@qwik.dev/core 2.0.0-beta.19 → 2.0.0-beta.21

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-beta.19-dev+0d046fb
3
+ * @qwik.dev/core 2.0.0-beta.21-dev+c008e88
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -11,7 +11,7 @@ export { isBrowser, isDev, isServer } from "@qwik.dev/core/build";
11
11
 
12
12
  import { p } from "@qwik.dev/core/preloader";
13
13
 
14
- const version = "2.0.0-beta.19-dev+0d046fb";
14
+ const version = "2.0.0-beta.21-dev+c008e88";
15
15
 
16
16
  const qDev = !1;
17
17
 
@@ -270,23 +270,45 @@ const delay = timeout => new Promise(resolve => {
270
270
  setTimeout(resolve, timeout);
271
271
  });
272
272
 
273
- function retryOnPromise(fn, retryCount = 0) {
274
- const retryOrThrow = e => {
275
- if (isPromise(e) && retryCount < 100) {
276
- return e.then(retryOnPromise.bind(null, fn, retryCount++));
277
- }
278
- throw e;
279
- };
273
+ const checkError = e => {
274
+ isServer && e instanceof ReferenceError && e.message.includes("window") && (e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message);
275
+ };
276
+
277
+ const justThrow = e => {
278
+ throw e;
279
+ };
280
+
281
+ function retryOnPromise(fn, onError = justThrow) {
282
+ let ok = !1;
283
+ let result;
280
284
  try {
281
- const result = fn();
282
- return isPromise(result) ? result.catch(e => retryOrThrow(e)) : result;
285
+ result = fn(), ok = !0;
283
286
  } catch (e) {
284
- if (isDev && isServer && e instanceof ReferenceError && e.message.includes("window")) {
285
- throw e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message,
286
- e;
287
- }
288
- return retryOrThrow(e);
287
+ result = e;
288
+ }
289
+ if (!isPromise(result)) {
290
+ return ok ? result : (isDev && checkError(result), onError(result));
289
291
  }
292
+ let retryCount = 100;
293
+ const retry = async p => {
294
+ for (;isPromise(p); ) {
295
+ try {
296
+ return await p, await fn();
297
+ } catch (err) {
298
+ if (!isPromise(err)) {
299
+ p = err;
300
+ break;
301
+ }
302
+ if (! --retryCount) {
303
+ p = new Error("Exceeded max retry count in retryOnPromise");
304
+ break;
305
+ }
306
+ p = err;
307
+ }
308
+ }
309
+ return isDev && checkError(p), onError(p);
310
+ };
311
+ return ok ? result.catch(retry) : retry(result);
290
312
  }
291
313
 
292
314
  const ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
@@ -352,15 +374,15 @@ const isSvgElement = elementName => "svg" === elementName || isForeignObjectElem
352
374
 
353
375
  const isMathElement = elementName => "math" === elementName;
354
376
 
355
- const vnode_isDefaultNamespace = vnode => !(384 & vnode.flags);
377
+ const vnode_isDefaultNamespace = vnode => !(1536 & vnode.flags);
356
378
 
357
379
  const vnode_getElementNamespaceFlags = element => {
358
380
  switch (fastNamespaceURI(element)) {
359
381
  case SVG_NS:
360
- return 128;
382
+ return 512;
361
383
 
362
384
  case MATH_NS:
363
- return 256;
385
+ return 1024;
364
386
 
365
387
  default:
366
388
  return 0;
@@ -380,7 +402,7 @@ function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNo
380
402
  domChildren.push(childVNode);
381
403
  continue;
382
404
  }
383
- if ((384 & childVNode.flags) == (384 & domParentVNode.flags)) {
405
+ if ((1536 & childVNode.flags) == (1536 & domParentVNode.flags)) {
384
406
  domChildren.push(childVNode);
385
407
  continue;
386
408
  }
@@ -426,7 +448,7 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
426
448
  const vFirstChild = vnode_getFirstChild(vCursor);
427
449
  if (newChildElement = cloneDomTreeWithNamespace(childElement, childElementTag, namespace, !vFirstChild),
428
450
  childElement.remove(), null == rootElement && (rootElement = newChildElement), parentElement && parentElement.appendChild(newChildElement),
429
- vCursor.node = newChildElement, vCursor.flags &= -385, vCursor.flags |= namespaceFlag,
451
+ vCursor.node = newChildElement, vCursor.flags &= -1537, vCursor.flags |= namespaceFlag,
430
452
  vFirstChild) {
431
453
  vCursor = vFirstChild, parentElement = newChildElement;
432
454
  continue;
@@ -479,23 +501,23 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
479
501
  let elementNamespaceFlag = 0;
480
502
  const isElementVNodeOrString = "string" == typeof tagOrVNode || vnode_isElementVNode(tagOrVNode);
481
503
  if (isElementVNodeOrString && isSvg(tagOrVNode)) {
482
- elementNamespace = SVG_NS, elementNamespaceFlag = 128;
504
+ elementNamespace = SVG_NS, elementNamespaceFlag = 512;
483
505
  } else if (isElementVNodeOrString && isMath(tagOrVNode)) {
484
- elementNamespace = MATH_NS, elementNamespaceFlag = 256;
506
+ elementNamespace = MATH_NS, elementNamespaceFlag = 1024;
485
507
  } else if (domParentVNode && !parentIsForeignObject && !parentIsDefaultNamespace) {
486
- elementNamespace = !!(128 & domParentVNode.flags) ? SVG_NS : !!(256 & domParentVNode.flags) ? MATH_NS : HTML_NS,
487
- elementNamespaceFlag = 384 & domParentVNode.flags;
508
+ elementNamespace = !!(512 & domParentVNode.flags) ? SVG_NS : !!(1024 & domParentVNode.flags) ? MATH_NS : HTML_NS,
509
+ elementNamespaceFlag = 1536 & domParentVNode.flags;
488
510
  }
489
511
  return NEW_NAMESPACE_DATA.elementNamespace = elementNamespace, NEW_NAMESPACE_DATA.elementNamespaceFlag = elementNamespaceFlag,
490
512
  NEW_NAMESPACE_DATA;
491
513
  }
492
514
 
493
515
  function isSvg(tagOrVNode) {
494
- return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!vnode_isElementVNode(tagOrVNode) && (isSvgElement(vnode_getElementName(tagOrVNode)) || !!(128 & tagOrVNode.flags));
516
+ return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!vnode_isElementVNode(tagOrVNode) && (isSvgElement(vnode_getElementName(tagOrVNode)) || !!(512 & tagOrVNode.flags));
495
517
  }
496
518
 
497
519
  function isMath(tagOrVNode) {
498
- return "string" == typeof tagOrVNode ? isMathElement(tagOrVNode) : !!vnode_isElementVNode(tagOrVNode) && (isMathElement(vnode_getElementName(tagOrVNode)) || !!(256 & tagOrVNode.flags));
520
+ return "string" == typeof tagOrVNode ? isMathElement(tagOrVNode) : !!vnode_isElementVNode(tagOrVNode) && (isMathElement(vnode_getElementName(tagOrVNode)) || !!(1024 & tagOrVNode.flags));
499
521
  }
500
522
 
501
523
  function getAttributeNamespace(attributeName) {
@@ -526,6 +548,42 @@ const mergeMaps = (map1, map2) => {
526
548
  return map1;
527
549
  };
528
550
 
551
+ const EVENT_SUFFIX = "$";
552
+
553
+ const isHtmlAttributeAnEventName = name => 113 === name.charCodeAt(0) && 45 === name.charCodeAt(1) && 58 === name.charCodeAt(3);
554
+
555
+ function jsxEventToHtmlAttribute(jsxEvent) {
556
+ if (jsxEvent.endsWith("$")) {
557
+ const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
558
+ if (-1 !== idx) {
559
+ const name = jsxEvent.slice(idx, -1);
560
+ return "DOMContentLoaded" === name ? prefix + "-d-o-m-content-loaded" : createEventName("-" === name.charAt(0) ? name.slice(1) : name.toLowerCase(), prefix);
561
+ }
562
+ }
563
+ return null;
564
+ }
565
+
566
+ function createEventName(event, prefix) {
567
+ return prefix + fromCamelToKebabCase(event);
568
+ }
569
+
570
+ function getEventScopeDataFromJsxEvent(eventName) {
571
+ let prefix;
572
+ let idx = -1;
573
+ return eventName.startsWith("on") ? (prefix = "q-e:", idx = 2) : eventName.startsWith("window:on") ? (prefix = "q-w:",
574
+ idx = 9) : eventName.startsWith("document:on") && (prefix = "q-d:", idx = 11), [ prefix, idx ];
575
+ }
576
+
577
+ function isPreventDefault(key) {
578
+ return key.startsWith("preventdefault:");
579
+ }
580
+
581
+ const fromCamelToKebabCase = text => text.replace(/([A-Z-])/g, a => "-" + a.toLowerCase());
582
+
583
+ const getEventDataFromHtmlAttribute = htmlKey => [ htmlKey.charAt(2), htmlKey.substring(4) ];
584
+
585
+ const getScopedEventName = (scope, eventName) => scope + ":" + eventName;
586
+
529
587
  const _EFFECT_BACK_REF = Symbol("backRef");
530
588
 
531
589
  class BackRef {
@@ -627,7 +685,7 @@ function resumeCursor(cursor, container) {
627
685
  }
628
686
 
629
687
  function removeCursorFromQueue(cursor, container, keepCursorFlag) {
630
- keepCursorFlag || (cursor.flags &= -65);
688
+ keepCursorFlag || (cursor.flags &= -257);
631
689
  const index = globalCursorQueue.indexOf(cursor);
632
690
  -1 !== index && (globalCursorQueue.splice(index, 1), container.$cursorCount$--);
633
691
  }
@@ -757,48 +815,6 @@ const _IMMUTABLE = Symbol("IMMUTABLE");
757
815
 
758
816
  const _UNINITIALIZED = Symbol("UNINITIALIZED");
759
817
 
760
- const EVENT_SUFFIX = "$";
761
-
762
- const isHtmlAttributeAnEventName = name => 111 === name.charCodeAt(0) && 110 === name.charCodeAt(1) && (58 === name.charCodeAt(2) || (name.startsWith("on-window:") || name.startsWith("on-document:")));
763
-
764
- function jsxEventToHtmlAttribute(jsxEvent) {
765
- if (jsxEvent.endsWith("$")) {
766
- const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
767
- if (-1 !== idx) {
768
- const name = jsxEvent.slice(idx, -1);
769
- return "DOMContentLoaded" === name ? prefix + "-d-o-m-content-loaded" : createEventName("-" === name.charAt(0) ? name.slice(1) : name.toLowerCase(), prefix);
770
- }
771
- }
772
- return null;
773
- }
774
-
775
- function createEventName(event, prefix) {
776
- return prefix + fromCamelToKebabCase(event);
777
- }
778
-
779
- function getEventScopeDataFromJsxEvent(eventName) {
780
- let prefix = "on:";
781
- let idx = -1;
782
- return eventName.startsWith("on") ? (prefix = "on:", idx = 2) : eventName.startsWith("window:on") ? (prefix = "on-window:",
783
- idx = 9) : eventName.startsWith("document:on") && (prefix = "on-document:", idx = 11),
784
- [ prefix, idx ];
785
- }
786
-
787
- function isPreventDefault(key) {
788
- return key.startsWith("preventdefault:");
789
- }
790
-
791
- const fromCamelToKebabCase = text => text.replace(/([A-Z-])/g, a => "-" + a.toLowerCase());
792
-
793
- const getEventDataFromHtmlAttribute = htmlKey => htmlKey.startsWith("on:") ? [ "", htmlKey.substring(3) ] : htmlKey.startsWith("on-window:") ? [ "window", htmlKey.substring(10) ] : [ "document", htmlKey.substring(12) ];
794
-
795
- const getScopedEventName = (scope, eventName) => {
796
- const suffix = ":" + eventName;
797
- return scope ? scope + suffix : suffix;
798
- };
799
-
800
- const getLoaderScopedEventName = (scope, scopedEvent) => scope ? "-" + scopedEvent : scopedEvent;
801
-
802
818
  const EMPTY_ARRAY = [];
803
819
 
804
820
  const EMPTY_OBJ = {};
@@ -1014,7 +1030,7 @@ class ComputedSignalImpl extends SignalImpl {
1014
1030
  $computeQrl$;
1015
1031
  $flags$;
1016
1032
  [_EFFECT_BACK_REF]=void 0;
1017
- constructor(container, fn, flags = 33) {
1033
+ constructor(container, fn, flags = 17) {
1018
1034
  super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
1019
1035
  }
1020
1036
  invalidate() {
@@ -1055,15 +1071,9 @@ class ComputedSignalImpl extends SignalImpl {
1055
1071
  ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
1056
1072
  }
1057
1073
  }
1058
- set value(_) {
1059
- throw qError(30);
1060
- }
1061
- get value() {
1062
- return super.value;
1063
- }
1064
1074
  }
1065
1075
 
1066
- class AsyncComputedSignalImpl extends ComputedSignalImpl {
1076
+ class AsyncSignalImpl extends ComputedSignalImpl {
1067
1077
  $untrackedLoading$=!1;
1068
1078
  $untrackedError$=void 0;
1069
1079
  $loadingEffects$=void 0;
@@ -1097,7 +1107,7 @@ class AsyncComputedSignalImpl extends ComputedSignalImpl {
1097
1107
  this.$promise$ = null, super.invalidate();
1098
1108
  }
1099
1109
  async promise() {
1100
- return this.$promise$ = null, await retryOnPromise(() => this.$computeIfNeeded$()),
1110
+ return this.$promise$ = null, await retryOnPromise(this.$computeIfNeeded$.bind(this)),
1101
1111
  this.$untrackedValue$;
1102
1112
  }
1103
1113
  $computeIfNeeded$() {
@@ -1144,7 +1154,7 @@ const implicit$FirstArg = fn => function(first, ...rest) {
1144
1154
 
1145
1155
  class SerializerSignalImpl extends ComputedSignalImpl {
1146
1156
  constructor(container, argQrl) {
1147
- super(container, argQrl, 33);
1157
+ super(container, argQrl, 17);
1148
1158
  }
1149
1159
  $didInitialize$=!1;
1150
1160
  $computeIfNeeded$() {
@@ -1168,7 +1178,7 @@ const createSignal$1 = value => new SignalImpl(null, value);
1168
1178
 
1169
1179
  const createComputedSignal = (qrl, options) => new ComputedSignalImpl(options?.container || null, qrl, getComputedSignalFlags(options?.serializationStrategy || "always"));
1170
1180
 
1171
- const createAsyncComputedSignal = (qrl, options) => new AsyncComputedSignalImpl(options?.container || null, qrl, getComputedSignalFlags(options?.serializationStrategy || "never"));
1181
+ const createAsyncSignal = (qrl, options) => new AsyncSignalImpl(options?.container || null, qrl, getComputedSignalFlags(options?.serializationStrategy || "never"));
1172
1182
 
1173
1183
  const createSerializerSignal = arg => new SerializerSignalImpl(null, arg);
1174
1184
 
@@ -1176,7 +1186,8 @@ const createSignal = createSignal$1;
1176
1186
 
1177
1187
  const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedSignal);
1178
1188
 
1179
- const createAsyncComputed$ = /*#__PURE__*/ implicit$FirstArg(createAsyncComputedSignal);
1189
+ const createAsync$ =
1190
+ /*#__PURE__*/ implicit$FirstArg(createAsyncSignal);
1180
1191
 
1181
1192
  const createSerializer$ = implicit$FirstArg(createSerializerSignal);
1182
1193
 
@@ -1193,7 +1204,7 @@ const _wrapProp = (...args) => {
1193
1204
  return obj[prop];
1194
1205
  }
1195
1206
  if (isSignal(obj)) {
1196
- return obj instanceof AsyncComputedSignalImpl || isDev && assertEqual(prop, "value", "Left side is a signal, prop must be value"),
1207
+ return obj instanceof AsyncSignalImpl || isDev && assertEqual(prop, "value", "Left side is a signal, prop must be value"),
1197
1208
  obj instanceof WrappedSignalImpl && 4 & obj.$flags$ ? obj : getWrapped(args);
1198
1209
  }
1199
1210
  if (isPropsProxy(obj)) {
@@ -1284,8 +1295,8 @@ function clearEffectSubscription(container, effect) {
1284
1295
  const backRefs = effect.backRef;
1285
1296
  if (backRefs) {
1286
1297
  for (const producer of backRefs) {
1287
- if (producer instanceof AsyncComputedSignalImpl) {
1288
- clearAsyncComputedSignal(producer, effect);
1298
+ if (producer instanceof AsyncSignalImpl) {
1299
+ clearAsyncSignal(producer, effect);
1289
1300
  } else if (producer instanceof SignalImpl) {
1290
1301
  clearSignal(container, producer, effect);
1291
1302
  } else if (isPropsProxy(producer)) {
@@ -1305,7 +1316,7 @@ function clearSignal(container, producer, effect) {
1305
1316
  clearAllEffects(container, producer));
1306
1317
  }
1307
1318
 
1308
- function clearAsyncComputedSignal(producer, effect) {
1319
+ function clearAsyncSignal(producer, effect) {
1309
1320
  const effects = producer.$effects$;
1310
1321
  effects && effects.has(effect) && effects.delete(effect);
1311
1322
  const pendingEffects = producer.$loadingEffects$;
@@ -1328,31 +1339,23 @@ class SubscriptionData {
1328
1339
  }
1329
1340
  }
1330
1341
 
1331
- const useLexicalScope = () => {
1332
- const context = getInvokeContext();
1333
- let qrl = context.$qrl$;
1334
- if (qrl) {
1335
- isDev && assertQrl(qrl), isDev && assertDefined(qrl.$captureRef$, "invoke: qrl $captureRef$ must be defined inside useLexicalScope()", qrl);
1336
- } else {
1337
- const el = context.$hostElement$ instanceof ElementVNode ? context.$hostElement$.node : void 0;
1338
- isDev && assertDefined(el, "invoke: element must be defined inside useLexicalScope()", context);
1339
- const containerElement = _getQContainerElement(el);
1340
- isDev && assertDefined(containerElement, "invoke: cant find parent q:container of", el);
1341
- const container = getDomContainer(containerElement);
1342
- context.$container$ ||= container, qrl = container.parseQRL(decodeURIComponent(String(context.$url$)));
1342
+ const maybeScopeFromQL = (captureIds, element) => {
1343
+ if ("string" == typeof captureIds) {
1344
+ const container = getDomContainer(element);
1345
+ setCaptures(deserializeCaptures(container, captureIds));
1343
1346
  }
1344
- return qrl.$captureRef$;
1347
+ return null;
1345
1348
  };
1346
1349
 
1347
- const _val = (_, element) => {
1348
- const [signal] = useLexicalScope();
1349
- signal.value = "number" === element.type ? element.valueAsNumber : element.value;
1350
- };
1350
+ function _val(_, element) {
1351
+ maybeScopeFromQL(this, element);
1352
+ _captures[0].value = "number" === element.type ? element.valueAsNumber : element.value;
1353
+ }
1351
1354
 
1352
- const _chk = (_, element) => {
1353
- const [signal] = useLexicalScope();
1354
- signal.value = element.checked;
1355
- };
1355
+ function _chk(_, element) {
1356
+ maybeScopeFromQL(this, element);
1357
+ _captures[0].value = element.checked;
1358
+ }
1356
1359
 
1357
1360
  const _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1358
1361
 
@@ -1427,26 +1430,26 @@ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
1427
1430
  ...varProps
1428
1431
  }, varPropsCopied = !0), bindCheckedSignal) {
1429
1432
  delete varProps[BIND_CHECKED], varProps.checked = bindCheckedSignal;
1430
- const handler = createQRL(null, "_chk", _chk, null, null, [ bindCheckedSignal ]);
1431
- if (constProps && _hasOwnProperty$1.call(constProps, "on:input")) {
1433
+ const handler = createQRL(null, "_chk", _chk, null, [ bindCheckedSignal ]);
1434
+ if (constProps && _hasOwnProperty$1.call(constProps, "q-e:input")) {
1432
1435
  constPropsCopied || (constProps = {
1433
1436
  ...constProps
1434
1437
  }, constPropsCopied = !0);
1435
- const existingHandler = constProps["on:input"];
1436
- delete constProps["on:input"], toSort = mergeHandlers(varProps, "on:input", existingHandler) || toSort;
1438
+ const existingHandler = constProps["q-e:input"];
1439
+ delete constProps["q-e:input"], toSort = mergeHandlers(varProps, "q-e:input", existingHandler) || toSort;
1437
1440
  }
1438
- toSort = mergeHandlers(varProps, "on:input", handler) || toSort;
1441
+ toSort = mergeHandlers(varProps, "q-e:input", handler) || toSort;
1439
1442
  } else if (bindValueSignal) {
1440
1443
  delete varProps[BIND_VALUE], varProps.value = bindValueSignal;
1441
- const handler = createQRL(null, "_val", _val, null, null, [ bindValueSignal ]);
1442
- if (constProps && _hasOwnProperty$1.call(constProps, "on:input")) {
1444
+ const handler = createQRL(null, "_val", _val, null, [ bindValueSignal ]);
1445
+ if (constProps && _hasOwnProperty$1.call(constProps, "q-e:input")) {
1443
1446
  constPropsCopied || (constProps = {
1444
1447
  ...constProps
1445
1448
  }, constPropsCopied = !0);
1446
- const existingHandler = constProps["on:input"];
1447
- delete constProps["on:input"], toSort = mergeHandlers(varProps, "on:input", existingHandler) || toSort;
1449
+ const existingHandler = constProps["q-e:input"];
1450
+ delete constProps["q-e:input"], toSort = mergeHandlers(varProps, "q-e:input", existingHandler) || toSort;
1448
1451
  }
1449
- toSort = mergeHandlers(varProps, "on:input", handler) || toSort;
1452
+ toSort = mergeHandlers(varProps, "q-e:input", handler) || toSort;
1450
1453
  }
1451
1454
  }
1452
1455
  }
@@ -1559,7 +1562,7 @@ function addUseOnEvents(jsx, useOnEvents) {
1559
1562
  let targetElement = jsxElement;
1560
1563
  let eventKey = key;
1561
1564
  if (isHeadless) {
1562
- if ("on:qvisible" !== key && !key.startsWith("on-document:") && !key.startsWith("on-window:")) {
1565
+ if ("q-e:qvisible" !== key && !key.startsWith("q-d:") && !key.startsWith("q-w:")) {
1563
1566
  isDev && logWarn('You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component has a valid element node. ');
1564
1567
  continue;
1565
1568
  }
@@ -1569,7 +1572,7 @@ function addUseOnEvents(jsx, useOnEvents) {
1569
1572
  }
1570
1573
  targetElement = placeholderElement;
1571
1574
  }
1572
- targetElement && ("script" === targetElement.type && "on:qvisible" === key && (eventKey = "on-document:qinit",
1575
+ targetElement && ("script" === targetElement.type && "q-e:qvisible" === key && (eventKey = "q-d:qinit",
1573
1576
  isDev && logWarn('You are trying to add an event "' + key + '" using the `useVisibleTask$` hook with the "intersection-observer" strategy, but a node to which you can add an event is not found. Using "document-ready" or "document-idle" instead.')),
1574
1577
  addUseOnEvent(targetElement, eventKey, useOnEvents[key]));
1575
1578
  }
@@ -1586,6 +1589,8 @@ function addUseOnEvent(jsxElement, key, value) {
1586
1589
  props[key] = void 0);
1587
1590
  }
1588
1591
 
1592
+ const getValue$1 = o => o.value;
1593
+
1589
1594
  function findFirstElementNode(jsx) {
1590
1595
  const queue = [ jsx ];
1591
1596
  for (;queue.length; ) {
@@ -1602,7 +1607,7 @@ function findFirstElementNode(jsx) {
1602
1607
  return maybeThen(jsx, jsx => findFirstElementNode(jsx));
1603
1608
  }
1604
1609
  if (isSignal(jsx)) {
1605
- return findFirstElementNode(untrack(() => jsx.value));
1610
+ return findFirstElementNode(untrack(getValue$1, jsx));
1606
1611
  }
1607
1612
  }
1608
1613
  }
@@ -1654,6 +1659,30 @@ const SSRStream = (props, key) => jsx(RenderOnce, {
1654
1659
 
1655
1660
  const InternalSSRStream = () => null;
1656
1661
 
1662
+ let _setAttribute = null;
1663
+
1664
+ const fastSetAttribute = (target, name, value) => {
1665
+ _setAttribute || (_setAttribute = target.setAttribute), _setAttribute.call(target, name, value);
1666
+ };
1667
+
1668
+ let _setAttributeNS = null;
1669
+
1670
+ const fastSetAttributeNS = (target, namespace, name, value) => {
1671
+ _setAttributeNS || (_setAttributeNS = target.setAttributeNS), _setAttributeNS.call(target, namespace, name, value);
1672
+ };
1673
+
1674
+ function directSetAttribute(element, attrName, attrValue, isSvg) {
1675
+ if (null != attrValue) {
1676
+ if (isSvg) {
1677
+ const namespace = getAttributeNamespace(attrName);
1678
+ if (namespace) {
1679
+ return void fastSetAttributeNS(element, namespace, attrName, attrValue);
1680
+ }
1681
+ }
1682
+ fastSetAttribute(element, attrName, attrValue);
1683
+ }
1684
+ }
1685
+
1657
1686
  function escapeHTML(html) {
1658
1687
  let escapedHTML = "";
1659
1688
  const length = html.length;
@@ -1820,33 +1849,6 @@ function isAriaAttribute(prop) {
1820
1849
 
1821
1850
  const styleKey = (qStyles, index) => (assertQrl(qStyles), `${hashCode(qStyles.$hash$)}-${index}`);
1822
1851
 
1823
- const mapApp_findIndx = (array, key, start) => {
1824
- isDev && assertTrue(start % 2 == 0, "Expecting even number.");
1825
- let bottom = start >> 1;
1826
- let top = array.length - 2 >> 1;
1827
- for (;bottom <= top; ) {
1828
- const mid = bottom + (top - bottom >> 1);
1829
- const midKey = array[mid << 1];
1830
- if (midKey === key) {
1831
- return mid << 1;
1832
- }
1833
- midKey < key ? bottom = mid + 1 : top = mid - 1;
1834
- }
1835
- return ~(bottom << 1);
1836
- };
1837
-
1838
- const mapArray_set = (array, key, value, start, allowNullValue = !1) => {
1839
- const indx = mapApp_findIndx(array, key, start);
1840
- indx >= 0 ? null != value || allowNullValue ? array[indx + 1] = value : array.splice(indx, 2) : (null != value || allowNullValue) && array.splice(-1 ^ indx, 0, key, value);
1841
- };
1842
-
1843
- const mapArray_get = (array, key, start) => {
1844
- const indx = mapApp_findIndx(array, key, start);
1845
- return indx >= 0 ? array[indx + 1] : null;
1846
- };
1847
-
1848
- const mapArray_has = (array, key, start) => mapApp_findIndx(array, key, start) >= 0;
1849
-
1850
1852
  class DeleteOperation {
1851
1853
  target;
1852
1854
  constructor(target) {
@@ -1901,59 +1903,63 @@ const createInsertOrMoveOperation = (target, parent, beforeTarget) => new Insert
1901
1903
 
1902
1904
  const createSetAttributeOperation = (target, attrName, attrValue, scopedStyleIdPrefix = null, isSvg = !1) => new SetAttributeOperation(target, attrName, attrValue, scopedStyleIdPrefix, isSvg);
1903
1905
 
1904
- function callQrl(container, host, qrl, event, element, useGetObjectById) {
1905
- const getObjectById = useGetObjectById && container?.$getObjectById$ || null;
1906
- const singleItem = vnode_getProp(host, "q:p", getObjectById);
1907
- if (null !== singleItem) {
1908
- return qrl(event, element, singleItem);
1906
+ function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromDOM(event, element)) {
1907
+ const container = ctx.$container$;
1908
+ const hostElement = ctx.$hostElement$;
1909
+ vnode_ensureElementInflated(container, hostElement);
1910
+ let realHandler = handler;
1911
+ if (64 & hostElement.flags) {
1912
+ let shouldInflate;
1913
+ 128 & hostElement.flags || (shouldInflate = !0, hostElement.flags |= 128);
1914
+ const getObj = shouldInflate ? container.$getObjectById$ : null;
1915
+ const singleItem = vnode_getProp(hostElement, "q:p", getObj);
1916
+ if (null !== singleItem) {
1917
+ realHandler = () => handler(event, element, singleItem);
1918
+ } else {
1919
+ const multiItems = vnode_getProp(hostElement, "q:ps", getObj);
1920
+ null !== multiItems && (realHandler = () => handler(event, element, ...multiItems));
1921
+ }
1909
1922
  }
1910
- const multiItems = vnode_getProp(host, "q:ps", getObjectById);
1911
- return null !== multiItems ? qrl(event, element, ...multiItems) : qrl(event, element);
1923
+ return retryOnPromise(() => {
1924
+ if (!(32 & hostElement.flags)) {
1925
+ return invokeApply(ctx, realHandler, [ event, element ]);
1926
+ }
1927
+ }, err => container.handleError(err, hostElement));
1912
1928
  }
1913
1929
 
1914
- const _run = (...args) => {
1915
- const [qrl] = useLexicalScope();
1916
- const context = getInvokeContext();
1917
- const hostElement = context.$hostElement$;
1918
- if (hostElement) {
1919
- return context.$container$ ||= getDomContainer(hostElement.node), vnode_ensureElementInflated(hostElement),
1920
- retryOnPromise(() => {
1921
- if (!(32 & hostElement.flags)) {
1922
- return callQrl(context.$container$, hostElement, qrl, args[0], args[1], !0).catch(err => {
1923
- const container = context.$container$;
1924
- if (!container) {
1925
- throw err;
1926
- }
1927
- container.handleError(err, hostElement);
1928
- });
1929
- }
1930
- });
1930
+ function _run(event, element) {
1931
+ const ctx = newInvokeContextFromDOM(event, element);
1932
+ "string" == typeof this && setCaptures(deserializeCaptures(ctx.$container$, this));
1933
+ const qrlToRun = _captures[0];
1934
+ return isDev && assertQrl(qrlToRun), runEventHandlerQRL(qrlToRun, event, element, ctx);
1935
+ }
1936
+
1937
+ const mapApp_findIndx = (array, key, start) => {
1938
+ isDev && assertTrue(start % 2 == 0, "Expecting even number.");
1939
+ let bottom = start >> 1;
1940
+ let top = array.length - 2 >> 1;
1941
+ for (;bottom <= top; ) {
1942
+ const mid = bottom + (top - bottom >> 1);
1943
+ const midKey = array[mid << 1];
1944
+ if (midKey === key) {
1945
+ return mid << 1;
1946
+ }
1947
+ midKey < key ? bottom = mid + 1 : top = mid - 1;
1931
1948
  }
1949
+ return ~(bottom << 1);
1932
1950
  };
1933
1951
 
1934
- let _setAttribute = null;
1935
-
1936
- const fastSetAttribute = (target, name, value) => {
1937
- _setAttribute || (_setAttribute = target.setAttribute), _setAttribute.call(target, name, value);
1952
+ const mapArray_set = (array, key, value, start, allowNullValue = !1) => {
1953
+ const indx = mapApp_findIndx(array, key, start);
1954
+ indx >= 0 ? null != value || allowNullValue ? array[indx + 1] = value : array.splice(indx, 2) : (null != value || allowNullValue) && array.splice(-1 ^ indx, 0, key, value);
1938
1955
  };
1939
1956
 
1940
- let _setAttributeNS = null;
1941
-
1942
- const fastSetAttributeNS = (target, namespace, name, value) => {
1943
- _setAttributeNS || (_setAttributeNS = target.setAttributeNS), _setAttributeNS.call(target, namespace, name, value);
1957
+ const mapArray_get = (array, key, start) => {
1958
+ const indx = mapApp_findIndx(array, key, start);
1959
+ return indx >= 0 ? array[indx + 1] : null;
1944
1960
  };
1945
1961
 
1946
- function directSetAttribute(element, attrName, attrValue, isSvg) {
1947
- if (null != attrValue) {
1948
- if (isSvg) {
1949
- const namespace = getAttributeNamespace(attrName);
1950
- if (namespace) {
1951
- return void fastSetAttributeNS(element, namespace, attrName, attrValue);
1952
- }
1953
- }
1954
- fastSetAttribute(element, attrName, attrValue);
1955
- }
1956
- }
1962
+ const mapArray_has = (array, key, start) => mapApp_findIndx(array, key, start) >= 0;
1957
1963
 
1958
1964
  function peekNextSibling(vCurrent) {
1959
1965
  return vCurrent ? vCurrent.nextSibling : null;
@@ -1963,7 +1969,7 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty;
1963
1969
 
1964
1970
  function setAttribute(journal, vnode, key, value, scopedStyleIdPrefix, originalValue) {
1965
1971
  import.meta.env.TEST && scopedStyleIdPrefix && vnode_setProp(vnode, "__scopedStyleIdPrefix__", scopedStyleIdPrefix),
1966
- vnode_setProp(vnode, key, originalValue), addVNodeOperation(journal, createSetAttributeOperation(vnode.node, key, value, scopedStyleIdPrefix, !!(128 & vnode.flags)));
1972
+ vnode_setProp(vnode, key, originalValue), addVNodeOperation(journal, createSetAttributeOperation(vnode.node, key, value, scopedStyleIdPrefix, !!(512 & vnode.flags)));
1967
1973
  }
1968
1974
 
1969
1975
  const vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyleIdPrefix) => {
@@ -2259,61 +2265,52 @@ function expectNoMoreTextNodes(diffContext) {
2259
2265
  function createNewElement(diffContext, jsx, elementName, currentFile) {
2260
2266
  const element = createElementWithNamespace(diffContext, elementName);
2261
2267
  const {constProps} = jsx;
2262
- let needsQDispatchEventPatch = !1;
2263
2268
  if (constProps) {
2264
2269
  for (const key in constProps) {
2265
2270
  let value = constProps[key];
2266
2271
  if (isHtmlAttributeAnEventName(key)) {
2267
- const data = getEventDataFromHtmlAttribute(key);
2268
- if (data) {
2269
- const [scope, eventName] = data;
2270
- const scopedEvent = getScopedEventName(scope, eventName);
2271
- const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
2272
- eventName && (vnode_setProp(diffContext.vNewNode, "::" + scopedEvent, value), scope && vnode_setAttr(diffContext.journal, diffContext.vNewNode, key, ""),
2273
- registerQwikLoaderEvent(diffContext, loaderScopedEvent));
2272
+ registerEventHandlers(key, value, element, diffContext.vNewNode, diffContext);
2273
+ } else {
2274
+ if ("ref" === key) {
2275
+ if (isSignal(value)) {
2276
+ value.value = element;
2277
+ continue;
2278
+ }
2279
+ if ("function" == typeof value) {
2280
+ value(element);
2281
+ continue;
2282
+ }
2283
+ if (null == value) {
2284
+ continue;
2285
+ }
2286
+ throw qError(15, [ currentFile ]);
2274
2287
  }
2275
- needsQDispatchEventPatch = !0;
2276
- continue;
2277
- }
2278
- if ("ref" === key) {
2279
2288
  if (isSignal(value)) {
2280
- value.value = element;
2281
- continue;
2289
+ const vHost = diffContext.vNewNode;
2290
+ const signal = value;
2291
+ value = retryOnPromise(() => trackSignalAndAssignHost(signal, vHost, key, diffContext.container, diffContext.subscriptionData.const));
2282
2292
  }
2283
- if ("function" == typeof value) {
2284
- value(element);
2293
+ if (isPromise(value)) {
2294
+ const vHost = diffContext.vNewNode;
2295
+ const attributePromise = value.then(resolvedValue => directSetAttribute(element, key, serializeAttribute(key, resolvedValue, diffContext.scopedStyleIdPrefix), !!(512 & vHost.flags)));
2296
+ diffContext.asyncAttributePromises.push(attributePromise);
2285
2297
  continue;
2286
2298
  }
2287
- if (null == value) {
2288
- continue;
2289
- }
2290
- throw qError(15, [ currentFile ]);
2291
- }
2292
- if (isSignal(value)) {
2293
- const vHost = diffContext.vNewNode;
2294
- const signal = value;
2295
- value = retryOnPromise(() => trackSignalAndAssignHost(signal, vHost, key, diffContext.container, diffContext.subscriptionData.const));
2296
- }
2297
- if (isPromise(value)) {
2298
- const vHost = diffContext.vNewNode;
2299
- const attributePromise = value.then(resolvedValue => directSetAttribute(element, key, serializeAttribute(key, resolvedValue, diffContext.scopedStyleIdPrefix), !!(128 & vHost.flags)));
2300
- diffContext.asyncAttributePromises.push(attributePromise);
2301
- continue;
2302
- }
2303
- if (key !== dangerouslySetInnerHTML) {
2304
- if ("textarea" !== elementName || "value" !== key) {
2305
- directSetAttribute(element, key, serializeAttribute(key, value, diffContext.scopedStyleIdPrefix), !!(128 & diffContext.vNewNode.flags));
2306
- } else {
2307
- if (value && "string" != typeof value) {
2308
- if (isDev) {
2309
- throw qError(23, [ currentFile, value ]);
2299
+ if (key !== dangerouslySetInnerHTML) {
2300
+ if ("textarea" !== elementName || "value" !== key) {
2301
+ directSetAttribute(element, key, serializeAttribute(key, value, diffContext.scopedStyleIdPrefix), !!(512 & diffContext.vNewNode.flags));
2302
+ } else {
2303
+ if (value && "string" != typeof value) {
2304
+ if (isDev) {
2305
+ throw qError(23, [ currentFile, value ]);
2306
+ }
2307
+ continue;
2310
2308
  }
2311
- continue;
2309
+ element.value = escapeHTML(value || "");
2312
2310
  }
2313
- element.value = escapeHTML(value || "");
2311
+ } else {
2312
+ value && (element.innerHTML = String(value), element.setAttribute("q:container", "html"));
2314
2313
  }
2315
- } else {
2316
- value && (element.innerHTML = String(value), element.setAttribute("q:container", "html"));
2317
2314
  }
2318
2315
  }
2319
2316
  }
@@ -2321,8 +2318,18 @@ function createNewElement(diffContext, jsx, elementName, currentFile) {
2321
2318
  if (key && (diffContext.vNewNode.key = key), diffContext.scopedStyleIdPrefix) {
2322
2319
  _hasOwnProperty.call(jsx.varProps, "class") || jsx.constProps && _hasOwnProperty.call(jsx.constProps, "class") || element.setAttribute("class", diffContext.scopedStyleIdPrefix);
2323
2320
  }
2324
- return vnode_insertBefore(diffContext.journal, diffContext.vParent, diffContext.vNewNode, diffContext.vCurrent),
2325
- needsQDispatchEventPatch;
2321
+ vnode_insertBefore(diffContext.journal, diffContext.vParent, diffContext.vNewNode, diffContext.vCurrent);
2322
+ }
2323
+
2324
+ function registerEventHandlers(key, value, element, vnode, diffContext) {
2325
+ const scopedKebabName = key.slice(2);
2326
+ Array.isArray(value) || (value = [ value ]);
2327
+ const handlers = [];
2328
+ for (const handler of value.flat(2)) {
2329
+ handler && handlers.push(runEventHandlerQRL.bind(null, handler));
2330
+ }
2331
+ (element._qDispatch ||= {})[scopedKebabName] = handlers, "e" !== key.charAt(2) && vnode_setAttr(diffContext.journal, vnode, key, ""),
2332
+ registerQwikLoaderEvent(diffContext, scopedKebabName);
2326
2333
  }
2327
2334
 
2328
2335
  function createElementWithNamespace(diffContext, elementName) {
@@ -2334,9 +2341,8 @@ function createElementWithNamespace(diffContext, elementName) {
2334
2341
  }
2335
2342
 
2336
2343
  function expectElement(diffContext, jsx, elementName) {
2337
- let needsQDispatchEventPatch = !1;
2338
2344
  if (diffContext.isCreationMode) {
2339
- needsQDispatchEventPatch = createNewElement(diffContext, jsx, elementName, null);
2345
+ createNewElement(diffContext, jsx, elementName, null);
2340
2346
  } else {
2341
2347
  const isElementVNode = diffContext.vCurrent && vnode_isElementVNode(diffContext.vCurrent);
2342
2348
  const isSameElementName = isElementVNode && elementName === vnode_getElementName(diffContext.vCurrent);
@@ -2344,69 +2350,43 @@ function expectElement(diffContext, jsx, elementName) {
2344
2350
  if (isSameElementName && jsxKey === (isElementVNode && diffContext.vCurrent.key)) {
2345
2351
  deleteFromSideBuffer(diffContext, elementName, jsxKey);
2346
2352
  } else {
2347
- const sideBufferKey = getSideBufferKey(elementName, jsxKey);
2348
- moveOrCreateKeyedNode(diffContext, elementName, jsxKey, sideBufferKey, diffContext.vParent) && (needsQDispatchEventPatch = createNewElement(diffContext, jsx, elementName, null));
2353
+ moveOrCreateKeyedNode(diffContext, elementName, jsxKey, getSideBufferKey(elementName, jsxKey), diffContext.vParent) && createNewElement(diffContext, jsx, elementName, null);
2349
2354
  }
2350
2355
  }
2351
2356
  const jsxProps = jsx.varProps;
2352
- const vNode = diffContext.vNewNode || diffContext.vCurrent;
2353
- const element = vNode.node;
2354
- jsxProps && (needsQDispatchEventPatch = diffProps(diffContext, vNode, jsxProps, isDev && getFileLocationFromJsx(jsx.dev) || null) || needsQDispatchEventPatch),
2355
- needsQDispatchEventPatch && (element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
2356
- if (32 & vNode.flags) {
2357
- return;
2358
- }
2359
- const eventName = fromCamelToKebabCase(event.type);
2360
- const eventProp = ":" + scope.substring(1) + ":" + eventName;
2361
- const qrls = [ vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null) ];
2362
- for (const qrl of qrls.flat(2)) {
2363
- qrl && callQrl(diffContext.container, vNode, qrl, event, vNode.node, !1).catch(e => {
2364
- diffContext.container.handleError(e, vNode);
2365
- });
2366
- }
2367
- }));
2357
+ jsxProps && diffProps(diffContext, diffContext.vNewNode || diffContext.vCurrent, jsxProps, isDev && getFileLocationFromJsx(jsx.dev) || null);
2368
2358
  }
2369
2359
 
2370
2360
  function diffProps(diffContext, vnode, newAttrs, currentFile) {
2371
- diffContext.isCreationMode || vnode_ensureElementInflated(vnode);
2361
+ diffContext.isCreationMode || vnode_ensureElementInflated(diffContext.container, vnode);
2372
2362
  const oldAttrs = vnode.props;
2373
- let patchEventDispatch = !1;
2374
2363
  for (const key in newAttrs) {
2375
2364
  const newValue = newAttrs[key];
2376
- const isEvent = isHtmlAttributeAnEventName(key);
2377
2365
  if (oldAttrs && _hasOwnProperty.call(oldAttrs, key)) {
2378
2366
  const oldValue = oldAttrs[key];
2379
2367
  if (newValue !== oldValue) {
2380
2368
  if (newValue instanceof WrappedSignalImpl && oldValue instanceof WrappedSignalImpl && areWrappedSignalsEqual(newValue, oldValue)) {
2381
2369
  continue;
2382
2370
  }
2383
- if (isEvent) {
2384
- const result = recordJsxEvent(diffContext, vnode, key, newValue, currentFile);
2385
- patchEventDispatch ||= result;
2386
- } else {
2387
- patchProperty(diffContext, vnode, key, newValue, currentFile);
2388
- }
2389
- }
2390
- } else if (null != newValue) {
2391
- if (isEvent) {
2392
- const result = recordJsxEvent(diffContext, vnode, key, newValue, currentFile);
2393
- patchEventDispatch ||= result;
2394
- } else {
2395
2371
  patchProperty(diffContext, vnode, key, newValue, currentFile);
2396
2372
  }
2373
+ } else {
2374
+ null != newValue && patchProperty(diffContext, vnode, key, newValue, currentFile);
2397
2375
  }
2398
2376
  }
2399
2377
  if (oldAttrs) {
2400
2378
  for (const key in oldAttrs) {
2401
- _hasOwnProperty.call(newAttrs, key) || key.startsWith(HANDLER_PREFIX) || isHtmlAttributeAnEventName(key) || patchProperty(diffContext, vnode, key, null, currentFile);
2379
+ _hasOwnProperty.call(newAttrs, key) || ":" === key.charAt(0) || isHtmlAttributeAnEventName(key) || patchProperty(diffContext, vnode, key, null, currentFile);
2402
2380
  }
2403
2381
  }
2404
- return patchEventDispatch;
2405
2382
  }
2406
2383
 
2407
2384
  const patchProperty = (diffContext, vnode, key, value, currentFile) => {
2408
- if ("q:p" === key || "q:ps" === key || key.charAt(0) === HANDLER_PREFIX) {
2409
- return void vnode_setProp(vnode, key, value);
2385
+ if (isHtmlAttributeAnEventName(key)) {
2386
+ return void registerEventHandlers(key, value, vnode.node, vnode, diffContext);
2387
+ }
2388
+ if ("q:p" === key || "q:ps" === key) {
2389
+ return vnode_setProp(vnode, key, value), void (vnode.flags |= 192);
2410
2390
  }
2411
2391
  const originalValue = value;
2412
2392
  if ("ref" === key) {
@@ -2441,23 +2421,9 @@ const patchProperty = (diffContext, vnode, key, value, currentFile) => {
2441
2421
  setAttribute(diffContext.journal, vnode, key, value, diffContext.scopedStyleIdPrefix, originalValue);
2442
2422
  };
2443
2423
 
2444
- const recordJsxEvent = (diffContext, vnode, key, value, currentFile) => {
2445
- const data = getEventDataFromHtmlAttribute(key);
2446
- if (data) {
2447
- const props = vnode.props;
2448
- const [scope, eventName] = data;
2449
- const scopedEvent = getScopedEventName(scope, eventName);
2450
- const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
2451
- const scopedEventKey = ":" + scopedEvent;
2452
- return (!props || !_hasOwnProperty.call(props, scopedEventKey)) && (patchProperty(diffContext, vnode, scopedEventKey, value, currentFile),
2453
- registerQwikLoaderEvent(diffContext, loaderScopedEvent), !0);
2454
- }
2455
- return !1;
2456
- };
2457
-
2458
2424
  function registerQwikLoaderEvent(diffContext, eventName) {
2459
2425
  const qWindow = import.meta.env.TEST ? diffContext.container.document.defaultView : window;
2460
- qWindow && (qWindow.qwikevents ||= []).push(eventName);
2426
+ qWindow && (qWindow._qwikEv ||= []).push(eventName);
2461
2427
  }
2462
2428
 
2463
2429
  function retrieveChildWithKey(diffContext, nodeName, key) {
@@ -2532,7 +2498,7 @@ function deleteFromSideBuffer(diffContext, nodeName, key) {
2532
2498
  function moveOrCreateKeyedNode(diffContext, nodeName, lookupKey, sideBufferKey, parentForInsert, addCurrentToSideBufferOnSideInsert) {
2533
2499
  if (diffContext.vNewNode = retrieveChildWithKey(diffContext, nodeName, lookupKey),
2534
2500
  diffContext.vNewNode) {
2535
- return vnode_insertBefore(diffContext.journal, parentForInsert, diffContext.vNewNode, diffContext.vCurrent),
2501
+ return sideBufferKey || vnode_insertBefore(diffContext.journal, parentForInsert, diffContext.vNewNode, diffContext.vCurrent),
2536
2502
  diffContext.vCurrent = diffContext.vNewNode, diffContext.vNewNode = null, !1;
2537
2503
  }
2538
2504
  if (null != sideBufferKey) {
@@ -2545,7 +2511,7 @@ function moveOrCreateKeyedNode(diffContext, nodeName, lookupKey, sideBufferKey,
2545
2511
  null != currentSideKey && (diffContext.vSideBuffer ||= new Map, diffContext.vSideBuffer.set(currentSideKey, diffContext.vCurrent));
2546
2512
  }
2547
2513
  }
2548
- return vnode_insertBefore(diffContext.journal, parentForInsert, buffered, diffContext.vCurrent),
2514
+ return buffered !== diffContext.vCurrent && vnode_insertBefore(diffContext.journal, parentForInsert, buffered, diffContext.vCurrent),
2549
2515
  diffContext.vCurrent = buffered, diffContext.vNewNode = null, !1;
2550
2516
  }
2551
2517
  }
@@ -2704,7 +2670,7 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
2704
2670
  continue;
2705
2671
  }
2706
2672
  (obj instanceof SignalImpl || isStore(obj)) && clearAllEffects(container, obj),
2707
- (objIsTask || obj instanceof AsyncComputedSignalImpl) && cleanupDestroyable(obj);
2673
+ (objIsTask || obj instanceof AsyncSignalImpl) && cleanupDestroyable(obj);
2708
2674
  }
2709
2675
  }
2710
2676
  }
@@ -2810,8 +2776,6 @@ function containsWrappedSignal(data, signal) {
2810
2776
  return !1;
2811
2777
  }
2812
2778
 
2813
- const HANDLER_PREFIX = ":";
2814
-
2815
2779
  let count = 0;
2816
2780
 
2817
2781
  const useSequentialScope = () => {
@@ -2846,6 +2810,12 @@ const useResourceQrl = (qrl, opts) => {
2846
2810
 
2847
2811
  const Resource = props => _jsxSorted(Fragment, null, null, getResourceValueAsPromise(props), 0, null);
2848
2812
 
2813
+ const getResolved = resource => resource._resolved;
2814
+
2815
+ const getValue = resource => resource.value;
2816
+
2817
+ const getLoading = resource => resource.loading;
2818
+
2849
2819
  function getResourceValueAsPromise(props) {
2850
2820
  const resource = props.value;
2851
2821
  if (isResourceReturn(resource)) {
@@ -2858,13 +2828,13 @@ function getResourceValueAsPromise(props) {
2858
2828
  return Promise.resolve(resource._error).then(useBindInvokeContext(props.onRejected));
2859
2829
  }
2860
2830
  {
2861
- const resolvedValue = untrack(() => resource._resolved);
2831
+ const resolvedValue = untrack(getResolved, resource);
2862
2832
  if (void 0 !== resolvedValue) {
2863
2833
  return Promise.resolve(resolvedValue).then(useBindInvokeContext(props.onResolved));
2864
2834
  }
2865
2835
  }
2866
2836
  }
2867
- return untrack(() => resource.value).then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
2837
+ return untrack(getValue, resource).then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
2868
2838
  }
2869
2839
  if (isPromise(resource)) {
2870
2840
  return resource.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
@@ -2924,8 +2894,8 @@ const runResource = (task, container, host) => {
2924
2894
  resourceTarget._state = "rejected", resourceTarget._error = value, reject(value)),
2925
2895
  isServerPlatform() || forceStoreEffects(resource, "_state"), !0);
2926
2896
  cleanups.push(() => {
2927
- if (!0 === untrack(() => resource.loading)) {
2928
- const value = untrack(() => resource._resolved);
2897
+ if (!0 === untrack(getLoading, resource)) {
2898
+ const value = untrack(getResolved, resource);
2929
2899
  setState(!0, value);
2930
2900
  }
2931
2901
  }), invoke(iCtx, () => {
@@ -3024,7 +2994,7 @@ function clearNodePropData(vNode) {
3024
2994
  }
3025
2995
 
3026
2996
  function setNodeProp(domVNode, journal, property, value, isConst, scopedStyleIdPrefix = null) {
3027
- journal.push(createSetAttributeOperation(domVNode.node, property, value, scopedStyleIdPrefix, !!(128 & domVNode.flags))),
2997
+ journal.push(createSetAttributeOperation(domVNode.node, property, value, scopedStyleIdPrefix, !!(512 & domVNode.flags))),
3028
2998
  isConst || (domVNode.props && null == value ? delete domVNode.props[property] : (domVNode.props ||= {})[property] = value);
3029
2999
  }
3030
3000
 
@@ -3222,11 +3192,6 @@ function walkCursor(cursor, options) {
3222
3192
  const journal = cursorData.journal ||= [];
3223
3193
  let currentVNode = null;
3224
3194
  for (;currentVNode = cursorData.position; ) {
3225
- if (!isRunningOnServer && !import.meta.env.TEST) {
3226
- if (performance.now() - startTime >= timeBudget) {
3227
- return void scheduleYield();
3228
- }
3229
- }
3230
3195
  if (cursorData.promise) {
3231
3196
  return;
3232
3197
  }
@@ -3272,6 +3237,11 @@ function walkCursor(cursor, options) {
3272
3237
  cursorData.promise = null, resumeCursor(cursor, container), triggerCursors();
3273
3238
  });
3274
3239
  }
3240
+ if (!isRunningOnServer && !import.meta.env.TEST) {
3241
+ if (performance.now() - startTime >= timeBudget) {
3242
+ return void scheduleYield();
3243
+ }
3244
+ }
3275
3245
  }
3276
3246
  isDev && assertFalse(!(!(127 & cursor.dirty) || cursorData.position), "Cursor is still dirty and position is not set after walking"),
3277
3247
  finishWalk(container, cursor, cursorData, isRunningOnServer);
@@ -3343,12 +3313,12 @@ function addCursor(container, root, priority) {
3343
3313
  promise: null
3344
3314
  });
3345
3315
  const cursor = root;
3346
- return cursor.flags |= 64, addCursorToQueue(container, cursor), triggerCursors(),
3316
+ return cursor.flags |= 256, addCursorToQueue(container, cursor), triggerCursors(),
3347
3317
  cursor;
3348
3318
  }
3349
3319
 
3350
3320
  function isCursor(vNode) {
3351
- return !!(64 & vNode.flags);
3321
+ return !!(256 & vNode.flags);
3352
3322
  }
3353
3323
 
3354
3324
  function findCursor(vNode) {
@@ -3513,23 +3483,23 @@ const fastGetter = (prototype, name) => {
3513
3483
 
3514
3484
  const vnode_newElement = (element, elementName, key = null) => {
3515
3485
  isDev && assertEqual(fastNodeType(element), 1, "Expecting element node.");
3516
- const vnode = new ElementVNode(key, -503, null, null, null, null, null, null, element, elementName);
3486
+ const vnode = new ElementVNode(key, -2039, null, null, null, null, null, null, element, elementName);
3517
3487
  return element.vNode = vnode, vnode;
3518
3488
  };
3519
3489
 
3520
3490
  const vnode_newUnMaterializedElement = element => {
3521
3491
  isDev && assertEqual(fastNodeType(element), 1, "Expecting element node.");
3522
- const vnode = new ElementVNode(null, -511, null, null, null, null, void 0, void 0, element, void 0);
3492
+ const vnode = new ElementVNode(null, -2047, null, null, null, null, void 0, void 0, element, void 0);
3523
3493
  return element.vNode = vnode, vnode;
3524
3494
  };
3525
3495
 
3526
3496
  const vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
3527
3497
  isDev && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
3528
- return new TextVNode(-508, null, previousTextNode, null, null, sharedTextNode, textContent);
3498
+ return new TextVNode(-2044, null, previousTextNode, null, null, sharedTextNode, textContent);
3529
3499
  };
3530
3500
 
3531
3501
  const vnode_newText = (textNode, textContent) => {
3532
- const vnode = new TextVNode(-500, null, null, null, null, textNode, textContent);
3502
+ const vnode = new TextVNode(-2036, null, null, null, null, textNode, textContent);
3533
3503
  return isDev && assertEqual(fastNodeType(textNode), 3, "Expecting text node."),
3534
3504
  isDev && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode."),
3535
3505
  isDev && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode."),
@@ -3538,7 +3508,7 @@ const vnode_newText = (textNode, textContent) => {
3538
3508
  };
3539
3509
 
3540
3510
  const vnode_newVirtual = () => {
3541
- const vnode = new VirtualVNode(null, -510, null, null, null, null, null, null);
3511
+ const vnode = new VirtualVNode(null, -2046, null, null, null, null, null, null);
3542
3512
  return isDev && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode."),
3543
3513
  isDev && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode."),
3544
3514
  isDev && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode."),
@@ -3612,7 +3582,7 @@ const vnode_setProp = (vNode, key, value) => {
3612
3582
 
3613
3583
  const vnode_setAttr = (journal, vNode, key, value, scopedStyleIdPrefix = null) => {
3614
3584
  vnode_isElementVNode(vNode) && (import.meta.env.TEST && scopedStyleIdPrefix && vnode_setProp(vNode, "__scopedStyleIdPrefix__", scopedStyleIdPrefix),
3615
- vnode_setProp(vNode, key, value), addVNodeOperation(journal, createSetAttributeOperation(vNode.node, key, value, scopedStyleIdPrefix, !!(128 & vNode.flags))));
3585
+ vnode_setProp(vNode, key, value), addVNodeOperation(journal, createSetAttributeOperation(vNode.node, key, value, scopedStyleIdPrefix, !!(512 & vNode.flags))));
3616
3586
  };
3617
3587
 
3618
3588
  const vnode_ensureElementKeyInflated = vnode => {
@@ -3623,30 +3593,44 @@ const vnode_ensureElementKeyInflated = vnode => {
3623
3593
  value && (vnode.key = value);
3624
3594
  };
3625
3595
 
3626
- const vnode_ensureElementInflated = vnode => {
3596
+ const vnode_ensureElementInflated = (container, vnode) => {
3627
3597
  if (1 == (15 & vnode.flags)) {
3628
3598
  const elementVNode = vnode;
3629
3599
  elementVNode.flags ^= 8;
3630
3600
  const element = elementVNode.node;
3631
3601
  const attributes = element.attributes;
3602
+ let isConst = !1;
3632
3603
  for (let idx = 0; idx < attributes.length; idx++) {
3633
3604
  const attr = attributes[idx];
3634
3605
  const key = attr.name;
3635
- if (":" === key || !key) {
3636
- const value = attr.value;
3637
- value && (elementVNode.key = value);
3638
- break;
3639
- }
3640
- if (key.startsWith("q:container")) {
3606
+ if (isHtmlAttributeAnEventName(key)) {
3607
+ registerQrlHandlers(attr, key, container, element);
3608
+ } else if (isConst) {} else if (":" !== key && key) {
3609
+ if (key.startsWith("q:container")) {
3610
+ const value = attr.value;
3611
+ "html" === value ? vnode_setProp(elementVNode, "dangerouslySetInnerHTML", element.innerHTML) : "text" === value && "value" in element && vnode_setProp(elementVNode, "value", element.value);
3612
+ } else {
3613
+ vnode_setProp(elementVNode, key, attr.value);
3614
+ }
3615
+ } else {
3641
3616
  const value = attr.value;
3642
- "html" === value ? vnode_setProp(elementVNode, "dangerouslySetInnerHTML", element.innerHTML) : "text" === value && "value" in element && vnode_setProp(elementVNode, "value", element.value);
3643
- } else if (!key.startsWith("on:")) {
3644
- vnode_setProp(elementVNode, key, attr.value);
3617
+ value && (elementVNode.key = value), isConst = !0;
3645
3618
  }
3646
3619
  }
3620
+ null === vnode_getProp(elementVNode, "q:p", null) && null === vnode_getProp(elementVNode, "q:ps", null) || (vnode.flags |= 64);
3647
3621
  }
3648
3622
  };
3649
3623
 
3624
+ function registerQrlHandlers(attr, key, container, element) {
3625
+ const value = attr.value;
3626
+ const scopedKebabName = key.slice(2);
3627
+ const handlers = value.split("|").map(qrl => {
3628
+ const handler = parseQRL(qrl);
3629
+ return handler.$container$ = container, handler;
3630
+ });
3631
+ (element._qDispatch ||= {})[scopedKebabName] = handlers;
3632
+ }
3633
+
3650
3634
  function vnode_walkVNode(vNode, callback) {
3651
3635
  let vCursor = vNode;
3652
3636
  if (vnode_isTextVNode(vNode)) {
@@ -3701,6 +3685,21 @@ function vnode_getDOMChildNodes(journal, root, isVNode = !1, childNodes = []) {
3701
3685
  return childNodes;
3702
3686
  }
3703
3687
 
3688
+ function vnode_getDOMContainer(vNode) {
3689
+ let cursor = vNode;
3690
+ for (;cursor; ) {
3691
+ if (vnode_isElementVNode(cursor)) {
3692
+ try {
3693
+ return getDomContainer(cursor.node);
3694
+ } catch {
3695
+ return null;
3696
+ }
3697
+ }
3698
+ cursor = cursor.parent;
3699
+ }
3700
+ return null;
3701
+ }
3702
+
3704
3703
  const vnode_getDomSibling = (vNode, nextDirection, descend) => {
3705
3704
  let cursor = vNode;
3706
3705
  for (;descend && cursor && vnode_isVirtualVNode(cursor); ) {
@@ -3833,7 +3832,7 @@ const vnode_locate = (rootVNode, id) => {
3833
3832
 
3834
3833
  const vnode_getChildWithIdx = (vNode, childIdx) => {
3835
3834
  let child = vnode_getFirstChild(vNode);
3836
- for (isDev && assertDefined(child, "Missing child."); child.flags >>> 9 !== childIdx; ) {
3835
+ for (isDev && assertDefined(child, "Missing child."); child.flags >>> 11 !== childIdx; ) {
3837
3836
  child = child.nextSibling, isDev && assertDefined(child, "Missing child.");
3838
3837
  }
3839
3838
  return child;
@@ -4198,9 +4197,9 @@ const processVNodeData$1 = (vData, callback) => {
4198
4197
  }
4199
4198
  };
4200
4199
 
4201
- const vnode_getAttrKeys = vnode => {
4200
+ const vnode_getAttrKeys = (container, vnode) => {
4202
4201
  if (3 & vnode.flags) {
4203
- vnode_ensureElementInflated(vnode);
4202
+ vnode_ensureElementInflated(container, vnode);
4204
4203
  const keys = [];
4205
4204
  const props = vnode.props;
4206
4205
  if (props) {
@@ -4228,7 +4227,7 @@ const vnode_getProjectionParentOrParent = vnode => vnode.parent || vnode.slotPar
4228
4227
 
4229
4228
  const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode.node;
4230
4229
 
4231
- function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1, colorize = !0) {
4230
+ function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1, colorize = !0, container = this && vnode_getDOMContainer(this)) {
4232
4231
  let vnode = this;
4233
4232
  if (0 === depth) {
4234
4233
  return "...";
@@ -4244,8 +4243,8 @@ function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1
4244
4243
  if (vnode_isTextVNode(vnode)) {
4245
4244
  strings.push(qwikDebugToString(vnode_getText(vnode)));
4246
4245
  } else if (vnode_isVirtualVNode(vnode)) {
4247
- const attrs = [ "[" + String(vnode.flags >>> 9) + "]" ];
4248
- vnode.dirty && attrs.push(` dirty:${vnode.dirty}`), vnode_getAttrKeys(vnode).forEach(key => {
4246
+ const attrs = [ "[" + String(vnode.flags >>> 11) + "]" ];
4247
+ vnode.dirty && attrs.push(` dirty:${vnode.dirty}`), vnode_getAttrKeys(container, vnode).forEach(key => {
4249
4248
  if ("q:type" !== key && "__scopedStyleIdPrefix__" !== key) {
4250
4249
  const value = vnode_getProp(vnode, key, null);
4251
4250
  attrs.push(" " + key + "=" + qwikDebugToString(value));
@@ -4261,7 +4260,7 @@ function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1
4261
4260
  const attrs = [];
4262
4261
  isCursor(vnode) && attrs.push(" cursor"), vnode.dirty && attrs.push(` dirty:${vnode.dirty}`),
4263
4262
  vnode.dirtyChildren && attrs.push(` dirtyChildren[${vnode.dirtyChildren.length}]`);
4264
- const keys = vnode_getAttrKeys(vnode);
4263
+ const keys = vnode_getAttrKeys(container, vnode);
4265
4264
  for (const key of keys) {
4266
4265
  const value = vnode_getProp(vnode, key, null);
4267
4266
  attrs.push(" " + key + "=" + qwikDebugToString(value));
@@ -4305,7 +4304,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
4305
4304
  let vLast = null;
4306
4305
  let previousTextNode = null;
4307
4306
  const addVNode = node => {
4308
- node.flags = 511 & node.flags | idx << 9, idx++, vLast && (vLast.nextSibling = node),
4307
+ node.flags = 2047 & node.flags | idx << 11, idx++, vLast && (vLast.nextSibling = node),
4309
4308
  node.previousSibling = vLast, node.parent = vParent, vFirst || (vParent.firstChild = vFirst = node),
4310
4309
  vLast = node;
4311
4310
  };
@@ -4470,16 +4469,7 @@ isServer && import("node:async_hooks").then(module => {
4470
4469
  localAsyncStore = new module.AsyncLocalStorage;
4471
4470
  }).catch(() => {});
4472
4471
 
4473
- const tryGetInvokeContext = () => {
4474
- if (!_context) {
4475
- const context = "undefined" != typeof document && document && document.__q_context__;
4476
- if (!context) {
4477
- return;
4478
- }
4479
- return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
4480
- }
4481
- return _context;
4482
- };
4472
+ const tryGetInvokeContext = () => _context;
4483
4473
 
4484
4474
  const getInvokeContext = () => {
4485
4475
  const ctx = tryGetInvokeContext();
@@ -4515,28 +4505,26 @@ function invoke(context, fn, ...args) {
4515
4505
 
4516
4506
  function invokeApply(context, fn, args) {
4517
4507
  const previousContext = _context;
4518
- let returnValue;
4519
4508
  try {
4520
- _context = context, returnValue = fn.apply(this, args);
4509
+ return _context = context, fn.apply(this, args);
4521
4510
  } finally {
4522
4511
  _context = previousContext;
4523
4512
  }
4524
- return returnValue;
4525
4513
  }
4526
4514
 
4527
- const newInvokeContextFromTuple = ([element, event, url]) => {
4515
+ const newInvokeContextFromDOM = (event, element) => {
4528
4516
  const domContainer = getDomContainer(element);
4529
4517
  const hostElement = vnode_locate(domContainer.rootVNode, element);
4530
4518
  const locale = domContainer.$locale$;
4531
- return locale && setLocale(locale), newInvokeContext(locale, hostElement, event, url);
4519
+ locale && setLocale(locale);
4520
+ const context = newInvokeContext(locale, hostElement, event);
4521
+ return context.$container$ = domContainer, context;
4532
4522
  };
4533
4523
 
4534
- function newRenderInvokeContext(locale, hostElement, container, url) {
4524
+ function newRenderInvokeContext(locale, hostElement, container) {
4535
4525
  const ctx = {
4536
- $url$: url,
4537
4526
  $hostElement$: hostElement,
4538
4527
  $event$: "qRender",
4539
- $qrl$: void 0,
4540
4528
  $effectSubscriber$: void 0,
4541
4529
  $locale$: locale,
4542
4530
  $container$: container,
@@ -4545,12 +4533,10 @@ function newRenderInvokeContext(locale, hostElement, container, url) {
4545
4533
  return seal(), ctx;
4546
4534
  }
4547
4535
 
4548
- function newInvokeContext(locale, hostElement, event, url) {
4536
+ function newInvokeContext(locale, hostElement, event) {
4549
4537
  const ctx = {
4550
- $url$: url,
4551
4538
  $hostElement$: hostElement,
4552
4539
  $event$: event,
4553
- $qrl$: void 0,
4554
4540
  $effectSubscriber$: void 0,
4555
4541
  $locale$: locale || (event && isObject(event) && "locale" in event ? event.locale : void 0),
4556
4542
  $container$: void 0
@@ -4591,15 +4577,7 @@ const trackSignal = (fn, subscriber, property, container, data) => {
4591
4577
  const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignalImpl && value.$hostElement$ !== host && host && (value.$hostElement$ = host),
4592
4578
  trackSignal(() => value.value, host, property, container, data));
4593
4579
 
4594
- const _getContextElement = () => {
4595
- const iCtx = tryGetInvokeContext();
4596
- if (iCtx) {
4597
- const hostElement = iCtx.$hostElement$;
4598
- let element = null;
4599
- return null != hostElement && (vnode_isVNode(hostElement) ? vnode_isElementVNode(hostElement) && (element = vnode_getNode(hostElement)) : element = hostElement),
4600
- element ?? iCtx.$qrl$?.$setContainer$(void 0);
4601
- }
4602
- };
4580
+ const _getContextHostElement = () => tryGetInvokeContext()?.$hostElement$;
4603
4581
 
4604
4582
  const _getContextEvent = () => {
4605
4583
  const iCtx = tryGetInvokeContext();
@@ -4617,11 +4595,7 @@ const _getContextContainer = () => {
4617
4595
 
4618
4596
  const _jsxBranch = input => input;
4619
4597
 
4620
- const _waitUntilRendered = elm => {
4621
- const container = getDomContainer(elm);
4622
- const promise = container?.$renderPromise$;
4623
- return promise || Promise.resolve();
4624
- };
4598
+ const _waitUntilRendered = container => container.$renderPromise$ || Promise.resolve();
4625
4599
 
4626
4600
  const createContextId = name => (isDev && assertTrue(/^[\w/.-]+$/.test(name), "Context name must only contain A-Z,a-z,0-9,_,.,-", name),
4627
4601
  /*#__PURE__*/ Object.freeze({
@@ -4674,40 +4648,40 @@ const _constants = [ void 0, null, !0, !1, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COM
4674
4648
 
4675
4649
  const _constantNames = [ "undefined", "null", "true", "false", "''", "EMPTY_ARRAY", "EMPTY_OBJ", "NEEDS_COMPUTATION", "STORE_ALL_PROPS", "_UNINITIALIZED", "Slot", "Fragment", "NaN", "Infinity", "-Infinity", "MAX_SAFE_INTEGER", "MAX_SAFE_INTEGER-1", "MIN_SAFE_INTEGER" ];
4676
4650
 
4677
- const _typeIdNames = [ "Plain", "RootRef", "ForwardRef", "Constant", "Array", "Object", "URL", "Date", "Regex", "VNode", "RefVNode", "BigInt", "URLSearchParams", "ForwardRefs", "Error", "Promise", "Set", "Map", "Uint8Array", "QRL", "PreloadQRL", "Task", "Resource", "Component", "Signal", "WrappedSignal", "ComputedSignal", "AsyncComputedSignal", "SerializerSignal", "Store", "FormData", "JSXNode", "PropsProxy", "SubscriptionData", "EffectSubscription" ];
4651
+ const _typeIdNames = [ "Plain", "RootRef", "ForwardRef", "Constant", "Array", "Object", "URL", "Date", "Regex", "QRL", "VNode", "RefVNode", "BigInt", "URLSearchParams", "ForwardRefs", "Error", "Promise", "Set", "Map", "Uint8Array", "Task", "Resource", "Component", "Signal", "WrappedSignal", "ComputedSignal", "AsyncSignal", "SerializerSignal", "Store", "FormData", "JSXNode", "PropsProxy", "SubscriptionData", "EffectSubscription" ];
4678
4652
 
4679
- function qrlToString(serializationContext, value, raw) {
4680
- let symbol = value.$symbol$;
4681
- let chunk = value.$chunk$;
4653
+ function qrlToString(serializationContext, qrl, raw) {
4654
+ let symbol = qrl.$symbol$;
4655
+ let chunk = qrl.$chunk$;
4682
4656
  const platform = getPlatform();
4683
4657
  if (platform) {
4684
- const result = platform.chunkForSymbol(symbol, chunk, value.dev?.file);
4658
+ const result = isDev ? platform.chunkForSymbol(symbol, chunk, qrl.dev?.file) : platform.chunkForSymbol(symbol, chunk);
4685
4659
  result && (chunk = result[1], symbol = result[0]);
4686
4660
  }
4687
- if (isSyncQrl(value)) {
4688
- chunk = "", symbol = String(serializationContext.$addSyncFn$(null, 0, value.resolved));
4661
+ if (isSyncQrl(qrl)) {
4662
+ chunk = "", symbol = String(serializationContext.$addSyncFn$(null, 0, qrl.resolved));
4689
4663
  } else {
4690
- if (chunk || (chunk = serializationContext.$symbolToChunkResolver$(value.$hash$)),
4664
+ if (chunk || (chunk = serializationContext.$symbolToChunkResolver$(qrl.$hash$)),
4691
4665
  isDev) {
4692
- (globalThis.__qrl_back_channel__ ||= new Map).set(value.$symbol$, value.resolved),
4666
+ (globalThis.__qrl_back_channel__ ||= new Map).set(qrl.$symbol$, qrl.$symbolRef$),
4693
4667
  chunk || (chunk = QRL_RUNTIME_CHUNK);
4694
4668
  }
4695
4669
  if (!chunk) {
4696
- throw qError(14, [ value.$symbol$ ]);
4670
+ throw qError(14, [ qrl.$symbol$ ]);
4697
4671
  }
4698
4672
  chunk.startsWith("./") && (chunk = chunk.slice(2));
4699
4673
  }
4700
- let capturedIds = null;
4701
- if (Array.isArray(value.$captureRef$) && value.$captureRef$.length > 0 && (capturedIds = value.$captureRef$.map(ref => `${serializationContext.$addRoot$(ref)}`)),
4674
+ const captures = qrl.getCaptured();
4675
+ let captureIds = null;
4676
+ if (captures && captures.length > 0 && (captureIds = captures.map(ref => `${serializationContext.$addRoot$(ref)}`).join(" ")),
4702
4677
  raw) {
4703
- return [ chunk, symbol, capturedIds ];
4678
+ return [ chunk, symbol, captureIds ];
4704
4679
  }
4705
4680
  let qrlStringInline = `${chunk}#${symbol}`;
4706
- return capturedIds && capturedIds.length > 0 && (qrlStringInline += `[${capturedIds.join(" ")}]`),
4707
- qrlStringInline;
4681
+ return captureIds && (qrlStringInline += `#${captureIds}`), qrlStringInline;
4708
4682
  }
4709
4683
 
4710
- function createQRLWithBackChannel(chunk, symbol, captureIds) {
4684
+ function createQRLWithBackChannel(chunk, symbol, captures) {
4711
4685
  let qrlImporter = null;
4712
4686
  if (isDev && chunk === QRL_RUNTIME_CHUNK) {
4713
4687
  const backChannel = globalThis.__qrl_back_channel__;
@@ -4717,14 +4691,12 @@ function createQRLWithBackChannel(chunk, symbol, captureIds) {
4717
4691
  [symbol]: fn
4718
4692
  }));
4719
4693
  }
4720
- return createQRL(chunk, symbol, null, qrlImporter, captureIds, null);
4694
+ return createQRL(chunk, symbol, null, qrlImporter, captures);
4721
4695
  }
4722
4696
 
4723
4697
  function parseQRL(qrl) {
4724
- const hashIdx = qrl.indexOf("#");
4725
- const captureStart = qrl.indexOf("[", hashIdx);
4726
- const captureEnd = qrl.indexOf("]", captureStart);
4727
- return createQRLWithBackChannel(qrl.slice(0, hashIdx > -1 ? hashIdx : captureStart), captureStart > -1 ? qrl.slice(hashIdx + 1, captureStart) : qrl.slice(hashIdx + 1), captureStart > -1 && captureEnd > -1 ? qrl.slice(captureStart + 1, captureEnd).split(" ").filter(v => v.length).map(s => parseInt(s, 10)) : null);
4698
+ const [chunk, symbol, captures] = qrl.split("#");
4699
+ return createQRLWithBackChannel(chunk, symbol, captures || null);
4728
4700
  }
4729
4701
 
4730
4702
  const QRL_RUNTIME_CHUNK = "mock-chunk";
@@ -4736,7 +4708,7 @@ const pendingStoreTargets = new Map;
4736
4708
  const allocate = (container, typeId, value) => {
4737
4709
  switch (typeId) {
4738
4710
  case 0:
4739
- case 13:
4711
+ case 14:
4740
4712
  return value;
4741
4713
 
4742
4714
  case 1:
@@ -4758,18 +4730,22 @@ const allocate = (container, typeId, value) => {
4758
4730
  case 5:
4759
4731
  return {};
4760
4732
 
4761
- case 19:
4762
- case 20:
4763
- if ("string" == typeof value) {
4764
- const data = value.split(" ").map(Number);
4765
- return createQRLWithBackChannel(container.$getObjectById$(data[0]), container.$getObjectById$(data[1]), data.length > 2 ? data.slice(2) : null);
4733
+ case 9:
4734
+ {
4735
+ let qrl;
4736
+ if ("string" == typeof value) {
4737
+ const [chunkId, symbolId, captureIds] = value.split("#");
4738
+ qrl = createQRLWithBackChannel(container.$getObjectById$(chunkId), container.$getObjectById$(symbolId), captureIds || null);
4739
+ } else {
4740
+ qrl = createQRLWithBackChannel("", String(value), null);
4741
+ }
4742
+ return qrl.$container$ = container, qrl;
4766
4743
  }
4767
- return createQRLWithBackChannel("", String(value));
4768
4744
 
4769
- case 21:
4745
+ case 20:
4770
4746
  return new Task(-1, -1, null, null, null, null);
4771
4747
 
4772
- case 22:
4748
+ case 21:
4773
4749
  {
4774
4750
  const res = createResourceReturn(container, void 0, void 0);
4775
4751
  return res.loading = !1, res;
@@ -4785,28 +4761,28 @@ const allocate = (container, typeId, value) => {
4785
4761
  const idx = value.lastIndexOf("/");
4786
4762
  return new RegExp(value.slice(1, idx), value.slice(idx + 1));
4787
4763
 
4788
- case 14:
4764
+ case 15:
4789
4765
  return new Error;
4790
4766
 
4791
- case 23:
4767
+ case 22:
4792
4768
  return componentQrl(null);
4793
4769
 
4794
- case 24:
4770
+ case 23:
4795
4771
  return new SignalImpl(container, 0);
4796
4772
 
4797
- case 25:
4773
+ case 24:
4798
4774
  return new WrappedSignalImpl(container, null, null, null);
4799
4775
 
4800
- case 26:
4776
+ case 25:
4801
4777
  return new ComputedSignalImpl(container, null);
4802
4778
 
4803
- case 27:
4804
- return new AsyncComputedSignalImpl(container, null);
4779
+ case 26:
4780
+ return new AsyncSignalImpl(container, null);
4805
4781
 
4806
- case 28:
4782
+ case 27:
4807
4783
  return new SerializerSignalImpl(container, null);
4808
4784
 
4809
- case 29:
4785
+ case 28:
4810
4786
  {
4811
4787
  const data = value;
4812
4788
  const t = data[0];
@@ -4819,25 +4795,25 @@ const allocate = (container, typeId, value) => {
4819
4795
  }), data[0] = 0, data[1] = storeValue, store;
4820
4796
  }
4821
4797
 
4822
- case 12:
4798
+ case 13:
4823
4799
  return new URLSearchParams(value);
4824
4800
 
4825
- case 30:
4801
+ case 29:
4826
4802
  return new FormData;
4827
4803
 
4828
- case 31:
4804
+ case 30:
4829
4805
  return new JSXNodeImpl(null, null, null, null, null);
4830
4806
 
4831
- case 11:
4807
+ case 12:
4832
4808
  return BigInt(value);
4833
4809
 
4834
- case 16:
4810
+ case 17:
4835
4811
  return new Set;
4836
4812
 
4837
- case 17:
4813
+ case 18:
4838
4814
  return new Map;
4839
4815
 
4840
- case 15:
4816
+ case 16:
4841
4817
  let resolve;
4842
4818
  let reject;
4843
4819
  const promise = new Promise((res, rej) => {
@@ -4845,28 +4821,28 @@ const allocate = (container, typeId, value) => {
4845
4821
  });
4846
4822
  return resolvers.set(promise, [ resolve, reject ]), promise.catch(() => {}), promise;
4847
4823
 
4848
- case 18:
4824
+ case 19:
4849
4825
  const encodedLength = value.length;
4850
4826
  const rest = 3 & encodedLength;
4851
4827
  return new Uint8Array(3 * (encodedLength >>> 2) + (rest ? rest - 1 : 0));
4852
4828
 
4853
- case 32:
4829
+ case 31:
4854
4830
  return createPropsProxy(null);
4855
4831
 
4856
- case 9:
4832
+ case 10:
4857
4833
  return retrieveVNodeOrDocument(container, value);
4858
4834
 
4859
- case 10:
4835
+ case 11:
4860
4836
  const vNode = retrieveVNodeOrDocument(container, value);
4861
4837
  if (vnode_isVNode(vNode)) {
4862
4838
  return ensureMaterialized(vNode), vnode_getNode(vNode);
4863
4839
  }
4864
4840
  throw qError(17, [ typeof vNode ]);
4865
4841
 
4866
- case 33:
4842
+ case 32:
4867
4843
  return new SubscriptionData({});
4868
4844
 
4869
- case 34:
4845
+ case 33:
4870
4846
  return new EffectSubscription(null, null, null, null);
4871
4847
 
4872
4848
  default:
@@ -4884,7 +4860,7 @@ const EXTRACT_SELF_IMPORT = /Promise\s*\.\s*resolve/;
4884
4860
 
4885
4861
  const EXTRACT_FILE_NAME = /[\\/(]([\w\d.\-_]+\.(js|ts)x?):/;
4886
4862
 
4887
- const qrl = (chunkOrFn, symbol, lexicalScopeCapture = EMPTY_ARRAY, stackOffset = 0) => {
4863
+ const qrl = (chunkOrFn, symbol, lexicalScopeCapture, stackOffset = 0) => {
4888
4864
  let chunk = null;
4889
4865
  let symbolFn = null;
4890
4866
  if (isFunction(chunkOrFn)) {
@@ -4912,24 +4888,24 @@ const qrl = (chunkOrFn, symbol, lexicalScopeCapture = EMPTY_ARRAY, stackOffset =
4912
4888
  }
4913
4889
  chunk = chunkOrFn;
4914
4890
  }
4915
- return createQRL(chunk, symbol, null, symbolFn, null, lexicalScopeCapture);
4891
+ return createQRL(chunk, symbol, null, symbolFn, lexicalScopeCapture);
4916
4892
  };
4917
4893
 
4918
- const inlinedQrl = (symbol, symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, symbol, null, null, lexicalScopeCapture);
4894
+ const inlinedQrl = (symbol, symbolName, lexicalScopeCapture) => createQRL(null, symbolName, symbol, null, lexicalScopeCapture);
4919
4895
 
4920
- const _noopQrl = (symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, null, null, null, lexicalScopeCapture);
4896
+ const _noopQrl = (symbolName, lexicalScopeCapture) => createQRL(null, symbolName, null, null, lexicalScopeCapture);
4921
4897
 
4922
- const _noopQrlDEV = (symbolName, opts, lexicalScopeCapture = EMPTY_ARRAY) => {
4898
+ const _noopQrlDEV = (symbolName, opts, lexicalScopeCapture) => {
4923
4899
  const newQrl = _noopQrl(symbolName, lexicalScopeCapture);
4924
4900
  return newQrl.dev = opts, newQrl;
4925
4901
  };
4926
4902
 
4927
- const qrlDEV = (chunkOrFn, symbol, opts, lexicalScopeCapture = EMPTY_ARRAY) => {
4903
+ const qrlDEV = (chunkOrFn, symbol, opts, lexicalScopeCapture) => {
4928
4904
  const newQrl = qrl(chunkOrFn, symbol, lexicalScopeCapture, 1);
4929
4905
  return newQrl.dev = opts, newQrl;
4930
4906
  };
4931
4907
 
4932
- const inlinedQrlDEV = (symbol, symbolName, opts, lexicalScopeCapture = EMPTY_ARRAY) => {
4908
+ const inlinedQrlDEV = (symbol, symbolName, opts, lexicalScopeCapture) => {
4933
4909
  const qrl = inlinedQrl(symbol, symbolName, lexicalScopeCapture);
4934
4910
  return qrl.dev = opts, qrl;
4935
4911
  };
@@ -4949,7 +4925,6 @@ async function serialize(serializationContext) {
4949
4925
  const forwardRefs = [];
4950
4926
  let forwardRefsId = 0;
4951
4927
  const promises = new Set;
4952
- const preloadQrls = new Set;
4953
4928
  const s11nWeakRefs = new Map;
4954
4929
  let parent;
4955
4930
  const qrlMap = new Map;
@@ -4987,9 +4962,6 @@ async function serialize(serializationContext) {
4987
4962
  });
4988
4963
  }
4989
4964
  };
4990
- const addPreloadQrl = qrl => {
4991
- isSyncQrl(qrl) || (preloadQrls.add(qrl), serializationContext.$addRoot$(qrl));
4992
- };
4993
4965
  const getSeenRefOrOutput = (value, index, keepWeak) => {
4994
4966
  let seen = getSeenRef(value);
4995
4967
  const forwardRefIdx = !keepWeak && s11nWeakRefs.get(value);
@@ -5033,7 +5005,7 @@ async function serialize(serializationContext) {
5033
5005
  break;
5034
5006
 
5035
5007
  case "bigint":
5036
- (value < 1e4 && value > -1e3 || getSeenRefOrOutput(value, index)) && output(11, value.toString());
5008
+ (value < 1e4 && value > -1e3 || getSeenRefOrOutput(value, index)) && output(12, value.toString());
5037
5009
  break;
5038
5010
 
5039
5011
  case "symbol":
@@ -5047,21 +5019,20 @@ async function serialize(serializationContext) {
5047
5019
  output(3, 11);
5048
5020
  } else if (isQrl(value)) {
5049
5021
  if (getSeenRefOrOutput(value, index)) {
5050
- const [chunk, symbol, captureIds] = qrlToString(serializationContext, value, !0);
5022
+ const [chunk, symbol, captures] = qrlToString(serializationContext, value, !0);
5051
5023
  let data;
5052
- let type;
5053
5024
  if ("" !== chunk) {
5054
- data = `${$addRoot$(chunk)} ${$addRoot$(symbol)}${captureIds ? " " + captureIds.join(" ") : ""}`;
5025
+ data = `${$addRoot$(chunk)}#${$addRoot$(symbol)}${captures ? "#" + captures : ""}`;
5055
5026
  const existing = qrlMap.get(data);
5056
5027
  if (existing) {
5057
5028
  const ref = $addRoot$(existing);
5058
5029
  return void output(1, ref);
5059
5030
  }
5060
- qrlMap.set(data, value), type = preloadQrls.has(value) ? 20 : 19;
5031
+ qrlMap.set(data, value);
5061
5032
  } else {
5062
- data = Number(symbol), type = 19;
5033
+ data = Number(symbol);
5063
5034
  }
5064
- output(type, data);
5035
+ output(9, data);
5065
5036
  }
5066
5037
  } else {
5067
5038
  if (!isQwikComponent(value)) {
@@ -5069,7 +5040,7 @@ async function serialize(serializationContext) {
5069
5040
  }
5070
5041
  {
5071
5042
  const [qrl] = value[SERIALIZABLE_STATE];
5072
- serializationContext.$renderSymbols$.add(qrl.$symbol$), output(23, [ qrl ]);
5043
+ serializationContext.$renderSymbols$.add(qrl.$symbol$), output(22, [ qrl ]);
5073
5044
  }
5074
5045
  }
5075
5046
  break;
@@ -5100,15 +5071,15 @@ async function serialize(serializationContext) {
5100
5071
  const writeObjectValue = value => {
5101
5072
  if (isPropsProxy(value)) {
5102
5073
  const owner = value[_OWNER];
5103
- output(32, [ _serializationWeakRef(owner), owner.varProps, owner.constProps, value[_PROPS_HANDLER].$effects$ ]);
5074
+ output(31, [ _serializationWeakRef(owner), owner.varProps, owner.constProps, value[_PROPS_HANDLER].$effects$ ]);
5104
5075
  } else if (value instanceof SubscriptionData) {
5105
- output(33, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
5076
+ output(32, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
5106
5077
  } else if (value instanceof EffectSubscription) {
5107
- output(34, [ value.consumer, value.property, value.backRef, value.data ]);
5078
+ output(33, [ value.consumer, value.property, value.backRef, value.data ]);
5108
5079
  } else if (isStore(value)) {
5109
5080
  if (isResource(value)) {
5110
5081
  serializationContext.$resources$.add(value);
5111
- const forwardRefId = resolvePromise(value.value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(22, resolved, resolvedValue, getStoreHandler(value).$effects$));
5082
+ const forwardRefId = resolvePromise(value.value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(21, resolved, resolvedValue, getStoreHandler(value).$effects$));
5112
5083
  output(2, forwardRefId);
5113
5084
  } else {
5114
5085
  const storeHandler = getStoreHandler(value);
@@ -5124,12 +5095,12 @@ async function serialize(serializationContext) {
5124
5095
  for (;void 0 === out[out.length - 1]; ) {
5125
5096
  out.pop();
5126
5097
  }
5127
- output(29, out);
5098
+ output(28, out);
5128
5099
  }
5129
5100
  } else if (isSerializerObj(value)) {
5130
5101
  const result = value[SerializerSymbol](value);
5131
5102
  if (isPromise(result)) {
5132
- const forwardRef = resolvePromise(result, $addRoot$, (resolved, resolvedValue) => new PromiseResult(28, resolved, resolvedValue, void 0, void 0));
5103
+ const forwardRef = resolvePromise(result, $addRoot$, (resolved, resolvedValue) => new PromiseResult(27, resolved, resolvedValue, void 0, void 0));
5133
5104
  output(2, forwardRef);
5134
5105
  } else {
5135
5106
  const index = parent.$index$;
@@ -5149,40 +5120,38 @@ async function serialize(serializationContext) {
5149
5120
  output(5, out.length ? out : 0);
5150
5121
  }
5151
5122
  } else if ($isDomRef$(value)) {
5152
- value.$ssrNode$.vnodeData[0] |= 16, output(10, value.$ssrNode$.id);
5123
+ value.$ssrNode$.vnodeData[0] |= 16, output(11, value.$ssrNode$.id);
5153
5124
  } else if (value instanceof SignalImpl) {
5154
5125
  if (value instanceof SerializerSignalImpl) {
5155
- addPreloadQrl(value.$computeQrl$);
5156
5126
  const maybeValue = getCustomSerializerPromise(value, value.$untrackedValue$);
5157
5127
  if (isPromise(maybeValue)) {
5158
- const forwardRefId = resolvePromise(maybeValue, $addRoot$, (resolved, resolvedValue) => new PromiseResult(28, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
5128
+ const forwardRefId = resolvePromise(maybeValue, $addRoot$, (resolved, resolvedValue) => new PromiseResult(27, resolved, resolvedValue, value.$effects$, value.$computeQrl$));
5159
5129
  output(2, forwardRefId);
5160
5130
  } else {
5161
- output(28, [ value.$computeQrl$, filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$effects$, maybeValue ]);
5131
+ output(27, [ value.$computeQrl$, filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$effects$, maybeValue ]);
5162
5132
  }
5163
5133
  return;
5164
5134
  }
5165
5135
  if (value instanceof WrappedSignalImpl) {
5166
- output(25, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
5136
+ output(24, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
5167
5137
  } else if (value instanceof ComputedSignalImpl) {
5168
5138
  let v = value.$untrackedValue$;
5169
- const shouldAlwaysSerialize = 32 & value.$flags$;
5170
- const shouldNeverSerialize = 16 & value.$flags$;
5139
+ const shouldAlwaysSerialize = 16 & value.$flags$;
5140
+ const shouldNeverSerialize = 8 & value.$flags$;
5171
5141
  const isInvalid = 1 & value.$flags$;
5172
5142
  const isSkippable = fastSkipSerialize(value.$untrackedValue$);
5173
- shouldAlwaysSerialize ? v = value.$untrackedValue$ : (shouldNeverSerialize || isInvalid || isSkippable) && (v = NEEDS_COMPUTATION),
5174
- addPreloadQrl(value.$computeQrl$);
5143
+ shouldAlwaysSerialize ? v = value.$untrackedValue$ : (shouldNeverSerialize || isInvalid || isSkippable) && (v = NEEDS_COMPUTATION);
5175
5144
  const out = [ value.$computeQrl$, filterEffectBackRefs(value[_EFFECT_BACK_REF]), value.$effects$ ];
5176
- const isAsync = value instanceof AsyncComputedSignalImpl;
5145
+ const isAsync = value instanceof AsyncSignalImpl;
5177
5146
  isAsync && out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedLoading$, value.$untrackedError$);
5178
5147
  let keepUndefined = !1;
5179
5148
  v !== NEEDS_COMPUTATION && (out.push(v), isAsync || void 0 !== v || (keepUndefined = !0)),
5180
- output(isAsync ? 27 : 26, out, keepUndefined);
5149
+ output(isAsync ? 26 : 25, out, keepUndefined);
5181
5150
  } else {
5182
5151
  const v = value.$untrackedValue$;
5183
5152
  const keepUndefined = void 0 === v;
5184
5153
  const out = [ v ];
5185
- value.$effects$ && out.push(...value.$effects$), output(24, out, keepUndefined);
5154
+ value.$effects$ && out.push(...value.$effects$), output(23, out, keepUndefined);
5186
5155
  }
5187
5156
  } else if (value instanceof URL) {
5188
5157
  output(6, value.href);
@@ -5193,10 +5162,10 @@ async function serialize(serializationContext) {
5193
5162
  } else if (value instanceof Error) {
5194
5163
  const out = [ value.message ];
5195
5164
  out.push(...Object.entries(value).flat()), isDev && out.push("stack", value.stack),
5196
- output(14, out);
5165
+ output(15, out);
5197
5166
  } else if ($isSsrNode$(value)) {
5198
5167
  const rootIndex = $addRoot$(value);
5199
- serializationContext.$setProp$(value, "q:id", String(rootIndex)), output(9, value.id);
5168
+ serializationContext.$setProp$(value, "q:id", String(rootIndex)), output(10, value.id);
5200
5169
  const vNodeData = value.vnodeData;
5201
5170
  if (vNodeData && (discoverValuesForVNodeData(vNodeData, vNodeDataValue => $addRoot$(vNodeDataValue)),
5202
5171
  vNodeData[0] |= 16), value.children) {
@@ -5217,38 +5186,38 @@ async function serialize(serializationContext) {
5217
5186
  const array = [];
5218
5187
  value.forEach((value, key) => {
5219
5188
  array.push(key, "string" == typeof value ? value : value.name);
5220
- }), output(30, array);
5189
+ }), output(29, array);
5221
5190
  } else if (value instanceof URLSearchParams) {
5222
- output(12, value.toString());
5191
+ output(13, value.toString());
5223
5192
  } else if (value instanceof Set) {
5224
- output(16, [ ...value.values() ]);
5193
+ output(17, [ ...value.values() ]);
5225
5194
  } else if (value instanceof Map) {
5226
5195
  const combined = [];
5227
5196
  for (const [k, v] of value.entries()) {
5228
5197
  combined.push(k, v);
5229
5198
  }
5230
- output(17, combined);
5199
+ output(18, combined);
5231
5200
  } else if (isJSXNode(value)) {
5232
5201
  const out = [ value.type, value.key, value.varProps, value.constProps, value.children, value.toSort || void 0 ];
5233
5202
  for (;void 0 === out[out.length - 1]; ) {
5234
5203
  out.pop();
5235
5204
  }
5236
- output(31, out);
5205
+ output(30, out);
5237
5206
  } else if (value instanceof Task) {
5238
5207
  const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$ ];
5239
5208
  for (;void 0 === out[out.length - 1]; ) {
5240
5209
  out.pop();
5241
5210
  }
5242
- output(21, out);
5211
+ output(20, out);
5243
5212
  } else if (isPromise(value)) {
5244
- const forwardRefId = resolvePromise(value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(15, resolved, resolvedValue));
5213
+ const forwardRefId = resolvePromise(value, $addRoot$, (resolved, resolvedValue) => new PromiseResult(16, resolved, resolvedValue));
5245
5214
  output(2, forwardRefId);
5246
5215
  } else if (value instanceof PromiseResult) {
5247
- if (22 === value.$type$) {
5248
- output(22, [ value.$resolved$, value.$value$, value.$effects$ ]);
5249
- } else if (28 === value.$type$) {
5216
+ if (21 === value.$type$) {
5217
+ output(21, [ value.$resolved$, value.$value$, value.$effects$ ]);
5218
+ } else if (27 === value.$type$) {
5250
5219
  if (value.$qrl$) {
5251
- output(28, [ value.$qrl$, value.$effects$, value.$value$ ]);
5220
+ output(27, [ value.$qrl$, value.$effects$, value.$value$ ]);
5252
5221
  } else {
5253
5222
  if (!value.$resolved$) {
5254
5223
  throw console.error(value.$value$), qError(33);
@@ -5259,7 +5228,7 @@ async function serialize(serializationContext) {
5259
5228
  }
5260
5229
  }
5261
5230
  } else {
5262
- output(15, [ value.$resolved$, value.$value$ ]);
5231
+ output(16, [ value.$resolved$, value.$value$ ]);
5263
5232
  }
5264
5233
  } else if (value instanceof Uint8Array) {
5265
5234
  let buf = "";
@@ -5267,7 +5236,7 @@ async function serialize(serializationContext) {
5267
5236
  buf += String.fromCharCode(c);
5268
5237
  }
5269
5238
  const out = btoa(buf).replace(/=+$/, "");
5270
- output(18, out);
5239
+ output(19, out);
5271
5240
  } else if (value instanceof SerializationWeakRef) {
5272
5241
  const obj = value.$obj$;
5273
5242
  if (getSeenRefOrOutput(obj, parent.$index$, !0)) {
@@ -5311,7 +5280,7 @@ async function serialize(serializationContext) {
5311
5280
  lastIdx--;
5312
5281
  }
5313
5282
  if (lastIdx >= 0) {
5314
- $writer$.write(","), $writer$.write("13,");
5283
+ $writer$.write(","), $writer$.write("14,");
5315
5284
  const out = lastIdx === forwardRefs.length - 1 ? forwardRefs : forwardRefs.slice(0, lastIdx + 1);
5316
5285
  outputArray(out, !0, value => {
5317
5286
  $writer$.write(String(value));
@@ -5720,9 +5689,9 @@ function setEvent(serializationCtx, key, rawValue) {
5720
5689
  let value = null;
5721
5690
  const qrls = rawValue;
5722
5691
  const appendToValue = valueToAppend => {
5723
- value = (null == value ? "" : value + "\n") + valueToAppend;
5692
+ value = (null == value ? "" : value + "|") + valueToAppend;
5724
5693
  };
5725
- const getQrlString = qrl => (!qrl.$symbol$.startsWith("_") && qrl.$captureRef$?.length && (qrl = createQRL(null, "_run", _run, null, null, [ qrl ])),
5694
+ const getQrlString = qrl => (!qrl.$symbol$.startsWith("_") && qrl.$captures$?.length && (qrl = createQRL(null, "_run", _run, null, [ qrl ])),
5726
5695
  qrlToString(serializationCtx, qrl));
5727
5696
  if (Array.isArray(qrls)) {
5728
5697
  for (let i = 0; i <= qrls.length; i++) {
@@ -5745,13 +5714,12 @@ function addQwikEventToSerializationContext(serializationCtx, key, qrl) {
5745
5714
  if (data) {
5746
5715
  const [scope, eventName] = data;
5747
5716
  const scopedEvent = getScopedEventName(scope, eventName);
5748
- const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
5749
- serializationCtx.$eventNames$.add(loaderScopedEvent), serializationCtx.$eventQrls$.add(qrl);
5717
+ serializationCtx.$eventNames$.add(scopedEvent), serializationCtx.$eventQrls$.add(qrl);
5750
5718
  }
5751
5719
  }
5752
5720
 
5753
5721
  function addPreventDefaultEventToSerializationContext(serializationCtx, key) {
5754
- const eventName = key.substring(14);
5722
+ const eventName = "e" + key.substring(14);
5755
5723
  eventName && serializationCtx.$eventNames$.add(eventName);
5756
5724
  }
5757
5725
 
@@ -5775,6 +5743,11 @@ function appendClassIfScopedStyleExists(jsx, styleScoped) {
5775
5743
  jsx.constProps.class = "");
5776
5744
  }
5777
5745
 
5746
+ const useLexicalScope = () => (isDev && assertDefined(_captures, "invoke: captures must be defined for useLexicalScope()"),
5747
+ _captures);
5748
+
5749
+ let loading = Promise.resolve();
5750
+
5778
5751
  const inflate = (container, target, typeId, data) => {
5779
5752
  if (0 !== typeId) {
5780
5753
  switch (4 !== typeId && Array.isArray(data) && (data = _eagerDeserializeArray(container, data)),
@@ -5792,19 +5765,14 @@ const inflate = (container, target, typeId, data) => {
5792
5765
  }
5793
5766
  break;
5794
5767
 
5795
- case 19:
5796
5768
  case 20:
5797
- _inflateQRL(container, target), 20 === typeId && target.resolve();
5798
- break;
5799
-
5800
- case 21:
5801
5769
  const task = target;
5802
5770
  const v = data;
5803
5771
  task.$qrl$ = v[0], task.$flags$ = v[1], task.$index$ = v[2], task.$el$ = v[3], task[_EFFECT_BACK_REF] = v[4],
5804
5772
  task.$state$ = v[5];
5805
5773
  break;
5806
5774
 
5807
- case 22:
5775
+ case 21:
5808
5776
  const [resolved, result, effects] = data;
5809
5777
  const resource = target;
5810
5778
  resolved ? (resource.value = Promise.resolve(result), resource._resolved = result,
@@ -5812,11 +5780,11 @@ const inflate = (container, target, typeId, data) => {
5812
5780
  resource._state = "rejected"), getStoreHandler(target).$effects$ = effects;
5813
5781
  break;
5814
5782
 
5815
- case 23:
5783
+ case 22:
5816
5784
  target[SERIALIZABLE_STATE][0] = data[0];
5817
5785
  break;
5818
5786
 
5819
- case 29:
5787
+ case 28:
5820
5788
  {
5821
5789
  const store = unwrapStore(target);
5822
5790
  const storeTarget = pendingStoreTargets.get(store);
@@ -5827,7 +5795,7 @@ const inflate = (container, target, typeId, data) => {
5827
5795
  break;
5828
5796
  }
5829
5797
 
5830
- case 24:
5798
+ case 23:
5831
5799
  {
5832
5800
  const signal = target;
5833
5801
  const d = data;
@@ -5835,7 +5803,7 @@ const inflate = (container, target, typeId, data) => {
5835
5803
  break;
5836
5804
  }
5837
5805
 
5838
- case 25:
5806
+ case 24:
5839
5807
  {
5840
5808
  const signal = target;
5841
5809
  const d = data;
@@ -5845,30 +5813,31 @@ const inflate = (container, target, typeId, data) => {
5845
5813
  break;
5846
5814
  }
5847
5815
 
5848
- case 27:
5816
+ case 26:
5849
5817
  {
5850
- const asyncComputed = target;
5818
+ const asyncSignal = target;
5851
5819
  const d = data;
5852
- asyncComputed.$computeQrl$ = d[0], asyncComputed[_EFFECT_BACK_REF] = d[1], asyncComputed.$effects$ = new Set(d[2]),
5853
- asyncComputed.$loadingEffects$ = new Set(d[3]), asyncComputed.$errorEffects$ = new Set(d[4]),
5854
- asyncComputed.$untrackedLoading$ = d[5], asyncComputed.$untrackedError$ = d[6];
5855
- d.length > 7 && (asyncComputed.$untrackedValue$ = d[7], asyncComputed.$promiseValue$ = d[7]),
5856
- asyncComputed.$flags$ |= 1;
5820
+ asyncSignal.$computeQrl$ = d[0], asyncSignal[_EFFECT_BACK_REF] = d[1], asyncSignal.$effects$ = new Set(d[2]),
5821
+ asyncSignal.$loadingEffects$ = new Set(d[3]), asyncSignal.$errorEffects$ = new Set(d[4]),
5822
+ asyncSignal.$untrackedLoading$ = d[5], asyncSignal.$untrackedError$ = d[6];
5823
+ d.length > 7 && (asyncSignal.$untrackedValue$ = d[7], asyncSignal.$promiseValue$ = d[7]),
5824
+ asyncSignal.$flags$ |= 1;
5857
5825
  break;
5858
5826
  }
5859
5827
 
5860
- case 28:
5861
- case 26:
5828
+ case 27:
5829
+ case 25:
5862
5830
  {
5863
5831
  const computed = target;
5864
5832
  const d = data;
5865
- computed.$computeQrl$ = d[0], computed[_EFFECT_BACK_REF] = d[1], d[2] && (computed.$effects$ = new Set(d[2]));
5866
- d.length > 3 ? (computed.$untrackedValue$ = d[3], 28 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1,
5867
- computed.$computeQrl$.resolve());
5833
+ computed.$computeQrl$ = d[0];
5834
+ const p = computed.$computeQrl$.resolve(container).catch(() => {});
5835
+ loading = loading.finally(() => p), computed[_EFFECT_BACK_REF] = d[1], d[2] && (computed.$effects$ = new Set(d[2]));
5836
+ d.length > 3 ? (computed.$untrackedValue$ = d[3], 27 === typeId && (computed.$flags$ |= 1)) : computed.$flags$ |= 1;
5868
5837
  break;
5869
5838
  }
5870
5839
 
5871
- case 14:
5840
+ case 15:
5872
5841
  {
5873
5842
  const d = data;
5874
5843
  target.message = d[0];
@@ -5878,7 +5847,7 @@ const inflate = (container, target, typeId, data) => {
5878
5847
  break;
5879
5848
  }
5880
5849
 
5881
- case 30:
5850
+ case 29:
5882
5851
  {
5883
5852
  const formData = target;
5884
5853
  const d = data;
@@ -5888,7 +5857,7 @@ const inflate = (container, target, typeId, data) => {
5888
5857
  break;
5889
5858
  }
5890
5859
 
5891
- case 31:
5860
+ case 30:
5892
5861
  {
5893
5862
  const jsx = target;
5894
5863
  const [type, key, varProps, constProps, children, toSort] = data;
@@ -5897,7 +5866,7 @@ const inflate = (container, target, typeId, data) => {
5897
5866
  break;
5898
5867
  }
5899
5868
 
5900
- case 16:
5869
+ case 17:
5901
5870
  {
5902
5871
  const set = target;
5903
5872
  const d = data;
@@ -5907,7 +5876,7 @@ const inflate = (container, target, typeId, data) => {
5907
5876
  break;
5908
5877
  }
5909
5878
 
5910
- case 17:
5879
+ case 18:
5911
5880
  {
5912
5881
  const map = target;
5913
5882
  const d = data;
@@ -5917,7 +5886,7 @@ const inflate = (container, target, typeId, data) => {
5917
5886
  break;
5918
5887
  }
5919
5888
 
5920
- case 15:
5889
+ case 16:
5921
5890
  {
5922
5891
  const promise = target;
5923
5892
  const [resolved, result] = data;
@@ -5926,7 +5895,7 @@ const inflate = (container, target, typeId, data) => {
5926
5895
  break;
5927
5896
  }
5928
5897
 
5929
- case 18:
5898
+ case 19:
5930
5899
  const bytes = target;
5931
5900
  const buf = atob(data);
5932
5901
  let i = 0;
@@ -5935,7 +5904,7 @@ const inflate = (container, target, typeId, data) => {
5935
5904
  }
5936
5905
  break;
5937
5906
 
5938
- case 32:
5907
+ case 31:
5939
5908
  const propsProxy = target;
5940
5909
  const d = data;
5941
5910
  let owner = d[0];
@@ -5943,14 +5912,14 @@ const inflate = (container, target, typeId, data) => {
5943
5912
  owner._proxy = propsProxy), propsProxy[_OWNER] = owner, propsProxy[_PROPS_HANDLER].$effects$ = d[3];
5944
5913
  break;
5945
5914
 
5946
- case 33:
5915
+ case 32:
5947
5916
  {
5948
5917
  const effectData = target;
5949
5918
  effectData.data.$scopedStyleIdPrefix$ = data[0], effectData.data.$isConst$ = data[1];
5950
5919
  break;
5951
5920
  }
5952
5921
 
5953
- case 34:
5922
+ case 33:
5954
5923
  {
5955
5924
  const effectSub = target;
5956
5925
  const d = data;
@@ -5972,16 +5941,6 @@ const _eagerDeserializeArray = (container, data, output = Array(data.length / 2)
5972
5941
  return output;
5973
5942
  };
5974
5943
 
5975
- function _inflateQRL(container, qrl) {
5976
- if (qrl.$captureRef$) {
5977
- return qrl;
5978
- }
5979
- const captureIds = qrl.$capture$;
5980
- return qrl.$captureRef$ = captureIds ? captureIds.map(id => container.$getObjectById$(id)) : null,
5981
- qrl.$capture$ = null, container.element && qrl.$setContainer$(container.element),
5982
- qrl;
5983
- }
5984
-
5985
5944
  function deserializeData(container, typeId, value) {
5986
5945
  if (0 === typeId) {
5987
5946
  return value;
@@ -6014,7 +5973,7 @@ function inflateWrappedSignalValue(signal) {
6014
5973
  }
6015
5974
  }
6016
5975
 
6017
- const needsInflation = typeId => typeId >= 14 || 4 === typeId || 5 === typeId;
5976
+ const needsInflation = typeId => typeId >= 15 || 4 === typeId || 5 === typeId;
6018
5977
 
6019
5978
  const deserializedProxyMap = new WeakMap;
6020
5979
 
@@ -6306,8 +6265,9 @@ class DomContainer extends _SharedContainer {
6306
6265
  $setRawState$(id, vParent) {
6307
6266
  this.$stateData$[id] = vParent;
6308
6267
  }
6309
- parseQRL(qrl) {
6310
- return _inflateQRL(this, parseQRL(qrl));
6268
+ parseQRL(qrlStr) {
6269
+ const qrl = parseQRL(qrlStr);
6270
+ return qrl.$container$ = this, qrl;
6311
6271
  }
6312
6272
  handleError(err, host) {
6313
6273
  const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
@@ -6465,11 +6425,12 @@ class Task extends BackRef {
6465
6425
 
6466
6426
  const isTask = value => value instanceof Task;
6467
6427
 
6468
- const scheduleTask = (_event, element) => {
6469
- const [task] = useLexicalScope();
6428
+ function scheduleTask(_event, element) {
6470
6429
  const container = getDomContainer(element);
6430
+ "string" == typeof this && setCaptures(deserializeCaptures(container, this));
6431
+ const task = _captures[0];
6471
6432
  task.$flags$ |= 8, markVNodeDirty(container, task.$el$, 1);
6472
- };
6433
+ }
6473
6434
 
6474
6435
  const throwIfQRLNotResolved = qrl => {
6475
6436
  if (!qrl.resolved) {
@@ -6544,11 +6505,11 @@ const getComputedSignalFlags = serializationStrategy => {
6544
6505
  let flags = 1;
6545
6506
  switch (serializationStrategy) {
6546
6507
  case "never":
6547
- flags |= 16;
6508
+ flags |= 8;
6548
6509
  break;
6549
6510
 
6550
6511
  case "always":
6551
- flags |= 32;
6512
+ flags |= 16;
6552
6513
  }
6553
6514
  return flags;
6554
6515
  };
@@ -6781,6 +6742,8 @@ function getEffects(target, prop, storeEffects) {
6781
6742
  return effectsToTrigger;
6782
6743
  }
6783
6744
 
6745
+ const getKeyVal = (value, key) => value[key];
6746
+
6784
6747
  const canSerialize = (value, seen = new WeakSet) => {
6785
6748
  if (null == value || "string" == typeof value || "number" == typeof value || "boolean" == typeof value || "bigint" == typeof value) {
6786
6749
  return !0;
@@ -6793,7 +6756,7 @@ const canSerialize = (value, seen = new WeakSet) => {
6793
6756
  const proto = Object.getPrototypeOf(value);
6794
6757
  if (isStore(value) && (value = getStoreTarget(value)), proto == Object.prototype) {
6795
6758
  for (const key in value) {
6796
- if (!canSerialize(untrack(() => value[key]), seen)) {
6759
+ if (!canSerialize(untrack(getKeyVal, value, key), seen)) {
6797
6760
  return !1;
6798
6761
  }
6799
6762
  }
@@ -6901,7 +6864,7 @@ const _dumpState = (state, color = !1, prefix = "", limit = 20) => {
6901
6864
  out.push(`${RED}${type}${RESET} ${printRaw(value, `${prefix} `)}`);
6902
6865
  } else {
6903
6866
  3 === key ? value = constantToName(value) : "string" == typeof value ? (value = JSON.stringify(value),
6904
- value.length > 120 && (value = value.slice(0, 120) + '"...')) : 13 === key ? value = `[\n${prefix} ${value.join(`\n${prefix} `)}\n${prefix}]` : Array.isArray(value) && (value = value.length ? `[\n${_dumpState(value, color, `${prefix} `)}\n${prefix}]` : "[]"),
6867
+ value.length > 120 && (value = value.slice(0, 120) + '"...')) : 14 === key ? value = `[\n${prefix} ${value.join(`\n${prefix} `)}\n${prefix}]` : Array.isArray(value) && (value = value.length ? `[\n${_dumpState(value, color, `${prefix} `)}\n${prefix}]` : "[]"),
6905
6868
  out.push(`${RED}${typeIdToName(key)}${RESET} ${value}`);
6906
6869
  }
6907
6870
  }
@@ -6919,8 +6882,7 @@ const constantToName = code => _constantNames[code] || `Unknown(${code})`;
6919
6882
 
6920
6883
  function preprocessState(data, container) {
6921
6884
  const isRootDeepRef = (type, value) => 1 === type && "string" == typeof value;
6922
- const isForwardRefsMap = type => 13 === type;
6923
- const isPreloadQrlType = type => 20 === type;
6885
+ const isForwardRefsMap = type => 14 === type;
6924
6886
  const processRootRef = index => {
6925
6887
  const rootRefPath = data[index + 1].split(" ");
6926
6888
  let object = data;
@@ -6938,31 +6900,8 @@ function preprocessState(data, container) {
6938
6900
  parent && (parent[typeIndex] = 1, parent[valueIndex] = index / 2), data[index] = objectType,
6939
6901
  data[index + 1] = object;
6940
6902
  };
6941
- const toPreload = isServer ? void 0 : [];
6942
6903
  for (let i = 0; i < data.length; i += 2) {
6943
- if (isRootDeepRef(data[i], data[i + 1])) {
6944
- processRootRef(i);
6945
- } else if (isForwardRefsMap(data[i])) {
6946
- container.$forwardRefs$ = data[i + 1];
6947
- } else if (!isServer && isPreloadQrlType(data[i])) {
6948
- const chunkIdx = Number(data[i + 1].split(" ")[0]);
6949
- toPreload.push(chunkIdx);
6950
- }
6951
- }
6952
- if (!isServer) {
6953
- for (const idx of toPreload) {
6954
- const chunkType = data[2 * idx];
6955
- let chunk;
6956
- if (0 === chunkType) {
6957
- chunk = data[2 * idx + 1];
6958
- } else {
6959
- if (1 !== chunkType) {
6960
- continue;
6961
- }
6962
- chunk = data[2 * data[2 * idx + 1] + 1];
6963
- }
6964
- p(chunk, .3);
6965
- }
6904
+ isRootDeepRef(data[i], data[i + 1]) ? processRootRef(i) : isForwardRefsMap(data[i]) && (container.$forwardRefs$ = data[i + 1]);
6966
6905
  }
6967
6906
  }
6968
6907
 
@@ -6974,7 +6913,7 @@ async function _serialize(data) {
6974
6913
  return await serializationContext.$serialize$(), serializationContext.$writer$.toString();
6975
6914
  }
6976
6915
 
6977
- function _deserialize(rawStateData, element) {
6916
+ function _deserialize(rawStateData) {
6978
6917
  if (null == rawStateData) {
6979
6918
  return [];
6980
6919
  }
@@ -6982,8 +6921,7 @@ function _deserialize(rawStateData, element) {
6982
6921
  if (!Array.isArray(stateData)) {
6983
6922
  return [];
6984
6923
  }
6985
- let container;
6986
- container = isNode(element) && isElement$1(element) ? _createDeserializeContainer(stateData, element) : _createDeserializeContainer(stateData);
6924
+ const container = _createDeserializeContainer(stateData);
6987
6925
  const output = [];
6988
6926
  for (let i = 0; i < stateData.length; i += 2) {
6989
6927
  output[i / 2] = deserializeData(container, stateData[i], stateData[i + 1]);
@@ -6992,11 +6930,11 @@ function _deserialize(rawStateData, element) {
6992
6930
  }
6993
6931
 
6994
6932
  function getObjectById(id, stateData) {
6995
- return "string" == typeof id && (id = parseInt(id, 10)), isDev && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`),
6996
- stateData[id];
6933
+ return "string" == typeof id ? stateData[id = parseInt(id, 10)] : (isDev && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`),
6934
+ stateData[id]);
6997
6935
  }
6998
6936
 
6999
- function _createDeserializeContainer(stateData, element) {
6937
+ function _createDeserializeContainer(stateData) {
7000
6938
  let state;
7001
6939
  const container = {
7002
6940
  $getObjectById$: id => getObjectById(id, state),
@@ -7006,12 +6944,12 @@ function _createDeserializeContainer(stateData, element) {
7006
6944
  $forwardRefs$: null
7007
6945
  };
7008
6946
  return preprocessState(stateData, container), state = wrapDeserializerProxy(container, stateData),
7009
- container.$state$ = state, element && (container.element = element), container;
6947
+ container.$state$ = state, container;
7010
6948
  }
7011
6949
 
7012
6950
  const verifySerializable = (value, preMessage) => {
7013
6951
  const seen = new WeakSet;
7014
- return untrack(() => _verifySerializable(value, seen, "_", preMessage));
6952
+ return untrack(_verifySerializable, value, seen, "_", preMessage);
7015
6953
  };
7016
6954
 
7017
6955
  const _verifySerializable = (value, seen, ctx, preMessage) => {
@@ -7082,101 +7020,119 @@ const NoSerializeSymbol = Symbol("noSerialize");
7082
7020
 
7083
7021
  const SerializerSymbol = Symbol("serialize");
7084
7022
 
7085
- const resolvedSymbol = Symbol("resolved");
7023
+ let _captures = null;
7086
7024
 
7087
- const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
7088
- let _containerEl;
7089
- const qrl = async function(...args) {
7090
- const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
7091
- return await boundedFn(...args);
7092
- };
7093
- const setContainer = el => (_containerEl || (_containerEl = el), _containerEl);
7094
- function bindFnToContext(currentCtx, beforeFn) {
7095
- const bound = (...args) => {
7096
- if (!qrl.resolved) {
7097
- return qrl.resolve().then(fn => {
7098
- if (!isFunction(fn)) {
7099
- throw qError(5);
7100
- }
7101
- return bound(...args);
7102
- });
7103
- }
7104
- if (beforeFn && !1 === beforeFn()) {
7105
- return;
7106
- }
7107
- const context = createOrReuseInvocationContext(currentCtx);
7108
- const prevQrl = context.$qrl$;
7109
- const prevEvent = context.$event$;
7110
- context.$qrl$ = qrl, context.$event$ ||= this;
7111
- try {
7112
- return invoke.call(this, context, symbolRef, ...args);
7113
- } finally {
7114
- context.$qrl$ = prevQrl, context.$event$ = prevEvent;
7115
- }
7116
- };
7117
- return bound;
7025
+ const setCaptures = captures => {
7026
+ _captures = captures;
7027
+ };
7028
+
7029
+ const deserializeCaptures = (container, captures) => {
7030
+ const refs = [];
7031
+ for (const id of captures.split(" ")) {
7032
+ refs.push(container.$getObjectById$(id));
7118
7033
  }
7119
- const wrapFn = fn => "function" != typeof fn || !capture?.length && !captureRef?.length ? fn : function(...args) {
7120
- let context = tryGetInvokeContext();
7121
- if (context) {
7122
- if (context.$qrl$?.$symbol$ === qrl.$symbol$) {
7123
- return fn.apply(this, args);
7124
- }
7125
- const prevQrl = context.$qrl$;
7126
- context.$qrl$ = qrl;
7127
- try {
7128
- return fn.apply(this, args);
7129
- } finally {
7130
- context.$qrl$ = prevQrl;
7131
- }
7034
+ return refs;
7035
+ };
7036
+
7037
+ const ensureQrlCaptures = qrl => {
7038
+ if (_captures = qrl.$captures$, "string" == typeof _captures) {
7039
+ if (!qrl.$container$) {
7040
+ throw qError(13);
7132
7041
  }
7133
- return context = newInvokeContext(), context.$qrl$ = qrl, context.$event$ = this,
7134
- invoke.call(this, context, fn, ...args);
7135
- };
7136
- symbolFn && resolvedSymbol in symbolFn && (symbolRef = symbolFn[resolvedSymbol]);
7137
- const resolve = symbolRef ? async () => symbolRef : async containerEl => {
7138
- if (null !== symbolRef) {
7042
+ const prevLoading = loading;
7043
+ if (_captures = qrl.$captures$ = deserializeCaptures(qrl.$container$, _captures),
7044
+ loading !== prevLoading) {
7045
+ return loading;
7046
+ }
7047
+ }
7048
+ };
7049
+
7050
+ function bindFnToContext(qrl, currentCtx, beforeFn) {
7051
+ const bound = (...args) => qrl.resolved ? beforeFn && !1 === beforeFn() ? void 0 : invokeApply.call(this, currentCtx, qrl.resolved, args) : qrl.resolve().then(fn => {
7052
+ if (!isFunction(fn)) {
7053
+ throw qError(5);
7054
+ }
7055
+ return bound(...args);
7056
+ });
7057
+ return bound;
7058
+ }
7059
+
7060
+ const bindCaptures = (qrl, fn) => "function" == typeof fn && qrl.$captures$ ? function(...args) {
7061
+ return ensureQrlCaptures(qrl), fn.apply(this, args);
7062
+ } : fn;
7063
+
7064
+ const makeResolveFunction = (qrl, symbolFn) => {
7065
+ let symbolRef;
7066
+ return async container => {
7067
+ if (null != symbolRef) {
7139
7068
  return symbolRef;
7140
7069
  }
7141
- if (containerEl && setContainer(containerEl), "" === chunk) {
7142
- isDev && assertDefined(_containerEl, "Sync QRL must have container element");
7143
- const hash = _containerEl.getAttribute("q:instance");
7144
- const qFuncs = getQFuncs(_containerEl.ownerDocument, hash);
7145
- return qrl.resolved = symbolRef = qFuncs[Number(symbol)];
7070
+ if (container) {
7071
+ qrl.$container$ = container;
7072
+ } else if (!qrl.$container$) {
7073
+ const ctx = tryGetInvokeContext();
7074
+ ctx?.$container$ && (qrl.$container$ = ctx.$container$);
7075
+ }
7076
+ if ("" === qrl.$chunk$) {
7077
+ isDev && assertDefined(qrl.$container$, "Sync QRL must have container element");
7078
+ const hash = qrl.$container$.$instanceHash$;
7079
+ const doc = qrl.$container$.element?.ownerDocument || document;
7080
+ const qFuncs = getQFuncs(doc, hash);
7081
+ return qrl.resolved = symbolRef = qFuncs[Number(qrl.$symbol$)];
7146
7082
  }
7147
- isBrowser && chunk && p(chunk, 1);
7083
+ isBrowser && qrl.$chunk$ && p(qrl.$chunk$, 1);
7148
7084
  const start = now();
7149
- const ctx = tryGetInvokeContext();
7150
- if (null !== symbolFn) {
7151
- symbolRef = symbolFn().then(module => {
7152
- const resolved = wrapFn(symbolRef = module[symbol]);
7153
- return symbolFn[resolvedSymbol] = resolved, qrl.resolved = resolved, resolved;
7085
+ const symbol = qrl.$symbol$;
7086
+ const importP = symbolFn ? symbolFn().then(module => module[symbol]) : getPlatform().importSymbol(qrl.$container$?.element, qrl.$chunk$, symbol);
7087
+ if (symbolRef = maybeThen(importP, resolved => (symbolFn && (symbolFn[symbol] = resolved),
7088
+ symbolRef = qrl.resolved = bindCaptures(qrl, resolved))), isPromise(symbolRef)) {
7089
+ const ctx = tryGetInvokeContext();
7090
+ symbolRef.then(() => emitUsedSymbol(symbol, ctx?.$hostElement$ instanceof ElementVNode ? ctx?.$hostElement$.node : void 0, start), err => {
7091
+ console.error(`qrl ${symbol} failed to load`, err), symbolRef = null;
7154
7092
  });
7155
- } else {
7156
- const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
7157
- symbolRef = maybeThen(imported, ref => qrl.resolved = wrapFn(symbolRef = ref));
7158
7093
  }
7159
- return isPromise(symbolRef) && symbolRef.then(() => emitUsedSymbol(symbol, ctx?.$hostElement$ instanceof ElementVNode ? ctx?.$hostElement$.node : void 0, start), err => {
7160
- console.error(`qrl ${symbol} failed to load`, err), symbolRef = null;
7161
- }), symbolRef;
7094
+ return qrl.$container$ && await ensureQrlCaptures(qrl), symbolRef;
7162
7095
  };
7163
- const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
7096
+ };
7097
+
7098
+ function getSymbol() {
7099
+ return this.$symbol$;
7100
+ }
7101
+
7102
+ function getHash() {
7103
+ return this.$hash$;
7104
+ }
7105
+
7106
+ function getCaptured() {
7107
+ return ensureQrlCaptures(this), this.$captures$;
7108
+ }
7109
+
7110
+ const createQRL = (chunk, symbol, symbolRef, symbolFn, captures) => {
7111
+ const qrl = async function(...args) {
7112
+ if (qrl.resolved) {
7113
+ return qrl.resolved.apply(this, args);
7114
+ }
7115
+ const ctx = tryGetInvokeContext();
7116
+ return await qrl.resolve(ctx?.$container$), invokeApply.call(this, ctx, qrl.resolved, args);
7117
+ };
7118
+ symbolFn && symbol in symbolFn && (symbolRef = symbolFn[symbol]);
7119
+ const resolve = null != symbolRef ? async () => symbolRef : makeResolveFunction(qrl, symbolFn);
7164
7120
  const hash = getSymbolHash(symbol);
7165
7121
  return Object.assign(qrl, {
7166
- getSymbol: () => symbol,
7167
- getHash: () => hash,
7168
- getCaptured: () => qrl.$captureRef$,
7122
+ getSymbol,
7123
+ getHash,
7124
+ getCaptured,
7125
+ getFn: function(currentCtx, beforeFn) {
7126
+ return bindFnToContext.call(this, qrl, currentCtx, beforeFn);
7127
+ },
7169
7128
  resolve,
7170
- $setContainer$: setContainer,
7129
+ resolved: void 0,
7171
7130
  $chunk$: chunk,
7172
7131
  $symbol$: symbol,
7173
7132
  $hash$: hash,
7174
- getFn: bindFnToContext,
7175
- $capture$: capture,
7176
- $captureRef$: captureRef,
7177
- dev: null,
7178
- resolved: void 0
7179
- }), symbolRef && (symbolRef = maybeThen(symbolRef, resolved => qrl.resolved = wrapFn(symbolRef = resolved))),
7133
+ $captures$: captures,
7134
+ $container$: null
7135
+ }), null != symbolRef && (symbolRef = maybeThen(ensureQrlCaptures(qrl), () => maybeThen(symbolRef, resolved => symbolRef = qrl.resolved = bindCaptures(qrl, resolved)))),
7180
7136
  isBrowser && symbol && p(symbol, .8), qrl;
7181
7137
  };
7182
7138
 
@@ -7201,17 +7157,17 @@ const now = () => isServerPlatform() ? 0 : "object" == typeof performance ? perf
7201
7157
 
7202
7158
  let runtimeSymbolId = 0;
7203
7159
 
7204
- const $ = expression => createQRL(null, "s" + runtimeSymbolId++, expression, null, null, null);
7160
+ const $ = expression => createQRL(null, "s" + runtimeSymbolId++, expression, null, null);
7205
7161
 
7206
7162
  const dollar = $;
7207
7163
 
7208
7164
  const eventQrl = qrl => qrl;
7209
7165
 
7210
- const sync$ = fn => createQRL("", "<sync>", fn, null, null, null);
7166
+ const sync$ = fn => createQRL("", "<sync>", fn, null, null);
7211
7167
 
7212
7168
  const _qrlSync = function(fn, serializedFn) {
7213
7169
  return void 0 === serializedFn && (serializedFn = fn.toString()), fn.serialized = serializedFn,
7214
- createQRL("", "<sync>", fn, null, null, null);
7170
+ createQRL("", "<sync>", fn, null, null);
7215
7171
  };
7216
7172
 
7217
7173
  const componentQrl = componentQrl => {
@@ -7516,15 +7472,15 @@ const _useStyles = (styleQrl, transform, scoped) => {
7516
7472
  };
7517
7473
 
7518
7474
  const useOn = (event, eventQrl) => {
7519
- _useOn("on:", event, eventQrl);
7475
+ _useOn("q-e:", event, eventQrl);
7520
7476
  };
7521
7477
 
7522
7478
  const useOnDocument = (event, eventQrl) => {
7523
- _useOn("on-document:", event, eventQrl);
7479
+ _useOn("q-d:", event, eventQrl);
7524
7480
  };
7525
7481
 
7526
7482
  const useOnWindow = (event, eventQrl) => {
7527
- _useOn("on-window:", event, eventQrl);
7483
+ _useOn("q-w:", event, eventQrl);
7528
7484
  };
7529
7485
 
7530
7486
  const _useOn = (prefix, eventName, eventQrl) => {
@@ -7561,31 +7517,27 @@ const useOnEventsSequentialScope = () => {
7561
7517
  };
7562
7518
  };
7563
7519
 
7564
- const useSignal = initialState => useConstant(() => {
7520
+ const getSignal = initialState => {
7565
7521
  const value = isFunction(initialState) && !isQwikComponent(initialState) ? invoke(void 0, initialState) : initialState;
7566
7522
  return createSignal(value);
7567
- });
7568
-
7569
- const useConstant = value => {
7570
- const {val, set} = useSequentialScope();
7571
- return null != val ? val : set(value = isFunction(value) && !isQwikComponent(value) ? value() : value);
7572
7523
  };
7573
7524
 
7574
- const useComputedCommon = (qrl, createFn, options) => {
7525
+ const useSignal = initialState => useConstant(getSignal, initialState);
7526
+
7527
+ const useConstant = (value, ...args) => {
7575
7528
  const {val, set} = useSequentialScope();
7576
- if (val) {
7577
- return val;
7578
- }
7579
- assertQrl(qrl);
7580
- const signal = createFn(qrl, options);
7581
- return set(signal), throwIfQRLNotResolved(qrl), signal;
7529
+ return null != val ? val : set(value = isFunction(value) && !isQwikComponent(value) ? untrack(value, ...args) : value);
7582
7530
  };
7583
7531
 
7584
- const useComputedQrl = (qrl, options) => useComputedCommon(qrl, createComputedSignal, options);
7532
+ const creator$2 = (qrl, options) => (qrl.resolve(), createComputedSignal(qrl, options));
7533
+
7534
+ const useComputedQrl = (qrl, options) => useConstant(creator$2, qrl, options);
7585
7535
 
7586
7536
  const useComputed$ = implicit$FirstArg(useComputedQrl);
7587
7537
 
7588
- const useSerializerQrl = qrl => useComputedCommon(qrl, createSerializerSignal);
7538
+ const creator$1 = qrl => (qrl.resolve(), createSerializerSignal(qrl));
7539
+
7540
+ const useSerializerQrl = qrl => useConstant(creator$1, qrl);
7589
7541
 
7590
7542
  const useSerializer$ = implicit$FirstArg(useSerializerQrl);
7591
7543
 
@@ -7605,7 +7557,7 @@ const useRegisterTaskEvents = (task, eagerness) => {
7605
7557
  "intersection-observer" === eagerness ? useOn("qvisible", getTaskHandlerQrl(task)) : "document-ready" === eagerness ? useOnDocument("qinit", getTaskHandlerQrl(task)) : "document-idle" === eagerness && useOnDocument("qidle", getTaskHandlerQrl(task));
7606
7558
  };
7607
7559
 
7608
- const getTaskHandlerQrl = task => createQRL(null, "_task", scheduleTask, null, null, [ task ]);
7560
+ const getTaskHandlerQrl = task => createQRL(null, "_task", scheduleTask, null, [ task ]);
7609
7561
 
7610
7562
  const useResource$ = (generatorFn, opts) => useResourceQrl(dollar(generatorFn), opts);
7611
7563
 
@@ -7613,9 +7565,11 @@ const useTask$ = /*#__PURE__*/ implicit$FirstArg(useTaskQrl);
7613
7565
 
7614
7566
  const useVisibleTask$ = /*#__PURE__*/ implicit$FirstArg(useVisibleTaskQrl);
7615
7567
 
7616
- const useAsyncComputedQrl = (qrl, options) => useComputedCommon(qrl, createAsyncComputedSignal, options);
7568
+ const creator = (qrl, options) => (qrl.resolve(), createAsyncSignal(qrl, options));
7569
+
7570
+ const useAsyncQrl = (qrl, options) => useConstant(creator, qrl, options);
7617
7571
 
7618
- const useAsyncComputed$ = implicit$FirstArg(useAsyncComputedQrl);
7572
+ const useAsync$ = implicit$FirstArg(useAsyncQrl);
7619
7573
 
7620
7574
  const useErrorBoundary = () => {
7621
7575
  const error = useStore({
@@ -7663,4 +7617,4 @@ globalThis.__qwik = version, import.meta.hot && import.meta.hot.dispose(() => {
7663
7617
  globalThis.__qwik = void 0;
7664
7618
  });
7665
7619
 
7666
- export { $, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, SkipRender, Slot, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, EMPTY_ARRAY as _EMPTY_ARRAY, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, _UNINITIALIZED, _VAR_PROPS, _chk, _deserialize, _dumpState, _executeSsrChores, _fnSignal, _getConstProps, _getContextContainer, _getContextElement, _getContextEvent, getDomContainer as _getDomContainer, _getQContainerElement, _getVarProps, _hasStoreEffects, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, _regSymbol, _resolveContextWithoutSequentialScope, _restProps, _run, _serialize, scheduleTask as _task, _val, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getFirstChild as _vnode_getFirstChild, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsyncComputed$, createAsyncComputedSignal as createAsyncComputedQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, forceStoreEffects, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useAsyncComputed$, useAsyncComputedQrl, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
7620
+ export { $, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, SkipRender, Slot, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, EMPTY_ARRAY as _EMPTY_ARRAY, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, _UNINITIALIZED, _VAR_PROPS, _captures, _chk, _deserialize, _dumpState, _executeSsrChores, _fnSignal, _getConstProps, _getContextContainer, _getContextEvent, _getContextHostElement, getDomContainer as _getDomContainer, _getQContainerElement, _getVarProps, _hasStoreEffects, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, _regSymbol, _resolveContextWithoutSequentialScope, _restProps, _run, _serialize, scheduleTask as _task, _val, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getFirstChild as _vnode_getFirstChild, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsync$, createAsyncSignal as createAsyncQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, forceStoreEffects, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useAsync$, useAsyncQrl, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };