compressed-script-loader 1.2.5 → 1.2.6
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 +71 -4
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.js +11 -11
- package/webpack/index.js +10 -10
- package/webpack-esm/index.mjs +9 -9
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
# compressed-script-loader
|
|
10
10
|
|
|
11
|
+
## Details
|
|
12
|
+
|
|
11
13
|
+ Use code with **comment** extraction feature added to `unzipSync` of [`fflate`][1].
|
|
12
14
|
+ **comment** is used to embed **SRI**. (`script.integrity`)
|
|
13
15
|
If comment is omitted or does not pass to verify process that it is **SRI**,
|
|
@@ -36,7 +38,7 @@ You can use `sha256`, `sha384`, and `sha512` in `script.integrity`, and the pref
|
|
|
36
38
|
|
|
37
39
|
## Use for SPA
|
|
38
40
|
|
|
39
|
-
> Load automatically
|
|
41
|
+
> #### Load automatically
|
|
40
42
|
|
|
41
43
|
+ Specifying config in the `data-csl-config` attribute of the `script` element
|
|
42
44
|
will automatically load the zip file and insert it as a `script` element in the header section of the html page.
|
|
@@ -67,16 +69,37 @@ You can use `sha256`, `sha384`, and `sha512` in `script.integrity`, and the pref
|
|
|
67
69
|
></script>
|
|
68
70
|
```
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
+ Supports simple `data-csl-config` (since v1.2.6)
|
|
73
|
+
+ In this case, the packed zip file must be deployed in the same directory as the page and no callbacks are available.
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<script
|
|
77
|
+
data-csl-config='"system-coordinate-map-mini"'
|
|
78
|
+
src="https://cdn.jsdelivr.net/npm/compressed-script-loader@1.2.6/umd/index.js"
|
|
79
|
+
></script>
|
|
80
|
+
<!-- or -->
|
|
81
|
+
<script
|
|
82
|
+
data-csl-config='["system-coordinate-map-mini", "bundle"]'
|
|
83
|
+
src="https://cdn.jsdelivr.net/npm/compressed-script-loader@1.2.6/umd/index.js"
|
|
84
|
+
></script>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
> #### Load manually
|
|
71
88
|
|
|
72
89
|
```html
|
|
73
90
|
<script src="https://cdn.jsdelivr.net/npm/compressed-script-loader@latest/umd/index.js"></script>
|
|
74
91
|
<script>
|
|
92
|
+
// global variable `NsLoader` is available (umd)
|
|
75
93
|
(async () => {
|
|
76
94
|
const SCRIPT_BASENAME = "system-coordinate-map-mini";
|
|
77
|
-
|
|
95
|
+
// If the packed zip file is located in the same directory as the page
|
|
96
|
+
// and you don't care where the script is inserted, you can skip this step.
|
|
97
|
+
NsLoader.setConfig("./libs"/*, "script[src*=css-2d-renderer]"*/);
|
|
98
|
+
|
|
78
99
|
await NsLoader.loadCompressedScript(SCRIPT_BASENAME);
|
|
100
|
+
// If you don't use it anymore, this step will destroy the loader api
|
|
79
101
|
NsLoader.cleanUp();
|
|
102
|
+
|
|
80
103
|
runEVEWorld(() => {
|
|
81
104
|
window.setTimeout(() => {
|
|
82
105
|
document.querySelectorAll("script[src^='./loader/'],script[src*='compressed-script-loader']").forEach(script => script.remove());
|
|
@@ -87,7 +110,51 @@ You can use `sha256`, `sha384`, and `sha512` in `script.integrity`, and the pref
|
|
|
87
110
|
</script>
|
|
88
111
|
```
|
|
89
112
|
|
|
90
|
-
|
|
113
|
+
> #### Loader API
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
declare global {
|
|
117
|
+
let cslCallback: (() => void) | undefined;
|
|
118
|
+
interface Window {
|
|
119
|
+
cslCallback: (() => void) | undefined;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export interface UnzipFileInfo {
|
|
123
|
+
name: string;
|
|
124
|
+
size: number;
|
|
125
|
+
originalSize: number;
|
|
126
|
+
compression: number;
|
|
127
|
+
}
|
|
128
|
+
export declare type UnzipFileFilter = (file: UnzipFileInfo) => boolean;
|
|
129
|
+
export interface UnzipOptions {
|
|
130
|
+
filter?: UnzipFileFilter;
|
|
131
|
+
}
|
|
132
|
+
export interface Unzipped {
|
|
133
|
+
[path: string]: {
|
|
134
|
+
data: Uint8Array;
|
|
135
|
+
comment?: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export declare type TCSLConfig = {
|
|
139
|
+
base: string;
|
|
140
|
+
selector?: string;
|
|
141
|
+
load: string[];
|
|
142
|
+
callback?: keyof Window;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare const NsLoader: {
|
|
146
|
+
unzipSync: (data: Uint8Array, opts?: UnzipOptions) => Unzipped;
|
|
147
|
+
cleanUp: () => void;
|
|
148
|
+
setConfig: (base: string, insertionSelector?: string | undefined) => void;
|
|
149
|
+
loadCompressedScript: (baseName: string, log?: (msg: string) => void) => Promise<void>;
|
|
150
|
+
readonly version: string;
|
|
151
|
+
};
|
|
152
|
+
declare interface Window {
|
|
153
|
+
NsLoader: typeof NsLoader;
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Config definition
|
|
91
158
|
|
|
92
159
|
```ts
|
|
93
160
|
/**
|
package/index.d.ts
CHANGED
|
@@ -22,5 +22,5 @@ declare let unzipSync: typeof Uz.unzipSync;
|
|
|
22
22
|
declare let cleanUp: () => void;
|
|
23
23
|
declare let setConfig: (base: string, insertionSelector?: string | undefined) => void;
|
|
24
24
|
declare let loadCompressedScript: (baseName: string, log?: (msg: string) => void) => Promise<void>;
|
|
25
|
-
declare const version = "v1.2.
|
|
25
|
+
declare const version = "v1.2.6";
|
|
26
26
|
export { setConfig, loadCompressedScript, cleanUp, unzipSync, version };
|
package/package.json
CHANGED
package/umd/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(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:()=>B,loadCompressedScript:()=>Y,setConfig:()=>D,unzipSync:()=>
|
|
3
|
-
;const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([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]),s=new n([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 n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new o(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const c=new r(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(s,0),
|
|
4
|
-
;if(n){a=new o(1<<t);const n=15-t;for(c=0;c<r;++c)if(e[c]){const o=c<<4|e[c],r=t-e[c];let s=l[e[c]-1]++<<r;for(const e=s|(1<<r)-1;s<=e;++s)a[
|
|
5
|
-
;return s.set(e.subarray(t,c)),s},k=["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 o=new Error(t||k[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,E),!n)throw o;return o},x=(e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const a=!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
|
|
6
|
-
const n=4+((
|
|
7
|
-
o<256)t[
|
|
8
|
-
;return[T(e,t+10),a,i,c,s+T(e,t+30)+T(e,t+32),f,
|
|
9
|
-
;return n.length&&E(8),t}}let _,N
|
|
10
|
-
|
|
11
|
-
})).catch((e=>(console.error(e),null)));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);const e=
|
|
12
|
-
;return t})()));
|
|
2
|
+
!function(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:()=>B,loadCompressedScript:()=>Y,setConfig:()=>D,unzipSync:()=>R,version:()=>G})
|
|
3
|
+
;const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([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]),s=new n([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 n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new o(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const c=new r(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(s,0),p=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,p[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const g=(e,t,n)=>{const r=e.length;let c=0;const s=new o(t);for(;c<r;++c)e[c]&&++s[e[c]-1];const l=new o(t);for(c=0;c<t;++c)l[c]=l[c-1]+s[c-1]<<1;let a
|
|
4
|
+
;if(n){a=new o(1<<t);const n=15-t;for(c=0;c<r;++c)if(e[c]){const o=c<<4|e[c],r=t-e[c];let s=l[e[c]-1]++<<r;for(const e=s|(1<<r)-1;s<=e;++s)a[p[s]>>>n]=o}}else for(a=new o(r),c=0;c<r;++c)e[c]&&(a[c]=p[l[e[c]-1]++]>>>15-e[c]);return a},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=g(y,9,1),m=g(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=(e,t,c)=>{(null==t||t<0)&&(t=0),(null==c||c>e.length)&&(c=e.length);const s=new(2==e.BYTES_PER_ELEMENT?o:4==e.BYTES_PER_ELEMENT?r:n)(c-t)
|
|
5
|
+
;return s.set(e.subarray(t,c)),s},k=["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 o=new Error(t||k[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,E),!n)throw o;return o},x=(e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const a=!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 p=o.f||0,y=o.p||0,h=o.b||0,k=o.l,x=o.d,T=o.m,$=o.n;const j=8*r;do{if(!k){p=v(e,y,1);const c=v(e,y+1,3);if(y+=3,!c){
|
|
6
|
+
const n=4+((y+7)/8|0),c=e[n-4]|e[n-3]<<8,s=n+c;if(s>r){f&&E(0);break}a&&u(h+c),t.set(e.subarray(n,s),h),o.b=h+=c,o.p=y=8*s,o.f=p;continue}if(1==c)k=b,x=m,T=9,$=5;else if(2==c){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 c=new n(r),s=new n(19);for(let t=0;t<o;++t)s[l[t]]=v(e,y+3*t,7);y+=3*o;const a=w(s),i=(1<<a)-1,f=g(s,a,1);for(let t=0;t<r;){const n=f[v(e,y,i)];y+=15&n;const o=n>>>4;if(o<16)c[t++]=o;else{let n=0,r=0;for(16==o?(r=3+v(e,y,3),y+=2,n=c[t-1]):17==o?(r=3+v(e,y,7),y+=3):18==o&&(r=11+v(e,y,127),y+=7);r--;)c[t++]=n}}const d=c.subarray(0,t),u=c.subarray(t);T=w(d),$=w(u),k=g(d,T,1),x=g(u,$,1)}else E(1);if(y>j){f&&E(0);break}}a&&u(h+131072);const C=(1<<T)-1,z=(1<<$)-1;let O=y;for(;;O=y){const n=k[S(e,y)&C],o=n>>>4;if(y+=15&n,y>j){f&&E(0);break}if(n||E(2),
|
|
7
|
+
o<256)t[h++]=o;else{if(256==o){O=y,k=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=c[t];n=v(e,y,(1<<r)-1)+i[t],y+=r}const r=x[S(e,y)&z],l=r>>>4;r||E(3),y+=15&r;let p=d[l];if(l>3){const t=s[l];p+=S(e,y)&(1<<t)-1,y+=t}if(y>j){f&&E(0);break}a&&u(h+131072);const g=h+n;for(;h<g;h+=4)t[h]=t[h-p],t[h+1]=t[h+1-p],t[h+2]=t[h+2-p],t[h+3]=t[h+3-p];h=g}}}o.l=k,o.p=O,o.b=h,o.f=p,k&&(p=1,o.m=T,o.d=x,o.n=$)}while(!p);return h==t.length?t:C(t,0,h)},T=(e,t)=>e[t]|e[t+1]<<8,$=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,j=(e,t)=>$(e,t)+4294967296*$(e,t+4),z=(e,t)=>t+30+T(e,t+26)+T(e,t+28),O=(e,t,n)=>{const o=!(2048&T(e,t+8)),r=T(e,t+28),c=A(e.subarray(t+46,t+46+r),o),s=t+46+r,l=$(e,t+20),[a,i,f]=n&&4294967295==l?P(e,s):[l,$(e,t+24),$(e,t+42)],d=s+T(e,t+30)
|
|
8
|
+
;return[T(e,t+10),a,i,c,s+T(e,t+30)+T(e,t+32),f,A(e.subarray(d,d+T(e,t+32)),o)]},P=(e,t)=>{for(;1!=T(e,t);t+=4+T(e,t+2));return[j(e,t+12),j(e,t+4),j(e,t+20)]};let U;const L=new n(0);try{const e=new TextDecoder;e.decode(L,{stream:!0}),U=e}catch(e){}function A(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(U)return U.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,C(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)
|
|
9
|
+
;return n.length&&E(8),t}}let M,_,N=new TextDecoder,R=function(e,t){const o={};let r=e.length-22;for(;101010256!=$(e,r);--r)(!r||e.length-r>65558)&&E(13);let c=T(e,r+8);if(!c)return{};let s=$(e,r+16);const l=4294967295==s;l&&(r=$(e,r-12),101075792!=$(e,r)&&E(13),c=$(e,r+32),s=$(e,r+48));const a=t&&t.filter;for(let t=0;t<c;++t){const[t,r,c,i,f,d,u]=O(e,s,l),p=z(e,d);if(s=f,!a||a({name:i,size:r,originalSize:c,compression:t})){let s;t?8===t?s=x(e.subarray(p,p+r),new n(c)):E(14,"unknown compression type "+t):s=C(e,p,p+r),s&&(o[i]={data:s,comment:u})}}return o},B=()=>{N=void 0,F=D=Y=B=void 0,M=_=void 0,q=R=void 0},q=e=>{const t=/^(?:sha\d\d\d-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){const n=(e=t[1]).length;if(88===n||64===n||44===n)return`sha${64===n?384:88===n?512:256}-${e}`}},D=(e,t)=>{M=e,
|
|
10
|
+
_=t||""},F=(e,t,n,o)=>{const r=()=>{n(),console.log(`script ${t} is ready`)};let c=_?document.querySelector(_).nextSibling:void 0;const s=document.head[c?"insertBefore":"appendChild"](document.createElement("script"),c);if(s.id=t,o){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));s.integrity=o,s.onload=r,s.src=t}else s.text=e,r()},Y=async(e,t=console.log)=>{const n=e+".zip",o=await fetch(`${M||"."}/${n}`).then((async e=>{const n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(c=+e.headers.get("content-length"),n?1.3*c|0:c);var c;const s=new Uint8Array(r);let l=0;for(;;){const e=await o.read();if(e.done)break;s.set(e.value,l),l+=e.value.length,t(`loading zip: ${l.toLocaleString()} bytes(${Math.round(l/r*100)}%)`)}return n?s.slice(0,l):s
|
|
11
|
+
})).catch((e=>(console.error(e),null)));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);const e=R(o);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{const n=Object.keys(e);let o=n.length;const r=()=>{!--o&&t()};for(let t=0;t<n.length;){const o=n[t++],c=e[o];F(N.decode(c.data,{stream:!1}),o,r,q(c.comment))}}))}},J=()=>{J=void 0;const e=document.querySelector("script[data-csl-config]");if(e){const t=e.dataset.cslConfig;if(t){const e=JSON.parse(t);let n;"object"==typeof e?(D(e.base,e.selector),n=e.load):n=Array.isArray(e)?e:"string"==typeof e?[e]:[];try{const t=[];for(const e of n)t.push(Y(e));Promise.all(t).then((()=>{const t="function"==typeof cslCallback?cslCallback:window[e.callback||"cslCallback"]
|
|
12
|
+
;"function"==typeof t&&t(),B()}))}catch(e){console.error(e)}}}};setTimeout(J,250);const G="v1.2.6";return t})()));
|
package/webpack/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
(()=>{"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:()=>N,loadCompressedScript:()=>Y,setConfig:()=>D,unzipSync:()=>B,version:()=>G});const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([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]),
|
|
3
|
-
;for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(
|
|
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 b=h(p,9,1),m=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 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=(e,t,c)=>{(null==t||t<0)&&(t=0),(null==c||c>e.length)&&(c=e.length);const
|
|
5
|
-
Error.captureStackTrace&&Error.captureStackTrace(o,E),!n)throw o;return o},T=(e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const a=!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,p=o.p||0,y=o.b||0,k=o.l,T=o.d,$=o.m,x=o.n;const z=8*r;do{if(!k){g=v(e,p,1);const c=v(e,p+1,3);if(p+=3,!c){const n=4+((p+7)/8|0),c=e[n-4]|e[n-3]<<8,
|
|
6
|
-
;const o=n>>>4;if(o<16)c[t++]=o;else{let n=0,r=0;for(16==o?(r=3+v(e,p,3),p+=2,n=c[t-1]):17==o?(r=3+v(e,p,7),p+=3):18==o&&(r=11+v(e,p,127),p+=7);r--;)c[t++]=n}}const d=c.subarray(0,t),u=c.subarray(t);$=w(d),x=w(u),k=h(d,$,1),T=h(u,x,1)}else E(1);if(p>z){f&&E(0);break}}a&&u(y+131072);const C=(1<<$)-1,O=(1<<x)-1;let
|
|
7
|
-
}while(!g);return y==t.length?t:C(t,0,y)},$=(e,t)=>e[t]|e[t+1]<<8,x=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,z=(e,t)=>x(e,t)+4294967296*x(e,t+4),O=(e,t)=>t+30+$(e,t+26)+$(e,t+28),
|
|
8
|
-
let o=e[n++];const r=+(o>127)+ +(o>223)+ +(o>239);if(n+r>e.length)return[t,C(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&&E(8),t}}let L,R
|
|
9
|
-
;t?8===t?
|
|
10
|
-
const n=e+".zip",o=await fetch(`${
|
|
11
|
-
;const e=document.querySelector("script[data-csl-config]");if(e){const t=e.dataset.cslConfig;if(t){const e=JSON.parse(t);D(e.base,e.selector);try{const t=[];for(const
|
|
2
|
+
(()=>{"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:()=>N,loadCompressedScript:()=>Y,setConfig:()=>D,unzipSync:()=>B,version:()=>G});const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([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]),s=new n([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 n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new o(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const c=new r(n[30])
|
|
3
|
+
;for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(s,0),g=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,g[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const h=(e,t,n)=>{const r=e.length;let c=0;const s=new o(t);for(;c<r;++c)e[c]&&++s[e[c]-1];const l=new o(t);for(c=0;c<t;++c)l[c]=l[c-1]+s[c-1]<<1;let a;if(n){a=new o(1<<t);const n=15-t;for(c=0;c<r;++c)if(e[c]){const o=c<<4|e[c],r=t-e[c];let s=l[e[c]-1]++<<r;for(const e=s|(1<<r)-1;s<=e;++s)a[g[s]>>>n]=o}}else for(a=new o(r),c=0;c<r;++c)e[c]&&(a[c]=g[l[e[c]-1]++]>>>15-e[c]);return a},p=new n(288);for(let e=0;e<144;++e)p[e]=8;for(let e=144;e<256;++e)p[e]=9;for(let e=256;e<280;++e)p[e]=7
|
|
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 b=h(p,9,1),m=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 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=(e,t,c)=>{(null==t||t<0)&&(t=0),(null==c||c>e.length)&&(c=e.length);const s=new(2==e.BYTES_PER_ELEMENT?o:4==e.BYTES_PER_ELEMENT?r:n)(c-t);return s.set(e.subarray(t,c)),s},k=["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 o=new Error(t||k[e]);if(o.code=e,
|
|
5
|
+
Error.captureStackTrace&&Error.captureStackTrace(o,E),!n)throw o;return o},T=(e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const a=!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,p=o.p||0,y=o.b||0,k=o.l,T=o.d,$=o.m,x=o.n;const z=8*r;do{if(!k){g=v(e,p,1);const c=v(e,p+1,3);if(p+=3,!c){const n=4+((p+7)/8|0),c=e[n-4]|e[n-3]<<8,s=n+c;if(s>r){f&&E(0);break}a&&u(y+c),t.set(e.subarray(n,s),y),o.b=y+=c,o.p=p=8*s,o.f=g;continue}if(1==c)k=b,T=m,$=9,x=5;else if(2==c){const t=v(e,p,31)+257,o=v(e,p+10,15)+4,r=t+v(e,p+5,31)+1;p+=14;const c=new n(r),s=new n(19);for(let t=0;t<o;++t)s[l[t]]=v(e,p+3*t,7);p+=3*o;const a=w(s),i=(1<<a)-1,f=h(s,a,1);for(let t=0;t<r;){const n=f[v(e,p,i)];p+=15&n
|
|
6
|
+
;const o=n>>>4;if(o<16)c[t++]=o;else{let n=0,r=0;for(16==o?(r=3+v(e,p,3),p+=2,n=c[t-1]):17==o?(r=3+v(e,p,7),p+=3):18==o&&(r=11+v(e,p,127),p+=7);r--;)c[t++]=n}}const d=c.subarray(0,t),u=c.subarray(t);$=w(d),x=w(u),k=h(d,$,1),T=h(u,x,1)}else E(1);if(p>z){f&&E(0);break}}a&&u(y+131072);const C=(1<<$)-1,O=(1<<x)-1;let j=p;for(;;j=p){const n=k[S(e,p)&C],o=n>>>4;if(p+=15&n,p>z){f&&E(0);break}if(n||E(2),o<256)t[y++]=o;else{if(256==o){j=p,k=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=c[t];n=v(e,p,(1<<r)-1)+i[t],p+=r}const r=T[S(e,p)&O],l=r>>>4;r||E(3),p+=15&r;let g=d[l];if(l>3){const t=s[l];g+=S(e,p)&(1<<t)-1,p+=t}if(p>z){f&&E(0);break}a&&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}}}o.l=k,o.p=j,o.b=y,o.f=g,k&&(g=1,o.m=$,o.d=T,o.n=x)
|
|
7
|
+
}while(!g);return y==t.length?t:C(t,0,y)},$=(e,t)=>e[t]|e[t+1]<<8,x=(e,t)=>(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0,z=(e,t)=>x(e,t)+4294967296*x(e,t+4),O=(e,t)=>t+30+$(e,t+26)+$(e,t+28),j=(e,t,n)=>{const o=!(2048&$(e,t+8)),r=$(e,t+28),c=M(e.subarray(t+46,t+46+r),o),s=t+46+r,l=x(e,t+20),[a,i,f]=n&&4294967295==l?P(e,s):[l,x(e,t+24),x(e,t+42)],d=s+$(e,t+30);return[$(e,t+10),a,i,c,s+$(e,t+30)+$(e,t+32),f,M(e.subarray(d,d+$(e,t+32)),o)]},P=(e,t)=>{for(;1!=$(e,t);t+=4+$(e,t+2));return[z(e,t+12),z(e,t+4),z(e,t+20)]};let U;const A=new n(0);try{const e=new TextDecoder;e.decode(A,{stream:!0}),U=e}catch(e){}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(U)return U.decode(e);{const[t,n]=(e=>{for(let t="",n=0;;){
|
|
8
|
+
let o=e[n++];const r=+(o>127)+ +(o>223)+ +(o>239);if(n+r>e.length)return[t,C(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&&E(8),t}}let _,L,R=new TextDecoder,B=function(e,t){const o={};let r=e.length-22;for(;101010256!=x(e,r);--r)(!r||e.length-r>65558)&&E(13);let c=$(e,r+8);if(!c)return{};let s=x(e,r+16);const l=4294967295==s;l&&(r=x(e,r-12),101075792!=x(e,r)&&E(13),c=x(e,r+32),s=x(e,r+48));const a=t&&t.filter;for(let t=0;t<c;++t){const[t,r,c,i,f,d,u]=j(e,s,l),g=O(e,d);if(s=f,!a||a({name:i,size:r,originalSize:c,compression:t})){let s
|
|
9
|
+
;t?8===t?s=T(e.subarray(g,g+r),new n(c)):E(14,"unknown compression type "+t):s=C(e,g,g+r),s&&(o[i]={data:s,comment:u})}}return o},N=()=>{R=void 0,F=D=Y=N=void 0,_=L=void 0,q=B=void 0},q=e=>{const t=/^(?:sha\d\d\d-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){const n=(e=t[1]).length;if(88===n||64===n||44===n)return`sha${64===n?384:88===n?512:256}-${e}`}},D=(e,t)=>{_=e,L=t||""},F=(e,t,n,o)=>{const r=()=>{n(),console.log(`script ${t} is ready`)};let c=L?document.querySelector(L).nextSibling:void 0;const s=document.head[c?"insertBefore":"appendChild"](document.createElement("script"),c);if(s.id=t,o){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));s.integrity=o,s.onload=r,s.src=t}else s.text=e,r()},Y=async(e,t=console.log)=>{
|
|
10
|
+
const n=e+".zip",o=await fetch(`${_||"."}/${n}`).then((async e=>{const n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(c=+e.headers.get("content-length"),n?1.3*c|0:c);var c;const s=new Uint8Array(r);let l=0;for(;;){const e=await o.read();if(e.done)break;s.set(e.value,l),l+=e.value.length,t(`loading zip: ${l.toLocaleString()} bytes(${Math.round(l/r*100)}%)`)}return n?s.slice(0,l):s})).catch((e=>(console.error(e),null)));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);const e=B(o);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{const n=Object.keys(e);let o=n.length;const r=()=>{!--o&&t()};for(let t=0;t<n.length;){const o=n[t++],c=e[o];F(R.decode(c.data,{stream:!1}),o,r,q(c.comment))}}))}},J=()=>{J=void 0
|
|
11
|
+
;const e=document.querySelector("script[data-csl-config]");if(e){const t=e.dataset.cslConfig;if(t){const e=JSON.parse(t);let n;"object"==typeof e?(D(e.base,e.selector),n=e.load):n=Array.isArray(e)?e:"string"==typeof e?[e]:[];try{const t=[];for(const e of n)t.push(Y(e));Promise.all(t).then((()=>{const t="function"==typeof cslCallback?cslCallback:window[e.callback||"cslCallback"];"function"==typeof t&&t(),N()}))}catch(e){console.error(e)}}}};setTimeout(J,250);const G="v1.2.6";module.exports=t})();
|
package/webpack-esm/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! For license information please see index.mjs.LICENSE.txt */
|
|
2
|
-
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)},t={};e.d(t,{Lx:()=>_,aN:()=>G,v6:()=>D,GZ:()=>M,i8:()=>Z});const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([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]),s=new n([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 n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new o(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const c=new r(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(s,0),
|
|
3
|
-
t=(61680&t)>>>4|(3855&t)<<4,
|
|
2
|
+
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)},t={};e.d(t,{Lx:()=>_,aN:()=>G,v6:()=>D,GZ:()=>M,i8:()=>Z});const n=Uint8Array,o=Uint16Array,r=Uint32Array,c=new n([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]),s=new n([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 n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=(e,t)=>{const n=new o(31);for(let o=0;o<31;++o)n[o]=t+=1<<e[o-1];const c=new r(n[30]);for(let e=1;e<30;++e)for(let t=n[e];t<n[e+1];++t)c[t]=t-n[e]<<5|e;return[n,c]},[i,f]=a(c,2);i[28]=258,f[258]=28;const[d,u]=a(s,0),g=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,
|
|
3
|
+
t=(61680&t)>>>4|(3855&t)<<4,g[e]=((65280&t)>>>8|(255&t)<<8)>>>1}const h=(e,t,n)=>{const r=e.length;let c=0;const s=new o(t);for(;c<r;++c)e[c]&&++s[e[c]-1];const l=new o(t);for(c=0;c<t;++c)l[c]=l[c-1]+s[c-1]<<1;let a;if(n){a=new o(1<<t);const n=15-t;for(c=0;c<r;++c)if(e[c]){const o=c<<4|e[c],r=t-e[c];let s=l[e[c]-1]++<<r;for(const e=s|(1<<r)-1;s<=e;++s)a[g[s]>>>n]=o}}else for(a=new o(r),c=0;c<r;++c)e[c]&&(a[c]=g[l[e[c]-1]++]>>>15-e[c]);return a},p=new n(288);for(let e=0;e<144;++e)p[e]=8;for(let e=144;e<256;++e)p[e]=9;for(let e=256;e<280;++e)p[e]=7;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 b=h(p,9,1),m=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 o=t/8|0;return(e[o]|e[o+1]<<8)>>(7&t)&n},C=(e,t)=>{
|
|
4
4
|
const n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},S=(e,t,c)=>{(null==t||t<0)&&(t=0),(null==c||c>e.length)&&(c=e.length);const s=new(2==e.BYTES_PER_ELEMENT?o:4==e.BYTES_PER_ELEMENT?r:n)(c-t);return s.set(e.subarray(t,c)),s},k=["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 o=new Error(t||k[e]);if(o.code=e,Error.captureStackTrace&&Error.captureStackTrace(o,E),!n)throw o;return o},x=(e,t,o)=>{const r=e.length;if(!r||o&&o.f&&!o.l)return t||new n(0);const a=!t||!!o,f=!o||o.i;!o&&(o={}),!t&&(t=new n(3*r));const u=e=>{let o=t.length;if(e>o){
|
|
5
|
-
const r=new n(Math.max(2*o,e));r.set(t),t=r}};let
|
|
6
|
-
}else E(1);if(p>z){f&&E(0);break}}a&&u(
|
|
7
|
-
const o=!(2048&$(e,t+8)),r=$(e,t+28),c=
|
|
8
|
-
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&&E(8),t}}let R,
|
|
9
|
-
q=M=void 0},q=e=>{const t=/^(?:sha\d\d\d-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){const n=(e=t[1]).length;if(88===n||64===n||44===n)return`sha${64===n?384:88===n?512:256}-${e}`}},D=(e,t)=>{
|
|
10
|
-
;for(;;){const e=await o.read();if(e.done)break;s.set(e.value,l),l+=e.value.length,t(`loading zip: ${l.toLocaleString()} bytes(${Math.round(l/r*100)}%)`)}return n?s.slice(0,l):s})).catch((e=>(console.error(e),null)));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);const e=M(o);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{const n=Object.keys(e);let o=n.length;const r=()=>{!--o&&t()};for(let t=0;t<n.length;){const o=n[t++],c=e[o];F(B.decode(c.data,{stream:!1}),o,r,q(c.comment))}}))}},Y=()=>{Y=void 0;const e=document.querySelector("script[data-csl-config]");if(e){const t=e.dataset.cslConfig;if(t){const e=JSON.parse(t);D(e.base,e.selector)
|
|
11
|
-
;t="function"==typeof cslCallback?cslCallback:window[e.callback||"cslCallback"]
|
|
5
|
+
const r=new n(Math.max(2*o,e));r.set(t),t=r}};let g=o.f||0,p=o.p||0,y=o.b||0,k=o.l,x=o.d,$=o.m,T=o.n;const z=8*r;do{if(!k){g=v(e,p,1);const c=v(e,p+1,3);if(p+=3,!c){const n=4+((p+7)/8|0),c=e[n-4]|e[n-3]<<8,s=n+c;if(s>r){f&&E(0);break}a&&u(y+c),t.set(e.subarray(n,s),y),o.b=y+=c,o.p=p=8*s,o.f=g;continue}if(1==c)k=b,x=m,$=9,T=5;else if(2==c){const t=v(e,p,31)+257,o=v(e,p+10,15)+4,r=t+v(e,p+5,31)+1;p+=14;const c=new n(r),s=new n(19);for(let t=0;t<o;++t)s[l[t]]=v(e,p+3*t,7);p+=3*o;const a=w(s),i=(1<<a)-1,f=h(s,a,1);for(let t=0;t<r;){const n=f[v(e,p,i)];p+=15&n;const o=n>>>4;if(o<16)c[t++]=o;else{let n=0,r=0;for(16==o?(r=3+v(e,p,3),p+=2,n=c[t-1]):17==o?(r=3+v(e,p,7),p+=3):18==o&&(r=11+v(e,p,127),p+=7);r--;)c[t++]=n}}const d=c.subarray(0,t),u=c.subarray(t);$=w(d),T=w(u),k=h(d,$,1),x=h(u,T,1)
|
|
6
|
+
}else E(1);if(p>z){f&&E(0);break}}a&&u(y+131072);const S=(1<<$)-1,U=(1<<T)-1;let L=p;for(;;L=p){const n=k[C(e,p)&S],o=n>>>4;if(p+=15&n,p>z){f&&E(0);break}if(n||E(2),o<256)t[y++]=o;else{if(256==o){L=p,k=void 0;break}{let n=o-254;if(o>264){const t=o-257,r=c[t];n=v(e,p,(1<<r)-1)+i[t],p+=r}const r=x[C(e,p)&U],l=r>>>4;r||E(3),p+=15&r;let g=d[l];if(l>3){const t=s[l];g+=C(e,p)&(1<<t)-1,p+=t}if(p>z){f&&E(0);break}a&&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}}}o.l=k,o.p=L,o.b=y,o.f=g,k&&(g=1,o.m=$,o.d=x,o.n=T)}while(!g);return y==t.length?t:S(t,0,y)},$=(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+$(e,t+26)+$(e,t+28),L=(e,t,n)=>{
|
|
7
|
+
const o=!(2048&$(e,t+8)),r=$(e,t+28),c=P(e.subarray(t+46,t+46+r),o),s=t+46+r,l=T(e,t+20),[a,i,f]=n&&4294967295==l?O(e,s):[l,T(e,t+24),T(e,t+42)],d=s+$(e,t+30);return[$(e,t+10),a,i,c,s+$(e,t+30)+$(e,t+32),f,P(e.subarray(d,d+$(e,t+32)),o)]},O=(e,t)=>{for(;1!=$(e,t);t+=4+$(e,t+2));return[z(e,t+12),z(e,t+4),z(e,t+20)]};let j;const A=new n(0);try{const e=new TextDecoder;e.decode(A,{stream:!0}),j=e}catch(e){}function P(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 o=e[n++];const r=+(o>127)+ +(o>223)+ +(o>239);if(n+r>e.length)return[t,S(e,n-1)];r?3==r?(o=((15&o)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,
|
|
8
|
+
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&&E(8),t}}let N,R,B=new TextDecoder,M=function(e,t){const o={};let r=e.length-22;for(;101010256!=T(e,r);--r)(!r||e.length-r>65558)&&E(13);let c=$(e,r+8);if(!c)return{};let s=T(e,r+16);const l=4294967295==s;l&&(r=T(e,r-12),101075792!=T(e,r)&&E(13),c=T(e,r+32),s=T(e,r+48));const a=t&&t.filter;for(let t=0;t<c;++t){const[t,r,c,i,f,d,u]=L(e,s,l),g=U(e,d);if(s=f,!a||a({name:i,size:r,originalSize:c,compression:t})){let s;t?8===t?s=x(e.subarray(g,g+r),new n(c)):E(14,"unknown compression type "+t):s=S(e,g,g+r),s&&(o[i]={data:s,comment:u})}}return o},_=()=>{B=void 0,F=D=G=_=void 0,N=R=void 0,
|
|
9
|
+
q=M=void 0},q=e=>{const t=/^(?:sha\d\d\d-)?([a-z0-9+/=]{44,88})$/i.exec(e);if(t){const n=(e=t[1]).length;if(88===n||64===n||44===n)return`sha${64===n?384:88===n?512:256}-${e}`}},D=(e,t)=>{N=e,R=t||""},F=(e,t,n,o)=>{const r=()=>{n(),console.log(`script ${t} is ready`)};let c=R?document.querySelector(R).nextSibling:void 0;const s=document.head[c?"insertBefore":"appendChild"](document.createElement("script"),c);if(s.id=t,o){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"}));s.integrity=o,s.onload=r,s.src=t}else s.text=e,r()},G=async(e,t=console.log)=>{const n=e+".zip",o=await fetch(`${N||"."}/${n}`).then((async e=>{const n=!!e.headers.get("content-encoding"),o=e.body.getReader(),r=(c=+e.headers.get("content-length"),n?1.3*c|0:c);var c;const s=new Uint8Array(r);let l=0
|
|
10
|
+
;for(;;){const e=await o.read();if(e.done)break;s.set(e.value,l),l+=e.value.length,t(`loading zip: ${l.toLocaleString()} bytes(${Math.round(l/r*100)}%)`)}return n?s.slice(0,l):s})).catch((e=>(console.error(e),null)));if(o&&o.length){t(`loaded ${n}, decompressing binary...`),console.time(`unzip: ${n}`);const e=M(o);return console.timeEnd(`unzip: ${n}`),t(`${n} decompressed 😃`),new Promise((t=>{const n=Object.keys(e);let o=n.length;const r=()=>{!--o&&t()};for(let t=0;t<n.length;){const o=n[t++],c=e[o];F(B.decode(c.data,{stream:!1}),o,r,q(c.comment))}}))}},Y=()=>{Y=void 0;const e=document.querySelector("script[data-csl-config]");if(e){const t=e.dataset.cslConfig;if(t){const e=JSON.parse(t);let n;"object"==typeof e?(D(e.base,e.selector),n=e.load):n=Array.isArray(e)?e:"string"==typeof e?[e]:[]
|
|
11
|
+
;try{const t=[];for(const e of n)t.push(G(e));Promise.all(t).then((()=>{const t="function"==typeof cslCallback?cslCallback:window[e.callback||"cslCallback"];"function"==typeof t&&t(),_()}))}catch(e){console.error(e)}}}};setTimeout(Y,250);const Z="v1.2.6";var J=t.Lx,H=t.aN,I=t.v6,K=t.GZ,Q=t.i8;export{J as cleanUp,H as loadCompressedScript,I as setConfig,K as unzipSync,Q as version};
|