@microsoft/webui 0.0.21 → 0.0.23
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 +1 -0
- package/bin/webui +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/wasm/all/README.md +36 -0
- package/wasm/all/package.json +32 -0
- package/wasm/all/webui_wasm_all.d.ts +154 -0
- package/wasm/all/webui_wasm_all.js +928 -0
- package/wasm/all/webui_wasm_all_bg.wasm +0 -0
- package/wasm/all/webui_wasm_all_bg.wasm.d.ts +25 -0
- package/wasm/handler/README.md +36 -0
- package/wasm/handler/package.json +32 -0
- package/wasm/handler/webui_wasm_handler.d.ts +146 -0
- package/wasm/handler/webui_wasm_handler.js +878 -0
- package/wasm/handler/webui_wasm_handler_bg.wasm +0 -0
- package/wasm/handler/webui_wasm_handler_bg.wasm.d.ts +24 -0
- package/wasm/parser/README.md +36 -0
- package/wasm/parser/package.json +32 -0
- package/wasm/parser/webui_wasm_parser.d.ts +43 -0
- package/wasm/parser/webui_wasm_parser.js +485 -0
- package/wasm/parser/webui_wasm_parser_bg.wasm +0 -0
- package/wasm/parser/webui_wasm_parser_bg.wasm.d.ts +9 -0
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
/* @ts-self-types="./webui_wasm_handler.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A decoded protocol with reusable indices for repeated WASM renders.
|
|
5
|
+
*/
|
|
6
|
+
export class Protocol {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
ProtocolFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_protocol_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Decode protobuf bytes once for repeated rendering.
|
|
19
|
+
* @param {Uint8Array} protocol_bytes
|
|
20
|
+
* @param {string | null} [plugin]
|
|
21
|
+
*/
|
|
22
|
+
constructor(protocol_bytes, plugin) {
|
|
23
|
+
try {
|
|
24
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
25
|
+
const ptr0 = passArray8ToWasm0(protocol_bytes, wasm.__wbindgen_export);
|
|
26
|
+
const len0 = WASM_VECTOR_LEN;
|
|
27
|
+
var ptr1 = isLikeNone(plugin) ? 0 : passStringToWasm0(plugin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
28
|
+
var len1 = WASM_VECTOR_LEN;
|
|
29
|
+
wasm.protocol_new(retptr, ptr0, len0, ptr1, len1);
|
|
30
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
31
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
32
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
33
|
+
if (r2) {
|
|
34
|
+
throw takeObject(r1);
|
|
35
|
+
}
|
|
36
|
+
this.__wbg_ptr = r0;
|
|
37
|
+
ProtocolFinalization.register(this, this.__wbg_ptr, this);
|
|
38
|
+
return this;
|
|
39
|
+
} finally {
|
|
40
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Render from an existing JSON string.
|
|
45
|
+
* @param {string} state_json
|
|
46
|
+
* @param {object | null} [options]
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
render(state_json, options) {
|
|
50
|
+
let deferred3_0;
|
|
51
|
+
let deferred3_1;
|
|
52
|
+
try {
|
|
53
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
54
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
wasm.protocol_render(retptr, this.__wbg_ptr, ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
57
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
58
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
59
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
60
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
61
|
+
var ptr2 = r0;
|
|
62
|
+
var len2 = r1;
|
|
63
|
+
if (r3) {
|
|
64
|
+
ptr2 = 0; len2 = 0;
|
|
65
|
+
throw takeObject(r2);
|
|
66
|
+
}
|
|
67
|
+
deferred3_0 = ptr2;
|
|
68
|
+
deferred3_1 = len2;
|
|
69
|
+
return getStringFromWasm0(ptr2, len2);
|
|
70
|
+
} finally {
|
|
71
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
72
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Return component template payloads for requested component tags.
|
|
77
|
+
* @param {any} component_tags
|
|
78
|
+
* @param {string} inventory_hex
|
|
79
|
+
* @returns {string}
|
|
80
|
+
*/
|
|
81
|
+
renderComponentTemplates(component_tags, inventory_hex) {
|
|
82
|
+
let deferred3_0;
|
|
83
|
+
let deferred3_1;
|
|
84
|
+
try {
|
|
85
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
86
|
+
const ptr0 = passStringToWasm0(inventory_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
87
|
+
const len0 = WASM_VECTOR_LEN;
|
|
88
|
+
wasm.protocol_renderComponentTemplates(retptr, this.__wbg_ptr, addHeapObject(component_tags), ptr0, len0);
|
|
89
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
90
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
91
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
92
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
93
|
+
var ptr2 = r0;
|
|
94
|
+
var len2 = r1;
|
|
95
|
+
if (r3) {
|
|
96
|
+
ptr2 = 0; len2 = 0;
|
|
97
|
+
throw takeObject(r2);
|
|
98
|
+
}
|
|
99
|
+
deferred3_0 = ptr2;
|
|
100
|
+
deferred3_1 = len2;
|
|
101
|
+
return getStringFromWasm0(ptr2, len2);
|
|
102
|
+
} finally {
|
|
103
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
104
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Produce a complete partial-navigation response.
|
|
109
|
+
* @param {string} state_json
|
|
110
|
+
* @param {string} entry_id
|
|
111
|
+
* @param {string} request_path
|
|
112
|
+
* @param {string} inventory_hex
|
|
113
|
+
* @returns {string}
|
|
114
|
+
*/
|
|
115
|
+
renderPartial(state_json, entry_id, request_path, inventory_hex) {
|
|
116
|
+
let deferred6_0;
|
|
117
|
+
let deferred6_1;
|
|
118
|
+
try {
|
|
119
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
120
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
121
|
+
const len0 = WASM_VECTOR_LEN;
|
|
122
|
+
const ptr1 = passStringToWasm0(entry_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
123
|
+
const len1 = WASM_VECTOR_LEN;
|
|
124
|
+
const ptr2 = passStringToWasm0(request_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
125
|
+
const len2 = WASM_VECTOR_LEN;
|
|
126
|
+
const ptr3 = passStringToWasm0(inventory_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
127
|
+
const len3 = WASM_VECTOR_LEN;
|
|
128
|
+
wasm.protocol_renderPartial(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
129
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
130
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
131
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
132
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
133
|
+
var ptr5 = r0;
|
|
134
|
+
var len5 = r1;
|
|
135
|
+
if (r3) {
|
|
136
|
+
ptr5 = 0; len5 = 0;
|
|
137
|
+
throw takeObject(r2);
|
|
138
|
+
}
|
|
139
|
+
deferred6_0 = ptr5;
|
|
140
|
+
deferred6_1 = len5;
|
|
141
|
+
return getStringFromWasm0(ptr5, len5);
|
|
142
|
+
} finally {
|
|
143
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
144
|
+
wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Stream from an existing JSON string in bounded chunks.
|
|
149
|
+
* @param {string} state_json
|
|
150
|
+
* @param {Function} on_chunk
|
|
151
|
+
* @param {object | null} [options]
|
|
152
|
+
*/
|
|
153
|
+
renderStream(state_json, on_chunk, options) {
|
|
154
|
+
try {
|
|
155
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
156
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
157
|
+
const len0 = WASM_VECTOR_LEN;
|
|
158
|
+
wasm.protocol_renderStream(retptr, this.__wbg_ptr, ptr0, len0, addBorrowedObject(on_chunk), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
159
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
160
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
161
|
+
if (r1) {
|
|
162
|
+
throw takeObject(r0);
|
|
163
|
+
}
|
|
164
|
+
} finally {
|
|
165
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
166
|
+
heap[stack_pointer++] = undefined;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Open a host-driven progressive response for a streaming entry.
|
|
171
|
+
*
|
|
172
|
+
* Unlike `renderStream`, which pushes every chunk through one callback
|
|
173
|
+
* during a single synchronous call, the returned session hands each chunk
|
|
174
|
+
* back so the host owns the socket, the write order, and backpressure.
|
|
175
|
+
* @param {string} entry
|
|
176
|
+
* @param {string} request_path
|
|
177
|
+
* @param {object | null} [options]
|
|
178
|
+
* @returns {StreamingSession}
|
|
179
|
+
*/
|
|
180
|
+
streamResponse(entry, request_path, options) {
|
|
181
|
+
try {
|
|
182
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
183
|
+
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
184
|
+
const len0 = WASM_VECTOR_LEN;
|
|
185
|
+
const ptr1 = passStringToWasm0(request_path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
186
|
+
const len1 = WASM_VECTOR_LEN;
|
|
187
|
+
wasm.protocol_streamResponse(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
188
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
189
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
190
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
191
|
+
if (r2) {
|
|
192
|
+
throw takeObject(r1);
|
|
193
|
+
}
|
|
194
|
+
return StreamingSession.__wrap(r0);
|
|
195
|
+
} finally {
|
|
196
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Return CSS token names in build order.
|
|
201
|
+
* @returns {any}
|
|
202
|
+
*/
|
|
203
|
+
tokens() {
|
|
204
|
+
try {
|
|
205
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
206
|
+
wasm.protocol_tokens(retptr, this.__wbg_ptr);
|
|
207
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
208
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
209
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
210
|
+
if (r2) {
|
|
211
|
+
throw takeObject(r1);
|
|
212
|
+
}
|
|
213
|
+
return takeObject(r0);
|
|
214
|
+
} finally {
|
|
215
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (Symbol.dispose) Protocol.prototype[Symbol.dispose] = Protocol.prototype.free;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A progressive HTML response driven one chunk at a time from JavaScript.
|
|
223
|
+
*
|
|
224
|
+
* Every method returns the UTF-8 bytes it produced. Write them to the
|
|
225
|
+
* response and apply the host's own backpressure; the session holds no
|
|
226
|
+
* transport and never blocks on one.
|
|
227
|
+
*
|
|
228
|
+
* ```js
|
|
229
|
+
* const session = protocol.streamResponse('index.html', '/');
|
|
230
|
+
* const weather = session.boundary('weather-shell');
|
|
231
|
+
* controller.enqueue(session.writeShell(shellState));
|
|
232
|
+
* controller.enqueue(session.writeBoundary(weather, weatherState, 'updatable'));
|
|
233
|
+
* controller.enqueue(session.update(weather, forecast));
|
|
234
|
+
* controller.enqueue(session.finish(tailState));
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
export class StreamingSession {
|
|
238
|
+
static __wrap(ptr) {
|
|
239
|
+
const obj = Object.create(StreamingSession.prototype);
|
|
240
|
+
obj.__wbg_ptr = ptr;
|
|
241
|
+
StreamingSessionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
242
|
+
return obj;
|
|
243
|
+
}
|
|
244
|
+
__destroy_into_raw() {
|
|
245
|
+
const ptr = this.__wbg_ptr;
|
|
246
|
+
this.__wbg_ptr = 0;
|
|
247
|
+
StreamingSessionFinalization.unregister(this);
|
|
248
|
+
return ptr;
|
|
249
|
+
}
|
|
250
|
+
free() {
|
|
251
|
+
const ptr = this.__destroy_into_raw();
|
|
252
|
+
wasm.__wbg_streamingsession_free(ptr, 0);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Resolve an authored boundary name to a stable integer handle.
|
|
256
|
+
*
|
|
257
|
+
* Resolve once outside the write loop; the handle costs nothing to reuse.
|
|
258
|
+
* @param {string} name
|
|
259
|
+
* @returns {number}
|
|
260
|
+
*/
|
|
261
|
+
boundary(name) {
|
|
262
|
+
try {
|
|
263
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
264
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
265
|
+
const len0 = WASM_VECTOR_LEN;
|
|
266
|
+
wasm.streamingsession_boundary(retptr, this.__wbg_ptr, ptr0, len0);
|
|
267
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
268
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
269
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
270
|
+
if (r2) {
|
|
271
|
+
throw takeObject(r1);
|
|
272
|
+
}
|
|
273
|
+
return r0 >>> 0;
|
|
274
|
+
} finally {
|
|
275
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Number of compile-time boundaries declared by this entry.
|
|
280
|
+
* @returns {number}
|
|
281
|
+
*/
|
|
282
|
+
get boundaryCount() {
|
|
283
|
+
const ret = wasm.streamingsession_boundaryCount(this.__wbg_ptr);
|
|
284
|
+
return ret >>> 0;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Render the document tail and emit the terminal record.
|
|
288
|
+
* @param {string} state_json
|
|
289
|
+
* @returns {Uint8Array}
|
|
290
|
+
*/
|
|
291
|
+
finish(state_json) {
|
|
292
|
+
try {
|
|
293
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
294
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
296
|
+
wasm.streamingsession_finish(retptr, this.__wbg_ptr, ptr0, len0);
|
|
297
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
298
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
299
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
300
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
301
|
+
if (r3) {
|
|
302
|
+
throw takeObject(r2);
|
|
303
|
+
}
|
|
304
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
305
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
306
|
+
return v2;
|
|
307
|
+
} finally {
|
|
308
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Whether the terminal record has been written.
|
|
313
|
+
* @returns {boolean}
|
|
314
|
+
*/
|
|
315
|
+
get finished() {
|
|
316
|
+
const ret = wasm.streamingsession_finished(this.__wbg_ptr);
|
|
317
|
+
return ret !== 0;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Push a projected state patch to a committed updatable boundary.
|
|
321
|
+
* @param {number} boundary
|
|
322
|
+
* @param {string} state_json
|
|
323
|
+
* @returns {Uint8Array}
|
|
324
|
+
*/
|
|
325
|
+
update(boundary, state_json) {
|
|
326
|
+
try {
|
|
327
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
328
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
329
|
+
const len0 = WASM_VECTOR_LEN;
|
|
330
|
+
wasm.streamingsession_update(retptr, this.__wbg_ptr, boundary, ptr0, len0);
|
|
331
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
332
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
333
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
334
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
335
|
+
if (r3) {
|
|
336
|
+
throw takeObject(r2);
|
|
337
|
+
}
|
|
338
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
339
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
340
|
+
return v2;
|
|
341
|
+
} finally {
|
|
342
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Render and commit the next boundary in declaration order.
|
|
347
|
+
*
|
|
348
|
+
* `mode` is `"final"` (default) or `"updatable"`. Only updatable
|
|
349
|
+
* boundaries accept later `update()` calls.
|
|
350
|
+
* @param {number} boundary
|
|
351
|
+
* @param {string} state_json
|
|
352
|
+
* @param {string | null} [mode]
|
|
353
|
+
* @returns {Uint8Array}
|
|
354
|
+
*/
|
|
355
|
+
writeBoundary(boundary, state_json, mode) {
|
|
356
|
+
try {
|
|
357
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
358
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
359
|
+
const len0 = WASM_VECTOR_LEN;
|
|
360
|
+
var ptr1 = isLikeNone(mode) ? 0 : passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
361
|
+
var len1 = WASM_VECTOR_LEN;
|
|
362
|
+
wasm.streamingsession_writeBoundary(retptr, this.__wbg_ptr, boundary, ptr0, len0, ptr1, len1);
|
|
363
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
364
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
365
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
366
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
367
|
+
if (r3) {
|
|
368
|
+
throw takeObject(r2);
|
|
369
|
+
}
|
|
370
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
371
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
372
|
+
return v3;
|
|
373
|
+
} finally {
|
|
374
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Render everything before the first boundary.
|
|
379
|
+
* @param {string} state_json
|
|
380
|
+
* @returns {Uint8Array}
|
|
381
|
+
*/
|
|
382
|
+
writeShell(state_json) {
|
|
383
|
+
try {
|
|
384
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
385
|
+
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
386
|
+
const len0 = WASM_VECTOR_LEN;
|
|
387
|
+
wasm.streamingsession_writeShell(retptr, this.__wbg_ptr, ptr0, len0);
|
|
388
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
389
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
390
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
391
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
392
|
+
if (r3) {
|
|
393
|
+
throw takeObject(r2);
|
|
394
|
+
}
|
|
395
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
396
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
397
|
+
return v2;
|
|
398
|
+
} finally {
|
|
399
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (Symbol.dispose) StreamingSession.prototype[Symbol.dispose] = StreamingSession.prototype.free;
|
|
404
|
+
function __wbg_get_imports() {
|
|
405
|
+
const import0 = {
|
|
406
|
+
__proto__: null,
|
|
407
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
408
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
409
|
+
return addHeapObject(ret);
|
|
410
|
+
},
|
|
411
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
412
|
+
const ret = String(getObject(arg1));
|
|
413
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
414
|
+
const len1 = WASM_VECTOR_LEN;
|
|
415
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
416
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
417
|
+
},
|
|
418
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
419
|
+
const v = getObject(arg0);
|
|
420
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
421
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
422
|
+
},
|
|
423
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
424
|
+
const ret = debugString(getObject(arg1));
|
|
425
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
426
|
+
const len1 = WASM_VECTOR_LEN;
|
|
427
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
428
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
429
|
+
},
|
|
430
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
431
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
432
|
+
return ret;
|
|
433
|
+
},
|
|
434
|
+
__wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
|
|
435
|
+
const ret = getObject(arg0) === null;
|
|
436
|
+
return ret;
|
|
437
|
+
},
|
|
438
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
439
|
+
const val = getObject(arg0);
|
|
440
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
441
|
+
return ret;
|
|
442
|
+
},
|
|
443
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
444
|
+
const ret = getObject(arg0) === undefined;
|
|
445
|
+
return ret;
|
|
446
|
+
},
|
|
447
|
+
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
448
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
449
|
+
return ret;
|
|
450
|
+
},
|
|
451
|
+
__wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
|
|
452
|
+
const obj = getObject(arg1);
|
|
453
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
454
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
455
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
456
|
+
},
|
|
457
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
458
|
+
const obj = getObject(arg1);
|
|
459
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
460
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
461
|
+
var len1 = WASM_VECTOR_LEN;
|
|
462
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
463
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
464
|
+
},
|
|
465
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
466
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
467
|
+
},
|
|
468
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
469
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
470
|
+
return addHeapObject(ret);
|
|
471
|
+
}, arguments); },
|
|
472
|
+
__wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
|
|
473
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
474
|
+
return addHeapObject(ret);
|
|
475
|
+
}, arguments); },
|
|
476
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
477
|
+
const ret = getObject(arg0).done;
|
|
478
|
+
return ret;
|
|
479
|
+
},
|
|
480
|
+
__wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
|
|
481
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
482
|
+
return addHeapObject(ret);
|
|
483
|
+
}, arguments); },
|
|
484
|
+
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
485
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
486
|
+
return addHeapObject(ret);
|
|
487
|
+
}, arguments); },
|
|
488
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
489
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
490
|
+
return addHeapObject(ret);
|
|
491
|
+
},
|
|
492
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
493
|
+
let result;
|
|
494
|
+
try {
|
|
495
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
496
|
+
} catch (_) {
|
|
497
|
+
result = false;
|
|
498
|
+
}
|
|
499
|
+
const ret = result;
|
|
500
|
+
return ret;
|
|
501
|
+
},
|
|
502
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
503
|
+
let result;
|
|
504
|
+
try {
|
|
505
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
506
|
+
} catch (_) {
|
|
507
|
+
result = false;
|
|
508
|
+
}
|
|
509
|
+
const ret = result;
|
|
510
|
+
return ret;
|
|
511
|
+
},
|
|
512
|
+
__wbg_isArray_0677c962b281d01a: function(arg0) {
|
|
513
|
+
const ret = Array.isArray(getObject(arg0));
|
|
514
|
+
return ret;
|
|
515
|
+
},
|
|
516
|
+
__wbg_iterator_6f722e4a93058b71: function() {
|
|
517
|
+
const ret = Symbol.iterator;
|
|
518
|
+
return addHeapObject(ret);
|
|
519
|
+
},
|
|
520
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
521
|
+
const ret = getObject(arg0).length;
|
|
522
|
+
return ret;
|
|
523
|
+
},
|
|
524
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
525
|
+
const ret = getObject(arg0).length;
|
|
526
|
+
return ret;
|
|
527
|
+
},
|
|
528
|
+
__wbg_new_32b398fb48b6d94a: function() {
|
|
529
|
+
const ret = new Array();
|
|
530
|
+
return addHeapObject(ret);
|
|
531
|
+
},
|
|
532
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
533
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
534
|
+
return addHeapObject(ret);
|
|
535
|
+
},
|
|
536
|
+
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
537
|
+
const ret = getObject(arg0).next;
|
|
538
|
+
return addHeapObject(ret);
|
|
539
|
+
},
|
|
540
|
+
__wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
|
|
541
|
+
const ret = getObject(arg0).next();
|
|
542
|
+
return addHeapObject(ret);
|
|
543
|
+
}, arguments); },
|
|
544
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
545
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
546
|
+
},
|
|
547
|
+
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
548
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
549
|
+
},
|
|
550
|
+
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
551
|
+
const ret = getObject(arg0).value;
|
|
552
|
+
return addHeapObject(ret);
|
|
553
|
+
},
|
|
554
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
555
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
556
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
557
|
+
return addHeapObject(ret);
|
|
558
|
+
},
|
|
559
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
560
|
+
takeObject(arg0);
|
|
561
|
+
},
|
|
562
|
+
};
|
|
563
|
+
return {
|
|
564
|
+
__proto__: null,
|
|
565
|
+
"./webui_wasm_handler_bg.js": import0,
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const ProtocolFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
570
|
+
? { register: () => {}, unregister: () => {} }
|
|
571
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_protocol_free(ptr, 1));
|
|
572
|
+
const StreamingSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
573
|
+
? { register: () => {}, unregister: () => {} }
|
|
574
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_streamingsession_free(ptr, 1));
|
|
575
|
+
|
|
576
|
+
function addHeapObject(obj) {
|
|
577
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
578
|
+
const idx = heap_next;
|
|
579
|
+
heap_next = heap[idx];
|
|
580
|
+
|
|
581
|
+
heap[idx] = obj;
|
|
582
|
+
return idx;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function addBorrowedObject(obj) {
|
|
586
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
587
|
+
heap[--stack_pointer] = obj;
|
|
588
|
+
return stack_pointer;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function debugString(val) {
|
|
592
|
+
// primitive types
|
|
593
|
+
const type = typeof val;
|
|
594
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
595
|
+
return `${val}`;
|
|
596
|
+
}
|
|
597
|
+
if (type == 'string') {
|
|
598
|
+
return `"${val}"`;
|
|
599
|
+
}
|
|
600
|
+
if (type == 'symbol') {
|
|
601
|
+
const description = val.description;
|
|
602
|
+
if (description == null) {
|
|
603
|
+
return 'Symbol';
|
|
604
|
+
} else {
|
|
605
|
+
return `Symbol(${description})`;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (type == 'function') {
|
|
609
|
+
const name = val.name;
|
|
610
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
611
|
+
return `Function(${name})`;
|
|
612
|
+
} else {
|
|
613
|
+
return 'Function';
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
// objects
|
|
617
|
+
if (Array.isArray(val)) {
|
|
618
|
+
const length = val.length;
|
|
619
|
+
let debug = '[';
|
|
620
|
+
if (length > 0) {
|
|
621
|
+
debug += debugString(val[0]);
|
|
622
|
+
}
|
|
623
|
+
for(let i = 1; i < length; i++) {
|
|
624
|
+
debug += ', ' + debugString(val[i]);
|
|
625
|
+
}
|
|
626
|
+
debug += ']';
|
|
627
|
+
return debug;
|
|
628
|
+
}
|
|
629
|
+
// Test for built-in
|
|
630
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
631
|
+
let className;
|
|
632
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
633
|
+
className = builtInMatches[1];
|
|
634
|
+
} else {
|
|
635
|
+
// Failed to match the standard '[object ClassName]'
|
|
636
|
+
return toString.call(val);
|
|
637
|
+
}
|
|
638
|
+
if (className == 'Object') {
|
|
639
|
+
// we're a user defined class or Object
|
|
640
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
641
|
+
// easier than looping through ownProperties of `val`.
|
|
642
|
+
try {
|
|
643
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
644
|
+
} catch (_) {
|
|
645
|
+
return 'Object';
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
// errors
|
|
649
|
+
if (val instanceof Error) {
|
|
650
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
651
|
+
}
|
|
652
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
653
|
+
return className;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function dropObject(idx) {
|
|
657
|
+
if (idx < 1028) return;
|
|
658
|
+
heap[idx] = heap_next;
|
|
659
|
+
heap_next = idx;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
663
|
+
ptr = ptr >>> 0;
|
|
664
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
let cachedDataViewMemory0 = null;
|
|
668
|
+
function getDataViewMemory0() {
|
|
669
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
670
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
671
|
+
}
|
|
672
|
+
return cachedDataViewMemory0;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function getStringFromWasm0(ptr, len) {
|
|
676
|
+
return decodeText(ptr >>> 0, len);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
let cachedUint8ArrayMemory0 = null;
|
|
680
|
+
function getUint8ArrayMemory0() {
|
|
681
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
682
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
683
|
+
}
|
|
684
|
+
return cachedUint8ArrayMemory0;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
function getObject(idx) { return heap[idx]; }
|
|
688
|
+
|
|
689
|
+
function handleError(f, args) {
|
|
690
|
+
try {
|
|
691
|
+
return f.apply(this, args);
|
|
692
|
+
} catch (e) {
|
|
693
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
let heap = new Array(1024).fill(undefined);
|
|
698
|
+
heap.push(undefined, null, true, false);
|
|
699
|
+
|
|
700
|
+
let heap_next = heap.length;
|
|
701
|
+
|
|
702
|
+
function isLikeNone(x) {
|
|
703
|
+
return x === undefined || x === null;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
707
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
708
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
709
|
+
WASM_VECTOR_LEN = arg.length;
|
|
710
|
+
return ptr;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
714
|
+
if (realloc === undefined) {
|
|
715
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
716
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
717
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
718
|
+
WASM_VECTOR_LEN = buf.length;
|
|
719
|
+
return ptr;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
let len = arg.length;
|
|
723
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
724
|
+
|
|
725
|
+
const mem = getUint8ArrayMemory0();
|
|
726
|
+
|
|
727
|
+
let offset = 0;
|
|
728
|
+
|
|
729
|
+
for (; offset < len; offset++) {
|
|
730
|
+
const code = arg.charCodeAt(offset);
|
|
731
|
+
if (code > 0x7F) break;
|
|
732
|
+
mem[ptr + offset] = code;
|
|
733
|
+
}
|
|
734
|
+
if (offset !== len) {
|
|
735
|
+
if (offset !== 0) {
|
|
736
|
+
arg = arg.slice(offset);
|
|
737
|
+
}
|
|
738
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
739
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
740
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
741
|
+
|
|
742
|
+
offset += ret.written;
|
|
743
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
WASM_VECTOR_LEN = offset;
|
|
747
|
+
return ptr;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
let stack_pointer = 1024;
|
|
751
|
+
|
|
752
|
+
function takeObject(idx) {
|
|
753
|
+
const ret = getObject(idx);
|
|
754
|
+
dropObject(idx);
|
|
755
|
+
return ret;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
759
|
+
cachedTextDecoder.decode();
|
|
760
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
761
|
+
let numBytesDecoded = 0;
|
|
762
|
+
function decodeText(ptr, len) {
|
|
763
|
+
numBytesDecoded += len;
|
|
764
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
765
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
766
|
+
cachedTextDecoder.decode();
|
|
767
|
+
numBytesDecoded = len;
|
|
768
|
+
}
|
|
769
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
const cachedTextEncoder = new TextEncoder();
|
|
773
|
+
|
|
774
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
775
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
776
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
777
|
+
view.set(buf);
|
|
778
|
+
return {
|
|
779
|
+
read: arg.length,
|
|
780
|
+
written: buf.length
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
let WASM_VECTOR_LEN = 0;
|
|
786
|
+
|
|
787
|
+
let wasmModule, wasmInstance, wasm;
|
|
788
|
+
function __wbg_finalize_init(instance, module) {
|
|
789
|
+
wasmInstance = instance;
|
|
790
|
+
wasm = instance.exports;
|
|
791
|
+
wasmModule = module;
|
|
792
|
+
cachedDataViewMemory0 = null;
|
|
793
|
+
cachedUint8ArrayMemory0 = null;
|
|
794
|
+
return wasm;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
async function __wbg_load(module, imports) {
|
|
798
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
799
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
800
|
+
try {
|
|
801
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
802
|
+
} catch (e) {
|
|
803
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
804
|
+
|
|
805
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
806
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
807
|
+
|
|
808
|
+
} else { throw e; }
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
const bytes = await module.arrayBuffer();
|
|
813
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
814
|
+
} else {
|
|
815
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
816
|
+
|
|
817
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
818
|
+
return { instance, module };
|
|
819
|
+
} else {
|
|
820
|
+
return instance;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function expectedResponseType(type) {
|
|
825
|
+
switch (type) {
|
|
826
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
827
|
+
}
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function initSync(module) {
|
|
833
|
+
if (wasm !== undefined) return wasm;
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
if (module !== undefined) {
|
|
837
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
838
|
+
({module} = module)
|
|
839
|
+
} else {
|
|
840
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
const imports = __wbg_get_imports();
|
|
845
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
846
|
+
module = new WebAssembly.Module(module);
|
|
847
|
+
}
|
|
848
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
849
|
+
return __wbg_finalize_init(instance, module);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
async function __wbg_init(module_or_path) {
|
|
853
|
+
if (wasm !== undefined) return wasm;
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
if (module_or_path !== undefined) {
|
|
857
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
858
|
+
({module_or_path} = module_or_path)
|
|
859
|
+
} else {
|
|
860
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (module_or_path === undefined) {
|
|
865
|
+
module_or_path = new URL('webui_wasm_handler_bg.wasm', import.meta.url);
|
|
866
|
+
}
|
|
867
|
+
const imports = __wbg_get_imports();
|
|
868
|
+
|
|
869
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
870
|
+
module_or_path = fetch(module_or_path);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
874
|
+
|
|
875
|
+
return __wbg_finalize_init(instance, module);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
export { initSync, __wbg_init as default };
|