marko 6.0.165 → 6.0.167
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/dist/common/accessor.d.ts +22 -0
- package/dist/common/accessor.debug.d.ts +22 -0
- package/dist/common/helpers.d.ts +3 -2
- package/dist/common/types.d.ts +1 -1
- package/dist/debug/dom.js +1613 -2426
- package/dist/debug/dom.mjs +1517 -2404
- package/dist/debug/html.js +2441 -3359
- package/dist/debug/html.mjs +2364 -3267
- package/dist/dom/compat.d.ts +2 -1
- package/dist/dom/queue.d.ts +6 -6
- package/dist/dom/renderer.d.ts +9 -9
- package/dist/dom/signals.d.ts +5 -9
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +844 -1413
- package/dist/dom.mjs +840 -1394
- package/dist/html/template.d.ts +3 -3
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +1451 -2115
- package/dist/html.mjs +1447 -2025
- package/dist/translator/index.js +8047 -13063
- package/dist/translator/util/normalize-string-expression.d.ts +1 -1
- package/package.json +2 -2
package/dist/html.mjs
CHANGED
|
@@ -1,2353 +1,1775 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
|
|
2
|
+
let str = "", sep = "", part;
|
|
3
|
+
if (val) if (typeof val != "object") str += val;
|
|
4
|
+
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
|
+
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
|
+
return str;
|
|
7
|
+
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str, unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, MutationType = /* @__PURE__ */ function(MutationType) {
|
|
8
|
+
return MutationType[MutationType.call = 0] = "call", MutationType[MutationType.assign = 1] = "assign", MutationType;
|
|
9
|
+
}(MutationType || {}), REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
10
|
+
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
11
|
+
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
12
|
+
let symbol = Symbol[name];
|
|
13
|
+
typeof symbol == "symbol" && KNOWN_SYMBOLS.set(symbol, "Symbol." + name);
|
|
14
|
+
}
|
|
15
|
+
return KNOWN_SYMBOLS;
|
|
16
|
+
})(), KNOWN_FUNCTIONS = new Map([
|
|
17
|
+
[AggregateError, "AggregateError"],
|
|
18
|
+
[Array, "Array"],
|
|
19
|
+
[Array.from, "Array.from"],
|
|
20
|
+
[Array.isArray, "Array.isArray"],
|
|
21
|
+
[Array.of, "Array.of"],
|
|
22
|
+
[ArrayBuffer, "ArrayBuffer"],
|
|
23
|
+
[ArrayBuffer.isView, "ArrayBuffer.isView"],
|
|
24
|
+
[Atomics.add, "Atomics.add"],
|
|
25
|
+
[Atomics.and, "Atomics.and"],
|
|
26
|
+
[Atomics.compareExchange, "Atomics.compareExchange"],
|
|
27
|
+
[Atomics.exchange, "Atomics.exchange"],
|
|
28
|
+
[Atomics.isLockFree, "Atomics.isLockFree"],
|
|
29
|
+
[Atomics.load, "Atomics.load"],
|
|
30
|
+
[Atomics.notify, "Atomics.notify"],
|
|
31
|
+
[Atomics.or, "Atomics.or"],
|
|
32
|
+
[Atomics.store, "Atomics.store"],
|
|
33
|
+
[Atomics.sub, "Atomics.sub"],
|
|
34
|
+
[Atomics.wait, "Atomics.wait"],
|
|
35
|
+
[BigInt, "BigInt"],
|
|
36
|
+
[BigInt.asIntN, "BigInt.asIntN"],
|
|
37
|
+
[BigInt.asUintN, "BigInt.asUintN"],
|
|
38
|
+
[BigInt64Array, "BigInt64Array"],
|
|
39
|
+
[BigInt64Array.from, "BigInt64Array.from"],
|
|
40
|
+
[BigInt64Array.of, "BigInt64Array.of"],
|
|
41
|
+
[BigUint64Array, "BigUint64Array"],
|
|
42
|
+
[BigUint64Array.from, "BigUint64Array.from"],
|
|
43
|
+
[BigUint64Array.of, "BigUint64Array.of"],
|
|
44
|
+
[Boolean, "Boolean"],
|
|
45
|
+
[console.assert, "console.assert"],
|
|
46
|
+
[console.clear, "console.clear"],
|
|
47
|
+
[console.count, "console.count"],
|
|
48
|
+
[console.countReset, "console.countReset"],
|
|
49
|
+
[console.debug, "console.debug"],
|
|
50
|
+
[console.dir, "console.dir"],
|
|
51
|
+
[console.dirxml, "console.dirxml"],
|
|
52
|
+
[console.error, "console.error"],
|
|
53
|
+
[console.group, "console.group"],
|
|
54
|
+
[console.groupCollapsed, "console.groupCollapsed"],
|
|
55
|
+
[console.groupEnd, "console.groupEnd"],
|
|
56
|
+
[console.info, "console.info"],
|
|
57
|
+
[console.log, "console.log"],
|
|
58
|
+
[console.table, "console.table"],
|
|
59
|
+
[console.time, "console.time"],
|
|
60
|
+
[console.timeEnd, "console.timeEnd"],
|
|
61
|
+
[console.timeLog, "console.timeLog"],
|
|
62
|
+
[console.timeStamp, "console.timeStamp"],
|
|
63
|
+
[console.trace, "console.trace"],
|
|
64
|
+
[console.warn, "console.warn"],
|
|
65
|
+
[DataView, "DataView"],
|
|
66
|
+
[Date, "Date"],
|
|
67
|
+
[Date.now, "Date.now"],
|
|
68
|
+
[Date.parse, "Date.parse"],
|
|
69
|
+
[Date.UTC, "Date.UTC"],
|
|
70
|
+
[decodeURI, "decodeURI"],
|
|
71
|
+
[decodeURIComponent, "decodeURIComponent"],
|
|
72
|
+
[encodeURI, "encodeURI"],
|
|
73
|
+
[encodeURIComponent, "encodeURIComponent"],
|
|
74
|
+
[Error, "Error"],
|
|
75
|
+
[EvalError, "EvalError"],
|
|
76
|
+
[Float32Array, "Float32Array"],
|
|
77
|
+
[Float32Array.from, "Float32Array.from"],
|
|
78
|
+
[Float32Array.of, "Float32Array.of"],
|
|
79
|
+
[Float64Array, "Float64Array"],
|
|
80
|
+
[Float64Array.from, "Float64Array.from"],
|
|
81
|
+
[Float64Array.of, "Float64Array.of"],
|
|
82
|
+
[Function, "Function"],
|
|
83
|
+
[globalThis.atob, "atob"],
|
|
84
|
+
[globalThis.btoa, "btoa"],
|
|
85
|
+
[globalThis.clearImmediate, "clearImmediate"],
|
|
86
|
+
[globalThis.clearInterval, "clearInterval"],
|
|
87
|
+
[globalThis.clearTimeout, "clearTimeout"],
|
|
88
|
+
[globalThis.crypto?.getRandomValues, "crypto.getRandomValues"],
|
|
89
|
+
[globalThis.crypto?.randomUUID, "crypto.randomUUID"],
|
|
90
|
+
[globalThis.fetch, "fetch"],
|
|
91
|
+
[globalThis.performance?.now, "performance.now"],
|
|
92
|
+
[globalThis.queueMicrotask, "queueMicrotask"],
|
|
93
|
+
[globalThis.setImmediate, "setImmediate"],
|
|
94
|
+
[globalThis.setInterval, "setInterval"],
|
|
95
|
+
[globalThis.setTimeout, "setTimeout"],
|
|
96
|
+
[globalThis.structuredClone, "structuredClone"],
|
|
97
|
+
[globalThis.URL, "URL"],
|
|
98
|
+
[globalThis.URLSearchParams, "URLSearchParams"],
|
|
99
|
+
[globalThis.WritableStream, "WritableStream"],
|
|
100
|
+
[Int16Array, "Int16Array"],
|
|
101
|
+
[Int16Array.from, "Int16Array.from"],
|
|
102
|
+
[Int16Array.of, "Int16Array.of"],
|
|
103
|
+
[Int32Array, "Int32Array"],
|
|
104
|
+
[Int32Array.from, "Int32Array.from"],
|
|
105
|
+
[Int32Array.of, "Int32Array.of"],
|
|
106
|
+
[Int8Array, "Int8Array"],
|
|
107
|
+
[Int8Array.from, "Int8Array.from"],
|
|
108
|
+
[Int8Array.of, "Int8Array.of"],
|
|
109
|
+
[Intl.Collator, "Intl.Collator"],
|
|
110
|
+
[Intl.DateTimeFormat, "Intl.DateTimeFormat"],
|
|
111
|
+
[Intl.DisplayNames, "Intl.DisplayNames"],
|
|
112
|
+
[Intl.getCanonicalLocales, "Intl.getCanonicalLocales"],
|
|
113
|
+
[Intl.ListFormat, "Intl.ListFormat"],
|
|
114
|
+
[Intl.Locale, "Intl.Locale"],
|
|
115
|
+
[Intl.NumberFormat, "Intl.NumberFormat"],
|
|
116
|
+
[Intl.PluralRules, "Intl.PluralRules"],
|
|
117
|
+
[Intl.RelativeTimeFormat, "Intl.RelativeTimeFormat"],
|
|
118
|
+
[Intl.Segmenter, "Intl.Segmenter"],
|
|
119
|
+
[Intl.supportedValuesOf, "Intl.supportedValuesOf"],
|
|
120
|
+
[isFinite, "isFinite"],
|
|
121
|
+
[isNaN, "isNaN"],
|
|
122
|
+
[JSON.parse, "JSON.parse"],
|
|
123
|
+
[JSON.stringify, "JSON.stringify"],
|
|
124
|
+
[Map, "Map"],
|
|
125
|
+
[Map.groupBy, "Map.groupBy"],
|
|
126
|
+
[Math.abs, "Math.abs"],
|
|
127
|
+
[Math.acos, "Math.acos"],
|
|
128
|
+
[Math.acosh, "Math.acosh"],
|
|
129
|
+
[Math.asin, "Math.asin"],
|
|
130
|
+
[Math.asinh, "Math.asinh"],
|
|
131
|
+
[Math.atan, "Math.atan"],
|
|
132
|
+
[Math.atan2, "Math.atan2"],
|
|
133
|
+
[Math.atanh, "Math.atanh"],
|
|
134
|
+
[Math.cbrt, "Math.cbrt"],
|
|
135
|
+
[Math.ceil, "Math.ceil"],
|
|
136
|
+
[Math.clz32, "Math.clz32"],
|
|
137
|
+
[Math.cos, "Math.cos"],
|
|
138
|
+
[Math.cosh, "Math.cosh"],
|
|
139
|
+
[Math.exp, "Math.exp"],
|
|
140
|
+
[Math.expm1, "Math.expm1"],
|
|
141
|
+
[Math.floor, "Math.floor"],
|
|
142
|
+
[Math.fround, "Math.fround"],
|
|
143
|
+
[Math.hypot, "Math.hypot"],
|
|
144
|
+
[Math.imul, "Math.imul"],
|
|
145
|
+
[Math.log, "Math.log"],
|
|
146
|
+
[Math.log10, "Math.log10"],
|
|
147
|
+
[Math.log1p, "Math.log1p"],
|
|
148
|
+
[Math.log2, "Math.log2"],
|
|
149
|
+
[Math.max, "Math.max"],
|
|
150
|
+
[Math.min, "Math.min"],
|
|
151
|
+
[Math.pow, "Math.pow"],
|
|
152
|
+
[Math.random, "Math.random"],
|
|
153
|
+
[Math.round, "Math.round"],
|
|
154
|
+
[Math.sign, "Math.sign"],
|
|
155
|
+
[Math.sin, "Math.sin"],
|
|
156
|
+
[Math.sinh, "Math.sinh"],
|
|
157
|
+
[Math.sqrt, "Math.sqrt"],
|
|
158
|
+
[Math.tan, "Math.tan"],
|
|
159
|
+
[Math.tanh, "Math.tanh"],
|
|
160
|
+
[Math.trunc, "Math.trunc"],
|
|
161
|
+
[Number, "Number"],
|
|
162
|
+
[Number.isFinite, "Number.isFinite"],
|
|
163
|
+
[Number.isInteger, "Number.isInteger"],
|
|
164
|
+
[Number.isNaN, "Number.isNaN"],
|
|
165
|
+
[Number.isSafeInteger, "Number.isSafeInteger"],
|
|
166
|
+
[Number.parseFloat, "Number.parseFloat"],
|
|
167
|
+
[Number.parseInt, "Number.parseInt"],
|
|
168
|
+
[Object, "Object"],
|
|
169
|
+
[Object.assign, "Object.assign"],
|
|
170
|
+
[Object.create, "Object.create"],
|
|
171
|
+
[Object.defineProperties, "Object.defineProperties"],
|
|
172
|
+
[Object.defineProperty, "Object.defineProperty"],
|
|
173
|
+
[Object.entries, "Object.entries"],
|
|
174
|
+
[Object.freeze, "Object.freeze"],
|
|
175
|
+
[Object.fromEntries, "Object.fromEntries"],
|
|
176
|
+
[Object.getOwnPropertyDescriptor, "Object.getOwnPropertyDescriptor"],
|
|
177
|
+
[Object.getOwnPropertyDescriptors, "Object.getOwnPropertyDescriptors"],
|
|
178
|
+
[Object.getOwnPropertyNames, "Object.getOwnPropertyNames"],
|
|
179
|
+
[Object.getOwnPropertySymbols, "Object.getOwnPropertySymbols"],
|
|
180
|
+
[Object.getPrototypeOf, "Object.getPrototypeOf"],
|
|
181
|
+
[Object.is, "Object.is"],
|
|
182
|
+
[Object.isExtensible, "Object.isExtensible"],
|
|
183
|
+
[Object.isFrozen, "Object.isFrozen"],
|
|
184
|
+
[Object.isSealed, "Object.isSealed"],
|
|
185
|
+
[Object.keys, "Object.keys"],
|
|
186
|
+
[Object.preventExtensions, "Object.preventExtensions"],
|
|
187
|
+
[Object.seal, "Object.seal"],
|
|
188
|
+
[Object.setPrototypeOf, "Object.setPrototypeOf"],
|
|
189
|
+
[Object.values, "Object.values"],
|
|
190
|
+
[parseFloat, "parseFloat"],
|
|
191
|
+
[parseInt, "parseInt"],
|
|
192
|
+
[Promise, "Promise"],
|
|
193
|
+
[Proxy, "Proxy"],
|
|
194
|
+
[RangeError, "RangeError"],
|
|
195
|
+
[ReferenceError, "ReferenceError"],
|
|
196
|
+
[Reflect.apply, "Reflect.apply"],
|
|
197
|
+
[Reflect.construct, "Reflect.construct"],
|
|
198
|
+
[Reflect.defineProperty, "Reflect.defineProperty"],
|
|
199
|
+
[Reflect.deleteProperty, "Reflect.deleteProperty"],
|
|
200
|
+
[Reflect.get, "Reflect.get"],
|
|
201
|
+
[Reflect.getOwnPropertyDescriptor, "Reflect.getOwnPropertyDescriptor"],
|
|
202
|
+
[Reflect.getPrototypeOf, "Reflect.getPrototypeOf"],
|
|
203
|
+
[Reflect.has, "Reflect.has"],
|
|
204
|
+
[Reflect.isExtensible, "Reflect.isExtensible"],
|
|
205
|
+
[Reflect.ownKeys, "Reflect.ownKeys"],
|
|
206
|
+
[Reflect.preventExtensions, "Reflect.preventExtensions"],
|
|
207
|
+
[Reflect.set, "Reflect.set"],
|
|
208
|
+
[Reflect.setPrototypeOf, "Reflect.setPrototypeOf"],
|
|
209
|
+
[RegExp, "RegExp"],
|
|
210
|
+
[Set, "Set"],
|
|
211
|
+
[String, "String"],
|
|
212
|
+
[String.fromCharCode, "String.fromCharCode"],
|
|
213
|
+
[String.fromCodePoint, "String.fromCodePoint"],
|
|
214
|
+
[String.raw, "String.raw"],
|
|
215
|
+
[Symbol, "Symbol"],
|
|
216
|
+
[Symbol.for, "Symbol.for"],
|
|
217
|
+
[SyntaxError, "SyntaxError"],
|
|
218
|
+
[TypeError, "TypeError"],
|
|
219
|
+
[Uint16Array, "Uint16Array"],
|
|
220
|
+
[Uint16Array.from, "Uint16Array.from"],
|
|
221
|
+
[Uint16Array.of, "Uint16Array.of"],
|
|
222
|
+
[Uint32Array, "Uint32Array"],
|
|
223
|
+
[Uint32Array.from, "Uint32Array.from"],
|
|
224
|
+
[Uint32Array.of, "Uint32Array.of"],
|
|
225
|
+
[Uint8Array, "Uint8Array"],
|
|
226
|
+
[Uint8Array.from, "Uint8Array.from"],
|
|
227
|
+
[Uint8Array.of, "Uint8Array.of"],
|
|
228
|
+
[Uint8ClampedArray, "Uint8ClampedArray"],
|
|
229
|
+
[Uint8ClampedArray.from, "Uint8ClampedArray.from"],
|
|
230
|
+
[Uint8ClampedArray.of, "Uint8ClampedArray.of"],
|
|
231
|
+
[URIError, "URIError"],
|
|
232
|
+
[WeakMap, "WeakMap"],
|
|
233
|
+
[WeakSet, "WeakSet"]
|
|
234
|
+
]), KNOWN_OBJECTS = new Map([
|
|
235
|
+
[Atomics, "Atomics"],
|
|
236
|
+
[console, "console"],
|
|
237
|
+
[globalThis, "globalThis"],
|
|
238
|
+
[globalThis.crypto, "crypto"],
|
|
239
|
+
[Intl, "Intl"],
|
|
240
|
+
[JSON, "JSON"],
|
|
241
|
+
[Math, "Math"],
|
|
242
|
+
[Reflect, "Reflect"]
|
|
243
|
+
]), State$1 = class {
|
|
244
|
+
ids = 0;
|
|
245
|
+
flush = 0;
|
|
246
|
+
registerInstanceId = 0;
|
|
247
|
+
flushed = !1;
|
|
248
|
+
wroteUndefined = !1;
|
|
249
|
+
buf = [];
|
|
250
|
+
strs = /* @__PURE__ */ new Map();
|
|
251
|
+
refs = /* @__PURE__ */ new WeakMap();
|
|
252
|
+
assigned = /* @__PURE__ */ new Set();
|
|
253
|
+
registered = [];
|
|
254
|
+
boundary = void 0;
|
|
255
|
+
mutated = [];
|
|
256
|
+
}, Reference = class {
|
|
257
|
+
registered = null;
|
|
258
|
+
assigns = null;
|
|
259
|
+
constructor(parent, accessor, flush, pos = null, id = null) {
|
|
260
|
+
this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id, this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id;
|
|
261
|
+
}
|
|
262
|
+
}, Serializer = class {
|
|
263
|
+
#state = new State$1();
|
|
264
|
+
get flushed() {
|
|
265
|
+
return this.#state.flushed;
|
|
266
|
+
}
|
|
267
|
+
stringify(val, boundary) {
|
|
268
|
+
try {
|
|
269
|
+
return this.#state.flushed = !1, this.#state.boundary = boundary, writeRoot(this.#state, val);
|
|
270
|
+
} finally {
|
|
271
|
+
this.#state.flush++, this.#state.buf = [];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
nextId() {
|
|
275
|
+
return nextId(this.#state);
|
|
276
|
+
}
|
|
277
|
+
symbol(id) {
|
|
278
|
+
let symbol = Symbol();
|
|
279
|
+
return this.#state.refs.set(symbol, new Reference(null, null, 0, null, id)), symbol;
|
|
280
|
+
}
|
|
281
|
+
writeCall(value, object, property, spread) {
|
|
282
|
+
let state = this.#state;
|
|
283
|
+
state.mutated.push({
|
|
284
|
+
type: 0,
|
|
285
|
+
value,
|
|
286
|
+
object,
|
|
287
|
+
property,
|
|
288
|
+
spread
|
|
289
|
+
}), state.flushed = !0;
|
|
290
|
+
}
|
|
291
|
+
writeAssign(value, object, property) {
|
|
292
|
+
let state = this.#state;
|
|
293
|
+
state.mutated.push({
|
|
294
|
+
type: 1,
|
|
295
|
+
value,
|
|
296
|
+
object,
|
|
297
|
+
property
|
|
298
|
+
}), state.flushed = !0;
|
|
299
|
+
}
|
|
300
|
+
register(id, val, scope) {
|
|
301
|
+
return register(id, val, scope, scope ? ++this.#state.registerInstanceId : 0);
|
|
302
|
+
}
|
|
303
|
+
}, $chunk, NOOP$2 = () => {}, K_SCOPE_ID = Symbol("Scope ID"), K_SCOPE_REFERENCED = Symbol("Scope Referenced"), Mark = /* @__PURE__ */ function(Mark) {
|
|
304
|
+
return Mark.Placeholder = "!^", Mark.PlaceholderEnd = "!", Mark.ReorderMarker = "#", Mark;
|
|
305
|
+
}(Mark || {}), RuntimeKey = /* @__PURE__ */ function(RuntimeKey) {
|
|
306
|
+
return RuntimeKey.Walk = ".w", RuntimeKey.Resume = ".r", RuntimeKey.Blocking = ".b", RuntimeKey.Scripts = ".j", RuntimeKey;
|
|
307
|
+
}(RuntimeKey || {}), kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope), State = class {
|
|
308
|
+
tagId = 1;
|
|
309
|
+
scopeId = 1;
|
|
310
|
+
reorderId = 1;
|
|
311
|
+
lastSerializedScopeId = this.scopeId;
|
|
312
|
+
hasGlobals = !1;
|
|
313
|
+
needsMainRuntime = !1;
|
|
314
|
+
hasMainRuntime = !1;
|
|
315
|
+
hasReorderRuntime = !1;
|
|
316
|
+
hasWrittenResume = !1;
|
|
317
|
+
walkOnNextFlush = !1;
|
|
318
|
+
trailerHTML = "";
|
|
319
|
+
resumes = "";
|
|
320
|
+
nonceAttr = "";
|
|
321
|
+
serializer = new Serializer();
|
|
322
|
+
writeReorders = null;
|
|
323
|
+
scopes = /* @__PURE__ */ new Map();
|
|
324
|
+
writeScopes = null;
|
|
325
|
+
ensureReady = null;
|
|
326
|
+
serializeReason;
|
|
327
|
+
constructor($global) {
|
|
328
|
+
this.$global = $global, this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
329
|
+
}
|
|
330
|
+
get runtimePrefix() {
|
|
331
|
+
let { $global } = this;
|
|
332
|
+
return $global.runtimeId + "." + $global.renderId;
|
|
333
|
+
}
|
|
334
|
+
get commentPrefix() {
|
|
335
|
+
let { $global } = this;
|
|
336
|
+
return $global.runtimeId + $global.renderId;
|
|
337
|
+
}
|
|
338
|
+
reorder(chunk) {
|
|
339
|
+
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
340
|
+
}
|
|
341
|
+
nextReorderId() {
|
|
342
|
+
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
343
|
+
for (n = n / 54 | 0; n; n >>>= 6) r += c[n & 63];
|
|
344
|
+
return r;
|
|
345
|
+
}
|
|
346
|
+
mark(code, str) {
|
|
347
|
+
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
348
|
+
}
|
|
349
|
+
}, Boundary = class extends AbortController {
|
|
350
|
+
onNext = NOOP$2;
|
|
351
|
+
count = 0;
|
|
352
|
+
constructor(state, parent) {
|
|
353
|
+
super(), this.state = state, this.state = state, this.signal.addEventListener("abort", () => {
|
|
354
|
+
this.count = 0, this.state = new State(this.state.$global), this.onNext();
|
|
355
|
+
}), parent && (parent.aborted ? this.abort(parent.reason) : parent.addEventListener("abort", () => {
|
|
356
|
+
this.abort(parent.reason);
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
flush() {
|
|
360
|
+
return this.signal.aborted || flushSerializer(this), this.count ? 1 : this.signal.aborted ? 2 : 0;
|
|
361
|
+
}
|
|
362
|
+
startAsync() {
|
|
363
|
+
this.signal.aborted || this.count++;
|
|
364
|
+
}
|
|
365
|
+
endAsync(chunk) {
|
|
366
|
+
!this.signal.aborted && this.count && (this.count--, chunk?.reorderId && this.state.reorder(chunk), this.onNext());
|
|
367
|
+
}
|
|
368
|
+
}, Chunk = class {
|
|
369
|
+
html = "";
|
|
370
|
+
scripts = "";
|
|
371
|
+
effects = "";
|
|
372
|
+
lastEffect = "";
|
|
373
|
+
async = !1;
|
|
374
|
+
consumed = !1;
|
|
375
|
+
needsWalk = !1;
|
|
376
|
+
reorderId = null;
|
|
377
|
+
placeholderBody = null;
|
|
378
|
+
placeholderRender = null;
|
|
379
|
+
placeholderBranchId = null;
|
|
380
|
+
constructor(boundary, next, context) {
|
|
381
|
+
this.boundary = boundary, this.next = next, this.context = context, this.boundary = boundary, this.next = next, this.context = context;
|
|
382
|
+
}
|
|
383
|
+
writeHTML(html) {
|
|
384
|
+
this.html += html;
|
|
385
|
+
}
|
|
386
|
+
writeEffect(scopeId, registryId) {
|
|
387
|
+
this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
388
|
+
}
|
|
389
|
+
writeScript(script) {
|
|
390
|
+
this.scripts = concatScripts(this.scripts, script);
|
|
391
|
+
}
|
|
392
|
+
append(chunk) {
|
|
393
|
+
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
394
|
+
}
|
|
395
|
+
flushPlaceholder() {
|
|
396
|
+
if (this.placeholderBody) {
|
|
397
|
+
let body = this.placeholderBody.consume();
|
|
398
|
+
if (body.async) {
|
|
399
|
+
let { state } = this.boundary, reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
400
|
+
this.placeholderBranchId = null, this.writeHTML(state.mark("!^", reorderId));
|
|
401
|
+
let after = this.render(this.placeholderRender);
|
|
402
|
+
after !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), after.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
403
|
+
} else body.next = this.next, this.next = body;
|
|
404
|
+
this.placeholderRender = this.placeholderBody = null;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
consume() {
|
|
408
|
+
let cur = this, needsWalk = cur.needsWalk;
|
|
409
|
+
if (cur.next && !cur.async) {
|
|
410
|
+
let html = "", effects = "", scripts = "", lastEffect = "";
|
|
411
|
+
do
|
|
412
|
+
cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
|
|
413
|
+
while (cur.next && !cur.async);
|
|
414
|
+
cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
|
|
415
|
+
}
|
|
416
|
+
return cur;
|
|
417
|
+
}
|
|
418
|
+
render(content, val) {
|
|
419
|
+
let prev = $chunk;
|
|
420
|
+
$chunk = this;
|
|
421
|
+
try {
|
|
422
|
+
return content(val), $chunk;
|
|
423
|
+
} catch (err) {
|
|
424
|
+
return this.boundary.abort(err), this;
|
|
425
|
+
} finally {
|
|
426
|
+
$chunk = prev;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
flushScript() {
|
|
430
|
+
let { boundary, effects } = this, { state } = boundary, { $global, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
|
|
431
|
+
if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(scripts, "(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}}),self[e]))(\"" + $global.runtimeId + "\")(\"" + $global.renderId + "\")")), state.ensureReady && state.hasMainRuntime) {
|
|
432
|
+
let first = !0;
|
|
433
|
+
for (let id in state.ensureReady) state.ensureReady[id] && (state.ensureReady[id] = 0, scripts = first ? concatScripts(scripts, "(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1") : concatScripts(scripts, runtimePrefix + ".b" + toAccess(toObjectKey(id)) + "=1")), first = !1;
|
|
434
|
+
}
|
|
435
|
+
if (effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\""), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]"))), state.writeReorders) {
|
|
436
|
+
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector(\"style[\"+e.i+\"]\")||\"\"),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
|
|
437
|
+
for (let reorderedChunk of state.writeReorders) {
|
|
438
|
+
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
439
|
+
for (reorderedChunk.reorderId = null;;) {
|
|
440
|
+
cur.flushPlaceholder();
|
|
441
|
+
let { next } = cur;
|
|
442
|
+
if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next) cur = next;
|
|
443
|
+
else break;
|
|
444
|
+
}
|
|
445
|
+
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")), scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
446
|
+
}
|
|
447
|
+
state.writeReorders = null;
|
|
448
|
+
}
|
|
449
|
+
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
|
|
450
|
+
}
|
|
451
|
+
flushHTML() {
|
|
452
|
+
let { boundary } = this, { state } = boundary;
|
|
453
|
+
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
454
|
+
let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
|
|
455
|
+
return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), boundary.count || (html += state.trailerHTML), html;
|
|
456
|
+
}
|
|
457
|
+
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g, SET_SCOPE_REGISTER_ID = "$C_s", voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
458
|
+
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
459
|
+
if (typeof renderer == "string") {
|
|
460
|
+
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
461
|
+
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
462
|
+
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
463
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange));
|
|
464
|
+
else if (renderContent) {
|
|
465
|
+
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
466
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
467
|
+
}
|
|
468
|
+
_html(`</${renderer}>`);
|
|
469
|
+
}
|
|
470
|
+
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
471
|
+
needsScript && (childScope.R = renderer, _script(branchId, "d")), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
472
|
+
} else {
|
|
473
|
+
shouldResume && _html(state.mark("[", ""));
|
|
474
|
+
let render = () => {
|
|
475
|
+
if (renderer) try {
|
|
476
|
+
return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
|
|
477
|
+
...inputOrArgs,
|
|
478
|
+
content
|
|
479
|
+
} : inputOrArgs);
|
|
480
|
+
} finally {
|
|
481
|
+
_set_serialize_reason(void 0);
|
|
482
|
+
}
|
|
483
|
+
else if (content) return content();
|
|
484
|
+
};
|
|
485
|
+
result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, shouldResume && _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : "")));
|
|
486
|
+
}
|
|
487
|
+
return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: renderer?.a || renderer }) : _scope_id(), result;
|
|
488
|
+
}, patchDynamicTag = ((originalDynamicTag) => (patch) => {
|
|
489
|
+
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
490
|
+
let patched = patch(tag, scopeId, accessor);
|
|
491
|
+
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
492
|
+
};
|
|
493
|
+
})(_dynamic_tag), K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
494
|
+
$global,
|
|
495
|
+
fork: _await,
|
|
496
|
+
write: _html,
|
|
497
|
+
writeScript,
|
|
498
|
+
nextScopeId: _scope_id,
|
|
499
|
+
peekNextScopeId: _peek_scope_id,
|
|
500
|
+
isInResumedBranch,
|
|
501
|
+
ensureState($global) {
|
|
502
|
+
let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
503
|
+
return state || ($global.runtimeId ||= "M", $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_", $global[K_TAGS_API_STATE] = state = new State($global)), state;
|
|
504
|
+
},
|
|
505
|
+
isTagsAPI(fn) {
|
|
506
|
+
return !!fn.a;
|
|
507
|
+
},
|
|
508
|
+
onFlush(fn) {
|
|
509
|
+
let { flushHTML } = Chunk.prototype;
|
|
510
|
+
Chunk.prototype.flushHTML = function() {
|
|
511
|
+
return fn(this), flushHTML.call(this);
|
|
512
|
+
};
|
|
513
|
+
},
|
|
514
|
+
patchDynamicTag,
|
|
515
|
+
writeSetScopeForComponent(branchId, m5c, m5i) {
|
|
516
|
+
writeScope(branchId, {
|
|
517
|
+
m5c,
|
|
518
|
+
m5i
|
|
519
|
+
}), _script(branchId, SET_SCOPE_REGISTER_ID);
|
|
520
|
+
},
|
|
521
|
+
toJSON(state) {
|
|
522
|
+
return function() {
|
|
523
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
524
|
+
if (!compatRegistered) {
|
|
525
|
+
let registered = getRegistered(this);
|
|
526
|
+
if (registered) {
|
|
527
|
+
let scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
528
|
+
scopeId !== void 0 && writeScopeToState(state, scopeId, {}), COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return compatRegistered;
|
|
532
|
+
};
|
|
533
|
+
},
|
|
534
|
+
flushScript($global) {
|
|
535
|
+
let boundary = new Boundary(this.ensureState($global));
|
|
536
|
+
if (boundary.flush() === 1) throw Error("Cannot serialize promise across tags/class compat layer.");
|
|
537
|
+
return new Chunk(boundary, null, null).flushScript().scripts;
|
|
538
|
+
},
|
|
539
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
|
540
|
+
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(boundary, null, null), normalizedInput = input;
|
|
541
|
+
if ("renderBody" in input) {
|
|
542
|
+
normalizedInput = {};
|
|
543
|
+
for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
544
|
+
}
|
|
545
|
+
head.render(() => {
|
|
546
|
+
if (willRerender) {
|
|
547
|
+
let scopeId = _peek_scope_id();
|
|
548
|
+
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
549
|
+
}
|
|
550
|
+
_set_serialize_reason(+!!willRerender);
|
|
551
|
+
try {
|
|
552
|
+
renderer(normalizedInput);
|
|
553
|
+
} finally {
|
|
554
|
+
_set_serialize_reason(void 0);
|
|
555
|
+
}
|
|
556
|
+
let asyncOut = classAPIOut.beginAsync({
|
|
557
|
+
last: !0,
|
|
558
|
+
timeout: -1
|
|
559
|
+
});
|
|
560
|
+
classAPIOut.onLast((next) => {
|
|
561
|
+
(boundary.onNext = () => {
|
|
562
|
+
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP$1) : boundary.count || (boundary.onNext = NOOP$1, head = head.consume(), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "", completeChunks.push(head), next());
|
|
563
|
+
})();
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
},
|
|
567
|
+
registerRenderer(renderer, id) {
|
|
568
|
+
return register("$C_r", renderer, register(id, () => {}));
|
|
569
|
+
},
|
|
570
|
+
registerRenderBody(fn) {
|
|
571
|
+
register("$C_b", fn);
|
|
572
|
+
}
|
|
573
|
+
}, _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), ServerRendered = class {
|
|
574
|
+
#head;
|
|
575
|
+
#cachedPromise = null;
|
|
576
|
+
constructor(head) {
|
|
577
|
+
this.#head = head;
|
|
578
|
+
}
|
|
579
|
+
[Symbol.asyncIterator]() {
|
|
580
|
+
let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read((html) => {
|
|
581
|
+
value += html, resolve && (resolve({
|
|
582
|
+
value,
|
|
583
|
+
done
|
|
584
|
+
}), value = "");
|
|
585
|
+
}, (err) => {
|
|
586
|
+
aborted = !0, reason = err, reject && reject(err);
|
|
587
|
+
}, () => {
|
|
588
|
+
done = !0, resolve && (resolve({
|
|
589
|
+
value,
|
|
590
|
+
done: !value
|
|
591
|
+
}), value = "");
|
|
592
|
+
});
|
|
593
|
+
return {
|
|
594
|
+
next() {
|
|
595
|
+
if (aborted) return Promise.reject(reason);
|
|
596
|
+
if (value) {
|
|
597
|
+
let result = {
|
|
598
|
+
value,
|
|
599
|
+
done: !1
|
|
600
|
+
};
|
|
601
|
+
return value = "", Promise.resolve(result);
|
|
602
|
+
} else if (done) return Promise.resolve({
|
|
603
|
+
value: "",
|
|
604
|
+
done
|
|
605
|
+
});
|
|
606
|
+
else return new Promise(exec);
|
|
607
|
+
},
|
|
608
|
+
throw(error) {
|
|
609
|
+
return done || aborted || boundary?.abort(error), Promise.resolve({
|
|
610
|
+
value: "",
|
|
611
|
+
done: !0
|
|
612
|
+
});
|
|
613
|
+
},
|
|
614
|
+
return(value) {
|
|
615
|
+
return done || aborted || boundary?.abort(/* @__PURE__ */ Error("Iterator returned before consumed.")), Promise.resolve({
|
|
616
|
+
value,
|
|
617
|
+
done: !0
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
function exec(_resolve, _reject) {
|
|
622
|
+
resolve = _resolve, reject = _reject;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
pipe(stream) {
|
|
626
|
+
this.#read((html) => {
|
|
627
|
+
stream.write(html);
|
|
628
|
+
}, (err) => {
|
|
629
|
+
let socket = "socket" in stream && stream.socket;
|
|
630
|
+
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err)) throw err;
|
|
631
|
+
}, () => {
|
|
632
|
+
stream.end();
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
toReadable() {
|
|
636
|
+
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
637
|
+
return new ReadableStream({
|
|
638
|
+
start: (ctrl) => {
|
|
639
|
+
boundary = this.#read((html) => {
|
|
640
|
+
ctrl.enqueue(encoder.encode(html));
|
|
641
|
+
}, (err) => {
|
|
642
|
+
boundary = void 0, cancelled || ctrl.error(err);
|
|
643
|
+
}, () => {
|
|
644
|
+
boundary = void 0, ctrl.close();
|
|
645
|
+
});
|
|
646
|
+
},
|
|
647
|
+
cancel: (reason) => {
|
|
648
|
+
cancelled = !0, boundary?.abort(reason);
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
then(onfulfilled, onrejected) {
|
|
653
|
+
return this.#promise().then(onfulfilled, onrejected);
|
|
654
|
+
}
|
|
655
|
+
catch(onrejected) {
|
|
656
|
+
return this.#promise().catch(onrejected);
|
|
657
|
+
}
|
|
658
|
+
finally(onfinally) {
|
|
659
|
+
return this.#promise().finally(onfinally);
|
|
660
|
+
}
|
|
661
|
+
#promise() {
|
|
662
|
+
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
663
|
+
let head = this.#head;
|
|
664
|
+
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
665
|
+
let { boundary } = head;
|
|
666
|
+
(boundary.onNext = () => {
|
|
667
|
+
switch (!boundary.count && boundary.flush()) {
|
|
668
|
+
case 2:
|
|
669
|
+
boundary.onNext = NOOP, reject(boundary.signal.reason);
|
|
670
|
+
break;
|
|
671
|
+
case 0:
|
|
672
|
+
resolve(head.consume().flushHTML());
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
})();
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
#read(onWrite, onAbort, onClose) {
|
|
679
|
+
let tick = !0, head = this.#head;
|
|
680
|
+
if (this.#head = null, !head) {
|
|
681
|
+
onAbort(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
685
|
+
let status = boundary.flush();
|
|
686
|
+
if (status === 2) tick || offTick(onNext), boundary.onNext = NOOP, onAbort(boundary.signal.reason);
|
|
687
|
+
else if (write || status === 0) {
|
|
688
|
+
let html = (head = head.consume()).flushHTML();
|
|
689
|
+
html && onWrite(html), status === 0 ? (tick || offTick(onNext), onClose()) : tick = !0;
|
|
690
|
+
} else tick && (tick = !1, queueTick(onNext));
|
|
691
|
+
};
|
|
692
|
+
return onNext(), boundary;
|
|
693
|
+
}
|
|
694
|
+
toString() {
|
|
695
|
+
let head = this.#head;
|
|
696
|
+
if (this.#head = null, !head) throw Error("Cannot read from a consumed render result");
|
|
697
|
+
let { boundary } = head;
|
|
698
|
+
switch (boundary.flush()) {
|
|
699
|
+
case 2: throw boundary.signal.reason;
|
|
700
|
+
case 1: throw Error("Cannot consume asynchronous render with 'toString'");
|
|
701
|
+
}
|
|
702
|
+
return head.consume().flushHTML();
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
//#region src/common/attr-tag.ts
|
|
3
706
|
function attrTag(attrs) {
|
|
4
|
-
|
|
707
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
5
708
|
}
|
|
6
709
|
function attrTags(first, attrs) {
|
|
7
|
-
|
|
710
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
|
8
711
|
}
|
|
9
712
|
function* attrTagIterator() {
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function _el_read_error() {
|
|
15
|
-
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/common/helpers.ts
|
|
22
|
-
function classValue(classValue2) {
|
|
23
|
-
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
|
24
|
-
}
|
|
713
|
+
yield this, yield* this[rest];
|
|
714
|
+
}
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/common/errors.ts
|
|
717
|
+
function _el_read_error() {}
|
|
718
|
+
function _hoist_read_error() {}
|
|
719
|
+
function _assert_hoist(value) {}
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/common/helpers.ts
|
|
25
722
|
function stringifyClassObject(name, value) {
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
function styleValue(styleValue2) {
|
|
29
|
-
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
|
723
|
+
return value ? name : "";
|
|
30
724
|
}
|
|
31
725
|
function stringifyStyleObject(name, value) {
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
function toDelimitedString(val, delimiter, stringify) {
|
|
35
|
-
let str = "", sep = "", part;
|
|
36
|
-
if (val)
|
|
37
|
-
if (typeof val != "object")
|
|
38
|
-
str += val;
|
|
39
|
-
else if (Array.isArray(val))
|
|
40
|
-
for (let v of val)
|
|
41
|
-
part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
42
|
-
else
|
|
43
|
-
for (let name in val)
|
|
44
|
-
part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
45
|
-
return str;
|
|
726
|
+
return value || value === 0 ? name + ":" + value : "";
|
|
46
727
|
}
|
|
47
728
|
function isEventHandler(name) {
|
|
48
|
-
|
|
729
|
+
return /^on[A-Z-]/.test(name);
|
|
49
730
|
}
|
|
50
731
|
function getEventHandlerName(name) {
|
|
51
|
-
|
|
732
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
52
733
|
}
|
|
53
734
|
function isVoid(value) {
|
|
54
|
-
|
|
735
|
+
return value == null || value === !1;
|
|
55
736
|
}
|
|
56
737
|
function normalizeDynamicRenderer(value) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// src/html/content.ts
|
|
738
|
+
if (value) {
|
|
739
|
+
if (typeof value == "string") return value;
|
|
740
|
+
let normalized = value.content || value.default || value;
|
|
741
|
+
if ("a" in normalized) return normalized;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/html/content.ts
|
|
66
746
|
function _unescaped(val) {
|
|
67
|
-
|
|
747
|
+
return val ? val + "" : val === 0 ? "0" : "";
|
|
68
748
|
}
|
|
69
|
-
var unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
|
|
70
749
|
function _escape(val) {
|
|
71
|
-
|
|
750
|
+
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
72
751
|
}
|
|
73
|
-
var unsafeScriptReg = /<\/script/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
|
|
74
752
|
function _escape_script(val) {
|
|
75
|
-
|
|
753
|
+
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
76
754
|
}
|
|
77
|
-
var unsafeStyleReg = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
|
|
78
755
|
function _escape_style(val) {
|
|
79
|
-
|
|
756
|
+
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
80
757
|
}
|
|
81
|
-
var unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str;
|
|
82
758
|
function _escape_comment(val) {
|
|
83
|
-
|
|
759
|
+
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
84
760
|
}
|
|
85
|
-
|
|
86
|
-
|
|
761
|
+
//#endregion
|
|
762
|
+
//#region src/common/for.ts
|
|
87
763
|
function forIn(obj, cb) {
|
|
88
|
-
|
|
89
|
-
cb(key, obj[key]);
|
|
764
|
+
for (let key in obj) cb(key, obj[key]);
|
|
90
765
|
}
|
|
91
766
|
function forOf(list, cb) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
767
|
+
if (list) {
|
|
768
|
+
let i = 0;
|
|
769
|
+
for (let item of list) cb(item, i++);
|
|
770
|
+
}
|
|
97
771
|
}
|
|
98
772
|
function forTo(to, from, step, cb) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
cb(start + i * delta);
|
|
773
|
+
let start = from || 0, delta = step || 1;
|
|
774
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
|
|
102
775
|
}
|
|
103
776
|
function forUntil(until, from, step, cb) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
cb(start + i * delta);
|
|
777
|
+
let start = from || 0, delta = step || 1;
|
|
778
|
+
for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
|
|
107
779
|
}
|
|
108
|
-
|
|
109
|
-
|
|
780
|
+
//#endregion
|
|
781
|
+
//#region src/common/opt.ts
|
|
110
782
|
function push(opt, item) {
|
|
111
|
-
|
|
783
|
+
return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
|
|
112
784
|
}
|
|
113
|
-
|
|
114
|
-
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region src/html/for.ts
|
|
115
787
|
function forOfBy(by, item, index) {
|
|
116
|
-
|
|
788
|
+
return by ? typeof by == "string" ? item[by] : by(item, index) : index;
|
|
117
789
|
}
|
|
118
790
|
function forInBy(by, name, value) {
|
|
119
|
-
|
|
791
|
+
return by ? by(name, value) : name;
|
|
120
792
|
}
|
|
121
793
|
function forStepBy(by, index) {
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// src/html/inlined-runtimes.ts
|
|
126
|
-
var WALKER_RUNTIME_CODE = '(e=>(self[e]||(self[e]=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>"#"&&d.push(e)}}),self[e]))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),"#"==n?(t[a]=l).i++:"!"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):"T"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l["^"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})';
|
|
127
|
-
|
|
128
|
-
// src/html/serializer.ts
|
|
129
|
-
var kTouchedIterator = /* @__PURE__ */ Symbol(), { hasOwnProperty } = {}, Generator = (function* () {
|
|
130
|
-
})().constructor, AsyncGenerator = (async function* () {
|
|
131
|
-
})().constructor;
|
|
132
|
-
patchIteratorNext(Generator.prototype);
|
|
133
|
-
patchIteratorNext(AsyncGenerator.prototype);
|
|
134
|
-
var REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
135
|
-
let KNOWN_SYMBOLS2 = /* @__PURE__ */ new Map();
|
|
136
|
-
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
137
|
-
let symbol = Symbol[name];
|
|
138
|
-
typeof symbol == "symbol" && KNOWN_SYMBOLS2.set(symbol, "Symbol." + name);
|
|
139
|
-
}
|
|
140
|
-
return KNOWN_SYMBOLS2;
|
|
141
|
-
})(), KNOWN_FUNCTIONS = /* @__PURE__ */ new Map([
|
|
142
|
-
// This is by no means an exhaustive list,
|
|
143
|
-
// but it should cover most of the built-in functions.
|
|
144
|
-
[AggregateError, "AggregateError"],
|
|
145
|
-
[Array, "Array"],
|
|
146
|
-
[Array.from, "Array.from"],
|
|
147
|
-
[Array.isArray, "Array.isArray"],
|
|
148
|
-
[Array.of, "Array.of"],
|
|
149
|
-
[ArrayBuffer, "ArrayBuffer"],
|
|
150
|
-
[ArrayBuffer.isView, "ArrayBuffer.isView"],
|
|
151
|
-
[Atomics.add, "Atomics.add"],
|
|
152
|
-
[Atomics.and, "Atomics.and"],
|
|
153
|
-
[Atomics.compareExchange, "Atomics.compareExchange"],
|
|
154
|
-
[Atomics.exchange, "Atomics.exchange"],
|
|
155
|
-
[Atomics.isLockFree, "Atomics.isLockFree"],
|
|
156
|
-
[Atomics.load, "Atomics.load"],
|
|
157
|
-
[Atomics.notify, "Atomics.notify"],
|
|
158
|
-
[Atomics.or, "Atomics.or"],
|
|
159
|
-
[Atomics.store, "Atomics.store"],
|
|
160
|
-
[Atomics.sub, "Atomics.sub"],
|
|
161
|
-
[Atomics.wait, "Atomics.wait"],
|
|
162
|
-
[BigInt, "BigInt"],
|
|
163
|
-
[BigInt.asIntN, "BigInt.asIntN"],
|
|
164
|
-
[BigInt.asUintN, "BigInt.asUintN"],
|
|
165
|
-
[BigInt64Array, "BigInt64Array"],
|
|
166
|
-
[BigInt64Array.from, "BigInt64Array.from"],
|
|
167
|
-
[BigInt64Array.of, "BigInt64Array.of"],
|
|
168
|
-
[BigUint64Array, "BigUint64Array"],
|
|
169
|
-
[BigUint64Array.from, "BigUint64Array.from"],
|
|
170
|
-
[BigUint64Array.of, "BigUint64Array.of"],
|
|
171
|
-
[Boolean, "Boolean"],
|
|
172
|
-
[console.assert, "console.assert"],
|
|
173
|
-
[console.clear, "console.clear"],
|
|
174
|
-
[console.count, "console.count"],
|
|
175
|
-
[console.countReset, "console.countReset"],
|
|
176
|
-
[console.debug, "console.debug"],
|
|
177
|
-
[console.dir, "console.dir"],
|
|
178
|
-
[console.dirxml, "console.dirxml"],
|
|
179
|
-
[console.error, "console.error"],
|
|
180
|
-
[console.group, "console.group"],
|
|
181
|
-
[console.groupCollapsed, "console.groupCollapsed"],
|
|
182
|
-
[console.groupEnd, "console.groupEnd"],
|
|
183
|
-
[console.info, "console.info"],
|
|
184
|
-
[console.log, "console.log"],
|
|
185
|
-
[console.table, "console.table"],
|
|
186
|
-
[console.time, "console.time"],
|
|
187
|
-
[console.timeEnd, "console.timeEnd"],
|
|
188
|
-
[console.timeLog, "console.timeLog"],
|
|
189
|
-
[console.timeStamp, "console.timeStamp"],
|
|
190
|
-
[console.trace, "console.trace"],
|
|
191
|
-
[console.warn, "console.warn"],
|
|
192
|
-
[DataView, "DataView"],
|
|
193
|
-
[Date, "Date"],
|
|
194
|
-
[Date.now, "Date.now"],
|
|
195
|
-
[Date.parse, "Date.parse"],
|
|
196
|
-
[Date.UTC, "Date.UTC"],
|
|
197
|
-
[decodeURI, "decodeURI"],
|
|
198
|
-
[decodeURIComponent, "decodeURIComponent"],
|
|
199
|
-
[encodeURI, "encodeURI"],
|
|
200
|
-
[encodeURIComponent, "encodeURIComponent"],
|
|
201
|
-
[Error, "Error"],
|
|
202
|
-
[EvalError, "EvalError"],
|
|
203
|
-
[Float32Array, "Float32Array"],
|
|
204
|
-
[Float32Array.from, "Float32Array.from"],
|
|
205
|
-
[Float32Array.of, "Float32Array.of"],
|
|
206
|
-
[Float64Array, "Float64Array"],
|
|
207
|
-
[Float64Array.from, "Float64Array.from"],
|
|
208
|
-
[Float64Array.of, "Float64Array.of"],
|
|
209
|
-
[Function, "Function"],
|
|
210
|
-
[globalThis.atob, "atob"],
|
|
211
|
-
[globalThis.btoa, "btoa"],
|
|
212
|
-
[globalThis.clearImmediate, "clearImmediate"],
|
|
213
|
-
[globalThis.clearInterval, "clearInterval"],
|
|
214
|
-
[globalThis.clearTimeout, "clearTimeout"],
|
|
215
|
-
[globalThis.crypto?.getRandomValues, "crypto.getRandomValues"],
|
|
216
|
-
[globalThis.crypto?.randomUUID, "crypto.randomUUID"],
|
|
217
|
-
[globalThis.fetch, "fetch"],
|
|
218
|
-
[globalThis.performance?.now, "performance.now"],
|
|
219
|
-
[globalThis.queueMicrotask, "queueMicrotask"],
|
|
220
|
-
[globalThis.setImmediate, "setImmediate"],
|
|
221
|
-
[globalThis.setInterval, "setInterval"],
|
|
222
|
-
[globalThis.setTimeout, "setTimeout"],
|
|
223
|
-
[globalThis.structuredClone, "structuredClone"],
|
|
224
|
-
[globalThis.URL, "URL"],
|
|
225
|
-
[globalThis.URLSearchParams, "URLSearchParams"],
|
|
226
|
-
[globalThis.WritableStream, "WritableStream"],
|
|
227
|
-
[Int16Array, "Int16Array"],
|
|
228
|
-
[Int16Array.from, "Int16Array.from"],
|
|
229
|
-
[Int16Array.of, "Int16Array.of"],
|
|
230
|
-
[Int32Array, "Int32Array"],
|
|
231
|
-
[Int32Array.from, "Int32Array.from"],
|
|
232
|
-
[Int32Array.of, "Int32Array.of"],
|
|
233
|
-
[Int8Array, "Int8Array"],
|
|
234
|
-
[Int8Array.from, "Int8Array.from"],
|
|
235
|
-
[Int8Array.of, "Int8Array.of"],
|
|
236
|
-
[Intl.Collator, "Intl.Collator"],
|
|
237
|
-
[Intl.DateTimeFormat, "Intl.DateTimeFormat"],
|
|
238
|
-
[Intl.DisplayNames, "Intl.DisplayNames"],
|
|
239
|
-
[Intl.getCanonicalLocales, "Intl.getCanonicalLocales"],
|
|
240
|
-
[Intl.ListFormat, "Intl.ListFormat"],
|
|
241
|
-
[Intl.Locale, "Intl.Locale"],
|
|
242
|
-
[Intl.NumberFormat, "Intl.NumberFormat"],
|
|
243
|
-
[Intl.PluralRules, "Intl.PluralRules"],
|
|
244
|
-
[Intl.RelativeTimeFormat, "Intl.RelativeTimeFormat"],
|
|
245
|
-
[Intl.Segmenter, "Intl.Segmenter"],
|
|
246
|
-
[Intl.supportedValuesOf, "Intl.supportedValuesOf"],
|
|
247
|
-
[isFinite, "isFinite"],
|
|
248
|
-
[isNaN, "isNaN"],
|
|
249
|
-
[JSON.parse, "JSON.parse"],
|
|
250
|
-
[JSON.stringify, "JSON.stringify"],
|
|
251
|
-
[Map, "Map"],
|
|
252
|
-
[Map.groupBy, "Map.groupBy"],
|
|
253
|
-
[Math.abs, "Math.abs"],
|
|
254
|
-
[Math.acos, "Math.acos"],
|
|
255
|
-
[Math.acosh, "Math.acosh"],
|
|
256
|
-
[Math.asin, "Math.asin"],
|
|
257
|
-
[Math.asinh, "Math.asinh"],
|
|
258
|
-
[Math.atan, "Math.atan"],
|
|
259
|
-
[Math.atan2, "Math.atan2"],
|
|
260
|
-
[Math.atanh, "Math.atanh"],
|
|
261
|
-
[Math.cbrt, "Math.cbrt"],
|
|
262
|
-
[Math.ceil, "Math.ceil"],
|
|
263
|
-
[Math.clz32, "Math.clz32"],
|
|
264
|
-
[Math.cos, "Math.cos"],
|
|
265
|
-
[Math.cosh, "Math.cosh"],
|
|
266
|
-
[Math.exp, "Math.exp"],
|
|
267
|
-
[Math.expm1, "Math.expm1"],
|
|
268
|
-
[Math.floor, "Math.floor"],
|
|
269
|
-
[Math.fround, "Math.fround"],
|
|
270
|
-
[Math.hypot, "Math.hypot"],
|
|
271
|
-
[Math.imul, "Math.imul"],
|
|
272
|
-
[Math.log, "Math.log"],
|
|
273
|
-
[Math.log10, "Math.log10"],
|
|
274
|
-
[Math.log1p, "Math.log1p"],
|
|
275
|
-
[Math.log2, "Math.log2"],
|
|
276
|
-
[Math.max, "Math.max"],
|
|
277
|
-
[Math.min, "Math.min"],
|
|
278
|
-
[Math.pow, "Math.pow"],
|
|
279
|
-
[Math.random, "Math.random"],
|
|
280
|
-
[Math.round, "Math.round"],
|
|
281
|
-
[Math.sign, "Math.sign"],
|
|
282
|
-
[Math.sin, "Math.sin"],
|
|
283
|
-
[Math.sinh, "Math.sinh"],
|
|
284
|
-
[Math.sqrt, "Math.sqrt"],
|
|
285
|
-
[Math.tan, "Math.tan"],
|
|
286
|
-
[Math.tanh, "Math.tanh"],
|
|
287
|
-
[Math.trunc, "Math.trunc"],
|
|
288
|
-
[Number, "Number"],
|
|
289
|
-
[Number.isFinite, "Number.isFinite"],
|
|
290
|
-
[Number.isInteger, "Number.isInteger"],
|
|
291
|
-
[Number.isNaN, "Number.isNaN"],
|
|
292
|
-
[Number.isSafeInteger, "Number.isSafeInteger"],
|
|
293
|
-
[Number.parseFloat, "Number.parseFloat"],
|
|
294
|
-
[Number.parseInt, "Number.parseInt"],
|
|
295
|
-
[Object, "Object"],
|
|
296
|
-
[Object.assign, "Object.assign"],
|
|
297
|
-
[Object.create, "Object.create"],
|
|
298
|
-
[Object.defineProperties, "Object.defineProperties"],
|
|
299
|
-
[Object.defineProperty, "Object.defineProperty"],
|
|
300
|
-
[Object.entries, "Object.entries"],
|
|
301
|
-
[Object.freeze, "Object.freeze"],
|
|
302
|
-
[Object.fromEntries, "Object.fromEntries"],
|
|
303
|
-
[Object.getOwnPropertyDescriptor, "Object.getOwnPropertyDescriptor"],
|
|
304
|
-
[Object.getOwnPropertyDescriptors, "Object.getOwnPropertyDescriptors"],
|
|
305
|
-
[Object.getOwnPropertyNames, "Object.getOwnPropertyNames"],
|
|
306
|
-
[Object.getOwnPropertySymbols, "Object.getOwnPropertySymbols"],
|
|
307
|
-
[Object.getPrototypeOf, "Object.getPrototypeOf"],
|
|
308
|
-
[Object.is, "Object.is"],
|
|
309
|
-
[Object.isExtensible, "Object.isExtensible"],
|
|
310
|
-
[Object.isFrozen, "Object.isFrozen"],
|
|
311
|
-
[Object.isSealed, "Object.isSealed"],
|
|
312
|
-
[Object.keys, "Object.keys"],
|
|
313
|
-
[Object.preventExtensions, "Object.preventExtensions"],
|
|
314
|
-
[Object.seal, "Object.seal"],
|
|
315
|
-
[Object.setPrototypeOf, "Object.setPrototypeOf"],
|
|
316
|
-
[Object.values, "Object.values"],
|
|
317
|
-
[parseFloat, "parseFloat"],
|
|
318
|
-
[parseInt, "parseInt"],
|
|
319
|
-
[Promise, "Promise"],
|
|
320
|
-
[Proxy, "Proxy"],
|
|
321
|
-
[RangeError, "RangeError"],
|
|
322
|
-
[ReferenceError, "ReferenceError"],
|
|
323
|
-
[Reflect.apply, "Reflect.apply"],
|
|
324
|
-
[Reflect.construct, "Reflect.construct"],
|
|
325
|
-
[Reflect.defineProperty, "Reflect.defineProperty"],
|
|
326
|
-
[Reflect.deleteProperty, "Reflect.deleteProperty"],
|
|
327
|
-
[Reflect.get, "Reflect.get"],
|
|
328
|
-
[Reflect.getOwnPropertyDescriptor, "Reflect.getOwnPropertyDescriptor"],
|
|
329
|
-
[Reflect.getPrototypeOf, "Reflect.getPrototypeOf"],
|
|
330
|
-
[Reflect.has, "Reflect.has"],
|
|
331
|
-
[Reflect.isExtensible, "Reflect.isExtensible"],
|
|
332
|
-
[Reflect.ownKeys, "Reflect.ownKeys"],
|
|
333
|
-
[Reflect.preventExtensions, "Reflect.preventExtensions"],
|
|
334
|
-
[Reflect.set, "Reflect.set"],
|
|
335
|
-
[Reflect.setPrototypeOf, "Reflect.setPrototypeOf"],
|
|
336
|
-
[RegExp, "RegExp"],
|
|
337
|
-
[Set, "Set"],
|
|
338
|
-
[String, "String"],
|
|
339
|
-
[String.fromCharCode, "String.fromCharCode"],
|
|
340
|
-
[String.fromCodePoint, "String.fromCodePoint"],
|
|
341
|
-
[String.raw, "String.raw"],
|
|
342
|
-
[Symbol, "Symbol"],
|
|
343
|
-
[Symbol.for, "Symbol.for"],
|
|
344
|
-
[SyntaxError, "SyntaxError"],
|
|
345
|
-
[TypeError, "TypeError"],
|
|
346
|
-
[Uint16Array, "Uint16Array"],
|
|
347
|
-
[Uint16Array.from, "Uint16Array.from"],
|
|
348
|
-
[Uint16Array.of, "Uint16Array.of"],
|
|
349
|
-
[Uint32Array, "Uint32Array"],
|
|
350
|
-
[Uint32Array.from, "Uint32Array.from"],
|
|
351
|
-
[Uint32Array.of, "Uint32Array.of"],
|
|
352
|
-
[Uint8Array, "Uint8Array"],
|
|
353
|
-
[Uint8Array.from, "Uint8Array.from"],
|
|
354
|
-
[Uint8Array.of, "Uint8Array.of"],
|
|
355
|
-
[Uint8ClampedArray, "Uint8ClampedArray"],
|
|
356
|
-
[Uint8ClampedArray.from, "Uint8ClampedArray.from"],
|
|
357
|
-
[Uint8ClampedArray.of, "Uint8ClampedArray.of"],
|
|
358
|
-
[URIError, "URIError"],
|
|
359
|
-
[WeakMap, "WeakMap"],
|
|
360
|
-
[WeakSet, "WeakSet"]
|
|
361
|
-
]), KNOWN_OBJECTS = /* @__PURE__ */ new Map([
|
|
362
|
-
[Atomics, "Atomics"],
|
|
363
|
-
[console, "console"],
|
|
364
|
-
[globalThis, "globalThis"],
|
|
365
|
-
[globalThis.crypto, "crypto"],
|
|
366
|
-
[Intl, "Intl"],
|
|
367
|
-
[JSON, "JSON"],
|
|
368
|
-
[Math, "Math"],
|
|
369
|
-
[Reflect, "Reflect"]
|
|
370
|
-
]), State = class {
|
|
371
|
-
ids = 0;
|
|
372
|
-
flush = 0;
|
|
373
|
-
registerInstanceId = 0;
|
|
374
|
-
flushed = !1;
|
|
375
|
-
wroteUndefined = !1;
|
|
376
|
-
buf = [];
|
|
377
|
-
strs = /* @__PURE__ */ new Map();
|
|
378
|
-
refs = /* @__PURE__ */ new WeakMap();
|
|
379
|
-
assigned = /* @__PURE__ */ new Set();
|
|
380
|
-
registered = [];
|
|
381
|
-
boundary = void 0;
|
|
382
|
-
mutated = [];
|
|
383
|
-
}, Reference = class {
|
|
384
|
-
constructor(parent, accessor, flush, pos = null, id = null) {
|
|
385
|
-
this.parent = parent;
|
|
386
|
-
this.accessor = accessor;
|
|
387
|
-
this.flush = flush;
|
|
388
|
-
this.pos = pos;
|
|
389
|
-
this.id = id;
|
|
390
|
-
this.parent = parent, this.accessor = accessor, this.flush = flush, this.pos = pos, this.id = id;
|
|
391
|
-
}
|
|
392
|
-
registered = null;
|
|
393
|
-
assigns = null;
|
|
394
|
-
};
|
|
395
|
-
var Serializer = class {
|
|
396
|
-
#state = new State();
|
|
397
|
-
get flushed() {
|
|
398
|
-
return this.#state.flushed;
|
|
399
|
-
}
|
|
400
|
-
stringify(val, boundary) {
|
|
401
|
-
try {
|
|
402
|
-
return this.#state.flushed = !1, this.#state.boundary = boundary, writeRoot(this.#state, val);
|
|
403
|
-
} finally {
|
|
404
|
-
this.#state.flush++, this.#state.buf = [];
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
nextId() {
|
|
408
|
-
return nextId(this.#state);
|
|
409
|
-
}
|
|
410
|
-
symbol(id) {
|
|
411
|
-
let symbol = /* @__PURE__ */ Symbol();
|
|
412
|
-
return this.#state.refs.set(symbol, new Reference(null, null, 0, null, id)), symbol;
|
|
413
|
-
}
|
|
414
|
-
writeCall(value, object, property, spread) {
|
|
415
|
-
let state = this.#state;
|
|
416
|
-
state.mutated.push({
|
|
417
|
-
type: 0 /* call */,
|
|
418
|
-
value,
|
|
419
|
-
object,
|
|
420
|
-
property,
|
|
421
|
-
spread
|
|
422
|
-
}), state.flushed = !0;
|
|
423
|
-
}
|
|
424
|
-
writeAssign(value, object, property) {
|
|
425
|
-
let state = this.#state;
|
|
426
|
-
state.mutated.push({
|
|
427
|
-
type: 1 /* assign */,
|
|
428
|
-
value,
|
|
429
|
-
object,
|
|
430
|
-
property
|
|
431
|
-
}), state.flushed = !0;
|
|
432
|
-
}
|
|
433
|
-
register(id, val, scope) {
|
|
434
|
-
return register(
|
|
435
|
-
id,
|
|
436
|
-
val,
|
|
437
|
-
scope,
|
|
438
|
-
scope ? ++this.#state.registerInstanceId : 0
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
};
|
|
794
|
+
return by ? by(index) : index;
|
|
795
|
+
}
|
|
796
|
+
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
442
797
|
function register(id, val, scope, instanceId) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
798
|
+
return REGISTRY.set(val, {
|
|
799
|
+
id,
|
|
800
|
+
scope,
|
|
801
|
+
instanceId: instanceId ?? 0,
|
|
802
|
+
access: "_._" + toAccess(toObjectKey(id))
|
|
803
|
+
}), val;
|
|
449
804
|
}
|
|
450
805
|
function getRegistered(val) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
806
|
+
let registered = REGISTRY.get(val);
|
|
807
|
+
if (registered) return {
|
|
808
|
+
id: registered.id,
|
|
809
|
+
scope: registered.scope
|
|
810
|
+
};
|
|
454
811
|
}
|
|
455
812
|
function writeRoot(state, root) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
hadBuf && (buf.pop(), writeAssigned(state)), result = "{", buf.push("}");
|
|
468
|
-
for (let chunk of buf)
|
|
469
|
-
result += chunk;
|
|
470
|
-
return state.wroteUndefined ? (state.wroteUndefined = !1, "(_,$)=>" + result) : "_=>" + result;
|
|
813
|
+
let { buf } = state, hadBuf = buf.length !== 0, result;
|
|
814
|
+
if (hadBuf && buf.push(","), writeProp(state, root, null, "")) {
|
|
815
|
+
let rootRef = state.refs.get(root);
|
|
816
|
+
if (rootRef) {
|
|
817
|
+
let rootId = ensureId(state, rootRef);
|
|
818
|
+
(state.assigned.size || state.registered.length || state.mutated.length) && (state.assigned.delete(rootRef), writeAssigned(state), buf.push("," + (rootRef.assigns ? assignsToString(rootRef.assigns, rootId) : rootId)));
|
|
819
|
+
}
|
|
820
|
+
result = "(", buf.push(")");
|
|
821
|
+
} else hadBuf && (buf.pop(), writeAssigned(state)), result = "{", buf.push("}");
|
|
822
|
+
for (let chunk of buf) result += chunk;
|
|
823
|
+
return state.wroteUndefined ? (state.wroteUndefined = !1, "(_,$)=>" + result) : "_=>" + result;
|
|
471
824
|
}
|
|
472
825
|
function writeAssigned(state) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
);
|
|
503
|
-
if (writeProp(state, mutation.value, null, "")) {
|
|
504
|
-
let valueRef = state.refs.get(mutation.value);
|
|
505
|
-
valueRef && !valueRef.id && (valueRef.id = nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
506
|
-
} else
|
|
507
|
-
state.buf.push("void 0");
|
|
508
|
-
isCall && state.buf.push(")");
|
|
509
|
-
}
|
|
510
|
-
state.mutated = [], (state.assigned.size || state.registered.length) && writeAssigned(state);
|
|
511
|
-
}
|
|
826
|
+
if (state.assigned.size) {
|
|
827
|
+
let buf = "";
|
|
828
|
+
for (let ref of state.assigned) buf += "," + assignsToString(ref.assigns, ref.id), ref.assigns = null;
|
|
829
|
+
state.buf.push(buf), state.assigned = /* @__PURE__ */ new Set();
|
|
830
|
+
}
|
|
831
|
+
if (state.registered.length) {
|
|
832
|
+
let buf = "";
|
|
833
|
+
for (let ref of state.registered.sort(compareRegisteredReferences)) {
|
|
834
|
+
let scopeRef = state.refs.get(ref.registered.scope);
|
|
835
|
+
buf += "," + assignsToString(ref.assigns, ref.registered.access + "(" + (scopeRef ? ensureId(state, scopeRef) : ref.assigns[0]) + ")"), ref.assigns = null, ref.registered = null;
|
|
836
|
+
}
|
|
837
|
+
state.buf.push(buf), state.registered = [];
|
|
838
|
+
}
|
|
839
|
+
if (state.mutated.length) {
|
|
840
|
+
for (let mutation of state.mutated) {
|
|
841
|
+
let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(state.buf.length === 0 ? "" : ",");
|
|
842
|
+
if (writeProp(state, mutation.object, null, "")) {
|
|
843
|
+
let objectRef = state.refs.get(mutation.object);
|
|
844
|
+
objectRef && (objectRef.id ? hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")) : (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")));
|
|
845
|
+
} else state.buf.push("void 0");
|
|
846
|
+
let isCall = mutation.type === 0, valueStartIndex = state.buf.push(isCall ? (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "=");
|
|
847
|
+
if (writeProp(state, mutation.value, null, "")) {
|
|
848
|
+
let valueRef = state.refs.get(mutation.value);
|
|
849
|
+
valueRef && !valueRef.id && (valueRef.id = nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
850
|
+
} else state.buf.push("void 0");
|
|
851
|
+
isCall && state.buf.push(")");
|
|
852
|
+
}
|
|
853
|
+
state.mutated = [], (state.assigned.size || state.registered.length) && writeAssigned(state);
|
|
854
|
+
}
|
|
512
855
|
}
|
|
513
856
|
function writeProp(state, val, parent, accessor) {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
return writeSymbol(state, val, parent, accessor);
|
|
525
|
-
case "function":
|
|
526
|
-
return writeFunction(state, val, parent, accessor);
|
|
527
|
-
case "object":
|
|
528
|
-
return writeObject(state, val, parent, accessor);
|
|
529
|
-
default:
|
|
530
|
-
return !1;
|
|
531
|
-
}
|
|
857
|
+
switch (typeof val) {
|
|
858
|
+
case "string": return writeString(state, val, parent, accessor);
|
|
859
|
+
case "number": return writeNumber(state, val);
|
|
860
|
+
case "boolean": return writeBoolean(state, val);
|
|
861
|
+
case "bigint": return writeBigInt(state, val);
|
|
862
|
+
case "symbol": return writeSymbol(state, val, parent, accessor);
|
|
863
|
+
case "function": return writeFunction(state, val, parent, accessor);
|
|
864
|
+
case "object": return writeObject(state, val, parent, accessor);
|
|
865
|
+
default: return !1;
|
|
866
|
+
}
|
|
532
867
|
}
|
|
533
868
|
function writeReferenceOr(state, write, val, parent, accessor) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
let registered = REGISTRY.get(val);
|
|
545
|
-
return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(
|
|
546
|
-
val,
|
|
547
|
-
ref = new Reference(parent, accessor, state.flush, state.buf.length)
|
|
548
|
-
), write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
|
|
869
|
+
let ref = state.refs.get(val);
|
|
870
|
+
if (ref) {
|
|
871
|
+
if (parent) {
|
|
872
|
+
if (ref.assigns) return addAssignment(ref, ensureId(state, parent) + toAccess(accessor)), !1;
|
|
873
|
+
if (isCircular(parent, ref)) return ensureId(state, ref), state.assigned.add(ref), addAssignment(ref, ensureId(state, parent) + toAccess(accessor)), !1;
|
|
874
|
+
}
|
|
875
|
+
return state.buf.push(ensureId(state, ref)), !0;
|
|
876
|
+
}
|
|
877
|
+
let registered = REGISTRY.get(val);
|
|
878
|
+
return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flush, state.buf.length)), write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
|
|
549
879
|
}
|
|
550
880
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
state.buf.length
|
|
557
|
-
);
|
|
558
|
-
return fnRef.registered = registered, state.refs.set(val, fnRef), state.registered.push(fnRef), addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !state.refs.has(registered.scope) && writeProp(state, registered.scope, null, "");
|
|
559
|
-
} else
|
|
560
|
-
state.buf.push(registered.access);
|
|
561
|
-
return !0;
|
|
881
|
+
if (parent && registered.scope) {
|
|
882
|
+
let fnRef = new Reference(parent, accessor, state.flush, state.buf.length);
|
|
883
|
+
return fnRef.registered = registered, state.refs.set(val, fnRef), state.registered.push(fnRef), addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !state.refs.has(registered.scope) && writeProp(state, registered.scope, null, "");
|
|
884
|
+
} else state.buf.push(registered.access);
|
|
885
|
+
return !0;
|
|
562
886
|
}
|
|
563
887
|
function writeString(state, val, parent, accessor) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
), state.buf.push(quote(val, 0)));
|
|
570
|
-
} else
|
|
571
|
-
state.buf.push(quote(val, 0));
|
|
572
|
-
return !0;
|
|
888
|
+
if (val.length > 30) {
|
|
889
|
+
let ref = state.strs.get(val);
|
|
890
|
+
ref ? state.buf.push(ensureId(state, ref)) : (state.strs.set(val, new Reference(parent, accessor, state.flush, state.buf.length)), state.buf.push(quote(val, 0)));
|
|
891
|
+
} else state.buf.push(quote(val, 0));
|
|
892
|
+
return !0;
|
|
573
893
|
}
|
|
574
894
|
function writeNumber(state, val) {
|
|
575
|
-
|
|
895
|
+
return state.buf.push(val + ""), !0;
|
|
576
896
|
}
|
|
577
897
|
function writeBoolean(state, val) {
|
|
578
|
-
|
|
898
|
+
return state.buf.push(val ? "!0" : "!1"), !0;
|
|
579
899
|
}
|
|
580
900
|
function writeBigInt(state, val) {
|
|
581
|
-
|
|
901
|
+
return state.buf.push(val + "n"), !0;
|
|
582
902
|
}
|
|
583
903
|
function writeFunction(state, val, parent, accessor) {
|
|
584
|
-
|
|
585
|
-
|
|
904
|
+
let wellKnownFunction = KNOWN_FUNCTIONS.get(val);
|
|
905
|
+
return wellKnownFunction ? (state.buf.push(wellKnownFunction), !0) : writeReferenceOr(state, writeNever, val, parent, accessor);
|
|
586
906
|
}
|
|
587
907
|
function writeSymbol(state, val, parent, accessor) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
return key !== void 0 ? (state.buf.push("Symbol.for(" + quote(key, 0) + ")"), !0) : writeReferenceOr(state, writeUnknownSymbol, val, parent, accessor);
|
|
908
|
+
let wellKnownSymbol = KNOWN_SYMBOLS.get(val);
|
|
909
|
+
if (wellKnownSymbol) return state.buf.push(wellKnownSymbol), !0;
|
|
910
|
+
let key = Symbol.keyFor(val);
|
|
911
|
+
return key === void 0 ? writeReferenceOr(state, writeUnknownSymbol, val, parent, accessor) : (state.buf.push("Symbol.for(" + quote(key, 0) + ")"), !0);
|
|
593
912
|
}
|
|
594
913
|
function writeUnknownSymbol(state) {
|
|
595
|
-
|
|
914
|
+
return state.buf.push("Symbol()"), !0;
|
|
596
915
|
}
|
|
597
916
|
function writeNever(state, val, ref) {
|
|
598
|
-
|
|
917
|
+
return !1;
|
|
599
918
|
}
|
|
600
919
|
function writeNull(state) {
|
|
601
|
-
|
|
920
|
+
return state.buf.push("null"), !0;
|
|
602
921
|
}
|
|
603
922
|
function writeObject(state, val, parent, accessor) {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
923
|
+
if (val === null) return writeNull(state);
|
|
924
|
+
let wellKnownObject = KNOWN_OBJECTS.get(val);
|
|
925
|
+
return wellKnownObject ? (state.buf.push(wellKnownObject), !0) : writeReferenceOr(state, writeUnknownObject, val, parent, accessor);
|
|
607
926
|
}
|
|
608
927
|
function writeUnknownObject(state, val, ref) {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
case Float32Array:
|
|
650
|
-
case Float64Array:
|
|
651
|
-
return writeTypedArray(state, val, ref);
|
|
652
|
-
case WeakSet:
|
|
653
|
-
return writeWeakSet(state);
|
|
654
|
-
case WeakMap:
|
|
655
|
-
return writeWeakMap(state);
|
|
656
|
-
// The following references use `globalThis`
|
|
657
|
-
// since they are not implemented by all runtimes.
|
|
658
|
-
case globalThis.URL:
|
|
659
|
-
return writeURL(state, val);
|
|
660
|
-
case globalThis.URLSearchParams:
|
|
661
|
-
return writeURLSearchParams(state, val);
|
|
662
|
-
case globalThis.Headers:
|
|
663
|
-
return writeHeaders(state, val);
|
|
664
|
-
case globalThis.FormData:
|
|
665
|
-
return writeFormData(state, val);
|
|
666
|
-
case globalThis.ReadableStream:
|
|
667
|
-
return writeReadableStream(state, val, ref);
|
|
668
|
-
case globalThis.Request:
|
|
669
|
-
return writeRequest(state, val, ref);
|
|
670
|
-
case globalThis.Response:
|
|
671
|
-
return writeResponse(state, val, ref);
|
|
672
|
-
}
|
|
673
|
-
return !1;
|
|
928
|
+
switch (val.constructor) {
|
|
929
|
+
case void 0: return writeNullObject(state, val, ref);
|
|
930
|
+
case Object: return writePlainObject(state, val, ref);
|
|
931
|
+
case Array: return writeArray(state, val, ref);
|
|
932
|
+
case Date: return writeDate(state, val);
|
|
933
|
+
case RegExp: return writeRegExp(state, val);
|
|
934
|
+
case Promise: return writePromise(state, val, ref);
|
|
935
|
+
case Map: return writeMap(state, val, ref);
|
|
936
|
+
case Set: return writeSet(state, val, ref);
|
|
937
|
+
case Generator: return writeGenerator(state, val, ref);
|
|
938
|
+
case AsyncGenerator: return writeAsyncGenerator(state, val, ref);
|
|
939
|
+
case Error:
|
|
940
|
+
case EvalError:
|
|
941
|
+
case RangeError:
|
|
942
|
+
case ReferenceError:
|
|
943
|
+
case SyntaxError:
|
|
944
|
+
case TypeError:
|
|
945
|
+
case URIError: return writeError(state, val, ref);
|
|
946
|
+
case AggregateError: return writeAggregateError(state, val, ref);
|
|
947
|
+
case ArrayBuffer: return writeArrayBuffer(state, val);
|
|
948
|
+
case Int8Array:
|
|
949
|
+
case Uint8Array:
|
|
950
|
+
case Uint8ClampedArray:
|
|
951
|
+
case Int16Array:
|
|
952
|
+
case Uint16Array:
|
|
953
|
+
case Int32Array:
|
|
954
|
+
case Uint32Array:
|
|
955
|
+
case Float32Array:
|
|
956
|
+
case Float64Array: return writeTypedArray(state, val, ref);
|
|
957
|
+
case WeakSet: return writeWeakSet(state);
|
|
958
|
+
case WeakMap: return writeWeakMap(state);
|
|
959
|
+
case globalThis.URL: return writeURL(state, val);
|
|
960
|
+
case globalThis.URLSearchParams: return writeURLSearchParams(state, val);
|
|
961
|
+
case globalThis.Headers: return writeHeaders(state, val);
|
|
962
|
+
case globalThis.FormData: return writeFormData(state, val);
|
|
963
|
+
case globalThis.ReadableStream: return writeReadableStream(state, val, ref);
|
|
964
|
+
case globalThis.Request: return writeRequest(state, val, ref);
|
|
965
|
+
case globalThis.Response: return writeResponse(state, val, ref);
|
|
966
|
+
}
|
|
967
|
+
return !1;
|
|
674
968
|
}
|
|
675
969
|
function writePlainObject(state, val, ref) {
|
|
676
|
-
|
|
970
|
+
return state.buf.push("{"), writeObjectProps(state, val, ref), state.buf.push("}"), !0;
|
|
677
971
|
}
|
|
678
972
|
function writeArray(state, val, ref) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
973
|
+
let sep = "[";
|
|
974
|
+
for (let i = 0; i < val.length; i++) {
|
|
975
|
+
let item = val[i];
|
|
976
|
+
state.buf.push(sep), sep = ",", item === void 0 ? (state.wroteUndefined = !0, state.buf.push("$")) : writeProp(state, item, ref, "" + i);
|
|
977
|
+
}
|
|
978
|
+
return sep === "[" ? state.buf.push("[]") : state.buf.push("]"), !0;
|
|
685
979
|
}
|
|
686
980
|
function writeDate(state, val) {
|
|
687
|
-
|
|
981
|
+
return state.buf.push("new Date(\"" + val.toISOString() + "\")"), !0;
|
|
688
982
|
}
|
|
689
983
|
function writeRegExp(state, val) {
|
|
690
|
-
|
|
984
|
+
return state.buf.push(val + ""), !0;
|
|
691
985
|
}
|
|
692
986
|
function writePromise(state, val, ref) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
"(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"
|
|
698
|
-
), val.then(
|
|
699
|
-
(v) => writeAsyncCall(state, boundary, pRef, "f", v, pId),
|
|
700
|
-
(v) => writeAsyncCall(state, boundary, pRef, "r", v, pId)
|
|
701
|
-
), boundary.startAsync(), !0;
|
|
987
|
+
let { boundary } = state;
|
|
988
|
+
if (!boundary) return !1;
|
|
989
|
+
let pId = nextRefAccess(state), pRef = new Reference(ref, null, state.flush, null, pId);
|
|
990
|
+
return state.buf.push("(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"), val.then((v) => writeAsyncCall(state, boundary, pRef, "f", v, pId), (v) => writeAsyncCall(state, boundary, pRef, "r", v, pId)), boundary.startAsync(), !0;
|
|
702
991
|
}
|
|
703
992
|
function writeMap(state, val, ref) {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
for (let [itemKey, itemValue] of val)
|
|
715
|
-
itemKey === val && (itemKey = void 0, (assigns ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("a[" + i + "][1]")), i = items.push(
|
|
716
|
-
itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
|
|
717
|
-
);
|
|
718
|
-
assigns ? state.buf.push(
|
|
719
|
-
"((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
|
|
720
|
-
) : state.buf.push("new Map(" + arrayRef.id + "="), writeArray(state, items, arrayRef), state.buf.push(")");
|
|
721
|
-
} else {
|
|
722
|
-
for (let [itemKey, itemValue] of val)
|
|
723
|
-
itemKey === val && (itemKey = 0, (assigns ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assigns ||= []).push("a[" + (i + 1) + "]")), i = items.push(itemKey, itemValue);
|
|
724
|
-
assigns ? state.buf.push(
|
|
725
|
-
"(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
|
|
726
|
-
) : state.buf.push(
|
|
727
|
-
"(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
|
|
728
|
-
), writeArray(state, items, arrayRef), state.buf.push(")");
|
|
729
|
-
}
|
|
730
|
-
return !0;
|
|
993
|
+
if (!val.size) return state.buf.push("new Map"), !0;
|
|
994
|
+
let arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state)), items = [], assigns, i = 0;
|
|
995
|
+
if (val.size < 25) {
|
|
996
|
+
for (let [itemKey, itemValue] of val) itemKey === val && (itemKey = void 0, (assigns ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("a[" + i + "][1]")), i = items.push(itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]);
|
|
997
|
+
assigns ? state.buf.push("((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "=") : state.buf.push("new Map(" + arrayRef.id + "="), writeArray(state, items, arrayRef), state.buf.push(")");
|
|
998
|
+
} else {
|
|
999
|
+
for (let [itemKey, itemValue] of val) itemKey === val && (itemKey = 0, (assigns ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assigns ||= []).push("a[" + (i + 1) + "]")), i = items.push(itemKey, itemValue);
|
|
1000
|
+
assigns ? state.buf.push("(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "=") : state.buf.push("(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="), writeArray(state, items, arrayRef), state.buf.push(")");
|
|
1001
|
+
}
|
|
1002
|
+
return !0;
|
|
731
1003
|
}
|
|
732
1004
|
function writeSet(state, val, ref) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
let arrayRef = new Reference(
|
|
739
|
-
ref,
|
|
740
|
-
null,
|
|
741
|
-
state.flush,
|
|
742
|
-
null,
|
|
743
|
-
nextRefAccess(state)
|
|
744
|
-
);
|
|
745
|
-
return state.buf.push(
|
|
746
|
-
(assigns ? "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set," : "new Set(") + arrayRef.id + "="
|
|
747
|
-
), writeArray(state, items, arrayRef), state.buf.push(")"), !0;
|
|
1005
|
+
if (!val.size) return state.buf.push("new Set"), !0;
|
|
1006
|
+
let items = [], assigns, i = 0;
|
|
1007
|
+
for (let item of val) item === val && (item = 0, (assigns ||= []).push("i[" + i + "]")), i = items.push(item);
|
|
1008
|
+
let arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
|
|
1009
|
+
return state.buf.push((assigns ? "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set," : "new Set(") + arrayRef.id + "="), writeArray(state, items, arrayRef), state.buf.push(")"), !0;
|
|
748
1010
|
}
|
|
749
1011
|
function writeArrayBuffer(state, val) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
return state.buf.push(result), !0;
|
|
1012
|
+
let result;
|
|
1013
|
+
if (val.byteLength) {
|
|
1014
|
+
let view = new Int8Array(val);
|
|
1015
|
+
result = hasOnlyZeros(view) ? "new ArrayBuffer(" + val.byteLength + ")" : "new Int8Array(" + typedArrayToInitString(view) + ").buffer";
|
|
1016
|
+
} else result = "new ArrayBuffer";
|
|
1017
|
+
return state.buf.push(result), !0;
|
|
757
1018
|
}
|
|
758
1019
|
function writeTypedArray(state, val, ref) {
|
|
759
|
-
|
|
760
|
-
"new " + val.constructor.name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")")
|
|
761
|
-
)), !0;
|
|
1020
|
+
return val.byteOffset || state.refs.has(val.buffer) ? (state.buf.push("new " + val.constructor.name + "("), writeProp(state, val.buffer, ref, "buffer"), state.buf.push(val.byteOffset ? "," + val.byteOffset + ")" : ")")) : (state.refs.set(val.buffer, new Reference(ref, "buffer", state.flush, null)), state.buf.push("new " + val.constructor.name + (val.length === 0 ? "" : "(" + (hasOnlyZeros(val) ? val.length : typedArrayToInitString(val)) + ")"))), !0;
|
|
762
1021
|
}
|
|
763
1022
|
function writeWeakSet(state) {
|
|
764
|
-
|
|
1023
|
+
return state.buf.push("new WeakSet"), !0;
|
|
765
1024
|
}
|
|
766
1025
|
function writeWeakMap(state) {
|
|
767
|
-
|
|
1026
|
+
return state.buf.push("new WeakMap"), !0;
|
|
768
1027
|
}
|
|
769
1028
|
function writeError(state, val, ref) {
|
|
770
|
-
|
|
771
|
-
|
|
1029
|
+
let result = "new " + val.constructor.name + "(" + quote(val.message + "", 0);
|
|
1030
|
+
return val.cause ? (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})")) : state.buf.push(result + ")"), !0;
|
|
772
1031
|
}
|
|
773
1032
|
function writeAggregateError(state, val, ref) {
|
|
774
|
-
|
|
1033
|
+
return state.buf.push("new AggregateError("), writeProp(state, val.errors, ref, "errors"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), !0;
|
|
775
1034
|
}
|
|
776
1035
|
function writeURL(state, val) {
|
|
777
|
-
|
|
1036
|
+
return state.buf.push("new URL(" + quote(val.toString(), 0) + ")"), !0;
|
|
778
1037
|
}
|
|
779
1038
|
function writeURLSearchParams(state, val) {
|
|
780
|
-
|
|
781
|
-
|
|
1039
|
+
let str = val.toString();
|
|
1040
|
+
return str ? state.buf.push("new URLSearchParams(" + quote(str, 0) + ")") : state.buf.push("new URLSearchParams"), !0;
|
|
782
1041
|
}
|
|
783
1042
|
function writeHeaders(state, val) {
|
|
784
|
-
|
|
785
|
-
|
|
1043
|
+
let headers = stringEntriesToProps(val);
|
|
1044
|
+
return state.buf.push("new Headers" + (headers ? "({" + headers + "})" : "")), !0;
|
|
786
1045
|
}
|
|
787
1046
|
function writeFormData(state, val) {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
return sep === "[" ? state.buf.push("new FormData") : state.buf.push(
|
|
792
|
-
valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
|
|
793
|
-
), !0;
|
|
1047
|
+
let sep = "[", valStr = "";
|
|
1048
|
+
for (let [key, value] of val) typeof value == "string" && (valStr += sep + quote(key, 0) + "," + quote(value, 0), sep = ",");
|
|
1049
|
+
return sep === "[" ? state.buf.push("new FormData") : state.buf.push(valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"), !0;
|
|
794
1050
|
}
|
|
795
1051
|
function writeRequest(state, val, ref) {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
hasBody ? options + "})" : options ? ",{" + options + "})" : ")"
|
|
803
|
-
), !0;
|
|
1052
|
+
let sep = "", hasBody = val.body && !val.bodyUsed && val.duplex === "half";
|
|
1053
|
+
state.buf.push("new Request(" + quote(val.url, 0)), hasBody && (state.buf.push(",{body:"), writeProp(state, val.body, ref, "body") ? (state.buf.push(",duplex:\"half\""), sep = ",") : state.buf.pop());
|
|
1054
|
+
let options = "";
|
|
1055
|
+
val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
|
|
1056
|
+
let headers = stringEntriesToProps(val.headers);
|
|
1057
|
+
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}", sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(hasBody ? options + "})" : options ? ",{" + options + "})" : ")"), !0;
|
|
804
1058
|
}
|
|
805
1059
|
function writeResponse(state, val, ref) {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
"new Response" + (options ? "(null,{" + options + "})" : "")
|
|
811
|
-
) : (state.buf.push("new Response("), state.buf.push(
|
|
812
|
-
(writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")")
|
|
813
|
-
)), !0;
|
|
1060
|
+
let sep = "", options = "";
|
|
1061
|
+
val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
|
|
1062
|
+
let headers = stringEntriesToProps(val.headers);
|
|
1063
|
+
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}"), !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
|
|
814
1064
|
}
|
|
815
1065
|
function writeReadableStream(state, val, ref) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
"new ReadableStream({start(c){(async(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()]))=>{for(i of a)v=await i,i==l?c.close():c.enqueue(v)})(" + iterId + "={}).catch(e=>c.error(e))}})"
|
|
825
|
-
), reader.read().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
1066
|
+
let { boundary } = state;
|
|
1067
|
+
if (!boundary || val.locked) return !1;
|
|
1068
|
+
let reader = val.getReader(), iterId = nextRefAccess(state), iterRef = new Reference(ref, null, state.flush, null, iterId), onFulfilled = ({ value, done }) => {
|
|
1069
|
+
done ? writeAsyncCall(state, boundary, iterRef, "r", value) : boundary.signal.aborted || (reader.read().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, iterRef, "f", value));
|
|
1070
|
+
}, onRejected = (reason) => {
|
|
1071
|
+
writeAsyncCall(state, boundary, iterRef, "j", reason);
|
|
1072
|
+
};
|
|
1073
|
+
return state.buf.push("new ReadableStream({start(c){(async(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()]))=>{for(i of a)v=await i,i==l?c.close():c.enqueue(v)})(" + iterId + "={}).catch(e=>c.error(e))}})"), reader.read().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
826
1074
|
}
|
|
827
1075
|
function writeGenerator(state, iter, ref) {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
return state.buf.push("})()"), !0;
|
|
1076
|
+
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1077
|
+
let sep = "";
|
|
1078
|
+
for (state.buf.push("(function*(){");;) {
|
|
1079
|
+
let { value, done } = iter.next();
|
|
1080
|
+
if (done) {
|
|
1081
|
+
value !== void 0 && (state.buf.push(sep + "return "), writeProp(state, value, ref, ""));
|
|
1082
|
+
break;
|
|
1083
|
+
}
|
|
1084
|
+
value === void 0 ? state.buf.push(sep + "yield") : (state.buf.push(sep + "yield "), writeProp(state, value, ref, "")), sep = ";";
|
|
1085
|
+
}
|
|
1086
|
+
return state.buf.push("})()"), !0;
|
|
840
1087
|
}
|
|
841
1088
|
function writeAsyncGenerator(state, iter, ref) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
return state.buf.push(
|
|
852
|
-
"(async function*(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()])){for(i of a)v=await i,i!=l&&(yield v);return v})(" + iterId + "={})"
|
|
853
|
-
), iter.next().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
1089
|
+
if (iter[kTouchedIterator]) return state.buf.push("(async function*(){}())"), !0;
|
|
1090
|
+
let { boundary } = state;
|
|
1091
|
+
if (!boundary) return !1;
|
|
1092
|
+
let iterId = nextRefAccess(state), iterRef = new Reference(ref, null, state.flush, null, iterId), onFulfilled = ({ value, done }) => {
|
|
1093
|
+
done ? writeAsyncCall(state, boundary, iterRef, "r", value) : boundary.signal.aborted || (iter.next().then(onFulfilled, onRejected), boundary.startAsync(), writeAsyncCall(state, boundary, iterRef, "f", value));
|
|
1094
|
+
}, onRejected = (reason) => {
|
|
1095
|
+
writeAsyncCall(state, boundary, iterRef, "j", reason);
|
|
1096
|
+
};
|
|
1097
|
+
return state.buf.push("(async function*(_,f,v,l,i,p=a=>l=new Promise((r,j)=>{f=_.r=r;_.j=j}),a=((_.f=v=>{f(v);a.push(p())}),[p()])){for(i of a)v=await i,i!=l&&(yield v);return v})(" + iterId + "={})"), iter.next().then(onFulfilled, onRejected), boundary.startAsync(), !0;
|
|
854
1098
|
}
|
|
855
1099
|
function writeNullObject(state, val, ref) {
|
|
856
|
-
|
|
1100
|
+
return state.buf.push("{"), state.buf.push(writeObjectProps(state, val, ref) + "__proto__:null}"), !0;
|
|
857
1101
|
}
|
|
858
1102
|
function writeObjectProps(state, val, ref) {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
let iterRef = new Reference(
|
|
883
|
-
ref,
|
|
884
|
-
null,
|
|
885
|
-
state.flush,
|
|
886
|
-
null,
|
|
887
|
-
nextRefAccess(state)
|
|
888
|
-
);
|
|
889
|
-
state.buf.push(sep + "*[(" + iterRef.id + "="), writeArray(state, iterArr, iterRef), state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
890
|
-
break;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
sep = ",";
|
|
894
|
-
}
|
|
895
|
-
return sep;
|
|
1103
|
+
let sep = "";
|
|
1104
|
+
for (let key in val) if (hasOwnProperty.call(val, key)) {
|
|
1105
|
+
let escapedKey = toObjectKey(key);
|
|
1106
|
+
state.buf.push(sep + escapedKey + ":"), writeProp(state, val[key], ref, escapedKey) ? sep = "," : state.buf.pop();
|
|
1107
|
+
}
|
|
1108
|
+
if (hasSymbolIterator(val)) {
|
|
1109
|
+
let iterArr = [...val];
|
|
1110
|
+
switch (iterArr.length) {
|
|
1111
|
+
case 0:
|
|
1112
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
1113
|
+
break;
|
|
1114
|
+
case 1:
|
|
1115
|
+
state.buf.push(sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}");
|
|
1116
|
+
break;
|
|
1117
|
+
default: {
|
|
1118
|
+
let iterRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
|
|
1119
|
+
state.buf.push(sep + "*[(" + iterRef.id + "="), writeArray(state, iterArr, iterRef), state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
sep = ",";
|
|
1124
|
+
}
|
|
1125
|
+
return sep;
|
|
896
1126
|
}
|
|
897
1127
|
function writeAsyncCall(state, boundary, ref, method, value, preferredValueId = null) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
}
|
|
907
|
-
state.buf.push(")"), boundary.endAsync();
|
|
1128
|
+
if (boundary.signal.aborted) return;
|
|
1129
|
+
state.flushed = !0;
|
|
1130
|
+
let valueStartIndex = state.buf.push((state.buf.length === 0 ? "" : ",") + ref.id + "." + method + "(");
|
|
1131
|
+
if (writeProp(state, value, ref, "")) {
|
|
1132
|
+
let valueRef = state.refs.get(value);
|
|
1133
|
+
valueRef && !valueRef.id && (valueRef.id = preferredValueId || nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
|
|
1134
|
+
}
|
|
1135
|
+
state.buf.push(")"), boundary.endAsync();
|
|
908
1136
|
}
|
|
909
1137
|
function isCircular(parent, ref) {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1138
|
+
let cur = parent;
|
|
1139
|
+
for (; cur;) {
|
|
1140
|
+
if (cur === ref) return !0;
|
|
1141
|
+
cur = cur.parent;
|
|
1142
|
+
}
|
|
1143
|
+
return !1;
|
|
916
1144
|
}
|
|
917
1145
|
function toObjectKey(name) {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
return quote(name, i);
|
|
929
|
-
} else if (isWord(startChar)) {
|
|
930
|
-
for (let i = 1; i < name.length; i++)
|
|
931
|
-
if (!isWordOrDigit(name[i]))
|
|
932
|
-
return quote(name, i);
|
|
933
|
-
} else
|
|
934
|
-
return quote(name, 0);
|
|
935
|
-
return name;
|
|
1146
|
+
if (name === "") return "\"\"";
|
|
1147
|
+
let startChar = name[0];
|
|
1148
|
+
if (isDigit(startChar)) {
|
|
1149
|
+
if (startChar === "0") {
|
|
1150
|
+
if (name !== "0") return quote(name, 1);
|
|
1151
|
+
} else for (let i = 1; i < name.length; i++) if (!isDigit(name[i])) return quote(name, i);
|
|
1152
|
+
} else if (isWord(startChar)) {
|
|
1153
|
+
for (let i = 1; i < name.length; i++) if (!isWordOrDigit(name[i])) return quote(name, i);
|
|
1154
|
+
} else return quote(name, 0);
|
|
1155
|
+
return name;
|
|
936
1156
|
}
|
|
937
1157
|
function toAccess(accessor) {
|
|
938
|
-
|
|
939
|
-
|
|
1158
|
+
let start = accessor[0];
|
|
1159
|
+
return start === "\"" || start >= "0" && start <= "9" ? "[" + accessor + "]" : "." + accessor;
|
|
940
1160
|
}
|
|
941
1161
|
function quote(str, startPos) {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
return '"' + (lastPos === startPos ? str : result + str.slice(lastPos)) + '"';
|
|
1162
|
+
let result = "", lastPos = 0;
|
|
1163
|
+
for (let i = startPos; i < str.length; i++) {
|
|
1164
|
+
let replacement;
|
|
1165
|
+
switch (str[i]) {
|
|
1166
|
+
case "\"":
|
|
1167
|
+
replacement = "\\\"";
|
|
1168
|
+
break;
|
|
1169
|
+
case "\\":
|
|
1170
|
+
replacement = "\\\\";
|
|
1171
|
+
break;
|
|
1172
|
+
case "<":
|
|
1173
|
+
replacement = "\\x3C";
|
|
1174
|
+
break;
|
|
1175
|
+
case "\n":
|
|
1176
|
+
replacement = "\\n";
|
|
1177
|
+
break;
|
|
1178
|
+
case "\r":
|
|
1179
|
+
replacement = "\\r";
|
|
1180
|
+
break;
|
|
1181
|
+
case "\u2028":
|
|
1182
|
+
replacement = "\\u2028";
|
|
1183
|
+
break;
|
|
1184
|
+
case "\u2029":
|
|
1185
|
+
replacement = "\\u2029";
|
|
1186
|
+
break;
|
|
1187
|
+
default: continue;
|
|
1188
|
+
}
|
|
1189
|
+
result += str.slice(lastPos, i) + replacement, lastPos = i + 1;
|
|
1190
|
+
}
|
|
1191
|
+
return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
|
|
974
1192
|
}
|
|
975
1193
|
function ensureId(state, ref) {
|
|
976
|
-
|
|
1194
|
+
return ref.id || assignId(state, ref);
|
|
977
1195
|
}
|
|
978
1196
|
function assignId(state, ref) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
return ref.id + "=" + accessPrevValue;
|
|
1197
|
+
let { pos } = ref;
|
|
1198
|
+
if (ref.id = nextRefAccess(state), pos !== null && ref.flush === state.flush) return pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id;
|
|
1199
|
+
let cur = ref, accessPrevValue = "";
|
|
1200
|
+
do {
|
|
1201
|
+
accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
|
|
1202
|
+
let parent = cur.parent;
|
|
1203
|
+
if (parent.id) {
|
|
1204
|
+
accessPrevValue = parent.id + accessPrevValue;
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
if (parent.flush === state.flush) {
|
|
1208
|
+
accessPrevValue = ensureId(state, parent) + accessPrevValue;
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
|
+
cur = parent;
|
|
1212
|
+
} while (cur);
|
|
1213
|
+
return ref.id + "=" + accessPrevValue;
|
|
997
1214
|
}
|
|
998
1215
|
function assignsToString(assigns, value) {
|
|
999
|
-
|
|
1216
|
+
return assigns.length > 100 ? "($=>(" + assigns.join("=$,") + "=$))(" + value + ")" : assigns.join("=") + "=" + value;
|
|
1000
1217
|
}
|
|
1001
1218
|
function addAssignment(ref, assign) {
|
|
1002
|
-
|
|
1219
|
+
ref.assigns ? ref.assigns.push(assign) : ref.assigns = [assign];
|
|
1003
1220
|
}
|
|
1004
1221
|
function nextRefAccess(state) {
|
|
1005
|
-
|
|
1222
|
+
return "_." + nextId(state);
|
|
1006
1223
|
}
|
|
1007
1224
|
function nextId(state) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
return r;
|
|
1225
|
+
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = state.ids++, r = c[n % 53];
|
|
1226
|
+
for (n = n / 53 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1227
|
+
return r;
|
|
1012
1228
|
}
|
|
1013
1229
|
function hasSymbolIterator(value) {
|
|
1014
|
-
|
|
1230
|
+
return Symbol.iterator in value;
|
|
1015
1231
|
}
|
|
1016
1232
|
function stringEntriesToProps(entries) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
return result;
|
|
1233
|
+
let result = "", sep = "";
|
|
1234
|
+
for (let [key, value] of entries) result += sep + toObjectKey(key) + ":" + quote(value, 0), sep = ",";
|
|
1235
|
+
return result;
|
|
1021
1236
|
}
|
|
1022
1237
|
function typedArrayToInitString(view) {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
return result += "]", result;
|
|
1238
|
+
let result = "[", sep = "";
|
|
1239
|
+
for (let i = 0; i < view.length; i++) result += sep + view[i], sep = ",";
|
|
1240
|
+
return result += "]", result;
|
|
1027
1241
|
}
|
|
1028
1242
|
function hasOnlyZeros(typedArray) {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
return !0;
|
|
1243
|
+
for (let i = 0; i < typedArray.length; i++) if (typedArray[i] !== 0) return !1;
|
|
1244
|
+
return !0;
|
|
1032
1245
|
}
|
|
1033
1246
|
function isWordOrDigit(char) {
|
|
1034
|
-
|
|
1247
|
+
return isWord(char) || isDigit(char);
|
|
1035
1248
|
}
|
|
1036
1249
|
function isDigit(char) {
|
|
1037
|
-
|
|
1250
|
+
return char >= "0" && char <= "9";
|
|
1038
1251
|
}
|
|
1039
1252
|
function isWord(char) {
|
|
1040
|
-
|
|
1253
|
+
return char >= "a" && char <= "z" || char >= "A" && char <= "Z" || char === "_" || char === "$";
|
|
1041
1254
|
}
|
|
1042
1255
|
function patchIteratorNext(proto) {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1256
|
+
let { next } = proto;
|
|
1257
|
+
proto.next = function(value) {
|
|
1258
|
+
return this[kTouchedIterator] = 1, next.call(this, value);
|
|
1259
|
+
};
|
|
1047
1260
|
}
|
|
1048
1261
|
function compareRegisteredReferences(a, b) {
|
|
1049
|
-
|
|
1262
|
+
return a.registered.instanceId - b.registered.instanceId;
|
|
1050
1263
|
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
var $chunk, NOOP = () => {
|
|
1054
|
-
}, K_SCOPE_ID = /* @__PURE__ */ Symbol("Scope ID"), K_SCOPE_REFERENCED = /* @__PURE__ */ Symbol("Scope Referenced");
|
|
1264
|
+
//#endregion
|
|
1265
|
+
//#region src/html/writer.ts
|
|
1055
1266
|
function getChunk() {
|
|
1056
|
-
|
|
1267
|
+
return $chunk;
|
|
1057
1268
|
}
|
|
1058
1269
|
function getContext(key) {
|
|
1059
|
-
|
|
1270
|
+
return $chunk.context?.[key];
|
|
1060
1271
|
}
|
|
1061
1272
|
function getState() {
|
|
1062
|
-
|
|
1273
|
+
return $chunk.boundary.state;
|
|
1063
1274
|
}
|
|
1064
1275
|
function getScopeId(scope) {
|
|
1065
|
-
|
|
1276
|
+
return scope[K_SCOPE_ID];
|
|
1066
1277
|
}
|
|
1067
1278
|
function _html(html) {
|
|
1068
|
-
|
|
1279
|
+
$chunk.writeHTML(html);
|
|
1069
1280
|
}
|
|
1070
1281
|
function writeScript(script) {
|
|
1071
|
-
|
|
1282
|
+
$chunk.writeScript(script);
|
|
1072
1283
|
}
|
|
1073
1284
|
function _script(scopeId, registryId) {
|
|
1074
|
-
|
|
1285
|
+
$chunk.context?.[kIsAsync] && _resume_branch(scopeId), $chunk.boundary.state.needsMainRuntime = !0, $chunk.writeEffect(scopeId, registryId);
|
|
1075
1286
|
}
|
|
1076
1287
|
function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
["D" /* ConditionalRenderer */ + nodeAccessor]: render2?.a
|
|
1083
|
-
}) : _scope_id();
|
|
1288
|
+
let shouldResume = serializeReason !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
|
|
1289
|
+
render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
|
|
1290
|
+
["A" + nodeAccessor]: referenceScope(writeScope(branchId, {})),
|
|
1291
|
+
["D" + nodeAccessor]: render?.a
|
|
1292
|
+
});
|
|
1084
1293
|
}
|
|
1085
1294
|
function normalizeServerRender(value) {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
return renderer;
|
|
1295
|
+
let renderer = normalizeDynamicRenderer(value);
|
|
1296
|
+
if (renderer && typeof renderer == "function") return renderer;
|
|
1089
1297
|
}
|
|
1090
|
-
var kPendingContexts = /* @__PURE__ */ Symbol("Pending Contexts");
|
|
1091
1298
|
function withContext(key, value, cb, cbValue) {
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1100
|
-
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
parentScopeId
|
|
1105
|
-
);
|
|
1299
|
+
let ctx = $chunk.context ||= { [kPendingContexts]: 0 }, prev = ctx[key];
|
|
1300
|
+
ctx[kPendingContexts]++, ctx[key] = value;
|
|
1301
|
+
try {
|
|
1302
|
+
return cb(cbValue);
|
|
1303
|
+
} finally {
|
|
1304
|
+
ctx[kPendingContexts]--, ctx[key] = prev;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
|
|
1308
|
+
_scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
|
|
1309
|
+
let childScope = _scope_with_id(childScopeId);
|
|
1310
|
+
childScope.T = _resume({}, registryId, parentScopeId), nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
|
|
1106
1311
|
}
|
|
1107
1312
|
function _resume(val, id, scopeId) {
|
|
1108
|
-
|
|
1109
|
-
id,
|
|
1110
|
-
val,
|
|
1111
|
-
_scope_with_id(scopeId)
|
|
1112
|
-
);
|
|
1313
|
+
return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
|
|
1113
1314
|
}
|
|
1114
1315
|
function _id() {
|
|
1115
|
-
|
|
1116
|
-
|
|
1316
|
+
let state = $chunk.boundary.state, { $global } = state;
|
|
1317
|
+
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1117
1318
|
}
|
|
1118
1319
|
function _scope_id() {
|
|
1119
|
-
|
|
1320
|
+
return $chunk.boundary.state.scopeId++;
|
|
1120
1321
|
}
|
|
1121
1322
|
function _peek_scope_id() {
|
|
1122
|
-
|
|
1323
|
+
return $chunk.boundary.state.scopeId;
|
|
1123
1324
|
}
|
|
1124
1325
|
function getScopeById(scopeId) {
|
|
1125
|
-
|
|
1126
|
-
return $chunk.boundary.state.scopes.get(scopeId);
|
|
1326
|
+
if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
|
|
1127
1327
|
}
|
|
1128
1328
|
function _set_serialize_reason(reason) {
|
|
1129
|
-
|
|
1329
|
+
$chunk.boundary.state.serializeReason = reason;
|
|
1130
1330
|
}
|
|
1131
1331
|
function _scope_reason() {
|
|
1132
|
-
|
|
1133
|
-
|
|
1332
|
+
let reason = $chunk.boundary.state.serializeReason;
|
|
1333
|
+
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1134
1334
|
}
|
|
1135
1335
|
function _serialize_if(condition, key) {
|
|
1136
|
-
|
|
1336
|
+
return condition && (condition === 1 || condition[key]) ? 1 : void 0;
|
|
1137
1337
|
}
|
|
1138
1338
|
function _serialize_guard(condition, key) {
|
|
1139
|
-
|
|
1339
|
+
return condition && (condition === 1 || condition[key]) ? 1 : 0;
|
|
1140
1340
|
}
|
|
1141
1341
|
function _el_resume(scopeId, accessor, shouldResume) {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1342
|
+
if (shouldResume === 0) return "";
|
|
1343
|
+
let { state } = $chunk.boundary;
|
|
1344
|
+
return state.needsMainRuntime = !0, state.mark("*", scopeId + " " + accessor);
|
|
1145
1345
|
}
|
|
1146
1346
|
function _sep(shouldResume) {
|
|
1147
|
-
|
|
1347
|
+
return shouldResume === 0 ? "" : "<!>";
|
|
1148
1348
|
}
|
|
1149
1349
|
function _el(scopeId, id) {
|
|
1150
|
-
|
|
1350
|
+
return _resume(() => void 0, id, scopeId);
|
|
1151
1351
|
}
|
|
1152
1352
|
function _hoist(scopeId, id) {
|
|
1153
|
-
|
|
1154
|
-
|
|
1353
|
+
let getter = () => void 0;
|
|
1354
|
+
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1155
1355
|
}
|
|
1156
1356
|
function _resume_branch(scopeId) {
|
|
1157
|
-
|
|
1158
|
-
|
|
1357
|
+
let branchId = $chunk.context?.[kBranchId];
|
|
1358
|
+
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1159
1359
|
}
|
|
1160
|
-
var kBranchId = /* @__PURE__ */ Symbol("Branch Id"), kIsAsync = /* @__PURE__ */ Symbol("Is Async");
|
|
1161
1360
|
function isInResumedBranch() {
|
|
1162
|
-
|
|
1361
|
+
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1163
1362
|
}
|
|
1164
1363
|
function withBranchId(branchId, cb) {
|
|
1165
|
-
|
|
1364
|
+
return withContext(kBranchId, branchId, cb);
|
|
1166
1365
|
}
|
|
1167
1366
|
function withIsAsync(cb, value) {
|
|
1168
|
-
|
|
1367
|
+
return withContext(kIsAsync, !0, cb, value);
|
|
1169
1368
|
}
|
|
1170
1369
|
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
});
|
|
1185
|
-
}), loopScopes && writeScope(scopeId, {
|
|
1186
|
-
["A" /* BranchScopes */ + accessor]: loopScopes
|
|
1187
|
-
});
|
|
1188
|
-
} else
|
|
1189
|
-
forOf(list, cb);
|
|
1190
|
-
writeBranchEnd(
|
|
1191
|
-
scopeId,
|
|
1192
|
-
accessor,
|
|
1193
|
-
serializeStateful,
|
|
1194
|
-
serializeMarker,
|
|
1195
|
-
parentEndTag,
|
|
1196
|
-
singleNode,
|
|
1197
|
-
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
|
1198
|
-
);
|
|
1370
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1371
|
+
if (serializeBranch !== 0) {
|
|
1372
|
+
let loopScopes;
|
|
1373
|
+
forOf(list, (item, index) => {
|
|
1374
|
+
let branchId = _peek_scope_id(), itemKey = forOfBy(by, item, index);
|
|
1375
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1376
|
+
cb(item, index);
|
|
1377
|
+
let branchScope = writeScope(branchId, {});
|
|
1378
|
+
resumeKeys && itemKey !== index && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1379
|
+
});
|
|
1380
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1381
|
+
} else forOf(list, cb);
|
|
1382
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1199
1383
|
}
|
|
1200
1384
|
function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
});
|
|
1215
|
-
}), loopScopes && writeScope(scopeId, {
|
|
1216
|
-
["A" /* BranchScopes */ + accessor]: loopScopes
|
|
1217
|
-
});
|
|
1218
|
-
} else
|
|
1219
|
-
forIn(obj, cb);
|
|
1220
|
-
writeBranchEnd(
|
|
1221
|
-
scopeId,
|
|
1222
|
-
accessor,
|
|
1223
|
-
serializeStateful,
|
|
1224
|
-
serializeMarker,
|
|
1225
|
-
parentEndTag,
|
|
1226
|
-
singleNode,
|
|
1227
|
-
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
|
1228
|
-
);
|
|
1385
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1386
|
+
if (serializeBranch !== 0) {
|
|
1387
|
+
let loopScopes;
|
|
1388
|
+
forIn(obj, (key, value) => {
|
|
1389
|
+
let branchId = _peek_scope_id(), itemKey = forInBy(by, key, value);
|
|
1390
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1391
|
+
cb(key, value);
|
|
1392
|
+
let branchScope = writeScope(branchId, {});
|
|
1393
|
+
resumeKeys && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1394
|
+
});
|
|
1395
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1396
|
+
} else forIn(obj, cb);
|
|
1397
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1229
1398
|
}
|
|
1230
1399
|
function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
});
|
|
1245
|
-
}), loopScopes && writeScope(scopeId, {
|
|
1246
|
-
["A" /* BranchScopes */ + accessor]: loopScopes
|
|
1247
|
-
});
|
|
1248
|
-
} else
|
|
1249
|
-
forTo(to, from, step, cb);
|
|
1250
|
-
writeBranchEnd(
|
|
1251
|
-
scopeId,
|
|
1252
|
-
accessor,
|
|
1253
|
-
serializeStateful,
|
|
1254
|
-
serializeMarker,
|
|
1255
|
-
parentEndTag,
|
|
1256
|
-
singleNode,
|
|
1257
|
-
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
|
1258
|
-
);
|
|
1400
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1401
|
+
if (serializeBranch !== 0) {
|
|
1402
|
+
let loopScopes;
|
|
1403
|
+
forTo(to, from, step, (i) => {
|
|
1404
|
+
let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
|
|
1405
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1406
|
+
cb(i);
|
|
1407
|
+
let branchScope = writeScope(branchId, {});
|
|
1408
|
+
resumeKeys && itemKey !== i && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1409
|
+
});
|
|
1410
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1411
|
+
} else forTo(to, from, step, cb);
|
|
1412
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1259
1413
|
}
|
|
1260
1414
|
function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
});
|
|
1275
|
-
}), loopScopes && writeScope(scopeId, {
|
|
1276
|
-
["A" /* BranchScopes */ + accessor]: loopScopes
|
|
1277
|
-
});
|
|
1278
|
-
} else
|
|
1279
|
-
forUntil(to, from, step, cb);
|
|
1280
|
-
writeBranchEnd(
|
|
1281
|
-
scopeId,
|
|
1282
|
-
accessor,
|
|
1283
|
-
serializeStateful,
|
|
1284
|
-
serializeMarker,
|
|
1285
|
-
parentEndTag,
|
|
1286
|
-
singleNode,
|
|
1287
|
-
singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
|
|
1288
|
-
);
|
|
1415
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1416
|
+
if (serializeBranch !== 0) {
|
|
1417
|
+
let loopScopes;
|
|
1418
|
+
forUntil(to, from, step, (i) => {
|
|
1419
|
+
let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
|
|
1420
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1421
|
+
cb(i);
|
|
1422
|
+
let branchScope = writeScope(branchId, {});
|
|
1423
|
+
resumeKeys && itemKey !== i && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1424
|
+
});
|
|
1425
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1426
|
+
} else forUntil(to, from, step, cb);
|
|
1427
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1289
1428
|
}
|
|
1290
1429
|
function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
["D" /* ConditionalRenderer */ + accessor]: branchIndex || void 0,
|
|
1299
|
-
// we convert 0 to undefined since the runtime defaults branch to 0.
|
|
1300
|
-
["A" /* BranchScopes */ + accessor]: resumeMarker ? void 0 : referenceScope(writeScope(branchId, {}))
|
|
1301
|
-
}), writeBranchEnd(
|
|
1302
|
-
scopeId,
|
|
1303
|
-
accessor,
|
|
1304
|
-
serializeStateful,
|
|
1305
|
-
serializeMarker,
|
|
1306
|
-
parentEndTag,
|
|
1307
|
-
singleNode,
|
|
1308
|
-
shouldWriteBranch ? " " + branchId : ""
|
|
1309
|
-
);
|
|
1430
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), branchId = _peek_scope_id();
|
|
1431
|
+
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[", ""));
|
|
1432
|
+
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1433
|
+
shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1434
|
+
["D" + accessor]: branchIndex || void 0,
|
|
1435
|
+
["A" + accessor]: resumeMarker ? void 0 : referenceScope(writeScope(branchId, {}))
|
|
1436
|
+
}), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1310
1437
|
}
|
|
1311
1438
|
function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, branchIds) {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
) : state.mark(
|
|
1319
|
-
parentEndTag ? ")" /* BranchEndOnlyChildInParent */ : "]" /* BranchEnd */,
|
|
1320
|
-
scopeId + " " + accessor + (branchIds || "")
|
|
1321
|
-
);
|
|
1322
|
-
$chunk.writeHTML(mark + endTag);
|
|
1323
|
-
} else
|
|
1324
|
-
$chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1325
|
-
else
|
|
1326
|
-
$chunk.writeHTML(endTag);
|
|
1439
|
+
let endTag = parentEndTag || "";
|
|
1440
|
+
if (serializeMarker !== 0) if (!parentEndTag || serializeStateful !== 0) {
|
|
1441
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1442
|
+
$chunk.writeHTML(mark + endTag);
|
|
1443
|
+
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1444
|
+
else $chunk.writeHTML(endTag);
|
|
1327
1445
|
}
|
|
1328
1446
|
function scopeHasReference(scope) {
|
|
1329
|
-
|
|
1447
|
+
return !!scope[K_SCOPE_REFERENCED];
|
|
1330
1448
|
}
|
|
1331
1449
|
function referenceScope(scope) {
|
|
1332
|
-
|
|
1450
|
+
return scope[K_SCOPE_REFERENCED] = 1, scope;
|
|
1333
1451
|
}
|
|
1334
|
-
var writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
|
1335
1452
|
function writeScopeToState(state, scopeId, partialScope) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1453
|
+
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1454
|
+
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
|
|
1338
1455
|
}
|
|
1339
1456
|
function _existing_scope(scopeId) {
|
|
1340
|
-
|
|
1457
|
+
return writeScope(scopeId, _scope_with_id(scopeId));
|
|
1341
1458
|
}
|
|
1342
1459
|
function _scope_with_id(scopeId) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1460
|
+
let { state } = $chunk.boundary, scope = state.scopes.get(scopeId);
|
|
1461
|
+
return scope || (scope = { [K_SCOPE_ID]: scopeId }, state.scopes.set(scopeId, scope)), referenceScope(scope);
|
|
1345
1462
|
}
|
|
1346
1463
|
function $global() {
|
|
1347
|
-
|
|
1464
|
+
return $chunk.boundary.state.$global;
|
|
1348
1465
|
}
|
|
1349
1466
|
function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
$chunk.writeHTML(
|
|
1373
|
-
$chunk.boundary.state.mark("[" /* BranchStart */, "")
|
|
1374
|
-
), withIsAsync(content, value), $chunk.writeHTML(
|
|
1375
|
-
$chunk.boundary.state.mark(
|
|
1376
|
-
"]" /* BranchEnd */,
|
|
1377
|
-
scopeId + " " + accessor + " " + branchId
|
|
1378
|
-
)
|
|
1379
|
-
);
|
|
1380
|
-
} else
|
|
1381
|
-
withIsAsync(content, value);
|
|
1382
|
-
}), boundary.endAsync(chunk)));
|
|
1383
|
-
},
|
|
1384
|
-
(err) => {
|
|
1385
|
-
chunk.async = !1, boundary.abort(err);
|
|
1386
|
-
}
|
|
1387
|
-
);
|
|
1467
|
+
let resumeMarker = serializeMarker !== 0;
|
|
1468
|
+
if (!isPromise(promise)) {
|
|
1469
|
+
if (resumeMarker) {
|
|
1470
|
+
let branchId = _peek_scope_id();
|
|
1471
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), content(promise), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1472
|
+
} else content(promise);
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
let chunk = $chunk, { boundary } = chunk;
|
|
1476
|
+
chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context), chunk.async = !0, chunk.context?.[kPendingContexts] && (chunk.context = {
|
|
1477
|
+
...chunk.context,
|
|
1478
|
+
[kPendingContexts]: 0
|
|
1479
|
+
}), boundary.startAsync(), promise.then((value) => {
|
|
1480
|
+
chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(() => {
|
|
1481
|
+
if (resumeMarker) {
|
|
1482
|
+
let branchId = _peek_scope_id();
|
|
1483
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withIsAsync(content, value), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1484
|
+
} else withIsAsync(content, value);
|
|
1485
|
+
}), boundary.endAsync(chunk)));
|
|
1486
|
+
}, (err) => {
|
|
1487
|
+
chunk.async = !1, boundary.abort(err);
|
|
1488
|
+
});
|
|
1388
1489
|
}
|
|
1389
1490
|
function _try(scopeId, accessor, content, input) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
C: accessor,
|
|
1399
|
-
E: catchContent,
|
|
1400
|
-
Q: placeholderContent
|
|
1401
|
-
}), $chunk.writeHTML(
|
|
1402
|
-
$chunk.boundary.state.mark(
|
|
1403
|
-
"]" /* BranchEnd */,
|
|
1404
|
-
scopeId + " " + accessor + " " + branchId
|
|
1405
|
-
)
|
|
1406
|
-
);
|
|
1491
|
+
let branchId = _peek_scope_id();
|
|
1492
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
1493
|
+
let catchContent = input.catch ? normalizeDynamicRenderer(input.catch) || 0 : void 0, placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
|
1494
|
+
catchContent === void 0 ? placeholderContent ? tryPlaceholder(content, placeholderContent, branchId) : content() : tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId) : content, catchContent || (() => {})), writeScope(branchId, {
|
|
1495
|
+
C: accessor,
|
|
1496
|
+
E: catchContent,
|
|
1497
|
+
Q: placeholderContent
|
|
1498
|
+
}), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1407
1499
|
}
|
|
1408
1500
|
function tryPlaceholder(content, placeholder, branchId) {
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1501
|
+
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context);
|
|
1502
|
+
if (body === body.render(content)) {
|
|
1503
|
+
chunk.append(body);
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context), chunk.placeholderBody = body, chunk.placeholderRender = placeholder, chunk.placeholderBranchId = branchId;
|
|
1415
1507
|
}
|
|
1416
1508
|
function tryCatch(content, catchContent) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1442
|
-
var State2 = class {
|
|
1443
|
-
constructor($global2) {
|
|
1444
|
-
this.$global = $global2;
|
|
1445
|
-
this.$global = $global2, $global2.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global2.cspNonce));
|
|
1446
|
-
}
|
|
1447
|
-
tagId = 1;
|
|
1448
|
-
scopeId = 1;
|
|
1449
|
-
reorderId = 1;
|
|
1450
|
-
lastSerializedScopeId = this.scopeId;
|
|
1451
|
-
hasGlobals = !1;
|
|
1452
|
-
needsMainRuntime = !1;
|
|
1453
|
-
hasMainRuntime = !1;
|
|
1454
|
-
hasReorderRuntime = !1;
|
|
1455
|
-
hasWrittenResume = !1;
|
|
1456
|
-
walkOnNextFlush = !1;
|
|
1457
|
-
trailerHTML = "";
|
|
1458
|
-
resumes = "";
|
|
1459
|
-
nonceAttr = "";
|
|
1460
|
-
serializer = new Serializer();
|
|
1461
|
-
writeReorders = null;
|
|
1462
|
-
scopes = /* @__PURE__ */ new Map();
|
|
1463
|
-
writeScopes = null;
|
|
1464
|
-
ensureReady = null;
|
|
1465
|
-
serializeReason;
|
|
1466
|
-
get runtimePrefix() {
|
|
1467
|
-
let { $global: $global2 } = this;
|
|
1468
|
-
return $global2.runtimeId + "." + $global2.renderId;
|
|
1469
|
-
}
|
|
1470
|
-
get commentPrefix() {
|
|
1471
|
-
let { $global: $global2 } = this;
|
|
1472
|
-
return $global2.runtimeId + $global2.renderId;
|
|
1473
|
-
}
|
|
1474
|
-
reorder(chunk) {
|
|
1475
|
-
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
1476
|
-
}
|
|
1477
|
-
nextReorderId() {
|
|
1478
|
-
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
1479
|
-
for (n = n / 54 | 0; n; n >>>= 6)
|
|
1480
|
-
r += c[n & 63];
|
|
1481
|
-
return r;
|
|
1482
|
-
}
|
|
1483
|
-
mark(code, str) {
|
|
1484
|
-
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1485
|
-
}
|
|
1486
|
-
};
|
|
1487
|
-
var Boundary = class extends AbortController {
|
|
1488
|
-
constructor(state, parent) {
|
|
1489
|
-
super();
|
|
1490
|
-
this.state = state;
|
|
1491
|
-
this.state = state, this.signal.addEventListener("abort", () => {
|
|
1492
|
-
this.count = 0, this.state = new State2(this.state.$global), this.onNext();
|
|
1493
|
-
}), parent && (parent.aborted ? this.abort(parent.reason) : parent.addEventListener("abort", () => {
|
|
1494
|
-
this.abort(parent.reason);
|
|
1495
|
-
}));
|
|
1496
|
-
}
|
|
1497
|
-
onNext = NOOP;
|
|
1498
|
-
count = 0;
|
|
1499
|
-
flush() {
|
|
1500
|
-
return this.signal.aborted || flushSerializer(this), this.count ? 1 /* continue */ : this.signal.aborted ? 2 /* aborted */ : 0 /* complete */;
|
|
1501
|
-
}
|
|
1502
|
-
startAsync() {
|
|
1503
|
-
this.signal.aborted || this.count++;
|
|
1504
|
-
}
|
|
1505
|
-
endAsync(chunk) {
|
|
1506
|
-
!this.signal.aborted && this.count && (this.count--, chunk?.reorderId && this.state.reorder(chunk), this.onNext());
|
|
1507
|
-
}
|
|
1508
|
-
}, Chunk = class {
|
|
1509
|
-
constructor(boundary, next, context) {
|
|
1510
|
-
this.boundary = boundary;
|
|
1511
|
-
this.next = next;
|
|
1512
|
-
this.context = context;
|
|
1513
|
-
this.boundary = boundary, this.next = next, this.context = context;
|
|
1514
|
-
}
|
|
1515
|
-
html = "";
|
|
1516
|
-
scripts = "";
|
|
1517
|
-
effects = "";
|
|
1518
|
-
lastEffect = "";
|
|
1519
|
-
async = !1;
|
|
1520
|
-
consumed = !1;
|
|
1521
|
-
needsWalk = !1;
|
|
1522
|
-
reorderId = null;
|
|
1523
|
-
placeholderBody = null;
|
|
1524
|
-
placeholderRender = null;
|
|
1525
|
-
placeholderBranchId = null;
|
|
1526
|
-
writeHTML(html) {
|
|
1527
|
-
this.html += html;
|
|
1528
|
-
}
|
|
1529
|
-
writeEffect(scopeId, registryId) {
|
|
1530
|
-
this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1531
|
-
}
|
|
1532
|
-
writeScript(script) {
|
|
1533
|
-
this.scripts = concatScripts(this.scripts, script);
|
|
1534
|
-
}
|
|
1535
|
-
append(chunk) {
|
|
1536
|
-
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
1537
|
-
}
|
|
1538
|
-
flushPlaceholder() {
|
|
1539
|
-
if (this.placeholderBody) {
|
|
1540
|
-
let body = this.placeholderBody.consume();
|
|
1541
|
-
if (body.async) {
|
|
1542
|
-
let { state } = this.boundary, reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
1543
|
-
this.placeholderBranchId = null, this.writeHTML(state.mark("!^" /* Placeholder */, reorderId));
|
|
1544
|
-
let after = this.render(this.placeholderRender);
|
|
1545
|
-
after !== this && this.boundary.abort(
|
|
1546
|
-
new Error("An @placeholder cannot contain async content.")
|
|
1547
|
-
), after.writeHTML(state.mark("!" /* PlaceholderEnd */, reorderId)), state.reorder(body);
|
|
1548
|
-
} else
|
|
1549
|
-
body.next = this.next, this.next = body;
|
|
1550
|
-
this.placeholderRender = this.placeholderBody = null;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
consume() {
|
|
1554
|
-
let cur = this, needsWalk = cur.needsWalk;
|
|
1555
|
-
if (cur.next && !cur.async) {
|
|
1556
|
-
let html = "", effects = "", scripts = "", lastEffect = "";
|
|
1557
|
-
do
|
|
1558
|
-
cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
|
|
1559
|
-
while (cur.next && !cur.async);
|
|
1560
|
-
cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
|
|
1561
|
-
}
|
|
1562
|
-
return cur;
|
|
1563
|
-
}
|
|
1564
|
-
render(content, val) {
|
|
1565
|
-
let prev = $chunk;
|
|
1566
|
-
$chunk = this;
|
|
1567
|
-
try {
|
|
1568
|
-
return content(val), $chunk;
|
|
1569
|
-
} catch (err) {
|
|
1570
|
-
return this.boundary.abort(err), this;
|
|
1571
|
-
} finally {
|
|
1572
|
-
$chunk = prev;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
flushScript() {
|
|
1576
|
-
let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
|
|
1577
|
-
if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
|
1578
|
-
scripts,
|
|
1579
|
-
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
1580
|
-
)), state.ensureReady && state.hasMainRuntime) {
|
|
1581
|
-
let first = !0;
|
|
1582
|
-
for (let id in state.ensureReady)
|
|
1583
|
-
state.ensureReady[id] && (state.ensureReady[id] = 0, first ? scripts = concatScripts(
|
|
1584
|
-
scripts,
|
|
1585
|
-
"(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1"
|
|
1586
|
-
) : scripts = concatScripts(
|
|
1587
|
-
scripts,
|
|
1588
|
-
runtimePrefix + ".b" /* Blocking */ + toAccess(toObjectKey(id)) + "=1"
|
|
1589
|
-
)), first = !1;
|
|
1590
|
-
}
|
|
1591
|
-
if (effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ',"' + effects + '"' : '"' + effects + '"'), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
|
1592
|
-
scripts,
|
|
1593
|
-
runtimePrefix + ".r.push(" + state.resumes + ")"
|
|
1594
|
-
) : (state.hasWrittenResume = !0, scripts = concatScripts(
|
|
1595
|
-
scripts,
|
|
1596
|
-
runtimePrefix + ".r=[" + state.resumes + "]"
|
|
1597
|
-
))), state.writeReorders) {
|
|
1598
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
|
|
1599
|
-
scripts,
|
|
1600
|
-
REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
|
|
1601
|
-
));
|
|
1602
|
-
for (let reorderedChunk of state.writeReorders) {
|
|
1603
|
-
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1604
|
-
for (reorderedChunk.reorderId = null; ; ) {
|
|
1605
|
-
cur.flushPlaceholder();
|
|
1606
|
-
let { next } = cur;
|
|
1607
|
-
if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
|
|
1608
|
-
"#" /* ReorderMarker */,
|
|
1609
|
-
cur.reorderId = state.nextReorderId()
|
|
1610
|
-
), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next)
|
|
1611
|
-
cur = next;
|
|
1612
|
-
else
|
|
1613
|
-
break;
|
|
1614
|
-
}
|
|
1615
|
-
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(
|
|
1616
|
-
scripts,
|
|
1617
|
-
runtimePrefix + ".r=[]"
|
|
1618
|
-
)), reorderScripts = concatScripts(
|
|
1619
|
-
reorderScripts,
|
|
1620
|
-
'_.push("' + reorderEffects + '")'
|
|
1621
|
-
)), scripts = concatScripts(
|
|
1622
|
-
scripts,
|
|
1623
|
-
reorderScripts && runtimePrefix + ".j" /* Scripts */ + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"
|
|
1624
|
-
), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1625
|
-
}
|
|
1626
|
-
state.writeReorders = null;
|
|
1627
|
-
}
|
|
1628
|
-
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
|
|
1629
|
-
}
|
|
1630
|
-
flushHTML() {
|
|
1631
|
-
let { boundary } = this, { state } = boundary;
|
|
1632
|
-
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
1633
|
-
let { scripts } = this, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
|
|
1634
|
-
return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, html = __flush__($global2, html)), boundary.count || (html += state.trailerHTML), html;
|
|
1635
|
-
}
|
|
1636
|
-
};
|
|
1509
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state), body = new Chunk(catchBoundary, null, chunk.context), bodyEnd = body.render(content);
|
|
1510
|
+
if (catchBoundary.signal.aborted) {
|
|
1511
|
+
catchContent(catchBoundary.signal.reason);
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
if (body === bodyEnd) {
|
|
1515
|
+
chunk.append(body);
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
let reorderId = state.nextReorderId(), endMarker = state.mark("!", reorderId), bodyNext = bodyEnd.next = $chunk = new Chunk(boundary, chunk.next, body.context);
|
|
1519
|
+
chunk.next = body, chunk.writeHTML(state.mark("!^", reorderId)), bodyEnd.writeHTML(endMarker), boundary.startAsync(), catchBoundary.onNext = () => {
|
|
1520
|
+
if (!boundary.signal.aborted) if (catchBoundary.signal.aborted) {
|
|
1521
|
+
if (!bodyEnd.consumed) {
|
|
1522
|
+
let cur = body, writeMarker = !0;
|
|
1523
|
+
do {
|
|
1524
|
+
let next = cur.next;
|
|
1525
|
+
cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.needsWalk = !0, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
|
|
1526
|
+
} while (cur !== bodyNext);
|
|
1527
|
+
}
|
|
1528
|
+
let catchChunk = new Chunk(boundary, null, chunk.context);
|
|
1529
|
+
catchChunk.reorderId = reorderId, catchChunk.render(catchContent, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
|
|
1530
|
+
} else catchBoundary.count ? boundary.onNext() : boundary.endAsync();
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1637
1533
|
function flushSerializer(boundary) {
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
serializer.stringify(serializeData, boundary)
|
|
1652
|
-
)), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null, flushed && (state.walkOnNextFlush = !0);
|
|
1653
|
-
}
|
|
1534
|
+
let { state } = boundary, { writeScopes, serializer } = state, { flushed } = serializer;
|
|
1535
|
+
if (writeScopes || flushed) {
|
|
1536
|
+
let shouldSerialize = !1, serializeData = [], { lastSerializedScopeId } = state;
|
|
1537
|
+
state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)), shouldSerialize = !0);
|
|
1538
|
+
for (let key in writeScopes) {
|
|
1539
|
+
let scope = writeScopes[key];
|
|
1540
|
+
if (scopeHasReference(scope) || Object.getOwnPropertyNames(scope).length) {
|
|
1541
|
+
let scopeId = getScopeId(scope), scopeIdDelta = scopeId - lastSerializedScopeId;
|
|
1542
|
+
lastSerializedScopeId = scopeId + 1, scopeIdDelta && serializeData.push(scopeIdDelta), serializeData.push(scope), shouldSerialize = !0;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
shouldSerialize && (state.resumes = concatSequence(state.resumes, serializer.stringify(serializeData, boundary))), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null, flushed && (state.walkOnNextFlush = !0);
|
|
1546
|
+
}
|
|
1654
1547
|
}
|
|
1655
1548
|
function _trailers(html) {
|
|
1656
|
-
|
|
1549
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1657
1550
|
}
|
|
1658
1551
|
function concatEffects(a, b) {
|
|
1659
|
-
|
|
1552
|
+
return a ? b ? a + " " + b : a : b;
|
|
1660
1553
|
}
|
|
1661
1554
|
function concatSequence(a, b) {
|
|
1662
|
-
|
|
1555
|
+
return a ? b ? a + "," + b : a : b;
|
|
1663
1556
|
}
|
|
1664
1557
|
function concatScripts(a, b) {
|
|
1665
|
-
|
|
1558
|
+
return a ? b ? a + ";" + b : a : b;
|
|
1666
1559
|
}
|
|
1667
|
-
var tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue;
|
|
1668
1560
|
function queueTick(cb) {
|
|
1669
|
-
|
|
1561
|
+
tickQueue ? tickQueue.add(cb) : (tickQueue = new Set([cb]), tick(flushTickQueue));
|
|
1670
1562
|
}
|
|
1671
1563
|
function offTick(cb) {
|
|
1672
|
-
|
|
1564
|
+
tickQueue?.delete(cb);
|
|
1673
1565
|
}
|
|
1674
1566
|
function flushTickQueue() {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
cb(!0);
|
|
1567
|
+
let queue = tickQueue;
|
|
1568
|
+
tickQueue = void 0;
|
|
1569
|
+
for (let cb of queue) cb(!0);
|
|
1679
1570
|
}
|
|
1680
1571
|
function isPromise(value) {
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1683
|
-
function getFilteredGlobals($
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1698
|
-
}
|
|
1699
|
-
return filtered;
|
|
1572
|
+
return value != null && typeof value.then == "function";
|
|
1573
|
+
}
|
|
1574
|
+
function getFilteredGlobals($global) {
|
|
1575
|
+
if (!$global) return 0;
|
|
1576
|
+
let serializedGlobals = $global.serializedGlobals;
|
|
1577
|
+
if (!serializedGlobals) return 0;
|
|
1578
|
+
let filtered = 0;
|
|
1579
|
+
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1580
|
+
let value = $global[key];
|
|
1581
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1582
|
+
}
|
|
1583
|
+
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1584
|
+
let value = $global[key];
|
|
1585
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1586
|
+
}
|
|
1587
|
+
return filtered;
|
|
1700
1588
|
}
|
|
1701
1589
|
function _subscribe(subscribers, scope) {
|
|
1702
|
-
|
|
1590
|
+
return $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1703
1591
|
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1592
|
+
//#endregion
|
|
1593
|
+
//#region src/html/attrs.ts
|
|
1706
1594
|
function _attr_class(value) {
|
|
1707
|
-
|
|
1595
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassObject));
|
|
1708
1596
|
}
|
|
1709
1597
|
function _attr_style(value) {
|
|
1710
|
-
|
|
1598
|
+
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1711
1599
|
}
|
|
1712
1600
|
function _attr_option_value(value) {
|
|
1713
|
-
|
|
1714
|
-
|
|
1601
|
+
let valueAttr = _attr("value", value);
|
|
1602
|
+
return normalizedValueMatches(getContext(kSelectedValue), value) ? valueAttr + " selected" : valueAttr;
|
|
1715
1603
|
}
|
|
1716
|
-
var kSelectedValue = /* @__PURE__ */ Symbol("selectedValue");
|
|
1717
1604
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
1718
|
-
|
|
1719
|
-
3 /* SelectValue */,
|
|
1720
|
-
scopeId,
|
|
1721
|
-
nodeAccessor,
|
|
1722
|
-
void 0,
|
|
1723
|
-
valueChange
|
|
1724
|
-
), content && withContext(kSelectedValue, value, content);
|
|
1605
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange), content && withContext(kSelectedValue, value, content);
|
|
1725
1606
|
}
|
|
1726
1607
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1727
|
-
|
|
1728
|
-
2 /* InputValue */,
|
|
1729
|
-
scopeId,
|
|
1730
|
-
nodeAccessor,
|
|
1731
|
-
void 0,
|
|
1732
|
-
valueChange
|
|
1733
|
-
), _escape(value);
|
|
1608
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _escape(value);
|
|
1734
1609
|
}
|
|
1735
1610
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1736
|
-
|
|
1737
|
-
2 /* InputValue */,
|
|
1738
|
-
scopeId,
|
|
1739
|
-
nodeAccessor,
|
|
1740
|
-
void 0,
|
|
1741
|
-
valueChange
|
|
1742
|
-
), _attr("value", value);
|
|
1611
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _attr("value", value);
|
|
1743
1612
|
}
|
|
1744
1613
|
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1745
|
-
|
|
1746
|
-
0 /* InputChecked */,
|
|
1747
|
-
scopeId,
|
|
1748
|
-
nodeAccessor,
|
|
1749
|
-
void 0,
|
|
1750
|
-
checkedChange
|
|
1751
|
-
), normalizeBoolAttrValue(checked) ? " checked" : "";
|
|
1614
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange), normalizeBoolAttrValue(checked) ? " checked" : "";
|
|
1752
1615
|
}
|
|
1753
1616
|
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
scopeId,
|
|
1758
|
-
nodeAccessor,
|
|
1759
|
-
getCheckedValueRef(checkedValue),
|
|
1760
|
-
checkedValueChange
|
|
1761
|
-
), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1762
|
-
}
|
|
1763
|
-
var checkedValuesRefs = /* @__PURE__ */ new WeakMap();
|
|
1617
|
+
let valueAttr = _attr("value", value);
|
|
1618
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1619
|
+
}
|
|
1764
1620
|
function getCheckedValueRef(checkedValue) {
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1621
|
+
if (Array.isArray(checkedValue)) {
|
|
1622
|
+
let ref = checkedValuesRefs.get(checkedValue);
|
|
1623
|
+
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1624
|
+
}
|
|
1769
1625
|
}
|
|
1770
1626
|
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
4 /* DetailsOrDialogOpen */,
|
|
1774
|
-
scopeId,
|
|
1775
|
-
nodeAccessor,
|
|
1776
|
-
normalizedOpen,
|
|
1777
|
-
openChange
|
|
1778
|
-
), normalizedOpen ? " open" : "";
|
|
1627
|
+
let normalizedOpen = normalizeBoolAttrValue(open);
|
|
1628
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen, openChange), normalizedOpen ? " open" : "";
|
|
1779
1629
|
}
|
|
1780
1630
|
function _attr_nonce() {
|
|
1781
|
-
|
|
1631
|
+
return getChunk().boundary.state.nonceAttr;
|
|
1782
1632
|
}
|
|
1783
1633
|
function _attr(name, value) {
|
|
1784
|
-
|
|
1634
|
+
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1785
1635
|
}
|
|
1786
1636
|
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
case "details":
|
|
1824
|
-
case "dialog":
|
|
1825
|
-
data.openChange && (result += _attr_details_or_dialog_open(
|
|
1826
|
-
scopeId,
|
|
1827
|
-
nodeAccessor,
|
|
1828
|
-
data.open,
|
|
1829
|
-
data.openChange
|
|
1830
|
-
), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1831
|
-
break;
|
|
1832
|
-
}
|
|
1833
|
-
for (let name in data) {
|
|
1834
|
-
let value = data[name];
|
|
1835
|
-
switch (name) {
|
|
1836
|
-
case "class":
|
|
1837
|
-
result += _attr_class(value);
|
|
1838
|
-
break;
|
|
1839
|
-
case "style":
|
|
1840
|
-
result += _attr_style(value);
|
|
1841
|
-
break;
|
|
1842
|
-
default:
|
|
1843
|
-
name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
|
1844
|
-
["I" /* EventAttributes */ + nodeAccessor]: events
|
|
1845
|
-
})), events[getEventHandlerName(name)] = value) : result += nonVoidAttr(name, value));
|
|
1846
|
-
break;
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
return result;
|
|
1637
|
+
let result = "", skip = /[\s/>"'=]/, events;
|
|
1638
|
+
switch (tagName) {
|
|
1639
|
+
case "input":
|
|
1640
|
+
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange);
|
|
1641
|
+
else if (data.checkedValue || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value);
|
|
1642
|
+
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange);
|
|
1643
|
+
else break;
|
|
1644
|
+
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1645
|
+
break;
|
|
1646
|
+
case "select":
|
|
1647
|
+
case "textarea":
|
|
1648
|
+
(data.value || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1649
|
+
break;
|
|
1650
|
+
case "option":
|
|
1651
|
+
data.value && (result += _attr_option_value(data.value), skip = /^value$|[\s/>"'=]/);
|
|
1652
|
+
break;
|
|
1653
|
+
case "details":
|
|
1654
|
+
case "dialog":
|
|
1655
|
+
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1656
|
+
break;
|
|
1657
|
+
}
|
|
1658
|
+
for (let name in data) {
|
|
1659
|
+
let value = data[name];
|
|
1660
|
+
switch (name) {
|
|
1661
|
+
case "class":
|
|
1662
|
+
result += _attr_class(value);
|
|
1663
|
+
break;
|
|
1664
|
+
case "style":
|
|
1665
|
+
result += _attr_style(value);
|
|
1666
|
+
break;
|
|
1667
|
+
default:
|
|
1668
|
+
name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventHandlerName(name)] = value) : result += nonVoidAttr(name, value));
|
|
1669
|
+
break;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
return result;
|
|
1850
1673
|
}
|
|
1851
1674
|
function _attrs_content(data, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1852
|
-
|
|
1675
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1853
1676
|
}
|
|
1854
1677
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1678
|
+
let partial = {};
|
|
1679
|
+
for (let name in data) {
|
|
1680
|
+
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
1681
|
+
skip[key] || (partial[key] = data[name]);
|
|
1682
|
+
}
|
|
1683
|
+
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1861
1684
|
}
|
|
1862
1685
|
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1863
|
-
|
|
1686
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1864
1687
|
}
|
|
1865
1688
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1689
|
+
writeScope(scopeId, {
|
|
1690
|
+
["F" + nodeAccessor]: type,
|
|
1691
|
+
["G" + nodeAccessor]: value,
|
|
1692
|
+
["E" + nodeAccessor]: valueChange
|
|
1693
|
+
});
|
|
1871
1694
|
}
|
|
1872
1695
|
function stringAttr(name, value) {
|
|
1873
|
-
|
|
1696
|
+
return value && " " + name + attrAssignment(value);
|
|
1874
1697
|
}
|
|
1875
1698
|
function nonVoidAttr(name, value) {
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
break;
|
|
1887
|
-
}
|
|
1888
|
-
return " " + name + attrAssignment(value + "");
|
|
1889
|
-
}
|
|
1890
|
-
var singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g;
|
|
1699
|
+
switch (typeof value) {
|
|
1700
|
+
case "string": return " " + name + attrAssignment(value);
|
|
1701
|
+
case "boolean": return " " + name;
|
|
1702
|
+
case "number": return " " + name + "=" + value;
|
|
1703
|
+
case "object":
|
|
1704
|
+
if (value instanceof RegExp) return " " + name + attrAssignment(value.source);
|
|
1705
|
+
break;
|
|
1706
|
+
}
|
|
1707
|
+
return " " + name + attrAssignment(value + "");
|
|
1708
|
+
}
|
|
1891
1709
|
function attrAssignment(value) {
|
|
1892
|
-
|
|
1710
|
+
return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, "\"") ? "='" + escapeSingleQuotedAttrValue(value) + "'" : "=\"" + escapeDoubleQuotedAttrValue(value) + "\"" : "=" + value : "";
|
|
1893
1711
|
}
|
|
1894
1712
|
function escapeSingleQuotedAttrValue(value) {
|
|
1895
|
-
|
|
1896
|
-
singleQuoteAttrReplacements,
|
|
1897
|
-
replaceUnsafeSingleQuoteAttrChar
|
|
1898
|
-
) : value;
|
|
1713
|
+
return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
|
|
1899
1714
|
}
|
|
1900
1715
|
function replaceUnsafeSingleQuoteAttrChar(match) {
|
|
1901
|
-
|
|
1716
|
+
return match === "'" ? "'" : "&";
|
|
1902
1717
|
}
|
|
1903
1718
|
function escapeDoubleQuotedAttrValue(value) {
|
|
1904
|
-
|
|
1905
|
-
doubleQuoteAttrReplacements,
|
|
1906
|
-
replaceUnsafeDoubleQuoteAttrChar
|
|
1907
|
-
) : value;
|
|
1719
|
+
return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
|
|
1908
1720
|
}
|
|
1909
1721
|
function replaceUnsafeDoubleQuoteAttrChar(match) {
|
|
1910
|
-
|
|
1722
|
+
return match === "\"" ? """ : "&";
|
|
1911
1723
|
}
|
|
1912
1724
|
function normalizedValueMatches(a, b) {
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
} else if (normalizeStrAttrValue(a) === value)
|
|
1919
|
-
return !0;
|
|
1920
|
-
return !1;
|
|
1725
|
+
let value = normalizeStrAttrValue(b);
|
|
1726
|
+
if (Array.isArray(a)) {
|
|
1727
|
+
for (let item of a) if (normalizeStrAttrValue(item) === value) return !0;
|
|
1728
|
+
} else if (normalizeStrAttrValue(a) === value) return !0;
|
|
1729
|
+
return !1;
|
|
1921
1730
|
}
|
|
1922
1731
|
function normalizeStrAttrValue(value) {
|
|
1923
|
-
|
|
1732
|
+
return value && value !== !0 || value === 0 ? value + "" : "";
|
|
1924
1733
|
}
|
|
1925
1734
|
function normalizeBoolAttrValue(value) {
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
// src/html/dynamic-tag.ts
|
|
1934
|
-
var voidElementsReg = (
|
|
1935
|
-
/* cspell:disable-next-line */
|
|
1936
|
-
/^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/
|
|
1937
|
-
), _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
1938
|
-
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
1939
|
-
if (typeof renderer == "string") {
|
|
1940
|
-
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
1941
|
-
if (rendered = !0, _scope_id(), _html(
|
|
1942
|
-
`<${renderer}${_attrs(input, "a", branchId, renderer)}>`
|
|
1943
|
-
), !voidElementsReg.test(renderer)) {
|
|
1944
|
-
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
1945
|
-
if (renderer === "textarea")
|
|
1946
|
-
_html(
|
|
1947
|
-
_attr_textarea_value(
|
|
1948
|
-
branchId,
|
|
1949
|
-
"a",
|
|
1950
|
-
input.value,
|
|
1951
|
-
input.valueChange
|
|
1952
|
-
)
|
|
1953
|
-
);
|
|
1954
|
-
else if (renderContent) {
|
|
1955
|
-
if (typeof renderContent != "function")
|
|
1956
|
-
throw new Error(
|
|
1957
|
-
`Body content is not supported for the \`<${renderer}>\` tag.`
|
|
1958
|
-
);
|
|
1959
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(
|
|
1960
|
-
branchId,
|
|
1961
|
-
"a",
|
|
1962
|
-
input.value,
|
|
1963
|
-
input.valueChange,
|
|
1964
|
-
renderContent
|
|
1965
|
-
) : _dynamic_tag(
|
|
1966
|
-
branchId,
|
|
1967
|
-
"a",
|
|
1968
|
-
renderContent,
|
|
1969
|
-
void 0,
|
|
1970
|
-
0,
|
|
1971
|
-
void 0,
|
|
1972
|
-
serializeReason
|
|
1973
|
-
);
|
|
1974
|
-
}
|
|
1975
|
-
_html(`</${renderer}>`);
|
|
1976
|
-
}
|
|
1977
|
-
let childScope = getScopeById(branchId), needsScript = childScope && (childScope["Ia"] || childScope["Ea"]);
|
|
1978
|
-
needsScript && (childScope.R = renderer, _script(branchId, "d")), (shouldResume || needsScript) && _html(
|
|
1979
|
-
state.mark(
|
|
1980
|
-
"'" /* BranchEndNativeTag */,
|
|
1981
|
-
scopeId + " " + accessor + " " + branchId
|
|
1982
|
-
)
|
|
1983
|
-
);
|
|
1984
|
-
} else {
|
|
1985
|
-
shouldResume && _html(state.mark("[" /* BranchStart */, ""));
|
|
1986
|
-
let render2 = () => {
|
|
1987
|
-
if (renderer)
|
|
1988
|
-
try {
|
|
1989
|
-
return _set_serialize_reason(
|
|
1990
|
-
shouldResume && inputOrArgs !== void 0 ? 1 : 0
|
|
1991
|
-
), inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
|
1992
|
-
content ? { ...inputOrArgs, content } : inputOrArgs
|
|
1993
|
-
);
|
|
1994
|
-
} finally {
|
|
1995
|
-
_set_serialize_reason(void 0);
|
|
1996
|
-
}
|
|
1997
|
-
else if (content)
|
|
1998
|
-
return content();
|
|
1999
|
-
};
|
|
2000
|
-
result = shouldResume ? withBranchId(branchId, render2) : render2(), rendered = _peek_scope_id() !== branchId, shouldResume && _html(
|
|
2001
|
-
state.mark(
|
|
2002
|
-
"]" /* BranchEnd */,
|
|
2003
|
-
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
|
2004
|
-
)
|
|
2005
|
-
);
|
|
2006
|
-
}
|
|
2007
|
-
return rendered ? shouldResume && writeScope(scopeId, {
|
|
2008
|
-
["D" /* ConditionalRenderer */ + accessor]: renderer?.a || renderer
|
|
2009
|
-
}) : _scope_id(), result;
|
|
2010
|
-
};
|
|
1735
|
+
if (value != null && value !== !1) return !0;
|
|
1736
|
+
}
|
|
1737
|
+
//#endregion
|
|
1738
|
+
//#region src/common/compat-meta.ts
|
|
1739
|
+
//#endregion
|
|
1740
|
+
//#region src/html/dynamic-tag.ts
|
|
2011
1741
|
function _content(id, fn) {
|
|
2012
|
-
|
|
1742
|
+
return fn.a = id, fn;
|
|
2013
1743
|
}
|
|
2014
1744
|
function _content_resume(id, fn, scopeId) {
|
|
2015
|
-
|
|
2016
|
-
}
|
|
2017
|
-
var patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
2018
|
-
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
2019
|
-
let patched = patch(tag, scopeId, accessor);
|
|
2020
|
-
return patched !== tag && (patched.a = tag), originalDynamicTag(
|
|
2021
|
-
scopeId,
|
|
2022
|
-
accessor,
|
|
2023
|
-
patched,
|
|
2024
|
-
input,
|
|
2025
|
-
content,
|
|
2026
|
-
inputIsArgs,
|
|
2027
|
-
resume
|
|
2028
|
-
);
|
|
2029
|
-
};
|
|
2030
|
-
})(_dynamic_tag);
|
|
2031
|
-
|
|
2032
|
-
// src/html/compat.ts
|
|
2033
|
-
var K_TAGS_API_STATE = /* @__PURE__ */ Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
2034
|
-
$global,
|
|
2035
|
-
fork: _await,
|
|
2036
|
-
write: _html,
|
|
2037
|
-
writeScript,
|
|
2038
|
-
nextScopeId: _scope_id,
|
|
2039
|
-
peekNextScopeId: _peek_scope_id,
|
|
2040
|
-
isInResumedBranch,
|
|
2041
|
-
ensureState($global2) {
|
|
2042
|
-
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
2043
|
-
return state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2)), state;
|
|
2044
|
-
},
|
|
2045
|
-
isTagsAPI(fn) {
|
|
2046
|
-
return !!fn.a;
|
|
2047
|
-
},
|
|
2048
|
-
onFlush(fn) {
|
|
2049
|
-
let { flushHTML } = Chunk.prototype;
|
|
2050
|
-
Chunk.prototype.flushHTML = function() {
|
|
2051
|
-
return fn(this), flushHTML.call(this);
|
|
2052
|
-
};
|
|
2053
|
-
},
|
|
2054
|
-
patchDynamicTag,
|
|
2055
|
-
writeSetScopeForComponent(branchId, m5c, m5i) {
|
|
2056
|
-
writeScope(branchId, { m5c, m5i }), _script(branchId, SET_SCOPE_REGISTER_ID);
|
|
2057
|
-
},
|
|
2058
|
-
toJSON(state) {
|
|
2059
|
-
return function() {
|
|
2060
|
-
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
2061
|
-
if (!compatRegistered) {
|
|
2062
|
-
let registered = getRegistered(this);
|
|
2063
|
-
if (registered) {
|
|
2064
|
-
let scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
2065
|
-
scopeId !== void 0 && writeScopeToState(state, scopeId, {}), COMPAT_REGISTRY.set(
|
|
2066
|
-
this,
|
|
2067
|
-
compatRegistered = [registered.id, scopeId]
|
|
2068
|
-
);
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
return compatRegistered;
|
|
2072
|
-
};
|
|
2073
|
-
},
|
|
2074
|
-
flushScript($global2) {
|
|
2075
|
-
let boundary = new Boundary(this.ensureState($global2));
|
|
2076
|
-
if (boundary.flush() === 1 /* continue */)
|
|
2077
|
-
throw new Error(
|
|
2078
|
-
"Cannot serialize promise across tags/class compat layer."
|
|
2079
|
-
);
|
|
2080
|
-
return new Chunk(boundary, null, null).flushScript().scripts;
|
|
2081
|
-
},
|
|
2082
|
-
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
|
2083
|
-
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(
|
|
2084
|
-
boundary,
|
|
2085
|
-
null,
|
|
2086
|
-
null
|
|
2087
|
-
), normalizedInput = input;
|
|
2088
|
-
if ("renderBody" in input) {
|
|
2089
|
-
normalizedInput = {};
|
|
2090
|
-
for (let key in input)
|
|
2091
|
-
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
2092
|
-
}
|
|
2093
|
-
head.render(() => {
|
|
2094
|
-
if (willRerender) {
|
|
2095
|
-
let scopeId = _peek_scope_id();
|
|
2096
|
-
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
2097
|
-
}
|
|
2098
|
-
_set_serialize_reason(willRerender ? 1 : 0);
|
|
2099
|
-
try {
|
|
2100
|
-
renderer(normalizedInput);
|
|
2101
|
-
} finally {
|
|
2102
|
-
_set_serialize_reason(void 0);
|
|
2103
|
-
}
|
|
2104
|
-
let asyncOut = classAPIOut.beginAsync({ last: !0, timeout: -1 });
|
|
2105
|
-
classAPIOut.onLast((next) => {
|
|
2106
|
-
(boundary.onNext = () => {
|
|
2107
|
-
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP2) : boundary.count || (boundary.onNext = NOOP2, head = head.consume(), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "", completeChunks.push(head), next());
|
|
2108
|
-
})();
|
|
2109
|
-
});
|
|
2110
|
-
});
|
|
2111
|
-
},
|
|
2112
|
-
registerRenderer(renderer, id) {
|
|
2113
|
-
return register(
|
|
2114
|
-
RENDERER_REGISTER_ID,
|
|
2115
|
-
renderer,
|
|
2116
|
-
register(id, () => {
|
|
2117
|
-
})
|
|
2118
|
-
);
|
|
2119
|
-
},
|
|
2120
|
-
registerRenderBody(fn) {
|
|
2121
|
-
register(RENDER_BODY_ID, fn);
|
|
2122
|
-
}
|
|
2123
|
-
};
|
|
2124
|
-
function NOOP2() {
|
|
1745
|
+
return _resume(_content(id, fn), id, scopeId);
|
|
2125
1746
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
1747
|
+
//#endregion
|
|
1748
|
+
//#region src/html/compat.ts
|
|
1749
|
+
function NOOP$1() {}
|
|
1750
|
+
//#endregion
|
|
1751
|
+
//#region src/html/template.ts
|
|
2129
1752
|
function render(input = {}) {
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
1753
|
+
let { $global } = input;
|
|
1754
|
+
$global ? ({$global, ...input} = input, $global = {
|
|
1755
|
+
runtimeId: "M",
|
|
1756
|
+
renderId: getDefaultRenderId(this),
|
|
1757
|
+
...$global
|
|
1758
|
+
}) : $global = {
|
|
1759
|
+
runtimeId: "M",
|
|
1760
|
+
renderId: getDefaultRenderId(this)
|
|
1761
|
+
};
|
|
1762
|
+
let state = new State($global), head = new Chunk(new Boundary(state, $global.signal), null, null);
|
|
1763
|
+
return this.i && ((state.ensureReady ||= {})[this.a] = 1), head.render(this, input), new ServerRendered(head);
|
|
2141
1764
|
}
|
|
2142
1765
|
function getDefaultRenderId(template) {
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
#cachedPromise = null;
|
|
2154
|
-
constructor(head) {
|
|
2155
|
-
this.#head = head;
|
|
2156
|
-
}
|
|
2157
|
-
[Symbol.asyncIterator]() {
|
|
2158
|
-
let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read(
|
|
2159
|
-
(html) => {
|
|
2160
|
-
value += html, resolve && (resolve({ value, done }), value = "");
|
|
2161
|
-
},
|
|
2162
|
-
(err) => {
|
|
2163
|
-
aborted = !0, reason = err, reject && reject(err);
|
|
2164
|
-
},
|
|
2165
|
-
() => {
|
|
2166
|
-
done = !0, resolve && (resolve({ value, done: !value }), value = "");
|
|
2167
|
-
}
|
|
2168
|
-
);
|
|
2169
|
-
return {
|
|
2170
|
-
next() {
|
|
2171
|
-
if (aborted)
|
|
2172
|
-
return Promise.reject(reason);
|
|
2173
|
-
if (value) {
|
|
2174
|
-
let result = { value, done: !1 };
|
|
2175
|
-
return value = "", Promise.resolve(result);
|
|
2176
|
-
} else return done ? Promise.resolve({ value: "", done }) : new Promise(exec);
|
|
2177
|
-
},
|
|
2178
|
-
throw(error) {
|
|
2179
|
-
return done || aborted || boundary?.abort(error), Promise.resolve({ value: "", done: !0 });
|
|
2180
|
-
},
|
|
2181
|
-
return(value2) {
|
|
2182
|
-
return done || aborted || boundary?.abort(new Error("Iterator returned before consumed.")), Promise.resolve({ value: value2, done: !0 });
|
|
2183
|
-
}
|
|
2184
|
-
};
|
|
2185
|
-
function exec(_resolve, _reject) {
|
|
2186
|
-
resolve = _resolve, reject = _reject;
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
pipe(stream) {
|
|
2190
|
-
this.#read(
|
|
2191
|
-
(html) => {
|
|
2192
|
-
stream.write(html);
|
|
2193
|
-
},
|
|
2194
|
-
(err) => {
|
|
2195
|
-
let socket = "socket" in stream && stream.socket;
|
|
2196
|
-
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err))
|
|
2197
|
-
throw err;
|
|
2198
|
-
},
|
|
2199
|
-
() => {
|
|
2200
|
-
stream.end();
|
|
2201
|
-
}
|
|
2202
|
-
);
|
|
2203
|
-
}
|
|
2204
|
-
toReadable() {
|
|
2205
|
-
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
2206
|
-
return new ReadableStream({
|
|
2207
|
-
start: (ctrl) => {
|
|
2208
|
-
boundary = this.#read(
|
|
2209
|
-
(html) => {
|
|
2210
|
-
ctrl.enqueue(encoder.encode(html));
|
|
2211
|
-
},
|
|
2212
|
-
(err) => {
|
|
2213
|
-
boundary = void 0, cancelled || ctrl.error(err);
|
|
2214
|
-
},
|
|
2215
|
-
() => {
|
|
2216
|
-
boundary = void 0, ctrl.close();
|
|
2217
|
-
}
|
|
2218
|
-
);
|
|
2219
|
-
},
|
|
2220
|
-
cancel: (reason) => {
|
|
2221
|
-
cancelled = !0, boundary?.abort(reason);
|
|
2222
|
-
}
|
|
2223
|
-
});
|
|
2224
|
-
}
|
|
2225
|
-
then(onfulfilled, onrejected) {
|
|
2226
|
-
return this.#promise().then(onfulfilled, onrejected);
|
|
2227
|
-
}
|
|
2228
|
-
catch(onrejected) {
|
|
2229
|
-
return this.#promise().catch(onrejected);
|
|
2230
|
-
}
|
|
2231
|
-
finally(onfinally) {
|
|
2232
|
-
return this.#promise().finally(onfinally);
|
|
2233
|
-
}
|
|
2234
|
-
#promise() {
|
|
2235
|
-
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
2236
|
-
let head = this.#head;
|
|
2237
|
-
if (this.#head = null, !head)
|
|
2238
|
-
return reject(new Error("Cannot read from a consumed render result"));
|
|
2239
|
-
let { boundary } = head;
|
|
2240
|
-
(boundary.onNext = () => {
|
|
2241
|
-
switch (!boundary.count && boundary.flush()) {
|
|
2242
|
-
case 2 /* aborted */:
|
|
2243
|
-
boundary.onNext = NOOP3, reject(boundary.signal.reason);
|
|
2244
|
-
break;
|
|
2245
|
-
case 0 /* complete */:
|
|
2246
|
-
resolve(head.consume().flushHTML());
|
|
2247
|
-
break;
|
|
2248
|
-
}
|
|
2249
|
-
})();
|
|
2250
|
-
});
|
|
2251
|
-
}
|
|
2252
|
-
#read(onWrite, onAbort, onClose) {
|
|
2253
|
-
let tick2 = !0, head = this.#head;
|
|
2254
|
-
if (this.#head = null, !head) {
|
|
2255
|
-
onAbort(new Error("Cannot read from a consumed render result"));
|
|
2256
|
-
return;
|
|
2257
|
-
}
|
|
2258
|
-
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
2259
|
-
let status = boundary.flush();
|
|
2260
|
-
if (status === 2 /* aborted */)
|
|
2261
|
-
tick2 || offTick(onNext), boundary.onNext = NOOP3, onAbort(boundary.signal.reason);
|
|
2262
|
-
else if (write || status === 0 /* complete */) {
|
|
2263
|
-
let html = (head = head.consume()).flushHTML();
|
|
2264
|
-
html && onWrite(html), status === 0 /* complete */ ? (tick2 || offTick(onNext), onClose()) : tick2 = !0;
|
|
2265
|
-
} else tick2 && (tick2 = !1, queueTick(onNext));
|
|
2266
|
-
};
|
|
2267
|
-
return onNext(), boundary;
|
|
2268
|
-
}
|
|
2269
|
-
toString() {
|
|
2270
|
-
let head = this.#head;
|
|
2271
|
-
if (this.#head = null, !head) throw new Error("Cannot read from a consumed render result");
|
|
2272
|
-
let { boundary } = head;
|
|
2273
|
-
switch (boundary.flush()) {
|
|
2274
|
-
case 2 /* aborted */:
|
|
2275
|
-
throw boundary.signal.reason;
|
|
2276
|
-
case 1 /* continue */:
|
|
2277
|
-
throw new Error("Cannot consume asynchronous render with 'toString'");
|
|
2278
|
-
}
|
|
2279
|
-
return head.consume().flushHTML();
|
|
2280
|
-
}
|
|
2281
|
-
};
|
|
2282
|
-
function NOOP3() {
|
|
2283
|
-
}
|
|
2284
|
-
export {
|
|
2285
|
-
$global,
|
|
2286
|
-
_assert_hoist,
|
|
2287
|
-
_attr,
|
|
2288
|
-
_attr_class,
|
|
2289
|
-
_attr_content,
|
|
2290
|
-
_attr_details_or_dialog_open as _attr_details_open,
|
|
2291
|
-
_attr_details_or_dialog_open as _attr_dialog_open,
|
|
2292
|
-
_attr_input_checked,
|
|
2293
|
-
_attr_input_checkedValue,
|
|
2294
|
-
_attr_input_value,
|
|
2295
|
-
_attr_nonce,
|
|
2296
|
-
_attr_option_value,
|
|
2297
|
-
_attr_select_value,
|
|
2298
|
-
_attr_style,
|
|
2299
|
-
_attr_textarea_value,
|
|
2300
|
-
_attrs,
|
|
2301
|
-
_attrs_content,
|
|
2302
|
-
_attrs_partial,
|
|
2303
|
-
_attrs_partial_content,
|
|
2304
|
-
_await,
|
|
2305
|
-
_content,
|
|
2306
|
-
_content_resume,
|
|
2307
|
-
_dynamic_tag,
|
|
2308
|
-
_el,
|
|
2309
|
-
_el_read_error,
|
|
2310
|
-
_el_resume,
|
|
2311
|
-
_escape,
|
|
2312
|
-
_escape_comment,
|
|
2313
|
-
_escape_script,
|
|
2314
|
-
_escape_style,
|
|
2315
|
-
_existing_scope,
|
|
2316
|
-
_for_in,
|
|
2317
|
-
_for_of,
|
|
2318
|
-
_for_to,
|
|
2319
|
-
_for_until,
|
|
2320
|
-
_hoist,
|
|
2321
|
-
_hoist_read_error,
|
|
2322
|
-
_html,
|
|
2323
|
-
_id,
|
|
2324
|
-
_if,
|
|
2325
|
-
_peek_scope_id,
|
|
2326
|
-
_resume,
|
|
2327
|
-
_resume_branch,
|
|
2328
|
-
writeScope as _scope,
|
|
2329
|
-
_scope_id,
|
|
2330
|
-
_scope_reason,
|
|
2331
|
-
_scope_with_id,
|
|
2332
|
-
_script,
|
|
2333
|
-
_sep,
|
|
2334
|
-
_serialize_guard,
|
|
2335
|
-
_serialize_if,
|
|
2336
|
-
_set_serialize_reason,
|
|
2337
|
-
_subscribe,
|
|
2338
|
-
_template,
|
|
2339
|
-
_trailers,
|
|
2340
|
-
_try,
|
|
2341
|
-
_unescaped,
|
|
2342
|
-
_var,
|
|
2343
|
-
attrTag,
|
|
2344
|
-
attrTags,
|
|
2345
|
-
compat,
|
|
2346
|
-
forIn,
|
|
2347
|
-
forInBy,
|
|
2348
|
-
forOf,
|
|
2349
|
-
forOfBy,
|
|
2350
|
-
forStepBy,
|
|
2351
|
-
forTo,
|
|
2352
|
-
forUntil
|
|
2353
|
-
};
|
|
1766
|
+
if (template.i) {
|
|
1767
|
+
let ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = Math.random() * 4294967296 >>> 0, r = ENCODE_CHARS[n % 53];
|
|
1768
|
+
for (n = n / 53 | 0; n; n >>>= 6) r += ENCODE_CHARS[n & 63];
|
|
1769
|
+
return r;
|
|
1770
|
+
}
|
|
1771
|
+
return "_";
|
|
1772
|
+
}
|
|
1773
|
+
function NOOP() {}
|
|
1774
|
+
//#endregion
|
|
1775
|
+
export { $global, _assert_hoist, _attr, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_option_value, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _subscribe, _template, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil };
|