marko 6.0.167 → 6.0.168
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/html.js +392 -388
- package/dist/html.mjs +391 -387
- package/package.json +1 -1
package/dist/html.js
CHANGED
|
@@ -4,9 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
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,
|
|
8
|
-
return MutationType[MutationType.call = 0] = "call", MutationType[MutationType.assign = 1] = "assign", MutationType;
|
|
9
|
-
}(MutationType || {}), REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
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, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
10
8
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
11
9
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
12
10
|
let symbol = Symbol[name];
|
|
@@ -240,221 +238,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
240
238
|
[JSON, "JSON"],
|
|
241
239
|
[Math, "Math"],
|
|
242
240
|
[Reflect, "Reflect"]
|
|
243
|
-
]),
|
|
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) => {
|
|
241
|
+
]), $chunk, NOOP$2 = () => {}, K_SCOPE_ID = Symbol("Scope ID"), K_SCOPE_REFERENCED = Symbol("Scope Referenced"), kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope), 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
242
|
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
459
243
|
if (typeof renderer == "string") {
|
|
460
244
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
@@ -570,176 +354,45 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
570
354
|
registerRenderBody(fn) {
|
|
571
355
|
register("$C_b", fn);
|
|
572
356
|
}
|
|
573
|
-
}, _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer))
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
706
|
-
//#region src/common/attr-tag.ts
|
|
707
|
-
function attrTag(attrs) {
|
|
708
|
-
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
709
|
-
}
|
|
710
|
-
function attrTags(first, attrs) {
|
|
711
|
-
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
|
712
|
-
}
|
|
713
|
-
function* attrTagIterator() {
|
|
714
|
-
yield this, yield* this[rest];
|
|
715
|
-
}
|
|
716
|
-
//#endregion
|
|
717
|
-
//#region src/common/errors.ts
|
|
718
|
-
function _el_read_error() {}
|
|
719
|
-
function _hoist_read_error() {}
|
|
720
|
-
function _assert_hoist(value) {}
|
|
721
|
-
//#endregion
|
|
722
|
-
//#region src/common/helpers.ts
|
|
723
|
-
function stringifyClassObject(name, value) {
|
|
724
|
-
return value ? name : "";
|
|
725
|
-
}
|
|
726
|
-
function stringifyStyleObject(name, value) {
|
|
727
|
-
return value || value === 0 ? name + ":" + value : "";
|
|
728
|
-
}
|
|
729
|
-
function isEventHandler(name) {
|
|
730
|
-
return /^on[A-Z-]/.test(name);
|
|
731
|
-
}
|
|
732
|
-
function getEventHandlerName(name) {
|
|
733
|
-
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
734
|
-
}
|
|
735
|
-
function isVoid(value) {
|
|
736
|
-
return value == null || value === !1;
|
|
737
|
-
}
|
|
738
|
-
function normalizeDynamicRenderer(value) {
|
|
739
|
-
if (value) {
|
|
740
|
-
if (typeof value == "string") return value;
|
|
741
|
-
let normalized = value.content || value.default || value;
|
|
742
|
-
if ("a" in normalized) return normalized;
|
|
357
|
+
}, _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer));
|
|
358
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
359
|
+
//#region src/common/attr-tag.ts
|
|
360
|
+
function attrTag(attrs) {
|
|
361
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
|
362
|
+
}
|
|
363
|
+
function attrTags(first, attrs) {
|
|
364
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
|
365
|
+
}
|
|
366
|
+
function* attrTagIterator() {
|
|
367
|
+
yield this, yield* this[rest];
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/common/errors.ts
|
|
371
|
+
function _el_read_error() {}
|
|
372
|
+
function _hoist_read_error() {}
|
|
373
|
+
function _assert_hoist(value) {}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/common/helpers.ts
|
|
376
|
+
function stringifyClassObject(name, value) {
|
|
377
|
+
return value ? name : "";
|
|
378
|
+
}
|
|
379
|
+
function stringifyStyleObject(name, value) {
|
|
380
|
+
return value || value === 0 ? name + ":" + value : "";
|
|
381
|
+
}
|
|
382
|
+
function isEventHandler(name) {
|
|
383
|
+
return /^on[A-Z-]/.test(name);
|
|
384
|
+
}
|
|
385
|
+
function getEventHandlerName(name) {
|
|
386
|
+
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
|
387
|
+
}
|
|
388
|
+
function isVoid(value) {
|
|
389
|
+
return value == null || value === !1;
|
|
390
|
+
}
|
|
391
|
+
function normalizeDynamicRenderer(value) {
|
|
392
|
+
if (value) {
|
|
393
|
+
if (typeof value == "string") return value;
|
|
394
|
+
let normalized = value.content || value.default || value;
|
|
395
|
+
if ("a" in normalized) return normalized;
|
|
743
396
|
}
|
|
744
397
|
}
|
|
745
398
|
//#endregion
|
|
@@ -795,6 +448,69 @@ function forStepBy(by, index) {
|
|
|
795
448
|
return by ? by(index) : index;
|
|
796
449
|
}
|
|
797
450
|
patchIteratorNext(Generator.prototype), patchIteratorNext(AsyncGenerator.prototype);
|
|
451
|
+
var MutationType = /* @__PURE__ */ function(MutationType) {
|
|
452
|
+
return MutationType[MutationType.call = 0] = "call", MutationType[MutationType.assign = 1] = "assign", MutationType;
|
|
453
|
+
}(MutationType || {}), State$1 = class {
|
|
454
|
+
ids = 0;
|
|
455
|
+
flush = 0;
|
|
456
|
+
registerInstanceId = 0;
|
|
457
|
+
flushed = !1;
|
|
458
|
+
wroteUndefined = !1;
|
|
459
|
+
buf = [];
|
|
460
|
+
strs = /* @__PURE__ */ new Map();
|
|
461
|
+
refs = /* @__PURE__ */ new WeakMap();
|
|
462
|
+
assigned = /* @__PURE__ */ new Set();
|
|
463
|
+
registered = [];
|
|
464
|
+
boundary = void 0;
|
|
465
|
+
mutated = [];
|
|
466
|
+
}, Reference = class {
|
|
467
|
+
registered = null;
|
|
468
|
+
assigns = null;
|
|
469
|
+
constructor(parent, accessor, flush, pos = null, id = null) {
|
|
470
|
+
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;
|
|
471
|
+
}
|
|
472
|
+
}, Serializer = class {
|
|
473
|
+
#state = new State$1();
|
|
474
|
+
get flushed() {
|
|
475
|
+
return this.#state.flushed;
|
|
476
|
+
}
|
|
477
|
+
stringify(val, boundary) {
|
|
478
|
+
try {
|
|
479
|
+
return this.#state.flushed = !1, this.#state.boundary = boundary, writeRoot(this.#state, val);
|
|
480
|
+
} finally {
|
|
481
|
+
this.#state.flush++, this.#state.buf = [];
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
nextId() {
|
|
485
|
+
return nextId(this.#state);
|
|
486
|
+
}
|
|
487
|
+
symbol(id) {
|
|
488
|
+
let symbol = Symbol();
|
|
489
|
+
return this.#state.refs.set(symbol, new Reference(null, null, 0, null, id)), symbol;
|
|
490
|
+
}
|
|
491
|
+
writeCall(value, object, property, spread) {
|
|
492
|
+
let state = this.#state;
|
|
493
|
+
state.mutated.push({
|
|
494
|
+
type: 0,
|
|
495
|
+
value,
|
|
496
|
+
object,
|
|
497
|
+
property,
|
|
498
|
+
spread
|
|
499
|
+
}), state.flushed = !0;
|
|
500
|
+
}
|
|
501
|
+
writeAssign(value, object, property) {
|
|
502
|
+
let state = this.#state;
|
|
503
|
+
state.mutated.push({
|
|
504
|
+
type: 1,
|
|
505
|
+
value,
|
|
506
|
+
object,
|
|
507
|
+
property
|
|
508
|
+
}), state.flushed = !0;
|
|
509
|
+
}
|
|
510
|
+
register(id, val, scope) {
|
|
511
|
+
return register(id, val, scope, scope ? ++this.#state.registerInstanceId : 0);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
798
514
|
function register(id, val, scope, instanceId) {
|
|
799
515
|
return REGISTRY.set(val, {
|
|
800
516
|
id,
|
|
@@ -1264,6 +980,11 @@ function compareRegisteredReferences(a, b) {
|
|
|
1264
980
|
}
|
|
1265
981
|
//#endregion
|
|
1266
982
|
//#region src/html/writer.ts
|
|
983
|
+
var Mark = /* @__PURE__ */ function(Mark) {
|
|
984
|
+
return Mark.Placeholder = "!^", Mark.PlaceholderEnd = "!", Mark.ReorderMarker = "#", Mark;
|
|
985
|
+
}(Mark || {}), RuntimeKey = /* @__PURE__ */ function(RuntimeKey) {
|
|
986
|
+
return RuntimeKey.Walk = ".w", RuntimeKey.Resume = ".r", RuntimeKey.Blocking = ".b", RuntimeKey.Scripts = ".j", RuntimeKey;
|
|
987
|
+
}(RuntimeKey || {});
|
|
1267
988
|
function getChunk() {
|
|
1268
989
|
return $chunk;
|
|
1269
990
|
}
|
|
@@ -1531,6 +1252,157 @@ function tryCatch(content, catchContent) {
|
|
|
1531
1252
|
} else catchBoundary.count ? boundary.onNext() : boundary.endAsync();
|
|
1532
1253
|
};
|
|
1533
1254
|
}
|
|
1255
|
+
var State = class {
|
|
1256
|
+
tagId = 1;
|
|
1257
|
+
scopeId = 1;
|
|
1258
|
+
reorderId = 1;
|
|
1259
|
+
lastSerializedScopeId = this.scopeId;
|
|
1260
|
+
hasGlobals = !1;
|
|
1261
|
+
needsMainRuntime = !1;
|
|
1262
|
+
hasMainRuntime = !1;
|
|
1263
|
+
hasReorderRuntime = !1;
|
|
1264
|
+
hasWrittenResume = !1;
|
|
1265
|
+
walkOnNextFlush = !1;
|
|
1266
|
+
trailerHTML = "";
|
|
1267
|
+
resumes = "";
|
|
1268
|
+
nonceAttr = "";
|
|
1269
|
+
serializer = new Serializer();
|
|
1270
|
+
writeReorders = null;
|
|
1271
|
+
scopes = /* @__PURE__ */ new Map();
|
|
1272
|
+
writeScopes = null;
|
|
1273
|
+
ensureReady = null;
|
|
1274
|
+
serializeReason;
|
|
1275
|
+
constructor($global) {
|
|
1276
|
+
this.$global = $global, this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
|
|
1277
|
+
}
|
|
1278
|
+
get runtimePrefix() {
|
|
1279
|
+
let { $global } = this;
|
|
1280
|
+
return $global.runtimeId + "." + $global.renderId;
|
|
1281
|
+
}
|
|
1282
|
+
get commentPrefix() {
|
|
1283
|
+
let { $global } = this;
|
|
1284
|
+
return $global.runtimeId + $global.renderId;
|
|
1285
|
+
}
|
|
1286
|
+
reorder(chunk) {
|
|
1287
|
+
this.writeReorders ? this.writeReorders.push(chunk) : (this.needsMainRuntime = !0, this.writeReorders = [chunk]);
|
|
1288
|
+
}
|
|
1289
|
+
nextReorderId() {
|
|
1290
|
+
let c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789", n = this.reorderId++, r = c[n % 54];
|
|
1291
|
+
for (n = n / 54 | 0; n; n >>>= 6) r += c[n & 63];
|
|
1292
|
+
return r;
|
|
1293
|
+
}
|
|
1294
|
+
mark(code, str) {
|
|
1295
|
+
return "<!--" + this.commentPrefix + code + str + "-->";
|
|
1296
|
+
}
|
|
1297
|
+
}, Boundary = class extends AbortController {
|
|
1298
|
+
onNext = NOOP$2;
|
|
1299
|
+
count = 0;
|
|
1300
|
+
constructor(state, parent) {
|
|
1301
|
+
super(), this.state = state, this.state = state, this.signal.addEventListener("abort", () => {
|
|
1302
|
+
this.count = 0, this.state = new State(this.state.$global), this.onNext();
|
|
1303
|
+
}), parent && (parent.aborted ? this.abort(parent.reason) : parent.addEventListener("abort", () => {
|
|
1304
|
+
this.abort(parent.reason);
|
|
1305
|
+
}));
|
|
1306
|
+
}
|
|
1307
|
+
flush() {
|
|
1308
|
+
return this.signal.aborted || flushSerializer(this), this.count ? 1 : this.signal.aborted ? 2 : 0;
|
|
1309
|
+
}
|
|
1310
|
+
startAsync() {
|
|
1311
|
+
this.signal.aborted || this.count++;
|
|
1312
|
+
}
|
|
1313
|
+
endAsync(chunk) {
|
|
1314
|
+
!this.signal.aborted && this.count && (this.count--, chunk?.reorderId && this.state.reorder(chunk), this.onNext());
|
|
1315
|
+
}
|
|
1316
|
+
}, Chunk = class {
|
|
1317
|
+
html = "";
|
|
1318
|
+
scripts = "";
|
|
1319
|
+
effects = "";
|
|
1320
|
+
lastEffect = "";
|
|
1321
|
+
async = !1;
|
|
1322
|
+
consumed = !1;
|
|
1323
|
+
needsWalk = !1;
|
|
1324
|
+
reorderId = null;
|
|
1325
|
+
placeholderBody = null;
|
|
1326
|
+
placeholderRender = null;
|
|
1327
|
+
placeholderBranchId = null;
|
|
1328
|
+
constructor(boundary, next, context) {
|
|
1329
|
+
this.boundary = boundary, this.next = next, this.context = context, this.boundary = boundary, this.next = next, this.context = context;
|
|
1330
|
+
}
|
|
1331
|
+
writeHTML(html) {
|
|
1332
|
+
this.html += html;
|
|
1333
|
+
}
|
|
1334
|
+
writeEffect(scopeId, registryId) {
|
|
1335
|
+
this.lastEffect === registryId ? this.effects += " " + scopeId : (this.lastEffect = registryId, this.effects = concatEffects(this.effects, registryId + " " + scopeId));
|
|
1336
|
+
}
|
|
1337
|
+
writeScript(script) {
|
|
1338
|
+
this.scripts = concatScripts(this.scripts, script);
|
|
1339
|
+
}
|
|
1340
|
+
append(chunk) {
|
|
1341
|
+
this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect;
|
|
1342
|
+
}
|
|
1343
|
+
flushPlaceholder() {
|
|
1344
|
+
if (this.placeholderBody) {
|
|
1345
|
+
let body = this.placeholderBody.consume();
|
|
1346
|
+
if (body.async) {
|
|
1347
|
+
let { state } = this.boundary, reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
1348
|
+
this.placeholderBranchId = null, this.writeHTML(state.mark("!^", reorderId));
|
|
1349
|
+
let after = this.render(this.placeholderRender);
|
|
1350
|
+
after !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), after.writeHTML(state.mark("!", reorderId)), state.reorder(body);
|
|
1351
|
+
} else body.next = this.next, this.next = body;
|
|
1352
|
+
this.placeholderRender = this.placeholderBody = null;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
consume() {
|
|
1356
|
+
let cur = this, needsWalk = cur.needsWalk;
|
|
1357
|
+
if (cur.next && !cur.async) {
|
|
1358
|
+
let html = "", effects = "", scripts = "", lastEffect = "";
|
|
1359
|
+
do
|
|
1360
|
+
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;
|
|
1361
|
+
while (cur.next && !cur.async);
|
|
1362
|
+
cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
|
|
1363
|
+
}
|
|
1364
|
+
return cur;
|
|
1365
|
+
}
|
|
1366
|
+
render(content, val) {
|
|
1367
|
+
let prev = $chunk;
|
|
1368
|
+
$chunk = this;
|
|
1369
|
+
try {
|
|
1370
|
+
return content(val), $chunk;
|
|
1371
|
+
} catch (err) {
|
|
1372
|
+
return this.boundary.abort(err), this;
|
|
1373
|
+
} finally {
|
|
1374
|
+
$chunk = prev;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
flushScript() {
|
|
1378
|
+
let { boundary, effects } = this, { state } = boundary, { $global, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
|
|
1379
|
+
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) {
|
|
1380
|
+
let first = !0;
|
|
1381
|
+
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;
|
|
1382
|
+
}
|
|
1383
|
+
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) {
|
|
1384
|
+
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 + ")"));
|
|
1385
|
+
for (let reorderedChunk of state.writeReorders) {
|
|
1386
|
+
let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
|
|
1387
|
+
for (reorderedChunk.reorderId = null;;) {
|
|
1388
|
+
cur.flushPlaceholder();
|
|
1389
|
+
let { next } = cur;
|
|
1390
|
+
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;
|
|
1391
|
+
else break;
|
|
1392
|
+
}
|
|
1393
|
+
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>";
|
|
1394
|
+
}
|
|
1395
|
+
state.writeReorders = null;
|
|
1396
|
+
}
|
|
1397
|
+
return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
|
|
1398
|
+
}
|
|
1399
|
+
flushHTML() {
|
|
1400
|
+
let { boundary } = this, { state } = boundary;
|
|
1401
|
+
this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
|
|
1402
|
+
let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
|
|
1403
|
+
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;
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1534
1406
|
function flushSerializer(boundary) {
|
|
1535
1407
|
let { state } = boundary, { writeScopes, serializer } = state, { flushed } = serializer;
|
|
1536
1408
|
if (writeScopes || flushed) {
|
|
@@ -1771,6 +1643,138 @@ function getDefaultRenderId(template) {
|
|
|
1771
1643
|
}
|
|
1772
1644
|
return "_";
|
|
1773
1645
|
}
|
|
1646
|
+
var ServerRendered = class {
|
|
1647
|
+
#head;
|
|
1648
|
+
#cachedPromise = null;
|
|
1649
|
+
constructor(head) {
|
|
1650
|
+
this.#head = head;
|
|
1651
|
+
}
|
|
1652
|
+
[Symbol.asyncIterator]() {
|
|
1653
|
+
let resolve, reject, value = "", done = !1, aborted = !1, reason, boundary = this.#read((html) => {
|
|
1654
|
+
value += html, resolve && (resolve({
|
|
1655
|
+
value,
|
|
1656
|
+
done
|
|
1657
|
+
}), value = "");
|
|
1658
|
+
}, (err) => {
|
|
1659
|
+
aborted = !0, reason = err, reject && reject(err);
|
|
1660
|
+
}, () => {
|
|
1661
|
+
done = !0, resolve && (resolve({
|
|
1662
|
+
value,
|
|
1663
|
+
done: !value
|
|
1664
|
+
}), value = "");
|
|
1665
|
+
});
|
|
1666
|
+
return {
|
|
1667
|
+
next() {
|
|
1668
|
+
if (aborted) return Promise.reject(reason);
|
|
1669
|
+
if (value) {
|
|
1670
|
+
let result = {
|
|
1671
|
+
value,
|
|
1672
|
+
done: !1
|
|
1673
|
+
};
|
|
1674
|
+
return value = "", Promise.resolve(result);
|
|
1675
|
+
} else if (done) return Promise.resolve({
|
|
1676
|
+
value: "",
|
|
1677
|
+
done
|
|
1678
|
+
});
|
|
1679
|
+
else return new Promise(exec);
|
|
1680
|
+
},
|
|
1681
|
+
throw(error) {
|
|
1682
|
+
return done || aborted || boundary?.abort(error), Promise.resolve({
|
|
1683
|
+
value: "",
|
|
1684
|
+
done: !0
|
|
1685
|
+
});
|
|
1686
|
+
},
|
|
1687
|
+
return(value) {
|
|
1688
|
+
return done || aborted || boundary?.abort(/* @__PURE__ */ Error("Iterator returned before consumed.")), Promise.resolve({
|
|
1689
|
+
value,
|
|
1690
|
+
done: !0
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
function exec(_resolve, _reject) {
|
|
1695
|
+
resolve = _resolve, reject = _reject;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
pipe(stream) {
|
|
1699
|
+
this.#read((html) => {
|
|
1700
|
+
stream.write(html);
|
|
1701
|
+
}, (err) => {
|
|
1702
|
+
let socket = "socket" in stream && stream.socket;
|
|
1703
|
+
if (socket && typeof socket.destroySoon == "function" && socket.destroySoon(), !stream.emit?.("error", err)) throw err;
|
|
1704
|
+
}, () => {
|
|
1705
|
+
stream.end();
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
toReadable() {
|
|
1709
|
+
let cancelled = !1, boundary, encoder = new TextEncoder();
|
|
1710
|
+
return new ReadableStream({
|
|
1711
|
+
start: (ctrl) => {
|
|
1712
|
+
boundary = this.#read((html) => {
|
|
1713
|
+
ctrl.enqueue(encoder.encode(html));
|
|
1714
|
+
}, (err) => {
|
|
1715
|
+
boundary = void 0, cancelled || ctrl.error(err);
|
|
1716
|
+
}, () => {
|
|
1717
|
+
boundary = void 0, ctrl.close();
|
|
1718
|
+
});
|
|
1719
|
+
},
|
|
1720
|
+
cancel: (reason) => {
|
|
1721
|
+
cancelled = !0, boundary?.abort(reason);
|
|
1722
|
+
}
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
then(onfulfilled, onrejected) {
|
|
1726
|
+
return this.#promise().then(onfulfilled, onrejected);
|
|
1727
|
+
}
|
|
1728
|
+
catch(onrejected) {
|
|
1729
|
+
return this.#promise().catch(onrejected);
|
|
1730
|
+
}
|
|
1731
|
+
finally(onfinally) {
|
|
1732
|
+
return this.#promise().finally(onfinally);
|
|
1733
|
+
}
|
|
1734
|
+
#promise() {
|
|
1735
|
+
return this.#cachedPromise ||= new Promise((resolve, reject) => {
|
|
1736
|
+
let head = this.#head;
|
|
1737
|
+
if (this.#head = null, !head) return reject(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
1738
|
+
let { boundary } = head;
|
|
1739
|
+
(boundary.onNext = () => {
|
|
1740
|
+
switch (!boundary.count && boundary.flush()) {
|
|
1741
|
+
case 2:
|
|
1742
|
+
boundary.onNext = NOOP, reject(boundary.signal.reason);
|
|
1743
|
+
break;
|
|
1744
|
+
case 0:
|
|
1745
|
+
resolve(head.consume().flushHTML());
|
|
1746
|
+
break;
|
|
1747
|
+
}
|
|
1748
|
+
})();
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
#read(onWrite, onAbort, onClose) {
|
|
1752
|
+
let tick = !0, head = this.#head;
|
|
1753
|
+
if (this.#head = null, !head) {
|
|
1754
|
+
onAbort(/* @__PURE__ */ Error("Cannot read from a consumed render result"));
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
let { boundary } = head, onNext = boundary.onNext = (write) => {
|
|
1758
|
+
let status = boundary.flush();
|
|
1759
|
+
if (status === 2) tick || offTick(onNext), boundary.onNext = NOOP, onAbort(boundary.signal.reason);
|
|
1760
|
+
else if (write || status === 0) {
|
|
1761
|
+
let html = (head = head.consume()).flushHTML();
|
|
1762
|
+
html && onWrite(html), status === 0 ? (tick || offTick(onNext), onClose()) : tick = !0;
|
|
1763
|
+
} else tick && (tick = !1, queueTick(onNext));
|
|
1764
|
+
};
|
|
1765
|
+
return onNext(), boundary;
|
|
1766
|
+
}
|
|
1767
|
+
toString() {
|
|
1768
|
+
let head = this.#head;
|
|
1769
|
+
if (this.#head = null, !head) throw Error("Cannot read from a consumed render result");
|
|
1770
|
+
let { boundary } = head;
|
|
1771
|
+
switch (boundary.flush()) {
|
|
1772
|
+
case 2: throw boundary.signal.reason;
|
|
1773
|
+
case 1: throw Error("Cannot consume asynchronous render with 'toString'");
|
|
1774
|
+
}
|
|
1775
|
+
return head.consume().flushHTML();
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1774
1778
|
function NOOP() {}
|
|
1775
1779
|
exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr = _attr, exports._attr_class = _attr_class, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_value = _attr_input_value, exports._attr_nonce = _attr_nonce, exports._attr_option_value = _attr_option_value, exports._attr_select_value = _attr_select_value, exports._attr_style = _attr_style, exports._attr_textarea_value = _attr_textarea_value, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._await = _await, exports._content = _content, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
|
|
1776
1780
|
enumerable: !0,
|