marko 6.0.164 → 6.0.166
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 +2437 -3356
- package/dist/debug/html.mjs +2360 -3264
- 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.js +1447 -2112
- package/dist/html.mjs +1443 -2022
- package/dist/translator/index.js +8046 -13063
- package/dist/translator/util/normalize-string-expression.d.ts +1 -1
- package/package.json +2 -2
package/dist/html.mjs
CHANGED
|
@@ -1,2352 +1,1773 @@
|
|
|
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
|
-
|
|
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
|
+
}
|
|
1099
1306
|
}
|
|
1100
1307
|
function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
|
|
1101
|
-
|
|
1102
|
-
{},
|
|
1103
|
-
registryId,
|
|
1104
|
-
parentScopeId
|
|
1105
|
-
);
|
|
1308
|
+
_scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id(), _scope_with_id(childScopeId).T = _resume({}, registryId, parentScopeId);
|
|
1106
1309
|
}
|
|
1107
1310
|
function _resume(val, id, scopeId) {
|
|
1108
|
-
|
|
1109
|
-
id,
|
|
1110
|
-
val,
|
|
1111
|
-
_scope_with_id(scopeId)
|
|
1112
|
-
);
|
|
1311
|
+
return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
|
|
1113
1312
|
}
|
|
1114
1313
|
function _id() {
|
|
1115
|
-
|
|
1116
|
-
|
|
1314
|
+
let state = $chunk.boundary.state, { $global } = state;
|
|
1315
|
+
return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
|
|
1117
1316
|
}
|
|
1118
1317
|
function _scope_id() {
|
|
1119
|
-
|
|
1318
|
+
return $chunk.boundary.state.scopeId++;
|
|
1120
1319
|
}
|
|
1121
1320
|
function _peek_scope_id() {
|
|
1122
|
-
|
|
1321
|
+
return $chunk.boundary.state.scopeId;
|
|
1123
1322
|
}
|
|
1124
1323
|
function getScopeById(scopeId) {
|
|
1125
|
-
|
|
1126
|
-
return $chunk.boundary.state.scopes.get(scopeId);
|
|
1324
|
+
if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
|
|
1127
1325
|
}
|
|
1128
1326
|
function _set_serialize_reason(reason) {
|
|
1129
|
-
|
|
1327
|
+
$chunk.boundary.state.serializeReason = reason;
|
|
1130
1328
|
}
|
|
1131
1329
|
function _scope_reason() {
|
|
1132
|
-
|
|
1133
|
-
|
|
1330
|
+
let reason = $chunk.boundary.state.serializeReason;
|
|
1331
|
+
return $chunk.boundary.state.serializeReason = void 0, reason;
|
|
1134
1332
|
}
|
|
1135
1333
|
function _serialize_if(condition, key) {
|
|
1136
|
-
|
|
1334
|
+
return condition && (condition === 1 || condition[key]) ? 1 : void 0;
|
|
1137
1335
|
}
|
|
1138
1336
|
function _serialize_guard(condition, key) {
|
|
1139
|
-
|
|
1337
|
+
return condition && (condition === 1 || condition[key]) ? 1 : 0;
|
|
1140
1338
|
}
|
|
1141
1339
|
function _el_resume(scopeId, accessor, shouldResume) {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1340
|
+
if (shouldResume === 0) return "";
|
|
1341
|
+
let { state } = $chunk.boundary;
|
|
1342
|
+
return state.needsMainRuntime = !0, state.mark("*", scopeId + " " + accessor);
|
|
1145
1343
|
}
|
|
1146
1344
|
function _sep(shouldResume) {
|
|
1147
|
-
|
|
1345
|
+
return shouldResume === 0 ? "" : "<!>";
|
|
1148
1346
|
}
|
|
1149
1347
|
function _el(scopeId, id) {
|
|
1150
|
-
|
|
1348
|
+
return _resume(() => void 0, id, scopeId);
|
|
1151
1349
|
}
|
|
1152
1350
|
function _hoist(scopeId, id) {
|
|
1153
|
-
|
|
1154
|
-
|
|
1351
|
+
let getter = () => void 0;
|
|
1352
|
+
return getter[Symbol.iterator] = _hoist_read_error, _resume(getter, id, scopeId);
|
|
1155
1353
|
}
|
|
1156
1354
|
function _resume_branch(scopeId) {
|
|
1157
|
-
|
|
1158
|
-
|
|
1355
|
+
let branchId = $chunk.context?.[kBranchId];
|
|
1356
|
+
branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
|
|
1159
1357
|
}
|
|
1160
|
-
var kBranchId = /* @__PURE__ */ Symbol("Branch Id"), kIsAsync = /* @__PURE__ */ Symbol("Is Async");
|
|
1161
1358
|
function isInResumedBranch() {
|
|
1162
|
-
|
|
1359
|
+
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1163
1360
|
}
|
|
1164
1361
|
function withBranchId(branchId, cb) {
|
|
1165
|
-
|
|
1362
|
+
return withContext(kBranchId, branchId, cb);
|
|
1166
1363
|
}
|
|
1167
1364
|
function withIsAsync(cb, value) {
|
|
1168
|
-
|
|
1365
|
+
return withContext(kIsAsync, !0, cb, value);
|
|
1169
1366
|
}
|
|
1170
1367
|
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
|
-
);
|
|
1368
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1369
|
+
if (serializeBranch !== 0) {
|
|
1370
|
+
let loopScopes;
|
|
1371
|
+
forOf(list, (item, index) => {
|
|
1372
|
+
let branchId = _peek_scope_id(), itemKey = forOfBy(by, item, index);
|
|
1373
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1374
|
+
cb(item, index);
|
|
1375
|
+
let branchScope = writeScope(branchId, {});
|
|
1376
|
+
resumeKeys && itemKey !== index && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1377
|
+
});
|
|
1378
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1379
|
+
} else forOf(list, cb);
|
|
1380
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1199
1381
|
}
|
|
1200
1382
|
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
|
-
);
|
|
1383
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1384
|
+
if (serializeBranch !== 0) {
|
|
1385
|
+
let loopScopes;
|
|
1386
|
+
forIn(obj, (key, value) => {
|
|
1387
|
+
let branchId = _peek_scope_id(), itemKey = forInBy(by, key, value);
|
|
1388
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1389
|
+
cb(key, value);
|
|
1390
|
+
let branchScope = writeScope(branchId, {});
|
|
1391
|
+
resumeKeys && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1392
|
+
});
|
|
1393
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1394
|
+
} else forIn(obj, cb);
|
|
1395
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1229
1396
|
}
|
|
1230
1397
|
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
|
-
);
|
|
1398
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1399
|
+
if (serializeBranch !== 0) {
|
|
1400
|
+
let loopScopes;
|
|
1401
|
+
forTo(to, from, step, (i) => {
|
|
1402
|
+
let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
|
|
1403
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1404
|
+
cb(i);
|
|
1405
|
+
let branchScope = writeScope(branchId, {});
|
|
1406
|
+
resumeKeys && itemKey !== i && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1407
|
+
});
|
|
1408
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1409
|
+
} else forTo(to, from, step, cb);
|
|
1410
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1259
1411
|
}
|
|
1260
1412
|
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
|
-
);
|
|
1413
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "";
|
|
1414
|
+
if (serializeBranch !== 0) {
|
|
1415
|
+
let loopScopes;
|
|
1416
|
+
forUntil(to, from, step, (i) => {
|
|
1417
|
+
let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
|
|
1418
|
+
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
1419
|
+
cb(i);
|
|
1420
|
+
let branchScope = writeScope(branchId, {});
|
|
1421
|
+
resumeKeys && itemKey !== i && (branchScope.M = itemKey), resumeMarker || (loopScopes = push(loopScopes, referenceScope(branchScope)));
|
|
1422
|
+
});
|
|
1423
|
+
}), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes });
|
|
1424
|
+
} else forUntil(to, from, step, cb);
|
|
1425
|
+
writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
|
|
1289
1426
|
}
|
|
1290
1427
|
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
|
-
);
|
|
1428
|
+
let { state } = $chunk.boundary, resumeBranch = serializeBranch !== 0, resumeMarker = serializeMarker !== 0 && (!parentEndTag || serializeStateful !== 0), branchId = _peek_scope_id();
|
|
1429
|
+
resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[", ""));
|
|
1430
|
+
let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
|
|
1431
|
+
shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
|
|
1432
|
+
["D" + accessor]: branchIndex || void 0,
|
|
1433
|
+
["A" + accessor]: resumeMarker ? void 0 : referenceScope(writeScope(branchId, {}))
|
|
1434
|
+
}), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
|
|
1310
1435
|
}
|
|
1311
1436
|
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);
|
|
1437
|
+
let endTag = parentEndTag || "";
|
|
1438
|
+
if (serializeMarker !== 0) if (!parentEndTag || serializeStateful !== 0) {
|
|
1439
|
+
let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
|
|
1440
|
+
$chunk.writeHTML(mark + endTag);
|
|
1441
|
+
} else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
|
|
1442
|
+
else $chunk.writeHTML(endTag);
|
|
1327
1443
|
}
|
|
1328
1444
|
function scopeHasReference(scope) {
|
|
1329
|
-
|
|
1445
|
+
return !!scope[K_SCOPE_REFERENCED];
|
|
1330
1446
|
}
|
|
1331
1447
|
function referenceScope(scope) {
|
|
1332
|
-
|
|
1448
|
+
return scope[K_SCOPE_REFERENCED] = 1, scope;
|
|
1333
1449
|
}
|
|
1334
|
-
var writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
|
1335
1450
|
function writeScopeToState(state, scopeId, partialScope) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1451
|
+
let { scopes } = state, scope = scopes.get(scopeId);
|
|
1452
|
+
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
1453
|
}
|
|
1339
1454
|
function _existing_scope(scopeId) {
|
|
1340
|
-
|
|
1455
|
+
return writeScope(scopeId, _scope_with_id(scopeId));
|
|
1341
1456
|
}
|
|
1342
1457
|
function _scope_with_id(scopeId) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1458
|
+
let { state } = $chunk.boundary, scope = state.scopes.get(scopeId);
|
|
1459
|
+
return scope || (scope = { [K_SCOPE_ID]: scopeId }, state.scopes.set(scopeId, scope)), referenceScope(scope);
|
|
1345
1460
|
}
|
|
1346
1461
|
function $global() {
|
|
1347
|
-
|
|
1462
|
+
return $chunk.boundary.state.$global;
|
|
1348
1463
|
}
|
|
1349
1464
|
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
|
-
);
|
|
1465
|
+
let resumeMarker = serializeMarker !== 0;
|
|
1466
|
+
if (!isPromise(promise)) {
|
|
1467
|
+
if (resumeMarker) {
|
|
1468
|
+
let branchId = _peek_scope_id();
|
|
1469
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), content(promise), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1470
|
+
} else content(promise);
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
let chunk = $chunk, { boundary } = chunk;
|
|
1474
|
+
chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context), chunk.async = !0, chunk.context?.[kPendingContexts] && (chunk.context = {
|
|
1475
|
+
...chunk.context,
|
|
1476
|
+
[kPendingContexts]: 0
|
|
1477
|
+
}), boundary.startAsync(), promise.then((value) => {
|
|
1478
|
+
chunk.async && (chunk.async = !1, boundary.signal.aborted || (chunk.render(() => {
|
|
1479
|
+
if (resumeMarker) {
|
|
1480
|
+
let branchId = _peek_scope_id();
|
|
1481
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", "")), withIsAsync(content, value), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1482
|
+
} else withIsAsync(content, value);
|
|
1483
|
+
}), boundary.endAsync(chunk)));
|
|
1484
|
+
}, (err) => {
|
|
1485
|
+
chunk.async = !1, boundary.abort(err);
|
|
1486
|
+
});
|
|
1388
1487
|
}
|
|
1389
1488
|
function _try(scopeId, accessor, content, input) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
E: catchContent,
|
|
1399
|
-
Q: placeholderContent
|
|
1400
|
-
}), $chunk.writeHTML(
|
|
1401
|
-
$chunk.boundary.state.mark(
|
|
1402
|
-
"]" /* BranchEnd */,
|
|
1403
|
-
scopeId + " " + accessor + " " + branchId
|
|
1404
|
-
)
|
|
1405
|
-
);
|
|
1489
|
+
let branchId = _peek_scope_id();
|
|
1490
|
+
$chunk.writeHTML($chunk.boundary.state.mark("[", ""));
|
|
1491
|
+
let catchContent = input.catch ? normalizeDynamicRenderer(input.catch) || 0 : void 0, placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
|
1492
|
+
catchContent === void 0 ? placeholderContent ? tryPlaceholder(content, placeholderContent, branchId) : content() : tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId) : content, catchContent || (() => {})), writeScope(branchId, {
|
|
1493
|
+
C: accessor,
|
|
1494
|
+
E: catchContent,
|
|
1495
|
+
Q: placeholderContent
|
|
1496
|
+
}), $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
|
|
1406
1497
|
}
|
|
1407
1498
|
function tryPlaceholder(content, placeholder, branchId) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1499
|
+
let chunk = $chunk, { boundary } = chunk, body = new Chunk(boundary, null, chunk.context);
|
|
1500
|
+
if (body === body.render(content)) {
|
|
1501
|
+
chunk.append(body);
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context), chunk.placeholderBody = body, chunk.placeholderRender = placeholder, chunk.placeholderBranchId = branchId;
|
|
1414
1505
|
}
|
|
1415
1506
|
function tryCatch(content, catchContent) {
|
|
1416
|
-
|
|
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
|
-
var State2 = class {
|
|
1442
|
-
constructor($global2) {
|
|
1443
|
-
this.$global = $global2;
|
|
1444
|
-
this.$global = $global2, $global2.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global2.cspNonce));
|
|
1445
|
-
}
|
|
1446
|
-
tagId = 1;
|
|
1447
|
-
scopeId = 1;
|
|
1448
|
-
reorderId = 1;
|
|
1449
|
-
lastSerializedScopeId = this.scopeId;
|
|
1450
|
-
hasGlobals = !1;
|
|
1451
|
-
needsMainRuntime = !1;
|
|
1452
|
-
hasMainRuntime = !1;
|
|
1453
|
-
hasReorderRuntime = !1;
|
|
1454
|
-
hasWrittenResume = !1;
|
|
1455
|
-
walkOnNextFlush = !1;
|
|
1456
|
-
trailerHTML = "";
|
|
1457
|
-
resumes = "";
|
|
1458
|
-
nonceAttr = "";
|
|
1459
|
-
serializer = new Serializer();
|
|
1460
|
-
writeReorders = null;
|
|
1461
|
-
scopes = /* @__PURE__ */ new Map();
|
|
1462
|
-
writeScopes = null;
|
|
1463
|
-
ensureReady = null;
|
|
1464
|
-
serializeReason;
|
|
1465
|
-
get runtimePrefix() {
|
|
1466
|
-
let { $global: $global2 } = this;
|
|
1467
|
-
return $global2.runtimeId + "." + $global2.renderId;
|
|
1468
|
-
}
|
|
1469
|
-
get commentPrefix() {
|
|
1470
|
-
let { $global: $global2 } = this;
|
|
1471
|
-
return $global2.runtimeId + $global2.renderId;
|
|
1472
|
-
}
|
|
1473
|
-
reorder(chunk) {
|
|
1474
|
-
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
1475
|
-
}
|
|
1476
|
-
nextReorderId() {
|
|
1477
|
-
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
1478
|
-
for (n = n / 54 | 0; n; n >>>= 6)
|
|
1479
|
-
r += c[n & 63];
|
|
1480
|
-
return r;
|
|
1481
|
-
}
|
|
1482
|
-
mark(code, str) {
|
|
1483
|
-
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1484
|
-
}
|
|
1485
|
-
};
|
|
1486
|
-
var Boundary = class extends AbortController {
|
|
1487
|
-
constructor(state, parent) {
|
|
1488
|
-
super();
|
|
1489
|
-
this.state = state;
|
|
1490
|
-
this.state = state, this.signal.addEventListener("abort", () => {
|
|
1491
|
-
this.count = 0, this.state = new State2(this.state.$global), this.onNext();
|
|
1492
|
-
}), parent && (parent.aborted ? this.abort(parent.reason) : parent.addEventListener("abort", () => {
|
|
1493
|
-
this.abort(parent.reason);
|
|
1494
|
-
}));
|
|
1495
|
-
}
|
|
1496
|
-
onNext = NOOP;
|
|
1497
|
-
count = 0;
|
|
1498
|
-
flush() {
|
|
1499
|
-
return this.signal.aborted || flushSerializer(this), this.count ? 1 /* continue */ : this.signal.aborted ? 2 /* aborted */ : 0 /* complete */;
|
|
1500
|
-
}
|
|
1501
|
-
startAsync() {
|
|
1502
|
-
this.signal.aborted || this.count++;
|
|
1503
|
-
}
|
|
1504
|
-
endAsync(chunk) {
|
|
1505
|
-
!this.signal.aborted && this.count && (this.count--, chunk?.reorderId && this.state.reorder(chunk), this.onNext());
|
|
1506
|
-
}
|
|
1507
|
-
}, Chunk = class {
|
|
1508
|
-
constructor(boundary, next, context) {
|
|
1509
|
-
this.boundary = boundary;
|
|
1510
|
-
this.next = next;
|
|
1511
|
-
this.context = context;
|
|
1512
|
-
this.boundary = boundary, this.next = next, this.context = context;
|
|
1513
|
-
}
|
|
1514
|
-
html = "";
|
|
1515
|
-
scripts = "";
|
|
1516
|
-
effects = "";
|
|
1517
|
-
lastEffect = "";
|
|
1518
|
-
async = !1;
|
|
1519
|
-
consumed = !1;
|
|
1520
|
-
needsWalk = !1;
|
|
1521
|
-
reorderId = null;
|
|
1522
|
-
placeholderBody = null;
|
|
1523
|
-
placeholderRender = null;
|
|
1524
|
-
placeholderBranchId = null;
|
|
1525
|
-
writeHTML(html) {
|
|
1526
|
-
this.html += html;
|
|
1527
|
-
}
|
|
1528
|
-
writeEffect(scopeId, registryId) {
|
|
1529
|
-
this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1530
|
-
}
|
|
1531
|
-
writeScript(script) {
|
|
1532
|
-
this.scripts = concatScripts(this.scripts, script);
|
|
1533
|
-
}
|
|
1534
|
-
append(chunk) {
|
|
1535
|
-
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
1536
|
-
}
|
|
1537
|
-
flushPlaceholder() {
|
|
1538
|
-
if (this.placeholderBody) {
|
|
1539
|
-
let body = this.placeholderBody.consume();
|
|
1540
|
-
if (body.async) {
|
|
1541
|
-
let { state } = this.boundary, reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
1542
|
-
this.placeholderBranchId = null, this.writeHTML(state.mark("!^" /* Placeholder */, reorderId));
|
|
1543
|
-
let after = this.render(this.placeholderRender);
|
|
1544
|
-
after !== this && this.boundary.abort(
|
|
1545
|
-
new Error("An @placeholder cannot contain async content.")
|
|
1546
|
-
), after.writeHTML(state.mark("!" /* PlaceholderEnd */, reorderId)), state.reorder(body);
|
|
1547
|
-
} else
|
|
1548
|
-
body.next = this.next, this.next = body;
|
|
1549
|
-
this.placeholderRender = this.placeholderBody = null;
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
consume() {
|
|
1553
|
-
let cur = this, needsWalk = cur.needsWalk;
|
|
1554
|
-
if (cur.next && !cur.async) {
|
|
1555
|
-
let html = "", effects = "", scripts = "", lastEffect = "";
|
|
1556
|
-
do
|
|
1557
|
-
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;
|
|
1558
|
-
while (cur.next && !cur.async);
|
|
1559
|
-
cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
|
|
1560
|
-
}
|
|
1561
|
-
return cur;
|
|
1562
|
-
}
|
|
1563
|
-
render(content, val) {
|
|
1564
|
-
let prev = $chunk;
|
|
1565
|
-
$chunk = this;
|
|
1566
|
-
try {
|
|
1567
|
-
return content(val), $chunk;
|
|
1568
|
-
} catch (err) {
|
|
1569
|
-
return this.boundary.abort(err), this;
|
|
1570
|
-
} finally {
|
|
1571
|
-
$chunk = prev;
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
flushScript() {
|
|
1575
|
-
let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
|
|
1576
|
-
if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
|
|
1577
|
-
scripts,
|
|
1578
|
-
WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
|
|
1579
|
-
)), state.ensureReady && state.hasMainRuntime) {
|
|
1580
|
-
let first = !0;
|
|
1581
|
-
for (let id in state.ensureReady)
|
|
1582
|
-
state.ensureReady[id] && (state.ensureReady[id] = 0, first ? scripts = concatScripts(
|
|
1583
|
-
scripts,
|
|
1584
|
-
"(" + runtimePrefix + ".b={})" + toAccess(toObjectKey(id)) + "=1"
|
|
1585
|
-
) : scripts = concatScripts(
|
|
1586
|
-
scripts,
|
|
1587
|
-
runtimePrefix + ".b" /* Blocking */ + toAccess(toObjectKey(id)) + "=1"
|
|
1588
|
-
)), first = !1;
|
|
1589
|
-
}
|
|
1590
|
-
if (effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + ',"' + effects + '"' : '"' + effects + '"'), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
|
|
1591
|
-
scripts,
|
|
1592
|
-
runtimePrefix + ".r.push(" + state.resumes + ")"
|
|
1593
|
-
) : (state.hasWrittenResume = !0, scripts = concatScripts(
|
|
1594
|
-
scripts,
|
|
1595
|
-
runtimePrefix + ".r=[" + state.resumes + "]"
|
|
1596
|
-
))), state.writeReorders) {
|
|
1597
|
-
needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
|
|
1598
|
-
scripts,
|
|
1599
|
-
REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
|
|
1600
|
-
));
|
|
1601
|
-
for (let reorderedChunk of state.writeReorders) {
|
|
1602
|
-
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1603
|
-
for (reorderedChunk.reorderId = null; ; ) {
|
|
1604
|
-
cur.flushPlaceholder();
|
|
1605
|
-
let { next } = cur;
|
|
1606
|
-
if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
|
|
1607
|
-
"#" /* ReorderMarker */,
|
|
1608
|
-
cur.reorderId = state.nextReorderId()
|
|
1609
|
-
), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next)
|
|
1610
|
-
cur = next;
|
|
1611
|
-
else
|
|
1612
|
-
break;
|
|
1613
|
-
}
|
|
1614
|
-
reorderEffects && (state.hasWrittenResume || (state.hasWrittenResume = !0, scripts = concatScripts(
|
|
1615
|
-
scripts,
|
|
1616
|
-
runtimePrefix + ".r=[]"
|
|
1617
|
-
)), reorderScripts = concatScripts(
|
|
1618
|
-
reorderScripts,
|
|
1619
|
-
'_.push("' + reorderEffects + '")'
|
|
1620
|
-
)), scripts = concatScripts(
|
|
1621
|
-
scripts,
|
|
1622
|
-
reorderScripts && runtimePrefix + ".j" /* Scripts */ + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"
|
|
1623
|
-
), html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
1624
|
-
}
|
|
1625
|
-
state.writeReorders = null;
|
|
1626
|
-
}
|
|
1627
|
-
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
|
|
1628
|
-
}
|
|
1629
|
-
flushHTML() {
|
|
1630
|
-
let { boundary } = this, { state } = boundary;
|
|
1631
|
-
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
1632
|
-
let { scripts } = this, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
|
|
1633
|
-
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;
|
|
1634
|
-
}
|
|
1635
|
-
};
|
|
1507
|
+
let chunk = $chunk, { boundary } = chunk, { state } = boundary, catchBoundary = new Boundary(state), body = new Chunk(catchBoundary, null, chunk.context), bodyEnd = body.render(content);
|
|
1508
|
+
if (catchBoundary.signal.aborted) {
|
|
1509
|
+
catchContent(catchBoundary.signal.reason);
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
if (body === bodyEnd) {
|
|
1513
|
+
chunk.append(body);
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
let reorderId = state.nextReorderId(), endMarker = state.mark("!", reorderId), bodyNext = bodyEnd.next = $chunk = new Chunk(boundary, chunk.next, body.context);
|
|
1517
|
+
chunk.next = body, chunk.writeHTML(state.mark("!^", reorderId)), bodyEnd.writeHTML(endMarker), boundary.startAsync(), catchBoundary.onNext = () => {
|
|
1518
|
+
if (!boundary.signal.aborted) if (catchBoundary.signal.aborted) {
|
|
1519
|
+
if (!bodyEnd.consumed) {
|
|
1520
|
+
let cur = body, writeMarker = !0;
|
|
1521
|
+
do {
|
|
1522
|
+
let next = cur.next;
|
|
1523
|
+
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;
|
|
1524
|
+
} while (cur !== bodyNext);
|
|
1525
|
+
}
|
|
1526
|
+
let catchChunk = new Chunk(boundary, null, chunk.context);
|
|
1527
|
+
catchChunk.reorderId = reorderId, catchChunk.render(catchContent, catchBoundary.signal.reason), state.reorder(catchChunk), boundary.endAsync();
|
|
1528
|
+
} else catchBoundary.count ? boundary.onNext() : boundary.endAsync();
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1636
1531
|
function flushSerializer(boundary) {
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
serializer.stringify(serializeData, boundary)
|
|
1651
|
-
)), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null, flushed && (state.walkOnNextFlush = !0);
|
|
1652
|
-
}
|
|
1532
|
+
let { state } = boundary, { writeScopes, serializer } = state, { flushed } = serializer;
|
|
1533
|
+
if (writeScopes || flushed) {
|
|
1534
|
+
let shouldSerialize = !1, serializeData = [], { lastSerializedScopeId } = state;
|
|
1535
|
+
state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)), shouldSerialize = !0);
|
|
1536
|
+
for (let key in writeScopes) {
|
|
1537
|
+
let scope = writeScopes[key];
|
|
1538
|
+
if (scopeHasReference(scope) || Object.getOwnPropertyNames(scope).length) {
|
|
1539
|
+
let scopeId = getScopeId(scope), scopeIdDelta = scopeId - lastSerializedScopeId;
|
|
1540
|
+
lastSerializedScopeId = scopeId + 1, scopeIdDelta && serializeData.push(scopeIdDelta), serializeData.push(scope), shouldSerialize = !0;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
shouldSerialize && (state.resumes = concatSequence(state.resumes, serializer.stringify(serializeData, boundary))), state.lastSerializedScopeId = lastSerializedScopeId, state.writeScopes = null, flushed && (state.walkOnNextFlush = !0);
|
|
1544
|
+
}
|
|
1653
1545
|
}
|
|
1654
1546
|
function _trailers(html) {
|
|
1655
|
-
|
|
1547
|
+
$chunk.boundary.state.trailerHTML += html;
|
|
1656
1548
|
}
|
|
1657
1549
|
function concatEffects(a, b) {
|
|
1658
|
-
|
|
1550
|
+
return a ? b ? a + " " + b : a : b;
|
|
1659
1551
|
}
|
|
1660
1552
|
function concatSequence(a, b) {
|
|
1661
|
-
|
|
1553
|
+
return a ? b ? a + "," + b : a : b;
|
|
1662
1554
|
}
|
|
1663
1555
|
function concatScripts(a, b) {
|
|
1664
|
-
|
|
1556
|
+
return a ? b ? a + ";" + b : a : b;
|
|
1665
1557
|
}
|
|
1666
|
-
var tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue;
|
|
1667
1558
|
function queueTick(cb) {
|
|
1668
|
-
|
|
1559
|
+
tickQueue ? tickQueue.add(cb) : (tickQueue = new Set([cb]), tick(flushTickQueue));
|
|
1669
1560
|
}
|
|
1670
1561
|
function offTick(cb) {
|
|
1671
|
-
|
|
1562
|
+
tickQueue?.delete(cb);
|
|
1672
1563
|
}
|
|
1673
1564
|
function flushTickQueue() {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
cb(!0);
|
|
1565
|
+
let queue = tickQueue;
|
|
1566
|
+
tickQueue = void 0;
|
|
1567
|
+
for (let cb of queue) cb(!0);
|
|
1678
1568
|
}
|
|
1679
1569
|
function isPromise(value) {
|
|
1680
|
-
|
|
1681
|
-
}
|
|
1682
|
-
function getFilteredGlobals($
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1697
|
-
}
|
|
1698
|
-
return filtered;
|
|
1570
|
+
return value != null && typeof value.then == "function";
|
|
1571
|
+
}
|
|
1572
|
+
function getFilteredGlobals($global) {
|
|
1573
|
+
if (!$global) return 0;
|
|
1574
|
+
let serializedGlobals = $global.serializedGlobals;
|
|
1575
|
+
if (!serializedGlobals) return 0;
|
|
1576
|
+
let filtered = 0;
|
|
1577
|
+
if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
|
|
1578
|
+
let value = $global[key];
|
|
1579
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1580
|
+
}
|
|
1581
|
+
else for (let key in serializedGlobals) if (serializedGlobals[key]) {
|
|
1582
|
+
let value = $global[key];
|
|
1583
|
+
value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
|
|
1584
|
+
}
|
|
1585
|
+
return filtered;
|
|
1699
1586
|
}
|
|
1700
1587
|
function _subscribe(subscribers, scope) {
|
|
1701
|
-
|
|
1588
|
+
return $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1702
1589
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1590
|
+
//#endregion
|
|
1591
|
+
//#region src/html/attrs.ts
|
|
1705
1592
|
function _attr_class(value) {
|
|
1706
|
-
|
|
1593
|
+
return stringAttr("class", toDelimitedString(value, " ", stringifyClassObject));
|
|
1707
1594
|
}
|
|
1708
1595
|
function _attr_style(value) {
|
|
1709
|
-
|
|
1596
|
+
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1710
1597
|
}
|
|
1711
1598
|
function _attr_option_value(value) {
|
|
1712
|
-
|
|
1713
|
-
|
|
1599
|
+
let valueAttr = _attr("value", value);
|
|
1600
|
+
return normalizedValueMatches(getContext(kSelectedValue), value) ? valueAttr + " selected" : valueAttr;
|
|
1714
1601
|
}
|
|
1715
|
-
var kSelectedValue = /* @__PURE__ */ Symbol("selectedValue");
|
|
1716
1602
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
1717
|
-
|
|
1718
|
-
3 /* SelectValue */,
|
|
1719
|
-
scopeId,
|
|
1720
|
-
nodeAccessor,
|
|
1721
|
-
void 0,
|
|
1722
|
-
valueChange
|
|
1723
|
-
), content && withContext(kSelectedValue, value, content);
|
|
1603
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange), content && withContext(kSelectedValue, value, content);
|
|
1724
1604
|
}
|
|
1725
1605
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1726
|
-
|
|
1727
|
-
2 /* InputValue */,
|
|
1728
|
-
scopeId,
|
|
1729
|
-
nodeAccessor,
|
|
1730
|
-
void 0,
|
|
1731
|
-
valueChange
|
|
1732
|
-
), _escape(value);
|
|
1606
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _escape(value);
|
|
1733
1607
|
}
|
|
1734
1608
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1735
|
-
|
|
1736
|
-
2 /* InputValue */,
|
|
1737
|
-
scopeId,
|
|
1738
|
-
nodeAccessor,
|
|
1739
|
-
void 0,
|
|
1740
|
-
valueChange
|
|
1741
|
-
), _attr("value", value);
|
|
1609
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _attr("value", value);
|
|
1742
1610
|
}
|
|
1743
1611
|
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1744
|
-
|
|
1745
|
-
0 /* InputChecked */,
|
|
1746
|
-
scopeId,
|
|
1747
|
-
nodeAccessor,
|
|
1748
|
-
void 0,
|
|
1749
|
-
checkedChange
|
|
1750
|
-
), normalizeBoolAttrValue(checked) ? " checked" : "";
|
|
1612
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange), normalizeBoolAttrValue(checked) ? " checked" : "";
|
|
1751
1613
|
}
|
|
1752
1614
|
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
scopeId,
|
|
1757
|
-
nodeAccessor,
|
|
1758
|
-
getCheckedValueRef(checkedValue),
|
|
1759
|
-
checkedValueChange
|
|
1760
|
-
), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1761
|
-
}
|
|
1762
|
-
var checkedValuesRefs = /* @__PURE__ */ new WeakMap();
|
|
1615
|
+
let valueAttr = _attr("value", value);
|
|
1616
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1617
|
+
}
|
|
1763
1618
|
function getCheckedValueRef(checkedValue) {
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1619
|
+
if (Array.isArray(checkedValue)) {
|
|
1620
|
+
let ref = checkedValuesRefs.get(checkedValue);
|
|
1621
|
+
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1622
|
+
}
|
|
1768
1623
|
}
|
|
1769
1624
|
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
4 /* DetailsOrDialogOpen */,
|
|
1773
|
-
scopeId,
|
|
1774
|
-
nodeAccessor,
|
|
1775
|
-
normalizedOpen,
|
|
1776
|
-
openChange
|
|
1777
|
-
), normalizedOpen ? " open" : "";
|
|
1625
|
+
let normalizedOpen = normalizeBoolAttrValue(open);
|
|
1626
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen, openChange), normalizedOpen ? " open" : "";
|
|
1778
1627
|
}
|
|
1779
1628
|
function _attr_nonce() {
|
|
1780
|
-
|
|
1629
|
+
return getChunk().boundary.state.nonceAttr;
|
|
1781
1630
|
}
|
|
1782
1631
|
function _attr(name, value) {
|
|
1783
|
-
|
|
1632
|
+
return isVoid(value) ? "" : nonVoidAttr(name, value);
|
|
1784
1633
|
}
|
|
1785
1634
|
function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
1786
|
-
|
|
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
|
-
case "details":
|
|
1823
|
-
case "dialog":
|
|
1824
|
-
data.openChange && (result += _attr_details_or_dialog_open(
|
|
1825
|
-
scopeId,
|
|
1826
|
-
nodeAccessor,
|
|
1827
|
-
data.open,
|
|
1828
|
-
data.openChange
|
|
1829
|
-
), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1830
|
-
break;
|
|
1831
|
-
}
|
|
1832
|
-
for (let name in data) {
|
|
1833
|
-
let value = data[name];
|
|
1834
|
-
switch (name) {
|
|
1835
|
-
case "class":
|
|
1836
|
-
result += _attr_class(value);
|
|
1837
|
-
break;
|
|
1838
|
-
case "style":
|
|
1839
|
-
result += _attr_style(value);
|
|
1840
|
-
break;
|
|
1841
|
-
default:
|
|
1842
|
-
name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, {
|
|
1843
|
-
["I" /* EventAttributes */ + nodeAccessor]: events
|
|
1844
|
-
})), events[getEventHandlerName(name)] = value) : result += nonVoidAttr(name, value));
|
|
1845
|
-
break;
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
return result;
|
|
1635
|
+
let result = "", skip = /[\s/>"'=]/, events;
|
|
1636
|
+
switch (tagName) {
|
|
1637
|
+
case "input":
|
|
1638
|
+
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange);
|
|
1639
|
+
else if (data.checkedValue || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value);
|
|
1640
|
+
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange);
|
|
1641
|
+
else break;
|
|
1642
|
+
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1643
|
+
break;
|
|
1644
|
+
case "select":
|
|
1645
|
+
case "textarea":
|
|
1646
|
+
(data.value || data.valueChange) && (skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1647
|
+
break;
|
|
1648
|
+
case "option":
|
|
1649
|
+
data.value && (result += _attr_option_value(data.value), skip = /^value$|[\s/>"'=]/);
|
|
1650
|
+
break;
|
|
1651
|
+
case "details":
|
|
1652
|
+
case "dialog":
|
|
1653
|
+
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
for (let name in data) {
|
|
1657
|
+
let value = data[name];
|
|
1658
|
+
switch (name) {
|
|
1659
|
+
case "class":
|
|
1660
|
+
result += _attr_class(value);
|
|
1661
|
+
break;
|
|
1662
|
+
case "style":
|
|
1663
|
+
result += _attr_style(value);
|
|
1664
|
+
break;
|
|
1665
|
+
default:
|
|
1666
|
+
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));
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
return result;
|
|
1849
1671
|
}
|
|
1850
1672
|
function _attrs_content(data, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1851
|
-
|
|
1673
|
+
_html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1852
1674
|
}
|
|
1853
1675
|
function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1676
|
+
let partial = {};
|
|
1677
|
+
for (let name in data) {
|
|
1678
|
+
let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
|
|
1679
|
+
skip[key] || (partial[key] = data[name]);
|
|
1680
|
+
}
|
|
1681
|
+
return _attrs(partial, nodeAccessor, scopeId, tagName);
|
|
1860
1682
|
}
|
|
1861
1683
|
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1862
|
-
|
|
1684
|
+
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1863
1685
|
}
|
|
1864
1686
|
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1687
|
+
writeScope(scopeId, {
|
|
1688
|
+
["F" + nodeAccessor]: type,
|
|
1689
|
+
["G" + nodeAccessor]: value,
|
|
1690
|
+
["E" + nodeAccessor]: valueChange
|
|
1691
|
+
});
|
|
1870
1692
|
}
|
|
1871
1693
|
function stringAttr(name, value) {
|
|
1872
|
-
|
|
1694
|
+
return value && " " + name + attrAssignment(value);
|
|
1873
1695
|
}
|
|
1874
1696
|
function nonVoidAttr(name, value) {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
break;
|
|
1886
|
-
}
|
|
1887
|
-
return " " + name + attrAssignment(value + "");
|
|
1888
|
-
}
|
|
1889
|
-
var singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/g;
|
|
1697
|
+
switch (typeof value) {
|
|
1698
|
+
case "string": return " " + name + attrAssignment(value);
|
|
1699
|
+
case "boolean": return " " + name;
|
|
1700
|
+
case "number": return " " + name + "=" + value;
|
|
1701
|
+
case "object":
|
|
1702
|
+
if (value instanceof RegExp) return " " + name + attrAssignment(value.source);
|
|
1703
|
+
break;
|
|
1704
|
+
}
|
|
1705
|
+
return " " + name + attrAssignment(value + "");
|
|
1706
|
+
}
|
|
1890
1707
|
function attrAssignment(value) {
|
|
1891
|
-
|
|
1708
|
+
return value ? needsQuotedAttr.test(value) ? value[needsQuotedAttr.lastIndex - 1] === (needsQuotedAttr.lastIndex = 0, "\"") ? "='" + escapeSingleQuotedAttrValue(value) + "'" : "=\"" + escapeDoubleQuotedAttrValue(value) + "\"" : "=" + value : "";
|
|
1892
1709
|
}
|
|
1893
1710
|
function escapeSingleQuotedAttrValue(value) {
|
|
1894
|
-
|
|
1895
|
-
singleQuoteAttrReplacements,
|
|
1896
|
-
replaceUnsafeSingleQuoteAttrChar
|
|
1897
|
-
) : value;
|
|
1711
|
+
return singleQuoteAttrReplacements.test(value) ? value.replace(singleQuoteAttrReplacements, replaceUnsafeSingleQuoteAttrChar) : value;
|
|
1898
1712
|
}
|
|
1899
1713
|
function replaceUnsafeSingleQuoteAttrChar(match) {
|
|
1900
|
-
|
|
1714
|
+
return match === "'" ? "'" : "&";
|
|
1901
1715
|
}
|
|
1902
1716
|
function escapeDoubleQuotedAttrValue(value) {
|
|
1903
|
-
|
|
1904
|
-
doubleQuoteAttrReplacements,
|
|
1905
|
-
replaceUnsafeDoubleQuoteAttrChar
|
|
1906
|
-
) : value;
|
|
1717
|
+
return doubleQuoteAttrReplacements.test(value) ? value.replace(doubleQuoteAttrReplacements, replaceUnsafeDoubleQuoteAttrChar) : value;
|
|
1907
1718
|
}
|
|
1908
1719
|
function replaceUnsafeDoubleQuoteAttrChar(match) {
|
|
1909
|
-
|
|
1720
|
+
return match === "\"" ? """ : "&";
|
|
1910
1721
|
}
|
|
1911
1722
|
function normalizedValueMatches(a, b) {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
} else if (normalizeStrAttrValue(a) === value)
|
|
1918
|
-
return !0;
|
|
1919
|
-
return !1;
|
|
1723
|
+
let value = normalizeStrAttrValue(b);
|
|
1724
|
+
if (Array.isArray(a)) {
|
|
1725
|
+
for (let item of a) if (normalizeStrAttrValue(item) === value) return !0;
|
|
1726
|
+
} else if (normalizeStrAttrValue(a) === value) return !0;
|
|
1727
|
+
return !1;
|
|
1920
1728
|
}
|
|
1921
1729
|
function normalizeStrAttrValue(value) {
|
|
1922
|
-
|
|
1730
|
+
return value && value !== !0 || value === 0 ? value + "" : "";
|
|
1923
1731
|
}
|
|
1924
1732
|
function normalizeBoolAttrValue(value) {
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
// src/html/dynamic-tag.ts
|
|
1933
|
-
var voidElementsReg = (
|
|
1934
|
-
/* cspell:disable-next-line */
|
|
1935
|
-
/^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/
|
|
1936
|
-
), _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
1937
|
-
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
1938
|
-
if (typeof renderer == "string") {
|
|
1939
|
-
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
1940
|
-
if (rendered = !0, _scope_id(), _html(
|
|
1941
|
-
`<${renderer}${_attrs(input, "a", branchId, renderer)}>`
|
|
1942
|
-
), !voidElementsReg.test(renderer)) {
|
|
1943
|
-
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
1944
|
-
if (renderer === "textarea")
|
|
1945
|
-
_html(
|
|
1946
|
-
_attr_textarea_value(
|
|
1947
|
-
branchId,
|
|
1948
|
-
"a",
|
|
1949
|
-
input.value,
|
|
1950
|
-
input.valueChange
|
|
1951
|
-
)
|
|
1952
|
-
);
|
|
1953
|
-
else if (renderContent) {
|
|
1954
|
-
if (typeof renderContent != "function")
|
|
1955
|
-
throw new Error(
|
|
1956
|
-
`Body content is not supported for the \`<${renderer}>\` tag.`
|
|
1957
|
-
);
|
|
1958
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(
|
|
1959
|
-
branchId,
|
|
1960
|
-
"a",
|
|
1961
|
-
input.value,
|
|
1962
|
-
input.valueChange,
|
|
1963
|
-
renderContent
|
|
1964
|
-
) : _dynamic_tag(
|
|
1965
|
-
branchId,
|
|
1966
|
-
"a",
|
|
1967
|
-
renderContent,
|
|
1968
|
-
void 0,
|
|
1969
|
-
0,
|
|
1970
|
-
void 0,
|
|
1971
|
-
serializeReason
|
|
1972
|
-
);
|
|
1973
|
-
}
|
|
1974
|
-
_html(`</${renderer}>`);
|
|
1975
|
-
}
|
|
1976
|
-
let childScope = getScopeById(branchId), needsScript = childScope && (childScope["Ia"] || childScope["Ea"]);
|
|
1977
|
-
needsScript && (childScope.R = renderer, _script(branchId, "d")), (shouldResume || needsScript) && _html(
|
|
1978
|
-
state.mark(
|
|
1979
|
-
"'" /* BranchEndNativeTag */,
|
|
1980
|
-
scopeId + " " + accessor + " " + branchId
|
|
1981
|
-
)
|
|
1982
|
-
);
|
|
1983
|
-
} else {
|
|
1984
|
-
shouldResume && _html(state.mark("[" /* BranchStart */, ""));
|
|
1985
|
-
let render2 = () => {
|
|
1986
|
-
if (renderer)
|
|
1987
|
-
try {
|
|
1988
|
-
return _set_serialize_reason(
|
|
1989
|
-
shouldResume && inputOrArgs !== void 0 ? 1 : 0
|
|
1990
|
-
), inputIsArgs ? renderer(...inputOrArgs) : renderer(
|
|
1991
|
-
content ? { ...inputOrArgs, content } : inputOrArgs
|
|
1992
|
-
);
|
|
1993
|
-
} finally {
|
|
1994
|
-
_set_serialize_reason(void 0);
|
|
1995
|
-
}
|
|
1996
|
-
else if (content)
|
|
1997
|
-
return content();
|
|
1998
|
-
};
|
|
1999
|
-
result = shouldResume ? withBranchId(branchId, render2) : render2(), rendered = _peek_scope_id() !== branchId, shouldResume && _html(
|
|
2000
|
-
state.mark(
|
|
2001
|
-
"]" /* BranchEnd */,
|
|
2002
|
-
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
|
2003
|
-
)
|
|
2004
|
-
);
|
|
2005
|
-
}
|
|
2006
|
-
return rendered ? shouldResume && writeScope(scopeId, {
|
|
2007
|
-
["D" /* ConditionalRenderer */ + accessor]: renderer?.a || renderer
|
|
2008
|
-
}) : _scope_id(), result;
|
|
2009
|
-
};
|
|
1733
|
+
if (value != null && value !== !1) return !0;
|
|
1734
|
+
}
|
|
1735
|
+
//#endregion
|
|
1736
|
+
//#region src/common/compat-meta.ts
|
|
1737
|
+
//#endregion
|
|
1738
|
+
//#region src/html/dynamic-tag.ts
|
|
2010
1739
|
function _content(id, fn) {
|
|
2011
|
-
|
|
1740
|
+
return fn.a = id, fn;
|
|
2012
1741
|
}
|
|
2013
1742
|
function _content_resume(id, fn, scopeId) {
|
|
2014
|
-
|
|
2015
|
-
}
|
|
2016
|
-
var patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
|
|
2017
|
-
_dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
|
|
2018
|
-
let patched = patch(tag, scopeId, accessor);
|
|
2019
|
-
return patched !== tag && (patched.a = tag), originalDynamicTag(
|
|
2020
|
-
scopeId,
|
|
2021
|
-
accessor,
|
|
2022
|
-
patched,
|
|
2023
|
-
input,
|
|
2024
|
-
content,
|
|
2025
|
-
inputIsArgs,
|
|
2026
|
-
resume
|
|
2027
|
-
);
|
|
2028
|
-
};
|
|
2029
|
-
})(_dynamic_tag);
|
|
2030
|
-
|
|
2031
|
-
// src/html/compat.ts
|
|
2032
|
-
var K_TAGS_API_STATE = /* @__PURE__ */ Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
2033
|
-
$global,
|
|
2034
|
-
fork: _await,
|
|
2035
|
-
write: _html,
|
|
2036
|
-
writeScript,
|
|
2037
|
-
nextScopeId: _scope_id,
|
|
2038
|
-
peekNextScopeId: _peek_scope_id,
|
|
2039
|
-
isInResumedBranch,
|
|
2040
|
-
ensureState($global2) {
|
|
2041
|
-
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
|
2042
|
-
return state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2)), state;
|
|
2043
|
-
},
|
|
2044
|
-
isTagsAPI(fn) {
|
|
2045
|
-
return !!fn.a;
|
|
2046
|
-
},
|
|
2047
|
-
onFlush(fn) {
|
|
2048
|
-
let { flushHTML } = Chunk.prototype;
|
|
2049
|
-
Chunk.prototype.flushHTML = function() {
|
|
2050
|
-
return fn(this), flushHTML.call(this);
|
|
2051
|
-
};
|
|
2052
|
-
},
|
|
2053
|
-
patchDynamicTag,
|
|
2054
|
-
writeSetScopeForComponent(branchId, m5c, m5i) {
|
|
2055
|
-
writeScope(branchId, { m5c, m5i }), _script(branchId, SET_SCOPE_REGISTER_ID);
|
|
2056
|
-
},
|
|
2057
|
-
toJSON(state) {
|
|
2058
|
-
return function() {
|
|
2059
|
-
let compatRegistered = COMPAT_REGISTRY.get(this);
|
|
2060
|
-
if (!compatRegistered) {
|
|
2061
|
-
let registered = getRegistered(this);
|
|
2062
|
-
if (registered) {
|
|
2063
|
-
let scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
|
|
2064
|
-
scopeId !== void 0 && writeScopeToState(state, scopeId, {}), COMPAT_REGISTRY.set(
|
|
2065
|
-
this,
|
|
2066
|
-
compatRegistered = [registered.id, scopeId]
|
|
2067
|
-
);
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
return compatRegistered;
|
|
2071
|
-
};
|
|
2072
|
-
},
|
|
2073
|
-
flushScript($global2) {
|
|
2074
|
-
let boundary = new Boundary(this.ensureState($global2));
|
|
2075
|
-
if (boundary.flush() === 1 /* continue */)
|
|
2076
|
-
throw new Error(
|
|
2077
|
-
"Cannot serialize promise across tags/class compat layer."
|
|
2078
|
-
);
|
|
2079
|
-
return new Chunk(boundary, null, null).flushScript().scripts;
|
|
2080
|
-
},
|
|
2081
|
-
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
|
2082
|
-
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(
|
|
2083
|
-
boundary,
|
|
2084
|
-
null,
|
|
2085
|
-
null
|
|
2086
|
-
), normalizedInput = input;
|
|
2087
|
-
if ("renderBody" in input) {
|
|
2088
|
-
normalizedInput = {};
|
|
2089
|
-
for (let key in input)
|
|
2090
|
-
normalizedInput[key === "renderBody" ? "content" : key] = input[key];
|
|
2091
|
-
}
|
|
2092
|
-
head.render(() => {
|
|
2093
|
-
if (willRerender) {
|
|
2094
|
-
let scopeId = _peek_scope_id();
|
|
2095
|
-
writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
|
|
2096
|
-
}
|
|
2097
|
-
_set_serialize_reason(willRerender ? 1 : 0);
|
|
2098
|
-
try {
|
|
2099
|
-
renderer(normalizedInput);
|
|
2100
|
-
} finally {
|
|
2101
|
-
_set_serialize_reason(void 0);
|
|
2102
|
-
}
|
|
2103
|
-
let asyncOut = classAPIOut.beginAsync({ last: !0, timeout: -1 });
|
|
2104
|
-
classAPIOut.onLast((next) => {
|
|
2105
|
-
(boundary.onNext = () => {
|
|
2106
|
-
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());
|
|
2107
|
-
})();
|
|
2108
|
-
});
|
|
2109
|
-
});
|
|
2110
|
-
},
|
|
2111
|
-
registerRenderer(renderer, id) {
|
|
2112
|
-
return register(
|
|
2113
|
-
RENDERER_REGISTER_ID,
|
|
2114
|
-
renderer,
|
|
2115
|
-
register(id, () => {
|
|
2116
|
-
})
|
|
2117
|
-
);
|
|
2118
|
-
},
|
|
2119
|
-
registerRenderBody(fn) {
|
|
2120
|
-
register(RENDER_BODY_ID, fn);
|
|
2121
|
-
}
|
|
2122
|
-
};
|
|
2123
|
-
function NOOP2() {
|
|
1743
|
+
return _resume(_content(id, fn), id, scopeId);
|
|
2124
1744
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
1745
|
+
//#endregion
|
|
1746
|
+
//#region src/html/compat.ts
|
|
1747
|
+
function NOOP$1() {}
|
|
1748
|
+
//#endregion
|
|
1749
|
+
//#region src/html/template.ts
|
|
2128
1750
|
function render(input = {}) {
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
1751
|
+
let { $global } = input;
|
|
1752
|
+
$global ? ({$global, ...input} = input, $global = {
|
|
1753
|
+
runtimeId: "M",
|
|
1754
|
+
renderId: getDefaultRenderId(this),
|
|
1755
|
+
...$global
|
|
1756
|
+
}) : $global = {
|
|
1757
|
+
runtimeId: "M",
|
|
1758
|
+
renderId: getDefaultRenderId(this)
|
|
1759
|
+
};
|
|
1760
|
+
let state = new State($global), head = new Chunk(new Boundary(state, $global.signal), null, null);
|
|
1761
|
+
return this.i && ((state.ensureReady ||= {})[this.a] = 1), head.render(this, input), new ServerRendered(head);
|
|
2140
1762
|
}
|
|
2141
1763
|
function getDefaultRenderId(template) {
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
#cachedPromise = null;
|
|
2153
|
-
constructor(head) {
|
|
2154
|
-
this.#head = head;
|
|
2155
|
-
}
|
|
2156
|
-
[Symbol.asyncIterator]() {
|
|
2157
|
-
let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read(
|
|
2158
|
-
(html) => {
|
|
2159
|
-
value += html, resolve && (resolve({ value, done }), value = "");
|
|
2160
|
-
},
|
|
2161
|
-
(err) => {
|
|
2162
|
-
aborted = !0, reason = err, reject && reject(err);
|
|
2163
|
-
},
|
|
2164
|
-
() => {
|
|
2165
|
-
done = !0, resolve && (resolve({ value, done: !value }), value = "");
|
|
2166
|
-
}
|
|
2167
|
-
);
|
|
2168
|
-
return {
|
|
2169
|
-
next() {
|
|
2170
|
-
if (aborted)
|
|
2171
|
-
return Promise.reject(reason);
|
|
2172
|
-
if (value) {
|
|
2173
|
-
let result = { value, done: !1 };
|
|
2174
|
-
return value = "", Promise.resolve(result);
|
|
2175
|
-
} else return done ? Promise.resolve({ value: "", done }) : new Promise(exec);
|
|
2176
|
-
},
|
|
2177
|
-
throw(error) {
|
|
2178
|
-
return done || aborted || boundary?.abort(error), Promise.resolve({ value: "", done: !0 });
|
|
2179
|
-
},
|
|
2180
|
-
return(value2) {
|
|
2181
|
-
return done || aborted || boundary?.abort(new Error("Iterator returned before consumed.")), Promise.resolve({ value: value2, done: !0 });
|
|
2182
|
-
}
|
|
2183
|
-
};
|
|
2184
|
-
function exec(_resolve, _reject) {
|
|
2185
|
-
resolve = _resolve, reject = _reject;
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
pipe(stream) {
|
|
2189
|
-
this.#read(
|
|
2190
|
-
(html) => {
|
|
2191
|
-
stream.write(html);
|
|
2192
|
-
},
|
|
2193
|
-
(err) => {
|
|
2194
|
-
let socket = "socket" in stream && stream.socket;
|
|
2195
|
-
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err))
|
|
2196
|
-
throw err;
|
|
2197
|
-
},
|
|
2198
|
-
() => {
|
|
2199
|
-
stream.end();
|
|
2200
|
-
}
|
|
2201
|
-
);
|
|
2202
|
-
}
|
|
2203
|
-
toReadable() {
|
|
2204
|
-
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
2205
|
-
return new ReadableStream({
|
|
2206
|
-
start: (ctrl) => {
|
|
2207
|
-
boundary = this.#read(
|
|
2208
|
-
(html) => {
|
|
2209
|
-
ctrl.enqueue(encoder.encode(html));
|
|
2210
|
-
},
|
|
2211
|
-
(err) => {
|
|
2212
|
-
boundary = void 0, cancelled || ctrl.error(err);
|
|
2213
|
-
},
|
|
2214
|
-
() => {
|
|
2215
|
-
boundary = void 0, ctrl.close();
|
|
2216
|
-
}
|
|
2217
|
-
);
|
|
2218
|
-
},
|
|
2219
|
-
cancel: (reason) => {
|
|
2220
|
-
cancelled = !0, boundary?.abort(reason);
|
|
2221
|
-
}
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
2224
|
-
then(onfulfilled, onrejected) {
|
|
2225
|
-
return this.#promise().then(onfulfilled, onrejected);
|
|
2226
|
-
}
|
|
2227
|
-
catch(onrejected) {
|
|
2228
|
-
return this.#promise().catch(onrejected);
|
|
2229
|
-
}
|
|
2230
|
-
finally(onfinally) {
|
|
2231
|
-
return this.#promise().finally(onfinally);
|
|
2232
|
-
}
|
|
2233
|
-
#promise() {
|
|
2234
|
-
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
2235
|
-
let head = this.#head;
|
|
2236
|
-
if (this.#head = null, !head)
|
|
2237
|
-
return reject(new Error("Cannot read from a consumed render result"));
|
|
2238
|
-
let { boundary } = head;
|
|
2239
|
-
(boundary.onNext = () => {
|
|
2240
|
-
switch (!boundary.count && boundary.flush()) {
|
|
2241
|
-
case 2 /* aborted */:
|
|
2242
|
-
boundary.onNext = NOOP3, reject(boundary.signal.reason);
|
|
2243
|
-
break;
|
|
2244
|
-
case 0 /* complete */:
|
|
2245
|
-
resolve(head.consume().flushHTML());
|
|
2246
|
-
break;
|
|
2247
|
-
}
|
|
2248
|
-
})();
|
|
2249
|
-
});
|
|
2250
|
-
}
|
|
2251
|
-
#read(onWrite, onAbort, onClose) {
|
|
2252
|
-
let tick2 = !0, head = this.#head;
|
|
2253
|
-
if (this.#head = null, !head) {
|
|
2254
|
-
onAbort(new Error("Cannot read from a consumed render result"));
|
|
2255
|
-
return;
|
|
2256
|
-
}
|
|
2257
|
-
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
2258
|
-
let status = boundary.flush();
|
|
2259
|
-
if (status === 2 /* aborted */)
|
|
2260
|
-
tick2 || offTick(onNext), boundary.onNext = NOOP3, onAbort(boundary.signal.reason);
|
|
2261
|
-
else if (write || status === 0 /* complete */) {
|
|
2262
|
-
let html = (head = head.consume()).flushHTML();
|
|
2263
|
-
html && onWrite(html), status === 0 /* complete */ ? (tick2 || offTick(onNext), onClose()) : tick2 = !0;
|
|
2264
|
-
} else tick2 && (tick2 = !1, queueTick(onNext));
|
|
2265
|
-
};
|
|
2266
|
-
return onNext(), boundary;
|
|
2267
|
-
}
|
|
2268
|
-
toString() {
|
|
2269
|
-
let head = this.#head;
|
|
2270
|
-
if (this.#head = null, !head) throw new Error("Cannot read from a consumed render result");
|
|
2271
|
-
let { boundary } = head;
|
|
2272
|
-
switch (boundary.flush()) {
|
|
2273
|
-
case 2 /* aborted */:
|
|
2274
|
-
throw boundary.signal.reason;
|
|
2275
|
-
case 1 /* continue */:
|
|
2276
|
-
throw new Error("Cannot consume asynchronous render with 'toString'");
|
|
2277
|
-
}
|
|
2278
|
-
return head.consume().flushHTML();
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2281
|
-
function NOOP3() {
|
|
2282
|
-
}
|
|
2283
|
-
export {
|
|
2284
|
-
$global,
|
|
2285
|
-
_assert_hoist,
|
|
2286
|
-
_attr,
|
|
2287
|
-
_attr_class,
|
|
2288
|
-
_attr_content,
|
|
2289
|
-
_attr_details_or_dialog_open as _attr_details_open,
|
|
2290
|
-
_attr_details_or_dialog_open as _attr_dialog_open,
|
|
2291
|
-
_attr_input_checked,
|
|
2292
|
-
_attr_input_checkedValue,
|
|
2293
|
-
_attr_input_value,
|
|
2294
|
-
_attr_nonce,
|
|
2295
|
-
_attr_option_value,
|
|
2296
|
-
_attr_select_value,
|
|
2297
|
-
_attr_style,
|
|
2298
|
-
_attr_textarea_value,
|
|
2299
|
-
_attrs,
|
|
2300
|
-
_attrs_content,
|
|
2301
|
-
_attrs_partial,
|
|
2302
|
-
_attrs_partial_content,
|
|
2303
|
-
_await,
|
|
2304
|
-
_content,
|
|
2305
|
-
_content_resume,
|
|
2306
|
-
_dynamic_tag,
|
|
2307
|
-
_el,
|
|
2308
|
-
_el_read_error,
|
|
2309
|
-
_el_resume,
|
|
2310
|
-
_escape,
|
|
2311
|
-
_escape_comment,
|
|
2312
|
-
_escape_script,
|
|
2313
|
-
_escape_style,
|
|
2314
|
-
_existing_scope,
|
|
2315
|
-
_for_in,
|
|
2316
|
-
_for_of,
|
|
2317
|
-
_for_to,
|
|
2318
|
-
_for_until,
|
|
2319
|
-
_hoist,
|
|
2320
|
-
_hoist_read_error,
|
|
2321
|
-
_html,
|
|
2322
|
-
_id,
|
|
2323
|
-
_if,
|
|
2324
|
-
_peek_scope_id,
|
|
2325
|
-
_resume,
|
|
2326
|
-
_resume_branch,
|
|
2327
|
-
writeScope as _scope,
|
|
2328
|
-
_scope_id,
|
|
2329
|
-
_scope_reason,
|
|
2330
|
-
_scope_with_id,
|
|
2331
|
-
_script,
|
|
2332
|
-
_sep,
|
|
2333
|
-
_serialize_guard,
|
|
2334
|
-
_serialize_if,
|
|
2335
|
-
_set_serialize_reason,
|
|
2336
|
-
_subscribe,
|
|
2337
|
-
_template,
|
|
2338
|
-
_trailers,
|
|
2339
|
-
_try,
|
|
2340
|
-
_unescaped,
|
|
2341
|
-
_var,
|
|
2342
|
-
attrTag,
|
|
2343
|
-
attrTags,
|
|
2344
|
-
compat,
|
|
2345
|
-
forIn,
|
|
2346
|
-
forInBy,
|
|
2347
|
-
forOf,
|
|
2348
|
-
forOfBy,
|
|
2349
|
-
forStepBy,
|
|
2350
|
-
forTo,
|
|
2351
|
-
forUntil
|
|
2352
|
-
};
|
|
1764
|
+
if (template.i) {
|
|
1765
|
+
let ENCODE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = Math.random() * 4294967296 >>> 0, r = ENCODE_CHARS[n % 53];
|
|
1766
|
+
for (n = n / 53 | 0; n; n >>>= 6) r += ENCODE_CHARS[n & 63];
|
|
1767
|
+
return r;
|
|
1768
|
+
}
|
|
1769
|
+
return "_";
|
|
1770
|
+
}
|
|
1771
|
+
function NOOP() {}
|
|
1772
|
+
//#endregion
|
|
1773
|
+
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 };
|