compressed-script-loader 1.2.14 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/bin/cslpack.js +3 -16
- package/csl-types.d.ts +113 -0
- package/import-map.d.ts +15 -0
- package/index.d.ts +30 -19
- package/package.json +1 -1
- package/umd/index.js +2 -11
- package/unzip-sync.d.ts +73 -1
- package/webpack/index.js +2 -10
- package/webpack-esm/index.mjs +2 -10
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ but for some servers that do not perform compression transfer, this module can b
|
|
|
19
19
|
## 📇 Details
|
|
20
20
|
|
|
21
21
|
+ Use code with **comment** extraction feature added to `unzipSync` of [`fflate`][1].
|
|
22
|
+
|
|
22
23
|
+ **comment** is used to embed [**SRI**][2]. (`script.integrity`)
|
|
23
24
|
If comment is omitted or does not pass to verify process that it is [**SRI**][2],
|
|
24
25
|
the unziped code will be bound to the `text` property of `script` element.
|
|
@@ -35,12 +36,16 @@ You can use `sha256`, `sha384`, and `sha512` in `script.integrity`, and the pref
|
|
|
35
36
|
</script>
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
39
|
+ [**`cslpack`**](#cslpack-cli-since-v12x) cli - simple zip tool is available (since v1.2.x)
|
|
40
40
|
|
|
41
|
+
+ support module pack (experimental, since v1.3.x)
|
|
42
|
+
|
|
43
|
+
+ `importmap` is auto generate
|
|
44
|
+
|
|
45
|
+
|
|
41
46
|
## 🖌️ TODO
|
|
42
47
|
|
|
43
|
-
+ `type="module"`
|
|
48
|
+
+ `type="module"` - stage 1 (v1.3.4, unstable)
|
|
44
49
|
|
|
45
50
|
## 🦯 Use for SPA
|
|
46
51
|
|
|
@@ -121,21 +126,28 @@ You can use `sha256`, `sha384`, and `sha512` in `script.integrity`, and the pref
|
|
|
121
126
|
|
|
122
127
|
uses [fflate][1]'s `zipSync` feature
|
|
123
128
|
|
|
124
|
-
`$ cslpack <jspath> <jspath>... [-(d|dest) <output zip path>] [-sha <256|384|512>]`
|
|
129
|
+
`$ cslpack <jspath> <jspath>... [-(d|dest) <output zip path>] [-sha <256|384|512>] [-m <main module name with extension>]`
|
|
125
130
|
|
|
126
131
|
+ options
|
|
127
|
-
* `-(d|dest)
|
|
128
|
-
+ `-sha`
|
|
132
|
+
* `-(d|dest)`- output zip path. when omited will be output to **`./dist/bundle.zip`**
|
|
133
|
+
+ `-sha` - [256|384|512] when omited use 384 "sha384" (since v1.2.8)
|
|
134
|
+
+ `-m` - When packing as an esm module, specify the script name such as `main.js` that will be the entry point. pack as esm module with "importmap" data.
|
|
135
|
+
"importmap" is auto generate and pack together. (since v1.3 experimental)
|
|
129
136
|
|
|
130
137
|
**example:**
|
|
131
138
|
|
|
132
139
|
```shell
|
|
133
140
|
# apply just `sha384`
|
|
134
141
|
$ cslpack -d dist/lib/bundle.zip build/{bundle,data}.js
|
|
142
|
+
|
|
135
143
|
# or
|
|
136
144
|
$ cslpack build/{cjs,esm}/* -dest dist/lib/bundle.zip -sha 512
|
|
145
|
+
|
|
137
146
|
# will be output to "./dist/bundle.zip"
|
|
138
147
|
$ cslpack build/{cjs,esm}/*
|
|
148
|
+
|
|
149
|
+
# pack as `esm` module. `main.js` is `build/esm/main.js`
|
|
150
|
+
$ clspack build/esm/*.js build/lib/hoge-data.js -m main.js
|
|
139
151
|
```
|
|
140
152
|
|
|
141
153
|
> NOTE: \`cslpack\` does not keep directory path
|
package/bin/cslpack.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*! For license information please see cslpack.js.LICENSE.txt */
|
|
3
|
-
(()=>{var _wm_={274:module=>{
|
|
4
|
-
;
|
|
5
|
-
;
|
|
6
|
-
s=new o(1<<r);var c=15-r;for(a=0;a<t;++a)if(e[a])for(var l=a<<4|e[a],u=r-e[a],v=f[e[a]-1]++<<u,p=v|(1<<u)-1;v<=p;++v)s[g[v]>>>c]=l}else for(s=new o(t),a=0;a<t;++a)e[a]&&(s[a]=g[f[e[a]-1]++]>>>15-e[a]);return s},b=new a(288);for(_=0;_<144;++_)b[_]=8;for(_=144;_<256;++_)b[_]=9;for(_=256;_<280;++_)b[_]=7;for(_=280;_<288;++_)b[_]=8;var x=new a(32);for(_=0;_<32;++_)x[_]=5;var y=w(b,9,0),k=w(x,5,0),E=function(e){return(e+7)/8|0},M=function(e,r,n){(null==r||r<0)&&(r=0),(null==n||n>e.length)&&(n=e.length);var t=new(2==e.BYTES_PER_ELEMENT?o:4==e.BYTES_PER_ELEMENT?i:a)(n-r);return t.set(e.subarray(r,n)),t
|
|
7
|
-
},z=['unexpected EOF','invalid block type','invalid length/literal','invalid distance','stream finished','no stream handler',,'no callback','invalid UTF-8 data','extra field too long','date not in range 1980-2099','filename too long','stream finishing','invalid zip data'],T=function(e,r,n){var t=new Error(r||z[e]);if(t.code=e,Error.captureStackTrace&&Error.captureStackTrace(t,T),!n)throw t;return t},A=function(e,r,n){n<<=7&r;var t=r/8|0;e[t]|=n,e[t+1]|=n>>>8},S=function(e,r,n){n<<=7&r;var t=r/8|0;e[t]|=n,e[t+1]|=n>>>8,e[t+2]|=n>>>16},j=function(e,r){for(var n=[],t=0;t<e.length;++t)e[t]&&n.push({s:t,f:e[t]});var i=n.length,s=n.slice();if(!i)return[R,0];if(1==i){var f=new a(n[0].s+1);return f[n[0].s]=1,[f,1]}n.sort((function(e,r){return e.f-r.f})),n.push({s:-1,f:25001})
|
|
8
|
-
;var c=n[0],l=n[1],u=0,v=1,p=2;for(n[0]={s:-1,f:c.f+l.f,l:c,r:l};v!=i-1;)c=n[n[u].f<n[p].f?u++:p++],l=n[u!=v&&n[u].f<n[p].f?u++:p++],n[v++]={s:-1,f:c.f+l.f,l:c,r:l};var d=s[0].s;for(t=1;t<i;++t)s[t].s>d&&(d=s[t].s);var h=new o(d+1),g=q(n[v-1],h,0);if(g>r){t=0;var _=0,m=g-r,w=1<<m;for(s.sort((function(e,r){return h[r.s]-h[e.s]||e.f-r.f}));t<i;++t){var b=s[t].s;if(!(h[b]>r))break;_+=w-(1<<g-h[b]),h[b]=r}for(_>>>=m;_>0;){var x=s[t].s;h[x]<r?_-=1<<r-h[x]++-1:++t}for(;t>=0&&_;--t){var y=s[t].s;h[y]==r&&(--h[y],++_)}g=r}return[new a(h),g]},q=function(e,r,n){return-1==e.s?Math.max(q(e.l,r,n+1),q(e.r,r,n+1)):r[e.s]=n},O=function(e){for(var r=e.length;r&&!e[--r];);for(var n=new o(++r),t=0,a=e[0],i=1,s=function(e){n[t++]=e},f=1;f<=r;++f)if(e[f]==a&&f!=r)++i;else{if(!a&&i>2){
|
|
9
|
-
for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(a),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(a);i=1,a=e[f]}return[n.subarray(0,t),r]},$=function(e,r){for(var n=0,t=0;t<r.length;++t)n+=e[t]*r[t];return n},I=function(e,r,n){var t=n.length,a=E(r+2);e[a]=255&t,e[a+1]=t>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;o<t;++o)e[a+o+4]=n[o];return 8*(a+4+t)},F=function(e,r,n,t,a,i,l,u,v,p,d){A(r,d++,n),++a[256];for(var h=j(a,15),g=h[0],_=h[1],m=j(i,15),E=m[0],M=m[1],z=O(g),T=z[0],q=z[1],F=O(E),D=F[0],R=F[1],P=new o(19),U=0;U<T.length;++U)P[31&T[U]]++;for(U=0;U<D.length;++U)P[31&D[U]]++;for(var C=j(P,7),N=C[0],Y=C[1],B=19;B>4&&!N[c[B-1]];--B);
|
|
10
|
-
var L,W,H,G,J=p+5<<3,K=$(a,b)+$(i,x)+l,Q=$(a,g)+$(i,E)+l+14+3*B+$(P,N)+(2*P[16]+3*P[17]+7*P[18]);if(J<=K&&J<=Q)return I(r,d,e.subarray(v,v+p));if(A(r,d,1+(Q<K)),d+=2,Q<K){L=w(g,_,0),W=g,H=w(E,M,0),G=E;var V=w(N,Y,0);A(r,d,q-257),A(r,d+5,R-1),A(r,d+10,B-4),d+=14;for(U=0;U<B;++U)A(r,d+3*U,N[c[U]]);d+=3*B;for(var X=[T,D],Z=0;Z<2;++Z){var ee=X[Z];for(U=0;U<ee.length;++U){var re=31&ee[U];A(r,d,V[re]),d+=N[re],re>15&&(A(r,d,ee[U]>>>5&127),d+=ee[U]>>>12)}}}else L=y,W=b,H=k,G=x;for(U=0;U<u;++U)if(t[U]>255){re=t[U]>>>18&31;S(r,d,L[re+257]),d+=W[re+257],re>7&&(A(r,d,t[U]>>>23&31),d+=s[re]);var ne=31&t[U];S(r,d,H[ne]),d+=G[ne],ne>3&&(S(r,d,t[U]>>>5&8191),d+=f[ne])}else S(r,d,L[t[U]]),d+=W[t[U]];return S(r,d,L[256]),d+W[256]
|
|
11
|
-
},D=new i([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),R=new a(0),P=function(e,r,n,t,c,l){var u=e.length,v=new a(t+u+5*(1+Math.ceil(u/7e3))+c),d=v.subarray(t,v.length-c),g=0;if(!r||u<8)for(var _=0;_<=u;_+=65535){var m=_+65535;m>=u&&(d[g>>3]=l),g=I(d,g+1,e.subarray(_,m))}else{for(var w=D[r-1],b=w>>>13,x=8191&w,y=(1<<n)-1,k=new o(32768),z=new o(y+1),T=Math.ceil(n/3),A=2*T,S=function(r){return(e[r]^e[r+1]<<T^e[r+2]<<A)&y},j=new i(25e3),q=new o(288),O=new o(32),$=0,P=0,U=(_=0,0),C=0,N=0;_<u;++_){var Y=S(_),B=32767&_,L=z[Y];if(k[B]=L,z[Y]=B,C<=_){var W=u-_;if(($>7e3||U>24576)&&W>423){g=F(e,d,0,j,q,O,P,U,N,_-N,g),U=$=P=0,N=_;for(var H=0;H<286;++H)q[H]=0;for(H=0;H<30;++H)O[H]=0}var G=2,J=0,K=x,Q=B-L&32767
|
|
12
|
-
;if(W>2&&Y==S(_-Q))for(var V=Math.min(b,W)-1,X=Math.min(32767,_),Z=Math.min(258,W);Q<=X&&--K&&B!=L;){if(e[_+G]==e[_+G-Q]){for(var ee=0;ee<Z&&e[_+ee]==e[_+ee-Q];++ee);if(ee>G){if(G=ee,J=Q,ee>V)break;var re=Math.min(Q,ee-2),ne=0;for(H=0;H<re;++H){var te=_-Q+H+32768&32767,ae=te-k[te]+32768&32767;ae>ne&&(ne=ae,L=te)}}}Q+=(B=L)-(L=k[B])+32768&32767}if(J){j[U++]=268435456|p[G]<<18|h[J];var oe=31&p[G],ie=31&h[J];P+=s[oe]+f[ie],++q[257+oe],++O[ie],C=_+G,++$}else j[U++]=e[_],++q[e[_]]}}g=F(e,d,l,j,q,O,P,U,N,_-N,g),!l&&7&g&&(g=I(d,g+1,R))}return M(v,0,t+E(g)+c)},U=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var n=r,t=9;--t;)n=(1&n&&-306674912)^n>>>1;e[r]=n}return e}(),C=function(){var e=-1;return{p:function(r){for(var n=e,t=0;t<r.length;++t)n=U[255&n^r[t]]^n>>>8;e=n},d:function(){
|
|
13
|
-
return~e}}},N=function(e,r,n,t,a){return P(e,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+r.mem,n,t,!a)},Y=function(e,r){var n={};for(var t in e)n[t]=e[t];for(var t in r)n[t]=r[t];return n},B=function(e,r,n){for(;n;++r)e[r]=n,n>>>=8};function L(e,r){return N(e,r||{},0,0)}var W=function(e,r,n,t){for(var o in e){var i=e[o],s=r+o,f=t;Array.isArray(i)&&(f=Y(t,i[1]),i=i[0]),i instanceof a?n[s]=[i,f]:(n[s+='/']=[new a(0),f],W(i,s,n,t))}},H='undefined'!=typeof TextEncoder&&new TextEncoder,G='undefined'!=typeof TextDecoder&&new TextDecoder;try{G.decode(R,{stream:!0}),1}catch(e){}function J(e,r){if(r){for(var n=new a(e.length),t=0;t<e.length;++t)n[t]=e.charCodeAt(t);return n}if(H)return H.encode(e)
|
|
14
|
-
;var o=e.length,i=new a(e.length+(e.length>>1)),s=0,f=function(e){i[s++]=e};for(t=0;t<o;++t){if(s+5>i.length){var c=new a(s+8+(o-t<<1));c.set(i),i=c}var l=e.charCodeAt(t);l<128||r?f(l):l<2048?(f(192|l>>6),f(128|63&l)):l>55295&&l<57344?(f(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++t))>>18),f(128|l>>12&63),f(128|l>>6&63),f(128|63&l)):(f(224|l>>12),f(128|l>>6&63),f(128|63&l))}return M(i,0,s)}var K=function(e){var r=0;if(e)for(var n in e){var t=e[n].length;t>65535&&T(9),r+=t+4}return r},Q=function(e,r,n,t,a,o,i,s){var f=t.length,c=n.extra,l=s&&s.length,u=K(c);B(e,r,null!=i?33639248:67324752),r+=4,null!=i&&(e[r++]=20,e[r++]=n.os),e[r]=20,r+=2,e[r++]=n.flag<<1|(null==o&&8),e[r++]=a&&8,e[r++]=255&n.compression,e[r++]=n.compression>>8
|
|
15
|
-
;var v=new Date(null==n.mtime?Date.now():n.mtime),p=v.getFullYear()-1980;if((p<0||p>119)&&T(10),B(e,r,p<<25|v.getMonth()+1<<21|v.getDate()<<16|v.getHours()<<11|v.getMinutes()<<5|v.getSeconds()>>>1),r+=4,null!=o&&(B(e,r,n.crc),B(e,r+4,o),B(e,r+8,n.size)),B(e,r+12,f),B(e,r+14,u),r+=16,null!=i&&(B(e,r,l),B(e,r+6,n.attrs),B(e,r+10,i),r+=14),e.set(t,r),r+=f,u)for(var d in c){var h=c[d],g=h.length;B(e,r,+d),B(e,r+2,g),e.set(h,r+4),r+=4+g}return l&&(e.set(s,r),r+=l),r},V=function(e,r,n,t,a){B(e,r,101010256),B(e,r+8,n),B(e,r+10,n),B(e,r+12,t),B(e,r+16,a)};'function'==typeof queueMicrotask?queueMicrotask:'function'==typeof setTimeout&&setTimeout
|
|
16
|
-
;const X=require("util"),Z=["zip","gz","png","jpg","jpeg","pdf","doc","docx","ppt","pptx","xls","xlsx","heic","heif","7z","bz2","rar","gif","webp","webm","mp4","mov","mp3","aifc"],ee=new X.TextEncoder;const re=n();console.log(re),Object.keys(re).length&&re.args||(console.log("\n> ERROR: the file to pack is required\n\n$ cslpack <jspath> <jspath>... [-(d|dest) <output zip path>] [-sha <256|384|512>]\n\n -(d|dest) : zip output path. when omited will be output to ./dist/bundle.zip\n -sha : [256|384|512] when omited use 384 \"sha384\"\n\n NOTE: `cslpack` does not keep directory path\n"),process.exit(0));const ne=new class{zipObj={};add(r,n){const a=t.parse(r),o=`${a.dir}/${a.base}`,i=ee.encode(e.readFileSync(o,"utf8"));i&&(this.zipObj[a.base]=[i,{level:-1===Z.indexOf(a.ext)?6:0,
|
|
17
|
-
comment:n}])}emit(r){const n=`[fflate.zip:${r}]`;console.time(n);const o=function(e,r){r||(r={});var n={},t=[];W(e,'',n,r);var o=0,i=0;for(var s in n){var f=n[s],c=f[0],l=f[1],u=0==l.level?0:8,v=(E=J(s)).length,p=l.comment,d=p&&J(p),h=d&&d.length,g=K(l.extra);v>65535&&T(11);var _=u?L(c,l):c,m=_.length,w=C();w.p(c),t.push(Y(l,{size:c.length,crc:w.d(),c:_,f:E,m:d,u:v!=s.length||d&&p.length!=h,o,compression:u})),o+=30+v+g+m,i+=76+2*(v+g)+(h||0)+m}for(var b=new a(i+22),x=o,y=i-o,k=0;k<t.length;++k){var E=t[k];Q(b,E.o,E,E.f,E.u,E.c.length);var M=30+E.f.length+K(E.extra);b.set(E.c,E.o+M),Q(b,o,E,E.f,E.u,E.c.length,E.o,E.m),o+=16+M+(E.m?E.m.length:0)}return V(b,o,t.length,y,x),b}(this.zipObj,{});(r=>{const n=t.dirname(r);e.existsSync(n)||e.mkdirSync(n,{recursive:!0})})(r),
|
|
18
|
-
e.writeFile(r,o,"binary",(()=>{console.timeEnd(n),this.zipObj={}}))}clear(){this.zipObj={}}};let te=re.sha;/256|384|512/.test(te)||(te="384");for(const n of re.args){if(e.statSync(n).isFile()){const e=r.execSync(`bash -c "echo -n $(openssl dgst -sha${te} -binary ${n} | openssl base64 -A)"`,{encoding:"utf8"});ne.add(n,e)}}ne.emit(re.d||re.dest||"./dist/bundle.zip")})(),module.exports=_we_})();
|
|
3
|
+
(()=>{var _wm_={274:module=>{const tinArgs=(acfg,dbg=!1)=>{dbg&&console.log("process.argv: ",process.argv),acfg=acfg||{};const pfix=acfg.prefix||"-",vIdx=pfix.length,eIdx=acfg.startIndex||2,pms={};if(process.argv.length>eIdx){const cArgs=process.argv;for(let idx=eIdx;idx<cArgs.length;){const opt=cArgs[idx++];if(opt)if(opt.startsWith(pfix)){let v=cArgs[idx];void 0===v||v.startsWith(pfix)?v=!0:(/^\[.+\]$/.test(v)||/^(?:re)?\/[^/]+\/[gimuys]{0,6}$/.test(v)?(/^re\//.test(v)&&(v=v.substring(2)),v=eval(v)):/\\,/.test(v)?v=v.replace(/\\,/g,","):/,/.test(v)?v=v.split(","):/^(?:-?\.?\d+(?:\.\d*)?|0x[\da-f]+)$/i.test(v)&&(v=+v),idx++),pms[opt.substring(vIdx)]=v}else(pms.args||(pms.args=[])).push(opt)}}return pms};module.exports=tinArgs}},_wmc_={};function _wr_(e){var r=_wmc_[e];if(void 0!==r)return r.exports;var t=_wmc_[e]={exports:{}};return _wm_[e](t,t.exports,_wr_),t.exports}_wr_.r=e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})};var _we_={};(()=>{"use strict";_wr_.r(_we_);const e=require("fs"),r=require("child_process");var t=_wr_(274);const n=require("path");var a=Uint8Array,o=Uint16Array,i=Uint32Array,s=new a([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,0,0,0]),f=new a([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,0,0]),l=new a([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=function(e,r){for(var t=new o(31),n=0;n<31;++n)t[n]=r+=1<<e[n-1];var a=new i(t[30]);for(n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)a[s]=s-t[n]<<5|n;return[t,a]},u=c(s,2),v=u[0],p=u[1];v[28]=258,p[258]=28;for(var h=c(f,0),d=(h[0],h[1]),g=new o(32768),m=0;m<32768;++m){var _=(43690&m)>>>1|(21845&m)<<1;_=(61680&(_=(52428&_)>>>2|(13107&_)<<2))>>>4|(3855&_)<<4,g[m]=((65280&_)>>>8|(255&_)<<8)>>>1}var w=function(e,r,t){for(var n=e.length,a=0,i=new o(r);a<n;++a)e[a]&&++i[e[a]-1];var s,f=new o(r);for(a=0;a<r;++a)f[a]=f[a-1]+i[a-1]<<1;if(t){s=new o(1<<r);var l=15-r;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=r-e[a],v=f[e[a]-1]++<<u,p=v|(1<<u)-1;v<=p;++v)s[g[v]>>>l]=c}else for(s=new o(n),a=0;a<n;++a)e[a]&&(s[a]=g[f[e[a]-1]++]>>>15-e[a]);return s},x=new a(288);for(m=0;m<144;++m)x[m]=8;for(m=144;m<256;++m)x[m]=9;for(m=256;m<280;++m)x[m]=7;for(m=280;m<288;++m)x[m]=8;var b=new a(32);for(m=0;m<32;++m)b[m]=5;var y=w(x,9,0),k=w(b,5,0),M=function(e){return(e+7)/8|0},E=function(e,r,t){(null==r||r<0)&&(r=0),(null==t||t>e.length)&&(t=e.length);var n=new(2==e.BYTES_PER_ELEMENT?o:4==e.BYTES_PER_ELEMENT?i:a)(t-r);return n.set(e.subarray(r,t)),n},T=['unexpected EOF','invalid block type','invalid length/literal','invalid distance','stream finished','no stream handler',,'no callback','invalid UTF-8 data','extra field too long','date not in range 1980-2099','filename too long','stream finishing','invalid zip data'],A=function(e,r,t){var n=new Error(r||T[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,A),!t)throw n;return n},S=function(e,r,t){t<<=7&r;var n=r/8|0;e[n]|=t,e[n+1]|=t>>>8},q=function(e,r,t){t<<=7&r;var n=r/8|0;e[n]|=t,e[n+1]|=t>>>8,e[n+2]|=t>>>16},$=function(e,r){for(var t=[],n=0;n<e.length;++n)e[n]&&t.push({s:n,f:e[n]});var i=t.length,s=t.slice();if(!i)return[R,0];if(1==i){var f=new a(t[0].s+1);return f[t[0].s]=1,[f,1]}t.sort((function(e,r){return e.f-r.f})),t.push({s:-1,f:25001});var l=t[0],c=t[1],u=0,v=1,p=2;for(t[0]={s:-1,f:l.f+c.f,l,r:c};v!=i-1;)l=t[t[u].f<t[p].f?u++:p++],c=t[u!=v&&t[u].f<t[p].f?u++:p++],t[v++]={s:-1,f:l.f+c.f,l,r:c};var h=s[0].s;for(n=1;n<i;++n)s[n].s>h&&(h=s[n].s);var d=new o(h+1),g=z(t[v-1],d,0);if(g>r){n=0;var m=0,_=g-r,w=1<<_;for(s.sort((function(e,r){return d[r.s]-d[e.s]||e.f-r.f}));n<i;++n){var x=s[n].s;if(!(d[x]>r))break;m+=w-(1<<g-d[x]),d[x]=r}for(m>>>=_;m>0;){var b=s[n].s;d[b]<r?m-=1<<r-d[b]++-1:++n}for(;n>=0&&m;--n){var y=s[n].s;d[y]==r&&(--d[y],++m)}g=r}return[new a(d),g]},z=function(e,r,t){return-1==e.s?Math.max(z(e.l,r,t+1),z(e.r,r,t+1)):r[e.s]=t},I=function(e){for(var r=e.length;r&&!e[--r];);for(var t=new o(++r),n=0,a=e[0],i=1,s=function(e){t[n++]=e},f=1;f<=r;++f)if(e[f]==a&&f!=r)++i;else{if(!a&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(s(a),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0)}for(;i--;)s(a);i=1,a=e[f]}return[t.subarray(0,n),r]},j=function(e,r){for(var t=0,n=0;n<r.length;++n)t+=e[n]*r[n];return t},F=function(e,r,t){var n=t.length,a=M(r+2);e[a]=255&n,e[a+1]=n>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;o<n;++o)e[a+o+4]=t[o];return 8*(a+4+n)},O=function(e,r,t,n,a,i,c,u,v,p,h){S(r,h++,t),++a[256];for(var d=$(a,15),g=d[0],m=d[1],_=$(i,15),M=_[0],E=_[1],T=I(g),A=T[0],z=T[1],O=I(M),D=O[0],R=O[1],N=new o(19),P=0;P<A.length;++P)N[31&A[P]]++;for(P=0;P<D.length;++P)N[31&D[P]]++
|
|
4
|
+
;for(var U=$(N,7),C=U[0],W=U[1],Y=19;Y>4&&!C[l[Y-1]];--Y);var B,L,H,J,G=p+5<<3,K=j(a,x)+j(i,b)+c,Q=j(a,g)+j(i,M)+c+14+3*Y+j(N,C)+(2*N[16]+3*N[17]+7*N[18]);if(G<=K&&G<=Q)return F(r,h,e.subarray(v,v+p));if(S(r,h,1+(Q<K)),h+=2,Q<K){B=w(g,m,0),L=g,H=w(M,E,0),J=M;var V=w(C,W,0);S(r,h,z-257),S(r,h+5,R-1),S(r,h+10,Y-4),h+=14;for(P=0;P<Y;++P)S(r,h+3*P,C[l[P]]);h+=3*Y;for(var X=[A,D],Z=0;Z<2;++Z){var ee=X[Z];for(P=0;P<ee.length;++P){var re=31&ee[P];S(r,h,V[re]),h+=C[re],re>15&&(S(r,h,ee[P]>>>5&127),h+=ee[P]>>>12)}}}else B=y,L=x,H=k,J=b;for(P=0;P<u;++P)if(n[P]>255){re=n[P]>>>18&31;q(r,h,B[re+257]),h+=L[re+257],re>7&&(S(r,h,n[P]>>>23&31),h+=s[re]);var te=31&n[P];q(r,h,H[te]),h+=J[te],te>3&&(q(r,h,n[P]>>>5&8191),h+=f[te])}else q(r,h,B[n[P]]),h+=L[n[P]];return q(r,h,B[256]),h+L[256]},D=new i([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),R=new a(0),N=function(e,r,t,n,l,c){var u=e.length,v=new a(n+u+5*(1+Math.ceil(u/7e3))+l),h=v.subarray(n,v.length-l),g=0;if(!r||u<8)for(var m=0;m<=u;m+=65535){var _=m+65535;_>=u&&(h[g>>3]=c),g=F(h,g+1,e.subarray(m,_))}else{for(var w=D[r-1],x=w>>>13,b=8191&w,y=(1<<t)-1,k=new o(32768),T=new o(y+1),A=Math.ceil(t/3),S=2*A,q=function(r){return(e[r]^e[r+1]<<A^e[r+2]<<S)&y},$=new i(25e3),z=new o(288),I=new o(32),j=0,N=0,P=(m=0,0),U=0,C=0;m<u;++m){var W=q(m),Y=32767&m,B=T[W];if(k[Y]=B,T[W]=Y,U<=m){var L=u-m;if((j>7e3||P>24576)&&L>423){g=O(e,h,0,$,z,I,N,P,C,m-C,g),P=j=N=0,C=m;for(var H=0;H<286;++H)z[H]=0;for(H=0;H<30;++H)I[H]=0}var J=2,G=0,K=b,Q=Y-B&32767;if(L>2&&W==q(m-Q))for(var V=Math.min(x,L)-1,X=Math.min(32767,m),Z=Math.min(258,L);Q<=X&&--K&&Y!=B;){if(e[m+J]==e[m+J-Q]){for(var ee=0;ee<Z&&e[m+ee]==e[m+ee-Q];++ee);if(ee>J){if(J=ee,G=Q,ee>V)break;var re=Math.min(Q,ee-2),te=0;for(H=0;H<re;++H){var ne=m-Q+H+32768&32767,ae=ne-k[ne]+32768&32767;ae>te&&(te=ae,B=ne)}}}Q+=(Y=B)-(B=k[Y])+32768&32767}if(G){$[P++]=268435456|p[J]<<18|d[G];var oe=31&p[J],ie=31&d[G];N+=s[oe]+f[ie],++z[257+oe],++I[ie],U=m+J,++j}else $[P++]=e[m],++z[e[m]]}}g=O(e,h,c,$,z,I,N,P,C,m-C,g),!c&&7&g&&(g=F(h,g+1,R))}return E(v,0,n+M(g)+l)},P=function(){for(var e=new Int32Array(256),r=0;r<256;++r){for(var t=r,n=9;--n;)t=(1&t&&-306674912)^t>>>1;e[r]=t}return e}(),U=function(){var e=-1;return{p:function(r){for(var t=e,n=0;n<r.length;++n)t=P[255&t^r[n]]^t>>>8;e=t},d:function(){return~e}}},C=function(e,r,t,n,a){return N(e,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+r.mem,t,n,!a)},W=function(e,r){var t={};for(var n in e)t[n]=e[n];for(var n in r)t[n]=r[n];return t},Y=function(e,r,t){for(;t;++r)e[r]=t,t>>>=8};function B(e,r){return C(e,r||{},0,0)}var L=function(e,r,t,n){for(var o in e){var i=e[o],s=r+o,f=n;Array.isArray(i)&&(f=W(n,i[1]),i=i[0]),i instanceof a?t[s]=[i,f]:(t[s+='/']=[new a(0),f],L(i,s,t,n))}},H='undefined'!=typeof TextEncoder&&new TextEncoder,J='undefined'!=typeof TextDecoder&&new TextDecoder;try{J.decode(R,{stream:!0}),1}catch(e){}function G(e,r){if(r){for(var t=new a(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}if(H)return H.encode(e);var o=e.length,i=new a(e.length+(e.length>>1)),s=0,f=function(e){i[s++]=e};for(n=0;n<o;++n){if(s+5>i.length){var l=new a(s+8+(o-n<<1));l.set(i),i=l}var c=e.charCodeAt(n);c<128||r?f(c):c<2048?(f(192|c>>6),f(128|63&c)):c>55295&&c<57344?(f(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++n))>>18),f(128|c>>12&63),f(128|c>>6&63),f(128|63&c)):(f(224|c>>12),f(128|c>>6&63),f(128|63&c))}return E(i,0,s)}var K=function(e){var r=0;if(e)for(var t in e){var n=e[t].length;n>65535&&A(9),r+=n+4}return r},Q=function(e,r,t,n,a,o,i,s){var f=n.length,l=t.extra,c=s&&s.length,u=K(l);Y(e,r,null!=i?33639248:67324752),r+=4,null!=i&&(e[r++]=20,e[r++]=t.os),e[r]=20,r+=2,e[r++]=t.flag<<1|(null==o&&8),e[r++]=a&&8,e[r++]=255&t.compression,e[r++]=t.compression>>8;var v=new Date(null==t.mtime?Date.now():t.mtime),p=v.getFullYear()-1980;if((p<0||p>119)&&A(10),Y(e,r,p<<25|v.getMonth()+1<<21|v.getDate()<<16|v.getHours()<<11|v.getMinutes()<<5|v.getSeconds()>>>1),r+=4,null!=o&&(Y(e,r,t.crc),Y(e,r+4,o),Y(e,r+8,t.size)),Y(e,r+12,f),Y(e,r+14,u),r+=16,null!=i&&(Y(e,r,c),Y(e,r+6,t.attrs),Y(e,r+10,i),r+=14),e.set(n,r),r+=f,u)for(var h in l){var d=l[h],g=d.length;Y(e,r,+h),Y(e,r+2,g),e.set(d,r+4),r+=4+g}return c&&(e.set(s,r),r+=c),r},V=function(e,r,t,n,a){Y(e,r,101010256),Y(e,r+8,t),Y(e,r+10,t),Y(e,r+12,n),Y(e,r+16,a)};'function'==typeof queueMicrotask?queueMicrotask:'function'==typeof setTimeout&&setTimeout;const X=new(require("util").TextEncoder);let Z="./dist/bundle.zip",ee=t();console.log(ee);let re=ee.args
|
|
5
|
+
;re||(console.log(`\n> ERROR: the file to pack is required\n\n$ cslpack <jspath> <jspath>... [-(d|dest) <output zip path>] [-sha <256|384|512>] [-m <main jsname>]\n\n -(d|dest): zip output path. when omited will be output to ${Z}\n -sha : [256|384|512] when omited use 384 "sha384"\n -m : When packing the esm module, specify the script name that will be the entry point.\n The "importmap" is automatically generated and packed together.\n\n NOTE: \`cslpack\` doesn't keep directory path\n`),process.exit(1));const te=new class{list={};map;constructor(e){this.setModuleMain(e)}setModuleMain(e){"string"==typeof e&&e.length&&(this.map={main:e,map:{imports:{}}})}add(r,t){let a=n.parse(r),o=`${a.dir}/${a.base}`,i=e.readFileSync(o,"utf8");if(i){let e=this.map;e&&((e,r,t)=>{const n=/(?<!\/\/\s*)(?:import|export)\s*(?:|[\w_]+\s+from|(?:[\w_]+\s*,\s*)?\{[^}]+\}\s*from|\*\s*as\s+[\w_]+\s+from|\*\s*from)?\s*"(([.\/]+)?[^"]+(?:\.(?:c|m)?js)?)"\s*;?/gm;let a,o=r.imports;for(;a=n.exec(e);)t&&!a[2]||(o[a[1]]="")})(i,e.map),this.list[a.base]=[X.encode(i),{level:7,comment:t}]}}emit(r){let t=this.list,o=this.map;o&&(t["$importmap.dat"]=[X.encode(JSON.stringify(o,null,2)),{level:7}]);let i=`[fflate.zip:${r}]`;console.time(i);let s=function(e,r){r||(r={});var t={},n=[];L(e,'',t,r);var o=0,i=0;for(var s in t){var f=t[s],l=f[0],c=f[1],u=0==c.level?0:8,v=(M=G(s)).length,p=c.comment,h=p&&G(p),d=h&&h.length,g=K(c.extra);v>65535&&A(11);var m=u?B(l,c):l,_=m.length,w=U();w.p(l),n.push(W(c,{size:l.length,crc:w.d(),c:m,f:M,m:h,u:v!=s.length||h&&p.length!=d,o,compression:u})),o+=30+v+g+_,i+=76+2*(v+g)+(d||0)+_}for(var x=new a(i+22),b=o,y=i-o,k=0;k<n.length;++k){var M=n[k];Q(x,M.o,M,M.f,M.u,M.c.length);var E=30+M.f.length+K(M.extra);x.set(M.c,M.o+E),Q(x,o,M,M.f,M.u,M.c.length,M.o,M.m),o+=16+E+(M.m?M.m.length:0)}return V(x,o,n.length,y,b),x}(t,{});(r=>{const t=n.dirname(r);e.existsSync(t)||e.mkdirSync(t,{recursive:!0})})(r),e.writeFile(r,s,"binary",(()=>{console.timeEnd(i),console.log(o),this.list={},this.map=void 0}))}clear(){this.list={}}}(ee.m);let ne=ee.sha;/256|384|512/.test(ne)||(ne="384");for(const t of re){if(e.statSync(t).isFile()){const e=r.execSync(`bash -c "echo -n $(openssl dgst -sha${ne} -binary ${t} | openssl base64 -A)"`,{encoding:"utf8"});te.add(t,e)}}te.emit(ee.d||ee.dest||Z)})(),module.exports=_we_})();
|
package/csl-types.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
Copyright (C) 2022 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
https://opensource.org/licenses/mit-license.php
|
|
6
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare var NsLoader: typeof import("./umd");
|
|
10
|
+
declare var cslCallback: TCSLCallbak;
|
|
11
|
+
declare interface Window {
|
|
12
|
+
cslCallback: TCSLCallbak;
|
|
13
|
+
[cbname: TCSLCallbackKey]: TCSLCallbak;
|
|
14
|
+
}
|
|
15
|
+
type TCSLCallbackKey = string & { __type__: "cslCallback" };
|
|
16
|
+
type TCSLCallbak = ((err?: Error[]) => void) | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* (C)ompressed-(S)cript-(L)oader config
|
|
19
|
+
*
|
|
20
|
+
* @date 2022/5/14
|
|
21
|
+
* @version 1.3
|
|
22
|
+
*/
|
|
23
|
+
type TCSLConfig = {
|
|
24
|
+
/**
|
|
25
|
+
* Specifies the directory that contains the zip file
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* base: "./lib" // or https://example.com/lib
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
base: string;
|
|
32
|
+
/**
|
|
33
|
+
* #### Insertion selector
|
|
34
|
+
*
|
|
35
|
+
* + can be omit. In the current specification, specify element inside `head`
|
|
36
|
+
* element to insert into` head` element.
|
|
37
|
+
*
|
|
38
|
+
* + If omitted, it will be inserted after `document.head.lastElementChild`
|
|
39
|
+
*
|
|
40
|
+
* NOTE: This will change in the near future
|
|
41
|
+
*
|
|
42
|
+
* ```js
|
|
43
|
+
* selector: "script[src*=css-2d-renderer]"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
selector?: string;
|
|
47
|
+
/**
|
|
48
|
+
* list of zip files you want to load
|
|
49
|
+
*
|
|
50
|
+
* + The comment attached to the zip file entry is used for `script.integrity`
|
|
51
|
+
*
|
|
52
|
+
* NOTE: Omit the `.zip` extension
|
|
53
|
+
*
|
|
54
|
+
* ```js
|
|
55
|
+
* // actually, "system-coordinate-map-mini.zip", "bundle.zip"
|
|
56
|
+
* load: ["system-coordinate-map-mini", "bundle"]
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
load: string | string[];
|
|
60
|
+
/**
|
|
61
|
+
* can be omit, default: "cslCallback"
|
|
62
|
+
*
|
|
63
|
+
* Please specify if you need to use another name
|
|
64
|
+
*
|
|
65
|
+
* ```js
|
|
66
|
+
* var cslCallback = () => {
|
|
67
|
+
* runEVEWorld(() => {
|
|
68
|
+
* window.setTimeout(() => {
|
|
69
|
+
* document.querySelectorAll("script[src^='./loader/'],script[src*='compressed-script-loader']").forEach(script => script.remove());
|
|
70
|
+
* delete window.NsLoader;
|
|
71
|
+
* }, 1000);
|
|
72
|
+
* });
|
|
73
|
+
* };
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
callback?: TCSLCallbackKey;
|
|
77
|
+
/**
|
|
78
|
+
* if need auto cleanup
|
|
79
|
+
*
|
|
80
|
+
* @default undefined
|
|
81
|
+
* @since 1.2.12
|
|
82
|
+
*/
|
|
83
|
+
cleanup?: true;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
type TInjectScriptOpt = {
|
|
89
|
+
/**
|
|
90
|
+
* specify `script` element type if need.
|
|
91
|
+
*/
|
|
92
|
+
type?: string;
|
|
93
|
+
integrity?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Use the `url` already created from the `URL.createObjectURL`
|
|
96
|
+
*/
|
|
97
|
+
url?: string;
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated currently unused
|
|
100
|
+
*/
|
|
101
|
+
insertTarget?: Element;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
type TProcessImportMapResult = {
|
|
107
|
+
entryMain: string;
|
|
108
|
+
imdata: TCSLImportMap;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
type TSRI = `sha${256 | 384 | 512}-${string}`;
|
package/import-map.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
Copyright (C) 2022 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
Released under the MIT license
|
|
5
|
+
https://opensource.org/licenses/mit-license.php
|
|
6
|
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|
|
8
|
+
declare type TImportMap = {
|
|
9
|
+
imports: Record<string, string>;
|
|
10
|
+
scopes?: Record<string, Record<string, string>>;
|
|
11
|
+
};
|
|
12
|
+
declare type TCSLImportMap = {
|
|
13
|
+
main: string;
|
|
14
|
+
map: TImportMap;
|
|
15
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -5,27 +5,38 @@
|
|
|
5
5
|
https://opensource.org/licenses/mit-license.php
|
|
6
6
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
+
/// <reference types="./csl-types" />
|
|
9
|
+
/// <reference types="./import-map" />
|
|
10
|
+
/**
|
|
11
|
+
* @file Load zipped javascript source to page by fetch API
|
|
12
|
+
* @author jeffy-g <hirotom1107@gmail.com>
|
|
13
|
+
* @summary original name `compressed-script-loader`
|
|
14
|
+
* @version 2.0
|
|
15
|
+
*/
|
|
8
16
|
import * as Uz from "./unzip-sync";
|
|
9
17
|
export type { UnzipFileFilter, FlateError, UnzipFileInfo, UnzipOptions, Unzipped } from "./unzip-sync";
|
|
10
|
-
declare global {
|
|
11
|
-
var NsLoader: typeof import("./umd");
|
|
12
|
-
var cslCallback: TCSLCallbak;
|
|
13
|
-
interface Window {
|
|
14
|
-
cslCallback: TCSLCallbak;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export declare type TCSLCallbak = ((err?: Error[]) => void) | undefined;
|
|
18
|
-
export declare type TCSLConfig = {
|
|
19
|
-
base: string;
|
|
20
|
-
selector?: string;
|
|
21
|
-
load: string[];
|
|
22
|
-
callback?: string;
|
|
23
|
-
cleanup?: true;
|
|
24
|
-
moduleDetect?: true;
|
|
25
|
-
};
|
|
26
18
|
declare let unzipSync: typeof Uz.unzipSync;
|
|
19
|
+
/**
|
|
20
|
+
* ### cleanup module
|
|
21
|
+
*
|
|
22
|
+
* CAVEAT: Doing this completely destroys the `loader`'s functionality.
|
|
23
|
+
*/
|
|
27
24
|
declare let cleanUp: () => void;
|
|
28
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} base script resource base url
|
|
27
|
+
* @param {string} [insertionSelector] where loaded script insert to?
|
|
28
|
+
*/
|
|
29
|
+
declare let setConfig: (base: string, insertionSelector?: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Load and unzip the zip file that contains the javascript source file
|
|
32
|
+
*
|
|
33
|
+
* @param {string} baseName zip file name. e.g - webpack
|
|
34
|
+
* @param {(msg: string) => void} [log] default: `console.log`
|
|
35
|
+
*/
|
|
29
36
|
declare let loadCompressedScript: (baseName: string, log?: (msg: string) => void) => Promise<void>;
|
|
30
|
-
declare
|
|
31
|
-
|
|
37
|
+
declare const version = "v1.3.5";
|
|
38
|
+
/**
|
|
39
|
+
* `importmap` zip entry name
|
|
40
|
+
*/
|
|
41
|
+
declare const IM_MAP_ID = "$importmap.dat";
|
|
42
|
+
export { setConfig, loadCompressedScript, cleanUp, unzipSync, version, IM_MAP_ID };
|
package/package.json
CHANGED
package/umd/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
((e,t)=>{'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports.NsLoader=t():e.NsLoader=t()})(globalThis,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})}},t={};e.r(t),e.d(t,{cleanUp:()=>
|
|
3
|
-
;const
|
|
4
|
-
;if(n){c=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const o=l<<4|e[l],r=t-e[l];let a=i[e[l]-1]++<<r;for(const e=a|(1<<r)-1;a<=e;++a)c[g[a]>>>n]=o}}else for(c=new o(r),l=0;l<r;++l)e[l]&&(c[l]=g[i[e[l]-1]++]>>>15-e[l]);return c},y=new n(288);for(let e=0;e<144;++e)y[e]=8;for(let e=144;e<256;++e)y[e]=9;for(let e=256;e<280;++e)y[e]=7;for(let e=280;e<288;++e)y[e]=8;const h=new n(32);for(let e=0;e<32;++e)h[e]=5;const b=p(y,9,1),m=p(h,5,1),w=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},v=(e,t,n)=>{const o=t/8|0;return(e[o]|e[o+1]<<8)>>(7&t)&n},S=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},C=[,n,o,,r],k=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const o=new C[e.BYTES_PER_ELEMENT](n-t);return o.set(e.subarray(t,n)),o
|
|
5
|
-
},x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$=(e,t,n)=>{const o=new Error(t||x[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,$),!n)throw o;return o},E=(e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const c=!t||!!o,f=!o||o.i;!o&&(o={}),!t&&(t=new n(3*r));const u=e=>{let o=t.length;if(e>o){const r=new n(Math.max(2*o,e));r.set(t),t=r}};let g=o.f||0,y=o.p||0,h=o.b||0,C=o.l,x=o.d,E=o.m,T=o.n;const j=8*r;do{if(!C){g=v(e,y,1);const l=v(e,y+1,3);if(y+=3,!l){const n=4+((y+7)/8|0),l=e[n-4]|e[n-3]<<8,a=n+l;if(a>r){f&&$(0);break}
|
|
6
|
-
c&&u(h+l),t.set(e.subarray(n,a),h),o.b=h+=l,o.p=y=8*a,o.f=g;continue}if(1===l)C=b,x=m,E=9,T=5;else if(2===l){const t=v(e,y,31)+257,o=v(e,y+10,15)+4,r=t+v(e,y+5,31)+1;y+=14;const l=new n(r),a=new n(19);for(let t=0;t<o;++t)a[i[t]]=v(e,y+3*t,7);y+=3*o;const c=w(a),s=(1<<c)-1,f=p(a,c,1);for(let t=0;t<r;){const n=f[v(e,y,s)];y+=15&n;const o=n>>>4;if(o<16)l[t++]=o;else{let n=0,r=0;for(16===o?(r=3+v(e,y,3),y+=2,n=l[t-1]):17===o?(r=3+v(e,y,7),y+=3):18===o&&(r=11+v(e,y,127),y+=7);r--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);E=w(d),T=w(u),C=p(d,E,1),x=p(u,T,1)}else $(1);if(y>j){f&&$(0);break}}c&&u(h+131072);const k=(1<<E)-1,O=(1<<T)-1;let z=y;for(;;z=y){const n=C[S(e,y)&k],o=n>>>4;if(y+=15&n,y>j){f&&$(0);break}if(n||$(2),o<256)t[h++]=o;else{if(256===o){z=y,C=void 0;break}{let n=o-254
|
|
7
|
-
;if(o>264){const t=o-257,r=l[t];n=v(e,y,(1<<r)-1)+s[t],y+=r}const r=x[S(e,y)&O],i=r>>>4;r||$(3),y+=15&r;let g=d[i];if(i>3){const t=a[i];g+=S(e,y)&(1<<t)-1,y+=t}if(y>j){f&&$(0);break}c&&u(h+131072);const p=h+n;for(;h<p;h+=4)t[h]=t[h-g],t[h+1]=t[h+1-g],t[h+2]=t[h+2-g],t[h+3]=t[h+3-g];h=p}}}o.l=C,o.p=z,o.b=h,o.f=g,C&&(g=1,o.m=E,o.d=x,o.n=T)}while(!g);return h===t.length?t:k(t,0,h)},T=(e,t)=>e[t]|e[t+1]<<8,j=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,O=(e,t)=>j(e,t)+4294967296*j(e,t+4),z=(e,t)=>t+30+T(e,t+26)+T(e,t+28),U=(e,t,n)=>{const o=!(2048&T(e,t+8)),r=T(e,t+28),l=M(e.subarray(t+46,t+46+r),o),a=t+46+r,i=j(e,t+20),[c,s,f]=n&&4294967295===i?P(e,a):[i,j(e,t+24),j(e,t+42)],d=a+T(e,t+30);return[T(e,t+10),c,s,l,a+T(e,t+30)+T(e,t+32),f,M(e.subarray(d,d+T(e,t+32)),o)]},P=(e,t)=>{
|
|
8
|
-
for(;1!=T(e,t);t+=4+T(e,t+2));return[O(e,t+12),O(e,t+4),O(e,t+20)]};let A;const L=new n(0);try{const e=new TextDecoder;e.decode(L,{stream:!0}),A=e}catch{}function M(e,t){if(t){let t="";for(let n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(A)return A.decode(e);{const[t,n]=(e=>{for(let t="",n=0;;){let o=e[n++];const r=+(o>127)+ +(o>223)+ +(o>239);if(n+r>e.length)return[t,k(e,n-1)];r?3===r?(o=((15&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|o>>10,56320|1023&o)):t+=1&r?String.fromCharCode((31&o)<<6|63&e[n++]):String.fromCharCode((15&o)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(o)}})(e);return n.length&&$(8),t}}let N,R,_=new TextDecoder,B=function(e,t){const o={};let r=e.length-22
|
|
9
|
-
;for(;101010256!=j(e,r);--r)(!r||e.length-r>65558)&&$(13);let l=T(e,r+8);if(!l)return{};let a=j(e,r+16);const i=4294967295===a;i&&(r=j(e,r-12),101075792!=j(e,r)&&$(13),l=j(e,r+32),a=j(e,r+48));const c=t&&t.filter;for(let t=0;t<l;++t){const[t,r,l,s,f,d,u]=U(e,a,i),g=z(e,d);if(a=f,!c||c({name:s,size:r,originalSize:l,compression:t,comment:u})){let a;t?8===t?a=E(e.subarray(g,g+r),new n(l)):$(14,"unknown compression type "+t):a=k(e,g,g+r),a&&(o[s]={data:a,comment:u})}}return o},q=()=>{_=void 0,J=F=Y=q=void 0,N=R=void 0,D=B=void 0},D=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},F=(e,t)=>{N=e,R=t||""},J=(e,t,n,o)=>{let r=()=>{n(),console.log(`script ${t} is ready`)
|
|
10
|
-
},l=R?document.querySelector(R).nextSibling:void 0,a=document.head[l?"insertBefore":"appendChild"](document.createElement("script"),l);if(a.id=t,o){let t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));a.integrity=o,a.crossOrigin="",a.onload=r,a.src=t}else a.text=e,r()},Y=async(e,t=console.log)=>{let n=e+".zip",o=await fetch(`${N||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(l=+e.headers.get("content-length"),n?1.3*l|0:l);var l;let a=new Uint8Array(r),i=0;for(;;){let e=await o.read();if(e.done)break;a.set(e.value,i),i+=e.value.length,t(`loading zip: ${i.toLocaleString()} bytes(${i/r*100|0}%)`)}return n?a.slice(0,i):a})).catch((e=>{console.error(e)}));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),
|
|
11
|
-
console.time(`unzip: ${n}`);let e=B(o);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{let n=Object.keys(e),o=n.length,r=()=>{!--o&&t()};for(let t,o=0;t=n[o++];){let n=e[t];J(_.decode(n.data),t,r,D(n.comment))}}))}throw new Error(`Could not load "${n}"`)},G=async()=>{G=void 0;let e=document.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){let e;t=JSON.parse(t),t.load?(F(t.base,t.selector),e=t.load):e=Array.isArray(t)?t:"string"==typeof t?[t]:[];let n="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"],o=[];for(let t of e)o.push(Y(t).catch((e=>e)));let r=(await Promise.all(o)).filter((e=>e&&e.name));"function"==typeof n&&n(r.length?r:void 0),t.cleanup&&q()}}};setTimeout(G,99);let H="v1.2.14";return t
|
|
12
|
-
})()));
|
|
2
|
+
((e,t)=>{'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports.NsLoader=t():e.NsLoader=t()})(globalThis,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})}},t={};e.r(t),e.d(t,{IM_MAP_ID:()=>ee,cleanUp:()=>Y,loadCompressedScript:()=>W,setConfig:()=>K,unzipSync:()=>I,version:()=>Z});const n=String.fromCharCode,o=Uint8Array,r=Uint16Array,l=Uint32Array,i=new o([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,0,0,0]),a=new o([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,0,0]),s=new o([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new r(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const o=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)o[t]=t-n[e]<<5|e;return[n,o]},[f,d]=c(i,2);f[28]=258,d[258]=28;const[u,p]=c(a,0),y=new r(32768);for(let e=0;e<32768;++e){let t=(43690&e)>>>1|(21845&e)<<1;t=(52428&t)>>>2|(13107&t)<<2,t=(61680&t)>>>4|(3855&t)<<4,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const o=e.length;let l=0;const i=new r(t);for(;l<o;++l)e[l]&&++i[e[l]-1];const a=new r(t);for(l=0;l<t;++l)a[l]=a[l-1]+i[l-1]<<1;let s;if(n){s=new r(1<<t);const n=15-t;for(l=0;l<o;++l)if(e[l]){const o=l<<4|e[l],r=t-e[l];let i=a[e[l]-1]++<<r;for(const e=i|(1<<r)-1;i<=e;++i)s[y[i]>>>n]=o}}else for(s=new r(o),l=0;l<o;++l)e[l]&&(s[l]=y[a[e[l]-1]++]>>>15-e[l]);return s},m=new o(288);for(let e=0;e<144;++e)m[e]=8;for(let e=144;e<256;++e)m[e]=9;for(let e=256;e<280;++e)m[e]=7;for(let e=280;e<288;++e)m[e]=8;const b=new o(32);for(let e=0;e<32;++e)b[e]=5;const h=g(m,9,1),w=g(b,5,1),v=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},S=(e,t,n)=>{const o=t/8|0;return(e[o]|e[o+1]<<8)>>(7&t)&n},$=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},k=[,o,r,,l],x=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const o=new k[e.BYTES_PER_ELEMENT](n-t);return o.set(e.subarray(t,n)),o},E=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"];let O=Error.captureStackTrace;const j=(e,t,n)=>{const o=new Error(t||E[e]);if(o.code=e,O&&O(o,j),!n)throw o;return o},C=(e,t,n)=>{const r=e.length;if(!r||n&&n.f&&!n.l)return t||new o(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new o(3*r));const d=e=>{let n=t.length;if(e>n){const r=new o(Math.max(2*n,e));r.set(t),t=r}};let p=n.f||0,y=n.p||0,m=n.b||0,b=n.l,k=n.d,E=n.m,O=n.n;const C=8*r;do{if(!b){p=S(e,y,1);const i=S(e,y+1,3);if(y+=3,!i){const o=4+((y+7)/8|0),i=e[o-4]|e[o-3]<<8,a=o+i;if(a>r){c&&j(0);break}l&&d(m+i),t.set(e.subarray(o,a),m),n.b=m+=i,n.p=y=8*a,n.f=p;continue}if(1===i)b=h,k=w,E=9,O=5;else if(2===i){const t=S(e,y,31)+257,n=S(e,y+10,15)+4,r=t+S(e,y+5,31)+1;y+=14;const l=new o(r),i=new o(19);for(let t=0;t<n;++t)i[s[t]]=S(e,y+3*t,7);y+=3*n;const a=v(i),c=(1<<a)-1,f=g(i,a,1);for(let t=0;t<r;){const n=f[S(e,y,c)];y+=15&n;const o=n>>>4;if(o<16)l[t++]=o;else{let n=0,r=0;for(16===o?(r=3+S(e,y,3),y+=2,n=l[t-1]):17===o?(r=3+S(e,y,7),y+=3):18===o&&(r=11+S(e,y,127),y+=7);r--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);E=v(d),O=v(u),b=g(d,E,1),k=g(u,O,1)}else j(1);if(y>C){c&&j(0);break}}l&&d(m+131072);const x=(1<<E)-1,T=(1<<O)-1;let z=y;for(;;z=y){const n=b[$(e,y)&x],o=n>>>4;if(y+=15&n,y>C){c&&j(0);break}if(n||j(2),o<256)t[m++]=o;else{if(256===o){z=y,b=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=i[t];n=S(e,y,(1<<r)-1)+f[t],y+=r}const r=k[$(e,y)&T],s=r>>>4;r||j(3),y+=15&r;let p=u[s];if(s>3){const t=a[s];p+=$(e,y)&(1<<t)-1,y+=t}if(y>C){c&&j(0);break}l&&d(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=b,n.p=z,n.b=m,n.f=p,b&&(p=1,n.m=E,n.d=k,n.n=O)}while(!p);return m===t.length?t:x(t,0,m)},T=(e,t)=>e[t]|e[t+1]<<8,z=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,M=(e,t)=>z(e,t)+4294967296*z(e,t+4),P=(e,t)=>t+30+T(e,t+26)+T(e,t+28),U=(e,t,n)=>{const o=!(2048&T(e,t+8)),r=T(e,t+28),l=_(e.subarray(t+46,t+46+r),o),i=t+46+r,a=z(e,t+20),[s,c,f]=n&&4294967295===a?A(e,i):[a,z(e,t+24),z(e,t+42)],d=i+T(e,t+30);return[T(e,t+10),s,c,l,i+T(e,t+30)+T(e,t+32),f,_(e.subarray(d,d+T(e,t+32)),o)]},A=(e,t)=>{for(;1!=T(e,t);t+=4+T(e,t+2));return[M(e,t+12),M(e,t+4),M(e,t+20)]};let L;const N=new o(0);try{const e=new TextDecoder;e.decode(N,{stream:!0}),L=e}catch{}function _(e,t){if(t){let t="";for(let o=0;o<e.length;o+=16384)t+=n.apply(null,e.subarray(o,o+16384));return t}if(L)return L.decode(e);{const[t,o]=(e=>{for(let t="",o=0;;){let r=e[o++]
|
|
3
|
+
;const l=+(r>127)+ +(r>223)+ +(r>239);if(o+l>e.length)return[t,x(e,o-1)];l?3===l?(r=((15&r)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])-65536,t+=n(55296|r>>10,56320|1023&r)):t+=n(1&l?(31&r)<<6|63&e[o++]:(15&r)<<12|(63&e[o++])<<6|63&e[o++]):t+=n(r)}})(e);return o.length&&j(8),t}}let R,B,D=console.log,J=document,q=Object.keys,F=new TextDecoder,I=function(e,t){const n={};let r=e.length-22;for(;101010256!=z(e,r);--r)(!r||e.length-r>65558)&&j(13);let l=T(e,r+8);if(!l)return{};let i=z(e,r+16);const a=4294967295===i;a&&(r=z(e,r-12),101075792!=z(e,r)&&j(13),l=z(e,r+32),i=z(e,r+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,r,l,c,f,d,u]=U(e,i,a),p=P(e,d);if(i=f,!s||s({name:c,size:r,originalSize:l,compression:t,comment:u})){let i;t?8===t?i=C(e.subarray(p,p+r),new o(l)):j(14,"unknown compression type "+t):i=x(e,p,p+r),i&&(n[c]={data:i,comment:u})}}return n},Y=()=>{F=void 0,Q=K=W=Y=void 0,R=B=void 0,V=H=G=I=void 0},G=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},H=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),K=(e,t)=>{R=e,B=t||""},Q=(e,t,n=(()=>{}),o={})=>{let r=()=>{n(),D(`script ${t} is ready`)},l=B?J.querySelector(B).nextElementSibling:void 0,i=J.head[l?"insertBefore":"appendChild"](J.createElement("script"),l);i.id=t,o.type&&(i.type=o.type);let a=o.integrity;a?(i.integrity=a,i.crossOrigin="",i.onload=r,i.src=o.url||H(e)):(i.text=e,r())},V=e=>{let t,n=q(e);if(n.includes(ee)){n=n.filter((e=>e!==ee));let o,r=F.decode(e[ee].data),l=JSON.parse(r),i=l.map.imports,a=[],s=new Map;q(i).forEach((t=>{for(let r,c=0;r=n[c++];){let[n,c]=r.split(".");if(new RegExp(`.*\\/?${n}${c?`(?:\\.${c})?`:""}$`).test(t)){let n=s.get(r);n||s.set(r,n=H(F.decode(e[r].data))),i[t]=n,r!==l.main||o||(o=n),a.push(r);break}}})),Q(JSON.stringify(l.map,null,2),ee,void 0,{type:"importmap"}),n=n.filter((e=>!a.includes(e))),t={entryMain:o,imdata:l}}return[n,t]},W=async(e,t=D)=>{let n=e+".zip",o=await fetch(`${R||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(l=+e.headers.get("content-length"),n?1.3*l|0:l);var l;let i=new Uint8Array(r),a=0;for(;;){let e=await o.read();if(e.done)break;i.set(e.value,a),a+=e.value.length,t(`loading zip: ${a.toLocaleString()} bytes(${a/r*100|0}%)`)}return n?i.slice(0,a):i})).catch((e=>{console.error(e)}));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);let e=I(o);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{let[n,{entryMain:o,imdata:r}={}]=V(e),l=n.length,i=r?.main,a=()=>{!--l&&t()};for(let t,r=0;t=n[r++];){let n=e[t],r=t===i;Q(F.decode(n.data),t,a,{integrity:G(n.comment),url:r?o:void 0,type:r?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},X=async()=>{X=void 0;let e=J.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){let e,n=Array.isArray;t=JSON.parse(t),t.load?(K(t.base,t.selector),e=n(t.load)?t.load:[t.load]):e=n(t)?t:"string"==typeof t?[t]:[];let o="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"],r=[];for(let t of e)r.push(W(t).catch((e=>e)));let l=(await Promise.all(r)).filter((e=>e&&e.name));"function"==typeof o&&o(l.length?l:void 0),t.cleanup&&Y()}}};setTimeout(X,99);const Z="v1.3.5",ee="$importmap.dat";return t})()));
|
package/unzip-sync.d.ts
CHANGED
|
@@ -1,21 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error generated within this library
|
|
3
|
+
*/
|
|
1
4
|
export interface FlateError extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* The code associated with this error
|
|
7
|
+
*/
|
|
2
8
|
code: number;
|
|
3
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Information about a file to be extracted from a ZIP archive
|
|
12
|
+
*/
|
|
4
13
|
export interface UnzipFileInfo {
|
|
14
|
+
/**
|
|
15
|
+
* The name of the file
|
|
16
|
+
*/
|
|
5
17
|
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* The compressed size of the file
|
|
20
|
+
*/
|
|
6
21
|
size: number;
|
|
22
|
+
/**
|
|
23
|
+
* The original size of the file
|
|
24
|
+
*/
|
|
7
25
|
originalSize: number;
|
|
26
|
+
/**
|
|
27
|
+
* The compression format for the data stream. This number is determined by
|
|
28
|
+
* the spec in PKZIP's APPNOTE.txt, section 4.4.5. For example, 0 = no
|
|
29
|
+
* compression, 8 = deflate, 14 = LZMA. If the filter function returns true
|
|
30
|
+
* but this value is not 8, the unzip function will throw.
|
|
31
|
+
*/
|
|
8
32
|
compression: number;
|
|
33
|
+
/**
|
|
34
|
+
* @since v1.2.9
|
|
35
|
+
* @date 2022/5/19
|
|
36
|
+
*/
|
|
9
37
|
comment?: string;
|
|
10
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* A filter for files to be extracted during the unzipping process
|
|
41
|
+
* @param file The info for the current file being processed
|
|
42
|
+
* @returns Whether or not to extract the current file
|
|
43
|
+
*/
|
|
11
44
|
export declare type UnzipFileFilter = (file: UnzipFileInfo) => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Options for expanding a ZIP archive
|
|
47
|
+
*/
|
|
12
48
|
export interface UnzipOptions {
|
|
49
|
+
/**
|
|
50
|
+
* A filter function to extract only certain files from a ZIP archive
|
|
51
|
+
*/
|
|
13
52
|
filter?: UnzipFileFilter;
|
|
14
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* An unzipped archive. The full path of each file is used as the key,
|
|
56
|
+
* and the file is the value
|
|
57
|
+
*/
|
|
15
58
|
export interface Unzipped {
|
|
16
59
|
[path: string]: {
|
|
17
60
|
data: Uint8Array;
|
|
18
61
|
comment?: string;
|
|
19
62
|
};
|
|
20
63
|
}
|
|
21
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {Error & { code: number }} FlateError An error generated within this library
|
|
66
|
+
* @typedef {(file: UnzipFileInfo) => boolean} UnzipFileFilter
|
|
67
|
+
* @typedef {{ filter?: UnzipFileFilter }} UnzipOptions
|
|
68
|
+
* @typedef {Record<string, { data: Uint8Array; comment?: string; }>} Unzipped
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* @typedef UnzipFileInfo
|
|
72
|
+
* @prop {string} name The name of the file
|
|
73
|
+
* @prop {number} size The compressed size of the file
|
|
74
|
+
* @prop {number} originalSize The original size of the file
|
|
75
|
+
* @prop {number} compression The compression format for the data stream.
|
|
76
|
+
* @prop {string} [comment]
|
|
77
|
+
*
|
|
78
|
+
* This number is determined bythe spec in PKZIP's APPNOTE.txt, section 4.4.5. For example,
|
|
79
|
+
* 0 = nocompression, 8 = deflate, 14 = LZMA.
|
|
80
|
+
*
|
|
81
|
+
* If the filter function returns truebut this value is not 8, the unzip function will throw.
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
|
|
85
|
+
* performance with more than one file.
|
|
86
|
+
*
|
|
87
|
+
* NOTE: Added comment extraction feature (by jeffy-g
|
|
88
|
+
*
|
|
89
|
+
* @param {Uint8Array} data The raw compressed ZIP file
|
|
90
|
+
* @param {UnzipOptions} [opts] The ZIP extraction options
|
|
91
|
+
* @returns {Unzipped} The decompressed files
|
|
92
|
+
*/
|
|
93
|
+
export declare function unzipSync(data: Uint8Array, opts?: UnzipOptions): Unzipped;
|
package/webpack/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})}},t={};e.r(t),e.d(t,{cleanUp:()=>
|
|
3
|
-
;
|
|
4
|
-
;for(let e=280;e<288;++e)p[e]=8;const y=new n(32);for(let e=0;e<32;++e)y[e]=5;const m=h(p,9,1),b=h(y,5,1),w=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},v=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},S=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},C=[,n,r,,o],k=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new C[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},$=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=(e,t,n)=>{const r=new Error(t||$[e]);if(r.code=e,
|
|
5
|
-
Error.captureStackTrace&&Error.captureStackTrace(r,E),!n)throw r;return r},x=(e,t,r)=>{const o=e.length;if(!o||r&&r.f&&!r.l)return t||new n(0);const i=!t||!!r,f=!r||r.i;!r&&(r={}),!t&&(t=new n(3*o));const u=e=>{let r=t.length;if(e>r){const o=new n(Math.max(2*r,e));o.set(t),t=o}};let g=r.f||0,p=r.p||0,y=r.b||0,C=r.l,$=r.d,x=r.m,O=r.n;const T=8*o;do{if(!C){g=v(e,p,1);const l=v(e,p+1,3);if(p+=3,!l){const n=4+((p+7)/8|0),l=e[n-4]|e[n-3]<<8,a=n+l;if(a>o){f&&E(0);break}i&&u(y+l),t.set(e.subarray(n,a),y),r.b=y+=l,r.p=p=8*a,r.f=g;continue}if(1===l)C=m,$=b,x=9,O=5;else if(2===l){const t=v(e,p,31)+257,r=v(e,p+10,15)+4,o=t+v(e,p+5,31)+1;p+=14;const l=new n(o),a=new n(19);for(let t=0;t<r;++t)a[c[t]]=v(e,p+3*t,7);p+=3*r;const i=w(a),s=(1<<i)-1,f=h(a,i,1);for(let t=0;t<o;){const n=f[v(e,p,s)];p+=15&n
|
|
6
|
-
;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+v(e,p,3),p+=2,n=l[t-1]):17===r?(o=3+v(e,p,7),p+=3):18===r&&(o=11+v(e,p,127),p+=7);o--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);x=w(d),O=w(u),C=h(d,x,1),$=h(u,O,1)}else E(1);if(p>T){f&&E(0);break}}i&&u(y+131072);const k=(1<<x)-1,z=(1<<O)-1;let U=p;for(;;U=p){const n=C[S(e,p)&k],r=n>>>4;if(p+=15&n,p>T){f&&E(0);break}if(n||E(2),r<256)t[y++]=r;else{if(256===r){U=p,C=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=l[t];n=v(e,p,(1<<o)-1)+s[t],p+=o}const o=$[S(e,p)&z],c=o>>>4;o||E(3),p+=15&o;let g=d[c];if(c>3){const t=a[c];g+=S(e,p)&(1<<t)-1,p+=t}if(p>T){f&&E(0);break}i&&u(y+131072);const h=y+n;for(;y<h;y+=4)t[y]=t[y-g],t[y+1]=t[y+1-g],t[y+2]=t[y+2-g],t[y+3]=t[y+3-g];y=h}}}r.l=C,r.p=U,r.b=y,r.f=g,C&&(g=1,r.m=x,r.d=$,
|
|
7
|
-
r.n=O)}while(!g);return y===t.length?t:k(t,0,y)},O=(e,t)=>e[t]|e[t+1]<<8,T=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,z=(e,t)=>T(e,t)+4294967296*T(e,t+4),U=(e,t)=>t+30+O(e,t+26)+O(e,t+28),j=(e,t,n)=>{const r=!(2048&O(e,t+8)),o=O(e,t+28),l=M(e.subarray(t+46,t+46+o),r),a=t+46+o,c=T(e,t+20),[i,s,f]=n&&4294967295===c?P(e,a):[c,T(e,t+24),T(e,t+42)],d=a+O(e,t+30);return[O(e,t+10),i,s,l,a+O(e,t+30)+O(e,t+32),f,M(e.subarray(d,d+O(e,t+32)),r)]},P=(e,t)=>{for(;1!=O(e,t);t+=4+O(e,t+2));return[z(e,t+12),z(e,t+4),z(e,t+20)]};let A;const L=new n(0);try{const e=new TextDecoder;e.decode(L,{stream:!0}),A=e}catch{}function M(e,t){if(t){let t="";for(let n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(A)return A.decode(e);{const[t,n]=(e=>{
|
|
8
|
-
for(let t="",n=0;;){let r=e[n++];const o=+(r>127)+ +(r>223)+ +(r>239);if(n+o>e.length)return[t,k(e,n-1)];o?3===o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}})(e);return n.length&&E(8),t}}let R,_,B=new TextDecoder,q=function(e,t){const r={};let o=e.length-22;for(;101010256!=T(e,o);--o)(!o||e.length-o>65558)&&E(13);let l=O(e,o+8);if(!l)return{};let a=T(e,o+16);const c=4294967295===a;c&&(o=T(e,o-12),101075792!=T(e,o)&&E(13),l=T(e,o+32),a=T(e,o+48));const i=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,s,f,d,u]=j(e,a,c),g=U(e,d);if(a=f,!i||i({name:s,size:o,originalSize:l,compression:t,comment:u
|
|
9
|
-
})){let a;t?8===t?a=x(e.subarray(g,g+o),new n(l)):E(14,"unknown compression type "+t):a=k(e,g,g+o),a&&(r[s]={data:a,comment:u})}}return r},D=()=>{B=void 0,J=N=Y=D=void 0,R=_=void 0,F=q=void 0},F=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},N=(e,t)=>{R=e,_=t||""},J=(e,t,n,r)=>{let o=()=>{n(),console.log(`script ${t} is ready`)},l=_?document.querySelector(_).nextSibling:void 0,a=document.head[l?"insertBefore":"appendChild"](document.createElement("script"),l);if(a.id=t,r){let t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));a.integrity=r,a.crossOrigin="",a.onload=o,a.src=t}else a.text=e,o()},Y=async(e,t=console.log)=>{
|
|
10
|
-
let n=e+".zip",r=await fetch(`${R||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?1.3*l|0:l);var l;let a=new Uint8Array(o),c=0;for(;;){let e=await r.read();if(e.done)break;a.set(e.value,c),c+=e.value.length,t(`loading zip: ${c.toLocaleString()} bytes(${c/o*100|0}%)`)}return n?a.slice(0,c):a})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);let e=q(r);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{let n=Object.keys(e),r=n.length,o=()=>{!--r&&t()};for(let t,r=0;t=n[r++];){let n=e[t];J(B.decode(n.data),t,o,F(n.comment))}}))}throw new Error(`Could not load "${n}"`)},G=async()=>{G=void 0
|
|
11
|
-
;let e=document.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){let e;t=JSON.parse(t),t.load?(N(t.base,t.selector),e=t.load):e=Array.isArray(t)?t:"string"==typeof t?[t]:[];let n="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"],r=[];for(let t of e)r.push(Y(t).catch((e=>e)));let o=(await Promise.all(r)).filter((e=>e&&e.name));"function"==typeof n&&n(o.length?o:void 0),t.cleanup&&D()}}};setTimeout(G,99);let H="v1.2.14";module.exports=t})();
|
|
2
|
+
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})}},t={};e.r(t),e.d(t,{IM_MAP_ID:()=>ee,cleanUp:()=>Y,loadCompressedScript:()=>W,setConfig:()=>K,unzipSync:()=>I,version:()=>Z});const n=String.fromCharCode,r=Uint8Array,o=Uint16Array,l=Uint32Array,i=new r([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,0,0,0]),a=new r([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,0,0]),s=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new o(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const r=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)r[t]=t-n[e]<<5|e;return[n,r]},[d,f]=c(i,2);d[28]=258,f[258]=28;const[u,p]=c(a,0),y=new o(32768);for(let e=0;e<32768;++e){let t=(43690&e)>>>1|(21845&e)<<1;t=(52428&t)>>>2|(13107&t)<<2,t=(61680&t)>>>4|(3855&t)<<4,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let l=0;const i=new o(t);for(;l<r;++l)e[l]&&++i[e[l]-1];const a=new o(t);for(l=0;l<t;++l)a[l]=a[l-1]+i[l-1]<<1;let s;if(n){s=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const r=l<<4|e[l],o=t-e[l];let i=a[e[l]-1]++<<o;for(const e=i|(1<<o)-1;i<=e;++i)s[y[i]>>>n]=r}}else for(s=new o(r),l=0;l<r;++l)e[l]&&(s[l]=y[a[e[l]-1]++]>>>15-e[l]);return s},m=new r(288);for(let e=0;e<144;++e)m[e]=8;for(let e=144;e<256;++e)m[e]=9;for(let e=256;e<280;++e)m[e]=7;for(let e=280;e<288;++e)m[e]=8;const h=new r(32);for(let e=0;e<32;++e)h[e]=5;const b=g(m,9,1),w=g(h,5,1),v=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},S=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},$=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},k=[,r,o,,l],E=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new k[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},O=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"];let x=Error.captureStackTrace;const C=(e,t,n)=>{const r=new Error(t||O[e]);if(r.code=e,x&&x(r,C),!n)throw r;return r},z=(e,t,n)=>{const o=e.length;if(!o||n&&n.f&&!n.l)return t||new r(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new r(3*o));const f=e=>{let n=t.length;if(e>n){const o=new r(Math.max(2*n,e));o.set(t),t=o}};let p=n.f||0,y=n.p||0,m=n.b||0,h=n.l,k=n.d,O=n.m,x=n.n;const z=8*o;do{if(!h){p=S(e,y,1);const i=S(e,y+1,3);if(y+=3,!i){const r=4+((y+7)/8|0),i=e[r-4]|e[r-3]<<8,a=r+i;if(a>o){c&&C(0);break}l&&f(m+i),t.set(e.subarray(r,a),m),n.b=m+=i,n.p=y=8*a,n.f=p;continue}if(1===i)h=b,k=w,O=9,x=5;else if(2===i){const t=S(e,y,31)+257,n=S(e,y+10,15)+4,o=t+S(e,y+5,31)+1;y+=14;const l=new r(o),i=new r(19);for(let t=0;t<n;++t)i[s[t]]=S(e,y+3*t,7);y+=3*n;const a=v(i),c=(1<<a)-1,d=g(i,a,1);for(let t=0;t<o;){const n=d[S(e,y,c)];y+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+S(e,y,3),y+=2,n=l[t-1]):17===r?(o=3+S(e,y,7),y+=3):18===r&&(o=11+S(e,y,127),y+=7);o--;)l[t++]=n}}const f=l.subarray(0,t),u=l.subarray(t);O=v(f),x=v(u),h=g(f,O,1),k=g(u,x,1)}else C(1);if(y>z){c&&C(0);break}}l&&f(m+131072);const E=(1<<O)-1,M=(1<<x)-1;let T=y;for(;;T=y){const n=h[$(e,y)&E],r=n>>>4;if(y+=15&n,y>z){c&&C(0);break}if(n||C(2),r<256)t[m++]=r;else{if(256===r){T=y,h=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=i[t];n=S(e,y,(1<<o)-1)+d[t],y+=o}const o=k[$(e,y)&M],s=o>>>4;o||C(3),y+=15&o;let p=u[s];if(s>3){const t=a[s];p+=$(e,y)&(1<<t)-1,y+=t}if(y>z){c&&C(0);break}l&&f(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=h,n.p=T,n.b=m,n.f=p,h&&(p=1,n.m=O,n.d=k,n.n=x)}while(!p);return m===t.length?t:E(t,0,m)},M=(e,t)=>e[t]|e[t+1]<<8,T=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,P=(e,t)=>T(e,t)+4294967296*T(e,t+4),U=(e,t)=>t+30+M(e,t+26)+M(e,t+28),j=(e,t,n)=>{const r=!(2048&M(e,t+8)),o=M(e,t+28),l=L(e.subarray(t+46,t+46+o),r),i=t+46+o,a=T(e,t+20),[s,c,d]=n&&4294967295===a?A(e,i):[a,T(e,t+24),T(e,t+42)],f=i+M(e,t+30);return[M(e,t+10),s,c,l,i+M(e,t+30)+M(e,t+32),d,L(e.subarray(f,f+M(e,t+32)),r)]},A=(e,t)=>{for(;1!=M(e,t);t+=4+M(e,t+2));return[P(e,t+12),P(e,t+4),P(e,t+20)]};let _;const R=new r(0);try{const e=new TextDecoder;e.decode(R,{stream:!0}),_=e}catch{}function L(e,t){if(t){let t="";for(let r=0;r<e.length;r+=16384)t+=n.apply(null,e.subarray(r,r+16384));return t}if(_)return _.decode(e);{const[t,r]=(e=>{for(let t="",r=0;;){let o=e[r++];const l=+(o>127)+ +(o>223)+ +(o>239);if(r+l>e.length)return[t,E(e,r-1)];l?3===l?(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,
|
|
3
|
+
t+=n(55296|o>>10,56320|1023&o)):t+=n(1&l?(31&o)<<6|63&e[r++]:(15&o)<<12|(63&e[r++])<<6|63&e[r++]):t+=n(o)}})(e);return r.length&&C(8),t}}let N,B,D=console.log,J=document,q=Object.keys,F=new TextDecoder,I=function(e,t){const n={};let o=e.length-22;for(;101010256!=T(e,o);--o)(!o||e.length-o>65558)&&C(13);let l=M(e,o+8);if(!l)return{};let i=T(e,o+16);const a=4294967295===i;a&&(o=T(e,o-12),101075792!=T(e,o)&&C(13),l=T(e,o+32),i=T(e,o+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,c,d,f,u]=j(e,i,a),p=U(e,f);if(i=d,!s||s({name:c,size:o,originalSize:l,compression:t,comment:u})){let i;t?8===t?i=z(e.subarray(p,p+o),new r(l)):C(14,"unknown compression type "+t):i=E(e,p,p+o),i&&(n[c]={data:i,comment:u})}}return n},Y=()=>{F=void 0,Q=K=W=Y=void 0,N=B=void 0,V=H=G=I=void 0},G=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},H=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),K=(e,t)=>{N=e,B=t||""},Q=(e,t,n=(()=>{}),r={})=>{let o=()=>{n(),D(`script ${t} is ready`)},l=B?J.querySelector(B).nextElementSibling:void 0,i=J.head[l?"insertBefore":"appendChild"](J.createElement("script"),l);i.id=t,r.type&&(i.type=r.type);let a=r.integrity;a?(i.integrity=a,i.crossOrigin="",i.onload=o,i.src=r.url||H(e)):(i.text=e,o())},V=e=>{let t,n=q(e);if(n.includes(ee)){n=n.filter((e=>e!==ee));let r,o=F.decode(e[ee].data),l=JSON.parse(o),i=l.map.imports,a=[],s=new Map;q(i).forEach((t=>{for(let o,c=0;o=n[c++];){let[n,c]=o.split(".");if(new RegExp(`.*\\/?${n}${c?`(?:\\.${c})?`:""}$`).test(t)){let n=s.get(o);n||s.set(o,n=H(F.decode(e[o].data))),i[t]=n,o!==l.main||r||(r=n),a.push(o);break}}})),Q(JSON.stringify(l.map,null,2),ee,void 0,{type:"importmap"}),n=n.filter((e=>!a.includes(e))),t={entryMain:r,imdata:l}}return[n,t]},W=async(e,t=D)=>{let n=e+".zip",r=await fetch(`${N||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?1.3*l|0:l);var l;let i=new Uint8Array(o),a=0;for(;;){let e=await r.read();if(e.done)break;i.set(e.value,a),a+=e.value.length,t(`loading zip: ${a.toLocaleString()} bytes(${a/o*100|0}%)`)}return n?i.slice(0,a):i})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);let e=I(r);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{let[n,{entryMain:r,imdata:o}={}]=V(e),l=n.length,i=o?.main,a=()=>{!--l&&t()};for(let t,o=0;t=n[o++];){let n=e[t],o=t===i;Q(F.decode(n.data),t,a,{integrity:G(n.comment),url:o?r:void 0,type:o?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},X=async()=>{X=void 0;let e=J.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){let e,n=Array.isArray;t=JSON.parse(t),t.load?(K(t.base,t.selector),e=n(t.load)?t.load:[t.load]):e=n(t)?t:"string"==typeof t?[t]:[];let r="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"],o=[];for(let t of e)o.push(W(t).catch((e=>e)));let l=(await Promise.all(o)).filter((e=>e&&e.name));"function"==typeof r&&r(l.length?l:void 0),t.cleanup&&Y()}}};setTimeout(X,99);const Z="v1.3.5",ee="$importmap.dat";module.exports=t})();
|
package/webpack-esm/index.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.mjs.LICENSE.txt */
|
|
2
|
-
var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{Lx:()=>
|
|
3
|
-
|
|
4
|
-
const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},k=[,n,r,,o],S=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new k[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},$=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],x=(e,t,n)=>{const r=new Error(t||$[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,x),!n)throw r;return r},E=(e,t,r)=>{const o=e.length;if(!o||r&&r.f&&!r.l)return t||new n(0);const i=!t||!!r,f=!r||r.i;!r&&(r={}),!t&&(t=new n(3*o));const u=e=>{let r=t.length;if(e>r){const o=new n(Math.max(2*r,e));o.set(t),t=o
|
|
5
|
-
}};let g=r.f||0,p=r.p||0,m=r.b||0,k=r.l,$=r.d,E=r.m,z=r.n;const O=8*o;do{if(!k){g=v(e,p,1);const l=v(e,p+1,3);if(p+=3,!l){const n=4+((p+7)/8|0),l=e[n-4]|e[n-3]<<8,a=n+l;if(a>o){f&&x(0);break}i&&u(m+l),t.set(e.subarray(n,a),m),r.b=m+=l,r.p=p=8*a,r.f=g;continue}if(1===l)k=w,$=y,E=9,z=5;else if(2===l){const t=v(e,p,31)+257,r=v(e,p+10,15)+4,o=t+v(e,p+5,31)+1;p+=14;const l=new n(o),a=new n(19);for(let t=0;t<r;++t)a[c[t]]=v(e,p+3*t,7);p+=3*r;const i=b(a),s=(1<<i)-1,f=h(a,i,1);for(let t=0;t<o;){const n=f[v(e,p,s)];p+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+v(e,p,3),p+=2,n=l[t-1]):17===r?(o=3+v(e,p,7),p+=3):18===r&&(o=11+v(e,p,127),p+=7);o--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);E=b(d),z=b(u),k=h(d,E,1),$=h(u,z,1)}else x(1);if(p>O){f&&x(0);break}}
|
|
6
|
-
i&&u(m+131072);const S=(1<<E)-1,T=(1<<z)-1;let U=p;for(;;U=p){const n=k[C(e,p)&S],r=n>>>4;if(p+=15&n,p>O){f&&x(0);break}if(n||x(2),r<256)t[m++]=r;else{if(256===r){U=p,k=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=l[t];n=v(e,p,(1<<o)-1)+s[t],p+=o}const o=$[C(e,p)&T],c=o>>>4;o||x(3),p+=15&o;let g=d[c];if(c>3){const t=a[c];g+=C(e,p)&(1<<t)-1,p+=t}if(p>O){f&&x(0);break}i&&u(m+131072);const h=m+n;for(;m<h;m+=4)t[m]=t[m-g],t[m+1]=t[m+1-g],t[m+2]=t[m+2-g],t[m+3]=t[m+3-g];m=h}}}r.l=k,r.p=U,r.b=m,r.f=g,k&&(g=1,r.m=E,r.d=$,r.n=z)}while(!g);return m===t.length?t:S(t,0,m)},z=(e,t)=>e[t]|e[t+1]<<8,O=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,T=(e,t)=>O(e,t)+4294967296*O(e,t+4),U=(e,t)=>t+30+z(e,t+26)+z(e,t+28),A=(e,t,n)=>{
|
|
7
|
-
const r=!(2048&z(e,t+8)),o=z(e,t+28),l=N(e.subarray(t+46,t+46+o),r),a=t+46+o,c=O(e,t+20),[i,s,f]=n&&4294967295===c?L(e,a):[c,O(e,t+24),O(e,t+42)],d=a+z(e,t+30);return[z(e,t+10),i,s,l,a+z(e,t+30)+z(e,t+32),f,N(e.subarray(d,d+z(e,t+32)),r)]},L=(e,t)=>{for(;1!=z(e,t);t+=4+z(e,t+2));return[T(e,t+12),T(e,t+4),T(e,t+20)]};let j;const P=new n(0);try{const e=new TextDecoder;e.decode(P,{stream:!0}),j=e}catch{}function N(e,t){if(t){let t="";for(let n=0;n<e.length;n+=16384)t+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return t}if(j)return j.decode(e);{const[t,n]=(e=>{for(let t="",n=0;;){let r=e[n++];const o=+(r>127)+ +(r>223)+ +(r>239);if(n+o>e.length)return[t,S(e,n-1)];o?3===o?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,
|
|
8
|
-
t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&o?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}})(e);return n.length&&x(8),t}}let R,B,q=new TextDecoder,D=function(e,t){const r={};let o=e.length-22;for(;101010256!=O(e,o);--o)(!o||e.length-o>65558)&&x(13);let l=z(e,o+8);if(!l)return{};let a=O(e,o+16);const c=4294967295===a;c&&(o=O(e,o-12),101075792!=O(e,o)&&x(13),l=O(e,o+32),a=O(e,o+48));const i=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,s,f,d,u]=A(e,a,c),g=U(e,d);if(a=f,!i||i({name:s,size:o,originalSize:l,compression:t,comment:u})){let a;t?8===t?a=E(e.subarray(g,g+o),new n(l)):x(14,"unknown compression type "+t):a=S(e,g,g+o),a&&(r[s]={data:a,comment:u})}}return r},F=()=>{q=void 0,Z=M=_=F=void 0,
|
|
9
|
-
R=B=void 0,G=D=void 0},G=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},M=(e,t)=>{R=e,B=t||""},Z=(e,t,n,r)=>{let o=()=>{n(),console.log(`script ${t} is ready`)},l=B?document.querySelector(B).nextSibling:void 0,a=document.head[l?"insertBefore":"appendChild"](document.createElement("script"),l);if(a.id=t,r){let t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));a.integrity=r,a.crossOrigin="",a.onload=o,a.src=t}else a.text=e,o()},_=async(e,t=console.log)=>{let n=e+".zip",r=await fetch(`${R||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?1.3*l|0:l);var l;let a=new Uint8Array(o),c=0;for(;;){
|
|
10
|
-
let e=await r.read();if(e.done)break;a.set(e.value,c),c+=e.value.length,t(`loading zip: ${c.toLocaleString()} bytes(${c/o*100|0}%)`)}return n?a.slice(0,c):a})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);let e=D(r);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{let n=Object.keys(e),r=n.length,o=()=>{!--r&&t()};for(let t,r=0;t=n[r++];){let n=e[t];Z(q.decode(n.data),t,o,G(n.comment))}}))}throw new Error(`Could not load "${n}"`)},J=async()=>{J=void 0;let e=document.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){let e;t=JSON.parse(t),t.load?(M(t.base,t.selector),e=t.load):e=Array.isArray(t)?t:"string"==typeof t?[t]:[]
|
|
11
|
-
;let n="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"],r=[];for(let t of e)r.push(_(t).catch((e=>e)));let o=(await Promise.all(r)).filter((e=>e&&e.name));"function"==typeof n&&n(o.length?o:void 0),t.cleanup&&F()}}};setTimeout(J,99);let Y="v1.2.14";var H=t.Lx,I=t.aN,K=t.v6,Q=t.GZ,V=t.i8;export{H as cleanUp,I as loadCompressedScript,K as setConfig,Q as unzipSync,V as version};
|
|
2
|
+
var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{Hx:()=>ee,Lx:()=>H,aN:()=>V,v6:()=>Y,GZ:()=>G,i8:()=>X});const n=String.fromCharCode,r=Uint8Array,o=Uint16Array,l=Uint32Array,a=new r([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,0,0,0]),i=new r([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,0,0]),s=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),c=(e,t)=>{const n=new o(31);for(let r=0;r<31;++r)n[r]=t+=1<<e[r-1];const r=new l(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)r[t]=t-n[e]<<5|e;return[n,r]},[f,d]=c(a,2);f[28]=258,d[258]=28;const[u,p]=c(i,0),y=new o(32768);for(let e=0;e<32768;++e){let t=(43690&e)>>>1|(21845&e)<<1;t=(52428&t)>>>2|(13107&t)<<2,t=(61680&t)>>>4|(3855&t)<<4,y[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let l=0;const a=new o(t);for(;l<r;++l)e[l]&&++a[e[l]-1];const i=new o(t);for(l=0;l<t;++l)i[l]=i[l-1]+a[l-1]<<1;let s;if(n){s=new o(1<<t);const n=15-t;for(l=0;l<r;++l)if(e[l]){const r=l<<4|e[l],o=t-e[l];let a=i[e[l]-1]++<<o;for(const e=a|(1<<o)-1;a<=e;++a)s[y[a]>>>n]=r}}else for(s=new o(r),l=0;l<r;++l)e[l]&&(s[l]=y[i[e[l]-1]++]>>>15-e[l]);return s},m=new r(288);for(let e=0;e<144;++e)m[e]=8;for(let e=144;e<256;++e)m[e]=9;for(let e=256;e<280;++e)m[e]=7;for(let e=280;e<288;++e)m[e]=8;const h=new r(32);for(let e=0;e<32;++e)h[e]=5;const w=g(m,9,1),b=g(h,5,1),v=e=>{let t=e[0];for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},$=(e,t,n)=>{const r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},k=(e,t)=>{const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},x=[,r,o,,l],E=(e,t,n)=>{(!t||t<0)&&(t=0),(!n||n>e.length)&&(n=e.length);const r=new x[e.BYTES_PER_ELEMENT](n-t);return r.set(e.subarray(t,n)),r},S=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"];let C=Error.captureStackTrace;const O=(e,t,n)=>{const r=new Error(t||S[e]);if(r.code=e,C&&C(r,O),!n)throw r;return r},z=(e,t,n)=>{const o=e.length;if(!o||n&&n.f&&!n.l)return t||new r(0);const l=!t||!!n,c=!n||n.i;!n&&(n={}),!t&&(t=new r(3*o));const d=e=>{let n=t.length;if(e>n){const o=new r(Math.max(2*n,e));o.set(t),t=o}};let p=n.f||0,y=n.p||0,m=n.b||0,h=n.l,x=n.d,S=n.m,C=n.n;const z=8*o;do{if(!h){p=$(e,y,1);const a=$(e,y+1,3);if(y+=3,!a){const r=4+((y+7)/8|0),a=e[r-4]|e[r-3]<<8,i=r+a;if(i>o){c&&O(0);break}l&&d(m+a),t.set(e.subarray(r,i),m),n.b=m+=a,n.p=y=8*i,n.f=p;continue}if(1===a)h=w,x=b,S=9,C=5;else if(2===a){const t=$(e,y,31)+257,n=$(e,y+10,15)+4,o=t+$(e,y+5,31)+1;y+=14;const l=new r(o),a=new r(19);for(let t=0;t<n;++t)a[s[t]]=$(e,y+3*t,7);y+=3*n;const i=v(a),c=(1<<i)-1,f=g(a,i,1);for(let t=0;t<o;){const n=f[$(e,y,c)];y+=15&n;const r=n>>>4;if(r<16)l[t++]=r;else{let n=0,o=0;for(16===r?(o=3+$(e,y,3),y+=2,n=l[t-1]):17===r?(o=3+$(e,y,7),y+=3):18===r&&(o=11+$(e,y,127),y+=7);o--;)l[t++]=n}}const d=l.subarray(0,t),u=l.subarray(t);S=v(d),C=v(u),h=g(d,S,1),x=g(u,C,1)}else O(1);if(y>z){c&&O(0);break}}l&&d(m+131072);const E=(1<<S)-1,U=(1<<C)-1;let A=y;for(;;A=y){const n=h[k(e,y)&E],r=n>>>4;if(y+=15&n,y>z){c&&O(0);break}if(n||O(2),r<256)t[m++]=r;else{if(256===r){A=y,h=void 0;break}{let n=r-254;if(r>264){const t=r-257,o=a[t];n=$(e,y,(1<<o)-1)+f[t],y+=o}const o=x[k(e,y)&U],s=o>>>4;o||O(3),y+=15&o;let p=u[s];if(s>3){const t=i[s];p+=k(e,y)&(1<<t)-1,y+=t}if(y>z){c&&O(0);break}l&&d(m+131072);const g=m+n;for(;m<g;m+=4)t[m]=t[m-p],t[m+1]=t[m+1-p],t[m+2]=t[m+2-p],t[m+3]=t[m+3-p];m=g}}}n.l=h,n.p=A,n.b=m,n.f=p,h&&(p=1,n.m=S,n.d=x,n.n=C)}while(!p);return m===t.length?t:E(t,0,m)},U=(e,t)=>e[t]|e[t+1]<<8,A=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,M=(e,t)=>A(e,t)+4294967296*A(e,t+4),T=(e,t)=>t+30+U(e,t+26)+U(e,t+28),L=(e,t,n)=>{const r=!(2048&U(e,t+8)),o=U(e,t+28),l=R(e.subarray(t+46,t+46+o),r),a=t+46+o,i=A(e,t+20),[s,c,f]=n&&4294967295===i?N(e,a):[i,A(e,t+24),A(e,t+42)],d=a+U(e,t+30);return[U(e,t+10),s,c,l,a+U(e,t+30)+U(e,t+32),f,R(e.subarray(d,d+U(e,t+32)),r)]},N=(e,t)=>{for(;1!=U(e,t);t+=4+U(e,t+2));return[M(e,t+12),M(e,t+4),M(e,t+20)]};let P;const j=new r(0);try{const e=new TextDecoder;e.decode(j,{stream:!0}),P=e}catch{}function R(e,t){if(t){let t="";for(let r=0;r<e.length;r+=16384)t+=n.apply(null,e.subarray(r,r+16384));return t}if(P)return P.decode(e);{const[t,r]=(e=>{for(let t="",r=0;;){let o=e[r++];const l=+(o>127)+ +(o>223)+ +(o>239);if(r+l>e.length)return[t,E(e,r-1)];l?3===l?(o=((15&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=n(55296|o>>10,56320|1023&o)):t+=n(1&l?(31&o)<<6|63&e[r++]:(15&o)<<12|(63&e[r++])<<6|63&e[r++]):t+=n(o)}})(e);return r.length&&O(8),t}}let _,B,D=console.log,J=document,q=Object.keys,F=new TextDecoder,G=function(e,t){const n={};let o=e.length-22;for(;101010256!=A(e,o);--o)(!o||e.length-o>65558)&&O(13);let l=U(e,o+8)
|
|
3
|
+
;if(!l)return{};let a=A(e,o+16);const i=4294967295===a;i&&(o=A(e,o-12),101075792!=A(e,o)&&O(13),l=A(e,o+32),a=A(e,o+48));const s=t&&t.filter;for(let t=0;t<l;++t){const[t,o,l,c,f,d,u]=L(e,a,i),p=T(e,d);if(a=f,!s||s({name:c,size:o,originalSize:l,compression:t,comment:u})){let a;t?8===t?a=z(e.subarray(p,p+o),new r(l)):O(14,"unknown compression type "+t):a=E(e,p,p+o),a&&(n[c]={data:a,comment:u})}}return n},H=()=>{F=void 0,K=Y=V=H=void 0,_=B=void 0,Q=Z=I=G=void 0},I=e=>{let t=/^(?:sha\d{3}-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){let n=(e=t[1]).length;if(!(88^n&&64^n&&44^n))return`sha${64==n?384:88==n?512:256}-${e}`}},Z=(e,t="text/javascript")=>URL.createObjectURL(new Blob([e],{type:t})),Y=(e,t)=>{_=e,B=t||""},K=(e,t,n=(()=>{}),r={})=>{let o=()=>{n(),D(`script ${t} is ready`)},l=B?J.querySelector(B).nextElementSibling:void 0,a=J.head[l?"insertBefore":"appendChild"](J.createElement("script"),l);a.id=t,r.type&&(a.type=r.type);let i=r.integrity;i?(a.integrity=i,a.crossOrigin="",a.onload=o,a.src=r.url||Z(e)):(a.text=e,o())},Q=e=>{let t,n=q(e);if(n.includes(ee)){n=n.filter((e=>e!==ee));let r,o=F.decode(e[ee].data),l=JSON.parse(o),a=l.map.imports,i=[],s=new Map;q(a).forEach((t=>{for(let o,c=0;o=n[c++];){let[n,c]=o.split(".");if(new RegExp(`.*\\/?${n}${c?`(?:\\.${c})?`:""}$`).test(t)){let n=s.get(o);n||s.set(o,n=Z(F.decode(e[o].data))),a[t]=n,o!==l.main||r||(r=n),i.push(o);break}}})),K(JSON.stringify(l.map,null,2),ee,void 0,{type:"importmap"}),n=n.filter((e=>!i.includes(e))),t={entryMain:r,imdata:l}}return[n,t]},V=async(e,t=D)=>{let n=e+".zip",r=await fetch(`${_||"."}/${n}`).then((async e=>{let n=!!e.headers.get("content-encoding"),r=e.body.getReader(),o=(l=+e.headers.get("content-length"),n?1.3*l|0:l);var l;let a=new Uint8Array(o),i=0;for(;;){let e=await r.read();if(e.done)break;a.set(e.value,i),i+=e.value.length,t(`loading zip: ${i.toLocaleString()} bytes(${i/o*100|0}%)`)}return n?a.slice(0,i):a})).catch((e=>{console.error(e)}));if(r&&r.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);let e=G(r);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{let[n,{entryMain:r,imdata:o}={}]=Q(e),l=n.length,a=o?.main,i=()=>{!--l&&t()};for(let t,o=0;t=n[o++];){let n=e[t],o=t===a;K(F.decode(n.data),t,i,{integrity:I(n.comment),url:o?r:void 0,type:o?"module":void 0})}}))}throw new Error(`Could not load "${n}"`)},W=async()=>{W=void 0;let e=J.querySelector("script[data-csl-config]");if(e){let t=e.dataset.cslConfig;if(t){let e,n=Array.isArray;t=JSON.parse(t),t.load?(Y(t.base,t.selector),e=n(t.load)?t.load:[t.load]):e=n(t)?t:"string"==typeof t?[t]:[];let r="function"==typeof cslCallback?cslCallback:window[t.callback||"cslCallback"],o=[];for(let t of e)o.push(V(t).catch((e=>e)));let l=(await Promise.all(o)).filter((e=>e&&e.name));"function"==typeof r&&r(l.length?l:void 0),t.cleanup&&H()}}};setTimeout(W,99);const X="v1.3.5",ee="$importmap.dat";var te=t.Hx,ne=t.Lx,re=t.aN,oe=t.v6,le=t.GZ,ae=t.i8;export{te as IM_MAP_ID,ne as cleanUp,re as loadCompressedScript,oe as setConfig,le as unzipSync,ae as version};
|