@agile-team/mach-report 2.16.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -12
- package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
- package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
- package/dist/ParamEditor-KzDQvbHY.js +732 -0
- package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
- package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
- package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
- package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
- package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
- package/dist/ReportPreview-BxWWTUL5.js +5583 -0
- package/dist/ReportPreview-Yf99omi3.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
- package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
- package/dist/RuleEditor-CqxT1a-W.js +2337 -0
- package/dist/RuleEditor-D7YWigD9.cjs +1 -0
- package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
- package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
- package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
- package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
- package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +163 -42
- package/dist/analytics.d.ts +163 -42
- package/dist/analytics.js +76 -141
- package/dist/artifact-integrity.json +110 -108
- package/dist/assets-2eC3mOcV.js +232 -0
- package/dist/assets-B0Hxn4l6.cjs +1 -0
- package/dist/{auto-uVBjX1j5.cjs → auto-B0EZFIK1.cjs} +1 -1
- package/dist/{auto-YR7a4BtF.js → auto-BlchZ1b8.js} +10 -10
- package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
- package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
- package/dist/charts-Dlv8j2AG.js +141 -0
- package/dist/charts-aCtoswXq.cjs +1 -0
- package/dist/codes.cjs +9 -9
- package/dist/codes.d.cts +54 -0
- package/dist/codes.d.ts +54 -0
- package/dist/codes.js +12097 -13668
- package/dist/column-visual-BpgQVWwT.js +238 -0
- package/dist/column-visual-CtYxnBCP.cjs +1 -0
- package/dist/component-tree-6TV7W6Yj.cjs +1 -0
- package/dist/component-tree-CvW4lzpv.js +67 -0
- package/dist/computed-4TnxzgIh.cjs +1 -0
- package/dist/computed-C8NRZQss.js +739 -0
- package/dist/data-bar-Ce38juRZ.cjs +1 -0
- package/dist/data-bar-PtjXhMgN.js +9 -0
- package/dist/dataset-DL83majE.js +161 -0
- package/dist/dataset-IrlXbUvh.cjs +1 -0
- package/dist/designer--TKECSEc.cjs +2 -0
- package/dist/designer-d6hJS41w.js +5683 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +835 -45
- package/dist/designer.d.ts +835 -45
- package/dist/designer.js +23 -20
- package/dist/{encoding-BYF9ZTl9.cjs → encoding-B--eZpp1.cjs} +1 -1
- package/dist/{encoding-BOGq4qYL.js → encoding-mctOLocI.js} +2 -2
- package/dist/{font-loader-EKLzOJxf.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
- package/dist/{font-loader-CzI1GuBc.js → font-loader-DW8tIaNp.js} +1 -1
- package/dist/index-CPh6tqge.js +1575 -0
- package/dist/index-CUNw7dL9.cjs +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +534 -16
- package/dist/index.d.ts +534 -16
- package/dist/index.js +1393 -955
- package/dist/json-snapshot-By4ZVVUt.js +1967 -0
- package/dist/json-snapshot-jiXff4lc.cjs +2 -0
- package/dist/matrix-0hywp0-F.cjs +1 -0
- package/dist/matrix-Dy-tyY7E.js +381 -0
- package/dist/param-validation-C-8sRJLq.cjs +1 -0
- package/dist/param-validation-CnDEd2l-.js +333 -0
- package/dist/{pdf-DJ5S6ukC.js → pdf-CKROKygt.js} +1845 -1845
- package/dist/{pdf-ByVCb1i6.cjs → pdf-DqyxJ96U.cjs} +47 -47
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +66 -0
- package/dist/pdf.d.ts +66 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-C2j5_mhx.js → plugin-ByjF2kiV.js} +5 -5
- package/dist/{plugin-Dr39GBRG.cjs → plugin-DM1M2wlI.cjs} +1 -1
- package/dist/prefill-B8H9qwE4.js +371 -0
- package/dist/prefill-D7EswyTI.cjs +1 -0
- package/dist/{prepared-DqtpvRTn.js → prepared-BE-4jfX5.js} +2 -2
- package/dist/{prepared-DdrjLC7L.cjs → prepared-CGVphji3.cjs} +1 -1
- package/dist/{protocol-BzwMP4Vw.cjs → protocol-ByRVzzQG.cjs} +1 -1
- package/dist/{protocol-kt4Iy6-3.js → protocol-Cr81vFSQ.js} +3 -3
- package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-DEJtmo3p.js} +67 -107
- package/dist/record-bindings-ehjnCDHt.cjs +1 -0
- package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-CBg0l_tj.js} +2 -2
- package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
- package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
- package/dist/runtime-CDA6d263.cjs +1 -0
- package/dist/runtime-CEMvybO7.js +170 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +121 -7
- package/dist/server/node.d.ts +121 -7
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +3446 -2115
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +417 -29
- package/dist/server.d.ts +417 -29
- package/dist/server.js +787 -544
- package/dist/sha256-BDQ1Qk7A.js +158 -0
- package/dist/sha256-DgZAKXqI.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
- package/dist/template-bindings-TKnXM7ll.js +62 -0
- package/dist/{template-catalog-BtR2JmCL.js → template-catalog-CmbWOJqy.js} +16 -16
- package/dist/template-catalog-Utu4GP09.cjs +1 -0
- package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
- package/dist/{template-fragments-By0aZC1D.js → template-fragments-DWgo9tlZ.js} +2 -2
- package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
- package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
- package/dist/{template-registry-Cw3vRTX2.js → template-registry-BIhIHOab.js} +319 -314
- package/dist/template-registry-DzWswQI5.cjs +1 -0
- package/dist/vue/async.d.cts +636 -35
- package/dist/vue/async.d.ts +636 -35
- package/dist/vue/index.d.cts +746 -67
- package/dist/vue/index.d.ts +746 -67
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +94 -89
- package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-B94EwVa_.cjs} +1 -1
- package/dist/{workbook-session-BeSO8PFB.js → workbook-session-BoScoOg-.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +75 -7
- package/dist/worker.d.ts +75 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +208 -15
- package/dist/xlsx.d.ts +208 -15
- package/dist/xlsx.js +288 -252
- package/package.json +1 -1
- package/dist/ParamEditor-CUQLgoxa.cjs +0 -1
- package/dist/ParamEditor-OKesP_nO.js +0 -594
- package/dist/ReportBatchPanel-cZCAMAwH.cjs +0 -1
- package/dist/ReportPreview-BcDKCLiK.js +0 -4834
- package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
- package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
- package/dist/RuleEditor-CGl9XY2s.js +0 -2037
- package/dist/assets-CqIbfbTr.js +0 -126
- package/dist/assets-e4YSke8n.cjs +0 -1
- package/dist/capabilities-DDwXr_cA.js +0 -103
- package/dist/capabilities-DNLyZdNw.cjs +0 -1
- package/dist/component-tree-Ca6YYfHq.js +0 -61
- package/dist/component-tree-DkGLEfZC.cjs +0 -1
- package/dist/computed-C-4C2S5h.js +0 -521
- package/dist/computed-CGV2a809.cjs +0 -1
- package/dist/config-Dg_o8e7m.cjs +0 -1
- package/dist/config-XQ4qrQ7Q.js +0 -844
- package/dist/dataset-BkRmwgeJ.cjs +0 -1
- package/dist/dataset-H5pFuQGU.js +0 -121
- package/dist/designer-BfQSahxq.js +0 -5163
- package/dist/designer-CPPdeM5_.cjs +0 -2
- package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
- package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
- package/dist/drill-CsdjgkRM.cjs +0 -1
- package/dist/drill-DIGsZfyB.js +0 -145
- package/dist/json-snapshot-D6ioHth9.js +0 -1702
- package/dist/json-snapshot-DknkjvxP.cjs +0 -2
- package/dist/matrix-CGRGkn5s.js +0 -112
- package/dist/matrix-gEO7ZM_u.cjs +0 -1
- package/dist/param-validation-C3HlcLLO.cjs +0 -1
- package/dist/param-validation-Do7Eg8Zv.js +0 -181
- package/dist/record-bindings-DUX1VMlR.cjs +0 -1
- package/dist/runtime-BjKBI530.js +0 -168
- package/dist/runtime-CBFEPKEs.cjs +0 -1
- package/dist/sha256-BshdOkCC.cjs +0 -1
- package/dist/sha256-DTG-Gq8i.js +0 -157
- package/dist/template-bindings-C2SpvsMU.js +0 -58
- package/dist/template-bindings-CEtWyiLX.cjs +0 -1
- package/dist/template-catalog-C2NLdrwB.cjs +0 -1
- package/dist/template-registry-C62vpv4a.cjs +0 -1
- package/dist/tree-BX380Rr7.cjs +0 -1
- package/dist/tree-CjVZLRw7.js +0 -172
|
@@ -0,0 +1,1575 @@
|
|
|
1
|
+
function Ht(t, i = "utf8") {
|
|
2
|
+
return new TextDecoder(i).decode(t);
|
|
3
|
+
}
|
|
4
|
+
const Ie = new TextEncoder();
|
|
5
|
+
function Re(t) {
|
|
6
|
+
return Ie.encode(t);
|
|
7
|
+
}
|
|
8
|
+
const Oe = 1024 * 8, Be = (() => {
|
|
9
|
+
const t = new Uint8Array(4), i = new Uint32Array(t.buffer);
|
|
10
|
+
return !((i[0] = 1) & t[0]);
|
|
11
|
+
})(), bt = {
|
|
12
|
+
int8: globalThis.Int8Array,
|
|
13
|
+
uint8: globalThis.Uint8Array,
|
|
14
|
+
int16: globalThis.Int16Array,
|
|
15
|
+
uint16: globalThis.Uint16Array,
|
|
16
|
+
int32: globalThis.Int32Array,
|
|
17
|
+
uint32: globalThis.Uint32Array,
|
|
18
|
+
uint64: globalThis.BigUint64Array,
|
|
19
|
+
int64: globalThis.BigInt64Array,
|
|
20
|
+
float32: globalThis.Float32Array,
|
|
21
|
+
float64: globalThis.Float64Array
|
|
22
|
+
};
|
|
23
|
+
class st {
|
|
24
|
+
/**
|
|
25
|
+
* Reference to the internal ArrayBuffer object.
|
|
26
|
+
*/
|
|
27
|
+
buffer;
|
|
28
|
+
/**
|
|
29
|
+
* Byte length of the internal ArrayBuffer.
|
|
30
|
+
*/
|
|
31
|
+
byteLength;
|
|
32
|
+
/**
|
|
33
|
+
* Byte offset of the internal ArrayBuffer.
|
|
34
|
+
*/
|
|
35
|
+
byteOffset;
|
|
36
|
+
/**
|
|
37
|
+
* Byte length of the internal ArrayBuffer.
|
|
38
|
+
*/
|
|
39
|
+
length;
|
|
40
|
+
/**
|
|
41
|
+
* The current offset of the buffer's pointer.
|
|
42
|
+
*/
|
|
43
|
+
offset;
|
|
44
|
+
lastWrittenByte;
|
|
45
|
+
littleEndian;
|
|
46
|
+
_data;
|
|
47
|
+
_mark;
|
|
48
|
+
_marks;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new IOBuffer.
|
|
51
|
+
* @param data - The data to construct the IOBuffer with.
|
|
52
|
+
* If data is a number, it will be the new buffer's length<br>
|
|
53
|
+
* If data is `undefined`, the buffer will be initialized with a default length of 8Kb<br>
|
|
54
|
+
* If data is an ArrayBuffer, SharedArrayBuffer, an ArrayBufferView (Typed Array), an IOBuffer instance,
|
|
55
|
+
* or a Node.js Buffer, a view will be created over the underlying ArrayBuffer.
|
|
56
|
+
* @param options - An object for the options.
|
|
57
|
+
* @returns A new IOBuffer instance.
|
|
58
|
+
*/
|
|
59
|
+
constructor(i = Oe, e = {}) {
|
|
60
|
+
let n = !1;
|
|
61
|
+
typeof i == "number" ? i = new ArrayBuffer(i) : (n = !0, this.lastWrittenByte = i.byteLength);
|
|
62
|
+
const a = e.offset ? e.offset >>> 0 : 0, r = i.byteLength - a;
|
|
63
|
+
let l = a;
|
|
64
|
+
(ArrayBuffer.isView(i) || i instanceof st) && (i.byteLength !== i.buffer.byteLength && (l = i.byteOffset + a), i = i.buffer), n ? this.lastWrittenByte = r : this.lastWrittenByte = 0, this.buffer = i, this.length = r, this.byteLength = r, this.byteOffset = l, this.offset = 0, this.littleEndian = !0, this._data = new DataView(this.buffer, l, r), this._mark = 0, this._marks = [];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the memory allocated to the buffer is sufficient to store more
|
|
68
|
+
* bytes after the offset.
|
|
69
|
+
* @param byteLength - The needed memory in bytes.
|
|
70
|
+
* @returns `true` if there is sufficient space and `false` otherwise.
|
|
71
|
+
*/
|
|
72
|
+
available(i = 1) {
|
|
73
|
+
return this.offset + i <= this.length;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if little-endian mode is used for reading and writing multi-byte
|
|
77
|
+
* values.
|
|
78
|
+
* @returns `true` if little-endian mode is used, `false` otherwise.
|
|
79
|
+
*/
|
|
80
|
+
isLittleEndian() {
|
|
81
|
+
return this.littleEndian;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Set little-endian mode for reading and writing multi-byte values.
|
|
85
|
+
* @returns This.
|
|
86
|
+
*/
|
|
87
|
+
setLittleEndian() {
|
|
88
|
+
return this.littleEndian = !0, this;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check if big-endian mode is used for reading and writing multi-byte values.
|
|
92
|
+
* @returns `true` if big-endian mode is used, `false` otherwise.
|
|
93
|
+
*/
|
|
94
|
+
isBigEndian() {
|
|
95
|
+
return !this.littleEndian;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Switches to big-endian mode for reading and writing multi-byte values.
|
|
99
|
+
* @returns This.
|
|
100
|
+
*/
|
|
101
|
+
setBigEndian() {
|
|
102
|
+
return this.littleEndian = !1, this;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Move the pointer n bytes forward.
|
|
106
|
+
* @param n - Number of bytes to skip.
|
|
107
|
+
* @returns This.
|
|
108
|
+
*/
|
|
109
|
+
skip(i = 1) {
|
|
110
|
+
return this.offset += i, this;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Move the pointer n bytes backward.
|
|
114
|
+
* @param n - Number of bytes to move back.
|
|
115
|
+
* @returns This.
|
|
116
|
+
*/
|
|
117
|
+
back(i = 1) {
|
|
118
|
+
return this.offset -= i, this;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Move the pointer to the given offset.
|
|
122
|
+
* @param offset - The offset to move to.
|
|
123
|
+
* @returns This.
|
|
124
|
+
*/
|
|
125
|
+
seek(i) {
|
|
126
|
+
return this.offset = i, this;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Store the current pointer offset.
|
|
130
|
+
* @see {@link IOBuffer#reset}
|
|
131
|
+
* @returns This.
|
|
132
|
+
*/
|
|
133
|
+
mark() {
|
|
134
|
+
return this._mark = this.offset, this;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Move the pointer back to the last pointer offset set by mark.
|
|
138
|
+
* @see {@link IOBuffer#mark}
|
|
139
|
+
* @returns This.
|
|
140
|
+
*/
|
|
141
|
+
reset() {
|
|
142
|
+
return this.offset = this._mark, this;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Push the current pointer offset to the mark stack.
|
|
146
|
+
* @see {@link IOBuffer#popMark}
|
|
147
|
+
* @returns This.
|
|
148
|
+
*/
|
|
149
|
+
pushMark() {
|
|
150
|
+
return this._marks.push(this.offset), this;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Pop the last pointer offset from the mark stack, and set the current
|
|
154
|
+
* pointer offset to the popped value.
|
|
155
|
+
* @see {@link IOBuffer#pushMark}
|
|
156
|
+
* @returns This.
|
|
157
|
+
*/
|
|
158
|
+
popMark() {
|
|
159
|
+
const i = this._marks.pop();
|
|
160
|
+
if (i === void 0)
|
|
161
|
+
throw new Error("Mark stack empty");
|
|
162
|
+
return this.seek(i), this;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Move the pointer offset back to 0.
|
|
166
|
+
* @returns This.
|
|
167
|
+
*/
|
|
168
|
+
rewind() {
|
|
169
|
+
return this.offset = 0, this;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Make sure the buffer has sufficient memory to write a given byteLength at
|
|
173
|
+
* the current pointer offset.
|
|
174
|
+
* If the buffer's memory is insufficient, this method will create a new
|
|
175
|
+
* buffer (a copy) with a length that is twice (byteLength + current offset).
|
|
176
|
+
* @param byteLength - The needed memory in bytes.
|
|
177
|
+
* @returns This.
|
|
178
|
+
*/
|
|
179
|
+
ensureAvailable(i = 1) {
|
|
180
|
+
if (!this.available(i)) {
|
|
181
|
+
const n = (this.offset + i) * 2, a = new Uint8Array(n);
|
|
182
|
+
a.set(new Uint8Array(this.buffer)), this.buffer = a.buffer, this.length = n, this.byteLength = n, this._data = new DataView(this.buffer);
|
|
183
|
+
}
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Read a byte and return false if the byte's value is 0, or true otherwise.
|
|
188
|
+
* Moves pointer forward by one byte.
|
|
189
|
+
* @returns The read boolean.
|
|
190
|
+
*/
|
|
191
|
+
readBoolean() {
|
|
192
|
+
return this.readUint8() !== 0;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Read a signed 8-bit integer and move pointer forward by 1 byte.
|
|
196
|
+
* @returns The read byte.
|
|
197
|
+
*/
|
|
198
|
+
readInt8() {
|
|
199
|
+
return this._data.getInt8(this.offset++);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Read an unsigned 8-bit integer and move pointer forward by 1 byte.
|
|
203
|
+
* @returns The read byte.
|
|
204
|
+
*/
|
|
205
|
+
readUint8() {
|
|
206
|
+
return this._data.getUint8(this.offset++);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Alias for {@link IOBuffer#readUint8}.
|
|
210
|
+
* @returns The read byte.
|
|
211
|
+
*/
|
|
212
|
+
readByte() {
|
|
213
|
+
return this.readUint8();
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Read `n` bytes and move pointer forward by `n` bytes.
|
|
217
|
+
* @param n - Number of bytes to read.
|
|
218
|
+
* @returns The read bytes.
|
|
219
|
+
*/
|
|
220
|
+
readBytes(i = 1) {
|
|
221
|
+
return this.readArray(i, "uint8");
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Creates an array of corresponding to the type `type` and size `size`.
|
|
225
|
+
* For example type `uint8` will create a `Uint8Array`.
|
|
226
|
+
* @param size - size of the resulting array
|
|
227
|
+
* @param type - number type of elements to read
|
|
228
|
+
* @returns The read array.
|
|
229
|
+
*/
|
|
230
|
+
readArray(i, e) {
|
|
231
|
+
const n = bt[e].BYTES_PER_ELEMENT * i, a = this.byteOffset + this.offset, r = this.buffer.slice(a, a + n);
|
|
232
|
+
if (this.littleEndian === Be && e !== "uint8" && e !== "int8") {
|
|
233
|
+
const h = new Uint8Array(this.buffer.slice(a, a + n));
|
|
234
|
+
h.reverse();
|
|
235
|
+
const o = new bt[e](h.buffer);
|
|
236
|
+
return this.offset += n, o.reverse(), o;
|
|
237
|
+
}
|
|
238
|
+
const l = new bt[e](r);
|
|
239
|
+
return this.offset += n, l;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Read a 16-bit signed integer and move pointer forward by 2 bytes.
|
|
243
|
+
* @returns The read value.
|
|
244
|
+
*/
|
|
245
|
+
readInt16() {
|
|
246
|
+
const i = this._data.getInt16(this.offset, this.littleEndian);
|
|
247
|
+
return this.offset += 2, i;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Read a 16-bit unsigned integer and move pointer forward by 2 bytes.
|
|
251
|
+
* @returns The read value.
|
|
252
|
+
*/
|
|
253
|
+
readUint16() {
|
|
254
|
+
const i = this._data.getUint16(this.offset, this.littleEndian);
|
|
255
|
+
return this.offset += 2, i;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Read a 32-bit signed integer and move pointer forward by 4 bytes.
|
|
259
|
+
* @returns The read value.
|
|
260
|
+
*/
|
|
261
|
+
readInt32() {
|
|
262
|
+
const i = this._data.getInt32(this.offset, this.littleEndian);
|
|
263
|
+
return this.offset += 4, i;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Read a 32-bit unsigned integer and move pointer forward by 4 bytes.
|
|
267
|
+
* @returns The read value.
|
|
268
|
+
*/
|
|
269
|
+
readUint32() {
|
|
270
|
+
const i = this._data.getUint32(this.offset, this.littleEndian);
|
|
271
|
+
return this.offset += 4, i;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Read a 32-bit floating number and move pointer forward by 4 bytes.
|
|
275
|
+
* @returns The read value.
|
|
276
|
+
*/
|
|
277
|
+
readFloat32() {
|
|
278
|
+
const i = this._data.getFloat32(this.offset, this.littleEndian);
|
|
279
|
+
return this.offset += 4, i;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Read a 64-bit floating number and move pointer forward by 8 bytes.
|
|
283
|
+
* @returns The read value.
|
|
284
|
+
*/
|
|
285
|
+
readFloat64() {
|
|
286
|
+
const i = this._data.getFloat64(this.offset, this.littleEndian);
|
|
287
|
+
return this.offset += 8, i;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Read a 64-bit signed integer number and move pointer forward by 8 bytes.
|
|
291
|
+
* @returns The read value.
|
|
292
|
+
*/
|
|
293
|
+
readBigInt64() {
|
|
294
|
+
const i = this._data.getBigInt64(this.offset, this.littleEndian);
|
|
295
|
+
return this.offset += 8, i;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Read a 64-bit unsigned integer number and move pointer forward by 8 bytes.
|
|
299
|
+
* @returns The read value.
|
|
300
|
+
*/
|
|
301
|
+
readBigUint64() {
|
|
302
|
+
const i = this._data.getBigUint64(this.offset, this.littleEndian);
|
|
303
|
+
return this.offset += 8, i;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Read a 1-byte ASCII character and move pointer forward by 1 byte.
|
|
307
|
+
* @returns The read character.
|
|
308
|
+
*/
|
|
309
|
+
readChar() {
|
|
310
|
+
return String.fromCharCode(this.readInt8());
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Read `n` 1-byte ASCII characters and move pointer forward by `n` bytes.
|
|
314
|
+
* @param n - Number of characters to read.
|
|
315
|
+
* @returns The read characters.
|
|
316
|
+
*/
|
|
317
|
+
readChars(i = 1) {
|
|
318
|
+
let e = "";
|
|
319
|
+
for (let n = 0; n < i; n++)
|
|
320
|
+
e += this.readChar();
|
|
321
|
+
return e;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Read the next `n` bytes, return a UTF-8 decoded string and move pointer
|
|
325
|
+
* forward by `n` bytes.
|
|
326
|
+
* @param n - Number of bytes to read.
|
|
327
|
+
* @returns The decoded string.
|
|
328
|
+
*/
|
|
329
|
+
readUtf8(i = 1) {
|
|
330
|
+
return Ht(this.readBytes(i));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Read the next `n` bytes, return a string decoded with `encoding` and move pointer
|
|
334
|
+
* forward by `n` bytes.
|
|
335
|
+
* If no encoding is passed, the function is equivalent to @see {@link IOBuffer#readUtf8}
|
|
336
|
+
* @param n - Number of bytes to read.
|
|
337
|
+
* @param encoding - The encoding to use. Default is 'utf8'.
|
|
338
|
+
* @returns The decoded string.
|
|
339
|
+
*/
|
|
340
|
+
decodeText(i = 1, e = "utf8") {
|
|
341
|
+
return Ht(this.readBytes(i), e);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Write 0xff if the passed value is truthy, 0x00 otherwise and move pointer
|
|
345
|
+
* forward by 1 byte.
|
|
346
|
+
* @param value - The value to write.
|
|
347
|
+
* @returns This.
|
|
348
|
+
*/
|
|
349
|
+
writeBoolean(i) {
|
|
350
|
+
return this.writeUint8(i ? 255 : 0), this;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Write `value` as an 8-bit signed integer and move pointer forward by 1 byte.
|
|
354
|
+
* @param value - The value to write.
|
|
355
|
+
* @returns This.
|
|
356
|
+
*/
|
|
357
|
+
writeInt8(i) {
|
|
358
|
+
return this.ensureAvailable(1), this._data.setInt8(this.offset++, i), this._updateLastWrittenByte(), this;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Write `value` as an 8-bit unsigned integer and move pointer forward by 1
|
|
362
|
+
* byte.
|
|
363
|
+
* @param value - The value to write.
|
|
364
|
+
* @returns This.
|
|
365
|
+
*/
|
|
366
|
+
writeUint8(i) {
|
|
367
|
+
return this.ensureAvailable(1), this._data.setUint8(this.offset++, i), this._updateLastWrittenByte(), this;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* An alias for {@link IOBuffer#writeUint8}.
|
|
371
|
+
* @param value - The value to write.
|
|
372
|
+
* @returns This.
|
|
373
|
+
*/
|
|
374
|
+
writeByte(i) {
|
|
375
|
+
return this.writeUint8(i);
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Write all elements of `bytes` as uint8 values and move pointer forward by
|
|
379
|
+
* `bytes.length` bytes.
|
|
380
|
+
* @param bytes - The array of bytes to write.
|
|
381
|
+
* @returns This.
|
|
382
|
+
*/
|
|
383
|
+
writeBytes(i) {
|
|
384
|
+
this.ensureAvailable(i.length);
|
|
385
|
+
for (let e = 0; e < i.length; e++)
|
|
386
|
+
this._data.setUint8(this.offset++, i[e]);
|
|
387
|
+
return this._updateLastWrittenByte(), this;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Write `value` as a 16-bit signed integer and move pointer forward by 2
|
|
391
|
+
* bytes.
|
|
392
|
+
* @param value - The value to write.
|
|
393
|
+
* @returns This.
|
|
394
|
+
*/
|
|
395
|
+
writeInt16(i) {
|
|
396
|
+
return this.ensureAvailable(2), this._data.setInt16(this.offset, i, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Write `value` as a 16-bit unsigned integer and move pointer forward by 2
|
|
400
|
+
* bytes.
|
|
401
|
+
* @param value - The value to write.
|
|
402
|
+
* @returns This.
|
|
403
|
+
*/
|
|
404
|
+
writeUint16(i) {
|
|
405
|
+
return this.ensureAvailable(2), this._data.setUint16(this.offset, i, this.littleEndian), this.offset += 2, this._updateLastWrittenByte(), this;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Write `value` as a 32-bit signed integer and move pointer forward by 4
|
|
409
|
+
* bytes.
|
|
410
|
+
* @param value - The value to write.
|
|
411
|
+
* @returns This.
|
|
412
|
+
*/
|
|
413
|
+
writeInt32(i) {
|
|
414
|
+
return this.ensureAvailable(4), this._data.setInt32(this.offset, i, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Write `value` as a 32-bit unsigned integer and move pointer forward by 4
|
|
418
|
+
* bytes.
|
|
419
|
+
* @param value - The value to write.
|
|
420
|
+
* @returns This.
|
|
421
|
+
*/
|
|
422
|
+
writeUint32(i) {
|
|
423
|
+
return this.ensureAvailable(4), this._data.setUint32(this.offset, i, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Write `value` as a 32-bit floating number and move pointer forward by 4
|
|
427
|
+
* bytes.
|
|
428
|
+
* @param value - The value to write.
|
|
429
|
+
* @returns This.
|
|
430
|
+
*/
|
|
431
|
+
writeFloat32(i) {
|
|
432
|
+
return this.ensureAvailable(4), this._data.setFloat32(this.offset, i, this.littleEndian), this.offset += 4, this._updateLastWrittenByte(), this;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Write `value` as a 64-bit floating number and move pointer forward by 8
|
|
436
|
+
* bytes.
|
|
437
|
+
* @param value - The value to write.
|
|
438
|
+
* @returns This.
|
|
439
|
+
*/
|
|
440
|
+
writeFloat64(i) {
|
|
441
|
+
return this.ensureAvailable(8), this._data.setFloat64(this.offset, i, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Write `value` as a 64-bit signed bigint and move pointer forward by 8
|
|
445
|
+
* bytes.
|
|
446
|
+
* @param value - The value to write.
|
|
447
|
+
* @returns This.
|
|
448
|
+
*/
|
|
449
|
+
writeBigInt64(i) {
|
|
450
|
+
return this.ensureAvailable(8), this._data.setBigInt64(this.offset, i, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Write `value` as a 64-bit unsigned bigint and move pointer forward by 8
|
|
454
|
+
* bytes.
|
|
455
|
+
* @param value - The value to write.
|
|
456
|
+
* @returns This.
|
|
457
|
+
*/
|
|
458
|
+
writeBigUint64(i) {
|
|
459
|
+
return this.ensureAvailable(8), this._data.setBigUint64(this.offset, i, this.littleEndian), this.offset += 8, this._updateLastWrittenByte(), this;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Write the charCode of `str`'s first character as an 8-bit unsigned integer
|
|
463
|
+
* and move pointer forward by 1 byte.
|
|
464
|
+
* @param str - The character to write.
|
|
465
|
+
* @returns This.
|
|
466
|
+
*/
|
|
467
|
+
writeChar(i) {
|
|
468
|
+
return this.writeUint8(i.charCodeAt(0));
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Write the charCodes of all `str`'s characters as 8-bit unsigned integers
|
|
472
|
+
* and move pointer forward by `str.length` bytes.
|
|
473
|
+
* @param str - The characters to write.
|
|
474
|
+
* @returns This.
|
|
475
|
+
*/
|
|
476
|
+
writeChars(i) {
|
|
477
|
+
for (let e = 0; e < i.length; e++)
|
|
478
|
+
this.writeUint8(i.charCodeAt(e));
|
|
479
|
+
return this;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* UTF-8 encode and write `str` to the current pointer offset and move pointer
|
|
483
|
+
* forward according to the encoded length.
|
|
484
|
+
* @param str - The string to write.
|
|
485
|
+
* @returns This.
|
|
486
|
+
*/
|
|
487
|
+
writeUtf8(i) {
|
|
488
|
+
return this.writeBytes(Re(i));
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Export a Uint8Array view of the internal buffer.
|
|
492
|
+
* The view starts at the byte offset and its length
|
|
493
|
+
* is calculated to stop at the last written byte or the original length.
|
|
494
|
+
* @returns A new Uint8Array view.
|
|
495
|
+
*/
|
|
496
|
+
toArray() {
|
|
497
|
+
return new Uint8Array(this.buffer, this.byteOffset, this.lastWrittenByte);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Get the total number of bytes written so far, regardless of the current offset.
|
|
501
|
+
* @returns - Total number of bytes.
|
|
502
|
+
*/
|
|
503
|
+
getWrittenByteLength() {
|
|
504
|
+
return this.lastWrittenByte - this.byteOffset;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Update the last written byte offset
|
|
508
|
+
* @private
|
|
509
|
+
*/
|
|
510
|
+
_updateLastWrittenByte() {
|
|
511
|
+
this.offset > this.lastWrittenByte && (this.lastWrittenByte = this.offset);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const Ne = 4, Wt = 0, Pt = 1, Ce = 2;
|
|
515
|
+
function Y(t) {
|
|
516
|
+
let i = t.length;
|
|
517
|
+
for (; --i >= 0; )
|
|
518
|
+
t[i] = 0;
|
|
519
|
+
}
|
|
520
|
+
const Ze = 0, ie = 1, Fe = 2, Me = 3, $e = 258, Ot = 29, lt = 256, et = lt + 1 + Ot, W = 30, Bt = 19, ne = 2 * et + 1, B = 15, yt = 16, He = 7, Nt = 256, ae = 16, re = 17, le = 18, Tt = (
|
|
521
|
+
/* extra bits for each length code */
|
|
522
|
+
new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0])
|
|
523
|
+
), _t = (
|
|
524
|
+
/* extra bits for each distance code */
|
|
525
|
+
new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13])
|
|
526
|
+
), We = (
|
|
527
|
+
/* extra bits for each bit length code */
|
|
528
|
+
new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
|
|
529
|
+
), oe = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Pe = 512, S = new Array((et + 2) * 2);
|
|
530
|
+
Y(S);
|
|
531
|
+
const Q = new Array(W * 2);
|
|
532
|
+
Y(Q);
|
|
533
|
+
const it = new Array(Pe);
|
|
534
|
+
Y(it);
|
|
535
|
+
const nt = new Array($e - Me + 1);
|
|
536
|
+
Y(nt);
|
|
537
|
+
const Ct = new Array(Ot);
|
|
538
|
+
Y(Ct);
|
|
539
|
+
const ft = new Array(W);
|
|
540
|
+
Y(ft);
|
|
541
|
+
function xt(t, i, e, n, a) {
|
|
542
|
+
this.static_tree = t, this.extra_bits = i, this.extra_base = e, this.elems = n, this.max_length = a, this.has_stree = t && t.length;
|
|
543
|
+
}
|
|
544
|
+
let he, _e, se;
|
|
545
|
+
function Et(t, i) {
|
|
546
|
+
this.dyn_tree = t, this.max_code = 0, this.stat_desc = i;
|
|
547
|
+
}
|
|
548
|
+
const fe = (t) => t < 256 ? it[t] : it[256 + (t >>> 7)], at = (t, i) => {
|
|
549
|
+
t.pending_buf[t.pending++] = i & 255, t.pending_buf[t.pending++] = i >>> 8 & 255;
|
|
550
|
+
}, w = (t, i, e) => {
|
|
551
|
+
t.bi_valid > yt - e ? (t.bi_buf |= i << t.bi_valid & 65535, at(t, t.bi_buf), t.bi_buf = i >> yt - t.bi_valid, t.bi_valid += e - yt) : (t.bi_buf |= i << t.bi_valid & 65535, t.bi_valid += e);
|
|
552
|
+
}, A = (t, i, e) => {
|
|
553
|
+
w(
|
|
554
|
+
t,
|
|
555
|
+
e[i * 2],
|
|
556
|
+
e[i * 2 + 1]
|
|
557
|
+
/*.Len*/
|
|
558
|
+
);
|
|
559
|
+
}, de = (t, i) => {
|
|
560
|
+
let e = 0;
|
|
561
|
+
do
|
|
562
|
+
e |= t & 1, t >>>= 1, e <<= 1;
|
|
563
|
+
while (--i > 0);
|
|
564
|
+
return e >>> 1;
|
|
565
|
+
}, Ke = (t) => {
|
|
566
|
+
t.bi_valid === 16 ? (at(t, t.bi_buf), t.bi_buf = 0, t.bi_valid = 0) : t.bi_valid >= 8 && (t.pending_buf[t.pending++] = t.bi_buf & 255, t.bi_buf >>= 8, t.bi_valid -= 8);
|
|
567
|
+
}, Ye = (t, i) => {
|
|
568
|
+
const e = i.dyn_tree, n = i.max_code, a = i.stat_desc.static_tree, r = i.stat_desc.has_stree, l = i.stat_desc.extra_bits, h = i.stat_desc.extra_base, o = i.stat_desc.max_length;
|
|
569
|
+
let _, u, c, d, E, k, z = 0;
|
|
570
|
+
for (d = 0; d <= B; d++)
|
|
571
|
+
t.bl_count[d] = 0;
|
|
572
|
+
for (e[t.heap[t.heap_max] * 2 + 1] = 0, _ = t.heap_max + 1; _ < ne; _++)
|
|
573
|
+
u = t.heap[_], d = e[e[u * 2 + 1] * 2 + 1] + 1, d > o && (d = o, z++), e[u * 2 + 1] = d, !(u > n) && (t.bl_count[d]++, E = 0, u >= h && (E = l[u - h]), k = e[u * 2], t.opt_len += k * (d + E), r && (t.static_len += k * (a[u * 2 + 1] + E)));
|
|
574
|
+
if (z !== 0) {
|
|
575
|
+
do {
|
|
576
|
+
for (d = o - 1; t.bl_count[d] === 0; )
|
|
577
|
+
d--;
|
|
578
|
+
t.bl_count[d]--, t.bl_count[d + 1] += 2, t.bl_count[o]--, z -= 2;
|
|
579
|
+
} while (z > 0);
|
|
580
|
+
for (d = o; d !== 0; d--)
|
|
581
|
+
for (u = t.bl_count[d]; u !== 0; )
|
|
582
|
+
c = t.heap[--_], !(c > n) && (e[c * 2 + 1] !== d && (t.opt_len += (d - e[c * 2 + 1]) * e[c * 2], e[c * 2 + 1] = d), u--);
|
|
583
|
+
}
|
|
584
|
+
}, ce = (t, i, e) => {
|
|
585
|
+
const n = new Array(B + 1);
|
|
586
|
+
let a = 0, r, l;
|
|
587
|
+
for (r = 1; r <= B; r++)
|
|
588
|
+
a = a + e[r - 1] << 1, n[r] = a;
|
|
589
|
+
for (l = 0; l <= i; l++) {
|
|
590
|
+
let h = t[l * 2 + 1];
|
|
591
|
+
h !== 0 && (t[l * 2] = de(n[h]++, h));
|
|
592
|
+
}
|
|
593
|
+
}, Xe = () => {
|
|
594
|
+
let t, i, e, n, a;
|
|
595
|
+
const r = new Array(B + 1);
|
|
596
|
+
for (e = 0, n = 0; n < Ot - 1; n++)
|
|
597
|
+
for (Ct[n] = e, t = 0; t < 1 << Tt[n]; t++)
|
|
598
|
+
nt[e++] = n;
|
|
599
|
+
for (nt[e - 1] = n, a = 0, n = 0; n < 16; n++)
|
|
600
|
+
for (ft[n] = a, t = 0; t < 1 << _t[n]; t++)
|
|
601
|
+
it[a++] = n;
|
|
602
|
+
for (a >>= 7; n < W; n++)
|
|
603
|
+
for (ft[n] = a << 7, t = 0; t < 1 << _t[n] - 7; t++)
|
|
604
|
+
it[256 + a++] = n;
|
|
605
|
+
for (i = 0; i <= B; i++)
|
|
606
|
+
r[i] = 0;
|
|
607
|
+
for (t = 0; t <= 143; )
|
|
608
|
+
S[t * 2 + 1] = 8, t++, r[8]++;
|
|
609
|
+
for (; t <= 255; )
|
|
610
|
+
S[t * 2 + 1] = 9, t++, r[9]++;
|
|
611
|
+
for (; t <= 279; )
|
|
612
|
+
S[t * 2 + 1] = 7, t++, r[7]++;
|
|
613
|
+
for (; t <= 287; )
|
|
614
|
+
S[t * 2 + 1] = 8, t++, r[8]++;
|
|
615
|
+
for (ce(S, et + 1, r), t = 0; t < W; t++)
|
|
616
|
+
Q[t * 2 + 1] = 5, Q[t * 2] = de(t, 5);
|
|
617
|
+
he = new xt(S, Tt, lt + 1, et, B), _e = new xt(Q, _t, 0, W, B), se = new xt(new Array(0), We, 0, Bt, He);
|
|
618
|
+
}, ue = (t) => {
|
|
619
|
+
let i;
|
|
620
|
+
for (i = 0; i < et; i++)
|
|
621
|
+
t.dyn_ltree[i * 2] = 0;
|
|
622
|
+
for (i = 0; i < W; i++)
|
|
623
|
+
t.dyn_dtree[i * 2] = 0;
|
|
624
|
+
for (i = 0; i < Bt; i++)
|
|
625
|
+
t.bl_tree[i * 2] = 0;
|
|
626
|
+
t.dyn_ltree[Nt * 2] = 1, t.opt_len = t.static_len = 0, t.sym_next = t.matches = 0;
|
|
627
|
+
}, ge = (t) => {
|
|
628
|
+
t.bi_valid > 8 ? at(t, t.bi_buf) : t.bi_valid > 0 && (t.pending_buf[t.pending++] = t.bi_buf), t.bi_buf = 0, t.bi_valid = 0;
|
|
629
|
+
}, Kt = (t, i, e, n) => {
|
|
630
|
+
const a = i * 2, r = e * 2;
|
|
631
|
+
return t[a] < t[r] || t[a] === t[r] && n[i] <= n[e];
|
|
632
|
+
}, vt = (t, i, e) => {
|
|
633
|
+
const n = t.heap[e];
|
|
634
|
+
let a = e << 1;
|
|
635
|
+
for (; a <= t.heap_len && (a < t.heap_len && Kt(i, t.heap[a + 1], t.heap[a], t.depth) && a++, !Kt(i, n, t.heap[a], t.depth)); )
|
|
636
|
+
t.heap[e] = t.heap[a], e = a, a <<= 1;
|
|
637
|
+
t.heap[e] = n;
|
|
638
|
+
}, Yt = (t, i, e) => {
|
|
639
|
+
let n, a, r = 0, l, h;
|
|
640
|
+
if (t.sym_next !== 0)
|
|
641
|
+
do
|
|
642
|
+
n = t.pending_buf[t.sym_buf + r++] & 255, n += (t.pending_buf[t.sym_buf + r++] & 255) << 8, a = t.pending_buf[t.sym_buf + r++], n === 0 ? A(t, a, i) : (l = nt[a], A(t, l + lt + 1, i), h = Tt[l], h !== 0 && (a -= Ct[l], w(t, a, h)), n--, l = fe(n), A(t, l, e), h = _t[l], h !== 0 && (n -= ft[l], w(t, n, h)));
|
|
643
|
+
while (r < t.sym_next);
|
|
644
|
+
A(t, Nt, i);
|
|
645
|
+
}, kt = (t, i) => {
|
|
646
|
+
const e = i.dyn_tree, n = i.stat_desc.static_tree, a = i.stat_desc.has_stree, r = i.stat_desc.elems;
|
|
647
|
+
let l, h, o = -1, _;
|
|
648
|
+
for (t.heap_len = 0, t.heap_max = ne, l = 0; l < r; l++)
|
|
649
|
+
e[l * 2] !== 0 ? (t.heap[++t.heap_len] = o = l, t.depth[l] = 0) : e[l * 2 + 1] = 0;
|
|
650
|
+
for (; t.heap_len < 2; )
|
|
651
|
+
_ = t.heap[++t.heap_len] = o < 2 ? ++o : 0, e[_ * 2] = 1, t.depth[_] = 0, t.opt_len--, a && (t.static_len -= n[_ * 2 + 1]);
|
|
652
|
+
for (i.max_code = o, l = t.heap_len >> 1; l >= 1; l--)
|
|
653
|
+
vt(t, e, l);
|
|
654
|
+
_ = r;
|
|
655
|
+
do
|
|
656
|
+
l = t.heap[
|
|
657
|
+
1
|
|
658
|
+
/*SMALLEST*/
|
|
659
|
+
], t.heap[
|
|
660
|
+
1
|
|
661
|
+
/*SMALLEST*/
|
|
662
|
+
] = t.heap[t.heap_len--], vt(
|
|
663
|
+
t,
|
|
664
|
+
e,
|
|
665
|
+
1
|
|
666
|
+
/*SMALLEST*/
|
|
667
|
+
), h = t.heap[
|
|
668
|
+
1
|
|
669
|
+
/*SMALLEST*/
|
|
670
|
+
], t.heap[--t.heap_max] = l, t.heap[--t.heap_max] = h, e[_ * 2] = e[l * 2] + e[h * 2], t.depth[_] = (t.depth[l] >= t.depth[h] ? t.depth[l] : t.depth[h]) + 1, e[l * 2 + 1] = e[h * 2 + 1] = _, t.heap[
|
|
671
|
+
1
|
|
672
|
+
/*SMALLEST*/
|
|
673
|
+
] = _++, vt(
|
|
674
|
+
t,
|
|
675
|
+
e,
|
|
676
|
+
1
|
|
677
|
+
/*SMALLEST*/
|
|
678
|
+
);
|
|
679
|
+
while (t.heap_len >= 2);
|
|
680
|
+
t.heap[--t.heap_max] = t.heap[
|
|
681
|
+
1
|
|
682
|
+
/*SMALLEST*/
|
|
683
|
+
], Ye(t, i), ce(e, o, t.bl_count);
|
|
684
|
+
}, Xt = (t, i, e) => {
|
|
685
|
+
let n, a = -1, r, l = i[1], h = 0, o = 7, _ = 4;
|
|
686
|
+
for (l === 0 && (o = 138, _ = 3), i[(e + 1) * 2 + 1] = 65535, n = 0; n <= e; n++)
|
|
687
|
+
r = l, l = i[(n + 1) * 2 + 1], !(++h < o && r === l) && (h < _ ? t.bl_tree[r * 2] += h : r !== 0 ? (r !== a && t.bl_tree[r * 2]++, t.bl_tree[ae * 2]++) : h <= 10 ? t.bl_tree[re * 2]++ : t.bl_tree[le * 2]++, h = 0, a = r, l === 0 ? (o = 138, _ = 3) : r === l ? (o = 6, _ = 3) : (o = 7, _ = 4));
|
|
688
|
+
}, Gt = (t, i, e) => {
|
|
689
|
+
let n, a = -1, r, l = i[1], h = 0, o = 7, _ = 4;
|
|
690
|
+
for (l === 0 && (o = 138, _ = 3), n = 0; n <= e; n++)
|
|
691
|
+
if (r = l, l = i[(n + 1) * 2 + 1], !(++h < o && r === l)) {
|
|
692
|
+
if (h < _)
|
|
693
|
+
do
|
|
694
|
+
A(t, r, t.bl_tree);
|
|
695
|
+
while (--h !== 0);
|
|
696
|
+
else r !== 0 ? (r !== a && (A(t, r, t.bl_tree), h--), A(t, ae, t.bl_tree), w(t, h - 3, 2)) : h <= 10 ? (A(t, re, t.bl_tree), w(t, h - 3, 3)) : (A(t, le, t.bl_tree), w(t, h - 11, 7));
|
|
697
|
+
h = 0, a = r, l === 0 ? (o = 138, _ = 3) : r === l ? (o = 6, _ = 3) : (o = 7, _ = 4);
|
|
698
|
+
}
|
|
699
|
+
}, Ge = (t) => {
|
|
700
|
+
let i;
|
|
701
|
+
for (Xt(t, t.dyn_ltree, t.l_desc.max_code), Xt(t, t.dyn_dtree, t.d_desc.max_code), kt(t, t.bl_desc), i = Bt - 1; i >= 3 && t.bl_tree[oe[i] * 2 + 1] === 0; i--)
|
|
702
|
+
;
|
|
703
|
+
return t.opt_len += 3 * (i + 1) + 5 + 5 + 4, i;
|
|
704
|
+
}, je = (t, i, e, n) => {
|
|
705
|
+
let a;
|
|
706
|
+
for (w(t, i - 257, 5), w(t, e - 1, 5), w(t, n - 4, 4), a = 0; a < n; a++)
|
|
707
|
+
w(t, t.bl_tree[oe[a] * 2 + 1], 3);
|
|
708
|
+
Gt(t, t.dyn_ltree, i - 1), Gt(t, t.dyn_dtree, e - 1);
|
|
709
|
+
}, Ve = (t) => {
|
|
710
|
+
let i = 4093624447, e;
|
|
711
|
+
for (e = 0; e <= 31; e++, i >>>= 1)
|
|
712
|
+
if (i & 1 && t.dyn_ltree[e * 2] !== 0)
|
|
713
|
+
return Wt;
|
|
714
|
+
if (t.dyn_ltree[18] !== 0 || t.dyn_ltree[20] !== 0 || t.dyn_ltree[26] !== 0)
|
|
715
|
+
return Pt;
|
|
716
|
+
for (e = 32; e < lt; e++)
|
|
717
|
+
if (t.dyn_ltree[e * 2] !== 0)
|
|
718
|
+
return Pt;
|
|
719
|
+
return Wt;
|
|
720
|
+
};
|
|
721
|
+
let jt = !1;
|
|
722
|
+
const qe = (t) => {
|
|
723
|
+
jt || (Xe(), jt = !0), t.l_desc = new Et(t.dyn_ltree, he), t.d_desc = new Et(t.dyn_dtree, _e), t.bl_desc = new Et(t.bl_tree, se), t.bi_buf = 0, t.bi_valid = 0, ue(t);
|
|
724
|
+
}, pe = (t, i, e, n) => {
|
|
725
|
+
w(t, (Ze << 1) + (n ? 1 : 0), 3), ge(t), at(t, e), at(t, ~e), e && t.pending_buf.set(t.window.subarray(i, i + e), t.pending), t.pending += e;
|
|
726
|
+
}, Je = (t) => {
|
|
727
|
+
w(t, ie << 1, 3), A(t, Nt, S), Ke(t);
|
|
728
|
+
}, Qe = (t, i, e, n) => {
|
|
729
|
+
let a, r, l = 0;
|
|
730
|
+
t.level > 0 ? (t.strm.data_type === Ce && (t.strm.data_type = Ve(t)), kt(t, t.l_desc), kt(t, t.d_desc), l = Ge(t), a = t.opt_len + 3 + 7 >>> 3, r = t.static_len + 3 + 7 >>> 3, r <= a && (a = r)) : a = r = e + 5, e + 4 <= a && i !== -1 ? pe(t, i, e, n) : t.strategy === Ne || r === a ? (w(t, (ie << 1) + (n ? 1 : 0), 3), Yt(t, S, Q)) : (w(t, (Fe << 1) + (n ? 1 : 0), 3), je(t, t.l_desc.max_code + 1, t.d_desc.max_code + 1, l + 1), Yt(t, t.dyn_ltree, t.dyn_dtree)), ue(t), n && ge(t);
|
|
731
|
+
}, ti = (t, i, e) => (t.pending_buf[t.sym_buf + t.sym_next++] = i, t.pending_buf[t.sym_buf + t.sym_next++] = i >> 8, t.pending_buf[t.sym_buf + t.sym_next++] = e, i === 0 ? t.dyn_ltree[e * 2]++ : (t.matches++, i--, t.dyn_ltree[(nt[e] + lt + 1) * 2]++, t.dyn_dtree[fe(i) * 2]++), t.sym_next === t.sym_end);
|
|
732
|
+
var ei = qe, ii = pe, ni = Qe, ai = ti, ri = Je, li = {
|
|
733
|
+
_tr_init: ei,
|
|
734
|
+
_tr_stored_block: ii,
|
|
735
|
+
_tr_flush_block: ni,
|
|
736
|
+
_tr_tally: ai,
|
|
737
|
+
_tr_align: ri
|
|
738
|
+
};
|
|
739
|
+
const oi = (t, i, e, n) => {
|
|
740
|
+
let a = t & 65535 | 0, r = t >>> 16 & 65535 | 0, l = 0;
|
|
741
|
+
for (; e !== 0; ) {
|
|
742
|
+
l = e > 2e3 ? 2e3 : e, e -= l;
|
|
743
|
+
do
|
|
744
|
+
a = a + i[n++] | 0, r = r + a | 0;
|
|
745
|
+
while (--l);
|
|
746
|
+
a %= 65521, r %= 65521;
|
|
747
|
+
}
|
|
748
|
+
return a | r << 16 | 0;
|
|
749
|
+
};
|
|
750
|
+
var we = oi;
|
|
751
|
+
const hi = () => {
|
|
752
|
+
let t, i = [];
|
|
753
|
+
for (var e = 0; e < 256; e++) {
|
|
754
|
+
t = e;
|
|
755
|
+
for (var n = 0; n < 8; n++)
|
|
756
|
+
t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
757
|
+
i[e] = t;
|
|
758
|
+
}
|
|
759
|
+
return i;
|
|
760
|
+
}, _i = new Uint32Array(hi()), si = (t, i, e, n) => {
|
|
761
|
+
const a = _i, r = n + e;
|
|
762
|
+
t ^= -1;
|
|
763
|
+
for (let l = n; l < r; l++)
|
|
764
|
+
t = t >>> 8 ^ a[(t ^ i[l]) & 255];
|
|
765
|
+
return t ^ -1;
|
|
766
|
+
};
|
|
767
|
+
var U = si, dt = {
|
|
768
|
+
2: "need dictionary",
|
|
769
|
+
/* Z_NEED_DICT 2 */
|
|
770
|
+
1: "stream end",
|
|
771
|
+
/* Z_STREAM_END 1 */
|
|
772
|
+
0: "",
|
|
773
|
+
/* Z_OK 0 */
|
|
774
|
+
"-1": "file error",
|
|
775
|
+
/* Z_ERRNO (-1) */
|
|
776
|
+
"-2": "stream error",
|
|
777
|
+
/* Z_STREAM_ERROR (-2) */
|
|
778
|
+
"-3": "data error",
|
|
779
|
+
/* Z_DATA_ERROR (-3) */
|
|
780
|
+
"-4": "insufficient memory",
|
|
781
|
+
/* Z_MEM_ERROR (-4) */
|
|
782
|
+
"-5": "buffer error",
|
|
783
|
+
/* Z_BUF_ERROR (-5) */
|
|
784
|
+
"-6": "incompatible version"
|
|
785
|
+
/* Z_VERSION_ERROR (-6) */
|
|
786
|
+
}, be = {
|
|
787
|
+
/* Allowed flush values; see deflate() and inflate() below for details */
|
|
788
|
+
Z_NO_FLUSH: 0,
|
|
789
|
+
Z_PARTIAL_FLUSH: 1,
|
|
790
|
+
Z_SYNC_FLUSH: 2,
|
|
791
|
+
Z_FULL_FLUSH: 3,
|
|
792
|
+
Z_FINISH: 4,
|
|
793
|
+
Z_BLOCK: 5,
|
|
794
|
+
/* Return codes for the compression/decompression functions. Negative values
|
|
795
|
+
* are errors, positive values are used for special but normal events.
|
|
796
|
+
*/
|
|
797
|
+
Z_OK: 0,
|
|
798
|
+
Z_STREAM_END: 1,
|
|
799
|
+
Z_STREAM_ERROR: -2,
|
|
800
|
+
Z_DATA_ERROR: -3,
|
|
801
|
+
Z_BUF_ERROR: -5,
|
|
802
|
+
Z_DEFAULT_COMPRESSION: -1,
|
|
803
|
+
Z_FILTERED: 1,
|
|
804
|
+
Z_HUFFMAN_ONLY: 2,
|
|
805
|
+
Z_RLE: 3,
|
|
806
|
+
Z_FIXED: 4,
|
|
807
|
+
Z_DEFAULT_STRATEGY: 0,
|
|
808
|
+
//Z_ASCII: 1, // = Z_TEXT (deprecated)
|
|
809
|
+
Z_UNKNOWN: 2,
|
|
810
|
+
/* The deflate compression method */
|
|
811
|
+
Z_DEFLATED: 8
|
|
812
|
+
//Z_NULL: null // Use -1 or null inline, depending on var type
|
|
813
|
+
};
|
|
814
|
+
const { _tr_init: fi, _tr_stored_block: St, _tr_flush_block: di, _tr_tally: I, _tr_align: ci } = li, {
|
|
815
|
+
Z_NO_FLUSH: R,
|
|
816
|
+
Z_PARTIAL_FLUSH: ui,
|
|
817
|
+
Z_FULL_FLUSH: gi,
|
|
818
|
+
Z_FINISH: x,
|
|
819
|
+
Z_BLOCK: Vt,
|
|
820
|
+
Z_OK: g,
|
|
821
|
+
Z_STREAM_END: qt,
|
|
822
|
+
Z_STREAM_ERROR: m,
|
|
823
|
+
Z_DATA_ERROR: pi,
|
|
824
|
+
Z_BUF_ERROR: At,
|
|
825
|
+
Z_DEFAULT_COMPRESSION: wi,
|
|
826
|
+
Z_FILTERED: bi,
|
|
827
|
+
Z_HUFFMAN_ONLY: ht,
|
|
828
|
+
Z_RLE: yi,
|
|
829
|
+
Z_FIXED: xi,
|
|
830
|
+
Z_DEFAULT_STRATEGY: Ei,
|
|
831
|
+
Z_UNKNOWN: vi,
|
|
832
|
+
Z_DEFLATED: ut
|
|
833
|
+
} = be, Ai = 9, mi = 15, Ti = 8, ki = 29, Si = 256, zt = Si + 1 + ki, zi = 30, Ui = 19, Li = 2 * zt + 1, Di = 15, s = 3, D = 258, T = D + s + 1, Ii = 32, P = 42, Zt = 57, Ut = 69, Lt = 73, Dt = 91, It = 103, N = 113, q = 666, p = 1, X = 2, Z = 3, G = 4, Ri = 3, C = (t, i) => (t.msg = dt[i], i), Jt = (t) => t * 2 - (t > 4 ? 9 : 0), L = (t) => {
|
|
834
|
+
let i = t.length;
|
|
835
|
+
for (; --i >= 0; )
|
|
836
|
+
t[i] = 0;
|
|
837
|
+
}, Oi = (t) => {
|
|
838
|
+
let i, e, n, a = t.w_size;
|
|
839
|
+
i = t.hash_size, n = i;
|
|
840
|
+
do
|
|
841
|
+
e = t.head[--n], t.head[n] = e >= a ? e - a : 0;
|
|
842
|
+
while (--i);
|
|
843
|
+
i = a, n = i;
|
|
844
|
+
do
|
|
845
|
+
e = t.prev[--n], t.prev[n] = e >= a ? e - a : 0;
|
|
846
|
+
while (--i);
|
|
847
|
+
};
|
|
848
|
+
let Ft = (t, i, e) => (i << t.hash_shift ^ e) & t.hash_mask;
|
|
849
|
+
const F = (t, i) => {
|
|
850
|
+
let e;
|
|
851
|
+
if (t.legacy_hash)
|
|
852
|
+
e = t.ins_h = Ft(t, t.ins_h, t.window[i + s - 1]);
|
|
853
|
+
else {
|
|
854
|
+
const a = t.window, r = a[i] | a[i + 1] << 8 | a[i + 2] << 16 | a[i + 3] << 24;
|
|
855
|
+
e = t.ins_h = Math.imul(r, 66521) + 66521 >>> 16 & t.hash_mask;
|
|
856
|
+
}
|
|
857
|
+
const n = t.prev[i & t.w_mask] = t.head[e];
|
|
858
|
+
return t.head[e] = i, n;
|
|
859
|
+
}, b = (t) => {
|
|
860
|
+
const i = t.state;
|
|
861
|
+
let e = i.pending;
|
|
862
|
+
e > t.avail_out && (e = t.avail_out), e !== 0 && (t.output.set(i.pending_buf.subarray(i.pending_out, i.pending_out + e), t.next_out), t.next_out += e, i.pending_out += e, t.total_out += e, t.avail_out -= e, i.pending -= e, i.pending === 0 && (i.pending_out = 0));
|
|
863
|
+
}, y = (t, i) => {
|
|
864
|
+
di(t, t.block_start >= 0 ? t.block_start : -1, t.strstart - t.block_start, i), t.block_start = t.strstart, b(t.strm);
|
|
865
|
+
}, f = (t, i) => {
|
|
866
|
+
t.pending_buf[t.pending++] = i;
|
|
867
|
+
}, j = (t, i) => {
|
|
868
|
+
t.pending_buf[t.pending++] = i >>> 8 & 255, t.pending_buf[t.pending++] = i & 255;
|
|
869
|
+
}, Rt = (t, i, e, n) => {
|
|
870
|
+
let a = t.avail_in;
|
|
871
|
+
return a > n && (a = n), a === 0 ? 0 : (t.avail_in -= a, i.set(t.input.subarray(t.next_in, t.next_in + a), e), t.state.wrap === 1 ? t.adler = we(t.adler, i, a, e) : t.state.wrap === 2 && (t.adler = U(t.adler, i, a, e)), t.next_in += a, t.total_in += a, a);
|
|
872
|
+
}, ye = (t, i) => {
|
|
873
|
+
let e = t.max_chain_length, n = t.strstart, a, r, l = t.prev_length, h = t.nice_match;
|
|
874
|
+
const o = t.strstart > t.w_size - T ? t.strstart - (t.w_size - T) : 0, _ = t.window, u = t.w_mask, c = t.prev, d = t.strstart + D;
|
|
875
|
+
let E = _[n + l - 1], k = _[n + l];
|
|
876
|
+
t.prev_length >= t.good_match && (e >>= 2), h > t.lookahead && (h = t.lookahead);
|
|
877
|
+
do
|
|
878
|
+
if (a = i, !(_[a + l] !== k || _[a + l - 1] !== E || _[a] !== _[n] || _[++a] !== _[n + 1])) {
|
|
879
|
+
n += 2, a++;
|
|
880
|
+
do
|
|
881
|
+
;
|
|
882
|
+
while (_[++n] === _[++a] && _[++n] === _[++a] && _[++n] === _[++a] && _[++n] === _[++a] && _[++n] === _[++a] && _[++n] === _[++a] && _[++n] === _[++a] && _[++n] === _[++a] && n < d);
|
|
883
|
+
if (r = D - (d - n), n = d - D, r > l) {
|
|
884
|
+
if (t.match_start = i, l = r, r >= h)
|
|
885
|
+
break;
|
|
886
|
+
E = _[n + l - 1], k = _[n + l];
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
while ((i = c[i & u]) > o && --e !== 0);
|
|
890
|
+
return l <= t.lookahead ? l : t.lookahead;
|
|
891
|
+
}, K = (t) => {
|
|
892
|
+
const i = t.w_size;
|
|
893
|
+
let e, n, a;
|
|
894
|
+
do {
|
|
895
|
+
if (n = t.window_size - t.lookahead - t.strstart, t.strstart >= i + (i - T) && (t.window.set(t.window.subarray(i, i + i - n), 0), t.match_start -= i, t.strstart -= i, t.block_start -= i, t.insert > t.strstart && (t.insert = t.strstart), Oi(t), n += i), t.strm.avail_in === 0)
|
|
896
|
+
break;
|
|
897
|
+
if (e = Rt(t.strm, t.window, t.strstart + t.lookahead, n), t.lookahead += e, t.legacy_hash) {
|
|
898
|
+
if (t.lookahead + t.insert >= s)
|
|
899
|
+
for (a = t.strstart - t.insert, t.ins_h = t.window[a], t.ins_h = Ft(t, t.ins_h, t.window[a + 1]); t.insert && (F(t, a), a++, t.insert--, !(t.lookahead + t.insert < s)); )
|
|
900
|
+
;
|
|
901
|
+
} else if (t.lookahead + t.insert > s)
|
|
902
|
+
for (a = t.strstart - t.insert; t.insert && (F(t, a), a++, t.insert--, !(t.lookahead + t.insert <= s)); )
|
|
903
|
+
;
|
|
904
|
+
} while (t.lookahead < T && t.strm.avail_in !== 0);
|
|
905
|
+
}, xe = (t, i) => {
|
|
906
|
+
let e = t.pending_buf_size - 5 > t.w_size ? t.w_size : t.pending_buf_size - 5, n, a, r, l = 0, h = t.strm.avail_in;
|
|
907
|
+
do {
|
|
908
|
+
if (n = 65535, r = t.bi_valid + 42 >> 3, t.strm.avail_out < r || (r = t.strm.avail_out - r, a = t.strstart - t.block_start, n > a + t.strm.avail_in && (n = a + t.strm.avail_in), n > r && (n = r), n < e && (n === 0 && i !== x || i === R || n !== a + t.strm.avail_in)))
|
|
909
|
+
break;
|
|
910
|
+
l = i === x && n === a + t.strm.avail_in ? 1 : 0, St(t, 0, 0, l), t.pending_buf[t.pending - 4] = n, t.pending_buf[t.pending - 3] = n >> 8, t.pending_buf[t.pending - 2] = ~n, t.pending_buf[t.pending - 1] = ~n >> 8, b(t.strm), a && (a > n && (a = n), t.strm.output.set(t.window.subarray(t.block_start, t.block_start + a), t.strm.next_out), t.strm.next_out += a, t.strm.avail_out -= a, t.strm.total_out += a, t.block_start += a, n -= a), n && (Rt(t.strm, t.strm.output, t.strm.next_out, n), t.strm.next_out += n, t.strm.avail_out -= n, t.strm.total_out += n);
|
|
911
|
+
} while (l === 0);
|
|
912
|
+
return h -= t.strm.avail_in, h && (h >= t.w_size ? (t.matches = 2, t.window.set(t.strm.input.subarray(t.strm.next_in - t.w_size, t.strm.next_in), 0), t.strstart = t.w_size, t.insert = t.strstart) : (t.window_size - t.strstart <= h && (t.strstart -= t.w_size, t.window.set(t.window.subarray(t.w_size, t.w_size + t.strstart), 0), t.matches < 2 && t.matches++, t.insert > t.strstart && (t.insert = t.strstart)), t.window.set(t.strm.input.subarray(t.strm.next_in - h, t.strm.next_in), t.strstart), t.strstart += h, t.insert += h > t.w_size - t.insert ? t.w_size - t.insert : h), t.block_start = t.strstart), t.high_water < t.strstart && (t.high_water = t.strstart), l ? G : i !== R && i !== x && t.strm.avail_in === 0 && t.strstart === t.block_start ? X : (r = t.window_size - t.strstart, t.strm.avail_in > r && t.block_start >= t.w_size && (t.block_start -= t.w_size, t.strstart -= t.w_size, t.window.set(t.window.subarray(t.w_size, t.w_size + t.strstart), 0), t.matches < 2 && t.matches++, r += t.w_size, t.insert > t.strstart && (t.insert = t.strstart)), r > t.strm.avail_in && (r = t.strm.avail_in), r && (Rt(t.strm, t.window, t.strstart, r), t.strstart += r, t.insert += r > t.w_size - t.insert ? t.w_size - t.insert : r), t.high_water < t.strstart && (t.high_water = t.strstart), r = t.bi_valid + 42 >> 3, r = t.pending_buf_size - r > 65535 ? 65535 : t.pending_buf_size - r, e = r > t.w_size ? t.w_size : r, a = t.strstart - t.block_start, (a >= e || (a || i === x) && i !== R && t.strm.avail_in === 0 && a <= r) && (n = a > r ? r : a, l = i === x && t.strm.avail_in === 0 && n === a ? 1 : 0, St(t, t.block_start, n, l), t.block_start += n, b(t.strm)), l ? Z : p);
|
|
913
|
+
}, mt = (t, i) => {
|
|
914
|
+
let e, n;
|
|
915
|
+
for (; ; ) {
|
|
916
|
+
if (t.lookahead < T) {
|
|
917
|
+
if (K(t), t.lookahead < T && i === R)
|
|
918
|
+
return p;
|
|
919
|
+
if (t.lookahead === 0)
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
if (e = 0, t.lookahead >= s && (e = F(t, t.strstart)), e !== 0 && t.strstart - e <= t.w_size - T && (t.match_length = ye(t, e)), t.match_length >= s)
|
|
923
|
+
if (n = I(t, t.strstart - t.match_start, t.match_length - s), t.lookahead -= t.match_length, t.match_length <= t.max_lazy_match && t.lookahead >= s) {
|
|
924
|
+
t.match_length--;
|
|
925
|
+
do
|
|
926
|
+
t.strstart++, e = F(t, t.strstart);
|
|
927
|
+
while (--t.match_length !== 0);
|
|
928
|
+
t.strstart++;
|
|
929
|
+
} else
|
|
930
|
+
t.strstart += t.match_length, t.match_length = 0, t.legacy_hash && (t.ins_h = t.window[t.strstart], t.ins_h = Ft(t, t.ins_h, t.window[t.strstart + 1]));
|
|
931
|
+
else
|
|
932
|
+
n = I(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++;
|
|
933
|
+
if (n && (y(t, !1), t.strm.avail_out === 0))
|
|
934
|
+
return p;
|
|
935
|
+
}
|
|
936
|
+
return t.insert = t.strstart < s - 1 ? t.strstart : s - 1, i === x ? (y(t, !0), t.strm.avail_out === 0 ? Z : G) : t.sym_next && (y(t, !1), t.strm.avail_out === 0) ? p : X;
|
|
937
|
+
}, $ = (t, i) => {
|
|
938
|
+
let e, n, a;
|
|
939
|
+
for (; ; ) {
|
|
940
|
+
if (t.lookahead < T) {
|
|
941
|
+
if (K(t), t.lookahead < T && i === R)
|
|
942
|
+
return p;
|
|
943
|
+
if (t.lookahead === 0)
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
946
|
+
if (e = 0, t.lookahead >= s && (e = F(t, t.strstart)), t.prev_length = t.match_length, t.prev_match = t.match_start, t.match_length = s - 1, e !== 0 && t.prev_length < t.max_lazy_match && t.strstart - e <= t.w_size - T && (t.match_length = ye(t, e), t.match_length <= 5 && (t.strategy === bi || t.match_length === s && t.strstart - t.match_start > 4096) && (t.match_length = s - 1)), t.prev_length >= s && t.match_length <= t.prev_length) {
|
|
947
|
+
a = t.strstart + t.lookahead - s, n = I(t, t.strstart - 1 - t.prev_match, t.prev_length - s), t.lookahead -= t.prev_length - 1, t.prev_length -= 2;
|
|
948
|
+
do
|
|
949
|
+
++t.strstart <= a && (e = F(t, t.strstart));
|
|
950
|
+
while (--t.prev_length !== 0);
|
|
951
|
+
if (t.match_available = 0, t.match_length = s - 1, t.strstart++, n && (y(t, !1), t.strm.avail_out === 0))
|
|
952
|
+
return p;
|
|
953
|
+
} else if (t.match_available) {
|
|
954
|
+
if (n = I(t, 0, t.window[t.strstart - 1]), n && y(t, !1), t.strstart++, t.lookahead--, t.strm.avail_out === 0)
|
|
955
|
+
return p;
|
|
956
|
+
} else
|
|
957
|
+
t.match_available = 1, t.strstart++, t.lookahead--;
|
|
958
|
+
}
|
|
959
|
+
return t.match_available && (n = I(t, 0, t.window[t.strstart - 1]), t.match_available = 0), t.insert = t.strstart < s - 1 ? t.strstart : s - 1, i === x ? (y(t, !0), t.strm.avail_out === 0 ? Z : G) : t.sym_next && (y(t, !1), t.strm.avail_out === 0) ? p : X;
|
|
960
|
+
}, Bi = (t, i) => {
|
|
961
|
+
let e, n, a, r;
|
|
962
|
+
const l = t.window;
|
|
963
|
+
for (; ; ) {
|
|
964
|
+
if (t.lookahead <= D) {
|
|
965
|
+
if (K(t), t.lookahead <= D && i === R)
|
|
966
|
+
return p;
|
|
967
|
+
if (t.lookahead === 0)
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
if (t.match_length = 0, t.lookahead >= s && t.strstart > 0 && (a = t.strstart - 1, n = l[a], n === l[++a] && n === l[++a] && n === l[++a])) {
|
|
971
|
+
r = t.strstart + D;
|
|
972
|
+
do
|
|
973
|
+
;
|
|
974
|
+
while (n === l[++a] && n === l[++a] && n === l[++a] && n === l[++a] && n === l[++a] && n === l[++a] && n === l[++a] && n === l[++a] && a < r);
|
|
975
|
+
t.match_length = D - (r - a), t.match_length > t.lookahead && (t.match_length = t.lookahead);
|
|
976
|
+
}
|
|
977
|
+
if (t.match_length >= s ? (e = I(t, 1, t.match_length - s), t.lookahead -= t.match_length, t.strstart += t.match_length, t.match_length = 0) : (e = I(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++), e && (y(t, !1), t.strm.avail_out === 0))
|
|
978
|
+
return p;
|
|
979
|
+
}
|
|
980
|
+
return t.insert = 0, i === x ? (y(t, !0), t.strm.avail_out === 0 ? Z : G) : t.sym_next && (y(t, !1), t.strm.avail_out === 0) ? p : X;
|
|
981
|
+
}, Ni = (t, i) => {
|
|
982
|
+
let e;
|
|
983
|
+
for (; ; ) {
|
|
984
|
+
if (t.lookahead === 0 && (K(t), t.lookahead === 0)) {
|
|
985
|
+
if (i === R)
|
|
986
|
+
return p;
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
if (t.match_length = 0, e = I(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++, e && (y(t, !1), t.strm.avail_out === 0))
|
|
990
|
+
return p;
|
|
991
|
+
}
|
|
992
|
+
return t.insert = 0, i === x ? (y(t, !0), t.strm.avail_out === 0 ? Z : G) : t.sym_next && (y(t, !1), t.strm.avail_out === 0) ? p : X;
|
|
993
|
+
};
|
|
994
|
+
function v(t, i, e, n, a) {
|
|
995
|
+
this.good_length = t, this.max_lazy = i, this.nice_length = e, this.max_chain = n, this.func = a;
|
|
996
|
+
}
|
|
997
|
+
const J = [
|
|
998
|
+
/* good lazy nice chain */
|
|
999
|
+
new v(0, 0, 0, 0, xe),
|
|
1000
|
+
/* 0 store only */
|
|
1001
|
+
new v(4, 4, 8, 4, mt),
|
|
1002
|
+
/* 1 max speed, no lazy matches */
|
|
1003
|
+
new v(4, 5, 16, 8, mt),
|
|
1004
|
+
/* 2 */
|
|
1005
|
+
new v(4, 6, 32, 32, mt),
|
|
1006
|
+
/* 3 */
|
|
1007
|
+
new v(4, 4, 16, 16, $),
|
|
1008
|
+
/* 4 lazy matches */
|
|
1009
|
+
new v(8, 16, 32, 32, $),
|
|
1010
|
+
/* 5 */
|
|
1011
|
+
new v(8, 16, 128, 128, $),
|
|
1012
|
+
/* 6 */
|
|
1013
|
+
new v(8, 32, 128, 256, $),
|
|
1014
|
+
/* 7 */
|
|
1015
|
+
new v(32, 128, 258, 1024, $),
|
|
1016
|
+
/* 8 */
|
|
1017
|
+
new v(32, 258, 258, 4096, $)
|
|
1018
|
+
/* 9 max compression */
|
|
1019
|
+
], Ci = (t) => {
|
|
1020
|
+
t.window_size = 2 * t.w_size, L(t.head), t.max_lazy_match = J[t.level].max_lazy, t.good_match = J[t.level].good_length, t.nice_match = J[t.level].nice_length, t.max_chain_length = J[t.level].max_chain, t.strstart = 0, t.block_start = 0, t.lookahead = 0, t.insert = 0, t.match_length = t.prev_length = s - 1, t.match_available = 0, t.ins_h = 0;
|
|
1021
|
+
};
|
|
1022
|
+
function Zi() {
|
|
1023
|
+
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = ut, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.legacy_hash = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(Li * 2), this.dyn_dtree = new Uint16Array((2 * zi + 1) * 2), this.bl_tree = new Uint16Array((2 * Ui + 1) * 2), L(this.dyn_ltree), L(this.dyn_dtree), L(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(Di + 1), this.heap = new Uint16Array(2 * zt + 1), L(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * zt + 1), L(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
|
|
1024
|
+
}
|
|
1025
|
+
const ot = (t) => {
|
|
1026
|
+
if (!t)
|
|
1027
|
+
return 1;
|
|
1028
|
+
const i = t.state;
|
|
1029
|
+
return !i || i.strm !== t || i.status !== P && //#ifdef GZIP
|
|
1030
|
+
i.status !== Zt && //#endif
|
|
1031
|
+
i.status !== Ut && i.status !== Lt && i.status !== Dt && i.status !== It && i.status !== N && i.status !== q ? 1 : 0;
|
|
1032
|
+
}, Ee = (t) => {
|
|
1033
|
+
if (ot(t))
|
|
1034
|
+
return C(t, m);
|
|
1035
|
+
t.total_in = t.total_out = 0, t.data_type = vi;
|
|
1036
|
+
const i = t.state;
|
|
1037
|
+
return i.pending = 0, i.pending_out = 0, i.wrap < 0 && (i.wrap = -i.wrap), i.status = //#ifdef GZIP
|
|
1038
|
+
i.wrap === 2 ? Zt : (
|
|
1039
|
+
//#endif
|
|
1040
|
+
i.wrap ? P : N
|
|
1041
|
+
), t.adler = i.wrap === 2 ? 0 : 1, i.last_flush = -2, fi(i), g;
|
|
1042
|
+
}, ve = (t) => {
|
|
1043
|
+
const i = Ee(t);
|
|
1044
|
+
return i === g && Ci(t.state), i;
|
|
1045
|
+
}, Fi = (t, i) => ot(t) || t.state.wrap !== 2 ? m : (t.state.gzhead = i, g), Ae = (t, i, e, n, a, r, l) => {
|
|
1046
|
+
if (!t)
|
|
1047
|
+
return m;
|
|
1048
|
+
let h = 1;
|
|
1049
|
+
if (i === wi && (i = 6), n < 0 ? (h = 0, n = -n) : n > 15 && (h = 2, n -= 16), a < 1 || a > Ai || e !== ut || n < 8 || n > 15 || i < 0 || i > 9 || r < 0 || r > xi || n === 8 && h !== 1)
|
|
1050
|
+
return C(t, m);
|
|
1051
|
+
n === 8 && (n = 9);
|
|
1052
|
+
const o = new Zi();
|
|
1053
|
+
return t.state = o, o.strm = t, o.status = P, o.wrap = h, o.gzhead = null, o.w_bits = n, o.w_size = 1 << o.w_bits, o.w_mask = o.w_size - 1, o.legacy_hash = l ? 1 : 0, o.hash_bits = a + 7, !o.legacy_hash && o.hash_bits < 15 && (o.hash_bits = 15), o.hash_size = 1 << o.hash_bits, o.hash_mask = o.hash_size - 1, o.hash_shift = ~~((o.hash_bits + s - 1) / s), o.window = new Uint8Array(o.w_size * 2), o.head = new Uint16Array(o.hash_size), o.prev = new Uint16Array(o.w_size), o.lit_bufsize = 1 << a + 6, o.pending_buf_size = o.lit_bufsize * 4, o.pending_buf = new Uint8Array(o.pending_buf_size), o.sym_buf = o.lit_bufsize, o.sym_end = (o.lit_bufsize - 1) * 3, o.level = i, o.strategy = r, o.method = e, ve(t);
|
|
1054
|
+
}, Mi = (t, i) => Ae(t, i, ut, mi, Ti, Ei), $i = (t, i) => {
|
|
1055
|
+
if (ot(t) || i > Vt || i < 0)
|
|
1056
|
+
return t ? C(t, m) : m;
|
|
1057
|
+
const e = t.state;
|
|
1058
|
+
if (!t.output || t.avail_in !== 0 && !t.input || e.status === q && i !== x)
|
|
1059
|
+
return C(t, t.avail_out === 0 ? At : m);
|
|
1060
|
+
const n = e.last_flush;
|
|
1061
|
+
if (e.last_flush = i, e.pending !== 0) {
|
|
1062
|
+
if (b(t), t.avail_out === 0)
|
|
1063
|
+
return e.last_flush = -1, g;
|
|
1064
|
+
} else if (t.avail_in === 0 && Jt(i) <= Jt(n) && i !== x)
|
|
1065
|
+
return C(t, At);
|
|
1066
|
+
if (e.status === q && t.avail_in !== 0)
|
|
1067
|
+
return C(t, At);
|
|
1068
|
+
if (e.status === P && e.wrap === 0 && (e.status = N), e.status === P) {
|
|
1069
|
+
let a = ut + (e.w_bits - 8 << 4) << 8, r = -1;
|
|
1070
|
+
if (e.strategy >= ht || e.level < 2 ? r = 0 : e.level < 6 ? r = 1 : e.level === 6 ? r = 2 : r = 3, a |= r << 6, e.strstart !== 0 && (a |= Ii), a += 31 - a % 31, j(e, a), e.strstart !== 0 && (j(e, t.adler >>> 16), j(e, t.adler & 65535)), t.adler = 1, e.status = N, b(t), e.pending !== 0)
|
|
1071
|
+
return e.last_flush = -1, g;
|
|
1072
|
+
}
|
|
1073
|
+
if (e.status === Zt) {
|
|
1074
|
+
if (t.adler = 0, f(e, 31), f(e, 139), f(e, 8), e.gzhead)
|
|
1075
|
+
f(
|
|
1076
|
+
e,
|
|
1077
|
+
(e.gzhead.text ? 1 : 0) + (e.gzhead.hcrc ? 2 : 0) + (e.gzhead.extra ? 4 : 0) + (e.gzhead.name ? 8 : 0) + (e.gzhead.comment ? 16 : 0)
|
|
1078
|
+
), f(e, e.gzhead.time & 255), f(e, e.gzhead.time >> 8 & 255), f(e, e.gzhead.time >> 16 & 255), f(e, e.gzhead.time >> 24 & 255), f(e, e.level === 9 ? 2 : e.strategy >= ht || e.level < 2 ? 4 : 0), f(e, e.gzhead.os & 255), e.gzhead.extra && e.gzhead.extra.length && (f(e, e.gzhead.extra.length & 255), f(e, e.gzhead.extra.length >> 8 & 255)), e.gzhead.hcrc && (t.adler = U(t.adler, e.pending_buf, e.pending, 0)), e.gzindex = 0, e.status = Ut;
|
|
1079
|
+
else if (f(e, 0), f(e, 0), f(e, 0), f(e, 0), f(e, 0), f(e, e.level === 9 ? 2 : e.strategy >= ht || e.level < 2 ? 4 : 0), f(e, Ri), e.status = N, b(t), e.pending !== 0)
|
|
1080
|
+
return e.last_flush = -1, g;
|
|
1081
|
+
}
|
|
1082
|
+
if (e.status === Ut) {
|
|
1083
|
+
if (e.gzhead.extra) {
|
|
1084
|
+
let a = e.pending, r = (e.gzhead.extra.length & 65535) - e.gzindex;
|
|
1085
|
+
for (; e.pending + r > e.pending_buf_size; ) {
|
|
1086
|
+
let h = e.pending_buf_size - e.pending;
|
|
1087
|
+
if (e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex, e.gzindex + h), e.pending), e.pending = e.pending_buf_size, e.gzhead.hcrc && e.pending > a && (t.adler = U(t.adler, e.pending_buf, e.pending - a, a)), e.gzindex += h, b(t), e.pending !== 0)
|
|
1088
|
+
return e.last_flush = -1, g;
|
|
1089
|
+
a = 0, r -= h;
|
|
1090
|
+
}
|
|
1091
|
+
let l = new Uint8Array(e.gzhead.extra);
|
|
1092
|
+
e.pending_buf.set(l.subarray(e.gzindex, e.gzindex + r), e.pending), e.pending += r, e.gzhead.hcrc && e.pending > a && (t.adler = U(t.adler, e.pending_buf, e.pending - a, a)), e.gzindex = 0;
|
|
1093
|
+
}
|
|
1094
|
+
e.status = Lt;
|
|
1095
|
+
}
|
|
1096
|
+
if (e.status === Lt) {
|
|
1097
|
+
if (e.gzhead.name) {
|
|
1098
|
+
let a = e.pending, r;
|
|
1099
|
+
do {
|
|
1100
|
+
if (e.pending === e.pending_buf_size) {
|
|
1101
|
+
if (e.gzhead.hcrc && e.pending > a && (t.adler = U(t.adler, e.pending_buf, e.pending - a, a)), b(t), e.pending !== 0)
|
|
1102
|
+
return e.last_flush = -1, g;
|
|
1103
|
+
a = 0;
|
|
1104
|
+
}
|
|
1105
|
+
e.gzindex < e.gzhead.name.length ? r = e.gzhead.name.charCodeAt(e.gzindex++) & 255 : r = 0, f(e, r);
|
|
1106
|
+
} while (r !== 0);
|
|
1107
|
+
e.gzhead.hcrc && e.pending > a && (t.adler = U(t.adler, e.pending_buf, e.pending - a, a)), e.gzindex = 0;
|
|
1108
|
+
}
|
|
1109
|
+
e.status = Dt;
|
|
1110
|
+
}
|
|
1111
|
+
if (e.status === Dt) {
|
|
1112
|
+
if (e.gzhead.comment) {
|
|
1113
|
+
let a = e.pending, r;
|
|
1114
|
+
do {
|
|
1115
|
+
if (e.pending === e.pending_buf_size) {
|
|
1116
|
+
if (e.gzhead.hcrc && e.pending > a && (t.adler = U(t.adler, e.pending_buf, e.pending - a, a)), b(t), e.pending !== 0)
|
|
1117
|
+
return e.last_flush = -1, g;
|
|
1118
|
+
a = 0;
|
|
1119
|
+
}
|
|
1120
|
+
e.gzindex < e.gzhead.comment.length ? r = e.gzhead.comment.charCodeAt(e.gzindex++) & 255 : r = 0, f(e, r);
|
|
1121
|
+
} while (r !== 0);
|
|
1122
|
+
e.gzhead.hcrc && e.pending > a && (t.adler = U(t.adler, e.pending_buf, e.pending - a, a));
|
|
1123
|
+
}
|
|
1124
|
+
e.status = It;
|
|
1125
|
+
}
|
|
1126
|
+
if (e.status === It) {
|
|
1127
|
+
if (e.gzhead.hcrc) {
|
|
1128
|
+
if (e.pending + 2 > e.pending_buf_size && (b(t), e.pending !== 0))
|
|
1129
|
+
return e.last_flush = -1, g;
|
|
1130
|
+
f(e, t.adler & 255), f(e, t.adler >> 8 & 255), t.adler = 0;
|
|
1131
|
+
}
|
|
1132
|
+
if (e.status = N, b(t), e.pending !== 0)
|
|
1133
|
+
return e.last_flush = -1, g;
|
|
1134
|
+
}
|
|
1135
|
+
if (t.avail_in !== 0 || e.lookahead !== 0 || i !== R && e.status !== q) {
|
|
1136
|
+
let a = e.level === 0 ? xe(e, i) : e.strategy === ht ? Ni(e, i) : e.strategy === yi ? Bi(e, i) : J[e.level].func(e, i);
|
|
1137
|
+
if ((a === Z || a === G) && (e.status = q), a === p || a === Z)
|
|
1138
|
+
return t.avail_out === 0 && (e.last_flush = -1), g;
|
|
1139
|
+
if (a === X && (i === ui ? ci(e) : i !== Vt && (St(e, 0, 0, !1), i === gi && (L(e.head), e.lookahead === 0 && (e.strstart = 0, e.block_start = 0, e.insert = 0))), b(t), t.avail_out === 0))
|
|
1140
|
+
return e.last_flush = -1, g;
|
|
1141
|
+
}
|
|
1142
|
+
return i !== x ? g : e.wrap <= 0 ? qt : (e.wrap === 2 ? (f(e, t.adler & 255), f(e, t.adler >> 8 & 255), f(e, t.adler >> 16 & 255), f(e, t.adler >> 24 & 255), f(e, t.total_in & 255), f(e, t.total_in >> 8 & 255), f(e, t.total_in >> 16 & 255), f(e, t.total_in >> 24 & 255)) : (j(e, t.adler >>> 16), j(e, t.adler & 65535)), b(t), e.wrap > 0 && (e.wrap = -e.wrap), e.pending !== 0 ? g : qt);
|
|
1143
|
+
}, Hi = (t) => {
|
|
1144
|
+
if (ot(t))
|
|
1145
|
+
return m;
|
|
1146
|
+
const i = t.state.status;
|
|
1147
|
+
return t.state = null, i === N ? C(t, pi) : g;
|
|
1148
|
+
}, Wi = (t, i) => {
|
|
1149
|
+
let e = i.length;
|
|
1150
|
+
if (ot(t))
|
|
1151
|
+
return m;
|
|
1152
|
+
const n = t.state, a = n.wrap;
|
|
1153
|
+
if (a === 2 || a === 1 && n.status !== P || n.lookahead)
|
|
1154
|
+
return m;
|
|
1155
|
+
if (a === 1 && (t.adler = we(t.adler, i, e, 0)), n.wrap = 0, e >= n.w_size) {
|
|
1156
|
+
a === 0 && (L(n.head), n.strstart = 0, n.block_start = 0, n.insert = 0);
|
|
1157
|
+
let o = new Uint8Array(n.w_size);
|
|
1158
|
+
o.set(i.subarray(e - n.w_size, e), 0), i = o, e = n.w_size;
|
|
1159
|
+
}
|
|
1160
|
+
const r = t.avail_in, l = t.next_in, h = t.input;
|
|
1161
|
+
for (t.avail_in = e, t.next_in = 0, t.input = i, K(n); n.lookahead >= s; ) {
|
|
1162
|
+
let o = n.strstart, _ = n.lookahead - (s - 1);
|
|
1163
|
+
do
|
|
1164
|
+
F(n, o), o++;
|
|
1165
|
+
while (--_);
|
|
1166
|
+
n.strstart = o, n.lookahead = s - 1, K(n);
|
|
1167
|
+
}
|
|
1168
|
+
return n.strstart += n.lookahead, n.block_start = n.strstart, n.insert = n.lookahead, n.lookahead = 0, n.match_length = n.prev_length = s - 1, n.match_available = 0, t.next_in = l, t.input = h, t.avail_in = r, n.wrap = a, g;
|
|
1169
|
+
};
|
|
1170
|
+
var Pi = Mi, Ki = Ae, Yi = ve, Xi = Ee, Gi = Fi, ji = $i, Vi = Hi, qi = Wi, Ji = "pako deflate (from Nodeca project)", tt = {
|
|
1171
|
+
deflateInit: Pi,
|
|
1172
|
+
deflateInit2: Ki,
|
|
1173
|
+
deflateReset: Yi,
|
|
1174
|
+
deflateResetKeep: Xi,
|
|
1175
|
+
deflateSetHeader: Gi,
|
|
1176
|
+
deflate: ji,
|
|
1177
|
+
deflateEnd: Vi,
|
|
1178
|
+
deflateSetDictionary: qi,
|
|
1179
|
+
deflateInfo: Ji
|
|
1180
|
+
};
|
|
1181
|
+
const Qi = (t, i) => Object.prototype.hasOwnProperty.call(t, i);
|
|
1182
|
+
var tn = function(t) {
|
|
1183
|
+
const i = Array.prototype.slice.call(arguments, 1);
|
|
1184
|
+
for (; i.length; ) {
|
|
1185
|
+
const e = i.shift();
|
|
1186
|
+
if (e) {
|
|
1187
|
+
if (typeof e != "object")
|
|
1188
|
+
throw new TypeError(e + "must be non-object");
|
|
1189
|
+
for (const n in e)
|
|
1190
|
+
Qi(e, n) && (t[n] = e[n]);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
return t;
|
|
1194
|
+
}, en = (t) => {
|
|
1195
|
+
let i = 0;
|
|
1196
|
+
for (let n = 0, a = t.length; n < a; n++)
|
|
1197
|
+
i += t[n].length;
|
|
1198
|
+
const e = new Uint8Array(i);
|
|
1199
|
+
for (let n = 0, a = 0, r = t.length; n < r; n++) {
|
|
1200
|
+
let l = t[n];
|
|
1201
|
+
e.set(l, a), a += l.length;
|
|
1202
|
+
}
|
|
1203
|
+
return e;
|
|
1204
|
+
}, me = {
|
|
1205
|
+
assign: tn,
|
|
1206
|
+
flattenChunks: en
|
|
1207
|
+
};
|
|
1208
|
+
let Te = !0;
|
|
1209
|
+
try {
|
|
1210
|
+
String.fromCharCode.apply(null, new Uint8Array(1));
|
|
1211
|
+
} catch {
|
|
1212
|
+
Te = !1;
|
|
1213
|
+
}
|
|
1214
|
+
const rt = new Uint8Array(256);
|
|
1215
|
+
for (let t = 0; t < 256; t++)
|
|
1216
|
+
rt[t] = t >= 252 ? 6 : t >= 248 ? 5 : t >= 240 ? 4 : t >= 224 ? 3 : t >= 192 ? 2 : 1;
|
|
1217
|
+
rt[254] = rt[255] = 1;
|
|
1218
|
+
var nn = (t) => {
|
|
1219
|
+
if (typeof TextEncoder == "function" && TextEncoder.prototype.encode)
|
|
1220
|
+
return new TextEncoder().encode(t);
|
|
1221
|
+
let i, e, n, a, r, l = t.length, h = 0;
|
|
1222
|
+
for (a = 0; a < l; a++)
|
|
1223
|
+
e = t.charCodeAt(a), (e & 64512) === 55296 && a + 1 < l && (n = t.charCodeAt(a + 1), (n & 64512) === 56320 && (e = 65536 + (e - 55296 << 10) + (n - 56320), a++)), h += e < 128 ? 1 : e < 2048 ? 2 : e < 65536 ? 3 : 4;
|
|
1224
|
+
for (i = new Uint8Array(h), r = 0, a = 0; r < h; a++)
|
|
1225
|
+
e = t.charCodeAt(a), (e & 64512) === 55296 && a + 1 < l && (n = t.charCodeAt(a + 1), (n & 64512) === 56320 && (e = 65536 + (e - 55296 << 10) + (n - 56320), a++)), e < 128 ? i[r++] = e : e < 2048 ? (i[r++] = 192 | e >>> 6, i[r++] = 128 | e & 63) : e < 65536 ? (i[r++] = 224 | e >>> 12, i[r++] = 128 | e >>> 6 & 63, i[r++] = 128 | e & 63) : (i[r++] = 240 | e >>> 18, i[r++] = 128 | e >>> 12 & 63, i[r++] = 128 | e >>> 6 & 63, i[r++] = 128 | e & 63);
|
|
1226
|
+
return i;
|
|
1227
|
+
};
|
|
1228
|
+
const an = (t, i) => {
|
|
1229
|
+
if (i < 65534 && t.subarray && Te)
|
|
1230
|
+
return String.fromCharCode.apply(null, t.length === i ? t : t.subarray(0, i));
|
|
1231
|
+
let e = "";
|
|
1232
|
+
for (let n = 0; n < i; n++)
|
|
1233
|
+
e += String.fromCharCode(t[n]);
|
|
1234
|
+
return e;
|
|
1235
|
+
};
|
|
1236
|
+
var rn = (t, i) => {
|
|
1237
|
+
const e = i || t.length;
|
|
1238
|
+
if (typeof TextDecoder == "function" && TextDecoder.prototype.decode)
|
|
1239
|
+
return new TextDecoder().decode(t.subarray(0, i));
|
|
1240
|
+
let n, a;
|
|
1241
|
+
const r = new Array(e * 2);
|
|
1242
|
+
for (a = 0, n = 0; n < e; ) {
|
|
1243
|
+
let l = t[n++];
|
|
1244
|
+
if (l < 128) {
|
|
1245
|
+
r[a++] = l;
|
|
1246
|
+
continue;
|
|
1247
|
+
}
|
|
1248
|
+
let h = rt[l];
|
|
1249
|
+
if (h > 4) {
|
|
1250
|
+
r[a++] = 65533, n += h - 1;
|
|
1251
|
+
continue;
|
|
1252
|
+
}
|
|
1253
|
+
for (l &= h === 2 ? 31 : h === 3 ? 15 : 7; h > 1 && n < e; )
|
|
1254
|
+
l = l << 6 | t[n++] & 63, h--;
|
|
1255
|
+
if (h > 1) {
|
|
1256
|
+
r[a++] = 65533;
|
|
1257
|
+
continue;
|
|
1258
|
+
}
|
|
1259
|
+
l < 65536 ? r[a++] = l : (l -= 65536, r[a++] = 55296 | l >> 10 & 1023, r[a++] = 56320 | l & 1023);
|
|
1260
|
+
}
|
|
1261
|
+
return an(r, a);
|
|
1262
|
+
}, ln = (t, i) => {
|
|
1263
|
+
i = i || t.length, i > t.length && (i = t.length);
|
|
1264
|
+
let e = i - 1;
|
|
1265
|
+
for (; e >= 0 && (t[e] & 192) === 128; )
|
|
1266
|
+
e--;
|
|
1267
|
+
return e < 0 || e === 0 ? i : e + rt[t[e]] > i ? e : i;
|
|
1268
|
+
}, ke = {
|
|
1269
|
+
string2buf: nn,
|
|
1270
|
+
buf2string: rn,
|
|
1271
|
+
utf8border: ln
|
|
1272
|
+
};
|
|
1273
|
+
function on() {
|
|
1274
|
+
this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
|
|
1275
|
+
}
|
|
1276
|
+
var hn = on;
|
|
1277
|
+
const Se = Object.prototype.toString, {
|
|
1278
|
+
Z_NO_FLUSH: _n,
|
|
1279
|
+
Z_SYNC_FLUSH: sn,
|
|
1280
|
+
Z_FULL_FLUSH: fn,
|
|
1281
|
+
Z_FINISH: dn,
|
|
1282
|
+
Z_OK: ct,
|
|
1283
|
+
Z_STREAM_END: cn,
|
|
1284
|
+
Z_DEFAULT_COMPRESSION: un,
|
|
1285
|
+
Z_DEFAULT_STRATEGY: gn,
|
|
1286
|
+
Z_DEFLATED: pn
|
|
1287
|
+
} = be, wn = {
|
|
1288
|
+
level: un,
|
|
1289
|
+
method: pn,
|
|
1290
|
+
chunkSize: 16384,
|
|
1291
|
+
windowBits: 15,
|
|
1292
|
+
memLevel: 8,
|
|
1293
|
+
strategy: gn,
|
|
1294
|
+
legacyHash: !0
|
|
1295
|
+
};
|
|
1296
|
+
function gt(t) {
|
|
1297
|
+
this.options = me.assign({}, wn, t || {});
|
|
1298
|
+
let i = this.options;
|
|
1299
|
+
i.raw && i.windowBits > 0 ? i.windowBits = -i.windowBits : i.gzip && i.windowBits > 0 && i.windowBits < 16 && (i.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new hn(), this.strm.avail_out = 0;
|
|
1300
|
+
let e = tt.deflateInit2(
|
|
1301
|
+
this.strm,
|
|
1302
|
+
i.level,
|
|
1303
|
+
i.method,
|
|
1304
|
+
i.windowBits,
|
|
1305
|
+
i.memLevel,
|
|
1306
|
+
i.strategy,
|
|
1307
|
+
i.legacyHash
|
|
1308
|
+
);
|
|
1309
|
+
if (e !== ct)
|
|
1310
|
+
throw new Error(dt[e]);
|
|
1311
|
+
if (i.header && tt.deflateSetHeader(this.strm, i.header), i.dictionary) {
|
|
1312
|
+
let n;
|
|
1313
|
+
if (typeof i.dictionary == "string" ? n = ke.string2buf(i.dictionary) : Se.call(i.dictionary) === "[object ArrayBuffer]" ? n = new Uint8Array(i.dictionary) : n = i.dictionary, e = tt.deflateSetDictionary(this.strm, n), e !== ct)
|
|
1314
|
+
throw new Error(dt[e]);
|
|
1315
|
+
this._dict_set = !0;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
gt.prototype.push = function(t, i) {
|
|
1319
|
+
const e = this.strm, n = this.options.chunkSize;
|
|
1320
|
+
let a, r;
|
|
1321
|
+
if (this.ended)
|
|
1322
|
+
return !1;
|
|
1323
|
+
for (i === ~~i ? r = i : r = i === !0 ? dn : _n, typeof t == "string" ? e.input = ke.string2buf(t) : Se.call(t) === "[object ArrayBuffer]" ? e.input = new Uint8Array(t) : e.input = t, e.next_in = 0, e.avail_in = e.input.length; ; ) {
|
|
1324
|
+
if (e.avail_out === 0 && (e.output = new Uint8Array(n), e.next_out = 0, e.avail_out = n), (r === sn || r === fn) && e.avail_out <= 6) {
|
|
1325
|
+
this.onData(e.output.subarray(0, e.next_out)), e.avail_out = 0;
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
if (a = tt.deflate(e, r), a === cn)
|
|
1329
|
+
return e.next_out > 0 && this.onData(e.output.subarray(0, e.next_out)), a = tt.deflateEnd(this.strm), this.onEnd(a), this.ended = !0, a === ct;
|
|
1330
|
+
if (e.avail_out === 0) {
|
|
1331
|
+
this.onData(e.output);
|
|
1332
|
+
continue;
|
|
1333
|
+
}
|
|
1334
|
+
if (r > 0 && e.next_out > 0) {
|
|
1335
|
+
this.onData(e.output.subarray(0, e.next_out)), e.avail_out = 0;
|
|
1336
|
+
continue;
|
|
1337
|
+
}
|
|
1338
|
+
if (e.avail_in === 0) break;
|
|
1339
|
+
}
|
|
1340
|
+
return !0;
|
|
1341
|
+
};
|
|
1342
|
+
gt.prototype.onData = function(t) {
|
|
1343
|
+
this.chunks.push(t);
|
|
1344
|
+
};
|
|
1345
|
+
gt.prototype.onEnd = function(t) {
|
|
1346
|
+
t === ct && (this.result = me.flattenChunks(this.chunks)), this.chunks = [], this.err = t, this.msg = this.strm.msg;
|
|
1347
|
+
};
|
|
1348
|
+
function bn(t, i) {
|
|
1349
|
+
const e = new gt(i);
|
|
1350
|
+
if (e.push(t, !0), e.err)
|
|
1351
|
+
throw e.msg || dt[e.err];
|
|
1352
|
+
return e.result;
|
|
1353
|
+
}
|
|
1354
|
+
var yn = bn, xn = {
|
|
1355
|
+
deflate: yn
|
|
1356
|
+
};
|
|
1357
|
+
const { deflate: En } = xn;
|
|
1358
|
+
var vn = En;
|
|
1359
|
+
const ze = [];
|
|
1360
|
+
for (let t = 0; t < 256; t++) {
|
|
1361
|
+
let i = t;
|
|
1362
|
+
for (let e = 0; e < 8; e++)
|
|
1363
|
+
i & 1 ? i = 3988292384 ^ i >>> 1 : i = i >>> 1;
|
|
1364
|
+
ze[t] = i;
|
|
1365
|
+
}
|
|
1366
|
+
const Qt = 4294967295;
|
|
1367
|
+
function An(t, i, e) {
|
|
1368
|
+
let n = t;
|
|
1369
|
+
for (let a = 0; a < e; a++)
|
|
1370
|
+
n = ze[(n ^ i[a]) & 255] ^ n >>> 8;
|
|
1371
|
+
return n;
|
|
1372
|
+
}
|
|
1373
|
+
function mn(t, i) {
|
|
1374
|
+
return (An(Qt, t, i) ^ Qt) >>> 0;
|
|
1375
|
+
}
|
|
1376
|
+
function H(t, i) {
|
|
1377
|
+
t.writeUint32(mn(new Uint8Array(t.buffer, t.byteOffset + t.offset - i, i), i));
|
|
1378
|
+
}
|
|
1379
|
+
const Tn = new Uint16Array([255]), kn = new Uint8Array(Tn.buffer);
|
|
1380
|
+
kn[0];
|
|
1381
|
+
const Sn = new Uint16Array([255]), zn = new Uint8Array(Sn.buffer);
|
|
1382
|
+
zn[0];
|
|
1383
|
+
const Un = Uint8Array.of(137, 80, 78, 71, 13, 10, 26, 10);
|
|
1384
|
+
function Ln(t) {
|
|
1385
|
+
t.writeBytes(Un);
|
|
1386
|
+
}
|
|
1387
|
+
const Dn = "tEXt", In = 0;
|
|
1388
|
+
new TextDecoder("latin1");
|
|
1389
|
+
function Rn(t) {
|
|
1390
|
+
if (Ue(t), t.length === 0 || t.length > 79)
|
|
1391
|
+
throw new Error("keyword length must be between 1 and 79");
|
|
1392
|
+
}
|
|
1393
|
+
const On = /^[\u0000-\u00FF]*$/;
|
|
1394
|
+
function Ue(t) {
|
|
1395
|
+
if (!On.test(t))
|
|
1396
|
+
throw new Error("invalid latin1 text");
|
|
1397
|
+
}
|
|
1398
|
+
function Bn(t, i, e) {
|
|
1399
|
+
Rn(i), Ue(e);
|
|
1400
|
+
const n = i.length + 1 + e.length;
|
|
1401
|
+
t.writeUint32(n), t.writeChars(Dn), t.writeChars(i), t.writeByte(In), t.writeChars(e), H(t, n + 4);
|
|
1402
|
+
}
|
|
1403
|
+
const O = {
|
|
1404
|
+
UNKNOWN: -1,
|
|
1405
|
+
GREYSCALE: 0,
|
|
1406
|
+
TRUECOLOUR: 2,
|
|
1407
|
+
INDEXED_COLOUR: 3,
|
|
1408
|
+
GREYSCALE_ALPHA: 4,
|
|
1409
|
+
TRUECOLOUR_ALPHA: 6
|
|
1410
|
+
}, Nn = {
|
|
1411
|
+
DEFLATE: 0
|
|
1412
|
+
}, Cn = {
|
|
1413
|
+
ADAPTIVE: 0
|
|
1414
|
+
}, V = {
|
|
1415
|
+
NO_INTERLACE: 0,
|
|
1416
|
+
ADAM7: 1
|
|
1417
|
+
}, Zn = {
|
|
1418
|
+
level: 3
|
|
1419
|
+
};
|
|
1420
|
+
class Fn extends st {
|
|
1421
|
+
_png;
|
|
1422
|
+
_zlibOptions;
|
|
1423
|
+
_colorType;
|
|
1424
|
+
_interlaceMethod;
|
|
1425
|
+
constructor(i, e = {}) {
|
|
1426
|
+
super(), this._colorType = O.UNKNOWN, this._zlibOptions = { ...Zn, ...e.zlib }, this._png = this._checkData(i), this._interlaceMethod = (e.interlace === "Adam7" ? V.ADAM7 : V.NO_INTERLACE) ?? V.NO_INTERLACE, this.setBigEndian();
|
|
1427
|
+
}
|
|
1428
|
+
encode() {
|
|
1429
|
+
if (Ln(this), this.encodeIHDR(), this._png.palette && (this.encodePLTE(), this._png.palette[0].length === 4 && this.encodeTRNS()), this.encodeData(), this._png.text)
|
|
1430
|
+
for (const [i, e] of Object.entries(this._png.text))
|
|
1431
|
+
Bn(this, i, e);
|
|
1432
|
+
return this.encodeIEND(), this.toArray();
|
|
1433
|
+
}
|
|
1434
|
+
// https://www.w3.org/TR/PNG/#11IHDR
|
|
1435
|
+
encodeIHDR() {
|
|
1436
|
+
this.writeUint32(13), this.writeChars("IHDR"), this.writeUint32(this._png.width), this.writeUint32(this._png.height), this.writeByte(this._png.depth), this.writeByte(this._colorType), this.writeByte(Nn.DEFLATE), this.writeByte(Cn.ADAPTIVE), this.writeByte(this._interlaceMethod), H(this, 17);
|
|
1437
|
+
}
|
|
1438
|
+
// https://www.w3.org/TR/PNG/#11IEND
|
|
1439
|
+
encodeIEND() {
|
|
1440
|
+
this.writeUint32(0), this.writeChars("IEND"), H(this, 4);
|
|
1441
|
+
}
|
|
1442
|
+
encodePLTE() {
|
|
1443
|
+
const i = this._png.palette?.length * 3;
|
|
1444
|
+
this.writeUint32(i), this.writeChars("PLTE");
|
|
1445
|
+
for (const e of this._png.palette)
|
|
1446
|
+
this.writeByte(e[0]), this.writeByte(e[1]), this.writeByte(e[2]);
|
|
1447
|
+
H(this, 4 + i);
|
|
1448
|
+
}
|
|
1449
|
+
encodeTRNS() {
|
|
1450
|
+
const i = this._png.palette.filter((e) => e.at(-1) !== 255);
|
|
1451
|
+
this.writeUint32(i.length), this.writeChars("tRNS");
|
|
1452
|
+
for (const e of i)
|
|
1453
|
+
this.writeByte(e.at(-1));
|
|
1454
|
+
H(this, 4 + i.length);
|
|
1455
|
+
}
|
|
1456
|
+
// https://www.w3.org/TR/PNG/#11IDAT
|
|
1457
|
+
encodeIDAT(i) {
|
|
1458
|
+
this.writeUint32(i.length), this.writeChars("IDAT"), this.writeBytes(i), H(this, i.length + 4);
|
|
1459
|
+
}
|
|
1460
|
+
encodeData() {
|
|
1461
|
+
const { width: i, height: e, channels: n, depth: a, data: r } = this._png, l = a <= 8 ? Math.ceil(i * a / 8) * n : Math.ceil(i * a / 8 * n / 2), h = new st().setBigEndian();
|
|
1462
|
+
let o = 0;
|
|
1463
|
+
if (this._interlaceMethod === V.NO_INTERLACE)
|
|
1464
|
+
for (let c = 0; c < e; c++)
|
|
1465
|
+
h.writeByte(0), a === 16 ? o = Wn(r, h, l, o) : o = $n(r, h, l, o);
|
|
1466
|
+
else this._interlaceMethod === V.ADAM7 && (o = Hn(this._png, r, h, o));
|
|
1467
|
+
const _ = h.toArray(), u = vn(_, this._zlibOptions);
|
|
1468
|
+
this.encodeIDAT(u);
|
|
1469
|
+
}
|
|
1470
|
+
_checkData(i) {
|
|
1471
|
+
const { colorType: e, channels: n, depth: a } = Mn(i, i.palette), r = {
|
|
1472
|
+
width: te(i.width, "width"),
|
|
1473
|
+
height: te(i.height, "height"),
|
|
1474
|
+
channels: n,
|
|
1475
|
+
data: i.data,
|
|
1476
|
+
depth: a,
|
|
1477
|
+
text: i.text,
|
|
1478
|
+
palette: i.palette
|
|
1479
|
+
};
|
|
1480
|
+
this._colorType = e;
|
|
1481
|
+
const l = a < 8 ? Math.ceil(r.width * a / 8) * r.height * n : r.width * r.height * n;
|
|
1482
|
+
if (r.data.length !== l)
|
|
1483
|
+
throw new RangeError(`wrong data size. Found ${r.data.length}, expected ${l}`);
|
|
1484
|
+
return r;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
function te(t, i) {
|
|
1488
|
+
if (Number.isInteger(t) && t > 0)
|
|
1489
|
+
return t;
|
|
1490
|
+
throw new TypeError(`${i} must be a positive integer`);
|
|
1491
|
+
}
|
|
1492
|
+
function Mn(t, i) {
|
|
1493
|
+
const { channels: e = 4, depth: n = 8 } = t;
|
|
1494
|
+
if (e !== 4 && e !== 3 && e !== 2 && e !== 1)
|
|
1495
|
+
throw new RangeError(`unsupported number of channels: ${e}`);
|
|
1496
|
+
const a = {
|
|
1497
|
+
channels: e,
|
|
1498
|
+
depth: n,
|
|
1499
|
+
colorType: O.UNKNOWN
|
|
1500
|
+
};
|
|
1501
|
+
switch (e) {
|
|
1502
|
+
case 4:
|
|
1503
|
+
a.colorType = O.TRUECOLOUR_ALPHA;
|
|
1504
|
+
break;
|
|
1505
|
+
case 3:
|
|
1506
|
+
a.colorType = O.TRUECOLOUR;
|
|
1507
|
+
break;
|
|
1508
|
+
case 1:
|
|
1509
|
+
i ? a.colorType = O.INDEXED_COLOUR : a.colorType = O.GREYSCALE;
|
|
1510
|
+
break;
|
|
1511
|
+
case 2:
|
|
1512
|
+
a.colorType = O.GREYSCALE_ALPHA;
|
|
1513
|
+
break;
|
|
1514
|
+
default:
|
|
1515
|
+
throw new Error("unsupported number of channels");
|
|
1516
|
+
}
|
|
1517
|
+
return a;
|
|
1518
|
+
}
|
|
1519
|
+
function $n(t, i, e, n) {
|
|
1520
|
+
for (let a = 0; a < e; a++)
|
|
1521
|
+
i.writeByte(t[n++]);
|
|
1522
|
+
return n;
|
|
1523
|
+
}
|
|
1524
|
+
function Hn(t, i, e, n) {
|
|
1525
|
+
const a = [
|
|
1526
|
+
{ x: 0, y: 0, xStep: 8, yStep: 8 },
|
|
1527
|
+
{ x: 4, y: 0, xStep: 8, yStep: 8 },
|
|
1528
|
+
{ x: 0, y: 4, xStep: 4, yStep: 8 },
|
|
1529
|
+
{ x: 2, y: 0, xStep: 4, yStep: 4 },
|
|
1530
|
+
{ x: 0, y: 2, xStep: 2, yStep: 4 },
|
|
1531
|
+
{ x: 1, y: 0, xStep: 2, yStep: 2 },
|
|
1532
|
+
{ x: 0, y: 1, xStep: 1, yStep: 2 }
|
|
1533
|
+
], { width: r, height: l, channels: h, depth: o } = t;
|
|
1534
|
+
let _ = 0;
|
|
1535
|
+
o === 16 ? _ = h * o / 8 / 2 : _ = h * o / 8;
|
|
1536
|
+
for (let u = 0; u < 7; u++) {
|
|
1537
|
+
const c = a[u], d = Math.floor((r - c.x + c.xStep - 1) / c.xStep), E = Math.floor((l - c.y + c.yStep - 1) / c.yStep);
|
|
1538
|
+
if (d <= 0 || E <= 0)
|
|
1539
|
+
continue;
|
|
1540
|
+
const k = d * _;
|
|
1541
|
+
for (let z = 0; z < E; z++) {
|
|
1542
|
+
const Mt = c.y + z * c.yStep, pt = o <= 8 ? new Uint8Array(k) : new Uint16Array(k);
|
|
1543
|
+
let Le = 0;
|
|
1544
|
+
for (let M = 0; M < d; M++) {
|
|
1545
|
+
const $t = c.x + M * c.xStep;
|
|
1546
|
+
if ($t < r && Mt < l) {
|
|
1547
|
+
const De = (Mt * r + $t) * _;
|
|
1548
|
+
for (let wt = 0; wt < _; wt++)
|
|
1549
|
+
pt[Le++] = i[De + wt];
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
if (e.writeByte(0), o === 8)
|
|
1553
|
+
e.writeBytes(pt);
|
|
1554
|
+
else if (o === 16)
|
|
1555
|
+
for (const M of pt)
|
|
1556
|
+
e.writeByte(M >> 8 & 255), e.writeByte(M & 255);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return n;
|
|
1560
|
+
}
|
|
1561
|
+
function Wn(t, i, e, n) {
|
|
1562
|
+
for (let a = 0; a < e; a++)
|
|
1563
|
+
i.writeUint16(t[n++]);
|
|
1564
|
+
return n;
|
|
1565
|
+
}
|
|
1566
|
+
var ee;
|
|
1567
|
+
(function(t) {
|
|
1568
|
+
t[t.UNKNOWN = 0] = "UNKNOWN", t[t.METRE = 1] = "METRE";
|
|
1569
|
+
})(ee || (ee = {}));
|
|
1570
|
+
function Pn(t, i) {
|
|
1571
|
+
return new Fn(t, i).encode();
|
|
1572
|
+
}
|
|
1573
|
+
export {
|
|
1574
|
+
Pn as e
|
|
1575
|
+
};
|