├── .dockerignore ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── dist ├── cue-wasm-index.cjs ├── cue-wasm-index.cjs.map ├── cue-wasm-index.modern.js ├── cue-wasm-index.modern.js.map ├── cue-wasm-index.module.js ├── cue-wasm-index.module.js.map ├── cue.wasm.full.inline-41c9b744.js ├── cue.wasm.full.inline-41c9b744.js.map ├── cue.wasm.full.inline-71749b04.js ├── cue.wasm.full.inline-71749b04.js.map ├── wasm_exec.full-4a915ab6.js ├── wasm_exec.full-4a915ab6.js.map ├── wasm_exec.full-b3250e2a.js └── wasm_exec.full-b3250e2a.js.map ├── go.mod ├── go.sum ├── lib ├── index.js ├── polyfill.js └── wasm_exec.slim.cjs ├── main.go ├── package.json ├── scripts └── inline-wasm.sh ├── tests └── index.test.js └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | Dockerfile 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.wasm 2 | *.wasm.inline.js 3 | node_modules 4 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/golang:1.18-alpine AS build-go 2 | 3 | WORKDIR /src 4 | COPY . /src 5 | ENV GOGC=1000 6 | RUN GOOS=js GOARCH=wasm go build -o /src/lib/cue.wasm 7 | RUN /src/scripts/inline-wasm.sh 8 | 9 | FROM node:16-alpine AS build-node 10 | 11 | WORKDIR /src 12 | COPY . /src 13 | COPY --from=build-go /src/lib/cue.wasm.inline.js /src/lib/cue.wasm.full.inline.js 14 | COPY --from=build-go /usr/local/go/misc/wasm/wasm_exec.js /src/lib/wasm_exec.full.cjs 15 | 16 | RUN yarn install --frozen-lockfile 17 | RUN npx microbundle -f cjs,esm,modern 18 | 19 | # redact wasm from sourcemaps, no need to bundle twice 20 | RUN find /src/dist/cue.wasm.*.map -type f -exec sed -i -e 's|export default \\\".*\\\"|export default \\\"\\\"|g' {} \; 21 | 22 | FROM scratch 23 | 24 | COPY --from=build-node /src/dist / 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 dclareio 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Cue Wasm

4 | 5 |

6 | Wasm bindings for cue. Works with node 16+ and modern browsers thanks to microbundle 7 |

8 | 9 | 10 | 11 |

12 | 13 | contributors 14 | 15 | 16 | last update 17 | 18 | 19 | forks 20 | 21 | 22 | stars 23 | 24 | 25 | open issues 26 | 27 | 28 | license 29 | 30 |

31 | 32 |

33 | Documentation 34 | · 35 | Report Bug 36 | · 37 | Request Feature 38 |

39 |
40 | 41 |
42 | 43 | 44 | # :notebook_with_decorative_cover: Table of Contents 45 | 46 | - [Features](#dart-features) 47 | - [Getting Started](#toolbox-getting-started) 48 | * [Prerequisites](#bangbang-prerequisites) 49 | * [Installation](#gear-installation) 50 | * [Run Locally](#running-run-locally) 51 | - [Usage](#eyes-usage) 52 | - [Roadmap](#compass-roadmap) 53 | - [Contributing](#wave-contributing) 54 | * [Code of Conduct](#scroll-code-of-conduct) 55 | - [License](#warning-license) 56 | - [Contact](#handshake-contact) 57 | - [Acknowledgements](#gem-acknowledgements) 58 | 59 | 60 | 61 | ## :dart: Features 62 | 63 | - Cue to json `cue.toJSON()` 64 | - Cue to js object `cue.parse()` 65 | - Highly optimized - 2.1MB gzipped bundle size when using "slim" variant, 4.2MB for "full" 66 | 67 | ## :toolbox: Getting Started 68 | 69 | ### :gear: Installation 70 | 71 | Install cue-wasm with yarn 72 | 73 | ```bash 74 | yarn add cue-wasm 75 | ``` 76 | 77 | 78 | ### :running: Build Locally 79 | 80 | Clone the project 81 | 82 | ```bash 83 | git clone https://github.com/dclareio/cue-wasm.git 84 | ``` 85 | 86 | Go to the project directory 87 | 88 | ```bash 89 | cd cue-wasm 90 | ``` 91 | 92 | Install dependencies 93 | 94 | ```bash 95 | yarn 96 | ``` 97 | 98 | Build the library (requires docker) 99 | 100 | ```bash 101 | yarn build 102 | ``` 103 | 104 | 105 | 106 | ## :eyes: Usage 107 | 108 | ```javascript 109 | import CUE from 'cue-wasm' 110 | 111 | const cue = await CUE.init(); 112 | 113 | // basic API 114 | cue.parse('hello: "world"') // returns { hello: "world" } 115 | 116 | // Tagged template literals 117 | const mergeObj = { test: "test" } 118 | const obj = cue` 119 | key: "val" 120 | test: string 121 | ${mergeObj} 122 | `; // returns { test: "test", key: "val" } 123 | 124 | // note that for strings you'll need to quote them manually if you 125 | // don't want cue to interpret them literally. This allows dynamically 126 | // writing cue e.g. 127 | 128 | cue`test: ${"test"}` // evaluates `test: test` vs. 129 | cue`test: "${"test"}"` // evaluates `test: "test"` 130 | ``` 131 | 132 | 133 | ## :compass: Roadmap 134 | 135 | * [x] CUE -> JSON/JS 136 | * [X] CUE -> OpenAPI 137 | * [X] CUE -> JSONSchema 138 | * [X] CUE -> AST 139 | * [ ] CUE -> Typescripe Types 140 | * [ ] CUE -> Protobufs 141 | * [ ] JSON/JS -> CUE 142 | * [ ] JSONSchema -> CUE 143 | * [ ] Typescripe Types -> CUE 144 | * [ ] Protobufs -> CUE 145 | 146 | 147 | 157 | 158 | 159 | 160 | 163 | 164 | 165 | 166 | ## :warning: License 167 | 168 | Distributed under the MIT License. See LICENSE for more information. 169 | 170 | 171 | 172 | ## :handshake: Contact 173 | 174 | [@dclario](https://twitter.com/dclareio) - https://dclare.io - contact@dclare.io - **We do consulting!!** 175 | 176 | Project Link: [https://github.com/dclareio/cue-wasm](https://github.com/dclareio/cue-wasm) 177 | 178 | 179 | ## :gem: Acknowledgements 180 | 181 | - [CUE](https://github.com/cue-lang/cue) 182 | - [microbundle](https://github.com/developit/microbundle) 183 | -------------------------------------------------------------------------------- /dist/cue-wasm-index.modern.js: -------------------------------------------------------------------------------- 1 | import t from"@openapi-contrib/openapi-schema-to-json-schema";var e=function(t){null==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};e.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti>>30))>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0},e.prototype.init_by_array=function(t,e){var a,i,n;for(this.init_seed(19650218),a=1,i=0,n=this.N>e?this.N:e;n;n--)this.mt[a]=(this.mt[a]^(1664525*((4294901760&(r=this.mt[a-1]^this.mt[a-1]>>>30))>>>16)<<16)+1664525*(65535&r))+t[i]+i,this.mt[a]>>>=0,i++,++a>=this.N&&(this.mt[0]=this.mt[this.N-1],a=1),i>=e&&(i=0);for(n=this.N-1;n;n--){var r;this.mt[a]=(this.mt[a]^(1566083941*((4294901760&(r=this.mt[a-1]^this.mt[a-1]>>>30))>>>16)<<16)+1566083941*(65535&r))-a,this.mt[a]>>>=0,++a>=this.N&&(this.mt[0]=this.mt[this.N-1],a=1)}this.mt[0]=2147483648},e.prototype.random_int=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var a;for(this.mti==this.N+1&&this.init_seed(5489),a=0;a>>1^e[1&t];for(;a>>1^e[1&t];this.mt[this.N-1]=this.mt[this.M-1]^(t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK)>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,(t^=t>>>18)>>>0},e.prototype.random_int31=function(){return this.random_int()>>>1},e.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},e.prototype.random=function(){return this.random_int()*(1/4294967296)},e.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},e.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)};var a=new e(Math.random()*Number.MAX_SAFE_INTEGER);"undefined"==typeof global&&(window.global=window),global.crypto||(global.crypto={getRandomValues:function(t){for(var e=t.length;e--;)t[e]=Math.floor(256*a.random());return t}}),global.crypto.webcrypto&&(global.crypto=crypto.webcrypto);var i=Object.prototype.toString,n=Array.isArray,r=function(t){return"string"==typeof t||!n(t)&&function(t){return!!t&&"object"==typeof t}(t)&&"[object String]"==i.call(t)};function s(t){let e=t.length;for(;--e>=0;)t[e]=0}const o=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),l=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),d=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_=new Array(576);s(_);const c=new Array(60);s(c);const f=new Array(512);s(f);const u=new Array(256);s(u);const m=new Array(29);s(m);const w=new Array(30);function p(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}let b,g,k;function y(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}s(w);const v=t=>t<256?f[t]:f[256+(t>>>7)],x=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},A=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<{A(t,a[2*e],a[2*e+1])},E=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},S=(t,e,a)=>{const i=new Array(16);let n,r,s=0;for(n=1;n<=15;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=E(i[e]++,e))}},R=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},N=t=>{t.bi_valid>8?x(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},O=(t,e,a,i)=>{const n=2*e,r=2*a;return t[n]{const i=t.heap[a];let n=a<<1;for(;n<=t.heap_len&&(n{let i,n,r,s,h=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],n=t.pending_buf[t.l_buf+h],h++,0===i?z(t,n,e):(r=u[n],z(t,r+256+1,e),s=o[r],0!==s&&(n-=m[r],A(t,n,s)),i--,r=v(i),z(t,r,a),s=l[r],0!==s&&(i-=w[r],A(t,i,s)))}while(h{const a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;let s,o,l,h=-1;for(t.heap_len=0,t.heap_max=573,s=0;s>1;s>=1;s--)Z(t,a,s);l=r;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Z(t,a,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,a[2*l]=a[2*s]+a[2*o],t.depth[l]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,a[2*s+1]=a[2*o+1]=l,t.heap[1]=l++,Z(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,d,_,c,f,u,m=0;for(c=0;c<=15;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)d=t.heap[h],c=a[2*a[2*d+1]+1]+1,c>l&&(c=l,m++),a[2*d+1]=c,d>i||(t.bl_count[c]++,f=0,d>=o&&(f=s[d-o]),u=a[2*d],t.opt_len+=u*(c+f),r&&(t.static_len+=u*(n[2*d+1]+f)));if(0!==m){do{for(c=l-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[l]--,m-=2}while(m>0);for(c=l;0!==c;c--)for(d=t.bl_count[c];0!==d;)_=t.heap[--h],_>i||(a[2*_+1]!==c&&(t.opt_len+=(c-a[2*_+1])*a[2*_],a[2*_+1]=c),d--)}})(t,e),S(a,h,t.bl_count)},T=(t,e,a)=>{let i,n,r=-1,s=e[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=s,s=e[2*(i+1)+1],++o{let i,n,r=-1,s=e[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),i=0;i<=a;i++)if(n=s,s=e[2*(i+1)+1],!(++o{A(t,0+(i?1:0),3),((t,e,a,i)=>{N(t),x(t,a),x(t,~a),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a})(t,e,a)};var M={_tr_init:t=>{L||((()=>{let t,e,a,i,n;const r=new Array(16);for(a=0,i=0;i<28;i++)for(m[i]=a,t=0;t<1<>=7;i<30;i++)for(w[i]=n<<7,t=0;t<1<{let n,r,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),I(t,t.l_desc),I(t,t.d_desc),s=(t=>{let e;for(T(t,t.dyn_ltree,t.l_desc.max_code),T(t,t.dyn_dtree,t.d_desc.max_code),I(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*d[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),n=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=n&&(n=r)):n=r=a+5,a+4<=n&&-1!==e?F(t,e,a,i):4===t.strategy||r===n?(A(t,2+(i?1:0),3),U(t,_,c)):(A(t,4+(i?1:0),3),((t,e,a,i)=>{let n;for(A(t,e-257,5),A(t,a-1,5),A(t,i-4,4),n=0;n(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(u[a]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{A(t,2,3),z(t,256,_),(t=>{16===t.bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},B=(t,e,a,i)=>{let n=65535&t|0,r=t>>>16&65535|0,s=0;for(;0!==a;){s=a>2e3?2e3:a,a-=s;do{n=n+e[i++]|0,r=r+n|0}while(--s);n%=65521,r%=65521}return n|r<<16|0};const C=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var P=(t,e,a,i)=>{const n=C,r=i+a;t^=-1;for(let a=i;a>>8^n[255&(t^e[a])];return-1^t},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},H={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:K,_tr_stored_block:J,_tr_flush_block:W,_tr_tally:Y,_tr_align:X}=M,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:V,Z_FULL_FLUSH:q,Z_FINISH:Q,Z_BLOCK:$,Z_OK:tt,Z_STREAM_END:et,Z_STREAM_ERROR:at,Z_DATA_ERROR:it,Z_BUF_ERROR:nt,Z_DEFAULT_COMPRESSION:rt,Z_FILTERED:st,Z_HUFFMAN_ONLY:ot,Z_RLE:lt,Z_FIXED:ht,Z_UNKNOWN:dt,Z_DEFLATED:_t}=H,ct=(t,e)=>(t.msg=j[e],e),ft=t=>(t<<1)-(t>4?9:0),ut=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let mt=(t,e,a)=>(e<{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},pt=(t,e)=>{W(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,wt(t.strm)},bt=(t,e)=>{t.pending_buf[t.pending++]=e},gt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},kt=(t,e,a,i)=>{let n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=B(t.adler,e,n,a):2===t.state.wrap&&(t.adler=P(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n)},yt=(t,e)=>{let a,i,n=t.max_chain_length,r=t.strstart,s=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,d=t.w_mask,_=t.prev,c=t.strstart+258;let f=h[r+s-1],u=h[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+s]===u&&h[a+s-1]===f&&h[a]===h[r]&&h[++a]===h[r+1]){r+=2,a++;do{}while(h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&rs){if(t.match_start=e,s=i,i>=o)break;f=h[r+s-1],u=h[r+s]}}}while((e=_[e&d])>l&&0!=--n);return s<=t.lookahead?s:t.lookahead},vt=t=>{const e=t.w_size;let a,i,n,r,s;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,a=i;do{n=t.head[--a],t.head[a]=n>=e?n-e:0}while(--i);i=e,a=i;do{n=t.prev[--a],t.prev[a]=n>=e?n-e:0}while(--i);r+=e}if(0===t.strm.avail_in)break;if(i=kt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=mt(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=mt(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},xt=(t,e)=>{let a,i;for(;;){if(t.lookahead<262){if(vt(t),t.lookahead<262&&e===G)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-262&&(t.match_length=yt(t,a)),t.match_length>=3)if(i=Y(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=mt(t,t.ins_h,t.window[t.strstart+1]);else i=Y(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2},At=(t,e)=>{let a,i,n;for(;;){if(t.lookahead<262){if(vt(t),t.lookahead<262&&e===G)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=Y(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(pt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=Y(t,0,t.window[t.strstart-1]),i&&pt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=Y(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2};function zt(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n}const Et=[new zt(0,0,0,0,(t,e)=>{let a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(vt(t),0===t.lookahead&&e===G)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;const i=t.block_start+a;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,pt(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&pt(t,!1),1)}),new zt(4,4,8,4,xt),new zt(4,5,16,8,xt),new zt(4,6,32,32,xt),new zt(4,4,16,16,At),new zt(8,16,32,32,At),new zt(8,16,128,128,At),new zt(8,32,128,256,At),new zt(32,128,258,1024,At),new zt(32,258,258,4096,At)];function St(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_t,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ut(this.dyn_ltree),ut(this.dyn_dtree),ut(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ut(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ut(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Rt=(t,e)=>{let a,i;if(!t||!t.state||e>$||e<0)return t?ct(t,at):at;const n=t.state;if(!t.output||!t.input&&0!==t.avail_in||666===n.status&&e!==Q)return ct(t,0===t.avail_out?nt:at);n.strm=t;const r=n.last_flush;if(n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,bt(n,31),bt(n,139),bt(n,8),n.gzhead?(bt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),bt(n,255&n.gzhead.time),bt(n,n.gzhead.time>>8&255),bt(n,n.gzhead.time>>16&255),bt(n,n.gzhead.time>>24&255),bt(n,9===n.level?2:n.strategy>=ot||n.level<2?4:0),bt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(bt(n,255&n.gzhead.extra.length),bt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=P(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(bt(n,0),bt(n,0),bt(n,0),bt(n,0),bt(n,0),bt(n,9===n.level?2:n.strategy>=ot||n.level<2?4:0),bt(n,3),n.status=113);else{let e=_t+(n.w_bits-8<<4)<<8,a=-1;a=n.strategy>=ot||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=a<<6,0!==n.strstart&&(e|=32),e+=31-e%31,n.status=113,gt(n,e),0!==n.strstart&&(gt(n,t.adler>>>16),gt(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(a=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),wt(t),a=n.pending,n.pending!==n.pending_buf_size));)bt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),wt(t),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindexa&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),wt(t),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindexa&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&wt(t),n.pending+2<=n.pending_buf_size&&(bt(n,255&t.adler),bt(n,t.adler>>8&255),t.adler=0,n.status=113)):n.status=113),0!==n.pending){if(wt(t),0===t.avail_out)return n.last_flush=-1,tt}else if(0===t.avail_in&&ft(e)<=ft(r)&&e!==Q)return ct(t,nt);if(666===n.status&&0!==t.avail_in)return ct(t,nt);if(0!==t.avail_in||0!==n.lookahead||e!==G&&666!==n.status){let a=n.strategy===ot?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(vt(t),0===t.lookahead)){if(e===G)return 1;break}if(t.match_length=0,a=Y(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===lt?((t,e)=>{let a,i,n,r;const s=t.window;for(;;){if(t.lookahead<=258){if(vt(t),t.lookahead<=258&&e===G)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=s[n],i===s[++n]&&i===s[++n]&&i===s[++n])){r=t.strstart+258;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=Y(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=Y(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2})(n,e):Et[n.level].func(n,e);if(3!==a&&4!==a||(n.status=666),1===a||3===a)return 0===t.avail_out&&(n.last_flush=-1),tt;if(2===a&&(e===V?X(n):e!==$&&(J(n,0,0,!1),e===q&&(ut(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),wt(t),0===t.avail_out))return n.last_flush=-1,tt}return e!==Q?tt:n.wrap<=0?et:(2===n.wrap?(bt(n,255&t.adler),bt(n,t.adler>>8&255),bt(n,t.adler>>16&255),bt(n,t.adler>>24&255),bt(n,255&t.total_in),bt(n,t.total_in>>8&255),bt(n,t.total_in>>16&255),bt(n,t.total_in>>24&255)):(gt(n,t.adler>>>16),gt(n,65535&t.adler)),wt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?tt:et)},Nt=t=>{if(!t||!t.state)return at;const e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?ct(t,at):(t.state=null,113===e?ct(t,it):tt)};const Ot=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Zt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const e in a)Ot(a,e)&&(t[e]=a[e])}}return t},Ut=t=>{let e=0;for(let a=0,i=t.length;a=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Tt[254]=Tt[254]=1;var Dt=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,i,n,r,s=t.length,o=0;for(n=0;n>>6,e[r++]=128|63&a):a<65536?(e[r++]=224|a>>>12,e[r++]=128|a>>>6&63,e[r++]=128|63&a):(e[r++]=240|a>>>18,e[r++]=128|a>>>12&63,e[r++]=128|a>>>6&63,e[r++]=128|63&a);return e},Lt=(t,e)=>{const a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,n;const r=new Array(2*a);for(n=0,i=0;i4)r[n++]=65533,i+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&i1?r[n++]=65533:e<65536?r[n++]=e:(e-=65536,r[n++]=55296|e>>10&1023,r[n++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&It)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a="";for(let i=0;i{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Tt[t[a]]>e?a:e},Mt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Bt=Object.prototype.toString,{Z_NO_FLUSH:Ct,Z_SYNC_FLUSH:Pt,Z_FULL_FLUSH:jt,Z_FINISH:Ht,Z_OK:Kt,Z_STREAM_END:Jt,Z_DEFAULT_COMPRESSION:Wt,Z_DEFAULT_STRATEGY:Yt,Z_DEFLATED:Xt}=H;function Gt(t){this.options=Zt({level:Wt,method:Xt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mt,this.strm.avail_out=0;let a=((t,e,a,i,n,r)=>{if(!t)return at;let s=1;if(e===rt&&(e=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),n<1||n>9||a!==_t||i<8||i>15||e<0||e>9||r<0||r>ht)return ct(t,at);8===i&&(i=9);const o=new St;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=i,o.w_size=1<{const e=(t=>{if(!t||!t.state)return ct(t,at);t.total_in=t.total_out=0,t.data_type=dt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=G,K(e),tt})(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,ut(a.head),a.max_lazy_match=Et[a.level].max_lazy,a.good_match=Et[a.level].good_length,a.nice_match=Et[a.level].nice_length,a.max_chain_length=Et[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e})(t)})(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Kt)throw new Error(j[a]);if(e.header&&(i=this.strm)&&i.state&&(2!==i.state.wrap||(i.state.gzhead=e.header)),e.dictionary){let t;if(t="string"==typeof e.dictionary?Dt(e.dictionary):"[object ArrayBuffer]"===Bt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=((t,e)=>{let a=e.length;if(!t||!t.state)return at;const i=t.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return at;if(1===n&&(t.adler=B(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(ut(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(a-i.w_size,a),0),e=t,a=i.w_size}const r=t.avail_in,s=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,vt(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=mt(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,vt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=s,t.input=o,t.avail_in=r,i.wrap=n,tt})(this.strm,t),a!==Kt)throw new Error(j[a]);this._dict_set=!0}var i}function Vt(t,e){const a=new Gt(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result}Gt.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize;let n,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?Ht:Ct,a.input="string"==typeof t?Dt(t):"[object ArrayBuffer]"===Bt.call(t)?new Uint8Array(t):t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(r===Pt||r===jt)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Rt(a,r),n===Jt)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Nt(this.strm),this.onEnd(n),this.ended=!0,n===Kt;if(0!==a.avail_out){if(r>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},Gt.prototype.onData=function(t){this.chunks.push(t)},Gt.prototype.onEnd=function(t){t===Kt&&(this.result=Ut(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var qt={Deflate:Gt,deflate:Vt,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Vt(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Vt(t,e)},constants:H},Qt=function(t,e){let a,i,n,r,s,o,l,h,d,_,c,f,u,m,w,p,b,g,k,y,v,x,A,z;const E=t.state;a=t.next_in,A=t.input,i=a+(t.avail_in-5),n=t.next_out,z=t.output,r=n-(e-t.avail_out),s=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,c=E.hold,f=E.bits,u=E.lencode,m=E.distcode,w=(1<>>24,c>>>=g,f-=g,g=b>>>16&255,0===g)z[n++]=65535&b;else{if(!(16&g)){if(0==(64&g)){b=u[(65535&b)+(c&(1<>>=g,f-=g),f<15&&(c+=A[a++]<>>24,c>>>=g,f-=g,g=b>>>16&255,!(16&g)){if(0==(64&g)){b=m[(65535&b)+(c&(1<o){t.msg="invalid distance too far back",E.mode=30;break t}if(c>>>=g,f-=g,g=n-r,y>g){if(g=y-g,g>h&&E.sane){t.msg="invalid distance too far back",E.mode=30;break t}if(v=0,x=_,0===d){if(v+=l-g,g2;)z[n++]=x[v++],z[n++]=x[v++],z[n++]=x[v++],k-=3;k&&(z[n++]=x[v++],k>1&&(z[n++]=x[v++]))}else{v=n-y;do{z[n++]=z[v++],z[n++]=z[v++],z[n++]=z[v++],k-=3}while(k>2);k&&(z[n++]=z[v++],k>1&&(z[n++]=z[v++]))}break}}break}}while(a>3,a-=k,f-=k<<3,c&=(1<{const l=o.bits;let h,d,_,c,f,u,m=0,w=0,p=0,b=0,g=0,k=0,y=0,v=0,x=0,A=0,z=null,E=0;const S=new Uint16Array(16),R=new Uint16Array(16);let N,O,Z,U=null,I=0;for(m=0;m<=15;m++)S[m]=0;for(w=0;w=1&&0===S[b];b--);if(g>b&&(g=b),0===b)return n[r++]=20971520,n[r++]=20971520,o.bits=1,0;for(p=1;p0&&(0===t||1!==b))return-1;for(R[1]=0,m=1;m<15;m++)R[m+1]=R[m]+S[m];for(w=0;w852||2===t&&x>592)return 1;for(;;){N=m-y,s[w]u?(O=U[I+s[w]],Z=z[E+s[w]]):(O=96,Z=0),h=1<>y)+d]=N<<24|O<<16|Z|0}while(0!==d);for(h=1<>=1;if(0!==h?(A&=h-1,A+=h):A=0,w++,0==--S[m]){if(m===b)break;m=e[a+s[w]]}if(m>g&&(A&c)!==_){for(0===y&&(y=g),f+=p,k=m-y,v=1<852||2===t&&x>592)return 1;_=A&c,n[_]=g<<24|k<<16|f-r|0}}return 0!==A&&(n[f+A]=m-y<<24|64<<16|0),o.bits=g,0};const{Z_FINISH:ne,Z_BLOCK:re,Z_TREES:se,Z_OK:oe,Z_STREAM_END:le,Z_NEED_DICT:he,Z_STREAM_ERROR:de,Z_DATA_ERROR:_e,Z_MEM_ERROR:ce,Z_BUF_ERROR:fe,Z_DEFLATED:ue}=H,me=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function we(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const pe=t=>{if(!t||!t.state)return de;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,(t=>{if(!t||!t.state)return de;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,oe})(t)};let be,ge,ke=!0;const ye=t=>{if(ke){be=new Int32Array(512),ge=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ie(1,t.lens,0,288,be,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ie(2,t.lens,0,32,ge,0,t.work,{bits:5}),ke=!1}t.lencode=be,t.lenbits=9,t.distcode=ge,t.distbits=5},ve=(t,e,a,i)=>{let n;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(a-r.wsize,a),0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>i&&(n=i),r.window.set(e.subarray(a-i,a-i+n),r.wnext),(i-=n)?(r.window.set(e.subarray(a-i,a),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave{let a,i,n,r,s,o,l,h,d,_,c,f,u,m,w,p,b,g,k,y,v,x,A=0;const z=new Uint8Array(4);let E,S;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return de;a=t.state,12===a.mode&&(a.mode=13),s=t.next_out,n=t.output,l=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,c=l,x=oe;t:for(;;)switch(a.mode){case 1:if(0===a.wrap){a.mode=13;break}for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>>8&255,a.check=P(a.check,z,2,0),h=0,d=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=30;break}if((15&h)!==ue){t.msg="unknown compression method",a.mode=30;break}if(h>>>=4,d-=4,v=8+(15&h),0===a.wbits)a.wbits=v;else if(v>a.wbits){t.msg="invalid window size",a.mode=30;break}a.dmax=1<>8&1),512&a.flags&&(z[0]=255&h,z[1]=h>>>8&255,a.check=P(a.check,z,2,0)),h=0,d=0,a.mode=3;case 3:for(;d<32;){if(0===o)break t;o--,h+=i[r++]<>>8&255,z[2]=h>>>16&255,z[3]=h>>>24&255,a.check=P(a.check,z,4,0)),h=0,d=0,a.mode=4;case 4:for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>8),512&a.flags&&(z[0]=255&h,z[1]=h>>>8&255,a.check=P(a.check,z,2,0)),h=0,d=0,a.mode=5;case 5:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>>8&255,a.check=P(a.check,z,2,0)),h=0,d=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(f=a.length,f>o&&(f=o),f&&(a.head&&(v=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(r,r+f),v)),512&a.flags&&(a.check=P(a.check,i,f,r)),o-=f,r+=f,a.length-=f),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===o)break t;f=0;do{v=i[r+f++],a.head&&v&&a.length<65536&&(a.head.name+=String.fromCharCode(v))}while(v&&f>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=12;break;case 10:for(;d<32;){if(0===o)break t;o--,h+=i[r++]<>>=7&d,d-=7&d,a.mode=27;break}for(;d<3;){if(0===o)break t;o--,h+=i[r++]<>>=1,d-=1,3&h){case 0:a.mode=14;break;case 1:if(ye(a),a.mode=20,e===se){h>>>=2,d-=2;break t}break;case 2:a.mode=17;break;case 3:t.msg="invalid block type",a.mode=30}h>>>=2,d-=2;break;case 14:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&h,h=0,d=0,a.mode=15,e===se)break t;case 15:a.mode=16;case 16:if(f=a.length,f){if(f>o&&(f=o),f>l&&(f=l),0===f)break t;n.set(i.subarray(r,r+f),s),o-=f,r+=f,l-=f,s+=f,a.length-=f;break}a.mode=12;break;case 17:for(;d<14;){if(0===o)break t;o--,h+=i[r++]<>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=30;break}a.have=0,a.mode=18;case 18:for(;a.have>>=3,d-=3}for(;a.have<19;)a.lens[R[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=ie(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have>>24,p=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,h+=i[r++]<>>=w,d-=w,a.lens[a.have++]=b;else{if(16===b){for(S=w+2;d>>=w,d-=w,0===a.have){t.msg="invalid bit length repeat",a.mode=30;break}v=a.lens[a.have-1],f=3+(3&h),h>>>=2,d-=2}else if(17===b){for(S=w+3;d>>=w,d-=w,v=0,f=3+(7&h),h>>>=3,d-=3}else{for(S=w+7;d>>=w,d-=w,v=0,f=11+(127&h),h>>>=7,d-=7}if(a.have+f>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=30;break}for(;f--;)a.lens[a.have++]=v}}if(30===a.mode)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,E={bits:a.lenbits},x=ie(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=ie(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=30;break}if(a.mode=20,e===se)break t;case 20:a.mode=21;case 21:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=r,t.avail_in=o,a.hold=h,a.bits=d,Qt(t,c),s=t.next_out,n=t.output,l=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,12===a.mode&&(a.back=-1);break}for(a.back=0;A=a.lencode[h&(1<>>24,p=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,h+=i[r++]<>g)],w=A>>>24,p=A>>>16&255,b=65535&A,!(g+w<=d);){if(0===o)break t;o--,h+=i[r++]<>>=g,d-=g,a.back+=g}if(h>>>=w,d-=w,a.back+=w,a.length=b,0===p){a.mode=26;break}if(32&p){a.back=-1,a.mode=12;break}if(64&p){t.msg="invalid literal/length code",a.mode=30;break}a.extra=15&p,a.mode=22;case 22:if(a.extra){for(S=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;A=a.distcode[h&(1<>>24,p=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,h+=i[r++]<>g)],w=A>>>24,p=A>>>16&255,b=65535&A,!(g+w<=d);){if(0===o)break t;o--,h+=i[r++]<>>=g,d-=g,a.back+=g}if(h>>>=w,d-=w,a.back+=w,64&p){t.msg="invalid distance code",a.mode=30;break}a.offset=b,a.extra=15&p,a.mode=24;case 24:if(a.extra){for(S=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(0===l)break t;if(f=c-l,a.offset>f){if(f=a.offset-f,f>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=30;break}f>a.wnext?(f-=a.wnext,u=a.wsize-f):u=a.wnext-f,f>a.length&&(f=a.length),m=a.window}else m=n,u=s-a.offset,f=a.length;f>l&&(f=l),l-=f,a.length-=f;do{n[s++]=m[u++]}while(--f);0===a.length&&(a.mode=21);break;case 26:if(0===l)break t;n[s++]=a.length,l--,a.mode=21;break;case 27:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[r++]<{if(!t||!t.state)return de;let e=t.state;return e.window&&(e.window=null),t.state=null,oe},Ee=(t,e)=>{const a=e.length;let i,n,r;return t&&t.state?(i=t.state,0!==i.wrap&&11!==i.mode?de:11===i.mode&&(n=1,n=B(n,e,a,0),n!==i.check)?_e:(r=ve(t,e,a,a),r?(i.mode=31,ce):(i.havedict=1,oe))):de},Se=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Re=Object.prototype.toString,{Z_NO_FLUSH:Ne,Z_FINISH:Oe,Z_OK:Ze,Z_STREAM_END:Ue,Z_NEED_DICT:Ie,Z_STREAM_ERROR:Te,Z_DATA_ERROR:De,Z_MEM_ERROR:Le}=H;function Fe(t){this.options=Zt({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mt,this.strm.avail_out=0;let a=((t,e)=>{if(!t)return de;const a=new we;t.state=a,a.window=null;const i=((t,e)=>{let a;if(!t||!t.state)return de;const i=t.state;return e<0?(a=0,e=-e):(a=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?de:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,pe(t))})(t,e);return i!==oe&&(t.state=null),i})(this.strm,e.windowBits);if(a!==Ze)throw new Error(j[a]);if(this.header=new Se,((t,e)=>{if(!t||!t.state)return de;const a=t.state;0==(2&a.wrap)||(a.head=e,e.done=!1)})(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Dt(e.dictionary):"[object ArrayBuffer]"===Re.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=Ee(this.strm,e.dictionary),a!==Ze)))throw new Error(j[a])}function Me(t,e){const a=new Fe(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result}Fe.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let r,s,o;if(this.ended)return!1;for(s=e===~~e?e:!0===e?Oe:Ne,a.input="[object ArrayBuffer]"===Re.call(t)?new Uint8Array(t):t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),r=Ae(a,s),r===Ie&&n&&(r=Ee(a,n),r===Ze?r=Ae(a,s):r===De&&(r=Ie));a.avail_in>0&&r===Ue&&a.state.wrap>0&&0!==t[a.next_in];)xe(a),r=Ae(a,s);switch(r){case Te:case De:case Ie:case Le:return this.onEnd(r),this.ended=!0,!1}if(o=a.avail_out,a.next_out&&(0===a.avail_out||r===Ue))if("string"===this.options.to){let t=Ft(a.output,a.next_out),e=a.next_out-t,n=Lt(a.output,t);a.next_out=e,a.avail_out=i-e,e&&a.output.set(a.output.subarray(t,t+e),0),this.onData(n)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==Ze||0!==o){if(r===Ue)return r=ze(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},Fe.prototype.onData=function(t){this.chunks.push(t)},Fe.prototype.onEnd=function(t){t===Ze&&(this.result="string"===this.options.to?this.chunks.join(""):Ut(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Be={Inflate:Fe,inflate:Me,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Me(t,e)},ungzip:Me,constants:H};const{Deflate:Ce,deflate:Pe,deflateRaw:je,gzip:He}=qt,{Inflate:Ke,inflate:Je,inflateRaw:We,ungzip:Ye}=Be;var Xe={Deflate:Ce,deflate:Pe,deflateRaw:je,gzip:He,Inflate:Ke,inflate:Je,inflateRaw:We,ungzip:Ye,constants:H};global.CueWasmAPI={};const Ge=async()=>{if(CueWasmAPI.full&&CueWasmAPI.full.loaded)return CueWasmAPI.full;await import("./wasm_exec.full-4a915ab6.js");const e=await import("./cue.wasm.full.inline-41c9b744.js"),a=Buffer.from(e.default,"base64"),i=new Uint8Array(a),n=Xe.ungzip(i),s=new Go,{instance:o}=await WebAssembly.instantiate(n,s.importObject);s.run(o);const l=(t,...e)=>{const a=t.map((t,a)=>{let i=e[a];return i?(r(i)||(i=JSON.stringify(i)),t+i):t}).join("");return l.parse(a)};return l.toJSONImpl=CueWasmAPI._toJSONImpl,l.toOpenAPIImpl=CueWasmAPI._toOpenAPIImpl,l.toASTImpl=CueWasmAPI._toASTImpl,l.toJSON=t=>{Array.isArray(t)?t=(t=t.map(t=>r(t)?t:JSON.stringify(t))).join("\n"):r(t)||(t=JSON.stringify(t));const e=l.toJSONImpl(t);if(e&&e.error)throw e.error;return e.value},l.parse=t=>JSON.parse(l.toJSON(t)),l.toOpenAPI=t=>{Array.isArray(t)?t=(t=t.map(t=>r(t)?t:JSON.stringify(t))).join("\n"):r(t)||(t=JSON.stringify(t));const e=l.toOpenAPIImpl(t);if(e&&e.error)throw e.error;return e.value},l.parseSchema=e=>t(JSON.parse(l.toOpenAPI(e)).components.schemas),l.schema=(t,...e)=>{const a=t.map((t,a)=>{let i=e[a];return i?(r(i)||(i=JSON.stringify(i)),t+i):t}).join("");return l.parseSchema(a)},l.toAST=t=>{Array.isArray(t)?t=(t=t.map(t=>r(t)?t:JSON.stringify(t))).join("\n"):r(t)||(t=JSON.stringify(t));const e=l.toASTImpl(t);if(e&&e.error)throw e.error;return e.value},l.parseAST=t=>JSON.parse(l.toAST(t)),l.ast=(t,...e)=>{const a=t.map((t,a)=>{let i=e[a];return i?(r(i)||(i=JSON.stringify(i)),t+i):t}).join("");return l.parseAST(a)},CueWasmAPI.full=l,CueWasmAPI.full.loaded=!0,l};export{Ge as init}; 2 | //# sourceMappingURL=cue-wasm-index.modern.js.map 3 | -------------------------------------------------------------------------------- /dist/cue-wasm-index.module.js: -------------------------------------------------------------------------------- 1 | import t from"@openapi-contrib/openapi-schema-to-json-schema";var e=function(t){null==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};e.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti>>30))>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0},e.prototype.init_by_array=function(t,e){var a,i,n;for(this.init_seed(19650218),a=1,i=0,n=this.N>e?this.N:e;n;n--)this.mt[a]=(this.mt[a]^(1664525*((4294901760&(r=this.mt[a-1]^this.mt[a-1]>>>30))>>>16)<<16)+1664525*(65535&r))+t[i]+i,this.mt[a]>>>=0,i++,++a>=this.N&&(this.mt[0]=this.mt[this.N-1],a=1),i>=e&&(i=0);for(n=this.N-1;n;n--){var r;this.mt[a]=(this.mt[a]^(1566083941*((4294901760&(r=this.mt[a-1]^this.mt[a-1]>>>30))>>>16)<<16)+1566083941*(65535&r))-a,this.mt[a]>>>=0,++a>=this.N&&(this.mt[0]=this.mt[this.N-1],a=1)}this.mt[0]=2147483648},e.prototype.random_int=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var a;for(this.mti==this.N+1&&this.init_seed(5489),a=0;a>>1^e[1&t];for(;a>>1^e[1&t];this.mt[this.N-1]=this.mt[this.M-1]^(t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK)>>>1^e[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,(t^=t>>>18)>>>0},e.prototype.random_int31=function(){return this.random_int()>>>1},e.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},e.prototype.random=function(){return this.random_int()*(1/4294967296)},e.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},e.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)};var a=new e(Math.random()*Number.MAX_SAFE_INTEGER);"undefined"==typeof global&&(window.global=window),global.crypto||(global.crypto={getRandomValues:function(t){for(var e=t.length;e--;)t[e]=Math.floor(256*a.random());return t}}),global.crypto.webcrypto&&(global.crypto=crypto.webcrypto);var i=Object.prototype.toString,n=Array.isArray,r=function(t){return"string"==typeof t||!n(t)&&function(t){return!!t&&"object"==typeof t}(t)&&"[object String]"==i.call(t)};function s(t){let e=t.length;for(;--e>=0;)t[e]=0}const o=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),l=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),d=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_=new Array(576);s(_);const c=new Array(60);s(c);const f=new Array(512);s(f);const u=new Array(256);s(u);const m=new Array(29);s(m);const w=new Array(30);function p(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}let b,g,k;function v(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}s(w);const y=t=>t<256?f[t]:f[256+(t>>>7)],x=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},A=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<{A(t,a[2*e],a[2*e+1])},E=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},S=(t,e,a)=>{const i=new Array(16);let n,r,s=0;for(n=1;n<=15;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){let e=t[2*r+1];0!==e&&(t[2*r]=E(i[e]++,e))}},R=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},N=t=>{t.bi_valid>8?x(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},O=(t,e,a,i)=>{const n=2*e,r=2*a;return t[n]{const i=t.heap[a];let n=a<<1;for(;n<=t.heap_len&&(n{let i,n,r,s,h=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*h]<<8|t.pending_buf[t.d_buf+2*h+1],n=t.pending_buf[t.l_buf+h],h++,0===i?z(t,n,e):(r=u[n],z(t,r+256+1,e),s=o[r],0!==s&&(n-=m[r],A(t,n,s)),i--,r=y(i),z(t,r,a),s=l[r],0!==s&&(i-=w[r],A(t,i,s)))}while(h{const a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;let s,o,l,h=-1;for(t.heap_len=0,t.heap_max=573,s=0;s>1;s>=1;s--)Z(t,a,s);l=r;do{s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Z(t,a,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,a[2*l]=a[2*s]+a[2*o],t.depth[l]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,a[2*s+1]=a[2*o+1]=l,t.heap[1]=l++,Z(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,d,_,c,f,u,m=0;for(c=0;c<=15;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)d=t.heap[h],c=a[2*a[2*d+1]+1]+1,c>l&&(c=l,m++),a[2*d+1]=c,d>i||(t.bl_count[c]++,f=0,d>=o&&(f=s[d-o]),u=a[2*d],t.opt_len+=u*(c+f),r&&(t.static_len+=u*(n[2*d+1]+f)));if(0!==m){do{for(c=l-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[l]--,m-=2}while(m>0);for(c=l;0!==c;c--)for(d=t.bl_count[c];0!==d;)_=t.heap[--h],_>i||(a[2*_+1]!==c&&(t.opt_len+=(c-a[2*_+1])*a[2*_],a[2*_+1]=c),d--)}})(t,e),S(a,h,t.bl_count)},T=(t,e,a)=>{let i,n,r=-1,s=e[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=s,s=e[2*(i+1)+1],++o{let i,n,r=-1,s=e[1],o=0,l=7,h=4;for(0===s&&(l=138,h=3),i=0;i<=a;i++)if(n=s,s=e[2*(i+1)+1],!(++o{A(t,0+(i?1:0),3),((t,e,a,i)=>{N(t),x(t,a),x(t,~a),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a})(t,e,a)};var M={_tr_init:t=>{L||((()=>{let t,e,a,i,n;const r=new Array(16);for(a=0,i=0;i<28;i++)for(m[i]=a,t=0;t<1<>=7;i<30;i++)for(w[i]=n<<7,t=0;t<1<{let n,r,s=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),I(t,t.l_desc),I(t,t.d_desc),s=(t=>{let e;for(T(t,t.dyn_ltree,t.l_desc.max_code),T(t,t.dyn_dtree,t.d_desc.max_code),I(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*d[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),n=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=n&&(n=r)):n=r=a+5,a+4<=n&&-1!==e?F(t,e,a,i):4===t.strategy||r===n?(A(t,2+(i?1:0),3),U(t,_,c)):(A(t,4+(i?1:0),3),((t,e,a,i)=>{let n;for(A(t,e-257,5),A(t,a-1,5),A(t,i-4,4),n=0;n(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(u[a]+256+1)]++,t.dyn_dtree[2*y(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{A(t,2,3),z(t,256,_),(t=>{16===t.bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},B=(t,e,a,i)=>{let n=65535&t|0,r=t>>>16&65535|0,s=0;for(;0!==a;){s=a>2e3?2e3:a,a-=s;do{n=n+e[i++]|0,r=r+n|0}while(--s);n%=65521,r%=65521}return n|r<<16|0};const C=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var P=(t,e,a,i)=>{const n=C,r=i+a;t^=-1;for(let a=i;a>>8^n[255&(t^e[a])];return-1^t},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},H={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:K,_tr_stored_block:J,_tr_flush_block:W,_tr_tally:Y,_tr_align:X}=M,{Z_NO_FLUSH:G,Z_PARTIAL_FLUSH:V,Z_FULL_FLUSH:q,Z_FINISH:Q,Z_BLOCK:$,Z_OK:tt,Z_STREAM_END:et,Z_STREAM_ERROR:at,Z_DATA_ERROR:it,Z_BUF_ERROR:nt,Z_DEFAULT_COMPRESSION:rt,Z_FILTERED:st,Z_HUFFMAN_ONLY:ot,Z_RLE:lt,Z_FIXED:ht,Z_UNKNOWN:dt,Z_DEFLATED:_t}=H,ct=(t,e)=>(t.msg=j[e],e),ft=t=>(t<<1)-(t>4?9:0),ut=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let mt=(t,e,a)=>(e<{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},pt=(t,e)=>{W(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,wt(t.strm)},bt=(t,e)=>{t.pending_buf[t.pending++]=e},gt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},kt=(t,e,a,i)=>{let n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=B(t.adler,e,n,a):2===t.state.wrap&&(t.adler=P(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n)},vt=(t,e)=>{let a,i,n=t.max_chain_length,r=t.strstart,s=t.prev_length,o=t.nice_match;const l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,d=t.w_mask,_=t.prev,c=t.strstart+258;let f=h[r+s-1],u=h[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+s]===u&&h[a+s-1]===f&&h[a]===h[r]&&h[++a]===h[r+1]){r+=2,a++;do{}while(h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&h[++r]===h[++a]&&rs){if(t.match_start=e,s=i,i>=o)break;f=h[r+s-1],u=h[r+s]}}}while((e=_[e&d])>l&&0!=--n);return s<=t.lookahead?s:t.lookahead},yt=t=>{const e=t.w_size;let a,i,n,r,s;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,a=i;do{n=t.head[--a],t.head[a]=n>=e?n-e:0}while(--i);i=e,a=i;do{n=t.prev[--a],t.prev[a]=n>=e?n-e:0}while(--i);r+=e}if(0===t.strm.avail_in)break;if(i=kt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=i,t.lookahead+t.insert>=3)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=mt(t,t.ins_h,t.window[s+1]);t.insert&&(t.ins_h=mt(t,t.ins_h,t.window[s+3-1]),t.prev[s&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=s,s++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},xt=(t,e)=>{let a,i;for(;;){if(t.lookahead<262){if(yt(t),t.lookahead<262&&e===G)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-262&&(t.match_length=vt(t,a)),t.match_length>=3)if(i=Y(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=mt(t,t.ins_h,t.window[t.strstart+1]);else i=Y(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2},At=(t,e)=>{let a,i,n;for(;;){if(t.lookahead<262){if(yt(t),t.lookahead<262&&e===G)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=Y(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=mt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(pt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=Y(t,0,t.window[t.strstart-1]),i&&pt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=Y(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2};function zt(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n}const Et=[new zt(0,0,0,0,(t,e)=>{let a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(yt(t),0===t.lookahead&&e===G)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;const i=t.block_start+a;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,pt(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&pt(t,!1),1)}),new zt(4,4,8,4,xt),new zt(4,5,16,8,xt),new zt(4,6,32,32,xt),new zt(4,4,16,16,At),new zt(8,16,32,32,At),new zt(8,16,128,128,At),new zt(8,32,128,256,At),new zt(32,128,258,1024,At),new zt(32,258,258,4096,At)];function St(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_t,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ut(this.dyn_ltree),ut(this.dyn_dtree),ut(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ut(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ut(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Rt=(t,e)=>{let a,i;if(!t||!t.state||e>$||e<0)return t?ct(t,at):at;const n=t.state;if(!t.output||!t.input&&0!==t.avail_in||666===n.status&&e!==Q)return ct(t,0===t.avail_out?nt:at);n.strm=t;const r=n.last_flush;if(n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,bt(n,31),bt(n,139),bt(n,8),n.gzhead?(bt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),bt(n,255&n.gzhead.time),bt(n,n.gzhead.time>>8&255),bt(n,n.gzhead.time>>16&255),bt(n,n.gzhead.time>>24&255),bt(n,9===n.level?2:n.strategy>=ot||n.level<2?4:0),bt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(bt(n,255&n.gzhead.extra.length),bt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=P(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(bt(n,0),bt(n,0),bt(n,0),bt(n,0),bt(n,0),bt(n,9===n.level?2:n.strategy>=ot||n.level<2?4:0),bt(n,3),n.status=113);else{let e=_t+(n.w_bits-8<<4)<<8,a=-1;a=n.strategy>=ot||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=a<<6,0!==n.strstart&&(e|=32),e+=31-e%31,n.status=113,gt(n,e),0!==n.strstart&&(gt(n,t.adler>>>16),gt(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(a=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),wt(t),a=n.pending,n.pending!==n.pending_buf_size));)bt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),wt(t),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindexa&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){a=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>a&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),wt(t),a=n.pending,n.pending===n.pending_buf_size)){i=1;break}i=n.gzindexa&&(t.adler=P(t.adler,n.pending_buf,n.pending-a,a)),0===i&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&wt(t),n.pending+2<=n.pending_buf_size&&(bt(n,255&t.adler),bt(n,t.adler>>8&255),t.adler=0,n.status=113)):n.status=113),0!==n.pending){if(wt(t),0===t.avail_out)return n.last_flush=-1,tt}else if(0===t.avail_in&&ft(e)<=ft(r)&&e!==Q)return ct(t,nt);if(666===n.status&&0!==t.avail_in)return ct(t,nt);if(0!==t.avail_in||0!==n.lookahead||e!==G&&666!==n.status){let a=n.strategy===ot?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(yt(t),0===t.lookahead)){if(e===G)return 1;break}if(t.match_length=0,a=Y(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===lt?((t,e)=>{let a,i,n,r;const s=t.window;for(;;){if(t.lookahead<=258){if(yt(t),t.lookahead<=258&&e===G)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=s[n],i===s[++n]&&i===s[++n]&&i===s[++n])){r=t.strstart+258;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=Y(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=Y(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(pt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(pt(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(pt(t,!1),0===t.strm.avail_out)?1:2})(n,e):Et[n.level].func(n,e);if(3!==a&&4!==a||(n.status=666),1===a||3===a)return 0===t.avail_out&&(n.last_flush=-1),tt;if(2===a&&(e===V?X(n):e!==$&&(J(n,0,0,!1),e===q&&(ut(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),wt(t),0===t.avail_out))return n.last_flush=-1,tt}return e!==Q?tt:n.wrap<=0?et:(2===n.wrap?(bt(n,255&t.adler),bt(n,t.adler>>8&255),bt(n,t.adler>>16&255),bt(n,t.adler>>24&255),bt(n,255&t.total_in),bt(n,t.total_in>>8&255),bt(n,t.total_in>>16&255),bt(n,t.total_in>>24&255)):(gt(n,t.adler>>>16),gt(n,65535&t.adler)),wt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?tt:et)},Nt=t=>{if(!t||!t.state)return at;const e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?ct(t,at):(t.state=null,113===e?ct(t,it):tt)};const Ot=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Zt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const e in a)Ot(a,e)&&(t[e]=a[e])}}return t},Ut=t=>{let e=0;for(let a=0,i=t.length;a=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Tt[254]=Tt[254]=1;var Dt=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,i,n,r,s=t.length,o=0;for(n=0;n>>6,e[r++]=128|63&a):a<65536?(e[r++]=224|a>>>12,e[r++]=128|a>>>6&63,e[r++]=128|63&a):(e[r++]=240|a>>>18,e[r++]=128|a>>>12&63,e[r++]=128|a>>>6&63,e[r++]=128|63&a);return e},Lt=(t,e)=>{const a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,n;const r=new Array(2*a);for(n=0,i=0;i4)r[n++]=65533,i+=s-1;else{for(e&=2===s?31:3===s?15:7;s>1&&i1?r[n++]=65533:e<65536?r[n++]=e:(e-=65536,r[n++]=55296|e>>10&1023,r[n++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&It)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a="";for(let i=0;i{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Tt[t[a]]>e?a:e},Mt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Bt=Object.prototype.toString,{Z_NO_FLUSH:Ct,Z_SYNC_FLUSH:Pt,Z_FULL_FLUSH:jt,Z_FINISH:Ht,Z_OK:Kt,Z_STREAM_END:Jt,Z_DEFAULT_COMPRESSION:Wt,Z_DEFAULT_STRATEGY:Yt,Z_DEFLATED:Xt}=H;function Gt(t){this.options=Zt({level:Wt,method:Xt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Yt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mt,this.strm.avail_out=0;let a=((t,e,a,i,n,r)=>{if(!t)return at;let s=1;if(e===rt&&(e=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),n<1||n>9||a!==_t||i<8||i>15||e<0||e>9||r<0||r>ht)return ct(t,at);8===i&&(i=9);const o=new St;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=i,o.w_size=1<{const e=(t=>{if(!t||!t.state)return ct(t,at);t.total_in=t.total_out=0,t.data_type=dt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=G,K(e),tt})(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,ut(a.head),a.max_lazy_match=Et[a.level].max_lazy,a.good_match=Et[a.level].good_length,a.nice_match=Et[a.level].nice_length,a.max_chain_length=Et[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e})(t)})(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Kt)throw new Error(j[a]);if(e.header&&(i=this.strm)&&i.state&&(2!==i.state.wrap||(i.state.gzhead=e.header)),e.dictionary){let t;if(t="string"==typeof e.dictionary?Dt(e.dictionary):"[object ArrayBuffer]"===Bt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=((t,e)=>{let a=e.length;if(!t||!t.state)return at;const i=t.state,n=i.wrap;if(2===n||1===n&&42!==i.status||i.lookahead)return at;if(1===n&&(t.adler=B(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(ut(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(a-i.w_size,a),0),e=t,a=i.w_size}const r=t.avail_in,s=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,yt(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=mt(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,yt(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=s,t.input=o,t.avail_in=r,i.wrap=n,tt})(this.strm,t),a!==Kt)throw new Error(j[a]);this._dict_set=!0}var i}function Vt(t,e){const a=new Gt(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result}Gt.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize;let n,r;if(this.ended)return!1;for(r=e===~~e?e:!0===e?Ht:Ct,a.input="string"==typeof t?Dt(t):"[object ArrayBuffer]"===Bt.call(t)?new Uint8Array(t):t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(r===Pt||r===jt)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Rt(a,r),n===Jt)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Nt(this.strm),this.onEnd(n),this.ended=!0,n===Kt;if(0!==a.avail_out){if(r>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},Gt.prototype.onData=function(t){this.chunks.push(t)},Gt.prototype.onEnd=function(t){t===Kt&&(this.result=Ut(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var qt={Deflate:Gt,deflate:Vt,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Vt(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Vt(t,e)},constants:H},Qt=function(t,e){let a,i,n,r,s,o,l,h,d,_,c,f,u,m,w,p,b,g,k,v,y,x,A,z;const E=t.state;a=t.next_in,A=t.input,i=a+(t.avail_in-5),n=t.next_out,z=t.output,r=n-(e-t.avail_out),s=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,c=E.hold,f=E.bits,u=E.lencode,m=E.distcode,w=(1<>>24,c>>>=g,f-=g,g=b>>>16&255,0===g)z[n++]=65535&b;else{if(!(16&g)){if(0==(64&g)){b=u[(65535&b)+(c&(1<>>=g,f-=g),f<15&&(c+=A[a++]<>>24,c>>>=g,f-=g,g=b>>>16&255,!(16&g)){if(0==(64&g)){b=m[(65535&b)+(c&(1<o){t.msg="invalid distance too far back",E.mode=30;break t}if(c>>>=g,f-=g,g=n-r,v>g){if(g=v-g,g>h&&E.sane){t.msg="invalid distance too far back",E.mode=30;break t}if(y=0,x=_,0===d){if(y+=l-g,g2;)z[n++]=x[y++],z[n++]=x[y++],z[n++]=x[y++],k-=3;k&&(z[n++]=x[y++],k>1&&(z[n++]=x[y++]))}else{y=n-v;do{z[n++]=z[y++],z[n++]=z[y++],z[n++]=z[y++],k-=3}while(k>2);k&&(z[n++]=z[y++],k>1&&(z[n++]=z[y++]))}break}}break}}while(a>3,a-=k,f-=k<<3,c&=(1<{const l=o.bits;let h,d,_,c,f,u,m=0,w=0,p=0,b=0,g=0,k=0,v=0,y=0,x=0,A=0,z=null,E=0;const S=new Uint16Array(16),R=new Uint16Array(16);let N,O,Z,U=null,I=0;for(m=0;m<=15;m++)S[m]=0;for(w=0;w=1&&0===S[b];b--);if(g>b&&(g=b),0===b)return n[r++]=20971520,n[r++]=20971520,o.bits=1,0;for(p=1;p0&&(0===t||1!==b))return-1;for(R[1]=0,m=1;m<15;m++)R[m+1]=R[m]+S[m];for(w=0;w852||2===t&&x>592)return 1;for(;;){N=m-v,s[w]u?(O=U[I+s[w]],Z=z[E+s[w]]):(O=96,Z=0),h=1<>v)+d]=N<<24|O<<16|Z|0}while(0!==d);for(h=1<>=1;if(0!==h?(A&=h-1,A+=h):A=0,w++,0==--S[m]){if(m===b)break;m=e[a+s[w]]}if(m>g&&(A&c)!==_){for(0===v&&(v=g),f+=p,k=m-v,y=1<852||2===t&&x>592)return 1;_=A&c,n[_]=g<<24|k<<16|f-r|0}}return 0!==A&&(n[f+A]=m-v<<24|64<<16|0),o.bits=g,0};const{Z_FINISH:ne,Z_BLOCK:re,Z_TREES:se,Z_OK:oe,Z_STREAM_END:le,Z_NEED_DICT:he,Z_STREAM_ERROR:de,Z_DATA_ERROR:_e,Z_MEM_ERROR:ce,Z_BUF_ERROR:fe,Z_DEFLATED:ue}=H,me=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function we(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const pe=t=>{if(!t||!t.state)return de;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,(t=>{if(!t||!t.state)return de;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,oe})(t)};let be,ge,ke=!0;const ve=t=>{if(ke){be=new Int32Array(512),ge=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ie(1,t.lens,0,288,be,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ie(2,t.lens,0,32,ge,0,t.work,{bits:5}),ke=!1}t.lencode=be,t.lenbits=9,t.distcode=ge,t.distbits=5},ye=(t,e,a,i)=>{let n;const r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(r.window.set(e.subarray(a-r.wsize,a),0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>i&&(n=i),r.window.set(e.subarray(a-i,a-i+n),r.wnext),(i-=n)?(r.window.set(e.subarray(a-i,a),0),r.wnext=i,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave{let a,i,n,r,s,o,l,h,d,_,c,f,u,m,w,p,b,g,k,v,y,x,A=0;const z=new Uint8Array(4);let E,S;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return de;a=t.state,12===a.mode&&(a.mode=13),s=t.next_out,n=t.output,l=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,c=l,x=oe;t:for(;;)switch(a.mode){case 1:if(0===a.wrap){a.mode=13;break}for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>>8&255,a.check=P(a.check,z,2,0),h=0,d=0,a.mode=2;break}if(a.flags=0,a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=30;break}if((15&h)!==ue){t.msg="unknown compression method",a.mode=30;break}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits)a.wbits=y;else if(y>a.wbits){t.msg="invalid window size",a.mode=30;break}a.dmax=1<>8&1),512&a.flags&&(z[0]=255&h,z[1]=h>>>8&255,a.check=P(a.check,z,2,0)),h=0,d=0,a.mode=3;case 3:for(;d<32;){if(0===o)break t;o--,h+=i[r++]<>>8&255,z[2]=h>>>16&255,z[3]=h>>>24&255,a.check=P(a.check,z,4,0)),h=0,d=0,a.mode=4;case 4:for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>8),512&a.flags&&(z[0]=255&h,z[1]=h>>>8&255,a.check=P(a.check,z,2,0)),h=0,d=0,a.mode=5;case 5:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[r++]<>>8&255,a.check=P(a.check,z,2,0)),h=0,d=0}else a.head&&(a.head.extra=null);a.mode=6;case 6:if(1024&a.flags&&(f=a.length,f>o&&(f=o),f&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(r,r+f),y)),512&a.flags&&(a.check=P(a.check,i,f,r)),o-=f,r+=f,a.length-=f),a.length))break t;a.length=0,a.mode=7;case 7:if(2048&a.flags){if(0===o)break t;f=0;do{y=i[r+f++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y))}while(y&&f>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=12;break;case 10:for(;d<32;){if(0===o)break t;o--,h+=i[r++]<>>=7&d,d-=7&d,a.mode=27;break}for(;d<3;){if(0===o)break t;o--,h+=i[r++]<>>=1,d-=1,3&h){case 0:a.mode=14;break;case 1:if(ve(a),a.mode=20,e===se){h>>>=2,d-=2;break t}break;case 2:a.mode=17;break;case 3:t.msg="invalid block type",a.mode=30}h>>>=2,d-=2;break;case 14:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[r++]<>>16^65535)){t.msg="invalid stored block lengths",a.mode=30;break}if(a.length=65535&h,h=0,d=0,a.mode=15,e===se)break t;case 15:a.mode=16;case 16:if(f=a.length,f){if(f>o&&(f=o),f>l&&(f=l),0===f)break t;n.set(i.subarray(r,r+f),s),o-=f,r+=f,l-=f,s+=f,a.length-=f;break}a.mode=12;break;case 17:for(;d<14;){if(0===o)break t;o--,h+=i[r++]<>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=30;break}a.have=0,a.mode=18;case 18:for(;a.have>>=3,d-=3}for(;a.have<19;)a.lens[R[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=ie(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=30;break}a.have=0,a.mode=19;case 19:for(;a.have>>24,p=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,h+=i[r++]<>>=w,d-=w,a.lens[a.have++]=b;else{if(16===b){for(S=w+2;d>>=w,d-=w,0===a.have){t.msg="invalid bit length repeat",a.mode=30;break}y=a.lens[a.have-1],f=3+(3&h),h>>>=2,d-=2}else if(17===b){for(S=w+3;d>>=w,d-=w,y=0,f=3+(7&h),h>>>=3,d-=3}else{for(S=w+7;d>>=w,d-=w,y=0,f=11+(127&h),h>>>=7,d-=7}if(a.have+f>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=30;break}for(;f--;)a.lens[a.have++]=y}}if(30===a.mode)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=30;break}if(a.lenbits=9,E={bits:a.lenbits},x=ie(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=30;break}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=ie(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=30;break}if(a.mode=20,e===se)break t;case 20:a.mode=21;case 21:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=r,t.avail_in=o,a.hold=h,a.bits=d,Qt(t,c),s=t.next_out,n=t.output,l=t.avail_out,r=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,12===a.mode&&(a.back=-1);break}for(a.back=0;A=a.lencode[h&(1<>>24,p=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,h+=i[r++]<>g)],w=A>>>24,p=A>>>16&255,b=65535&A,!(g+w<=d);){if(0===o)break t;o--,h+=i[r++]<>>=g,d-=g,a.back+=g}if(h>>>=w,d-=w,a.back+=w,a.length=b,0===p){a.mode=26;break}if(32&p){a.back=-1,a.mode=12;break}if(64&p){t.msg="invalid literal/length code",a.mode=30;break}a.extra=15&p,a.mode=22;case 22:if(a.extra){for(S=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=23;case 23:for(;A=a.distcode[h&(1<>>24,p=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,h+=i[r++]<>g)],w=A>>>24,p=A>>>16&255,b=65535&A,!(g+w<=d);){if(0===o)break t;o--,h+=i[r++]<>>=g,d-=g,a.back+=g}if(h>>>=w,d-=w,a.back+=w,64&p){t.msg="invalid distance code",a.mode=30;break}a.offset=b,a.extra=15&p,a.mode=24;case 24:if(a.extra){for(S=a.extra;d>>=a.extra,d-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=30;break}a.mode=25;case 25:if(0===l)break t;if(f=c-l,a.offset>f){if(f=a.offset-f,f>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=30;break}f>a.wnext?(f-=a.wnext,u=a.wsize-f):u=a.wnext-f,f>a.length&&(f=a.length),m=a.window}else m=n,u=s-a.offset,f=a.length;f>l&&(f=l),l-=f,a.length-=f;do{n[s++]=m[u++]}while(--f);0===a.length&&(a.mode=21);break;case 26:if(0===l)break t;n[s++]=a.length,l--,a.mode=21;break;case 27:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[r++]<{if(!t||!t.state)return de;let e=t.state;return e.window&&(e.window=null),t.state=null,oe},Ee=(t,e)=>{const a=e.length;let i,n,r;return t&&t.state?(i=t.state,0!==i.wrap&&11!==i.mode?de:11===i.mode&&(n=1,n=B(n,e,a,0),n!==i.check)?_e:(r=ye(t,e,a,a),r?(i.mode=31,ce):(i.havedict=1,oe))):de},Se=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Re=Object.prototype.toString,{Z_NO_FLUSH:Ne,Z_FINISH:Oe,Z_OK:Ze,Z_STREAM_END:Ue,Z_NEED_DICT:Ie,Z_STREAM_ERROR:Te,Z_DATA_ERROR:De,Z_MEM_ERROR:Le}=H;function Fe(t){this.options=Zt({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mt,this.strm.avail_out=0;let a=((t,e)=>{if(!t)return de;const a=new we;t.state=a,a.window=null;const i=((t,e)=>{let a;if(!t||!t.state)return de;const i=t.state;return e<0?(a=0,e=-e):(a=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?de:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,pe(t))})(t,e);return i!==oe&&(t.state=null),i})(this.strm,e.windowBits);if(a!==Ze)throw new Error(j[a]);if(this.header=new Se,((t,e)=>{if(!t||!t.state)return de;const a=t.state;0==(2&a.wrap)||(a.head=e,e.done=!1)})(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Dt(e.dictionary):"[object ArrayBuffer]"===Re.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=Ee(this.strm,e.dictionary),a!==Ze)))throw new Error(j[a])}function Me(t,e){const a=new Fe(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result}Fe.prototype.push=function(t,e){const a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let r,s,o;if(this.ended)return!1;for(s=e===~~e?e:!0===e?Oe:Ne,a.input="[object ArrayBuffer]"===Re.call(t)?new Uint8Array(t):t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),r=Ae(a,s),r===Ie&&n&&(r=Ee(a,n),r===Ze?r=Ae(a,s):r===De&&(r=Ie));a.avail_in>0&&r===Ue&&a.state.wrap>0&&0!==t[a.next_in];)xe(a),r=Ae(a,s);switch(r){case Te:case De:case Ie:case Le:return this.onEnd(r),this.ended=!0,!1}if(o=a.avail_out,a.next_out&&(0===a.avail_out||r===Ue))if("string"===this.options.to){let t=Ft(a.output,a.next_out),e=a.next_out-t,n=Lt(a.output,t);a.next_out=e,a.avail_out=i-e,e&&a.output.set(a.output.subarray(t,t+e),0),this.onData(n)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==Ze||0!==o){if(r===Ue)return r=ze(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},Fe.prototype.onData=function(t){this.chunks.push(t)},Fe.prototype.onEnd=function(t){t===Ze&&(this.result="string"===this.options.to?this.chunks.join(""):Ut(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Be={Inflate:Fe,inflate:Me,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Me(t,e)},ungzip:Me,constants:H};const{Deflate:Ce,deflate:Pe,deflateRaw:je,gzip:He}=qt,{Inflate:Ke,inflate:Je,inflateRaw:We,ungzip:Ye}=Be;var Xe={Deflate:Ce,deflate:Pe,deflateRaw:je,gzip:He,Inflate:Ke,inflate:Je,inflateRaw:We,ungzip:Ye,constants:H};global.CueWasmAPI={};var Ge=function(){try{return CueWasmAPI.full&&CueWasmAPI.full.loaded?Promise.resolve(CueWasmAPI.full):Promise.resolve(import("./wasm_exec.full-4a915ab6.js")).then(function(){return Promise.resolve(import("./cue.wasm.full.inline-41c9b744.js")).then(function(e){var a=Buffer.from(e.default,"base64"),i=new Uint8Array(a),n=Xe.ungzip(i),s=new Go;return Promise.resolve(WebAssembly.instantiate(n,s.importObject)).then(function(e){s.run(e.instance);var a=function t(e){var a=arguments,i=e.map(function(t,e){var i=[].slice.call(a,1)[e];return i?(r(i)||(i=JSON.stringify(i)),t+i):t}).join("");return t.parse(i)};return a.toJSONImpl=CueWasmAPI._toJSONImpl,a.toOpenAPIImpl=CueWasmAPI._toOpenAPIImpl,a.toASTImpl=CueWasmAPI._toASTImpl,a.toJSON=function(t){Array.isArray(t)?t=(t=t.map(function(t){return r(t)?t:JSON.stringify(t)})).join("\n"):r(t)||(t=JSON.stringify(t));var e=a.toJSONImpl(t);if(e&&e.error)throw e.error;return e.value},a.parse=function(t){return JSON.parse(a.toJSON(t))},a.toOpenAPI=function(t){Array.isArray(t)?t=(t=t.map(function(t){return r(t)?t:JSON.stringify(t)})).join("\n"):r(t)||(t=JSON.stringify(t));var e=a.toOpenAPIImpl(t);if(e&&e.error)throw e.error;return e.value},a.parseSchema=function(e){return t(JSON.parse(a.toOpenAPI(e)).components.schemas)},a.schema=function(t){var e=arguments,i=t.map(function(t,a){var i=[].slice.call(e,1)[a];return i?(r(i)||(i=JSON.stringify(i)),t+i):t}).join("");return a.parseSchema(i)},a.toAST=function(t){Array.isArray(t)?t=(t=t.map(function(t){return r(t)?t:JSON.stringify(t)})).join("\n"):r(t)||(t=JSON.stringify(t));var e=a.toASTImpl(t);if(e&&e.error)throw e.error;return e.value},a.parseAST=function(t){return JSON.parse(a.toAST(t))},a.ast=function(t){var e=arguments,i=t.map(function(t,a){var i=[].slice.call(e,1)[a];return i?(r(i)||(i=JSON.stringify(i)),t+i):t}).join("");return a.parseAST(i)},CueWasmAPI.full=a,CueWasmAPI.full.loaded=!0,a})})})}catch(t){return Promise.reject(t)}};export{Ge as init}; 2 | //# sourceMappingURL=cue-wasm-index.module.js.map 3 | -------------------------------------------------------------------------------- /dist/cue.wasm.full.inline-41c9b744.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cue.wasm.full.inline-41c9b744.js","sources":["../lib/cue.wasm.full.inline.js"],"sourcesContent":["export default \"\"\n"],"names":["cue_wasm_full_inline"],"mappings":"AAAA,IAAAA,EAAe"} -------------------------------------------------------------------------------- /dist/cue.wasm.full.inline-71749b04.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"cue.wasm.full.inline-71749b04.js","sources":["../lib/cue.wasm.full.inline.js"],"sourcesContent":["export default \"\"\n"],"names":[],"mappings":"gBAAe"} -------------------------------------------------------------------------------- /dist/wasm_exec.full-4a915ab6.js: -------------------------------------------------------------------------------- 1 | (()=>{const e=()=>{const e=new Error("not implemented");return e.code="ENOSYS",e};if(!globalThis.fs){let t="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(e,i){t+=s.decode(i);const n=t.lastIndexOf("\n");return-1!=n&&(console.log(t.substr(0,n)),t=t.substr(n+1)),i.length},write(t,s,i,n,o,r){0===i&&n===s.length&&null===o?r(null,this.writeSync(t,s)):r(e())},chmod(t,s,i){i(e())},chown(t,s,i,n){n(e())},close(t,s){s(e())},fchmod(t,s,i){i(e())},fchown(t,s,i,n){n(e())},fstat(t,s){s(e())},fsync(e,t){t(null)},ftruncate(t,s,i){i(e())},lchown(t,s,i,n){n(e())},link(t,s,i){i(e())},lstat(t,s){s(e())},mkdir(t,s,i){i(e())},open(t,s,i,n){n(e())},read(t,s,i,n,o,r){r(e())},readdir(t,s){s(e())},readlink(t,s){s(e())},rename(t,s,i){i(e())},rmdir(t,s){s(e())},stat(t,s){s(e())},symlink(t,s,i){i(e())},truncate(t,s,i){i(e())},unlink(t,s){s(e())},utimes(t,s,i,n){n(e())}}}if(globalThis.process||(globalThis.process={getuid:()=>-1,getgid:()=>-1,geteuid:()=>-1,getegid:()=>-1,getgroups(){throw e()},pid:-1,ppid:-1,umask(){throw e()},cwd(){throw e()},chdir(){throw e()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const t=new TextEncoder("utf-8"),s=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{0!==e&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const e=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=e=>this.mem.getUint32(e+0,!0)+4294967296*this.mem.getInt32(e+4,!0),n=e=>{const t=this.mem.getFloat64(e,!0);if(0===t)return;if(!isNaN(t))return t;const s=this.mem.getUint32(e,!0);return this._values[s]},o=(e,t)=>{const s=2146959360;if("number"==typeof t&&0!==t)return isNaN(t)?(this.mem.setUint32(e+4,s,!0),void this.mem.setUint32(e,0,!0)):void this.mem.setFloat64(e,t,!0);if(void 0===t)return void this.mem.setFloat64(e,0,!0);let i=this._ids.get(t);void 0===i&&(i=this._idPool.pop(),void 0===i&&(i=this._values.length),this._values[i]=t,this._goRefCounts[i]=0,this._ids.set(t,i)),this._goRefCounts[i]++;let n=0;switch(typeof t){case"object":null!==t&&(n=1);break;case"string":n=2;break;case"symbol":n=3;break;case"function":n=4}this.mem.setUint32(e+4,s|n,!0),this.mem.setUint32(e,i,!0)},r=e=>{const t=i(e+0),s=i(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,s)},l=e=>{const t=i(e+0),s=i(e+8),o=new Array(s);for(let e=0;e{const t=i(e+0),n=i(e+8);return s.decode(new DataView(this._inst.exports.mem.buffer,t,n))},h=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{const t=this.mem.getInt32(8+(e>>>=0),!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{const t=i(8+(e>>>=0)),s=i(e+16),n=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,s,n))},"runtime.resetMemoryDataView":e=>{this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":t=>{e(8+(t>>>=0),1e6*(h+performance.now()))},"runtime.walltime":t=>{t>>>=0;const s=(new Date).getTime();e(t+8,s/1e3),this.mem.setInt32(t+16,s%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},i(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{const t=this.mem.getInt32(8+(e>>>=0),!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{crypto.getRandomValues(r(8+(e>>>=0)))},"syscall/js.finalizeRef":e=>{const t=this.mem.getUint32(8+(e>>>=0),!0);if(this._goRefCounts[t]--,0===this._goRefCounts[t]){const e=this._values[t];this._values[t]=null,this._ids.delete(e),this._idPool.push(t)}},"syscall/js.stringVal":e=>{o(24+(e>>>=0),a(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(n(e+8),a(e+16));e=this._inst.exports.getsp()>>>0,o(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(n(e+8),a(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(n(e+8),a(e+16))},"syscall/js.valueIndex":e=>{o(24+(e>>>=0),Reflect.get(n(e+8),i(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(n(e+8),i(e+16),n(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=n(e+8),s=Reflect.get(t,a(e+16)),i=l(e+32),r=Reflect.apply(s,t,i);e=this._inst.exports.getsp()>>>0,o(e+56,r),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=n(e+8),s=l(e+16),i=Reflect.apply(t,void 0,s);e=this._inst.exports.getsp()>>>0,o(e+40,i),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=n(e+8),s=l(e+16),i=Reflect.construct(t,s);e=this._inst.exports.getsp()>>>0,o(e+40,i),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":t=>{e(16+(t>>>=0),parseInt(n(t+8).length))},"syscall/js.valuePrepareString":s=>{s>>>=0;const i=t.encode(String(n(s+8)));o(s+16,i),e(s+24,i.length)},"syscall/js.valueLoadString":e=>{const t=n(8+(e>>>=0));r(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{this.mem.setUint8(24+(e>>>=0),n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":t=>{const s=r(8+(t>>>=0)),i=n(t+32);if(!(i instanceof Uint8Array||i instanceof Uint8ClampedArray))return void this.mem.setUint8(t+48,0);const o=i.subarray(0,s.length);s.set(o),e(t+40,o.length),this.mem.setUint8(t+48,1)},"syscall/js.copyBytesToJS":t=>{const s=n(8+(t>>>=0)),i=r(t+16);if(!(s instanceof Uint8Array||s instanceof Uint8ClampedArray))return void this.mem.setUint8(t+48,0);const o=i.subarray(0,s.length);s.set(o),e(t+40,o.length),this.mem.setUint8(t+48,1)},debug:e=>{console.log(e)}}}}async run(e){if(!(e instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=e,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(Infinity),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let s=4096;const i=e=>{const i=s,n=t.encode(e+"\0");return new Uint8Array(this.mem.buffer,s,n.length).set(n),s+=n.length,s%8!=0&&(s+=8-s%8),i},n=this.argv.length,o=[];this.argv.forEach(e=>{o.push(i(e))}),o.push(0),Object.keys(this.env).sort().forEach(e=>{o.push(i(`${e}=${this.env[e]}`))}),o.push(0);const r=s;if(o.forEach(e=>{this.mem.setUint32(s,e,!0),this.mem.setUint32(s+4,0,!0),s+=8}),s>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,r),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(e){const t=this;return function(){const s={id:e,this:this,args:arguments};return t._pendingEvent=s,t._resume(),s.result}}}})(); 2 | //# sourceMappingURL=wasm_exec.full-4a915ab6.js.map 3 | -------------------------------------------------------------------------------- /dist/wasm_exec.full-4a915ab6.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"wasm_exec.full-4a915ab6.js","sources":["../lib/wasm_exec.full.cjs"],"sourcesContent":["// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n\"use strict\";\n\n(() => {\n\tconst enosys = () => {\n\t\tconst err = new Error(\"not implemented\");\n\t\terr.code = \"ENOSYS\";\n\t\treturn err;\n\t};\n\n\tif (!globalThis.fs) {\n\t\tlet outputBuf = \"\";\n\t\tglobalThis.fs = {\n\t\t\tconstants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused\n\t\t\twriteSync(fd, buf) {\n\t\t\t\toutputBuf += decoder.decode(buf);\n\t\t\t\tconst nl = outputBuf.lastIndexOf(\"\\n\");\n\t\t\t\tif (nl != -1) {\n\t\t\t\t\tconsole.log(outputBuf.substr(0, nl));\n\t\t\t\t\toutputBuf = outputBuf.substr(nl + 1);\n\t\t\t\t}\n\t\t\t\treturn buf.length;\n\t\t\t},\n\t\t\twrite(fd, buf, offset, length, position, callback) {\n\t\t\t\tif (offset !== 0 || length !== buf.length || position !== null) {\n\t\t\t\t\tcallback(enosys());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst n = this.writeSync(fd, buf);\n\t\t\t\tcallback(null, n);\n\t\t\t},\n\t\t\tchmod(path, mode, callback) { callback(enosys()); },\n\t\t\tchown(path, uid, gid, callback) { callback(enosys()); },\n\t\t\tclose(fd, callback) { callback(enosys()); },\n\t\t\tfchmod(fd, mode, callback) { callback(enosys()); },\n\t\t\tfchown(fd, uid, gid, callback) { callback(enosys()); },\n\t\t\tfstat(fd, callback) { callback(enosys()); },\n\t\t\tfsync(fd, callback) { callback(null); },\n\t\t\tftruncate(fd, length, callback) { callback(enosys()); },\n\t\t\tlchown(path, uid, gid, callback) { callback(enosys()); },\n\t\t\tlink(path, link, callback) { callback(enosys()); },\n\t\t\tlstat(path, callback) { callback(enosys()); },\n\t\t\tmkdir(path, perm, callback) { callback(enosys()); },\n\t\t\topen(path, flags, mode, callback) { callback(enosys()); },\n\t\t\tread(fd, buffer, offset, length, position, callback) { callback(enosys()); },\n\t\t\treaddir(path, callback) { callback(enosys()); },\n\t\t\treadlink(path, callback) { callback(enosys()); },\n\t\t\trename(from, to, callback) { callback(enosys()); },\n\t\t\trmdir(path, callback) { callback(enosys()); },\n\t\t\tstat(path, callback) { callback(enosys()); },\n\t\t\tsymlink(path, link, callback) { callback(enosys()); },\n\t\t\ttruncate(path, length, callback) { callback(enosys()); },\n\t\t\tunlink(path, callback) { callback(enosys()); },\n\t\t\tutimes(path, atime, mtime, callback) { callback(enosys()); },\n\t\t};\n\t}\n\n\tif (!globalThis.process) {\n\t\tglobalThis.process = {\n\t\t\tgetuid() { return -1; },\n\t\t\tgetgid() { return -1; },\n\t\t\tgeteuid() { return -1; },\n\t\t\tgetegid() { return -1; },\n\t\t\tgetgroups() { throw enosys(); },\n\t\t\tpid: -1,\n\t\t\tppid: -1,\n\t\t\tumask() { throw enosys(); },\n\t\t\tcwd() { throw enosys(); },\n\t\t\tchdir() { throw enosys(); },\n\t\t}\n\t}\n\n\tif (!globalThis.crypto) {\n\t\tthrow new Error(\"globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)\");\n\t}\n\n\tif (!globalThis.performance) {\n\t\tthrow new Error(\"globalThis.performance is not available, polyfill required (performance.now only)\");\n\t}\n\n\tif (!globalThis.TextEncoder) {\n\t\tthrow new Error(\"globalThis.TextEncoder is not available, polyfill required\");\n\t}\n\n\tif (!globalThis.TextDecoder) {\n\t\tthrow new Error(\"globalThis.TextDecoder is not available, polyfill required\");\n\t}\n\n\tconst encoder = new TextEncoder(\"utf-8\");\n\tconst decoder = new TextDecoder(\"utf-8\");\n\n\tglobalThis.Go = class {\n\t\tconstructor() {\n\t\t\tthis.argv = [\"js\"];\n\t\t\tthis.env = {};\n\t\t\tthis.exit = (code) => {\n\t\t\t\tif (code !== 0) {\n\t\t\t\t\tconsole.warn(\"exit code:\", code);\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis._exitPromise = new Promise((resolve) => {\n\t\t\t\tthis._resolveExitPromise = resolve;\n\t\t\t});\n\t\t\tthis._pendingEvent = null;\n\t\t\tthis._scheduledTimeouts = new Map();\n\t\t\tthis._nextCallbackTimeoutID = 1;\n\n\t\t\tconst setInt64 = (addr, v) => {\n\t\t\t\tthis.mem.setUint32(addr + 0, v, true);\n\t\t\t\tthis.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n\t\t\t}\n\n\t\t\tconst getInt64 = (addr) => {\n\t\t\t\tconst low = this.mem.getUint32(addr + 0, true);\n\t\t\t\tconst high = this.mem.getInt32(addr + 4, true);\n\t\t\t\treturn low + high * 4294967296;\n\t\t\t}\n\n\t\t\tconst loadValue = (addr) => {\n\t\t\t\tconst f = this.mem.getFloat64(addr, true);\n\t\t\t\tif (f === 0) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (!isNaN(f)) {\n\t\t\t\t\treturn f;\n\t\t\t\t}\n\n\t\t\t\tconst id = this.mem.getUint32(addr, true);\n\t\t\t\treturn this._values[id];\n\t\t\t}\n\n\t\t\tconst storeValue = (addr, v) => {\n\t\t\t\tconst nanHead = 0x7FF80000;\n\n\t\t\t\tif (typeof v === \"number\" && v !== 0) {\n\t\t\t\t\tif (isNaN(v)) {\n\t\t\t\t\t\tthis.mem.setUint32(addr + 4, nanHead, true);\n\t\t\t\t\t\tthis.mem.setUint32(addr, 0, true);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.mem.setFloat64(addr, v, true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (v === undefined) {\n\t\t\t\t\tthis.mem.setFloat64(addr, 0, true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet id = this._ids.get(v);\n\t\t\t\tif (id === undefined) {\n\t\t\t\t\tid = this._idPool.pop();\n\t\t\t\t\tif (id === undefined) {\n\t\t\t\t\t\tid = this._values.length;\n\t\t\t\t\t}\n\t\t\t\t\tthis._values[id] = v;\n\t\t\t\t\tthis._goRefCounts[id] = 0;\n\t\t\t\t\tthis._ids.set(v, id);\n\t\t\t\t}\n\t\t\t\tthis._goRefCounts[id]++;\n\t\t\t\tlet typeFlag = 0;\n\t\t\t\tswitch (typeof v) {\n\t\t\t\t\tcase \"object\":\n\t\t\t\t\t\tif (v !== null) {\n\t\t\t\t\t\t\ttypeFlag = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"string\":\n\t\t\t\t\t\ttypeFlag = 2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"symbol\":\n\t\t\t\t\t\ttypeFlag = 3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"function\":\n\t\t\t\t\t\ttypeFlag = 4;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tthis.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n\t\t\t\tthis.mem.setUint32(addr, id, true);\n\t\t\t}\n\n\t\t\tconst loadSlice = (addr) => {\n\t\t\t\tconst array = getInt64(addr + 0);\n\t\t\t\tconst len = getInt64(addr + 8);\n\t\t\t\treturn new Uint8Array(this._inst.exports.mem.buffer, array, len);\n\t\t\t}\n\n\t\t\tconst loadSliceOfValues = (addr) => {\n\t\t\t\tconst array = getInt64(addr + 0);\n\t\t\t\tconst len = getInt64(addr + 8);\n\t\t\t\tconst a = new Array(len);\n\t\t\t\tfor (let i = 0; i < len; i++) {\n\t\t\t\t\ta[i] = loadValue(array + i * 8);\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t}\n\n\t\t\tconst loadString = (addr) => {\n\t\t\t\tconst saddr = getInt64(addr + 0);\n\t\t\t\tconst len = getInt64(addr + 8);\n\t\t\t\treturn decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n\t\t\t}\n\n\t\t\tconst timeOrigin = Date.now() - performance.now();\n\t\t\tthis.importObject = {\n\t\t\t\tgo: {\n\t\t\t\t\t// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n\t\t\t\t\t// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n\t\t\t\t\t// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n\t\t\t\t\t// This changes the SP, thus we have to update the SP used by the imported function.\n\n\t\t\t\t\t// func wasmExit(code int32)\n\t\t\t\t\t\"runtime.wasmExit\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst code = this.mem.getInt32(sp + 8, true);\n\t\t\t\t\t\tthis.exited = true;\n\t\t\t\t\t\tdelete this._inst;\n\t\t\t\t\t\tdelete this._values;\n\t\t\t\t\t\tdelete this._goRefCounts;\n\t\t\t\t\t\tdelete this._ids;\n\t\t\t\t\t\tdelete this._idPool;\n\t\t\t\t\t\tthis.exit(code);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n\t\t\t\t\t\"runtime.wasmWrite\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst fd = getInt64(sp + 8);\n\t\t\t\t\t\tconst p = getInt64(sp + 16);\n\t\t\t\t\t\tconst n = this.mem.getInt32(sp + 24, true);\n\t\t\t\t\t\tfs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func resetMemoryDataView()\n\t\t\t\t\t\"runtime.resetMemoryDataView\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tthis.mem = new DataView(this._inst.exports.mem.buffer);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func nanotime1() int64\n\t\t\t\t\t\"runtime.nanotime1\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tsetInt64(sp + 8, (timeOrigin + performance.now()) * 1000000);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func walltime() (sec int64, nsec int32)\n\t\t\t\t\t\"runtime.walltime\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst msec = (new Date).getTime();\n\t\t\t\t\t\tsetInt64(sp + 8, msec / 1000);\n\t\t\t\t\t\tthis.mem.setInt32(sp + 16, (msec % 1000) * 1000000, true);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func scheduleTimeoutEvent(delay int64) int32\n\t\t\t\t\t\"runtime.scheduleTimeoutEvent\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst id = this._nextCallbackTimeoutID;\n\t\t\t\t\t\tthis._nextCallbackTimeoutID++;\n\t\t\t\t\t\tthis._scheduledTimeouts.set(id, setTimeout(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tthis._resume();\n\t\t\t\t\t\t\t\twhile (this._scheduledTimeouts.has(id)) {\n\t\t\t\t\t\t\t\t\t// for some reason Go failed to register the timeout event, log and try again\n\t\t\t\t\t\t\t\t\t// (temporary workaround for https://github.com/golang/go/issues/28975)\n\t\t\t\t\t\t\t\t\tconsole.warn(\"scheduleTimeoutEvent: missed timeout event\");\n\t\t\t\t\t\t\t\t\tthis._resume();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetInt64(sp + 8) + 1, // setTimeout has been seen to fire up to 1 millisecond early\n\t\t\t\t\t\t));\n\t\t\t\t\t\tthis.mem.setInt32(sp + 16, id, true);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func clearTimeoutEvent(id int32)\n\t\t\t\t\t\"runtime.clearTimeoutEvent\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst id = this.mem.getInt32(sp + 8, true);\n\t\t\t\t\t\tclearTimeout(this._scheduledTimeouts.get(id));\n\t\t\t\t\t\tthis._scheduledTimeouts.delete(id);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func getRandomData(r []byte)\n\t\t\t\t\t\"runtime.getRandomData\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tcrypto.getRandomValues(loadSlice(sp + 8));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func finalizeRef(v ref)\n\t\t\t\t\t\"syscall/js.finalizeRef\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst id = this.mem.getUint32(sp + 8, true);\n\t\t\t\t\t\tthis._goRefCounts[id]--;\n\t\t\t\t\t\tif (this._goRefCounts[id] === 0) {\n\t\t\t\t\t\t\tconst v = this._values[id];\n\t\t\t\t\t\t\tthis._values[id] = null;\n\t\t\t\t\t\t\tthis._ids.delete(v);\n\t\t\t\t\t\t\tthis._idPool.push(id);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func stringVal(value string) ref\n\t\t\t\t\t\"syscall/js.stringVal\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tstoreValue(sp + 24, loadString(sp + 8));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueGet(v ref, p string) ref\n\t\t\t\t\t\"syscall/js.valueGet\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\tstoreValue(sp + 32, result);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueSet(v ref, p string, x ref)\n\t\t\t\t\t\"syscall/js.valueSet\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tReflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueDelete(v ref, p string)\n\t\t\t\t\t\"syscall/js.valueDelete\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tReflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueIndex(v ref, i int) ref\n\t\t\t\t\t\"syscall/js.valueIndex\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tstoreValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n\t\t\t\t\t},\n\n\t\t\t\t\t// valueSetIndex(v ref, i int, x ref)\n\t\t\t\t\t\"syscall/js.valueSetIndex\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tReflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueCall(v ref, m string, args []ref) (ref, bool)\n\t\t\t\t\t\"syscall/js.valueCall\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst v = loadValue(sp + 8);\n\t\t\t\t\t\t\tconst m = Reflect.get(v, loadString(sp + 16));\n\t\t\t\t\t\t\tconst args = loadSliceOfValues(sp + 32);\n\t\t\t\t\t\t\tconst result = Reflect.apply(m, v, args);\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 56, result);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 64, 1);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 56, err);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 64, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueInvoke(v ref, args []ref) (ref, bool)\n\t\t\t\t\t\"syscall/js.valueInvoke\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst v = loadValue(sp + 8);\n\t\t\t\t\t\t\tconst args = loadSliceOfValues(sp + 16);\n\t\t\t\t\t\t\tconst result = Reflect.apply(v, undefined, args);\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, result);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, err);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueNew(v ref, args []ref) (ref, bool)\n\t\t\t\t\t\"syscall/js.valueNew\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst v = loadValue(sp + 8);\n\t\t\t\t\t\t\tconst args = loadSliceOfValues(sp + 16);\n\t\t\t\t\t\t\tconst result = Reflect.construct(v, args);\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, result);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, err);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueLength(v ref) int\n\t\t\t\t\t\"syscall/js.valueLength\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tsetInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n\t\t\t\t\t},\n\n\t\t\t\t\t// valuePrepareString(v ref) (ref, int)\n\t\t\t\t\t\"syscall/js.valuePrepareString\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst str = encoder.encode(String(loadValue(sp + 8)));\n\t\t\t\t\t\tstoreValue(sp + 16, str);\n\t\t\t\t\t\tsetInt64(sp + 24, str.length);\n\t\t\t\t\t},\n\n\t\t\t\t\t// valueLoadString(v ref, b []byte)\n\t\t\t\t\t\"syscall/js.valueLoadString\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst str = loadValue(sp + 8);\n\t\t\t\t\t\tloadSlice(sp + 16).set(str);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueInstanceOf(v ref, t ref) bool\n\t\t\t\t\t\"syscall/js.valueInstanceOf\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tthis.mem.setUint8(sp + 24, (loadValue(sp + 8) instanceof loadValue(sp + 16)) ? 1 : 0);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func copyBytesToGo(dst []byte, src ref) (int, bool)\n\t\t\t\t\t\"syscall/js.copyBytesToGo\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst dst = loadSlice(sp + 8);\n\t\t\t\t\t\tconst src = loadValue(sp + 32);\n\t\t\t\t\t\tif (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst toCopy = src.subarray(0, dst.length);\n\t\t\t\t\t\tdst.set(toCopy);\n\t\t\t\t\t\tsetInt64(sp + 40, toCopy.length);\n\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func copyBytesToJS(dst ref, src []byte) (int, bool)\n\t\t\t\t\t\"syscall/js.copyBytesToJS\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst dst = loadValue(sp + 8);\n\t\t\t\t\t\tconst src = loadSlice(sp + 16);\n\t\t\t\t\t\tif (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst toCopy = src.subarray(0, dst.length);\n\t\t\t\t\t\tdst.set(toCopy);\n\t\t\t\t\t\tsetInt64(sp + 40, toCopy.length);\n\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t},\n\n\t\t\t\t\t\"debug\": (value) => {\n\t\t\t\t\t\tconsole.log(value);\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tasync run(instance) {\n\t\t\tif (!(instance instanceof WebAssembly.Instance)) {\n\t\t\t\tthrow new Error(\"Go.run: WebAssembly.Instance expected\");\n\t\t\t}\n\t\t\tthis._inst = instance;\n\t\t\tthis.mem = new DataView(this._inst.exports.mem.buffer);\n\t\t\tthis._values = [ // JS values that Go currently has references to, indexed by reference id\n\t\t\t\tNaN,\n\t\t\t\t0,\n\t\t\t\tnull,\n\t\t\t\ttrue,\n\t\t\t\tfalse,\n\t\t\t\tglobalThis,\n\t\t\t\tthis,\n\t\t\t];\n\t\t\tthis._goRefCounts = new Array(this._values.length).fill(Infinity); // number of references that Go has to a JS value, indexed by reference id\n\t\t\tthis._ids = new Map([ // mapping from JS values to reference ids\n\t\t\t\t[0, 1],\n\t\t\t\t[null, 2],\n\t\t\t\t[true, 3],\n\t\t\t\t[false, 4],\n\t\t\t\t[globalThis, 5],\n\t\t\t\t[this, 6],\n\t\t\t]);\n\t\t\tthis._idPool = []; // unused ids that have been garbage collected\n\t\t\tthis.exited = false; // whether the Go program has exited\n\n\t\t\t// Pass command line arguments and environment variables to WebAssembly by writing them to the linear memory.\n\t\t\tlet offset = 4096;\n\n\t\t\tconst strPtr = (str) => {\n\t\t\t\tconst ptr = offset;\n\t\t\t\tconst bytes = encoder.encode(str + \"\\0\");\n\t\t\t\tnew Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n\t\t\t\toffset += bytes.length;\n\t\t\t\tif (offset % 8 !== 0) {\n\t\t\t\t\toffset += 8 - (offset % 8);\n\t\t\t\t}\n\t\t\t\treturn ptr;\n\t\t\t};\n\n\t\t\tconst argc = this.argv.length;\n\n\t\t\tconst argvPtrs = [];\n\t\t\tthis.argv.forEach((arg) => {\n\t\t\t\targvPtrs.push(strPtr(arg));\n\t\t\t});\n\t\t\targvPtrs.push(0);\n\n\t\t\tconst keys = Object.keys(this.env).sort();\n\t\t\tkeys.forEach((key) => {\n\t\t\t\targvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n\t\t\t});\n\t\t\targvPtrs.push(0);\n\n\t\t\tconst argv = offset;\n\t\t\targvPtrs.forEach((ptr) => {\n\t\t\t\tthis.mem.setUint32(offset, ptr, true);\n\t\t\t\tthis.mem.setUint32(offset + 4, 0, true);\n\t\t\t\toffset += 8;\n\t\t\t});\n\n\t\t\t// The linker guarantees global data starts from at least wasmMinDataAddr.\n\t\t\t// Keep in sync with cmd/link/internal/ld/data.go:wasmMinDataAddr.\n\t\t\tconst wasmMinDataAddr = 4096 + 8192;\n\t\t\tif (offset >= wasmMinDataAddr) {\n\t\t\t\tthrow new Error(\"total length of command line and environment variables exceeds limit\");\n\t\t\t}\n\n\t\t\tthis._inst.exports.run(argc, argv);\n\t\t\tif (this.exited) {\n\t\t\t\tthis._resolveExitPromise();\n\t\t\t}\n\t\t\tawait this._exitPromise;\n\t\t}\n\n\t\t_resume() {\n\t\t\tif (this.exited) {\n\t\t\t\tthrow new Error(\"Go program has already exited\");\n\t\t\t}\n\t\t\tthis._inst.exports.resume();\n\t\t\tif (this.exited) {\n\t\t\t\tthis._resolveExitPromise();\n\t\t\t}\n\t\t}\n\n\t\t_makeFuncWrapper(id) {\n\t\t\tconst go = this;\n\t\t\treturn function () {\n\t\t\t\tconst event = { id: id, this: this, args: arguments };\n\t\t\t\tgo._pendingEvent = event;\n\t\t\t\tgo._resume();\n\t\t\t\treturn event.result;\n\t\t\t};\n\t\t}\n\t}\n})();\n"],"names":["enosys","err","Error","code","globalThis","fs","outputBuf","constants","O_WRONLY","O_RDWR","O_CREAT","O_TRUNC","O_APPEND","O_EXCL","writeSync","fd","buf","decoder","decode","nl","lastIndexOf","console","log","substr","length","write","offset","position","callback","this","chmod","path","mode","chown","uid","gid","close","fchmod","fchown","fstat","fsync","ftruncate","lchown","link","lstat","mkdir","perm","open","flags","read","buffer","readdir","readlink","rename","from","to","rmdir","stat","symlink","truncate","unlink","utimes","atime","mtime","process","getuid","getgid","geteuid","getegid","getgroups","pid","ppid","umask","cwd","chdir","crypto","performance","TextEncoder","TextDecoder","encoder","Go","constructor","argv","env","exit","warn","_exitPromise","Promise","resolve","_resolveExitPromise","_pendingEvent","_scheduledTimeouts","Map","_nextCallbackTimeoutID","setInt64","addr","v","mem","setUint32","Math","floor","getInt64","getUint32","getInt32","loadValue","f","getFloat64","isNaN","id","_values","storeValue","nanHead","setFloat64","undefined","_ids","get","_idPool","pop","_goRefCounts","set","typeFlag","loadSlice","array","len","Uint8Array","_inst","exports","loadSliceOfValues","a","Array","i","loadString","saddr","DataView","timeOrigin","Date","now","importObject","go","sp","exited","p","n","msec","getTime","setInt32","setTimeout","_resume","has","clearTimeout","delete","getRandomValues","push","result","Reflect","getsp","deleteProperty","m","args","apply","setUint8","construct","parseInt","str","encode","String","dst","src","Uint8ClampedArray","toCopy","subarray","debug","value","async","instance","WebAssembly","Instance","NaN","fill","Infinity","strPtr","ptr","bytes","argc","argvPtrs","forEach","arg","Object","keys","sort","key","run","resume","_makeFuncWrapper","event","arguments"],"mappings":"AAMA,MACC,MAAMA,EAAS,KACd,MAAMC,EAAM,IAAIC,MAAM,mBAEtB,OADAD,EAAIE,KAAO,SACJF,GAGR,IAAKG,WAAWC,GAAI,CACnB,IAAIC,EAAY,GAChBF,WAAWC,GAAK,CACfE,UAAW,CAAEC,UAAW,EAAGC,QAAS,EAAGC,SAAU,EAAGC,SAAU,EAAGC,UAAW,EAAGC,QAAS,GACxFC,UAAUC,EAAIC,GACbV,GAAaW,EAAQC,OAAOF,GAC5B,MAAMG,EAAKb,EAAUc,YAAY,MAKjC,OAJW,GAAPD,IACHE,QAAQC,IAAIhB,EAAUiB,OAAO,EAAGJ,IAChCb,EAAYA,EAAUiB,OAAOJ,EAAK,IAE5BH,EAAIQ,QAEZC,MAAMV,EAAIC,EAAKU,EAAQ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S,EAAG,GAAG,GAClCA,GAAU,IAMPA,GADoB,MAEvB,MAAM,IAAIxB,MAAM,wEAGjB2B,KAAKgG,MAAMC,QAAQiE,IAAIR,EAAMrG,GACzBrD,KAAK+G,QACR/G,KAAK4D,4BAEA5D,KAAKyD,aAGZ6D,UACC,GAAItH,KAAK+G,OACR,MAAM,IAAI1I,MAAM,iCAEjB2B,KAAKgG,MAAMC,QAAQkE,SACfnK,KAAK+G,QACR/G,KAAK4D,sBAIPwG,iBAAiBrF,GAChB,MAAM8B,EAAK7G,KACX,OAAO,WACN,MAAMqK,EAAQ,CAAEtF,GAAIA,EAAI/E,KAAMA,KAAMiI,KAAMqC,WAG1C,OAFAzD,EAAGhD,cAAgBwG,EACnBxD,EAAGS,UACI+C,EAAMzC,WA/hBjB"} -------------------------------------------------------------------------------- /dist/wasm_exec.full-b3250e2a.js: -------------------------------------------------------------------------------- 1 | (()=>{const e=()=>{const e=new Error("not implemented");return e.code="ENOSYS",e};if(!globalThis.fs){let t="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(e,i){t+=s.decode(i);const n=t.lastIndexOf("\n");return-1!=n&&(console.log(t.substr(0,n)),t=t.substr(n+1)),i.length},write(t,s,i,n,o,r){0===i&&n===s.length&&null===o?r(null,this.writeSync(t,s)):r(e())},chmod(t,s,i){i(e())},chown(t,s,i,n){n(e())},close(t,s){s(e())},fchmod(t,s,i){i(e())},fchown(t,s,i,n){n(e())},fstat(t,s){s(e())},fsync(e,t){t(null)},ftruncate(t,s,i){i(e())},lchown(t,s,i,n){n(e())},link(t,s,i){i(e())},lstat(t,s){s(e())},mkdir(t,s,i){i(e())},open(t,s,i,n){n(e())},read(t,s,i,n,o,r){r(e())},readdir(t,s){s(e())},readlink(t,s){s(e())},rename(t,s,i){i(e())},rmdir(t,s){s(e())},stat(t,s){s(e())},symlink(t,s,i){i(e())},truncate(t,s,i){i(e())},unlink(t,s){s(e())},utimes(t,s,i,n){n(e())}}}if(globalThis.process||(globalThis.process={getuid:()=>-1,getgid:()=>-1,geteuid:()=>-1,getegid:()=>-1,getgroups(){throw e()},pid:-1,ppid:-1,umask(){throw e()},cwd(){throw e()},chdir(){throw e()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const t=new TextEncoder("utf-8"),s=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{0!==e&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const e=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},i=e=>this.mem.getUint32(e+0,!0)+4294967296*this.mem.getInt32(e+4,!0),n=e=>{const t=this.mem.getFloat64(e,!0);if(0===t)return;if(!isNaN(t))return t;const s=this.mem.getUint32(e,!0);return this._values[s]},o=(e,t)=>{const s=2146959360;if("number"==typeof t&&0!==t)return isNaN(t)?(this.mem.setUint32(e+4,s,!0),void this.mem.setUint32(e,0,!0)):void this.mem.setFloat64(e,t,!0);if(void 0===t)return void this.mem.setFloat64(e,0,!0);let i=this._ids.get(t);void 0===i&&(i=this._idPool.pop(),void 0===i&&(i=this._values.length),this._values[i]=t,this._goRefCounts[i]=0,this._ids.set(t,i)),this._goRefCounts[i]++;let n=0;switch(typeof t){case"object":null!==t&&(n=1);break;case"string":n=2;break;case"symbol":n=3;break;case"function":n=4}this.mem.setUint32(e+4,s|n,!0),this.mem.setUint32(e,i,!0)},r=e=>{const t=i(e+0),s=i(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,s)},l=e=>{const t=i(e+0),s=i(e+8),o=new Array(s);for(let e=0;e{const t=i(e+0),n=i(e+8);return s.decode(new DataView(this._inst.exports.mem.buffer,t,n))},h=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{const t=this.mem.getInt32(8+(e>>>=0),!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{const t=i(8+(e>>>=0)),s=i(e+16),n=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,s,n))},"runtime.resetMemoryDataView":e=>{this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":t=>{e(8+(t>>>=0),1e6*(h+performance.now()))},"runtime.walltime":t=>{t>>>=0;const s=(new Date).getTime();e(t+8,s/1e3),this.mem.setInt32(t+16,s%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},i(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{const t=this.mem.getInt32(8+(e>>>=0),!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{crypto.getRandomValues(r(8+(e>>>=0)))},"syscall/js.finalizeRef":e=>{const t=this.mem.getUint32(8+(e>>>=0),!0);if(this._goRefCounts[t]--,0===this._goRefCounts[t]){const e=this._values[t];this._values[t]=null,this._ids.delete(e),this._idPool.push(t)}},"syscall/js.stringVal":e=>{o(24+(e>>>=0),a(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(n(e+8),a(e+16));e=this._inst.exports.getsp()>>>0,o(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(n(e+8),a(e+16),n(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(n(e+8),a(e+16))},"syscall/js.valueIndex":e=>{o(24+(e>>>=0),Reflect.get(n(e+8),i(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(n(e+8),i(e+16),n(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=n(e+8),s=Reflect.get(t,a(e+16)),i=l(e+32),r=Reflect.apply(s,t,i);e=this._inst.exports.getsp()>>>0,o(e+56,r),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=n(e+8),s=l(e+16),i=Reflect.apply(t,void 0,s);e=this._inst.exports.getsp()>>>0,o(e+40,i),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=n(e+8),s=l(e+16),i=Reflect.construct(t,s);e=this._inst.exports.getsp()>>>0,o(e+40,i),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":t=>{e(16+(t>>>=0),parseInt(n(t+8).length))},"syscall/js.valuePrepareString":s=>{s>>>=0;const i=t.encode(String(n(s+8)));o(s+16,i),e(s+24,i.length)},"syscall/js.valueLoadString":e=>{const t=n(8+(e>>>=0));r(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{this.mem.setUint8(24+(e>>>=0),n(e+8)instanceof n(e+16)?1:0)},"syscall/js.copyBytesToGo":t=>{const s=r(8+(t>>>=0)),i=n(t+32);if(!(i instanceof Uint8Array||i instanceof Uint8ClampedArray))return void this.mem.setUint8(t+48,0);const o=i.subarray(0,s.length);s.set(o),e(t+40,o.length),this.mem.setUint8(t+48,1)},"syscall/js.copyBytesToJS":t=>{const s=n(8+(t>>>=0)),i=r(t+16);if(!(s instanceof Uint8Array||s instanceof Uint8ClampedArray))return void this.mem.setUint8(t+48,0);const o=i.subarray(0,s.length);s.set(o),e(t+40,o.length),this.mem.setUint8(t+48,1)},debug:e=>{console.log(e)}}}}async run(e){if(!(e instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=e,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(Infinity),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let s=4096;const i=e=>{const i=s,n=t.encode(e+"\0");return new Uint8Array(this.mem.buffer,s,n.length).set(n),s+=n.length,s%8!=0&&(s+=8-s%8),i},n=this.argv.length,o=[];this.argv.forEach(e=>{o.push(i(e))}),o.push(0),Object.keys(this.env).sort().forEach(e=>{o.push(i(`${e}=${this.env[e]}`))}),o.push(0);const r=s;if(o.forEach(e=>{this.mem.setUint32(s,e,!0),this.mem.setUint32(s+4,0,!0),s+=8}),s>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,r),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(e){const t=this;return function(){const s={id:e,this:this,args:arguments};return t._pendingEvent=s,t._resume(),s.result}}}})(); 2 | //# sourceMappingURL=wasm_exec.full-b3250e2a.js.map 3 | -------------------------------------------------------------------------------- /dist/wasm_exec.full-b3250e2a.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"wasm_exec.full-b3250e2a.js","sources":["../lib/wasm_exec.full.cjs"],"sourcesContent":["// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n\"use strict\";\n\n(() => {\n\tconst enosys = () => {\n\t\tconst err = new Error(\"not implemented\");\n\t\terr.code = \"ENOSYS\";\n\t\treturn err;\n\t};\n\n\tif (!globalThis.fs) {\n\t\tlet outputBuf = \"\";\n\t\tglobalThis.fs = {\n\t\t\tconstants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused\n\t\t\twriteSync(fd, buf) {\n\t\t\t\toutputBuf += decoder.decode(buf);\n\t\t\t\tconst nl = outputBuf.lastIndexOf(\"\\n\");\n\t\t\t\tif (nl != -1) {\n\t\t\t\t\tconsole.log(outputBuf.substr(0, nl));\n\t\t\t\t\toutputBuf = outputBuf.substr(nl + 1);\n\t\t\t\t}\n\t\t\t\treturn buf.length;\n\t\t\t},\n\t\t\twrite(fd, buf, offset, length, position, callback) {\n\t\t\t\tif (offset !== 0 || length !== buf.length || position !== null) {\n\t\t\t\t\tcallback(enosys());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst n = this.writeSync(fd, buf);\n\t\t\t\tcallback(null, n);\n\t\t\t},\n\t\t\tchmod(path, mode, callback) { callback(enosys()); },\n\t\t\tchown(path, uid, gid, callback) { callback(enosys()); },\n\t\t\tclose(fd, callback) { callback(enosys()); },\n\t\t\tfchmod(fd, mode, callback) { callback(enosys()); },\n\t\t\tfchown(fd, uid, gid, callback) { callback(enosys()); },\n\t\t\tfstat(fd, callback) { callback(enosys()); },\n\t\t\tfsync(fd, callback) { callback(null); },\n\t\t\tftruncate(fd, length, callback) { callback(enosys()); },\n\t\t\tlchown(path, uid, gid, callback) { callback(enosys()); },\n\t\t\tlink(path, link, callback) { callback(enosys()); },\n\t\t\tlstat(path, callback) { callback(enosys()); },\n\t\t\tmkdir(path, perm, callback) { callback(enosys()); },\n\t\t\topen(path, flags, mode, callback) { callback(enosys()); },\n\t\t\tread(fd, buffer, offset, length, position, callback) { callback(enosys()); },\n\t\t\treaddir(path, callback) { callback(enosys()); },\n\t\t\treadlink(path, callback) { callback(enosys()); },\n\t\t\trename(from, to, callback) { callback(enosys()); },\n\t\t\trmdir(path, callback) { callback(enosys()); },\n\t\t\tstat(path, callback) { callback(enosys()); },\n\t\t\tsymlink(path, link, callback) { callback(enosys()); },\n\t\t\ttruncate(path, length, callback) { callback(enosys()); },\n\t\t\tunlink(path, callback) { callback(enosys()); },\n\t\t\tutimes(path, atime, mtime, callback) { callback(enosys()); },\n\t\t};\n\t}\n\n\tif (!globalThis.process) {\n\t\tglobalThis.process = {\n\t\t\tgetuid() { return -1; },\n\t\t\tgetgid() { return -1; },\n\t\t\tgeteuid() { return -1; },\n\t\t\tgetegid() { return -1; },\n\t\t\tgetgroups() { throw enosys(); },\n\t\t\tpid: -1,\n\t\t\tppid: -1,\n\t\t\tumask() { throw enosys(); },\n\t\t\tcwd() { throw enosys(); },\n\t\t\tchdir() { throw enosys(); },\n\t\t}\n\t}\n\n\tif (!globalThis.crypto) {\n\t\tthrow new Error(\"globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)\");\n\t}\n\n\tif (!globalThis.performance) {\n\t\tthrow new Error(\"globalThis.performance is not available, polyfill required (performance.now only)\");\n\t}\n\n\tif (!globalThis.TextEncoder) {\n\t\tthrow new Error(\"globalThis.TextEncoder is not available, polyfill required\");\n\t}\n\n\tif (!globalThis.TextDecoder) {\n\t\tthrow new Error(\"globalThis.TextDecoder is not available, polyfill required\");\n\t}\n\n\tconst encoder = new TextEncoder(\"utf-8\");\n\tconst decoder = new TextDecoder(\"utf-8\");\n\n\tglobalThis.Go = class {\n\t\tconstructor() {\n\t\t\tthis.argv = [\"js\"];\n\t\t\tthis.env = {};\n\t\t\tthis.exit = (code) => {\n\t\t\t\tif (code !== 0) {\n\t\t\t\t\tconsole.warn(\"exit code:\", code);\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis._exitPromise = new Promise((resolve) => {\n\t\t\t\tthis._resolveExitPromise = resolve;\n\t\t\t});\n\t\t\tthis._pendingEvent = null;\n\t\t\tthis._scheduledTimeouts = new Map();\n\t\t\tthis._nextCallbackTimeoutID = 1;\n\n\t\t\tconst setInt64 = (addr, v) => {\n\t\t\t\tthis.mem.setUint32(addr + 0, v, true);\n\t\t\t\tthis.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n\t\t\t}\n\n\t\t\tconst getInt64 = (addr) => {\n\t\t\t\tconst low = this.mem.getUint32(addr + 0, true);\n\t\t\t\tconst high = this.mem.getInt32(addr + 4, true);\n\t\t\t\treturn low + high * 4294967296;\n\t\t\t}\n\n\t\t\tconst loadValue = (addr) => {\n\t\t\t\tconst f = this.mem.getFloat64(addr, true);\n\t\t\t\tif (f === 0) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (!isNaN(f)) {\n\t\t\t\t\treturn f;\n\t\t\t\t}\n\n\t\t\t\tconst id = this.mem.getUint32(addr, true);\n\t\t\t\treturn this._values[id];\n\t\t\t}\n\n\t\t\tconst storeValue = (addr, v) => {\n\t\t\t\tconst nanHead = 0x7FF80000;\n\n\t\t\t\tif (typeof v === \"number\" && v !== 0) {\n\t\t\t\t\tif (isNaN(v)) {\n\t\t\t\t\t\tthis.mem.setUint32(addr + 4, nanHead, true);\n\t\t\t\t\t\tthis.mem.setUint32(addr, 0, true);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.mem.setFloat64(addr, v, true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (v === undefined) {\n\t\t\t\t\tthis.mem.setFloat64(addr, 0, true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet id = this._ids.get(v);\n\t\t\t\tif (id === undefined) {\n\t\t\t\t\tid = this._idPool.pop();\n\t\t\t\t\tif (id === undefined) {\n\t\t\t\t\t\tid = this._values.length;\n\t\t\t\t\t}\n\t\t\t\t\tthis._values[id] = v;\n\t\t\t\t\tthis._goRefCounts[id] = 0;\n\t\t\t\t\tthis._ids.set(v, id);\n\t\t\t\t}\n\t\t\t\tthis._goRefCounts[id]++;\n\t\t\t\tlet typeFlag = 0;\n\t\t\t\tswitch (typeof v) {\n\t\t\t\t\tcase \"object\":\n\t\t\t\t\t\tif (v !== null) {\n\t\t\t\t\t\t\ttypeFlag = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"string\":\n\t\t\t\t\t\ttypeFlag = 2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"symbol\":\n\t\t\t\t\t\ttypeFlag = 3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"function\":\n\t\t\t\t\t\ttypeFlag = 4;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tthis.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n\t\t\t\tthis.mem.setUint32(addr, id, true);\n\t\t\t}\n\n\t\t\tconst loadSlice = (addr) => {\n\t\t\t\tconst array = getInt64(addr + 0);\n\t\t\t\tconst len = getInt64(addr + 8);\n\t\t\t\treturn new Uint8Array(this._inst.exports.mem.buffer, array, len);\n\t\t\t}\n\n\t\t\tconst loadSliceOfValues = (addr) => {\n\t\t\t\tconst array = getInt64(addr + 0);\n\t\t\t\tconst len = getInt64(addr + 8);\n\t\t\t\tconst a = new Array(len);\n\t\t\t\tfor (let i = 0; i < len; i++) {\n\t\t\t\t\ta[i] = loadValue(array + i * 8);\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t}\n\n\t\t\tconst loadString = (addr) => {\n\t\t\t\tconst saddr = getInt64(addr + 0);\n\t\t\t\tconst len = getInt64(addr + 8);\n\t\t\t\treturn decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n\t\t\t}\n\n\t\t\tconst timeOrigin = Date.now() - performance.now();\n\t\t\tthis.importObject = {\n\t\t\t\tgo: {\n\t\t\t\t\t// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n\t\t\t\t\t// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n\t\t\t\t\t// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n\t\t\t\t\t// This changes the SP, thus we have to update the SP used by the imported function.\n\n\t\t\t\t\t// func wasmExit(code int32)\n\t\t\t\t\t\"runtime.wasmExit\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst code = this.mem.getInt32(sp + 8, true);\n\t\t\t\t\t\tthis.exited = true;\n\t\t\t\t\t\tdelete this._inst;\n\t\t\t\t\t\tdelete this._values;\n\t\t\t\t\t\tdelete this._goRefCounts;\n\t\t\t\t\t\tdelete this._ids;\n\t\t\t\t\t\tdelete this._idPool;\n\t\t\t\t\t\tthis.exit(code);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n\t\t\t\t\t\"runtime.wasmWrite\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst fd = getInt64(sp + 8);\n\t\t\t\t\t\tconst p = getInt64(sp + 16);\n\t\t\t\t\t\tconst n = this.mem.getInt32(sp + 24, true);\n\t\t\t\t\t\tfs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func resetMemoryDataView()\n\t\t\t\t\t\"runtime.resetMemoryDataView\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tthis.mem = new DataView(this._inst.exports.mem.buffer);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func nanotime1() int64\n\t\t\t\t\t\"runtime.nanotime1\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tsetInt64(sp + 8, (timeOrigin + performance.now()) * 1000000);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func walltime() (sec int64, nsec int32)\n\t\t\t\t\t\"runtime.walltime\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst msec = (new Date).getTime();\n\t\t\t\t\t\tsetInt64(sp + 8, msec / 1000);\n\t\t\t\t\t\tthis.mem.setInt32(sp + 16, (msec % 1000) * 1000000, true);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func scheduleTimeoutEvent(delay int64) int32\n\t\t\t\t\t\"runtime.scheduleTimeoutEvent\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst id = this._nextCallbackTimeoutID;\n\t\t\t\t\t\tthis._nextCallbackTimeoutID++;\n\t\t\t\t\t\tthis._scheduledTimeouts.set(id, setTimeout(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tthis._resume();\n\t\t\t\t\t\t\t\twhile (this._scheduledTimeouts.has(id)) {\n\t\t\t\t\t\t\t\t\t// for some reason Go failed to register the timeout event, log and try again\n\t\t\t\t\t\t\t\t\t// (temporary workaround for https://github.com/golang/go/issues/28975)\n\t\t\t\t\t\t\t\t\tconsole.warn(\"scheduleTimeoutEvent: missed timeout event\");\n\t\t\t\t\t\t\t\t\tthis._resume();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgetInt64(sp + 8) + 1, // setTimeout has been seen to fire up to 1 millisecond early\n\t\t\t\t\t\t));\n\t\t\t\t\t\tthis.mem.setInt32(sp + 16, id, true);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func clearTimeoutEvent(id int32)\n\t\t\t\t\t\"runtime.clearTimeoutEvent\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst id = this.mem.getInt32(sp + 8, true);\n\t\t\t\t\t\tclearTimeout(this._scheduledTimeouts.get(id));\n\t\t\t\t\t\tthis._scheduledTimeouts.delete(id);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func getRandomData(r []byte)\n\t\t\t\t\t\"runtime.getRandomData\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tcrypto.getRandomValues(loadSlice(sp + 8));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func finalizeRef(v ref)\n\t\t\t\t\t\"syscall/js.finalizeRef\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst id = this.mem.getUint32(sp + 8, true);\n\t\t\t\t\t\tthis._goRefCounts[id]--;\n\t\t\t\t\t\tif (this._goRefCounts[id] === 0) {\n\t\t\t\t\t\t\tconst v = this._values[id];\n\t\t\t\t\t\t\tthis._values[id] = null;\n\t\t\t\t\t\t\tthis._ids.delete(v);\n\t\t\t\t\t\t\tthis._idPool.push(id);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func stringVal(value string) ref\n\t\t\t\t\t\"syscall/js.stringVal\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tstoreValue(sp + 24, loadString(sp + 8));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueGet(v ref, p string) ref\n\t\t\t\t\t\"syscall/js.valueGet\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\tstoreValue(sp + 32, result);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueSet(v ref, p string, x ref)\n\t\t\t\t\t\"syscall/js.valueSet\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tReflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueDelete(v ref, p string)\n\t\t\t\t\t\"syscall/js.valueDelete\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tReflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueIndex(v ref, i int) ref\n\t\t\t\t\t\"syscall/js.valueIndex\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tstoreValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n\t\t\t\t\t},\n\n\t\t\t\t\t// valueSetIndex(v ref, i int, x ref)\n\t\t\t\t\t\"syscall/js.valueSetIndex\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tReflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueCall(v ref, m string, args []ref) (ref, bool)\n\t\t\t\t\t\"syscall/js.valueCall\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst v = loadValue(sp + 8);\n\t\t\t\t\t\t\tconst m = Reflect.get(v, loadString(sp + 16));\n\t\t\t\t\t\t\tconst args = loadSliceOfValues(sp + 32);\n\t\t\t\t\t\t\tconst result = Reflect.apply(m, v, args);\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 56, result);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 64, 1);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 56, err);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 64, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueInvoke(v ref, args []ref) (ref, bool)\n\t\t\t\t\t\"syscall/js.valueInvoke\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst v = loadValue(sp + 8);\n\t\t\t\t\t\t\tconst args = loadSliceOfValues(sp + 16);\n\t\t\t\t\t\t\tconst result = Reflect.apply(v, undefined, args);\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, result);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, err);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueNew(v ref, args []ref) (ref, bool)\n\t\t\t\t\t\"syscall/js.valueNew\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst v = loadValue(sp + 8);\n\t\t\t\t\t\t\tconst args = loadSliceOfValues(sp + 16);\n\t\t\t\t\t\t\tconst result = Reflect.construct(v, args);\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, result);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tsp = this._inst.exports.getsp() >>> 0; // see comment above\n\t\t\t\t\t\t\tstoreValue(sp + 40, err);\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueLength(v ref) int\n\t\t\t\t\t\"syscall/js.valueLength\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tsetInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n\t\t\t\t\t},\n\n\t\t\t\t\t// valuePrepareString(v ref) (ref, int)\n\t\t\t\t\t\"syscall/js.valuePrepareString\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst str = encoder.encode(String(loadValue(sp + 8)));\n\t\t\t\t\t\tstoreValue(sp + 16, str);\n\t\t\t\t\t\tsetInt64(sp + 24, str.length);\n\t\t\t\t\t},\n\n\t\t\t\t\t// valueLoadString(v ref, b []byte)\n\t\t\t\t\t\"syscall/js.valueLoadString\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst str = loadValue(sp + 8);\n\t\t\t\t\t\tloadSlice(sp + 16).set(str);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func valueInstanceOf(v ref, t ref) bool\n\t\t\t\t\t\"syscall/js.valueInstanceOf\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tthis.mem.setUint8(sp + 24, (loadValue(sp + 8) instanceof loadValue(sp + 16)) ? 1 : 0);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func copyBytesToGo(dst []byte, src ref) (int, bool)\n\t\t\t\t\t\"syscall/js.copyBytesToGo\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst dst = loadSlice(sp + 8);\n\t\t\t\t\t\tconst src = loadValue(sp + 32);\n\t\t\t\t\t\tif (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst toCopy = src.subarray(0, dst.length);\n\t\t\t\t\t\tdst.set(toCopy);\n\t\t\t\t\t\tsetInt64(sp + 40, toCopy.length);\n\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t},\n\n\t\t\t\t\t// func copyBytesToJS(dst ref, src []byte) (int, bool)\n\t\t\t\t\t\"syscall/js.copyBytesToJS\": (sp) => {\n\t\t\t\t\t\tsp >>>= 0;\n\t\t\t\t\t\tconst dst = loadValue(sp + 8);\n\t\t\t\t\t\tconst src = loadSlice(sp + 16);\n\t\t\t\t\t\tif (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n\t\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 0);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst toCopy = src.subarray(0, dst.length);\n\t\t\t\t\t\tdst.set(toCopy);\n\t\t\t\t\t\tsetInt64(sp + 40, toCopy.length);\n\t\t\t\t\t\tthis.mem.setUint8(sp + 48, 1);\n\t\t\t\t\t},\n\n\t\t\t\t\t\"debug\": (value) => {\n\t\t\t\t\t\tconsole.log(value);\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tasync run(instance) {\n\t\t\tif (!(instance instanceof WebAssembly.Instance)) {\n\t\t\t\tthrow new Error(\"Go.run: WebAssembly.Instance expected\");\n\t\t\t}\n\t\t\tthis._inst = instance;\n\t\t\tthis.mem = new DataView(this._inst.exports.mem.buffer);\n\t\t\tthis._values = [ // JS values that Go currently has references to, indexed by reference id\n\t\t\t\tNaN,\n\t\t\t\t0,\n\t\t\t\tnull,\n\t\t\t\ttrue,\n\t\t\t\tfalse,\n\t\t\t\tglobalThis,\n\t\t\t\tthis,\n\t\t\t];\n\t\t\tthis._goRefCounts = new Array(this._values.length).fill(Infinity); // number of references that Go has to a JS value, indexed by reference id\n\t\t\tthis._ids = new Map([ // mapping from JS values to reference ids\n\t\t\t\t[0, 1],\n\t\t\t\t[null, 2],\n\t\t\t\t[true, 3],\n\t\t\t\t[false, 4],\n\t\t\t\t[globalThis, 5],\n\t\t\t\t[this, 6],\n\t\t\t]);\n\t\t\tthis._idPool = []; // unused ids that have been garbage collected\n\t\t\tthis.exited = false; // whether the Go program has exited\n\n\t\t\t// Pass command line arguments and environment variables to WebAssembly by writing them to the linear memory.\n\t\t\tlet offset = 4096;\n\n\t\t\tconst strPtr = (str) => {\n\t\t\t\tconst ptr = offset;\n\t\t\t\tconst bytes = encoder.encode(str + \"\\0\");\n\t\t\t\tnew Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n\t\t\t\toffset += bytes.length;\n\t\t\t\tif (offset % 8 !== 0) {\n\t\t\t\t\toffset += 8 - (offset % 8);\n\t\t\t\t}\n\t\t\t\treturn ptr;\n\t\t\t};\n\n\t\t\tconst argc = this.argv.length;\n\n\t\t\tconst argvPtrs = [];\n\t\t\tthis.argv.forEach((arg) => {\n\t\t\t\targvPtrs.push(strPtr(arg));\n\t\t\t});\n\t\t\targvPtrs.push(0);\n\n\t\t\tconst keys = Object.keys(this.env).sort();\n\t\t\tkeys.forEach((key) => {\n\t\t\t\targvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n\t\t\t});\n\t\t\targvPtrs.push(0);\n\n\t\t\tconst argv = offset;\n\t\t\targvPtrs.forEach((ptr) => {\n\t\t\t\tthis.mem.setUint32(offset, ptr, true);\n\t\t\t\tthis.mem.setUint32(offset + 4, 0, true);\n\t\t\t\toffset += 8;\n\t\t\t});\n\n\t\t\t// The linker guarantees global data starts from at least wasmMinDataAddr.\n\t\t\t// Keep in sync with cmd/link/internal/ld/data.go:wasmMinDataAddr.\n\t\t\tconst wasmMinDataAddr = 4096 + 8192;\n\t\t\tif (offset >= wasmMinDataAddr) {\n\t\t\t\tthrow new Error(\"total length of command line and environment variables exceeds limit\");\n\t\t\t}\n\n\t\t\tthis._inst.exports.run(argc, argv);\n\t\t\tif (this.exited) {\n\t\t\t\tthis._resolveExitPromise();\n\t\t\t}\n\t\t\tawait this._exitPromise;\n\t\t}\n\n\t\t_resume() {\n\t\t\tif (this.exited) {\n\t\t\t\tthrow new Error(\"Go program has already exited\");\n\t\t\t}\n\t\t\tthis._inst.exports.resume();\n\t\t\tif (this.exited) {\n\t\t\t\tthis._resolveExitPromise();\n\t\t\t}\n\t\t}\n\n\t\t_makeFuncWrapper(id) {\n\t\t\tconst go = this;\n\t\t\treturn function () {\n\t\t\t\tconst event = { id: id, this: this, args: arguments };\n\t\t\t\tgo._pendingEvent = event;\n\t\t\t\tgo._resume();\n\t\t\t\treturn event.result;\n\t\t\t};\n\t\t}\n\t}\n})();\n"],"names":["enosys","err","Error","code","globalThis","fs","outputBuf","constants","O_WRONLY","O_RDWR","O_CREAT","O_TRUNC","O_APPEND","O_EXCL","writeSync","fd","buf","decoder","decode","nl","lastIndexOf","console","log","substr","length","write","offset","position","callback","this","chmod","path","mode","chown","uid","gid","close","fchmod","fchown","fstat","fsync","ftruncate","lchown","link","lstat","mkdir","perm","open","flags","read","buffer","readdir","readlink","rename","from","to","rmdir","stat","symlink","truncate","unlink","utimes","atime","mtime","process","getuid","getgid","geteuid","getegid","getgroups","pid","ppid","umask","cwd","chdir","crypto","performance","TextEncoder","TextDecoder","encoder","Go","constructor","argv","env","exit","warn","_exitPromise","Promise","resolve","_resolveExitPromise","_pendingEvent","_scheduledTimeouts","Map","_nextCallbackTimeoutID","setInt64","addr","v","mem","setUint32","Math","floor","getInt64","getUint32","getInt32","loadValue","f","getFloat64","isNaN","id","_values","storeValue","nanHead","setFloat64","undefined","_ids","get","_idPool","pop","_goRefCounts","set","typeFlag","loadSlice","array","len","Uint8Array","_inst","exports","loadSliceOfValues","a","Array","i","loadString","saddr","DataView","timeOrigin","Date","now","importObject","go","sp","exited","p","n","msec","getTime","setInt32","setTimeout","_resume","has","clearTimeout","delete","getRandomValues","push","result","Reflect","getsp","deleteProperty","m","args","apply","setUint8","construct","parseInt","str","encode","String","dst","src","Uint8ClampedArray","toCopy","subarray","debug","value","async","instance","WebAssembly","Instance","NaN","fill","Infinity","strPtr","ptr","bytes","argc","argvPtrs","forEach","arg","Object","keys","sort","key","run","resume","_makeFuncWrapper","event","arguments"],"mappings":"AAMA,MACC,MAAMA,EAAS,KACd,MAAMC,EAAM,IAAIC,MAAM,mBAEtB,OADAD,EAAIE,KAAO,SACJF,GAGR,IAAKG,WAAWC,GAAI,CACnB,IAAIC,EAAY,GAChBF,WAAWC,GAAK,CACfE,UAAW,CAAEC,UAAW,EAAGC,QAAS,EAAGC,SAAU,EAAGC,SAAU,EAAGC,UAAW,EAAGC,QAAS,GACxFC,UAAUC,EAAIC,GACbV,GAAaW,EAAQC,OAAOF,GAC5B,MAAMG,EAAKb,EAAUc,YAAY,MAKjC,OAJW,GAAPD,IACHE,Q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tE,EAAOxD,EAUb,GATA8J,EAASC,QAASJ,IACjBxJ,KAAKoE,IAAIC,UAAUxE,EAAQ2J,GAAK,GAChCxJ,KAAKoE,IAAIC,UAAUxE,EAAS,EAAG,GAAG,GAClCA,GAAU,IAMPA,GADoB,MAEvB,MAAM,IAAIxB,MAAM,wEAGjB2B,KAAKgG,MAAMC,QAAQiE,IAAIR,EAAMrG,GACzBrD,KAAK+G,QACR/G,KAAK4D,4BAEA5D,KAAKyD,aAGZ6D,UACC,GAAItH,KAAK+G,OACR,MAAM,IAAI1I,MAAM,iCAEjB2B,KAAKgG,MAAMC,QAAQkE,SACfnK,KAAK+G,QACR/G,KAAK4D,sBAIPwG,iBAAiBrF,GAChB,MAAM8B,EAAK7G,KACX,OAAO,WACN,MAAMqK,EAAQ,CAAEtF,GAAIA,EAAI/E,KAAMA,KAAMiI,KAAMqC,WAG1C,OAFAzD,EAAGhD,cAAgBwG,EACnBxD,EAAGS,UACI+C,EAAMzC,WA/hBjB"} -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/dclareio/cue-wasm 2 | 3 | go 1.18 4 | 5 | require cuelang.org/go v0.4.3 6 | 7 | require ( 8 | github.com/cockroachdb/apd/v2 v2.0.1 // indirect 9 | github.com/emicklei/proto v1.6.15 // indirect 10 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect 11 | github.com/google/uuid v1.2.0 // indirect 12 | github.com/mitchellh/mapstructure v1.5.0 // indirect 13 | github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect 14 | github.com/pkg/errors v0.8.1 // indirect 15 | github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc // indirect 16 | golang.org/x/exp v0.0.0-20210126221216-84987778548c // indirect 17 | golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 // indirect 18 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b // indirect 19 | golang.org/x/text v0.3.7 // indirect 20 | golang.org/x/tools v0.0.0-20200612220849-54c614fe050c // indirect 21 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect 22 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect 23 | ) 24 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cuelang.org/go v0.4.3 h1:W3oBBjDTm7+IZfCKZAmC8uDG0eYfJL4Pp/xbbCMKaVo= 2 | cuelang.org/go v0.4.3/go.mod h1:7805vR9H+VoBNdWFdI7jyDR3QLUPp4+naHfbcgp55HI= 3 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 4 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= 5 | github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= 6 | github.com/cockroachdb/apd/v2 v2.0.1 h1:y1Rh3tEU89D+7Tgbw+lp52T6p/GJLpDmNvr10UWqLTE= 7 | github.com/cockroachdb/apd/v2 v2.0.1/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= 8 | github.com/emicklei/proto v1.6.15 h1:XbpwxmuOPrdES97FrSfpyy67SSCV/wBIKXqgJzh6hNw= 9 | github.com/emicklei/proto v1.6.15/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A= 10 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 11 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= 12 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 13 | github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= 14 | github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 15 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 16 | github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= 17 | github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 18 | github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de h1:D5x39vF5KCwKQaw+OC9ZPiLVHXz3UFw2+psEX+gYcto= 19 | github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de/go.mod h1:kJun4WP5gFuHZgRjZUWWuH1DTxCtxbHDOIJsudS8jzY= 20 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 21 | github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= 22 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 23 | github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc h1:gSVONBi2HWMFXCa9jFdYvYk7IwW/mTLxWOF7rXS4LO0= 24 | github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc/go.mod h1:KbKfKPy2I6ecOIGA9apfheFv14+P3RSmmQvshofQyMY= 25 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 26 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 27 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 28 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 29 | golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= 30 | golang.org/x/exp v0.0.0-20210126221216-84987778548c h1:sWZb7hc7UoMhB5/VYk5+nsHuiHq8J5l0osfBYs9C3gw= 31 | golang.org/x/exp v0.0.0-20210126221216-84987778548c/go.mod h1:I6l2HNBLBZEcrOoCpyKLdY2lHoRZ8lI4x60KMCQDft4= 32 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= 33 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 34 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= 35 | golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= 36 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= 37 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 38 | golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 39 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 40 | golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 h1:xUIPaMhvROX9dhPvRCenIJtU78+lbEenGbgqB5hfHCQ= 41 | golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 42 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 43 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 44 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 45 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= 46 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 47 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 48 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 49 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 50 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 51 | golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 52 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 53 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 54 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 55 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 56 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 57 | golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 58 | golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 59 | golang.org/x/tools v0.0.0-20200612220849-54c614fe050c h1:g6oFfz6Cmw68izP3xsdud3Oxu145IPkeFzyRg58AKHM= 60 | golang.org/x/tools v0.0.0-20200612220849-54c614fe050c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 61 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 62 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 63 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 64 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 65 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 66 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= 67 | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 68 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | import "./polyfill.js"; 2 | import isString from 'lodash.isstring'; 3 | import pako from "pako"; 4 | import toJsonSchema from '@openapi-contrib/openapi-schema-to-json-schema'; 5 | 6 | global.CueWasmAPI = {} 7 | 8 | export const init = async () => { 9 | const variant = 'full'; 10 | if (CueWasmAPI[variant] && CueWasmAPI[variant].loaded) return CueWasmAPI[variant]; 11 | 12 | await import("./wasm_exec.full.cjs"); 13 | const cueWasm = await import('./cue.wasm.full.inline.js'); 14 | 15 | const cueBuff = Buffer.from(cueWasm.default, 'base64'); 16 | const cueArray = new Uint8Array(cueBuff); 17 | const cueUnzipped = pako.ungzip(cueArray); 18 | const go = new Go(); 19 | const { instance } = await WebAssembly.instantiate(cueUnzipped, go.importObject); 20 | go.run(instance); 21 | const cue = (strings, ...values) => { 22 | // called when using the cue`` tagged template literal syntax 23 | const builtString = strings.map((s, i) => { 24 | let value = values[i]; 25 | if (!value) return s; 26 | // don't quote strings to allow users to dynamically write cue vs. 27 | // just injecting json values 28 | if (!isString(value)) value = JSON.stringify(value); 29 | return s + value; 30 | }).join('') 31 | return cue.parse(builtString) 32 | } 33 | 34 | // ensure we don't overwrite the go functions with future variants 35 | // memoize go functions as calls into go are expensive and these are pure functions 36 | cue.toJSONImpl = CueWasmAPI._toJSONImpl 37 | cue.toOpenAPIImpl = CueWasmAPI._toOpenAPIImpl 38 | cue.toASTImpl = CueWasmAPI._toASTImpl 39 | 40 | cue.toJSON = (cueString) => { 41 | if (Array.isArray(cueString)) { 42 | cueString = cueString.map(cs => isString(cs) ? cs : JSON.stringify(cs)); 43 | cueString = cueString.join('\n'); 44 | } else if (!isString(cueString)) { 45 | cueString = JSON.stringify(cueString) 46 | } 47 | const result = cue.toJSONImpl(cueString); 48 | if (result && result.error) throw result.error; 49 | return result.value; 50 | }; 51 | 52 | cue.parse = (cueString) => JSON.parse(cue.toJSON(cueString)); 53 | 54 | cue.toOpenAPI = (cueString) => { 55 | if (Array.isArray(cueString)) { 56 | cueString = cueString.map(cs => isString(cs) ? cs : JSON.stringify(cs)); 57 | cueString = cueString.join('\n'); 58 | } else if (!isString(cueString)) { 59 | cueString = JSON.stringify(cueString) 60 | } 61 | const result = cue.toOpenAPIImpl(cueString); 62 | if (result && result.error) throw result.error; 63 | return result.value; 64 | }; 65 | 66 | cue.parseSchema = (cueString) => toJsonSchema(JSON.parse(cue.toOpenAPI(cueString)).components.schemas); 67 | cue.schema = (strings, ...values) => { 68 | // called when using the cue`` tagged template literal syntax 69 | const builtString = strings.map((s, i) => { 70 | let value = values[i]; 71 | if (!value) return s; 72 | // don't quote strings to allow users to dynamically write cue vs. 73 | // just injecting json values 74 | if (!isString(value)) value = JSON.stringify(value); 75 | return s + value; 76 | }).join('') 77 | return cue.parseSchema(builtString) 78 | } 79 | 80 | cue.toAST = (cueString) => { 81 | if (Array.isArray(cueString)) { 82 | cueString = cueString.map(cs => isString(cs) ? cs : JSON.stringify(cs)); 83 | cueString = cueString.join('\n'); 84 | } else if (!isString(cueString)) { 85 | cueString = JSON.stringify(cueString) 86 | } 87 | const result = cue.toASTImpl(cueString); 88 | if (result && result.error) throw result.error; 89 | return result.value; 90 | }; 91 | 92 | cue.parseAST = (cueString) => JSON.parse(cue.toAST(cueString)); 93 | cue.ast = (strings, ...values) => { 94 | // called when using the cue`` tagged template literal syntax 95 | const builtString = strings.map((s, i) => { 96 | let value = values[i]; 97 | if (!value) return s; 98 | // don't quote strings to allow users to dynamically write cue vs. 99 | // just injecting json values 100 | if (!isString(value)) value = JSON.stringify(value); 101 | return s + value; 102 | }).join('') 103 | return cue.parseAST(builtString) 104 | } 105 | CueWasmAPI[variant] = cue; 106 | // ensure later assignments to the global don't mess with this variant 107 | CueWasmAPI[variant].loaded = true; 108 | return cue; 109 | }; 110 | -------------------------------------------------------------------------------- /lib/polyfill.js: -------------------------------------------------------------------------------- 1 | import getRandomValues from 'polyfill-crypto.getrandomvalues'; 2 | 3 | if (typeof global === 'undefined') { 4 | window.global = window 5 | } 6 | if (!global.crypto) { 7 | global.crypto = { getRandomValues }; 8 | } 9 | if (global.crypto.webcrypto) { 10 | global.crypto = crypto.webcrypto 11 | } 12 | -------------------------------------------------------------------------------- /lib/wasm_exec.slim.cjs: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // This file has been modified for use by the TinyGo compiler. 6 | 7 | (() => { 8 | // Map multiple JavaScript environments to a single common API, 9 | // preferring web standards over Node.js API. 10 | // 11 | // Environments considered: 12 | // - Browsers 13 | // - Node.js 14 | // - Electron 15 | // - Parcel 16 | 17 | if (typeof global !== "undefined") { 18 | // global already exists 19 | } else if (typeof window !== "undefined") { 20 | window.global = window; 21 | } else if (typeof self !== "undefined") { 22 | self.global = self; 23 | } else { 24 | throw new Error("cannot export Go (neither global, window nor self is defined)"); 25 | } 26 | 27 | if (!global.require && typeof require !== "undefined") { 28 | global.require = require; 29 | } 30 | 31 | // if (!global.fs && global.require) { 32 | // global.fs = require("fs"); 33 | // } 34 | 35 | const enosys = () => { 36 | const err = new Error("not implemented"); 37 | err.code = "ENOSYS"; 38 | return err; 39 | }; 40 | 41 | // if (!global.fs) { 42 | // let outputBuf = ""; 43 | // global.fs = { 44 | // constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused 45 | // writeSync(fd, buf) { 46 | // outputBuf += decoder.decode(buf); 47 | // const nl = outputBuf.lastIndexOf("\n"); 48 | // if (nl != -1) { 49 | // console.log(outputBuf.substr(0, nl)); 50 | // outputBuf = outputBuf.substr(nl + 1); 51 | // } 52 | // return buf.length; 53 | // }, 54 | // write(fd, buf, offset, length, position, callback) { 55 | // if (offset !== 0 || length !== buf.length || position !== null) { 56 | // callback(enosys()); 57 | // return; 58 | // } 59 | // const n = this.writeSync(fd, buf); 60 | // callback(null, n); 61 | // }, 62 | // chmod(path, mode, callback) { callback(enosys()); }, 63 | // chown(path, uid, gid, callback) { callback(enosys()); }, 64 | // close(fd, callback) { callback(enosys()); }, 65 | // fchmod(fd, mode, callback) { callback(enosys()); }, 66 | // fchown(fd, uid, gid, callback) { callback(enosys()); }, 67 | // fstat(fd, callback) { callback(enosys()); }, 68 | // fsync(fd, callback) { callback(null); }, 69 | // ftruncate(fd, length, callback) { callback(enosys()); }, 70 | // lchown(path, uid, gid, callback) { callback(enosys()); }, 71 | // link(path, link, callback) { callback(enosys()); }, 72 | // lstat(path, callback) { callback(enosys()); }, 73 | // mkdir(path, perm, callback) { callback(enosys()); }, 74 | // open(path, flags, mode, callback) { callback(enosys()); }, 75 | // read(fd, buffer, offset, length, position, callback) { callback(enosys()); }, 76 | // readdir(path, callback) { callback(enosys()); }, 77 | // readlink(path, callback) { callback(enosys()); }, 78 | // rename(from, to, callback) { callback(enosys()); }, 79 | // rmdir(path, callback) { callback(enosys()); }, 80 | // stat(path, callback) { callback(enosys()); }, 81 | // symlink(path, link, callback) { callback(enosys()); }, 82 | // truncate(path, length, callback) { callback(enosys()); }, 83 | // unlink(path, callback) { callback(enosys()); }, 84 | // utimes(path, atime, mtime, callback) { callback(enosys()); }, 85 | // }; 86 | // } 87 | 88 | if (!global.process) { 89 | global.process = { 90 | getuid() { return -1; }, 91 | getgid() { return -1; }, 92 | geteuid() { return -1; }, 93 | getegid() { return -1; }, 94 | getgroups() { throw enosys(); }, 95 | pid: -1, 96 | ppid: -1, 97 | umask() { throw enosys(); }, 98 | cwd() { throw enosys(); }, 99 | chdir() { throw enosys(); }, 100 | } 101 | } 102 | 103 | if (!global.crypto) { 104 | const nodeCrypto = require("crypto"); 105 | global.crypto = { 106 | getRandomValues(b) { 107 | nodeCrypto.randomFillSync(b); 108 | }, 109 | }; 110 | } 111 | 112 | if (!global.performance) { 113 | global.performance = { 114 | now() { 115 | const [sec, nsec] = process.hrtime(); 116 | return sec * 1000 + nsec / 1000000; 117 | }, 118 | }; 119 | } 120 | 121 | if (!global.TextEncoder) { 122 | global.TextEncoder = require("util").TextEncoder; 123 | } 124 | 125 | if (!global.TextDecoder) { 126 | global.TextDecoder = require("util").TextDecoder; 127 | } 128 | 129 | // End of polyfills for common API. 130 | 131 | const encoder = new TextEncoder("utf-8"); 132 | const decoder = new TextDecoder("utf-8"); 133 | var logLine = []; 134 | 135 | global.Go = class { 136 | constructor() { 137 | this._callbackTimeouts = new Map(); 138 | this._nextCallbackTimeoutID = 1; 139 | 140 | const mem = () => { 141 | // The buffer may change when requesting more memory. 142 | return new DataView(this._inst.exports.memory.buffer); 143 | } 144 | 145 | const setInt64 = (addr, v) => { 146 | mem().setUint32(addr + 0, v, true); 147 | mem().setUint32(addr + 4, Math.floor(v / 4294967296), true); 148 | } 149 | 150 | const getInt64 = (addr) => { 151 | const low = mem().getUint32(addr + 0, true); 152 | const high = mem().getInt32(addr + 4, true); 153 | return low + high * 4294967296; 154 | } 155 | 156 | const loadValue = (addr) => { 157 | const f = mem().getFloat64(addr, true); 158 | if (f === 0) { 159 | return undefined; 160 | } 161 | if (!isNaN(f)) { 162 | return f; 163 | } 164 | 165 | const id = mem().getUint32(addr, true); 166 | return this._values[id]; 167 | } 168 | 169 | const storeValue = (addr, v) => { 170 | const nanHead = 0x7FF80000; 171 | 172 | if (typeof v === "number") { 173 | if (isNaN(v)) { 174 | mem().setUint32(addr + 4, nanHead, true); 175 | mem().setUint32(addr, 0, true); 176 | return; 177 | } 178 | if (v === 0) { 179 | mem().setUint32(addr + 4, nanHead, true); 180 | mem().setUint32(addr, 1, true); 181 | return; 182 | } 183 | mem().setFloat64(addr, v, true); 184 | return; 185 | } 186 | 187 | switch (v) { 188 | case undefined: 189 | mem().setFloat64(addr, 0, true); 190 | return; 191 | case null: 192 | mem().setUint32(addr + 4, nanHead, true); 193 | mem().setUint32(addr, 2, true); 194 | return; 195 | case true: 196 | mem().setUint32(addr + 4, nanHead, true); 197 | mem().setUint32(addr, 3, true); 198 | return; 199 | case false: 200 | mem().setUint32(addr + 4, nanHead, true); 201 | mem().setUint32(addr, 4, true); 202 | return; 203 | } 204 | 205 | let id = this._ids.get(v); 206 | if (id === undefined) { 207 | id = this._idPool.pop(); 208 | if (id === undefined) { 209 | id = this._values.length; 210 | } 211 | this._values[id] = v; 212 | this._goRefCounts[id] = 0; 213 | this._ids.set(v, id); 214 | } 215 | this._goRefCounts[id]++; 216 | let typeFlag = 1; 217 | switch (typeof v) { 218 | case "string": 219 | typeFlag = 2; 220 | break; 221 | case "symbol": 222 | typeFlag = 3; 223 | break; 224 | case "function": 225 | typeFlag = 4; 226 | break; 227 | } 228 | mem().setUint32(addr + 4, nanHead | typeFlag, true); 229 | mem().setUint32(addr, id, true); 230 | } 231 | 232 | const loadSlice = (array, len, cap) => { 233 | return new Uint8Array(this._inst.exports.memory.buffer, array, len); 234 | } 235 | 236 | const loadSliceOfValues = (array, len, cap) => { 237 | const a = new Array(len); 238 | for (let i = 0; i < len; i++) { 239 | a[i] = loadValue(array + i * 8); 240 | } 241 | return a; 242 | } 243 | 244 | const loadString = (ptr, len) => { 245 | return decoder.decode(new DataView(this._inst.exports.memory.buffer, ptr, len)); 246 | } 247 | 248 | const timeOrigin = Date.now() - performance.now(); 249 | this.importObject = { 250 | wasi_snapshot_preview1: { 251 | // https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#fd_write 252 | fd_write: function(fd, iovs_ptr, iovs_len, nwritten_ptr) { 253 | let nwritten = 0; 254 | if (fd == 1) { 255 | for (let iovs_i=0; iovs_i 0, // dummy 281 | fd_fdstat_get: () => 0, // dummy 282 | fd_seek: () => 0, // dummy 283 | "proc_exit": (code) => { 284 | if (global.process) { 285 | // Node.js 286 | process.exit(code); 287 | } else { 288 | // Can't exit in a browser. 289 | throw 'trying to exit with code ' + code; 290 | } 291 | }, 292 | random_get: (bufPtr, bufLen) => { 293 | crypto.getRandomValues(loadSlice(bufPtr, bufLen)); 294 | return 0; 295 | }, 296 | }, 297 | env: { 298 | // func ticks() float64 299 | "runtime.ticks": () => { 300 | return timeOrigin + performance.now(); 301 | }, 302 | 303 | // func sleepTicks(timeout float64) 304 | "runtime.sleepTicks": (timeout) => { 305 | // Do not sleep, only reactivate scheduler after the given timeout. 306 | setTimeout(this._inst.exports.go_scheduler, timeout); 307 | }, 308 | 309 | // https://github.com/tinygo-org/tinygo/issues/1140#issuecomment-718145455 310 | // func finalizeRef(v ref) 311 | "syscall/js.finalizeRef": (v_addr) => { 312 | // Note: TinyGo does not support finalizers so this is only called 313 | // for one specific case, by js.go:jsString. 314 | const id = mem().getUint32(v_addr, true); 315 | this._goRefCounts[id]--; 316 | if (this._goRefCounts[id] === 0) { 317 | const v = this._values[id]; 318 | this._values[id] = null; 319 | this._ids.delete(v); 320 | this._idPool.push(id); 321 | } 322 | }, 323 | 324 | // func stringVal(value string) ref 325 | "syscall/js.stringVal": (ret_ptr, value_ptr, value_len) => { 326 | const s = loadString(value_ptr, value_len); 327 | storeValue(ret_ptr, s); 328 | }, 329 | 330 | // func valueGet(v ref, p string) ref 331 | "syscall/js.valueGet": (retval, v_addr, p_ptr, p_len) => { 332 | let prop = loadString(p_ptr, p_len); 333 | let value = loadValue(v_addr); 334 | let result = Reflect.get(value, prop); 335 | storeValue(retval, result); 336 | }, 337 | 338 | // func valueSet(v ref, p string, x ref) 339 | "syscall/js.valueSet": (v_addr, p_ptr, p_len, x_addr) => { 340 | const v = loadValue(v_addr); 341 | const p = loadString(p_ptr, p_len); 342 | const x = loadValue(x_addr); 343 | Reflect.set(v, p, x); 344 | }, 345 | 346 | // func valueDelete(v ref, p string) 347 | "syscall/js.valueDelete": (v_addr, p_ptr, p_len) => { 348 | const v = loadValue(v_addr); 349 | const p = loadString(p_ptr, p_len); 350 | Reflect.deleteProperty(v, p); 351 | }, 352 | 353 | // func valueIndex(v ref, i int) ref 354 | "syscall/js.valueIndex": (ret_addr, v_addr, i) => { 355 | storeValue(ret_addr, Reflect.get(loadValue(v_addr), i)); 356 | }, 357 | 358 | // valueSetIndex(v ref, i int, x ref) 359 | "syscall/js.valueSetIndex": (v_addr, i, x_addr) => { 360 | Reflect.set(loadValue(v_addr), i, loadValue(x_addr)); 361 | }, 362 | 363 | // func valueCall(v ref, m string, args []ref) (ref, bool) 364 | "syscall/js.valueCall": (ret_addr, v_addr, m_ptr, m_len, args_ptr, args_len, args_cap) => { 365 | const v = loadValue(v_addr); 366 | const name = loadString(m_ptr, m_len); 367 | const args = loadSliceOfValues(args_ptr, args_len, args_cap); 368 | try { 369 | const m = Reflect.get(v, name); 370 | storeValue(ret_addr, Reflect.apply(m, v, args)); 371 | mem().setUint8(ret_addr + 8, 1); 372 | } catch (err) { 373 | storeValue(ret_addr, err); 374 | mem().setUint8(ret_addr + 8, 0); 375 | } 376 | }, 377 | 378 | // func valueInvoke(v ref, args []ref) (ref, bool) 379 | "syscall/js.valueInvoke": (ret_addr, v_addr, args_ptr, args_len, args_cap) => { 380 | try { 381 | const v = loadValue(v_addr); 382 | const args = loadSliceOfValues(args_ptr, args_len, args_cap); 383 | storeValue(ret_addr, Reflect.apply(v, undefined, args)); 384 | mem().setUint8(ret_addr + 8, 1); 385 | } catch (err) { 386 | storeValue(ret_addr, err); 387 | mem().setUint8(ret_addr + 8, 0); 388 | } 389 | }, 390 | 391 | // func valueNew(v ref, args []ref) (ref, bool) 392 | "syscall/js.valueNew": (ret_addr, v_addr, args_ptr, args_len, args_cap) => { 393 | const v = loadValue(v_addr); 394 | const args = loadSliceOfValues(args_ptr, args_len, args_cap); 395 | try { 396 | storeValue(ret_addr, Reflect.construct(v, args)); 397 | mem().setUint8(ret_addr + 8, 1); 398 | } catch (err) { 399 | storeValue(ret_addr, err); 400 | mem().setUint8(ret_addr+ 8, 0); 401 | } 402 | }, 403 | 404 | // func valueLength(v ref) int 405 | "syscall/js.valueLength": (v_addr) => { 406 | return loadValue(v_addr).length; 407 | }, 408 | 409 | // valuePrepareString(v ref) (ref, int) 410 | "syscall/js.valuePrepareString": (ret_addr, v_addr) => { 411 | const s = String(loadValue(v_addr)); 412 | const str = encoder.encode(s); 413 | storeValue(ret_addr, str); 414 | setInt64(ret_addr + 8, str.length); 415 | }, 416 | 417 | // valueLoadString(v ref, b []byte) 418 | "syscall/js.valueLoadString": (v_addr, slice_ptr, slice_len, slice_cap) => { 419 | const str = loadValue(v_addr); 420 | loadSlice(slice_ptr, slice_len, slice_cap).set(str); 421 | }, 422 | 423 | // func valueInstanceOf(v ref, t ref) bool 424 | "syscall/js.valueInstanceOf": (v_addr, t_addr) => { 425 | return loadValue(v_addr) instanceof loadValue(t_addr); 426 | }, 427 | 428 | // func copyBytesToGo(dst []byte, src ref) (int, bool) 429 | "syscall/js.copyBytesToGo": (ret_addr, dest_addr, dest_len, dest_cap, source_addr) => { 430 | let num_bytes_copied_addr = ret_addr; 431 | let returned_status_addr = ret_addr + 4; // Address of returned boolean status variable 432 | 433 | const dst = loadSlice(dest_addr, dest_len); 434 | const src = loadValue(source_addr); 435 | if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) { 436 | mem().setUint8(returned_status_addr, 0); // Return "not ok" status 437 | return; 438 | } 439 | const toCopy = src.subarray(0, dst.length); 440 | dst.set(toCopy); 441 | setInt64(num_bytes_copied_addr, toCopy.length); 442 | mem().setUint8(returned_status_addr, 1); // Return "ok" status 443 | }, 444 | 445 | // copyBytesToJS(dst ref, src []byte) (int, bool) 446 | // Originally copied from upstream Go project, then modified: 447 | // https://github.com/golang/go/blob/3f995c3f3b43033013013e6c7ccc93a9b1411ca9/misc/wasm/wasm_exec.js#L404-L416 448 | "syscall/js.copyBytesToJS": (ret_addr, dest_addr, source_addr, source_len, source_cap) => { 449 | let num_bytes_copied_addr = ret_addr; 450 | let returned_status_addr = ret_addr + 4; // Address of returned boolean status variable 451 | 452 | const dst = loadValue(dest_addr); 453 | const src = loadSlice(source_addr, source_len); 454 | if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) { 455 | mem().setUint8(returned_status_addr, 0); // Return "not ok" status 456 | return; 457 | } 458 | const toCopy = src.subarray(0, dst.length); 459 | dst.set(toCopy); 460 | setInt64(num_bytes_copied_addr, toCopy.length); 461 | mem().setUint8(returned_status_addr, 1); // Return "ok" status 462 | }, 463 | } 464 | }; 465 | } 466 | 467 | async run(instance) { 468 | this._inst = instance; 469 | this._values = [ // JS values that Go currently has references to, indexed by reference id 470 | NaN, 471 | 0, 472 | null, 473 | true, 474 | false, 475 | global, 476 | this, 477 | ]; 478 | this._goRefCounts = []; // number of references that Go has to a JS value, indexed by reference id 479 | this._ids = new Map(); // mapping from JS values to reference ids 480 | this._idPool = []; // unused ids that have been garbage collected 481 | this.exited = false; // whether the Go program has exited 482 | 483 | const mem = new DataView(this._inst.exports.memory.buffer) 484 | 485 | while (true) { 486 | const callbackPromise = new Promise((resolve) => { 487 | this._resolveCallbackPromise = () => { 488 | if (this.exited) { 489 | throw new Error("bad callback: Go program has already exited"); 490 | } 491 | setTimeout(resolve, 0); // make sure it is asynchronous 492 | }; 493 | }); 494 | this._inst.exports._start(); 495 | if (this.exited) { 496 | break; 497 | } 498 | await callbackPromise; 499 | } 500 | } 501 | 502 | _resume() { 503 | if (this.exited) { 504 | throw new Error("Go program has already exited"); 505 | } 506 | this._inst.exports.resume(); 507 | if (this.exited) { 508 | this._resolveExitPromise(); 509 | } 510 | } 511 | 512 | _makeFuncWrapper(id) { 513 | const go = this; 514 | return function () { 515 | const event = { id: id, this: this, args: arguments }; 516 | go._pendingEvent = event; 517 | go._resume(); 518 | return event.result; 519 | }; 520 | } 521 | } 522 | 523 | // not relvant to our usage 524 | 525 | // if ( 526 | // global.require && 527 | // global.require.main === module && 528 | // global.process && 529 | // global.process.versions && 530 | // !global.process.versions.electron 531 | // ) { 532 | // if (process.argv.length != 3) { 533 | // console.error("usage: go_js_wasm_exec [wasm binary] [arguments]"); 534 | // process.exit(1); 535 | // } 536 | 537 | // const go = new Go(); 538 | // WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => { 539 | // return go.run(result.instance); 540 | // }).catch((err) => { 541 | // console.error(err); 542 | // process.exit(1); 543 | // }); 544 | // } 545 | })(); 546 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | //go:build js && wasm 2 | // +build js,wasm 3 | 4 | package main 5 | 6 | import ( 7 | "bytes" 8 | "encoding/json" 9 | "reflect" 10 | "syscall/js" 11 | 12 | "cuelang.org/go/cue" 13 | "cuelang.org/go/cue/ast" 14 | "cuelang.org/go/cue/cuecontext" 15 | "cuelang.org/go/encoding/openapi" 16 | 17 | "github.com/mitchellh/mapstructure" 18 | ) 19 | 20 | func main() { 21 | wait := make(chan struct{}, 0) 22 | api := js.Global().Get("CueWasmAPI") 23 | api.Set("_toJSONImpl", js.FuncOf(toJSON)) 24 | api.Set("_toOpenAPIImpl", js.FuncOf(toOpenAPI)) 25 | api.Set("_toASTImpl", js.FuncOf(toAST)) 26 | <-wait 27 | } 28 | 29 | func toJSON(this js.Value, args []js.Value) interface{} { 30 | ctx := cuecontext.New() 31 | value := ctx.CompileString(args[0].String()) 32 | 33 | err:= value.Err() 34 | if err != nil { 35 | return map[string]interface{}{ 36 | "value": "", 37 | "error": err.Error(), 38 | } 39 | } 40 | 41 | jsonBytes, err := value.MarshalJSON() 42 | if err != nil { 43 | return map[string]interface{}{ 44 | "value": "", 45 | "error": err.Error(), 46 | } 47 | } 48 | return map[string]interface{}{ 49 | "value": string(jsonBytes), 50 | "error": nil, 51 | } 52 | } 53 | 54 | func genOpenAPI(inst *cue.Instance) ([]byte, error) { 55 | b, err := openapi.Gen(inst, nil) 56 | if err != nil { 57 | return nil, err 58 | } 59 | 60 | var out bytes.Buffer 61 | err = json.Indent(&out, b, "", " ") 62 | if err != nil { 63 | return nil, err 64 | } 65 | 66 | return out.Bytes(), nil 67 | } 68 | 69 | func toOpenAPI(this js.Value, args []js.Value) interface{} { 70 | var r cue.Runtime 71 | inst, err := r.Compile("", args[0].String()) 72 | if err != nil { 73 | return map[string]interface{}{ 74 | "value": "", 75 | "error": err.Error(), 76 | } 77 | } 78 | jsonBytes, err := genOpenAPI(inst) 79 | if err != nil { 80 | return map[string]interface{}{ 81 | "value": "", 82 | "error": err.Error(), 83 | } 84 | } 85 | return map[string]interface{}{ 86 | "value": string(jsonBytes), 87 | "error": nil, 88 | } 89 | } 90 | 91 | func With(v interface{}) { 92 | panic(v) 93 | } 94 | func On(err error) { 95 | if err != nil { 96 | panic(err) 97 | } 98 | } 99 | 100 | func Expect(value interface{}, err error) interface{} { 101 | On(err) 102 | return value 103 | } 104 | 105 | func toAST(this js.Value, args []js.Value) interface{} { 106 | ctx := cuecontext.New() 107 | value := ctx.CompileString(args[0].String()) 108 | 109 | err:= value.Err() 110 | if err != nil { 111 | return map[string]interface{}{ 112 | "value": "", 113 | "error": err.Error(), 114 | } 115 | } 116 | astBytes, err := json.Marshal(encodeToPrimitives(value.Source())) 117 | return map[string]interface{}{ 118 | "value": string(astBytes), 119 | "error": err, 120 | } 121 | } 122 | 123 | func newNodeEncoder(result *map[string]interface{}) *mapstructure.Decoder { 124 | return Expect(mapstructure.NewDecoder(&mapstructure.DecoderConfig{ 125 | DecodeHook: encodeHook, 126 | ErrorUnused: true, 127 | Result: result, 128 | })).(*mapstructure.Decoder) 129 | } 130 | func newMapEncoder(result *map[string]interface{}) *mapstructure.Decoder { 131 | return Expect(mapstructure.NewDecoder(&mapstructure.DecoderConfig{ 132 | ErrorUnused: true, 133 | Result: result, 134 | })).(*mapstructure.Decoder) 135 | } 136 | func encodeNode(node ast.Node) map[string]interface{} { 137 | var result map[string]interface{} 138 | On(newNodeEncoder(&result).Decode(node)) 139 | return result 140 | } 141 | 142 | func encodeToPrimitives(node ast.Node) map[string]interface{} { 143 | return encodeNode(node) 144 | } 145 | 146 | 147 | func unwrapNode(node ast.Node) map[string]interface{} { 148 | switch x := node.(type) { 149 | default: 150 | return encodeMap(x) 151 | } 152 | } 153 | 154 | 155 | func encodeMap(source interface{}) map[string]interface{} { 156 | var result map[string]interface{} 157 | On(newMapEncoder(&result).Decode(source)) 158 | return result 159 | } 160 | 161 | 162 | func mapIdent(ident *ast.Ident) interface{} { 163 | mapped := map[string]interface{}{ 164 | "Name": ident.Name, 165 | "NamePos": ident.NamePos, 166 | } 167 | return mapped 168 | } 169 | func mapIdents(idents []*ast.Ident) []interface{} { 170 | items := make([]interface{}, len(idents)) 171 | for i, ident := range idents { 172 | items[i] = mapIdent(ident) 173 | } 174 | return items 175 | } 176 | 177 | func DeclsToNodes(decls []ast.Decl) []ast.Node { 178 | nodes := make([]ast.Node, len(decls)) 179 | for i, decl := range decls { 180 | nodes[i] = decl 181 | } 182 | return nodes 183 | } 184 | func ExprsToNodes(exprs []ast.Expr) []ast.Node { 185 | nodes := make([]ast.Node, len(exprs)) 186 | for i, expr := range exprs { 187 | nodes[i] = expr 188 | } 189 | return nodes 190 | } 191 | func AttributesToNodes(attrs []*ast.Attribute) []ast.Node { 192 | nodes := make([]ast.Node, len(attrs)) 193 | for i, attr := range attrs { 194 | nodes[i] = attr 195 | } 196 | return nodes 197 | } 198 | func ClausesToNodes(clauses []ast.Clause) []ast.Node { 199 | nodes := make([]ast.Node, len(clauses)) 200 | for i, clause := range clauses { 201 | nodes[i] = clause 202 | } 203 | return nodes 204 | } 205 | func ImportSpecsToNodes(importSpecs []*ast.ImportSpec) []ast.Node { 206 | nodes := make([]ast.Node, len(importSpecs)) 207 | for i, importSpec := range importSpecs { 208 | nodes[i] = importSpec 209 | } 210 | return nodes 211 | } 212 | func mapNodes(nodes []ast.Node) []interface{} { 213 | items := make([]interface{}, len(nodes)) 214 | for i, item := range nodes { 215 | if node, ok := item.(ast.Node); ok { 216 | items[i] = encodeNode(node) 217 | } else { 218 | items[i] = item 219 | } 220 | } 221 | return items 222 | } 223 | func nodeInner(nodeMap map[string]interface{}) map[string]interface{} { 224 | for k, v := range nodeMap { 225 | if node, ok := v.(ast.Node); ok { 226 | nodeMap[k] = encodeNode(node) 227 | } 228 | } 229 | return nodeMap 230 | } 231 | 232 | func encodeHook(sourceType reflect.Type, targetType reflect.Type, source interface{}) (interface{}, error) { 233 | if ident, ok := source.(*ast.Ident); ok { 234 | mapped := map[string]interface{}{ 235 | "Name": ident.Name, 236 | "NamePos": ident.NamePos, // todo resolve Node and Scope (cyclic graph). 237 | } 238 | return mapped, nil 239 | } 240 | if node, ok := source.(ast.Node); ok { 241 | mapped := unwrapNode(node) // will still have Node interface values in map values. 242 | return nodeInner(mapped), nil // remap inner Node interface values 243 | } 244 | if decls, ok := source.([]ast.Decl); ok { 245 | nodes := DeclsToNodes(decls) 246 | return mapNodes(nodes), nil 247 | } 248 | if exprs, ok := source.([]ast.Expr); ok { 249 | nodes := ExprsToNodes(exprs) 250 | return mapNodes(nodes), nil 251 | } 252 | if idents, ok := source.([]*ast.Ident); ok { 253 | return mapIdents(idents), nil 254 | } 255 | if importSpecs, ok := source.([]*ast.ImportSpec); ok { 256 | nodes := ImportSpecsToNodes(importSpecs) 257 | return mapNodes(nodes), nil 258 | } 259 | if attrs, ok := source.([]*ast.Attribute); ok { 260 | nodes := AttributesToNodes(attrs) 261 | return mapNodes(nodes), nil 262 | } 263 | if clauses, ok := source.([]ast.Clause); ok { 264 | nodes := ClausesToNodes(clauses) 265 | return mapNodes(nodes), nil 266 | } 267 | return source, nil 268 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cue-wasm", 3 | "version": "1.0.0", 4 | "type": "module", 5 | "source": "lib/index.js", 6 | "exports": { 7 | "require": "./dist/cue-wasm-index.cjs", 8 | "default": "./dist/cue-wasm-index.modern.js" 9 | }, 10 | "main": "./dist/cue-wasm-[name].cjs", 11 | "module": "./dist/cue-wasm-[name].module.js", 12 | "scripts": { 13 | "build": "sudo buildkitd & sleep 5; rm -rf dist/; DOCKER_BUILDKIT=1 sudo nerdctl build -o type=local,dest=./dist -f Dockerfile . && sudo chmod 777 dist & wait", 14 | "test": "jest" 15 | }, 16 | "devDependencies": { 17 | "jest": "^28.1.1", 18 | "lodash.isstring": "^4.0.1", 19 | "memoizee": "^0.4.15", 20 | "microbundle": "^0.15.0", 21 | "pako": "^2.0.4", 22 | "polyfill-crypto.getrandomvalues": "^1.0.0" 23 | }, 24 | "dependencies": { 25 | "@openapi-contrib/openapi-schema-to-json-schema": "^3.2.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /scripts/inline-wasm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | cat <lib/cue.wasm.inline.js 3 | export default "$(cat lib/cue.wasm | gzip | base64 -w0)" 4 | EOF 5 | -------------------------------------------------------------------------------- /tests/index.test.js: -------------------------------------------------------------------------------- 1 | const CUE = require('../dist/cue-wasm-index.cjs'); 2 | 3 | const cueString1 = ` 4 | test: string 5 | test: "test" 6 | `; 7 | 8 | const cueString2 = ` 9 | hello: string 10 | hello: "world" 11 | `; 12 | 13 | ["full"].forEach(variant => { 14 | test(`parses cue to js object - ${variant}`, async () => { 15 | const cue = await CUE.init(variant); 16 | const result = cue.parse(cueString1); 17 | expect(result).toEqual({ test: "test" }); 18 | }); 19 | 20 | test(`parses cue tagged template to js object - ${variant}`, async () => { 21 | const cue = await CUE.init(variant); 22 | const result = cue` 23 | tagged: "template" 24 | `; 25 | expect(result).toEqual({ tagged: "template" }); 26 | }); 27 | 28 | test(`parses cue tagged with int interpolation to js object - ${variant}`, async () => { 29 | const cue = await CUE.init(variant); 30 | const result = cue` 31 | tagged: int 32 | tagged: ${1} 33 | `; 34 | expect(result).toEqual({ tagged: 1 }); 35 | }); 36 | 37 | test(`parses cue tagged with string interpolation to js object - ${variant}`, async () => { 38 | const cue = await CUE.init(variant); 39 | const result = cue` 40 | tagged: string 41 | tagged: "${"test"}" 42 | `; 43 | expect(result).toEqual({ tagged: "test" }); 44 | }); 45 | 46 | test(`parses cue tagged with obj interpolation to js object - ${variant}`, async () => { 47 | const cue = await CUE.init(variant); 48 | const result = cue` 49 | tagged: string 50 | ${{tagged: "test"}} 51 | `; 52 | expect(result).toEqual({ tagged: "test" }); 53 | }); 54 | 55 | test(`parses list of cue strings to js object - ${variant}`, async () => { 56 | const cue = await CUE.init(variant); 57 | const result = cue.parse([cueString1, cueString2]); 58 | expect(result).toEqual({ test: "test", hello: "world" }); 59 | }); 60 | 61 | // Perf tests 62 | // https://github.com/cue-lang/cue/wiki/Creating-test-or-performance-reproducers 63 | // TODO: provide slim/full bundles, this doesn't pass with tinygo 64 | test(`parses cue golden file - ${variant}`, async () => { 65 | const cue = await CUE.init(variant); 66 | const result = cue` 67 | #A: { 68 | a: string 69 | // when using tinygo, breaks with: *a | string 70 | } 71 | 72 | s: [Name=string]: #A & { 73 | a: Name 74 | } 75 | 76 | s: bar: _ 77 | 78 | foo: [ 79 | for _, a in s if a.a != _|_ {a}, 80 | ] 81 | `; 82 | 83 | expect(result).toEqual({ s: { bar: { a: 'bar' } }, foo: [ { a: 'bar' } ] }); 84 | }); 85 | 86 | test(`parses cue to ast - ${variant}`, async () => { 87 | const cue = await CUE.init(variant); 88 | const result = cue.ast` 89 | #A: { 90 | a: string 91 | // when using tinygo, breaks with: *a | string 92 | } 93 | 94 | s: [Name=string]: #A & { 95 | a: Name 96 | } 97 | 98 | s: bar: _ 99 | 100 | foo: [ 101 | for _, a in s if a.a != _|_ {a}, 102 | ] 103 | `; 104 | expect(result).toEqual({ 105 | "Decls": [ 106 | { 107 | "Attrs": [], 108 | "Label": { 109 | "Name": "#A", 110 | "NamePos": {} 111 | }, 112 | "Optional": {}, 113 | "Token": 47, 114 | "TokenPos": {}, 115 | "Value": { 116 | "Elts": [ 117 | { 118 | "Attrs": [], 119 | "Label": { 120 | "Name": "a", 121 | "NamePos": {} 122 | }, 123 | "Optional": {}, 124 | "Token": 47, 125 | "TokenPos": {}, 126 | "Value": { 127 | "Name": "string", 128 | "NamePos": {} 129 | } 130 | } 131 | ], 132 | "Lbrace": {}, 133 | "Rbrace": {} 134 | } 135 | }, 136 | { 137 | "Attrs": [], 138 | "Label": { 139 | "Name": "s", 140 | "NamePos": {} 141 | }, 142 | "Optional": {}, 143 | "Token": 47, 144 | "TokenPos": {}, 145 | "Value": { 146 | "Elts": [ 147 | { 148 | "Attrs": [], 149 | "Label": { 150 | "Elts": [ 151 | { 152 | "Equal": {}, 153 | "Expr": { 154 | "Name": "string", 155 | "NamePos": {} 156 | }, 157 | "Ident": { 158 | "Name": "Name", 159 | "NamePos": {} 160 | } 161 | } 162 | ], 163 | "Lbrack": {}, 164 | "Rbrack": {} 165 | }, 166 | "Optional": {}, 167 | "Token": 47, 168 | "TokenPos": {}, 169 | "Value": { 170 | "Op": 22, 171 | "OpPos": {}, 172 | "X": { 173 | "Name": "#A", 174 | "NamePos": {} 175 | }, 176 | "Y": { 177 | "Elts": [ 178 | { 179 | "Attrs": [], 180 | "Label": { 181 | "Name": "a", 182 | "NamePos": {} 183 | }, 184 | "Optional": {}, 185 | "Token": 47, 186 | "TokenPos": {}, 187 | "Value": { 188 | "Name": "Name", 189 | "NamePos": {} 190 | } 191 | } 192 | ], 193 | "Lbrace": {}, 194 | "Rbrace": {} 195 | } 196 | } 197 | } 198 | ], 199 | "Lbrace": {}, 200 | "Rbrace": {} 201 | } 202 | }, 203 | { 204 | "Attrs": [], 205 | "Label": { 206 | "Name": "s", 207 | "NamePos": {} 208 | }, 209 | "Optional": {}, 210 | "Token": 47, 211 | "TokenPos": {}, 212 | "Value": { 213 | "Elts": [ 214 | { 215 | "Attrs": [], 216 | "Label": { 217 | "Name": "bar", 218 | "NamePos": {} 219 | }, 220 | "Optional": {}, 221 | "Token": 47, 222 | "TokenPos": {}, 223 | "Value": { 224 | "Name": "_", 225 | "NamePos": {} 226 | } 227 | } 228 | ], 229 | "Lbrace": {}, 230 | "Rbrace": {} 231 | } 232 | }, 233 | { 234 | "Attrs": [], 235 | "Label": { 236 | "Name": "foo", 237 | "NamePos": {} 238 | }, 239 | "Optional": {}, 240 | "Token": 47, 241 | "TokenPos": {}, 242 | "Value": { 243 | "Elts": [ 244 | { 245 | "Clauses": [ 246 | { 247 | "Colon": {}, 248 | "For": {}, 249 | "In": {}, 250 | "Key": { 251 | "Name": "_", 252 | "NamePos": {} 253 | }, 254 | "Source": { 255 | "Name": "s", 256 | "NamePos": {} 257 | }, 258 | "Value": { 259 | "Name": "a", 260 | "NamePos": {} 261 | } 262 | }, 263 | { 264 | "Condition": { 265 | "Op": 32, 266 | "OpPos": {}, 267 | "X": { 268 | "Sel": { 269 | "Name": "a", 270 | "NamePos": {} 271 | }, 272 | "X": { 273 | "Name": "a", 274 | "NamePos": {} 275 | } 276 | }, 277 | "Y": { 278 | "Bottom": {} 279 | } 280 | }, 281 | "If": {} 282 | } 283 | ], 284 | "Value": { 285 | "Elts": [ 286 | { 287 | "Expr": { 288 | "Name": "a", 289 | "NamePos": {} 290 | } 291 | } 292 | ], 293 | "Lbrace": {}, 294 | "Rbrace": {} 295 | } 296 | } 297 | ], 298 | "Lbrack": {}, 299 | "Rbrack": {} 300 | } 301 | } 302 | ], 303 | "Filename": "", 304 | "Imports": [], 305 | "Unresolved": [ 306 | { 307 | "Name": "string", 308 | "NamePos": {} 309 | }, 310 | { 311 | "Name": "string", 312 | "NamePos": {} 313 | }, 314 | { 315 | "Name": "_", 316 | "NamePos": {} 317 | }, 318 | { 319 | "Name": "string", 320 | "NamePos": {} 321 | }, 322 | { 323 | "Name": "string", 324 | "NamePos": {} 325 | }, 326 | { 327 | "Name": "_", 328 | "NamePos": {} 329 | } 330 | ] 331 | }); 332 | }); 333 | 334 | if (variant !== "slim") { 335 | test(`parses cue schema - ${variant}`, async () => { 336 | const cue = await CUE.init(variant); 337 | const result = cue.schema` 338 | #Identity: { 339 | // first name of the person 340 | first: =~ "[A-Z].*" 341 | // Last name of the person 342 | Last: =~ "[A-Z].*" 343 | // Age of the person 344 | Age?: number & < 130 345 | } 346 | `; 347 | // TODO: fails with slim version 348 | expect(result).toEqual({ 349 | "$schema": "http://json-schema.org/draft-04/schema#", 350 | Identity: { 351 | type: "object", 352 | required: [ 353 | "first", 354 | "Last" 355 | ], 356 | properties: { 357 | first: { 358 | description: "first name of the person", 359 | type: "string", 360 | pattern: "[A-Z].*" 361 | }, 362 | Last: { 363 | description: "Last name of the person", 364 | type: "string", 365 | pattern: "[A-Z].*" 366 | }, 367 | Age: { 368 | description: "Age of the person", 369 | type: "number", 370 | maximum: 130, 371 | exclusiveMaximum: true 372 | } 373 | } 374 | } 375 | }); 376 | }); 377 | } 378 | }) 379 | 380 | 381 | 382 | --------------------------------------------------------------------------------