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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.21-dev+c008e88
3
+ * @qwik.dev/core/testing 2.0.0-beta.23-dev+03de42d
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
@@ -4018,16 +4018,16 @@ var require_CharacterData = __commonJS({
4018
4018
  // Return a DOMString whose value is the UTF-16 code
4019
4019
  // units from the offsetth UTF-16 code unit to the
4020
4020
  // offset+countth UTF-16 code unit in data.
4021
- substringData: { value: function substringData(offset, count2) {
4021
+ substringData: { value: function substringData(offset, count) {
4022
4022
  if (arguments.length < 2) {
4023
4023
  throw new TypeError("Not enough arguments");
4024
4024
  }
4025
4025
  offset = offset >>> 0;
4026
- count2 = count2 >>> 0;
4027
- if (offset > this.data.length || offset < 0 || count2 < 0) {
4026
+ count = count >>> 0;
4027
+ if (offset > this.data.length || offset < 0 || count < 0) {
4028
4028
  utils.IndexSizeError();
4029
4029
  }
4030
- return this.data.substring(offset, offset + count2);
4030
+ return this.data.substring(offset, offset + count);
4031
4031
  } },
4032
4032
  // void appendData(DOMString data);
4033
4033
  // The appendData(data) method must append data to the context
@@ -4063,8 +4063,8 @@ var require_CharacterData = __commonJS({
4063
4063
  //
4064
4064
  // Starting from offset UTF-16 code units remove count
4065
4065
  // UTF-16 code units from the context object's data.
4066
- deleteData: { value: function deleteData(offset, count2) {
4067
- return this.replaceData(offset, count2, "");
4066
+ deleteData: { value: function deleteData(offset, count) {
4067
+ return this.replaceData(offset, count, "");
4068
4068
  } },
4069
4069
  // void replaceData(unsigned long offset, unsigned long count,
4070
4070
  // DOMString data);
@@ -4074,15 +4074,15 @@ var require_CharacterData = __commonJS({
4074
4074
  // count as arguments followed by the insertData() method
4075
4075
  // with offset and data as arguments and re-throw any
4076
4076
  // exceptions these methods might have thrown.
4077
- replaceData: { value: function replaceData(offset, count2, data) {
4077
+ replaceData: { value: function replaceData(offset, count, data) {
4078
4078
  var curtext = this.data, len = curtext.length;
4079
4079
  offset = offset >>> 0;
4080
- count2 = count2 >>> 0;
4080
+ count = count >>> 0;
4081
4081
  data = String(data);
4082
4082
  if (offset > len || offset < 0) utils.IndexSizeError();
4083
- if (offset + count2 > len)
4084
- count2 = len - offset;
4085
- var prefix = curtext.substring(0, offset), suffix = curtext.substring(offset + count2);
4083
+ if (offset + count > len)
4084
+ count = len - offset;
4085
+ var prefix = curtext.substring(0, offset), suffix = curtext.substring(offset + count);
4086
4086
  this.data = prefix + data + suffix;
4087
4087
  } },
4088
4088
  // Utility method that Node.isEqualNode() calls to test Text and
@@ -5195,11 +5195,11 @@ var require_cssparser = __commonJS({
5195
5195
  * @return {String} The next character or null if there is no next character.
5196
5196
  * @method peek
5197
5197
  */
5198
- peek: function(count2) {
5198
+ peek: function(count) {
5199
5199
  var c = null;
5200
- count2 = typeof count2 === "undefined" ? 1 : count2;
5200
+ count = typeof count === "undefined" ? 1 : count;
5201
5201
  if (this._cursor < this._input.length) {
5202
- c = this._input.charAt(this._cursor + count2 - 1);
5202
+ c = this._input.charAt(this._cursor + count - 1);
5203
5203
  }
5204
5204
  return c;
5205
5205
  },
@@ -5318,9 +5318,9 @@ var require_cssparser = __commonJS({
5318
5318
  * @return {String} The string made up the read characters.
5319
5319
  * @method readCount
5320
5320
  */
5321
- readCount: function(count2) {
5321
+ readCount: function(count) {
5322
5322
  var buffer = "";
5323
- while (count2--) {
5323
+ while (count--) {
5324
5324
  buffer += this.read();
5325
5325
  }
5326
5326
  return buffer;
@@ -5868,7 +5868,7 @@ var require_cssparser = __commonJS({
5868
5868
  // Grammar
5869
5869
  //-----------------------------------------------------------------
5870
5870
  _stylesheet: function() {
5871
- var tokenStream = this._tokenStream, count2, token, tt;
5871
+ var tokenStream = this._tokenStream, count, token, tt;
5872
5872
  this.fire("startstylesheet");
5873
5873
  this._charset();
5874
5874
  this._skipCruft();
@@ -5918,13 +5918,13 @@ var require_cssparser = __commonJS({
5918
5918
  line: tokenStream.LT(0).startLine,
5919
5919
  col: tokenStream.LT(0).startCol
5920
5920
  });
5921
- count2 = 0;
5921
+ count = 0;
5922
5922
  while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) {
5923
- count2++;
5923
+ count++;
5924
5924
  }
5925
- while (count2) {
5925
+ while (count) {
5926
5926
  tokenStream.advance([Tokens.RBRACE]);
5927
- count2--;
5927
+ count--;
5928
5928
  }
5929
5929
  } else {
5930
5930
  throw new SyntaxError2("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);
@@ -7310,17 +7310,17 @@ var require_cssparser = __commonJS({
7310
7310
  "border-image-outset": { multi: "<length> | <number>", max: 4 },
7311
7311
  "border-image-repeat": { multi: "stretch | repeat | round", max: 2 },
7312
7312
  "border-image-slice": function(expression) {
7313
- var valid = false, numeric = "<number> | <percentage>", fill = false, count2 = 0, max = 4, part;
7313
+ var valid = false, numeric = "<number> | <percentage>", fill = false, count = 0, max = 4, part;
7314
7314
  if (ValidationTypes.isAny(expression, "fill")) {
7315
7315
  fill = true;
7316
7316
  valid = true;
7317
7317
  }
7318
- while (expression.hasNext() && count2 < max) {
7318
+ while (expression.hasNext() && count < max) {
7319
7319
  valid = ValidationTypes.isAny(expression, numeric);
7320
7320
  if (!valid) {
7321
7321
  break;
7322
7322
  }
7323
- count2++;
7323
+ count++;
7324
7324
  }
7325
7325
  if (!fill) {
7326
7326
  ValidationTypes.isAny(expression, "fill");
@@ -7343,19 +7343,19 @@ var require_cssparser = __commonJS({
7343
7343
  "border-left-style": "<border-style>",
7344
7344
  "border-left-width": "<border-width>",
7345
7345
  "border-radius": function(expression) {
7346
- var valid = false, simple = "<length> | <percentage> | inherit", slash = false, count2 = 0, max = 8, part;
7347
- while (expression.hasNext() && count2 < max) {
7346
+ var valid = false, simple = "<length> | <percentage> | inherit", slash = false, count = 0, max = 8, part;
7347
+ while (expression.hasNext() && count < max) {
7348
7348
  valid = ValidationTypes.isAny(expression, simple);
7349
7349
  if (!valid) {
7350
- if (String(expression.peek()) === "/" && count2 > 0 && !slash) {
7350
+ if (String(expression.peek()) === "/" && count > 0 && !slash) {
7351
7351
  slash = true;
7352
- max = count2 + 5;
7352
+ max = count + 5;
7353
7353
  expression.next();
7354
7354
  } else {
7355
7355
  break;
7356
7356
  }
7357
7357
  }
7358
- count2++;
7358
+ count++;
7359
7359
  }
7360
7360
  if (expression.hasNext()) {
7361
7361
  part = expression.next();
@@ -7737,8 +7737,8 @@ var require_cssparser = __commonJS({
7737
7737
  PropertyValueIterator.prototype.mark = function() {
7738
7738
  this._marks.push(this._i);
7739
7739
  };
7740
- PropertyValueIterator.prototype.peek = function(count2) {
7741
- return this.hasNext() ? this._parts[this._i + (count2 || 0)] : null;
7740
+ PropertyValueIterator.prototype.peek = function(count) {
7741
+ return this.hasNext() ? this._parts[this._i + (count || 0)] : null;
7742
7742
  };
7743
7743
  PropertyValueIterator.prototype.next = function() {
7744
7744
  return this.hasNext() ? this._parts[this._i++] : null;
@@ -8949,13 +8949,13 @@ var require_cssparser = __commonJS({
8949
8949
  }
8950
8950
  },
8951
8951
  singleProperty: function(types, expression, max, partial) {
8952
- var result2 = false, value = expression.value, count2 = 0, part;
8953
- while (expression.hasNext() && count2 < max) {
8952
+ var result2 = false, value = expression.value, count = 0, part;
8953
+ while (expression.hasNext() && count < max) {
8954
8954
  result2 = ValidationTypes.isAny(expression, types);
8955
8955
  if (!result2) {
8956
8956
  break;
8957
8957
  }
8958
- count2++;
8958
+ count++;
8959
8959
  }
8960
8960
  if (!result2) {
8961
8961
  if (expression.hasNext() && !expression.isFirst()) {
@@ -8970,10 +8970,10 @@ var require_cssparser = __commonJS({
8970
8970
  }
8971
8971
  },
8972
8972
  multiProperty: function(types, expression, comma, max) {
8973
- var result2 = false, value = expression.value, count2 = 0, part;
8974
- while (expression.hasNext() && !result2 && count2 < max) {
8973
+ var result2 = false, value = expression.value, count = 0, part;
8974
+ while (expression.hasNext() && !result2 && count < max) {
8975
8975
  if (ValidationTypes.isAny(expression, types)) {
8976
- count2++;
8976
+ count++;
8977
8977
  if (!expression.hasNext()) {
8978
8978
  result2 = true;
8979
8979
  } else if (comma) {
@@ -9208,11 +9208,11 @@ var require_cssparser = __commonJS({
9208
9208
  complex: {
9209
9209
  __proto__: null,
9210
9210
  "<bg-position>": function(expression) {
9211
- var result2 = false, numeric = "<percentage> | <length>", xDir = "left | right", yDir = "top | bottom", count2 = 0;
9212
- while (expression.peek(count2) && expression.peek(count2).text !== ",") {
9213
- count2++;
9211
+ var result2 = false, numeric = "<percentage> | <length>", xDir = "left | right", yDir = "top | bottom", count = 0;
9212
+ while (expression.peek(count) && expression.peek(count).text !== ",") {
9213
+ count++;
9214
9214
  }
9215
- if (count2 < 3) {
9215
+ if (count < 3) {
9216
9216
  if (ValidationTypes.isAny(expression, xDir + " | center | " + numeric)) {
9217
9217
  result2 = true;
9218
9218
  ValidationTypes.isAny(expression, yDir + " | center | " + numeric);
@@ -9280,7 +9280,7 @@ var require_cssparser = __commonJS({
9280
9280
  return result2;
9281
9281
  },
9282
9282
  "<shadow>": function(expression) {
9283
- var result2 = false, count2 = 0, inset = false, color = false;
9283
+ var result2 = false, count = 0, inset = false, color = false;
9284
9284
  if (expression.hasNext()) {
9285
9285
  if (ValidationTypes.isAny(expression, "inset")) {
9286
9286
  inset = true;
@@ -9288,8 +9288,8 @@ var require_cssparser = __commonJS({
9288
9288
  if (ValidationTypes.isAny(expression, "<color>")) {
9289
9289
  color = true;
9290
9290
  }
9291
- while (ValidationTypes.isAny(expression, "<length>") && count2 < 4) {
9292
- count2++;
9291
+ while (ValidationTypes.isAny(expression, "<length>") && count < 4) {
9292
+ count++;
9293
9293
  }
9294
9294
  if (expression.hasNext()) {
9295
9295
  if (!color) {
@@ -9299,7 +9299,7 @@ var require_cssparser = __commonJS({
9299
9299
  ValidationTypes.isAny(expression, "inset");
9300
9300
  }
9301
9301
  }
9302
- result2 = count2 >= 2 && count2 <= 4;
9302
+ result2 = count >= 2 && count <= 4;
9303
9303
  }
9304
9304
  return result2;
9305
9305
  },
@@ -15806,12 +15806,12 @@ var require_HTMLParser = __commonJS({
15806
15806
  this.attrs.push(this.MARKER);
15807
15807
  };
15808
15808
  HTMLParser.ActiveFormattingElements.prototype.push = function(elt, attrs) {
15809
- var count2 = 0;
15809
+ var count = 0;
15810
15810
  for (var i = this.list.length - 1; i >= 0; i--) {
15811
15811
  if (this.list[i] === this.MARKER) break;
15812
15812
  if (equal(elt, this.list[i], this.attrs[i])) {
15813
- count2++;
15814
- if (count2 === 3) {
15813
+ count++;
15814
+ if (count === 3) {
15815
15815
  this.list.splice(i, 1);
15816
15816
  this.attrs.splice(i, 1);
15817
15817
  break;
@@ -21517,17 +21517,17 @@ var require_main = __commonJS({
21517
21517
  case 4:
21518
21518
  return bb.read();
21519
21519
  case 5: {
21520
- let count2 = bb.read32();
21520
+ let count = bb.read32();
21521
21521
  let value2 = [];
21522
- for (let i = 0; i < count2; i++) {
21522
+ for (let i = 0; i < count; i++) {
21523
21523
  value2.push(visit());
21524
21524
  }
21525
21525
  return value2;
21526
21526
  }
21527
21527
  case 6: {
21528
- let count2 = bb.read32();
21528
+ let count = bb.read32();
21529
21529
  let value2 = {};
21530
- for (let i = 0; i < count2; i++) {
21530
+ for (let i = 0; i < count; i++) {
21531
21531
  value2[decodeUTF8(bb.read())] = visit();
21532
21532
  }
21533
21533
  return value2;
@@ -22401,13 +22401,13 @@ is not a problem with esbuild. You need to fix your environment instead.
22401
22401
  watch: (options2 = {}) => new Promise((resolve, reject) => {
22402
22402
  if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`);
22403
22403
  const keys = {};
22404
- const delay2 = getFlag(options2, keys, "delay", mustBeInteger);
22404
+ const delay = getFlag(options2, keys, "delay", mustBeInteger);
22405
22405
  checkForInvalidFlags(options2, keys, `in watch() call`);
22406
22406
  const request2 = {
22407
22407
  command: "watch",
22408
22408
  key: buildKey
22409
22409
  };
22410
- if (delay2) request2.delay = delay2;
22410
+ if (delay) request2.delay = delay;
22411
22411
  sendRequest(refs, request2, (error2) => {
22412
22412
  if (error2) reject(new Error(error2));
22413
22413
  else resolve(void 0);
@@ -23645,7 +23645,7 @@ import { _isJSXNode, _isStringifiable } from "@qwik.dev/core/internal";
23645
23645
  import { expect } from "vitest";
23646
23646
 
23647
23647
  // packages/qwik/src/core/client/vnode-utils.ts
23648
- import { isDev as isDev24 } from "@qwik.dev/core/build";
23648
+ import { isDev as isDev23 } from "@qwik.dev/core/build";
23649
23649
 
23650
23650
  // packages/qwik/src/core/shared/utils/qdev.ts
23651
23651
  var qDev = globalThis.qDev !== false;
@@ -23966,7 +23966,6 @@ var SVG_NS = "http://www.w3.org/2000/svg";
23966
23966
  var MATH_NS = "http://www.w3.org/1998/Math/MathML";
23967
23967
  var XLINK_NS = "http://www.w3.org/1999/xlink";
23968
23968
  var XML_NS = "http://www.w3.org/XML/1998/namespace";
23969
- var ResourceEvent = "qResource";
23970
23969
  var RenderEvent = "qRender";
23971
23970
  var TaskEvent = "qTask";
23972
23971
  var QDefaultSlot = "";
@@ -24076,11 +24075,6 @@ var safeCall = (call, thenFn, rejectFn) => {
24076
24075
  var maybeThen = (valueOrPromise, thenFn) => {
24077
24076
  return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
24078
24077
  };
24079
- var delay = (timeout) => {
24080
- return new Promise((resolve) => {
24081
- setTimeout(resolve, timeout);
24082
- });
24083
- };
24084
24078
  var checkError = (e) => {
24085
24079
  if (isServer2 && e instanceof ReferenceError && e.message.includes("window")) {
24086
24080
  e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message;
@@ -24132,10 +24126,10 @@ function retryOnPromise(fn, onError = justThrow) {
24132
24126
  }
24133
24127
 
24134
24128
  // packages/qwik/src/core/use/use-core.ts
24135
- import { isDev as isDev20 } from "@qwik.dev/core/build";
24129
+ import { isDev as isDev19 } from "@qwik.dev/core/build";
24136
24130
 
24137
24131
  // packages/qwik/src/core/client/dom-container.ts
24138
- import { isDev as isDev19 } from "@qwik.dev/core/build";
24132
+ import { isDev as isDev18 } from "@qwik.dev/core/build";
24139
24133
 
24140
24134
  // packages/qwik/src/core/use/use-sequential-scope.ts
24141
24135
  var useSequentialScope = () => {
@@ -24289,7 +24283,7 @@ Object.freeze(EMPTY_ARRAY);
24289
24283
  Object.freeze(EMPTY_OBJ);
24290
24284
 
24291
24285
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
24292
- import { isBrowser, isDev as isDev18 } from "@qwik.dev/core/build";
24286
+ import { isBrowser as isBrowser2, isDev as isDev17 } from "@qwik.dev/core/build";
24293
24287
  import { p as preload } from "@qwik.dev/core/preloader";
24294
24288
 
24295
24289
  // packages/qwik/src/core/reactive-primitives/backref.ts
@@ -24347,6 +24341,74 @@ var ElementVNode = class extends VirtualVNode {
24347
24341
  }
24348
24342
  };
24349
24343
 
24344
+ // packages/qwik/src/core/shared/serdes/qrl-to-string.ts
24345
+ import { isDev as isDev5 } from "@qwik.dev/core/build";
24346
+ function qrlToString(serializationContext, qrl, raw) {
24347
+ let symbol = qrl.$symbol$;
24348
+ let chunk = qrl.$chunk$;
24349
+ const platform = getPlatform();
24350
+ if (platform) {
24351
+ const result2 = isDev5 ? platform.chunkForSymbol(symbol, chunk, qrl.dev?.file) : platform.chunkForSymbol(symbol, chunk);
24352
+ if (result2) {
24353
+ chunk = result2[1];
24354
+ symbol = result2[0];
24355
+ }
24356
+ }
24357
+ const isSync = isSyncQrl(qrl);
24358
+ if (!isSync) {
24359
+ if (!chunk) {
24360
+ chunk = serializationContext.$symbolToChunkResolver$(qrl.$hash$);
24361
+ }
24362
+ if (isDev5) {
24363
+ const backChannel = globalThis.__qrl_back_channel__ || (globalThis.__qrl_back_channel__ = /* @__PURE__ */ new Map());
24364
+ backChannel.set(qrl.$symbol$, qrl.$symbolRef$);
24365
+ if (!chunk) {
24366
+ chunk = QRL_RUNTIME_CHUNK;
24367
+ }
24368
+ }
24369
+ if (!chunk) {
24370
+ throw qError(14 /* qrlMissingChunk */, [qrl.$symbol$]);
24371
+ }
24372
+ if (chunk.startsWith("./")) {
24373
+ chunk = chunk.slice(2);
24374
+ }
24375
+ } else {
24376
+ const fn = qrl.resolved;
24377
+ chunk = "";
24378
+ symbol = String(serializationContext.$addSyncFn$(null, 0, fn));
24379
+ }
24380
+ const captures = qrl.getCaptured();
24381
+ let captureIds = null;
24382
+ if (captures && captures.length > 0) {
24383
+ captureIds = captures.map((ref) => `${serializationContext.$addRoot$(ref)}`).join(" ");
24384
+ }
24385
+ if (raw) {
24386
+ return [chunk, symbol, captureIds];
24387
+ }
24388
+ let qrlStringInline = `${chunk}#${symbol}`;
24389
+ if (captureIds) {
24390
+ qrlStringInline += `#${captureIds}`;
24391
+ }
24392
+ return qrlStringInline;
24393
+ }
24394
+ function createQRLWithBackChannel(chunk, symbol, captures) {
24395
+ let qrlImporter = null;
24396
+ if (isDev5 && chunk === QRL_RUNTIME_CHUNK) {
24397
+ const backChannel = globalThis.__qrl_back_channel__;
24398
+ isDev5 && assertDefined(backChannel, "Missing QRL_RUNTIME_CHUNK");
24399
+ const fn = backChannel.get(symbol);
24400
+ if (fn) {
24401
+ qrlImporter = () => Promise.resolve({ [symbol]: fn });
24402
+ }
24403
+ }
24404
+ return createQRL(chunk, symbol, null, qrlImporter, captures);
24405
+ }
24406
+ function parseQRL(qrl) {
24407
+ const [chunk, symbol, captures] = qrl.split("#");
24408
+ return createQRLWithBackChannel(chunk, symbol, captures || null);
24409
+ }
24410
+ var QRL_RUNTIME_CHUNK = "mock-chunk";
24411
+
24350
24412
  // packages/qwik/src/core/client/run-qrl.ts
24351
24413
  function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromDOM(event, element)) {
24352
24414
  const container = ctx.$container$;
@@ -24381,9 +24443,9 @@ function runEventHandlerQRL(handler, event, element, ctx = newInvokeContextFromD
24381
24443
  }
24382
24444
 
24383
24445
  // packages/qwik/src/core/client/util-mapArray.ts
24384
- import { isDev as isDev5 } from "@qwik.dev/core/build";
24446
+ import { isDev as isDev6 } from "@qwik.dev/core/build";
24385
24447
  var mapApp_findIndx = (array, key, start) => {
24386
- isDev5 && assertTrue(start % 2 === 0, "Expecting even number.");
24448
+ isDev6 && assertTrue(start % 2 === 0, "Expecting even number.");
24387
24449
  let bottom = start >> 1;
24388
24450
  let top = array.length - 2 >> 1;
24389
24451
  while (bottom <= top) {
@@ -24434,11 +24496,8 @@ var mapArray_has = (array, key, start) => {
24434
24496
  return mapApp_findIndx(array, key, start) >= 0;
24435
24497
  };
24436
24498
 
24437
- // packages/qwik/src/core/use/use-resource.ts
24438
- import { isDev as isDev15 } from "@qwik.dev/core/build";
24439
-
24440
24499
  // packages/qwik/src/core/reactive-primitives/impl/signal-impl.ts
24441
- import { isDev as isDev6, isServer as isServer3 } from "@qwik.dev/core/build";
24500
+ import { isDev as isDev7, isServer as isServer3 } from "@qwik.dev/core/build";
24442
24501
  var DEBUG = false;
24443
24502
  var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
24444
24503
  var SignalImpl = class {
@@ -24448,7 +24507,7 @@ var SignalImpl = class {
24448
24507
  __publicField(this, "$effects$");
24449
24508
  __publicField(this, "$container$", null);
24450
24509
  __publicField(this, "$wrappedSignal$", null);
24451
- this.$container$ = container;
24510
+ this.$container$ = container || tryGetInvokeContext()?.$container$ || null;
24452
24511
  this.$untrackedValue$ = value;
24453
24512
  DEBUG && log("new", this);
24454
24513
  }
@@ -24467,17 +24526,16 @@ var SignalImpl = class {
24467
24526
  this.$untrackedValue$ = value;
24468
24527
  }
24469
24528
  get value() {
24529
+ const val = this.untrackedValue;
24470
24530
  const ctx = tryGetInvokeContext();
24471
24531
  if (!ctx) {
24472
- return this.untrackedValue;
24532
+ DEBUG && log("read->no-ctx", pad("\n" + this.toString(), " "));
24533
+ return val;
24473
24534
  }
24474
24535
  if (this.$container$ === null) {
24475
- if (!ctx.$container$) {
24476
- return this.untrackedValue;
24477
- }
24478
24536
  this.$container$ = ctx.$container$;
24479
24537
  } else {
24480
- isDev6 && assertTrue(
24538
+ isDev7 && assertTrue(
24481
24539
  !ctx.$container$ || ctx.$container$ === this.$container$,
24482
24540
  "Do not use signals across containers"
24483
24541
  );
@@ -24488,12 +24546,21 @@ var SignalImpl = class {
24488
24546
  ensureContainsBackRef(effectSubscriber, this);
24489
24547
  (import.meta.env.TEST ? !isDomContainer(this.$container$) : isServer3) && addQrlToSerializationCtx(effectSubscriber, this.$container$);
24490
24548
  DEBUG && log("read->sub", pad("\n" + this.toString(), " "));
24549
+ } else {
24550
+ DEBUG && log("read no sub", pad("\n" + this.toString(), " "));
24491
24551
  }
24492
- return this.untrackedValue;
24552
+ return val;
24493
24553
  }
24494
24554
  set value(value) {
24495
24555
  if (value !== this.$untrackedValue$) {
24496
- DEBUG && log("Signal.set", this.$untrackedValue$, "->", value, pad("\n" + this.toString(), " "));
24556
+ DEBUG && log(
24557
+ "Signal.set",
24558
+ this.$untrackedValue$,
24559
+ "->",
24560
+ value,
24561
+ pad("\n" + this.toString(), " "),
24562
+ this.$effects$ ? "subs: " + this.$effects$.size : "no subs"
24563
+ );
24497
24564
  this.$untrackedValue$ = value;
24498
24565
  scheduleEffects(this.$container$, this, this.$effects$);
24499
24566
  }
@@ -24505,8 +24572,12 @@ var SignalImpl = class {
24505
24572
  }
24506
24573
  }
24507
24574
  toString() {
24508
- if (isDev6) {
24509
- return `[${this.constructor.name}${this.$flags$ & 1 /* INVALID */ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e.consumer), " ")).join("\n") || "");
24575
+ if (isDev7) {
24576
+ try {
24577
+ return `[${this.constructor.name}${this.$flags$ & 1 /* INVALID */ ? " INVALID" : ""} ${this.$untrackedValue$}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e.consumer), " ")).join("\n") || "");
24578
+ } catch (e) {
24579
+ return `[${this.constructor.name} <cannot stringify>]`;
24580
+ }
24510
24581
  } else {
24511
24582
  return this.constructor.name;
24512
24583
  }
@@ -24515,34 +24586,29 @@ var SignalImpl = class {
24515
24586
  return { value: this.$untrackedValue$ };
24516
24587
  }
24517
24588
  };
24518
- var setupSignalValueAccess = (target, effectsFn, returnValueFn) => {
24589
+ var setupSignalValueAccess = (target, effectsProp, valueProp) => {
24519
24590
  const ctx = tryGetInvokeContext();
24520
- if (!ctx) {
24521
- return returnValueFn();
24522
- }
24523
- if (target.$container$ === null) {
24524
- if (!ctx.$container$) {
24525
- return returnValueFn();
24526
- }
24527
- target.$container$ = ctx.$container$;
24528
- } else {
24529
- isDev6 && assertTrue(
24591
+ if (ctx && (target.$container$ || (target.$container$ = ctx.$container$ || null))) {
24592
+ isDev7 && assertTrue(
24530
24593
  !ctx.$container$ || ctx.$container$ === target.$container$,
24531
24594
  "Do not use signals across containers"
24532
24595
  );
24596
+ const effectSubscriber = ctx.$effectSubscriber$;
24597
+ if (effectSubscriber) {
24598
+ ensureContainsSubscription(
24599
+ target[effectsProp] || (target[effectsProp] = /* @__PURE__ */ new Set()),
24600
+ effectSubscriber
24601
+ );
24602
+ ensureContainsBackRef(effectSubscriber, target);
24603
+ addQrlToSerializationCtx(effectSubscriber, target.$container$);
24604
+ DEBUG && log("read->sub", pad("\n" + target.toString(), " "));
24605
+ }
24533
24606
  }
24534
- const effectSubscriber = ctx.$effectSubscriber$;
24535
- if (effectSubscriber) {
24536
- ensureContainsSubscription(effectsFn(), effectSubscriber);
24537
- ensureContainsBackRef(effectSubscriber, target);
24538
- addQrlToSerializationCtx(effectSubscriber, target.$container$);
24539
- DEBUG && log("read->sub", pad("\n" + target.toString(), " "));
24540
- }
24541
- return returnValueFn();
24607
+ return target[valueProp];
24542
24608
  };
24543
24609
 
24544
24610
  // packages/qwik/src/core/shared/jsx/props-proxy.ts
24545
- import { isDev as isDev7 } from "@qwik.dev/core/build";
24611
+ import { isDev as isDev8 } from "@qwik.dev/core/build";
24546
24612
  function createPropsProxy(owner) {
24547
24613
  return new Proxy({}, new PropsProxyHandler(owner));
24548
24614
  }
@@ -24675,7 +24741,7 @@ var addPropsProxyEffect = (propsProxy, prop) => {
24675
24741
  propsProxy.$container$ = ctx.$container$;
24676
24742
  }
24677
24743
  } else {
24678
- isDev7 && assertTrue(
24744
+ isDev8 && assertTrue(
24679
24745
  !ctx.$container$ || ctx.$container$ === propsProxy.$container$,
24680
24746
  "Do not use props across containers"
24681
24747
  );
@@ -24703,18 +24769,8 @@ var isPropsProxy = (obj) => {
24703
24769
  return obj && _VAR_PROPS in obj;
24704
24770
  };
24705
24771
 
24706
- // packages/qwik/src/core/use/utils/destroyable.ts
24707
- var cleanupDestroyable = (destroyable) => {
24708
- const destroy = destroyable.$destroy$;
24709
- if (destroy) {
24710
- destroyable.$destroy$ = null;
24711
- try {
24712
- destroy();
24713
- } catch (err) {
24714
- logError(err);
24715
- }
24716
- }
24717
- };
24772
+ // packages/qwik/src/core/reactive-primitives/impl/async-signal-impl.ts
24773
+ import { isBrowser, isServer as isServer5 } from "@qwik.dev/core/build";
24718
24774
 
24719
24775
  // packages/qwik/src/core/reactive-primitives/subscriber.ts
24720
24776
  import { isServer as isServer4 } from "@qwik.dev/core/build";
@@ -24773,7 +24829,7 @@ var cleanupFn = (target, handleError) => {
24773
24829
  if (typeof fn == "function") {
24774
24830
  if (!cleanupFns) {
24775
24831
  cleanupFns = [];
24776
- target.$destroy$ = noSerialize(() => {
24832
+ target.$destroy$ = () => {
24777
24833
  target.$destroy$ = null;
24778
24834
  for (const fn2 of cleanupFns) {
24779
24835
  try {
@@ -24782,7 +24838,7 @@ var cleanupFn = (target, handleError) => {
24782
24838
  handleError(err);
24783
24839
  }
24784
24840
  }
24785
- });
24841
+ };
24786
24842
  }
24787
24843
  cleanupFns.push(fn);
24788
24844
  }
@@ -24791,13 +24847,13 @@ var cleanupFn = (target, handleError) => {
24791
24847
  };
24792
24848
 
24793
24849
  // packages/qwik/src/core/reactive-primitives/impl/computed-signal-impl.ts
24794
- import { isDev as isDev8 } from "@qwik.dev/core/build";
24850
+ import { isDev as isDev9 } from "@qwik.dev/core/build";
24795
24851
  var DEBUG2 = false;
24796
24852
  var log2 = (...args) => console.log("COMPUTED SIGNAL", ...args.map(qwikDebugToString));
24797
24853
  var _a3, _b;
24798
24854
  var ComputedSignalImpl = class extends (_b = SignalImpl, _a3 = _EFFECT_BACK_REF, _b) {
24799
24855
  constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */) {
24800
- super(container, NEEDS_COMPUTATION);
24856
+ super(container || fn.$container$, NEEDS_COMPUTATION);
24801
24857
  /**
24802
24858
  * The compute function is stored here.
24803
24859
  *
@@ -24814,27 +24870,20 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a3 = _EFFECT_BACK_REF,
24814
24870
  this.$flags$ |= 1 /* INVALID */;
24815
24871
  const ctx = newInvokeContext();
24816
24872
  ctx.$container$ = this.$container$ || void 0;
24817
- maybeThen(
24818
- retryOnPromise(() => invoke.call(this, ctx, this.$computeIfNeeded$)),
24819
- () => {
24820
- if (this.$flags$ & 2 /* RUN_EFFECTS */) {
24821
- this.$flags$ &= ~2 /* RUN_EFFECTS */;
24822
- scheduleEffects(this.$container$, this, this.$effects$);
24873
+ const running = retryOnPromise(invokeApply.bind(this, ctx, this.$computeIfNeeded$));
24874
+ if (running) {
24875
+ running.catch((err) => {
24876
+ if (this.$container$) {
24877
+ this.$container$.handleError(err, null);
24878
+ } else {
24879
+ console.error("Error during computation", err);
24823
24880
  }
24824
- }
24825
- );
24826
- }
24827
- /**
24828
- * Use this to force running subscribers, for example when the calculated value has mutated but
24829
- * remained the same object
24830
- */
24831
- force() {
24832
- this.$flags$ |= 2 /* RUN_EFFECTS */;
24833
- super.force();
24881
+ });
24882
+ }
24834
24883
  }
24835
24884
  get untrackedValue() {
24836
24885
  this.$computeIfNeeded$();
24837
- isDev8 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
24886
+ isDev9 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
24838
24887
  return this.$untrackedValue$;
24839
24888
  }
24840
24889
  $computeIfNeeded$() {
@@ -24860,13 +24909,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a3 = _EFFECT_BACK_REF,
24860
24909
  }
24861
24910
  DEBUG2 && log2("Signal.$compute$", untrackedValue);
24862
24911
  this.$flags$ &= ~1 /* INVALID */;
24863
- const didChange = untrackedValue !== this.$untrackedValue$;
24864
- if (didChange) {
24865
- if (this.$untrackedValue$ !== NEEDS_COMPUTATION) {
24866
- this.$flags$ |= 2 /* RUN_EFFECTS */;
24867
- }
24868
- this.$untrackedValue$ = untrackedValue;
24869
- }
24912
+ super.value = untrackedValue;
24870
24913
  } finally {
24871
24914
  if (ctx) {
24872
24915
  ctx.$effectSubscriber$ = previousEffectSubscription;
@@ -24881,29 +24924,83 @@ var log3 = (...args) => (
24881
24924
  // eslint-disable-next-line no-console
24882
24925
  console.log("ASYNC COMPUTED SIGNAL", ...args.map(qwikDebugToString))
24883
24926
  );
24927
+ var AsyncJob = class {
24928
+ constructor($signal$) {
24929
+ this.$signal$ = $signal$;
24930
+ /** First holds the compute promise and then the cleanup promise */
24931
+ __publicField(this, "$promise$", null);
24932
+ __publicField(this, "$cleanupRequested$", false);
24933
+ __publicField(this, "$canWrite$", true);
24934
+ __publicField(this, "$track$");
24935
+ __publicField(this, "$cleanups$");
24936
+ __publicField(this, "$abortController$");
24937
+ }
24938
+ get track() {
24939
+ return this.$track$ || (this.$track$ = trackFn(this.$signal$, this.$signal$.$container$));
24940
+ }
24941
+ get abortSignal() {
24942
+ return (this.$abortController$ || (this.$abortController$ = new AbortController())).signal;
24943
+ }
24944
+ /** Backward compatible cache method for resource */
24945
+ cache() {
24946
+ console.error(
24947
+ "useResource cache() method does not do anything. Use `useAsync$` instead of `useResource$`, use the `interval` option for polling behavior."
24948
+ );
24949
+ }
24950
+ get previous() {
24951
+ const val = this.$signal$.$untrackedValue$;
24952
+ if (val !== NEEDS_COMPUTATION) {
24953
+ return val;
24954
+ }
24955
+ }
24956
+ cleanup(callback) {
24957
+ if (typeof callback === "function") {
24958
+ (this.$cleanups$ || (this.$cleanups$ = [])).push(callback);
24959
+ }
24960
+ }
24961
+ };
24884
24962
  var _a4, _b2;
24885
24963
  var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a4 = _EFFECT_BACK_REF, _b2) {
24886
- constructor(container, fn, flags = 1 /* INVALID */) {
24964
+ constructor(container, fn, flags = 1 /* INVALID */ | 16 /* SERIALIZATION_STRATEGY_ALWAYS */, options) {
24887
24965
  super(container, fn, flags);
24888
24966
  __publicField(this, "$untrackedLoading$", false);
24889
24967
  __publicField(this, "$untrackedError$");
24890
24968
  __publicField(this, "$loadingEffects$");
24891
24969
  __publicField(this, "$errorEffects$");
24892
- __publicField(this, "$destroy$");
24893
- __publicField(this, "$promiseValue$", NEEDS_COMPUTATION);
24894
- __publicField(this, "$promise$", null);
24970
+ __publicField(this, "$current$", null);
24971
+ // TODO only create the array if concurrency > 1
24972
+ __publicField(this, "$jobs$", []);
24973
+ __publicField(this, "$concurrency$", 1);
24974
+ __publicField(this, "$interval$", 0);
24975
+ __publicField(this, "$pollTimeoutId$");
24976
+ __publicField(this, "$timeoutMs$");
24977
+ __publicField(this, "$computationTimeoutId$");
24895
24978
  __publicField(this, _a4);
24979
+ const interval = options?.interval || 0;
24980
+ const concurrency = options?.concurrency ?? 1;
24981
+ const initial = options?.initial;
24982
+ const timeout = options?.timeout;
24983
+ const eagerCleanup = options?.eagerCleanup;
24984
+ if (initial !== void 0) {
24985
+ const initialValue = typeof initial === "function" ? initial() : initial;
24986
+ this.$untrackedValue$ = initialValue;
24987
+ }
24988
+ this.$concurrency$ = concurrency;
24989
+ this.$timeoutMs$ = timeout;
24990
+ if (eagerCleanup) {
24991
+ this.$flags$ |= 32 /* EAGER_CLEANUP */;
24992
+ }
24993
+ this.interval = interval;
24896
24994
  }
24897
24995
  /**
24898
24996
  * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
24899
24997
  * has resolved or rejected.
24998
+ *
24999
+ * Accessing .loading will trigger computation if needed, since it's often used like
25000
+ * `signal.loading ? <Loading /> : signal.value`.
24900
25001
  */
24901
25002
  get loading() {
24902
- return setupSignalValueAccess(
24903
- this,
24904
- () => this.$loadingEffects$ || (this.$loadingEffects$ = /* @__PURE__ */ new Set()),
24905
- () => this.untrackedLoading
24906
- );
25003
+ return setupSignalValueAccess(this, "$loadingEffects$", "untrackedLoading");
24907
25004
  }
24908
25005
  set untrackedLoading(value) {
24909
25006
  if (value !== this.$untrackedLoading$) {
@@ -24913,15 +25010,16 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a4 = _EFFECT_BAC
24913
25010
  }
24914
25011
  }
24915
25012
  get untrackedLoading() {
25013
+ this.$computeIfNeeded$();
25014
+ if ((import.meta.env.TEST ? isServerPlatform() : isServer5) && this.$current$?.$promise$) {
25015
+ DEBUG3 && log3("Throwing loading promise for SSR");
25016
+ throw this.$current$?.$promise$;
25017
+ }
24916
25018
  return this.$untrackedLoading$;
24917
25019
  }
24918
25020
  /** The error that occurred when the signal was resolved. */
24919
25021
  get error() {
24920
- return setupSignalValueAccess(
24921
- this,
24922
- () => this.$errorEffects$ || (this.$errorEffects$ = /* @__PURE__ */ new Set()),
24923
- () => this.untrackedError
24924
- );
25022
+ return setupSignalValueAccess(this, "$errorEffects$", "untrackedError");
24925
25023
  }
24926
25024
  set untrackedError(value) {
24927
25025
  if (value !== this.$untrackedError$) {
@@ -24932,78 +25030,206 @@ var AsyncSignalImpl = class extends (_b2 = ComputedSignalImpl, _a4 = _EFFECT_BAC
24932
25030
  get untrackedError() {
24933
25031
  return this.$untrackedError$;
24934
25032
  }
24935
- invalidate() {
24936
- this.$promise$ = null;
24937
- super.invalidate();
25033
+ get interval() {
25034
+ return this.$interval$;
24938
25035
  }
25036
+ set interval(value) {
25037
+ this.$clearNextPoll$();
25038
+ this.$interval$ = value;
25039
+ if (this.$interval$ > 0 && this.$effects$?.size) {
25040
+ this.$scheduleNextPoll$();
25041
+ }
25042
+ }
25043
+ /** Invalidates the signal, causing it to re-compute its value. */
25044
+ async invalidate() {
25045
+ this.$flags$ |= 1 /* INVALID */;
25046
+ this.$clearNextPoll$();
25047
+ if (this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size) {
25048
+ await true;
25049
+ this.$computeIfNeeded$();
25050
+ }
25051
+ }
25052
+ /** Abort the current computation and run cleanups if needed. */
25053
+ abort(reason) {
25054
+ if (this.$current$) {
25055
+ this.$requestCleanups$(this.$current$, reason);
25056
+ }
25057
+ }
25058
+ /** Schedule eager cleanup on next macro task if no subscribers remain. */
25059
+ $scheduleEagerCleanup$() {
25060
+ if (!(this.$flags$ & 32 /* EAGER_CLEANUP */) || this.$hasSubscribers$()) {
25061
+ return;
25062
+ }
25063
+ if (!(import.meta.env.TEST ? !isServerPlatform() : isBrowser)) {
25064
+ return;
25065
+ }
25066
+ setTimeout(() => {
25067
+ if (!this.$hasSubscribers$()) {
25068
+ this.abort();
25069
+ }
25070
+ });
25071
+ }
25072
+ /** Returns a promise resolves when the signal finished computing. */
24939
25073
  async promise() {
24940
- this.$promise$ = null;
24941
- await retryOnPromise(this.$computeIfNeeded$.bind(this));
24942
- return this.$untrackedValue$;
25074
+ this.$computeIfNeeded$();
25075
+ while (this.$current$?.$promise$) {
25076
+ await this.$current$?.$promise$;
25077
+ }
24943
25078
  }
25079
+ /** Run the computation if needed */
24944
25080
  $computeIfNeeded$() {
24945
25081
  if (!(this.$flags$ & 1 /* INVALID */)) {
24946
25082
  return;
24947
25083
  }
24948
- const untrackedValue = (
24949
- // first time
24950
- this.$promiseValue$ === NEEDS_COMPUTATION || // or after invalidation
24951
- this.$promise$ === null ? this.$promiseComputation$() : this.$promiseValue$
24952
- );
24953
- if (isPromise(untrackedValue)) {
24954
- const isFirstComputation = this.$promiseValue$ === NEEDS_COMPUTATION;
24955
- this.untrackedLoading = true;
24956
- this.untrackedError = void 0;
24957
- if (this.$promiseValue$ !== NEEDS_COMPUTATION) {
24958
- cleanupDestroyable(this);
24959
- }
24960
- const promise = untrackedValue.then((promiseValue) => {
24961
- DEBUG3 && log3("Promise resolved", promiseValue);
24962
- this.$promiseValue$ = promiseValue;
24963
- this.untrackedLoading = false;
25084
+ this.$clearNextPoll$();
25085
+ if (this.$current$) {
25086
+ this.$requestCleanups$(this.$current$);
25087
+ }
25088
+ const limit = this.$concurrency$ === 0 ? Number.POSITIVE_INFINITY : this.$concurrency$;
25089
+ if (this.$jobs$.length >= limit) {
25090
+ DEBUG3 && log3(`Concurrency limit ${limit} reached, not starting new computation`);
25091
+ return;
25092
+ }
25093
+ DEBUG3 && log3("Starting new async computation");
25094
+ this.$flags$ &= ~1 /* INVALID */;
25095
+ const running = new AsyncJob(this);
25096
+ this.$current$ = running;
25097
+ this.$jobs$.push(running);
25098
+ running.$promise$ = this.$runComputation$(running);
25099
+ }
25100
+ async $runComputation$(running) {
25101
+ const isCurrent = () => running === this.$current$;
25102
+ this.untrackedLoading = true;
25103
+ const fn = this.$computeQrl$.resolved || await this.$computeQrl$.resolve();
25104
+ try {
25105
+ if (this.$timeoutMs$) {
25106
+ this.$computationTimeoutId$ = setTimeout(() => {
25107
+ running.$abortController$?.abort();
25108
+ const error = new Error(`timeout`);
25109
+ if (isCurrent()) {
25110
+ this.untrackedError = error;
25111
+ running.$canWrite$ = false;
25112
+ }
25113
+ }, this.$timeoutMs$);
25114
+ }
25115
+ const value = await retryOnPromise(fn.bind(null, running));
25116
+ running.$promise$ = null;
25117
+ if (running.$canWrite$) {
25118
+ const index = this.$jobs$.indexOf(running);
25119
+ if (index !== -1) {
25120
+ for (let i = 0; i < index; i++) {
25121
+ this.$jobs$[i].$canWrite$ = false;
25122
+ }
25123
+ }
25124
+ DEBUG3 && log3("Promise resolved", value);
24964
25125
  this.untrackedError = void 0;
24965
- if (this.setValue(promiseValue)) {
24966
- DEBUG3 && log3("Scheduling effects for subscribers", this.$effects$?.size);
24967
- this.$flags$ &= ~2 /* RUN_EFFECTS */;
24968
- scheduleEffects(this.$container$, this, this.$effects$);
24969
- }
24970
- }).catch((err) => {
24971
- if (isPromise(err)) {
24972
- return;
24973
- }
24974
- DEBUG3 && log3("Error caught in promise.catch", err);
24975
- this.$promiseValue$ = err;
24976
- this.untrackedLoading = false;
25126
+ this.value = value;
25127
+ }
25128
+ } catch (err) {
25129
+ running.$promise$ = null;
25130
+ DEBUG3 && log3("Error caught in promise.catch", err);
25131
+ if (isCurrent()) {
24977
25132
  this.untrackedError = err;
24978
- });
24979
- if (isFirstComputation) {
24980
- throw promise;
25133
+ }
25134
+ }
25135
+ if (isCurrent()) {
25136
+ clearTimeout(this.$computationTimeoutId$);
25137
+ if (this.$flags$ & 1 /* INVALID */) {
25138
+ DEBUG3 && log3("Computation finished but signal is invalid, re-running");
25139
+ this.$computeIfNeeded$();
24981
25140
  } else {
24982
- DEBUG3 && log3("Returning stale value", this.$untrackedValue$, "while computing", untrackedValue);
24983
- return promise;
25141
+ this.untrackedLoading = false;
25142
+ this.$scheduleNextPoll$();
24984
25143
  }
24985
- } else {
24986
- this.setValue(untrackedValue);
24987
25144
  }
24988
25145
  }
24989
- async $promiseComputation$() {
24990
- if (!this.$promise$) {
24991
- const [cleanup2] = cleanupFn(this, (err) => this.$container$?.handleError(err, null));
24992
- this.$promise$ = this.$computeQrl$.getFn()({
24993
- track: trackFn(this, this.$container$),
24994
- cleanup: cleanup2
24995
- });
25146
+ /** Called after SSR/unmount */
25147
+ async $destroy$() {
25148
+ this.$clearNextPoll$();
25149
+ clearTimeout(this.$computationTimeoutId$);
25150
+ if (this.$current$) {
25151
+ await this.$requestCleanups$(this.$current$);
24996
25152
  }
24997
- return this.$promise$;
25153
+ await Promise.all(this.$jobs$.map((job) => job.$promise$));
24998
25154
  }
24999
- setValue(value) {
25000
- this.$flags$ &= ~1 /* INVALID */;
25001
- const didChange = value !== this.$untrackedValue$;
25002
- if (didChange) {
25003
- this.$untrackedValue$ = value;
25004
- this.$flags$ |= 2 /* RUN_EFFECTS */;
25155
+ get untrackedValue() {
25156
+ this.$computeIfNeeded$();
25157
+ if (this.$current$?.$promise$) {
25158
+ if (this.$untrackedValue$ === NEEDS_COMPUTATION || (import.meta.env.TEST ? isServerPlatform() : isServer5)) {
25159
+ DEBUG3 && log3("Throwing promise while computing initial value", this);
25160
+ throw this.$current$?.$promise$;
25161
+ }
25162
+ DEBUG3 && log3("Returning stale value", this.$untrackedValue$, "while computing", this.$current$);
25163
+ return this.$untrackedValue$;
25164
+ }
25165
+ if (this.$untrackedError$) {
25166
+ DEBUG3 && log3("Throwing error while reading value", this);
25167
+ throw this.$untrackedError$;
25168
+ }
25169
+ return this.$untrackedValue$;
25170
+ }
25171
+ $clearNextPoll$() {
25172
+ if (this.$pollTimeoutId$ !== void 0) {
25173
+ clearTimeout(this.$pollTimeoutId$);
25174
+ this.$pollTimeoutId$ = void 0;
25175
+ }
25176
+ }
25177
+ $scheduleNextPoll$() {
25178
+ if ((import.meta.env.TEST ? !isServerPlatform() : isBrowser) && this.$interval$ > 0) {
25179
+ this.$clearNextPoll$();
25180
+ this.$pollTimeoutId$ = setTimeout(this.invalidate.bind(this), this.$interval$);
25181
+ this.$pollTimeoutId$?.unref?.();
25005
25182
  }
25006
- return didChange;
25183
+ }
25184
+ $hasSubscribers$() {
25185
+ return !!(this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size);
25186
+ }
25187
+ async $requestCleanups$(job, reason) {
25188
+ if (job.$cleanupRequested$) {
25189
+ return job.$promise$;
25190
+ }
25191
+ DEBUG3 && log3("Requesting cleanups for job", job);
25192
+ job.$cleanupRequested$ = true;
25193
+ job.$abortController$?.abort(reason);
25194
+ job.$promise$ = Promise.resolve(job.$promise$).then(
25195
+ () => job.$promise$ = this.$runCleanups$(job)
25196
+ );
25197
+ }
25198
+ /** Clean up and trigger signal compute once complete */
25199
+ async $runCleanups$(job) {
25200
+ const cleanups = job.$cleanups$;
25201
+ if (cleanups?.length) {
25202
+ DEBUG3 && log3("cleanup start", job);
25203
+ const onError = (err) => {
25204
+ const handleError = this.$container$?.handleError;
25205
+ if (handleError) {
25206
+ handleError(err, null);
25207
+ } else {
25208
+ console.error("Error in async signal cleanup", err);
25209
+ }
25210
+ };
25211
+ DEBUG3 && log3("cleanup start for real", job);
25212
+ await Promise.all(
25213
+ cleanups.map((fn) => {
25214
+ try {
25215
+ const result2 = fn();
25216
+ if (isPromise(result2)) {
25217
+ return result2.catch(onError);
25218
+ }
25219
+ } catch (err) {
25220
+ onError(err);
25221
+ }
25222
+ })
25223
+ );
25224
+ cleanups.length = 0;
25225
+ DEBUG3 && log3("cleanup finished", job);
25226
+ }
25227
+ const jobs = this.$jobs$;
25228
+ const idx = jobs.indexOf(job);
25229
+ if (idx !== -1) {
25230
+ jobs.splice(idx, 1);
25231
+ }
25232
+ this.$computeIfNeeded$();
25007
25233
  }
25008
25234
  };
25009
25235
 
@@ -25043,6 +25269,7 @@ var SerializerSignalImpl = class extends ComputedSignalImpl {
25043
25269
  return;
25044
25270
  }
25045
25271
  throwIfQRLNotResolved(this.$computeQrl$);
25272
+ this.$flags$ &= ~1 /* INVALID */;
25046
25273
  let arg = this.$computeQrl$.resolved;
25047
25274
  if (typeof arg === "function") {
25048
25275
  arg = arg();
@@ -25056,13 +25283,12 @@ var SerializerSignalImpl = class extends ComputedSignalImpl {
25056
25283
  "." /* VNODE */,
25057
25284
  this.$container$
25058
25285
  );
25286
+ this.$didInitialize$ = true;
25059
25287
  DEBUG4 && log4("SerializerSignal.$compute$", untrackedValue);
25060
25288
  const didChange = this.$didInitialize$ && untrackedValue !== "undefined" || untrackedValue !== this.$untrackedValue$;
25061
- this.$flags$ &= ~1 /* INVALID */;
25062
- this.$didInitialize$ = true;
25063
25289
  if (didChange) {
25064
- this.$flags$ |= 2 /* RUN_EFFECTS */;
25065
25290
  this.$untrackedValue$ = untrackedValue;
25291
+ scheduleEffects(this.$container$, this, this.$effects$);
25066
25292
  }
25067
25293
  }
25068
25294
  };
@@ -25081,7 +25307,7 @@ var createSerializer$ = implicit$FirstArg(
25081
25307
  var getValueProp = (p0) => p0.value;
25082
25308
 
25083
25309
  // packages/qwik/src/core/shared/vnode/vnode-dirty.ts
25084
- import { isServer as isServer7 } from "@qwik.dev/core/build";
25310
+ import { isServer as isServer8 } from "@qwik.dev/core/build";
25085
25311
 
25086
25312
  // packages/qwik/src/core/shared/cursor/cursor-queue.ts
25087
25313
  var globalCursorQueue = [];
@@ -25097,7 +25323,7 @@ function addCursorToQueue(container, cursor) {
25097
25323
  }
25098
25324
  }
25099
25325
  globalCursorQueue.splice(insertIndex, 0, cursor);
25100
- container.$cursorCount$++;
25326
+ container.$pendingCount$++;
25101
25327
  container.$renderPromise$ || (container.$renderPromise$ = new Promise((r) => container.$resolveRenderPromise$ = r));
25102
25328
  }
25103
25329
  function getHighestPriorityCursor() {
@@ -25120,7 +25346,7 @@ function getHighestPriorityCursor() {
25120
25346
  function pauseCursor(cursor, container) {
25121
25347
  pausedCursorQueue.push(cursor);
25122
25348
  removeCursorFromQueue(cursor, container, true);
25123
- container.$pausedCursorCount$++;
25349
+ container.$pendingCount$++;
25124
25350
  }
25125
25351
  function resumeCursor(cursor, container) {
25126
25352
  const index = pausedCursorQueue.indexOf(cursor);
@@ -25130,7 +25356,7 @@ function resumeCursor(cursor, container) {
25130
25356
  pausedCursorQueue[index] = pausedCursorQueue[lastIndex];
25131
25357
  }
25132
25358
  pausedCursorQueue.pop();
25133
- container.$pausedCursorCount$--;
25359
+ container.$pendingCount$--;
25134
25360
  }
25135
25361
  addCursorToQueue(container, cursor);
25136
25362
  }
@@ -25141,7 +25367,7 @@ function removeCursorFromQueue(cursor, container, keepCursorFlag) {
25141
25367
  const index = globalCursorQueue.indexOf(cursor);
25142
25368
  if (index !== -1) {
25143
25369
  globalCursorQueue.splice(index, 1);
25144
- container.$cursorCount$--;
25370
+ container.$pendingCount$--;
25145
25371
  }
25146
25372
  }
25147
25373
 
@@ -25198,7 +25424,7 @@ function setCursorData(vNode, cursorData) {
25198
25424
  }
25199
25425
 
25200
25426
  // packages/qwik/src/core/client/vnode-diff.ts
25201
- import { isDev as isDev12 } from "@qwik.dev/core/build";
25427
+ import { isDev as isDev13 } from "@qwik.dev/core/build";
25202
25428
 
25203
25429
  // packages/qwik/src/core/reactive-primitives/subscription-data.ts
25204
25430
  var SubscriptionData = class {
@@ -25209,14 +25435,14 @@ var SubscriptionData = class {
25209
25435
  };
25210
25436
 
25211
25437
  // packages/qwik/src/core/shared/component-execution.ts
25212
- import { isDev as isDev10, isServer as isServer5 } from "@qwik.dev/core/build";
25438
+ import { isDev as isDev11, isServer as isServer6 } from "@qwik.dev/core/build";
25213
25439
 
25214
25440
  // packages/qwik/src/core/shared/component.public.ts
25215
- import { isDev as isDev9 } from "@qwik.dev/core/build";
25441
+ import { isDev as isDev10 } from "@qwik.dev/core/build";
25216
25442
  var componentQrl = (componentQrl2) => {
25217
25443
  function QwikComponent(props, key, flags = 0) {
25218
- isDev9 && assertQrl(componentQrl2);
25219
- isDev9 && assertNumber(flags, "The Qwik Component was not invoked correctly");
25444
+ isDev10 && assertQrl(componentQrl2);
25445
+ isDev10 && assertNumber(flags, "The Qwik Component was not invoked correctly");
25220
25446
  const hash3 = qTest ? "sX" : componentQrl2.$hash$.slice(0, 4);
25221
25447
  const finalKey = hash3 + ":" + (key ? key : "");
25222
25448
  const InnerCmp = () => {
@@ -25232,6 +25458,16 @@ var isQwikComponent = (component) => {
25232
25458
  return typeof component == "function" && component[SERIALIZABLE_STATE] !== void 0;
25233
25459
  };
25234
25460
 
25461
+ // packages/qwik/src/core/shared/utils/objects.ts
25462
+ var isObjectEmpty = (obj) => {
25463
+ for (const key in obj) {
25464
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
25465
+ return false;
25466
+ }
25467
+ }
25468
+ return true;
25469
+ };
25470
+
25235
25471
  // packages/qwik/src/core/shared/jsx/jsx-node.ts
25236
25472
  var _hasOwnProperty = Object.prototype.hasOwnProperty;
25237
25473
  var JSXNodeImpl = class {
@@ -25246,8 +25482,8 @@ var JSXNodeImpl = class {
25246
25482
  __publicField(this, "_proxy", null);
25247
25483
  this.toSort = !!toSort;
25248
25484
  this.key = key === null || key === void 0 ? null : typeof key === "string" ? key : "" + key;
25249
- this.varProps = !varProps || isEmpty(varProps) ? EMPTY_OBJ : varProps;
25250
- this.constProps = !constProps || isEmpty(constProps) ? null : constProps;
25485
+ this.varProps = !varProps || isObjectEmpty(varProps) ? EMPTY_OBJ : varProps;
25486
+ this.constProps = !constProps || isObjectEmpty(constProps) ? null : constProps;
25251
25487
  if (qDev && dev) {
25252
25488
  this.dev = {
25253
25489
  ...dev,
@@ -25287,9 +25523,6 @@ var isJSXNode = (n) => {
25287
25523
  return n instanceof JSXNodeImpl;
25288
25524
  }
25289
25525
  };
25290
- var isEmpty = (obj) => {
25291
- return Object.keys(obj).length === 0;
25292
- };
25293
25526
 
25294
25527
  // packages/qwik/src/core/shared/jsx/jsx-runtime.ts
25295
25528
  var Fragment = (props) => props.children;
@@ -25310,7 +25543,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
25310
25543
  let isInlineComponent = false;
25311
25544
  if (componentQRL === null) {
25312
25545
  componentQRL = container.getHostProp(renderHost, OnRenderProp);
25313
- isDev10 && assertDefined(componentQRL, "No Component found at this location");
25546
+ isDev11 && assertDefined(componentQRL, "No Component found at this location");
25314
25547
  }
25315
25548
  if (isQrl(componentQRL)) {
25316
25549
  props = props || container.getHostProp(renderHost, ELEMENT_PROPS) || EMPTY_OBJ;
@@ -25326,7 +25559,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
25326
25559
  const inlineComponent = componentQRL;
25327
25560
  componentFn = () => invokeApply(iCtx, inlineComponent, [props || EMPTY_OBJ]);
25328
25561
  }
25329
- const isSsr = import.meta.env.TEST ? isServerPlatform() : isServer5;
25562
+ const isSsr = import.meta.env.TEST ? isServerPlatform() : isServer6;
25330
25563
  const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(
25331
25564
  () => {
25332
25565
  if (!isInlineComponent) {
@@ -25389,7 +25622,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
25389
25622
  }
25390
25623
  targetElement = placeholderElement;
25391
25624
  } else {
25392
- if (isDev10) {
25625
+ if (isDev11) {
25393
25626
  logWarn(
25394
25627
  '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. '
25395
25628
  );
@@ -25400,7 +25633,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
25400
25633
  if (targetElement) {
25401
25634
  if (targetElement.type === "script" && key === qVisibleEvent) {
25402
25635
  eventKey = "q-d:qinit";
25403
- if (isDev10) {
25636
+ if (isDev11) {
25404
25637
  logWarn(
25405
25638
  '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.'
25406
25639
  );
@@ -25488,9 +25721,9 @@ var SSRRaw = () => null;
25488
25721
  var SSRComment = () => null;
25489
25722
 
25490
25723
  // packages/qwik/src/core/client/vnode-namespace.ts
25491
- import { isDev as isDev11 } from "@qwik.dev/core/build";
25724
+ import { isDev as isDev12 } from "@qwik.dev/core/build";
25492
25725
  var isForeignObjectElement = (elementName) => {
25493
- return isDev11 ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
25726
+ return isDev12 ? elementName.toLowerCase() === "foreignobject" : elementName === "foreignObject";
25494
25727
  };
25495
25728
  var isSvgElement = (elementName) => elementName === "svg" || isForeignObjectElement(elementName);
25496
25729
  var isMathElement = (elementName) => elementName === "math";
@@ -25509,40 +25742,6 @@ var vnode_getElementNamespaceFlags = (element) => {
25509
25742
  return 0 /* NS_html */;
25510
25743
  }
25511
25744
  };
25512
- function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild) {
25513
- const { elementNamespace, elementNamespaceFlag } = getNewElementNamespaceData(
25514
- domParentVNode,
25515
- newChild
25516
- );
25517
- let domChildren = [];
25518
- if (elementNamespace === HTML_NS) {
25519
- domChildren = vnode_getDOMChildNodes(journal, newChild, true);
25520
- } else {
25521
- const children = vnode_getDOMChildNodes(journal, newChild, true);
25522
- for (let i = 0; i < children.length; i++) {
25523
- const childVNode = children[i];
25524
- if (vnode_isTextVNode(childVNode)) {
25525
- domChildren.push(childVNode);
25526
- continue;
25527
- }
25528
- if ((childVNode.flags & 1536 /* NAMESPACE_MASK */) === (domParentVNode.flags & 1536 /* NAMESPACE_MASK */)) {
25529
- domChildren.push(childVNode);
25530
- continue;
25531
- }
25532
- const newChildElement = vnode_cloneElementWithNamespace(
25533
- childVNode,
25534
- domParentVNode,
25535
- elementNamespace,
25536
- elementNamespaceFlag
25537
- );
25538
- if (newChildElement) {
25539
- childVNode.node = newChildElement;
25540
- domChildren.push(childVNode);
25541
- }
25542
- }
25543
- }
25544
- return domChildren;
25545
- }
25546
25745
  function cloneDomTreeWithNamespace(element, elementName, namespace, deep = false) {
25547
25746
  const newElement = element.ownerDocument.createElementNS(namespace, elementName);
25548
25747
  for (const attr of element.attributes) {
@@ -26305,42 +26504,17 @@ var createSetTextOperation = (target, text) => new SetTextOperation(target, text
26305
26504
  var createInsertOrMoveOperation = (target, parent, beforeTarget) => new InsertOrMoveOperation(target, parent, beforeTarget);
26306
26505
  var createSetAttributeOperation = (target, attrName, attrValue, scopedStyleIdPrefix = null, isSvg2 = false) => new SetAttributeOperation(target, attrName, attrValue, scopedStyleIdPrefix, isSvg2);
26307
26506
 
26308
- // packages/qwik/src/core/use/use-task.ts
26309
- var runTask = (task, container, host) => {
26310
- task.$flags$ &= ~8 /* DIRTY */;
26311
- cleanupDestroyable(task);
26312
- const iCtx = newInvokeContext(container.$locale$, host, TaskEvent);
26313
- iCtx.$container$ = container;
26314
- const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
26315
- const track = trackFn(task, container);
26316
- const [cleanup2] = cleanupFn(task, (reason) => container.handleError(reason, host));
26317
- const taskApi = { track, cleanup: cleanup2 };
26318
- return safeCall(
26319
- () => taskFn(taskApi),
26320
- cleanup2,
26321
- (err) => {
26322
- if (isPromise(err)) {
26323
- return err.then(() => runTask(task, container, host));
26324
- } else {
26325
- container.handleError(err, host);
26326
- }
26507
+ // packages/qwik/src/core/use/utils/destroyable.ts
26508
+ var cleanupDestroyable = (destroyable) => {
26509
+ if (destroyable.$destroy$) {
26510
+ try {
26511
+ destroyable.$destroy$();
26512
+ } catch (err) {
26513
+ logError(err);
26327
26514
  }
26328
- );
26329
- };
26330
- var Task = class extends BackRef {
26331
- constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
26332
- super();
26333
- this.$flags$ = $flags$;
26334
- this.$index$ = $index$;
26335
- this.$el$ = $el$;
26336
- this.$qrl$ = $qrl$;
26337
- this.$state$ = $state$;
26338
- this.$destroy$ = $destroy$;
26515
+ destroyable.$destroy$ = null;
26339
26516
  }
26340
26517
  };
26341
- var isTask = (value) => {
26342
- return value instanceof Task;
26343
- };
26344
26518
 
26345
26519
  // packages/qwik/src/core/client/vnode-diff.ts
26346
26520
  function peekNextSibling(vCurrent) {
@@ -26404,8 +26578,8 @@ var vnode_diff = (container, journal, jsxNode, vStartNode, cursor, scopedStyleId
26404
26578
  }
26405
26579
  };
26406
26580
  function diff(diffContext, jsxNode, vStartNode) {
26407
- isDev12 && assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode");
26408
- isDev12 && assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode");
26581
+ isDev13 && assertFalse(vnode_isVNode(jsxNode), "JSXNode should not be a VNode");
26582
+ isDev13 && assertTrue(vnode_isVNode(vStartNode), "vStartNode should be a VNode");
26409
26583
  diffContext.vParent = vStartNode;
26410
26584
  diffContext.vNewNode = null;
26411
26585
  diffContext.vCurrent = vnode_getFirstChild(vStartNode);
@@ -26415,7 +26589,7 @@ function diff(diffContext, jsxNode, vStartNode) {
26415
26589
  }
26416
26590
  while (diffContext.stack.length) {
26417
26591
  while (diffContext.jsxIdx < diffContext.jsxCount) {
26418
- isDev12 && assertFalse(
26592
+ isDev13 && assertFalse(
26419
26593
  diffContext.vParent === diffContext.vCurrent,
26420
26594
  "Parent and current can't be the same"
26421
26595
  );
@@ -26546,7 +26720,7 @@ function descend(diffContext, children, descendVNode, shouldExpectNoChildren = t
26546
26720
  }
26547
26721
  stackPush(diffContext, children, descendVNode);
26548
26722
  if (descendVNode) {
26549
- isDev12 && assertDefined(
26723
+ isDev13 && assertDefined(
26550
26724
  diffContext.vCurrent || diffContext.vNewNode,
26551
26725
  "Expecting vCurrent to be defined."
26552
26726
  );
@@ -26675,8 +26849,8 @@ function expectProjection(diffContext) {
26675
26849
  diffContext.vCurrent = diffContext.vCurrent && diffContext.vCurrent.flags & 32 /* Deleted */ ? null : diffContext.vCurrent;
26676
26850
  if (diffContext.vCurrent == null) {
26677
26851
  diffContext.vNewNode = vnode_newVirtual();
26678
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
26679
- isDev12 && vnode_setProp(diffContext.vNewNode, "q:code", "expectProjection");
26852
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
26853
+ isDev13 && vnode_setProp(diffContext.vNewNode, "q:code", "expectProjection");
26680
26854
  vnode_setProp(diffContext.vNewNode, QSlot, slotName);
26681
26855
  diffContext.vNewNode.slotParent = diffContext.vParent;
26682
26856
  vnode_setProp(diffContext.vParent, slotName, diffContext.vNewNode);
@@ -26694,30 +26868,30 @@ function expectSlot(diffContext) {
26694
26868
  //(id) => vnode_locate(container.rootVNode, id)
26695
26869
  ) : null;
26696
26870
  if (vProjectedNode == null) {
26871
+ diffContext.vNewNode = vnode_newVirtual();
26872
+ vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
26873
+ vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
26874
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
26697
26875
  vnode_insertBefore(
26698
26876
  diffContext.journal,
26699
26877
  diffContext.vParent,
26700
- diffContext.vNewNode = vnode_newVirtual(),
26878
+ diffContext.vNewNode,
26701
26879
  diffContext.vCurrent && getInsertBefore(diffContext)
26702
26880
  );
26703
- vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
26704
- vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
26705
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
26706
- isDev12 && vnode_setProp(diffContext.vNewNode, "q:code", "expectSlot" + count++);
26707
26881
  return false;
26708
26882
  } else if (vProjectedNode === diffContext.vCurrent) {
26709
26883
  } else {
26710
26884
  const oldParent = vProjectedNode.parent;
26885
+ diffContext.vNewNode = vProjectedNode;
26886
+ vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
26887
+ vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
26888
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
26711
26889
  vnode_insertBefore(
26712
26890
  diffContext.journal,
26713
26891
  diffContext.vParent,
26714
- diffContext.vNewNode = vProjectedNode,
26892
+ diffContext.vNewNode,
26715
26893
  diffContext.vCurrent && getInsertBefore(diffContext)
26716
26894
  );
26717
- vnode_setProp(diffContext.vNewNode, QSlot, slotNameKey);
26718
- vHost && vnode_setProp(vHost, slotNameKey, diffContext.vNewNode);
26719
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "P" /* Projection */);
26720
- isDev12 && vnode_setProp(diffContext.vNewNode, "q:code", "expectSlot" + count++);
26721
26895
  if (oldParent && vnode_isElementVNode(oldParent) && !oldParent.firstChild && vnode_getElementName(oldParent) === QTemplate) {
26722
26896
  vnode_remove(
26723
26897
  diffContext.journal,
@@ -26803,7 +26977,7 @@ function expectNoChildren(diffContext, removeDOM = true) {
26803
26977
  }
26804
26978
  }
26805
26979
  function expectNoMore(diffContext) {
26806
- isDev12 && assertFalse(
26980
+ isDev13 && assertFalse(
26807
26981
  diffContext.vParent === diffContext.vCurrent,
26808
26982
  "Parent and current can't be the same"
26809
26983
  );
@@ -26890,7 +27064,7 @@ function createNewElement(diffContext, jsx2, elementName, currentFile) {
26890
27064
  }
26891
27065
  if (elementName === "textarea" && key2 === "value") {
26892
27066
  if (value && typeof value !== "string") {
26893
- if (isDev12) {
27067
+ if (isDev13) {
26894
27068
  throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
26895
27069
  }
26896
27070
  continue;
@@ -26916,7 +27090,7 @@ function createNewElement(diffContext, jsx2, elementName, currentFile) {
26916
27090
  element.setAttribute("class", diffContext.scopedStyleIdPrefix);
26917
27091
  }
26918
27092
  }
26919
- vnode_insertBefore(
27093
+ vnode_insertElementBefore(
26920
27094
  diffContext.journal,
26921
27095
  diffContext.vParent,
26922
27096
  diffContext.vNewNode,
@@ -26925,16 +27099,28 @@ function createNewElement(diffContext, jsx2, elementName, currentFile) {
26925
27099
  }
26926
27100
  function registerEventHandlers(key, value, element, vnode, diffContext) {
26927
27101
  const scopedKebabName = key.slice(2);
26928
- if (!Array.isArray(value)) {
26929
- value = [value];
26930
- }
26931
- const handlers = [];
26932
- for (const handler of value.flat(2)) {
26933
- if (handler) {
26934
- handlers.push(runEventHandlerQRL.bind(null, handler));
26935
- }
27102
+ if (Array.isArray(value)) {
27103
+ const arr = value;
27104
+ const handlers = [];
27105
+ for (let i = 0; i < arr.length; i++) {
27106
+ const item = arr[i];
27107
+ if (Array.isArray(item)) {
27108
+ for (let j = 0; j < item.length; j++) {
27109
+ const handler = item[j];
27110
+ if (handler) {
27111
+ handlers.push(runEventHandlerQRL.bind(null, handler));
27112
+ }
27113
+ }
27114
+ } else if (item) {
27115
+ handlers.push(runEventHandlerQRL.bind(null, item));
27116
+ }
27117
+ }
27118
+ (element._qDispatch || (element._qDispatch = {}))[scopedKebabName] = handlers;
27119
+ } else if (value) {
27120
+ (element._qDispatch || (element._qDispatch = {}))[scopedKebabName] = [
27121
+ runEventHandlerQRL.bind(null, value)
27122
+ ];
26936
27123
  }
26937
- (element._qDispatch || (element._qDispatch = {}))[scopedKebabName] = handlers;
26938
27124
  if (key.charAt(2) !== "e") {
26939
27125
  vnode_setAttr(diffContext.journal, vnode, key, "");
26940
27126
  }
@@ -26975,7 +27161,7 @@ function expectElement(diffContext, jsx2, elementName) {
26975
27161
  const jsxProps = jsx2.varProps;
26976
27162
  const vNode = diffContext.vNewNode || diffContext.vCurrent;
26977
27163
  if (jsxProps) {
26978
- diffProps(diffContext, vNode, jsxProps, isDev12 && getFileLocationFromJsx(jsx2.dev) || null);
27164
+ diffProps(diffContext, vNode, jsxProps, isDev13 && getFileLocationFromJsx(jsx2.dev) || null);
26979
27165
  }
26980
27166
  }
26981
27167
  function diffProps(diffContext, vnode, newAttrs, currentFile) {
@@ -27232,14 +27418,14 @@ function expectVirtual(diffContext, type, jsxKey) {
27232
27418
  return;
27233
27419
  }
27234
27420
  if (jsxKey === null || diffContext.isCreationMode) {
27235
- vnode_insertBefore(
27421
+ vnode_insertVirtualBefore(
27236
27422
  diffContext.journal,
27237
27423
  diffContext.vParent,
27238
27424
  diffContext.vNewNode = vnode_newVirtual(),
27239
27425
  diffContext.vCurrent && getInsertBefore(diffContext)
27240
27426
  );
27241
27427
  diffContext.vNewNode.key = jsxKey;
27242
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, type);
27428
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, type);
27243
27429
  return;
27244
27430
  }
27245
27431
  if (moveOrCreateKeyedNode(
@@ -27250,14 +27436,14 @@ function expectVirtual(diffContext, type, jsxKey) {
27250
27436
  diffContext.vParent,
27251
27437
  true
27252
27438
  )) {
27253
- vnode_insertBefore(
27439
+ vnode_insertVirtualBefore(
27254
27440
  diffContext.journal,
27255
27441
  diffContext.vParent,
27256
27442
  diffContext.vNewNode = vnode_newVirtual(),
27257
27443
  diffContext.vCurrent && getInsertBefore(diffContext)
27258
27444
  );
27259
27445
  diffContext.vNewNode.key = jsxKey;
27260
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, type);
27446
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, type);
27261
27447
  }
27262
27448
  }
27263
27449
  function expectComponent(diffContext, component) {
@@ -27361,27 +27547,27 @@ function insertNewComponent(diffContext, host, componentQRL, jsxProps) {
27361
27547
  if (host) {
27362
27548
  clearAllEffects(diffContext.container, host);
27363
27549
  }
27364
- vnode_insertBefore(
27550
+ vnode_insertVirtualBefore(
27365
27551
  diffContext.journal,
27366
27552
  diffContext.vParent,
27367
27553
  diffContext.vNewNode = vnode_newVirtual(),
27368
27554
  diffContext.vCurrent && getInsertBefore(diffContext)
27369
27555
  );
27370
27556
  const jsxNode = diffContext.jsxValue;
27371
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "C" /* Component */);
27557
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "C" /* Component */);
27372
27558
  vnode_setProp(diffContext.vNewNode, OnRenderProp, componentQRL);
27373
27559
  vnode_setProp(diffContext.vNewNode, ELEMENT_PROPS, jsxProps);
27374
27560
  diffContext.vNewNode.key = jsxNode.key;
27375
27561
  }
27376
27562
  function insertNewInlineComponent(diffContext) {
27377
- vnode_insertBefore(
27563
+ vnode_insertVirtualBefore(
27378
27564
  diffContext.journal,
27379
27565
  diffContext.vParent,
27380
27566
  diffContext.vNewNode = vnode_newVirtual(),
27381
27567
  diffContext.vCurrent && getInsertBefore(diffContext)
27382
27568
  );
27383
27569
  const jsxNode = diffContext.jsxValue;
27384
- isDev12 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
27570
+ isDev13 && vnode_setProp(diffContext.vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
27385
27571
  vnode_setProp(diffContext.vNewNode, ELEMENT_PROPS, jsxNode.props);
27386
27572
  if (jsxNode.key) {
27387
27573
  diffContext.vNewNode.key = jsxNode.key;
@@ -27398,7 +27584,7 @@ function expectText(diffContext, text) {
27398
27584
  return;
27399
27585
  }
27400
27586
  }
27401
- vnode_insertBefore(
27587
+ vnode_insertElementBefore(
27402
27588
  diffContext.journal,
27403
27589
  diffContext.vParent,
27404
27590
  diffContext.vNewNode = vnode_newText(
@@ -27497,7 +27683,7 @@ function isPropsEmpty(props) {
27497
27683
  if (!props) {
27498
27684
  return true;
27499
27685
  }
27500
- return Object.keys(props).length === 0;
27686
+ return isObjectEmpty(props);
27501
27687
  }
27502
27688
  function cleanup(container, journal, vNode, cursorRoot = null) {
27503
27689
  let vCursor = vNode;
@@ -27520,7 +27706,7 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
27520
27706
  if (isObject(obj)) {
27521
27707
  const objIsTask = isTask(obj);
27522
27708
  if (objIsTask && obj.$flags$ & 1 /* VISIBLE_TASK */) {
27523
- obj.$flags$ |= 32 /* NEEDS_CLEANUP */;
27709
+ obj.$flags$ |= 16 /* NEEDS_CLEANUP */;
27524
27710
  markVNodeDirty(container, vCursor, 64 /* CLEANUP */, cursorRoot);
27525
27711
  continue;
27526
27712
  } else if (obj instanceof SignalImpl || isStore(obj)) {
@@ -27640,7 +27826,6 @@ function containsWrappedSignal(data, signal) {
27640
27826
  }
27641
27827
  return false;
27642
27828
  }
27643
- var count = 0;
27644
27829
 
27645
27830
  // packages/qwik/src/core/shared/cursor/chore-execution.ts
27646
27831
  function executeTasks(vNode, container, cursorData) {
@@ -27653,15 +27838,13 @@ function executeTasks(vNode, container, cursorData) {
27653
27838
  for (const item of elementSeq) {
27654
27839
  if (item instanceof Task) {
27655
27840
  const task = item;
27656
- if (!(task.$flags$ & 8 /* DIRTY */)) {
27841
+ if (!(task.$flags$ & 4 /* DIRTY */)) {
27657
27842
  continue;
27658
27843
  }
27659
- if (task.$flags$ & 4 /* RESOURCE */) {
27660
- runResource(task, container, vNode);
27661
- } else if (task.$flags$ & 1 /* VISIBLE_TASK */) {
27844
+ if (task.$flags$ & 1 /* VISIBLE_TASK */) {
27662
27845
  (cursorData.afterFlushTasks || (cursorData.afterFlushTasks = [])).push(task);
27663
27846
  } else {
27664
- const isRenderBlocking = !!(task.$flags$ & 16 /* RENDER_BLOCKING */);
27847
+ const isRenderBlocking = !!(task.$flags$ & 8 /* RENDER_BLOCKING */);
27665
27848
  const result2 = runTask(task, container, vNode);
27666
27849
  if (isPromise(result2)) {
27667
27850
  if (isRenderBlocking) {
@@ -27793,8 +27976,8 @@ function executeCleanup(vNode, container) {
27793
27976
  }
27794
27977
  for (const item of elementSeq) {
27795
27978
  if (item instanceof Task) {
27796
- if (item.$flags$ & 32 /* NEEDS_CLEANUP */) {
27797
- item.$flags$ &= ~32 /* NEEDS_CLEANUP */;
27979
+ if (item.$flags$ & 16 /* NEEDS_CLEANUP */) {
27980
+ item.$flags$ &= ~16 /* NEEDS_CLEANUP */;
27798
27981
  const task = item;
27799
27982
  cleanupDestroyable(task);
27800
27983
  }
@@ -27854,8 +28037,8 @@ function _flushJournal(journal) {
27854
28037
  } else {
27855
28038
  const doc2 = batchParent.ownerDocument || batchParent;
27856
28039
  const fragment = doc2.createDocumentFragment();
27857
- for (const node of batchNodes) {
27858
- fragment.appendChild(node);
28040
+ for (let i = 0; i < batchNodes.length; i++) {
28041
+ fragment.appendChild(batchNodes[i]);
27859
28042
  }
27860
28043
  fastInsertBefore(batchParent, fragment, batchBefore);
27861
28044
  }
@@ -27865,7 +28048,8 @@ function _flushJournal(journal) {
27865
28048
  batchSet.clear();
27866
28049
  }
27867
28050
  };
27868
- for (const operation of journal) {
28051
+ for (let i = 0; i < journal.length; i++) {
28052
+ const operation = journal[i];
27869
28053
  if (operation instanceof InsertOrMoveOperation) {
27870
28054
  if (batchParent === operation.parent && batchBefore === operation.beforeTarget) {
27871
28055
  if (!batchNodes) {
@@ -27995,7 +28179,7 @@ var createMacroTask = (fn) => {
27995
28179
  };
27996
28180
 
27997
28181
  // packages/qwik/src/core/shared/cursor/cursor-walker.ts
27998
- import { isDev as isDev13, isServer as isServer6 } from "@qwik.dev/core/build";
28182
+ import { isDev as isDev14, isServer as isServer7 } from "@qwik.dev/core/build";
27999
28183
  var DEBUG6 = false;
28000
28184
  var nextMicroTask = createMicroTask(processCursorQueue);
28001
28185
  var nextMacroTask = createMacroTask(processCursorQueue);
@@ -28024,7 +28208,7 @@ function processCursorQueue(options = {
28024
28208
  }
28025
28209
  function walkCursor(cursor, options) {
28026
28210
  const { timeBudget } = options;
28027
- const isRunningOnServer = import.meta.env.TEST ? isServerPlatform() : isServer6;
28211
+ const isRunningOnServer = import.meta.env.TEST ? isServerPlatform() : isServer7;
28028
28212
  const startTime = performance.now();
28029
28213
  const cursorData = getCursorData(cursor);
28030
28214
  const blockingPromise = cursorData.promise;
@@ -28032,17 +28216,17 @@ function walkCursor(cursor, options) {
28032
28216
  return;
28033
28217
  }
28034
28218
  const container = cursorData.container;
28035
- isDev13 && assertDefined(container, "Cursor container not found");
28219
+ isDev14 && assertDefined(container, "Cursor container not found");
28036
28220
  if (!cursor.dirty) {
28037
28221
  finishWalk(container, cursor, cursorData, isRunningOnServer);
28038
28222
  return;
28039
28223
  }
28040
28224
  const journal = cursorData.journal || (cursorData.journal = []);
28041
28225
  let currentVNode = null;
28042
- let count2 = 0;
28226
+ let count = 0;
28043
28227
  while (currentVNode = cursorData.position) {
28044
28228
  DEBUG6 && console.warn("walkCursor", currentVNode.toString());
28045
- if (DEBUG6 && count2++ > 1e3) {
28229
+ if (DEBUG6 && count++ > 1e3) {
28046
28230
  throw new Error("Infinite loop detected in cursor walker");
28047
28231
  }
28048
28232
  if (cursorData.promise) {
@@ -28109,17 +28293,17 @@ function walkCursor(cursor, options) {
28109
28293
  }
28110
28294
  }
28111
28295
  }
28112
- isDev13 && assertFalse(
28296
+ isDev14 && assertFalse(
28113
28297
  !!(cursor.dirty & 127 /* DIRTY_MASK */ && !cursorData.position),
28114
28298
  "Cursor is still dirty and position is not set after walking"
28115
28299
  );
28116
28300
  finishWalk(container, cursor, cursorData, isRunningOnServer);
28117
28301
  }
28118
- function finishWalk(container, cursor, cursorData, isServer11) {
28302
+ function finishWalk(container, cursor, cursorData, isServer12) {
28119
28303
  if (!(cursor.dirty & 127 /* DIRTY_MASK */)) {
28120
28304
  removeCursorFromQueue(cursor, container);
28121
28305
  DEBUG6 && console.warn("walkCursor: cursor done", cursor.toString());
28122
- if (!isServer11) {
28306
+ if (!isServer12) {
28123
28307
  executeFlushPhase(cursor, container);
28124
28308
  }
28125
28309
  if (cursorData.extraPromises) {
@@ -28132,13 +28316,8 @@ function finishWalk(container, cursor, cursorData, isServer11) {
28132
28316
  }
28133
28317
  }
28134
28318
  function resolveCursor(container) {
28135
- DEBUG6 && console.warn(
28136
- `walkCursor: cursor resolved, ${container.$cursorCount$} remaining, ${container.$pausedCursorCount$} paused`
28137
- );
28138
- if (container.$cursorCount$ === 0 && container.$pausedCursorCount$ === 0) {
28139
- container.$resolveRenderPromise$();
28140
- container.$renderPromise$ = null;
28141
- }
28319
+ DEBUG6 && console.warn(`walkCursor: cursor resolved, ${container.$pendingCount$} remaining`);
28320
+ container.$checkPendingCount$();
28142
28321
  }
28143
28322
  function partitionDirtyChildren(dirtyChildren, parent) {
28144
28323
  let writeIndex = 0;
@@ -28176,8 +28355,8 @@ function getNextVNode(vNode, cursor) {
28176
28355
  const dirtyChildren = parent.dirtyChildren;
28177
28356
  let index = parent.nextDirtyChildIndex;
28178
28357
  const len = dirtyChildren.length;
28179
- let count2 = len;
28180
- while (count2-- > 0) {
28358
+ let count = len;
28359
+ while (count-- > 0) {
28181
28360
  const nextVNode = dirtyChildren[index];
28182
28361
  if (nextVNode.dirty & 127 /* DIRTY_MASK */) {
28183
28362
  parent.nextDirtyChildIndex = (index + 1) % len;
@@ -28282,7 +28461,7 @@ function findAndPropagateToBlockingCursor(vNode) {
28282
28461
  return false;
28283
28462
  }
28284
28463
  function isSsrNodeGuard(_vNode) {
28285
- return import.meta.env.TEST ? isServerPlatform() : isServer7;
28464
+ return import.meta.env.TEST ? isServerPlatform() : isServer8;
28286
28465
  }
28287
28466
  function markVNodeDirty(container, vNode, bits, cursorRoot = null) {
28288
28467
  const prevDirty = vNode.dirty;
@@ -28336,7 +28515,7 @@ function addVNodeOperation(journal, operation) {
28336
28515
  }
28337
28516
 
28338
28517
  // packages/qwik/src/core/reactive-primitives/impl/wrapped-signal-impl.ts
28339
- import { isDev as isDev14 } from "@qwik.dev/core/build";
28518
+ import { isDev as isDev15 } from "@qwik.dev/core/build";
28340
28519
  var _a5, _b3;
28341
28520
  var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a5 = _EFFECT_BACK_REF, _b3) {
28342
28521
  constructor(container, fn, args, fnStr, flags = 1 /* INVALID */ | 4 /* UNWRAP */) {
@@ -28367,20 +28546,9 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a5 = _EFFECT_BACK_REF,
28367
28546
  scheduleEffects(this.$container$, this, this.$effects$);
28368
28547
  }
28369
28548
  }
28370
- /**
28371
- * Use this to force running subscribers, for example when the calculated value has mutated but
28372
- * remained the same object.
28373
- */
28374
- force() {
28375
- this.$flags$ |= 2 /* RUN_EFFECTS */;
28376
- if (this.$container$ && this.$hostElement$) {
28377
- this.$container$.setHostProp(this.$hostElement$, HOST_SIGNAL, this);
28378
- markVNodeDirty(this.$container$, this.$hostElement$, 16 /* COMPUTE */);
28379
- }
28380
- }
28381
28549
  get untrackedValue() {
28382
28550
  this.$computeIfNeeded$();
28383
- isDev14 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
28551
+ isDev15 && assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
28384
28552
  return this.$untrackedValue$;
28385
28553
  }
28386
28554
  $computeIfNeeded$() {
@@ -28467,6 +28635,11 @@ function clearAsyncSignal(producer, effect) {
28467
28635
  if (pendingEffects && pendingEffects.has(effect)) {
28468
28636
  pendingEffects.delete(effect);
28469
28637
  }
28638
+ const errorEffects = producer.$errorEffects$;
28639
+ if (errorEffects && errorEffects.has(effect)) {
28640
+ errorEffects.delete(effect);
28641
+ }
28642
+ producer.$scheduleEagerCleanup$();
28470
28643
  }
28471
28644
  function clearStoreOrProps(producer, effect) {
28472
28645
  const effects = producer?.$effects$;
@@ -28482,125 +28655,41 @@ function clearStoreOrProps(producer, effect) {
28482
28655
  }
28483
28656
  }
28484
28657
 
28485
- // packages/qwik/src/core/use/use-resource.ts
28486
- var getResolved = (resource) => resource._resolved;
28487
- var getLoading = (resource) => resource.loading;
28488
- var _createResourceReturn = (opts) => {
28489
- const resource = {
28490
- __brand: "resource",
28491
- value: void 0,
28492
- loading: !isServerPlatform(),
28493
- _resolved: void 0,
28494
- _error: void 0,
28495
- _state: "pending",
28496
- _timeout: opts?.timeout ?? -1,
28497
- _cache: 0,
28498
- _generation: 0
28499
- };
28500
- return resource;
28501
- };
28502
- var createResourceReturn = (container, opts, initialPromise) => {
28503
- const result2 = _createResourceReturn(opts);
28504
- result2.value = initialPromise;
28505
- return createStore(container, result2, 1 /* RECURSIVE */);
28506
- };
28507
- var runResource = (task, container, host) => {
28508
- task.$flags$ &= ~8 /* DIRTY */;
28658
+ // packages/qwik/src/core/use/use-task.ts
28659
+ var runTask = (task, container, host) => {
28660
+ task.$flags$ &= ~4 /* DIRTY */;
28509
28661
  cleanupDestroyable(task);
28510
- const iCtx = newInvokeContext(container.$locale$, host, ResourceEvent);
28662
+ const iCtx = newInvokeContext(container.$locale$, host, TaskEvent);
28511
28663
  iCtx.$container$ = container;
28512
28664
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
28513
- const resource = task.$state$;
28514
- isDev15 && assertDefined(
28515
- resource,
28516
- 'useResource: when running a resource, "task.resource" must be a defined.',
28517
- task
28518
- );
28519
28665
  const track = trackFn(task, container);
28520
- const [cleanup2, cleanups] = cleanupFn(
28521
- task,
28522
- (reason) => container.handleError(reason, host)
28523
- );
28524
- const resourceTarget = unwrapStore(resource);
28525
- const opts = {
28526
- track,
28527
- cleanup: cleanup2,
28528
- cache(policy) {
28529
- let milliseconds = 0;
28530
- if (policy === "immutable") {
28531
- milliseconds = Infinity;
28532
- } else {
28533
- milliseconds = policy;
28534
- }
28535
- resource._cache = milliseconds;
28536
- },
28537
- previous: resourceTarget._resolved
28538
- };
28539
- let resolve;
28540
- let reject;
28541
- let done = false;
28542
- const currentGeneration = ++resourceTarget._generation;
28543
- const setState = (resolved, value) => {
28544
- if (done || resourceTarget._generation !== currentGeneration) {
28545
- return false;
28546
- }
28547
- done = true;
28548
- if (resolved) {
28549
- resourceTarget.loading = false;
28550
- resourceTarget._state = "resolved";
28551
- resourceTarget._resolved = value;
28552
- resourceTarget._error = void 0;
28553
- resolve(value);
28554
- } else {
28555
- resourceTarget.loading = false;
28556
- resourceTarget._state = "rejected";
28557
- resourceTarget._error = value;
28558
- reject(value);
28559
- }
28560
- if (!isServerPlatform()) {
28561
- forceStoreEffects(resource, "_state");
28562
- }
28563
- return true;
28564
- };
28565
- cleanups.push(() => {
28566
- if (untrack(getLoading, resource) === true) {
28567
- const value = untrack(getResolved, resource);
28568
- setState(true, value);
28569
- }
28570
- });
28571
- invoke(iCtx, () => {
28572
- resource._state = "pending";
28573
- resource.loading = !isServerPlatform();
28574
- resource.value = new Promise((r, re) => {
28575
- resolve = r;
28576
- reject = re;
28577
- });
28578
- });
28579
- const promise = safeCall(
28580
- () => taskFn(opts),
28581
- (value) => {
28582
- setState(true, value);
28583
- },
28666
+ const [cleanup2] = cleanupFn(task, (reason) => container.handleError(reason, host));
28667
+ const taskApi = { track, cleanup: cleanup2 };
28668
+ return safeCall(
28669
+ () => taskFn(taskApi),
28670
+ cleanup2,
28584
28671
  (err) => {
28585
28672
  if (isPromise(err)) {
28586
- return err.then(() => runResource(task, container, host));
28673
+ return err.then(() => runTask(task, container, host));
28587
28674
  } else {
28588
- setState(false, err);
28675
+ container.handleError(err, host);
28589
28676
  }
28590
28677
  }
28591
28678
  );
28592
- const timeout = resourceTarget._timeout;
28593
- if (timeout > 0) {
28594
- return Promise.race([
28595
- promise,
28596
- delay(timeout).then(() => {
28597
- if (setState(false, new Error("timeout"))) {
28598
- cleanupDestroyable(task);
28599
- }
28600
- })
28601
- ]);
28679
+ };
28680
+ var Task = class extends BackRef {
28681
+ constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
28682
+ super();
28683
+ this.$flags$ = $flags$;
28684
+ this.$index$ = $index$;
28685
+ this.$el$ = $el$;
28686
+ this.$qrl$ = $qrl$;
28687
+ this.$state$ = $state$;
28688
+ this.$destroy$ = $destroy$;
28602
28689
  }
28603
- return promise;
28690
+ };
28691
+ var isTask = (value) => {
28692
+ return value instanceof Task;
28604
28693
  };
28605
28694
 
28606
28695
  // packages/qwik/src/core/shared/cursor/ssr-chore-execution.ts
@@ -28648,15 +28737,10 @@ function executeTasksChore(container, ssrNode) {
28648
28737
  for (const item of elementSeq) {
28649
28738
  if (item instanceof Task) {
28650
28739
  const task = item;
28651
- if (!(task.$flags$ & 8 /* DIRTY */)) {
28740
+ if (!(task.$flags$ & 4 /* DIRTY */)) {
28652
28741
  continue;
28653
28742
  }
28654
- let result2;
28655
- if (task.$flags$ & 4 /* RESOURCE */) {
28656
- result2 = runResource(task, container, ssrNode);
28657
- } else {
28658
- result2 = runTask(task, container, ssrNode);
28659
- }
28743
+ const result2 = runTask(task, container, ssrNode);
28660
28744
  promise = promise ? promise.then(() => result2) : result2;
28661
28745
  }
28662
28746
  }
@@ -28701,77 +28785,7 @@ function _chk(_, element) {
28701
28785
  var version = globalThis.QWIK_VERSION;
28702
28786
 
28703
28787
  // packages/qwik/src/core/shared/serdes/serialize.ts
28704
- import { isDev as isDev17 } from "@qwik.dev/core/build";
28705
-
28706
- // packages/qwik/src/core/shared/serdes/qrl-to-string.ts
28707
28788
  import { isDev as isDev16 } from "@qwik.dev/core/build";
28708
- function qrlToString(serializationContext, qrl, raw) {
28709
- let symbol = qrl.$symbol$;
28710
- let chunk = qrl.$chunk$;
28711
- const platform = getPlatform();
28712
- if (platform) {
28713
- const result2 = isDev16 ? platform.chunkForSymbol(symbol, chunk, qrl.dev?.file) : platform.chunkForSymbol(symbol, chunk);
28714
- if (result2) {
28715
- chunk = result2[1];
28716
- symbol = result2[0];
28717
- }
28718
- }
28719
- const isSync = isSyncQrl(qrl);
28720
- if (!isSync) {
28721
- if (!chunk) {
28722
- chunk = serializationContext.$symbolToChunkResolver$(qrl.$hash$);
28723
- }
28724
- if (isDev16) {
28725
- const backChannel = globalThis.__qrl_back_channel__ || (globalThis.__qrl_back_channel__ = /* @__PURE__ */ new Map());
28726
- backChannel.set(qrl.$symbol$, qrl.$symbolRef$);
28727
- if (!chunk) {
28728
- chunk = QRL_RUNTIME_CHUNK;
28729
- }
28730
- }
28731
- if (!chunk) {
28732
- throw qError(14 /* qrlMissingChunk */, [qrl.$symbol$]);
28733
- }
28734
- if (chunk.startsWith("./")) {
28735
- chunk = chunk.slice(2);
28736
- }
28737
- } else {
28738
- const fn = qrl.resolved;
28739
- chunk = "";
28740
- symbol = String(serializationContext.$addSyncFn$(null, 0, fn));
28741
- }
28742
- const captures = qrl.getCaptured();
28743
- let captureIds = null;
28744
- if (captures && captures.length > 0) {
28745
- captureIds = captures.map((ref) => `${serializationContext.$addRoot$(ref)}`).join(" ");
28746
- }
28747
- if (raw) {
28748
- return [chunk, symbol, captureIds];
28749
- }
28750
- let qrlStringInline = `${chunk}#${symbol}`;
28751
- if (captureIds) {
28752
- qrlStringInline += `#${captureIds}`;
28753
- }
28754
- return qrlStringInline;
28755
- }
28756
- function createQRLWithBackChannel(chunk, symbol, captures) {
28757
- let qrlImporter = null;
28758
- if (isDev16 && chunk === QRL_RUNTIME_CHUNK) {
28759
- const backChannel = globalThis.__qrl_back_channel__;
28760
- isDev16 && assertDefined(backChannel, "Missing QRL_RUNTIME_CHUNK");
28761
- const fn = backChannel.get(symbol);
28762
- if (fn) {
28763
- qrlImporter = () => Promise.resolve({ [symbol]: fn });
28764
- }
28765
- }
28766
- return createQRL(chunk, symbol, null, qrlImporter, captures);
28767
- }
28768
- function parseQRL(qrl) {
28769
- const [chunk, symbol, captures] = qrl.split("#");
28770
- return createQRLWithBackChannel(chunk, symbol, captures || null);
28771
- }
28772
- var QRL_RUNTIME_CHUNK = "mock-chunk";
28773
-
28774
- // packages/qwik/src/core/shared/serdes/serialize.ts
28775
28789
  async function serialize(serializationContext) {
28776
28790
  const {
28777
28791
  $writer$,
@@ -28943,7 +28957,7 @@ async function serialize(serializationContext) {
28943
28957
  } else if (isQwikComponent(value)) {
28944
28958
  const [qrl] = value[SERIALIZABLE_STATE];
28945
28959
  serializationContext.$renderSymbols$.add(qrl.$symbol$);
28946
- output(22 /* Component */, [qrl]);
28960
+ output(21 /* Component */, [qrl]);
28947
28961
  } else {
28948
28962
  throw qError(34 /* serializeErrorCannotSerializeFunction */, [value.toString()]);
28949
28963
  }
@@ -28975,58 +28989,45 @@ async function serialize(serializationContext) {
28975
28989
  const writeObjectValue = (value) => {
28976
28990
  if (isPropsProxy(value)) {
28977
28991
  const owner = value[_OWNER];
28978
- output(31 /* PropsProxy */, [
28992
+ output(30 /* PropsProxy */, [
28979
28993
  _serializationWeakRef(owner),
28980
28994
  owner.varProps,
28981
28995
  owner.constProps,
28982
28996
  value[_PROPS_HANDLER].$effects$
28983
28997
  ]);
28984
28998
  } else if (value instanceof SubscriptionData) {
28985
- output(32 /* SubscriptionData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
28999
+ output(31 /* SubscriptionData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
28986
29000
  } else if (value instanceof EffectSubscription) {
28987
- output(33 /* EffectSubscription */, [
29001
+ output(32 /* EffectSubscription */, [
28988
29002
  value.consumer,
28989
29003
  value.property,
28990
29004
  value.backRef,
28991
29005
  value.data
28992
29006
  ]);
28993
29007
  } else if (isStore(value)) {
28994
- if (isResource(value)) {
28995
- serializationContext.$resources$.add(value);
28996
- const forwardRefId = resolvePromise(value.value, $addRoot$, (resolved, resolvedValue) => {
28997
- return new PromiseResult(
28998
- 21 /* Resource */,
28999
- resolved,
29000
- resolvedValue,
29001
- getStoreHandler(value).$effects$
29002
- );
29003
- });
29004
- output(2 /* ForwardRef */, forwardRefId);
29005
- } else {
29006
- const storeHandler = getStoreHandler(value);
29007
- const storeTarget = getStoreTarget(value);
29008
- const flags = storeHandler.$flags$;
29009
- const effects = storeHandler.$effects$;
29010
- const innerStores = [];
29011
- for (const prop in storeTarget) {
29012
- const propValue = storeTarget[prop];
29013
- const innerStore = $storeProxyMap$.get(propValue);
29014
- if (innerStore) {
29015
- innerStores.push(innerStore);
29016
- }
29017
- }
29018
- const out = [storeTarget, flags, effects, ...innerStores];
29019
- while (out[out.length - 1] === void 0) {
29020
- out.pop();
29021
- }
29022
- output(28 /* Store */, out);
29008
+ const storeHandler = getStoreHandler(value);
29009
+ const storeTarget = getStoreTarget(value);
29010
+ const flags = storeHandler.$flags$;
29011
+ const effects = storeHandler.$effects$;
29012
+ const innerStores = [];
29013
+ for (const prop in storeTarget) {
29014
+ const propValue = storeTarget[prop];
29015
+ const innerStore = $storeProxyMap$.get(propValue);
29016
+ if (innerStore) {
29017
+ innerStores.push(innerStore);
29018
+ }
29019
+ }
29020
+ const out = [storeTarget, flags, effects, ...innerStores];
29021
+ while (out[out.length - 1] === void 0) {
29022
+ out.pop();
29023
29023
  }
29024
+ output(27 /* Store */, out);
29024
29025
  } else if (isSerializerObj(value)) {
29025
29026
  const result2 = value[SerializerSymbol](value);
29026
29027
  if (isPromise(result2)) {
29027
29028
  const forwardRef = resolvePromise(result2, $addRoot$, (resolved, resolvedValue) => {
29028
29029
  return new PromiseResult(
29029
- 27 /* SerializerSignal */,
29030
+ 26 /* SerializerSignal */,
29030
29031
  resolved,
29031
29032
  resolvedValue,
29032
29033
  void 0,
@@ -29063,7 +29064,7 @@ async function serialize(serializationContext) {
29063
29064
  if (isPromise(maybeValue)) {
29064
29065
  const forwardRefId = resolvePromise(maybeValue, $addRoot$, (resolved, resolvedValue) => {
29065
29066
  return new PromiseResult(
29066
- 27 /* SerializerSignal */,
29067
+ 26 /* SerializerSignal */,
29067
29068
  resolved,
29068
29069
  resolvedValue,
29069
29070
  value.$effects$,
@@ -29072,7 +29073,7 @@ async function serialize(serializationContext) {
29072
29073
  });
29073
29074
  output(2 /* ForwardRef */, forwardRefId);
29074
29075
  } else {
29075
- output(27 /* SerializerSignal */, [
29076
+ output(26 /* SerializerSignal */, [
29076
29077
  value.$computeQrl$,
29077
29078
  filterEffectBackRefs(value[_EFFECT_BACK_REF]),
29078
29079
  value.$effects$,
@@ -29082,7 +29083,7 @@ async function serialize(serializationContext) {
29082
29083
  return;
29083
29084
  }
29084
29085
  if (value instanceof WrappedSignalImpl) {
29085
- output(24 /* WrappedSignal */, [
29086
+ output(23 /* WrappedSignal */, [
29086
29087
  ...serializeWrappingFn(serializationContext, value),
29087
29088
  filterEffectBackRefs(value[_EFFECT_BACK_REF]),
29088
29089
  value.$flags$,
@@ -29095,35 +29096,40 @@ async function serialize(serializationContext) {
29095
29096
  const shouldNeverSerialize = value.$flags$ & 8 /* SERIALIZATION_STRATEGY_NEVER */;
29096
29097
  const isInvalid = value.$flags$ & 1 /* INVALID */;
29097
29098
  const isSkippable = fastSkipSerialize(value.$untrackedValue$);
29098
- if (shouldAlwaysSerialize) {
29099
+ const isAsync = value instanceof AsyncSignalImpl;
29100
+ const interval = isAsync && value.$interval$ > 0 ? value.$interval$ : void 0;
29101
+ const concurrency = isAsync && value.$concurrency$ !== 1 ? value.$concurrency$ : void 0;
29102
+ const timeout = isAsync && value.$timeoutMs$ !== 0 ? value.$timeoutMs$ : void 0;
29103
+ const eagerCleanup = isAsync && value.$flags$ & 32 /* EAGER_CLEANUP */ ? true : void 0;
29104
+ if (isInvalid || isSkippable) {
29105
+ v = NEEDS_COMPUTATION;
29106
+ } else if (shouldAlwaysSerialize) {
29099
29107
  v = value.$untrackedValue$;
29100
29108
  } else if (shouldNeverSerialize) {
29101
29109
  v = NEEDS_COMPUTATION;
29102
- } else if (isInvalid || isSkippable) {
29103
- v = NEEDS_COMPUTATION;
29104
29110
  }
29105
29111
  const out = [
29106
29112
  value.$computeQrl$,
29107
29113
  filterEffectBackRefs(value[_EFFECT_BACK_REF]),
29108
29114
  value.$effects$
29109
29115
  ];
29110
- const isAsync = value instanceof AsyncSignalImpl;
29111
29116
  if (isAsync) {
29112
- out.push(
29113
- value.$loadingEffects$,
29114
- value.$errorEffects$,
29115
- value.$untrackedLoading$,
29116
- value.$untrackedError$
29117
- );
29117
+ out.push(value.$loadingEffects$, value.$errorEffects$, value.$untrackedError$);
29118
29118
  }
29119
29119
  let keepUndefined = false;
29120
- if (v !== NEEDS_COMPUTATION) {
29120
+ if (v !== NEEDS_COMPUTATION || interval !== void 0 || concurrency !== void 0 || timeout !== void 0) {
29121
29121
  out.push(v);
29122
- if (!isAsync && v === void 0) {
29122
+ if (v === void 0) {
29123
29123
  keepUndefined = true;
29124
29124
  }
29125
29125
  }
29126
- output(isAsync ? 26 /* AsyncSignal */ : 25 /* ComputedSignal */, out, keepUndefined);
29126
+ if (isAsync) {
29127
+ out.push(interval);
29128
+ out.push(concurrency);
29129
+ out.push(timeout);
29130
+ out.push(eagerCleanup);
29131
+ }
29132
+ output(isAsync ? 25 /* AsyncSignal */ : 24 /* ComputedSignal */, out, keepUndefined);
29127
29133
  } else {
29128
29134
  const v = value.$untrackedValue$;
29129
29135
  const keepUndefined = v === void 0;
@@ -29131,7 +29137,7 @@ async function serialize(serializationContext) {
29131
29137
  if (value.$effects$) {
29132
29138
  out.push(...value.$effects$);
29133
29139
  }
29134
- output(23 /* Signal */, out, keepUndefined);
29140
+ output(22 /* Signal */, out, keepUndefined);
29135
29141
  }
29136
29142
  } else if (value instanceof URL) {
29137
29143
  output(6 /* URL */, value.href);
@@ -29142,7 +29148,7 @@ async function serialize(serializationContext) {
29142
29148
  } else if (value instanceof Error) {
29143
29149
  const out = [value.message];
29144
29150
  out.push(...Object.entries(value).flat());
29145
- if (isDev17) {
29151
+ if (isDev16) {
29146
29152
  out.push("stack", value.stack);
29147
29153
  }
29148
29154
  output(15 /* Error */, out);
@@ -29180,7 +29186,7 @@ async function serialize(serializationContext) {
29180
29186
  array.push(key, value2.name);
29181
29187
  }
29182
29188
  });
29183
- output(29 /* FormData */, array);
29189
+ output(28 /* FormData */, array);
29184
29190
  } else if (value instanceof URLSearchParams) {
29185
29191
  output(13 /* URLSearchParams */, value.toString());
29186
29192
  } else if (value instanceof Set) {
@@ -29203,7 +29209,7 @@ async function serialize(serializationContext) {
29203
29209
  while (out[out.length - 1] === void 0) {
29204
29210
  out.pop();
29205
29211
  }
29206
- output(30 /* JSXNode */, out);
29212
+ output(29 /* JSXNode */, out);
29207
29213
  } else if (value instanceof Task) {
29208
29214
  const out = [
29209
29215
  value.$qrl$,
@@ -29223,11 +29229,9 @@ async function serialize(serializationContext) {
29223
29229
  });
29224
29230
  output(2 /* ForwardRef */, forwardRefId);
29225
29231
  } else if (value instanceof PromiseResult) {
29226
- if (value.$type$ === 21 /* Resource */) {
29227
- output(21 /* Resource */, [value.$resolved$, value.$value$, value.$effects$]);
29228
- } else if (value.$type$ === 27 /* SerializerSignal */) {
29232
+ if (value.$type$ === 26 /* SerializerSignal */) {
29229
29233
  if (value.$qrl$) {
29230
- output(27 /* SerializerSignal */, [value.$qrl$, value.$effects$, value.$value$]);
29234
+ output(26 /* SerializerSignal */, [value.$qrl$, value.$effects$, value.$value$]);
29231
29235
  } else if (value.$resolved$) {
29232
29236
  const index = parent.$index$;
29233
29237
  parent = parent.$parent$;
@@ -29368,9 +29372,6 @@ function isObjectLiteral(obj) {
29368
29372
  const prototype = Object.getPrototypeOf(obj);
29369
29373
  return prototype == null || prototype === Object.prototype || prototype === Array.prototype;
29370
29374
  }
29371
- function isResource(value) {
29372
- return "__brand" in value && value.__brand === "resource";
29373
- }
29374
29375
  function serializeWrappingFn(serializationContext, value) {
29375
29376
  if (value.$funcStr$ && value.$funcStr$[0] === "{") {
29376
29377
  value.$funcStr$ = `(${value.$funcStr$})`;
@@ -29420,6 +29421,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
29420
29421
  const syncFnMap = /* @__PURE__ */ new Map();
29421
29422
  const syncFns = [];
29422
29423
  const roots = [];
29424
+ const eagerResume = /* @__PURE__ */ new Set();
29423
29425
  const getSeenRef = (obj) => seenObjsMap.get(obj);
29424
29426
  const $markSeen$ = (obj, parent, index) => {
29425
29427
  const ref = { $index$: index, $parent$: parent };
@@ -29507,9 +29509,10 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
29507
29509
  $writer$: writer,
29508
29510
  $eventQrls$: /* @__PURE__ */ new Set(),
29509
29511
  $eventNames$: /* @__PURE__ */ new Set(),
29510
- $resources$: /* @__PURE__ */ new Set(),
29511
29512
  $renderSymbols$: /* @__PURE__ */ new Set(),
29512
29513
  $storeProxyMap$: storeProxyMap,
29514
+ $eagerResume$: eagerResume,
29515
+ $resources$: /* @__PURE__ */ new Set(),
29513
29516
  $getProp$: getProp,
29514
29517
  $setProp$: setProp
29515
29518
  };
@@ -29530,8 +29533,7 @@ var _SharedContainer = class {
29530
29533
  __publicField(this, "$buildBase$", null);
29531
29534
  __publicField(this, "$renderPromise$", null);
29532
29535
  __publicField(this, "$resolveRenderPromise$", null);
29533
- __publicField(this, "$cursorCount$", 0);
29534
- __publicField(this, "$pausedCursorCount$", 0);
29536
+ __publicField(this, "$pendingCount$", 0);
29535
29537
  this.$serverData$ = serverData;
29536
29538
  this.$locale$ = locale;
29537
29539
  this.$version$ = version;
@@ -29554,6 +29556,12 @@ var _SharedContainer = class {
29554
29556
  writer
29555
29557
  );
29556
29558
  }
29559
+ $checkPendingCount$() {
29560
+ if (this.$pendingCount$ === 0) {
29561
+ this.$resolveRenderPromise$?.();
29562
+ this.$renderPromise$ = null;
29563
+ }
29564
+ }
29557
29565
  };
29558
29566
 
29559
29567
  // packages/qwik/src/core/shared/serdes/allocate.ts
@@ -29598,16 +29606,6 @@ var allocate = (container, typeId, value) => {
29598
29606
  }
29599
29607
  case 20 /* Task */:
29600
29608
  return new Task(-1, -1, null, null, null, null);
29601
- case 21 /* Resource */: {
29602
- const res = createResourceReturn(
29603
- container,
29604
- // we don't care about the timeout value
29605
- void 0,
29606
- void 0
29607
- );
29608
- res.loading = false;
29609
- return res;
29610
- }
29611
29609
  case 6 /* URL */:
29612
29610
  return new URL(value);
29613
29611
  case 7 /* Date */:
@@ -29617,19 +29615,19 @@ var allocate = (container, typeId, value) => {
29617
29615
  return new RegExp(value.slice(1, idx), value.slice(idx + 1));
29618
29616
  case 15 /* Error */:
29619
29617
  return new Error();
29620
- case 22 /* Component */:
29618
+ case 21 /* Component */:
29621
29619
  return componentQrl(null);
29622
- case 23 /* Signal */:
29620
+ case 22 /* Signal */:
29623
29621
  return new SignalImpl(container, 0);
29624
- case 24 /* WrappedSignal */:
29622
+ case 23 /* WrappedSignal */:
29625
29623
  return new WrappedSignalImpl(container, null, null, null);
29626
- case 25 /* ComputedSignal */:
29624
+ case 24 /* ComputedSignal */:
29627
29625
  return new ComputedSignalImpl(container, null);
29628
- case 26 /* AsyncSignal */:
29629
- return new AsyncSignalImpl(container, null);
29630
- case 27 /* SerializerSignal */:
29626
+ case 25 /* AsyncSignal */:
29627
+ return new AsyncSignalImpl(container, null, void 0, { interval: 0 });
29628
+ case 26 /* SerializerSignal */:
29631
29629
  return new SerializerSignalImpl(container, null);
29632
- case 28 /* Store */: {
29630
+ case 27 /* Store */: {
29633
29631
  const data = value;
29634
29632
  const t = data[0];
29635
29633
  const v = data[1];
@@ -29644,9 +29642,9 @@ var allocate = (container, typeId, value) => {
29644
29642
  }
29645
29643
  case 13 /* URLSearchParams */:
29646
29644
  return new URLSearchParams(value);
29647
- case 29 /* FormData */:
29645
+ case 28 /* FormData */:
29648
29646
  return new FormData();
29649
- case 30 /* JSXNode */:
29647
+ case 29 /* JSXNode */:
29650
29648
  return new JSXNodeImpl(null, null, null, null, null);
29651
29649
  case 12 /* BigInt */:
29652
29650
  return BigInt(value);
@@ -29671,7 +29669,7 @@ var allocate = (container, typeId, value) => {
29671
29669
  const rest = encodedLength & 3;
29672
29670
  const decodedLength = blocks * 3 + (rest ? rest - 1 : 0);
29673
29671
  return new Uint8Array(decodedLength);
29674
- case 31 /* PropsProxy */:
29672
+ case 30 /* PropsProxy */:
29675
29673
  return createPropsProxy(null);
29676
29674
  case 10 /* VNode */:
29677
29675
  return retrieveVNodeOrDocument(container, value);
@@ -29683,9 +29681,9 @@ var allocate = (container, typeId, value) => {
29683
29681
  } else {
29684
29682
  throw qError(17 /* serializeErrorExpectedVNode */, [typeof vNode]);
29685
29683
  }
29686
- case 32 /* SubscriptionData */:
29684
+ case 31 /* SubscriptionData */:
29687
29685
  return new SubscriptionData({});
29688
- case 33 /* EffectSubscription */:
29686
+ case 32 /* EffectSubscription */:
29689
29687
  return new EffectSubscription(null, null, null, null);
29690
29688
  default:
29691
29689
  throw qError(18 /* serializeErrorCannotAllocate */, [typeId]);
@@ -29728,44 +29726,30 @@ var inflate = (container, target, typeId, data) => {
29728
29726
  task[_EFFECT_BACK_REF] = v[4];
29729
29727
  task.$state$ = v[5];
29730
29728
  break;
29731
- case 21 /* Resource */:
29732
- const [resolved, result2, effects] = data;
29733
- const resource = target;
29734
- if (resolved) {
29735
- resource.value = Promise.resolve(result2);
29736
- resource._resolved = result2;
29737
- resource._state = "resolved";
29738
- } else {
29739
- resource.value = Promise.reject(result2);
29740
- resource._error = result2;
29741
- resource._state = "rejected";
29742
- }
29743
- getStoreHandler(target).$effects$ = effects;
29744
- break;
29745
- case 22 /* Component */:
29729
+ case 21 /* Component */:
29746
29730
  target[SERIALIZABLE_STATE][0] = data[0];
29747
29731
  break;
29748
- case 28 /* Store */: {
29732
+ case 27 /* Store */: {
29749
29733
  const store = unwrapStore(target);
29750
29734
  const storeTarget = pendingStoreTargets.get(store);
29751
29735
  if (storeTarget) {
29752
29736
  pendingStoreTargets.delete(store);
29753
29737
  inflate(container, store, storeTarget.t, storeTarget.v);
29754
29738
  }
29755
- const [, flags, effects2] = data;
29739
+ const [, flags, effects] = data;
29756
29740
  const storeHandler = getStoreHandler(target);
29757
29741
  storeHandler.$flags$ = flags;
29758
- storeHandler.$effects$ = effects2;
29742
+ storeHandler.$effects$ = effects;
29759
29743
  break;
29760
29744
  }
29761
- case 23 /* Signal */: {
29745
+ case 22 /* Signal */: {
29762
29746
  const signal = target;
29763
29747
  const d2 = data;
29764
29748
  signal.$untrackedValue$ = d2[0];
29765
29749
  signal.$effects$ = new Set(d2.slice(1));
29766
29750
  break;
29767
29751
  }
29768
- case 24 /* WrappedSignal */: {
29752
+ case 23 /* WrappedSignal */: {
29769
29753
  const signal = target;
29770
29754
  const d2 = data;
29771
29755
  signal.$func$ = container.getSyncFn(d2[0]);
@@ -29779,7 +29763,7 @@ var inflate = (container, target, typeId, data) => {
29779
29763
  inflateWrappedSignalValue(signal);
29780
29764
  break;
29781
29765
  }
29782
- case 26 /* AsyncSignal */: {
29766
+ case 25 /* AsyncSignal */: {
29783
29767
  const asyncSignal = target;
29784
29768
  const d2 = data;
29785
29769
  asyncSignal.$computeQrl$ = d2[0];
@@ -29787,19 +29771,25 @@ var inflate = (container, target, typeId, data) => {
29787
29771
  asyncSignal.$effects$ = new Set(d2[2]);
29788
29772
  asyncSignal.$loadingEffects$ = new Set(d2[3]);
29789
29773
  asyncSignal.$errorEffects$ = new Set(d2[4]);
29790
- asyncSignal.$untrackedLoading$ = d2[5];
29791
- asyncSignal.$untrackedError$ = d2[6];
29792
- const hasValue = d2.length > 7;
29774
+ asyncSignal.$untrackedError$ = d2[5];
29775
+ const hasValue = d2.length > 6;
29793
29776
  if (hasValue) {
29794
- asyncSignal.$untrackedValue$ = d2[7];
29795
- asyncSignal.$promiseValue$ = d2[7];
29777
+ asyncSignal.$untrackedValue$ = d2[6];
29778
+ }
29779
+ if (asyncSignal.$untrackedValue$ !== NEEDS_COMPUTATION) {
29780
+ asyncSignal.$flags$ &= ~1 /* INVALID */;
29781
+ }
29782
+ asyncSignal.interval = d2[7] ?? 0;
29783
+ asyncSignal.$concurrency$ = d2[8] ?? 1;
29784
+ asyncSignal.$timeoutMs$ = d2[9] ?? 0;
29785
+ if (d2[10]) {
29786
+ asyncSignal.$flags$ |= 32 /* EAGER_CLEANUP */;
29796
29787
  }
29797
- asyncSignal.$flags$ |= 1 /* INVALID */;
29798
29788
  break;
29799
29789
  }
29800
29790
  // Inflating a SerializerSignal is the same as inflating a ComputedSignal
29801
- case 27 /* SerializerSignal */:
29802
- case 25 /* ComputedSignal */: {
29791
+ case 26 /* SerializerSignal */:
29792
+ case 24 /* ComputedSignal */: {
29803
29793
  const computed = target;
29804
29794
  const d2 = data;
29805
29795
  computed.$computeQrl$ = d2[0];
@@ -29813,11 +29803,9 @@ var inflate = (container, target, typeId, data) => {
29813
29803
  const hasValue = d2.length > 3;
29814
29804
  if (hasValue) {
29815
29805
  computed.$untrackedValue$ = d2[3];
29816
- if (typeId === 27 /* SerializerSignal */) {
29817
- computed.$flags$ |= 1 /* INVALID */;
29818
- }
29819
- } else {
29820
- computed.$flags$ |= 1 /* INVALID */;
29806
+ }
29807
+ if (typeId !== 26 /* SerializerSignal */ && computed.$untrackedValue$ !== NEEDS_COMPUTATION) {
29808
+ computed.$flags$ &= ~1 /* INVALID */;
29821
29809
  }
29822
29810
  break;
29823
29811
  }
@@ -29829,7 +29817,7 @@ var inflate = (container, target, typeId, data) => {
29829
29817
  }
29830
29818
  break;
29831
29819
  }
29832
- case 29 /* FormData */: {
29820
+ case 28 /* FormData */: {
29833
29821
  const formData = target;
29834
29822
  const d2 = data;
29835
29823
  for (let i2 = 0; i2 < d2.length; i2++) {
@@ -29837,7 +29825,7 @@ var inflate = (container, target, typeId, data) => {
29837
29825
  }
29838
29826
  break;
29839
29827
  }
29840
- case 30 /* JSXNode */: {
29828
+ case 29 /* JSXNode */: {
29841
29829
  const jsx2 = target;
29842
29830
  const [type, key, varProps, constProps, children, toSort] = data;
29843
29831
  jsx2.type = type;
@@ -29866,12 +29854,12 @@ var inflate = (container, target, typeId, data) => {
29866
29854
  }
29867
29855
  case 16 /* Promise */: {
29868
29856
  const promise = target;
29869
- const [resolved2, result3] = data;
29857
+ const [resolved, result2] = data;
29870
29858
  const [resolve, reject] = resolvers.get(promise);
29871
- if (resolved2) {
29872
- resolve(result3);
29859
+ if (resolved) {
29860
+ resolve(result2);
29873
29861
  } else {
29874
- reject(result3);
29862
+ reject(result2);
29875
29863
  }
29876
29864
  break;
29877
29865
  }
@@ -29883,7 +29871,7 @@ var inflate = (container, target, typeId, data) => {
29883
29871
  bytes[i++] = s.charCodeAt(0);
29884
29872
  }
29885
29873
  break;
29886
- case 31 /* PropsProxy */:
29874
+ case 30 /* PropsProxy */:
29887
29875
  const propsProxy = target;
29888
29876
  const d = data;
29889
29877
  let owner = d[0];
@@ -29894,13 +29882,13 @@ var inflate = (container, target, typeId, data) => {
29894
29882
  propsProxy[_OWNER] = owner;
29895
29883
  propsProxy[_PROPS_HANDLER].$effects$ = d[3];
29896
29884
  break;
29897
- case 32 /* SubscriptionData */: {
29885
+ case 31 /* SubscriptionData */: {
29898
29886
  const effectData = target;
29899
29887
  effectData.data.$scopedStyleIdPrefix$ = data[0];
29900
29888
  effectData.data.$isConst$ = data[1];
29901
29889
  break;
29902
29890
  }
29903
- case 33 /* EffectSubscription */: {
29891
+ case 32 /* EffectSubscription */: {
29904
29892
  const effectSub = target;
29905
29893
  const d2 = data;
29906
29894
  effectSub.consumer = d2[0];
@@ -30022,13 +30010,13 @@ var makeResolveFunction = (qrl, symbolFn) => {
30022
30010
  }
30023
30011
  }
30024
30012
  if (qrl.$chunk$ === "") {
30025
- isDev18 && assertDefined(qrl.$container$, "Sync QRL must have container element");
30013
+ isDev17 && assertDefined(qrl.$container$, "Sync QRL must have container element");
30026
30014
  const hash3 = qrl.$container$.$instanceHash$;
30027
30015
  const doc2 = qrl.$container$.element?.ownerDocument || document;
30028
30016
  const qFuncs2 = getQFuncs(doc2, hash3);
30029
30017
  return qrl.resolved = symbolRef = qFuncs2[Number(qrl.$symbol$)];
30030
30018
  }
30031
- if (isBrowser && qrl.$chunk$) {
30019
+ if (isBrowser2 && qrl.$chunk$) {
30032
30020
  preload(qrl.$chunk$, 1);
30033
30021
  }
30034
30022
  const start = now();
@@ -30126,7 +30114,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, captures) => {
30126
30114
  })
30127
30115
  );
30128
30116
  }
30129
- if (isBrowser && symbol) {
30117
+ if (isBrowser2 && symbol) {
30130
30118
  preload(symbol, 0.8);
30131
30119
  }
30132
30120
  return qrl;
@@ -30381,7 +30369,6 @@ var _typeIdNames = [
30381
30369
  "Map",
30382
30370
  "Uint8Array",
30383
30371
  "Task",
30384
- "Resource",
30385
30372
  "Component",
30386
30373
  "Signal",
30387
30374
  "WrappedSignal",
@@ -30820,7 +30807,7 @@ var DomContainer = class extends _SharedContainer {
30820
30807
  const vErrorDiv = vnode_createErrorDiv(journal, document, vHost, err);
30821
30808
  const insertHost = vnode_isElementVNode(vHost) ? vHostParent || vHost : vHost;
30822
30809
  const insertBefore = insertHost === vHost ? null : vHostNextSibling;
30823
- vnode_insertBefore(
30810
+ vnode_insertElementBefore(
30824
30811
  journal,
30825
30812
  insertHost,
30826
30813
  vErrorDiv,
@@ -30917,7 +30904,7 @@ var DomContainer = class extends _SharedContainer {
30917
30904
  }
30918
30905
  getSyncFn(id) {
30919
30906
  const fn = this.$qFuncs$[id];
30920
- isDev19 && assertTrue(typeof fn === "function", "Invalid reference: " + id);
30907
+ isDev18 && assertTrue(typeof fn === "function", "Invalid reference: " + id);
30921
30908
  return fn;
30922
30909
  }
30923
30910
  $appendStyle$(content, styleId, host, scoped) {
@@ -30960,10 +30947,10 @@ var DomContainer = class extends _SharedContainer {
30960
30947
  };
30961
30948
 
30962
30949
  // packages/qwik/src/core/use/use-locale.ts
30963
- import { isServer as isServer8 } from "@qwik.dev/core/build";
30950
+ import { isServer as isServer9 } from "@qwik.dev/core/build";
30964
30951
  var _locale = void 0;
30965
30952
  var localAsyncStore;
30966
- if (isServer8) {
30953
+ if (isServer9) {
30967
30954
  import("node:async_hooks").then((module) => {
30968
30955
  localAsyncStore = new module.AsyncLocalStorage();
30969
30956
  }).catch(() => {
@@ -31005,8 +30992,8 @@ var useInvokeContext = () => {
31005
30992
  if (!ctx || ctx.$event$ !== RenderEvent) {
31006
30993
  throw qError(10 /* useInvokeContext */);
31007
30994
  }
31008
- isDev20 && assertDefined(ctx.$hostElement$, `invoke: $hostElement$ must be defined`, ctx);
31009
- isDev20 && assertDefined(ctx.$effectSubscriber$, `invoke: $effectSubscriber$ must be defined`, ctx);
30995
+ isDev19 && assertDefined(ctx.$hostElement$, `invoke: $hostElement$ must be defined`, ctx);
30996
+ isDev19 && assertDefined(ctx.$effectSubscriber$, `invoke: $effectSubscriber$ must be defined`, ctx);
31010
30997
  return ctx;
31011
30998
  };
31012
30999
  function invoke(context, fn, ...args) {
@@ -31080,7 +31067,7 @@ var trackSignal = (fn, subscriber, property, container, data) => {
31080
31067
  try {
31081
31068
  trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data);
31082
31069
  trackInvocation.$container$ = container;
31083
- return invoke(trackInvocation, fn);
31070
+ return invokeApply(trackInvocation, fn);
31084
31071
  } finally {
31085
31072
  trackInvocation.$effectSubscriber$ = previousSubscriber;
31086
31073
  trackInvocation.$container$ = previousContainer;
@@ -31094,7 +31081,7 @@ var trackSignalAndAssignHost = (value, host, property, container, data) => {
31094
31081
  };
31095
31082
 
31096
31083
  // packages/qwik/src/core/reactive-primitives/impl/store.ts
31097
- import { isDev as isDev21, isServer as isServer9 } from "@qwik.dev/core/build";
31084
+ import { isDev as isDev20, isServer as isServer10 } from "@qwik.dev/core/build";
31098
31085
  var DEBUG7 = false;
31099
31086
  var log5 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
31100
31087
  var getStoreHandler = (value) => {
@@ -31103,12 +31090,6 @@ var getStoreHandler = (value) => {
31103
31090
  var getStoreTarget = (value) => {
31104
31091
  return value?.[STORE_TARGET] || null;
31105
31092
  };
31106
- var forceStoreEffects = (value, prop) => {
31107
- const handler = getStoreHandler(value);
31108
- if (handler) {
31109
- handler.force(prop);
31110
- }
31111
- };
31112
31093
  var unwrapStore = (value) => {
31113
31094
  return getStoreTarget(value) || value;
31114
31095
  };
@@ -31161,7 +31142,7 @@ var StoreHandler2 = class {
31161
31142
  }
31162
31143
  this.$container$ = ctx.$container$;
31163
31144
  } else {
31164
- isDev21 && assertTrue(
31145
+ isDev20 && assertTrue(
31165
31146
  !ctx.$container$ || ctx.$container$ === this.$container$,
31166
31147
  "Do not use signals across containers"
31167
31148
  );
@@ -31264,7 +31245,7 @@ function addStoreEffect(target, prop, store, effectSubscription) {
31264
31245
  }
31265
31246
  ensureContainsSubscription(effects, effectSubscription);
31266
31247
  ensureContainsBackRef(effectSubscription, target);
31267
- (import.meta.env.TEST ? !isDomContainer(store.$container$) : isServer9) && addQrlToSerializationCtx(effectSubscription, store.$container$);
31248
+ (import.meta.env.TEST ? !isDomContainer(store.$container$) : isServer10) && addQrlToSerializationCtx(effectSubscription, store.$container$);
31268
31249
  DEBUG7 && log5(
31269
31250
  "sub",
31270
31251
  pad(
@@ -31442,11 +31423,11 @@ ${prefix}]` : "[]";
31442
31423
  }
31443
31424
  const result2 = out.map((v, i) => `${prefix}${isRoot ? `${i} ` : ""}${v}`).join("\n");
31444
31425
  if (isRoot) {
31445
- const count2 = hasRaw ? "" : `(${JSON.stringify(state).length} chars)`;
31426
+ const count = hasRaw ? "" : `(${JSON.stringify(state).length} chars)`;
31446
31427
  hasRaw = false;
31447
31428
  return `
31448
31429
  ${result2}
31449
- ${count2}`;
31430
+ ${count}`;
31450
31431
  }
31451
31432
  return result2;
31452
31433
  };
@@ -31502,13 +31483,13 @@ function preprocessState(data, container) {
31502
31483
  }
31503
31484
 
31504
31485
  // packages/qwik/src/core/shared/serdes/serdes.public.ts
31505
- import { isDev as isDev22 } from "@qwik.dev/core/build";
31486
+ import { isDev as isDev21 } from "@qwik.dev/core/build";
31506
31487
  function getObjectById(id, stateData) {
31507
31488
  if (typeof id === "string") {
31508
31489
  id = parseInt(id, 10);
31509
31490
  return stateData[id];
31510
31491
  }
31511
- isDev22 && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`);
31492
+ isDev21 && assertTrue(id < stateData.length, `Invalid reference ${id} >= ${stateData.length}`);
31512
31493
  return stateData[id];
31513
31494
  }
31514
31495
 
@@ -31555,6 +31536,9 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
31555
31536
  });
31556
31537
  return value;
31557
31538
  }
31539
+ if (unwrapped.__brand) {
31540
+ return value;
31541
+ }
31558
31542
  if (isSerializableObject(unwrapped)) {
31559
31543
  for (const [key, item] of Object.entries(unwrapped)) {
31560
31544
  _verifySerializable(item, seen, ctx + "." + key);
@@ -31598,17 +31582,11 @@ var shouldSerialize = (obj) => {
31598
31582
  var fastSkipSerialize = (obj) => {
31599
31583
  return !!obj && (isObject(obj) || typeof obj === "function") && (NoSerializeSymbol in obj || noSerializeSet.has(obj));
31600
31584
  };
31601
- var noSerialize = (input) => {
31602
- if (isObject(input) && input !== null || typeof input === "function") {
31603
- noSerializeSet.add(input);
31604
- }
31605
- return input;
31606
- };
31607
31585
  var NoSerializeSymbol = /* @__PURE__ */ Symbol("noSerialize");
31608
31586
  var SerializerSymbol = /* @__PURE__ */ Symbol("serialize");
31609
31587
 
31610
31588
  // packages/qwik/src/core/reactive-primitives/utils.ts
31611
- import { isDev as isDev23, isServer as isServer10 } from "@qwik.dev/core/build";
31589
+ import { isDev as isDev22, isServer as isServer11 } from "@qwik.dev/core/build";
31612
31590
  var DEBUG8 = false;
31613
31591
  var log6 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
31614
31592
  var throwIfQRLNotResolved = (qrl) => {
@@ -31627,7 +31605,7 @@ var ensureContainsBackRef = (array, value) => {
31627
31605
  (array.backRef || (array.backRef = /* @__PURE__ */ new Set())).add(value);
31628
31606
  };
31629
31607
  var addQrlToSerializationCtx = (effectSubscriber, container) => {
31630
- if (container) {
31608
+ if (container?.serializationCtx) {
31631
31609
  const effect = effectSubscriber.consumer;
31632
31610
  const property = effectSubscriber.property;
31633
31611
  let qrl = null;
@@ -31644,21 +31622,21 @@ var addQrlToSerializationCtx = (effectSubscriber, container) => {
31644
31622
  }
31645
31623
  };
31646
31624
  var scheduleEffects = (container, signal, effects) => {
31647
- const isBrowser4 = import.meta.env.TEST ? !isServerPlatform() : !isServer10;
31625
+ const isBrowser5 = import.meta.env.TEST ? !isServerPlatform() : !isServer11;
31648
31626
  if (effects) {
31649
31627
  const scheduleEffect = (effectSubscription) => {
31650
31628
  const consumer = effectSubscription.consumer;
31651
31629
  const property = effectSubscription.property;
31652
- isDev23 && assertDefined(container, "Container must be defined.");
31630
+ isDev22 && assertDefined(container, "Container must be defined.");
31653
31631
  if (isTask(consumer)) {
31654
- consumer.$flags$ |= 8 /* DIRTY */;
31632
+ consumer.$flags$ |= 4 /* DIRTY */;
31655
31633
  markVNodeDirty(container, consumer.$el$, 1 /* TASKS */);
31656
31634
  } else if (consumer instanceof SignalImpl) {
31657
31635
  consumer.invalidate();
31658
31636
  } else if (property === ":" /* COMPONENT */) {
31659
31637
  markVNodeDirty(container, consumer, 4 /* COMPONENT */);
31660
31638
  } else if (property === "." /* VNODE */) {
31661
- if (isBrowser4) {
31639
+ if (isBrowser5) {
31662
31640
  setNodeDiffPayload(consumer, signal);
31663
31641
  markVNodeDirty(container, consumer, 2 /* NODE_DIFF */);
31664
31642
  }
@@ -31671,7 +31649,7 @@ var scheduleEffects = (container, signal, effects) => {
31671
31649
  scopedStyleIdPrefix: data.$scopedStyleIdPrefix$,
31672
31650
  value: signal
31673
31651
  };
31674
- if (isBrowser4) {
31652
+ if (isBrowser5) {
31675
31653
  setNodePropData(consumer, property, payload);
31676
31654
  } else {
31677
31655
  const node = consumer;
@@ -31821,7 +31799,7 @@ var fastGetter = (prototype, name) => {
31821
31799
 
31822
31800
  // packages/qwik/src/core/client/vnode-utils.ts
31823
31801
  var vnode_newElement = (element, elementName, key = null) => {
31824
- isDev24 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
31802
+ isDev23 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
31825
31803
  const vnode = new ElementVNode(
31826
31804
  key,
31827
31805
  1 /* Element */ | 8 /* Inflated */ | -1 << 11 /* shift */,
@@ -31839,7 +31817,7 @@ var vnode_newElement = (element, elementName, key = null) => {
31839
31817
  return vnode;
31840
31818
  };
31841
31819
  var vnode_newUnMaterializedElement = (element) => {
31842
- isDev24 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
31820
+ isDev23 && assertEqual(fastNodeType(element), 1, "Expecting element node.");
31843
31821
  const vnode = new ElementVNode(
31844
31822
  null,
31845
31823
  1 /* Element */ | -1 << 11 /* shift */,
@@ -31857,7 +31835,7 @@ var vnode_newUnMaterializedElement = (element) => {
31857
31835
  return vnode;
31858
31836
  };
31859
31837
  var vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
31860
- isDev24 && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
31838
+ isDev23 && sharedTextNode && assertEqual(fastNodeType(sharedTextNode), 3, "Expecting text node.");
31861
31839
  const vnode = new TextVNode(
31862
31840
  4 /* Text */ | -1 << 11 /* shift */,
31863
31841
  // Flag
@@ -31889,10 +31867,10 @@ var vnode_newText = (textNode, textContent) => {
31889
31867
  textContent
31890
31868
  // Text Content
31891
31869
  );
31892
- isDev24 && assertEqual(fastNodeType(textNode), 3, "Expecting text node.");
31893
- isDev24 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
31894
- isDev24 && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
31895
- isDev24 && assertFalse(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
31870
+ isDev23 && assertEqual(fastNodeType(textNode), 3, "Expecting text node.");
31871
+ isDev23 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
31872
+ isDev23 && assertTrue(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
31873
+ isDev23 && assertFalse(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
31896
31874
  return vnode;
31897
31875
  };
31898
31876
  var vnode_newVirtual = () => {
@@ -31907,9 +31885,9 @@ var vnode_newVirtual = () => {
31907
31885
  null,
31908
31886
  null
31909
31887
  );
31910
- isDev24 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
31911
- isDev24 && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
31912
- isDev24 && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
31888
+ isDev23 && assertFalse(vnode_isElementVNode(vnode), "Incorrect format of TextVNode.");
31889
+ isDev23 && assertFalse(vnode_isTextVNode(vnode), "Incorrect format of TextVNode.");
31890
+ isDev23 && assertTrue(vnode_isVirtualVNode(vnode), "Incorrect format of TextVNode.");
31913
31891
  return vnode;
31914
31892
  };
31915
31893
  var vnode_isVNode = (vNode) => {
@@ -31919,12 +31897,12 @@ var vnode_isElementVNode = (vNode) => {
31919
31897
  return (vNode.flags & 1 /* Element */) === 1 /* Element */;
31920
31898
  };
31921
31899
  var vnode_isElementOrTextVNode = (vNode) => {
31922
- isDev24 && assertDefined(vNode, "Missing vNode");
31900
+ isDev23 && assertDefined(vNode, "Missing vNode");
31923
31901
  const flag = vNode.flags;
31924
31902
  return (flag & 5 /* ELEMENT_OR_TEXT_MASK */) !== 0;
31925
31903
  };
31926
31904
  var vnode_isMaterialized = (vNode) => {
31927
- isDev24 && assertDefined(vNode, "Missing vNode");
31905
+ isDev23 && assertDefined(vNode, "Missing vNode");
31928
31906
  const flag = vNode.flags;
31929
31907
  return (flag & 1 /* Element */) === 1 /* Element */ && vNode.firstChild !== void 0 && vNode.lastChild !== void 0;
31930
31908
  };
@@ -31935,26 +31913,26 @@ var vnode_isVirtualVNode = (vNode) => {
31935
31913
  return (vNode.flags & 2 /* Virtual */) === 2 /* Virtual */;
31936
31914
  };
31937
31915
  var vnode_isProjection = (vNode) => {
31938
- isDev24 && assertDefined(vNode, "Missing vNode");
31916
+ isDev23 && assertDefined(vNode, "Missing vNode");
31939
31917
  const flag = vNode.flags;
31940
31918
  return (flag & 2 /* Virtual */) === 2 /* Virtual */ && vnode_getProp(vNode, QSlot, null) !== null;
31941
31919
  };
31942
31920
  var ensureTextVNode = (vNode) => {
31943
- isDev24 && assertTrue(
31921
+ isDev23 && assertTrue(
31944
31922
  vnode_isTextVNode(vNode),
31945
31923
  "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)
31946
31924
  );
31947
31925
  return vNode;
31948
31926
  };
31949
31927
  var ensureElementOrVirtualVNode = (vNode) => {
31950
- isDev24 && assertDefined(vNode, "Missing vNode");
31951
- isDev24 && assertTrue(
31928
+ isDev23 && assertDefined(vNode, "Missing vNode");
31929
+ isDev23 && assertTrue(
31952
31930
  (vNode.flags & 3 /* ELEMENT_OR_VIRTUAL_MASK */) !== 0,
31953
31931
  "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode)
31954
31932
  );
31955
31933
  };
31956
31934
  var ensureElementVNode = (vNode) => {
31957
- isDev24 && assertTrue(
31935
+ isDev23 && assertTrue(
31958
31936
  vnode_isElementVNode(vNode),
31959
31937
  "Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)
31960
31938
  );
@@ -32068,6 +32046,20 @@ function registerQrlHandlers(attr, key, container, element) {
32068
32046
  });
32069
32047
  (element._qDispatch || (element._qDispatch = {}))[scopedKebabName] = handlers;
32070
32048
  }
32049
+ function vnode_walkDirectChildren(journal, vParent, callback) {
32050
+ let vNode = vnode_getFirstChild(vParent);
32051
+ while (vNode) {
32052
+ if (vnode_isTextVNode(vNode)) {
32053
+ vnode_ensureTextInflated(journal, vNode);
32054
+ callback(vNode, vParent);
32055
+ } else if (vnode_isElementVNode(vNode)) {
32056
+ callback(vNode, vParent);
32057
+ } else {
32058
+ vnode_walkDirectChildren(journal, vNode, callback);
32059
+ }
32060
+ vNode = vNode.nextSibling;
32061
+ }
32062
+ }
32071
32063
  function vnode_walkVNode(vNode, callback) {
32072
32064
  let vCursor = vNode;
32073
32065
  if (vnode_isTextVNode(vNode)) {
@@ -32108,37 +32100,15 @@ function vnode_walkVNode(vNode, callback) {
32108
32100
  }
32109
32101
  } while (true);
32110
32102
  }
32111
- function vnode_getDOMChildNodes(journal, root, isVNode = false, childNodes = []) {
32112
- if (vnode_isElementOrTextVNode(root)) {
32113
- if (vnode_isTextVNode(root)) {
32114
- vnode_ensureTextInflated(journal, root);
32115
- }
32116
- childNodes.push(isVNode ? root : vnode_getNode(root));
32117
- return childNodes;
32118
- }
32119
- let vNode = vnode_getFirstChild(root);
32120
- while (vNode) {
32121
- if (vnode_isElementVNode(vNode)) {
32122
- childNodes.push(isVNode ? vNode : vnode_getNode(vNode));
32123
- } else if (vnode_isTextVNode(vNode)) {
32124
- vnode_ensureTextInflated(journal, vNode);
32125
- childNodes.push(isVNode ? vNode : vnode_getNode(vNode));
32126
- } else {
32127
- isVNode ? vnode_getDOMChildNodes(journal, vNode, true, childNodes) : vnode_getDOMChildNodes(journal, vNode, false, childNodes);
32128
- }
32129
- vNode = vNode.nextSibling;
32130
- }
32131
- return childNodes;
32132
- }
32133
32103
  function vnode_getDOMContainer(vNode) {
32134
32104
  let cursor = vNode;
32135
32105
  while (cursor) {
32136
32106
  if (vnode_isElementVNode(cursor)) {
32137
- try {
32138
- return getDomContainer(cursor.node);
32139
- } catch {
32107
+ const qContainerElement = _getQContainerElement(cursor.node);
32108
+ if (!qContainerElement) {
32140
32109
  return null;
32141
32110
  }
32111
+ return getDomContainerFromQContainerElement(qContainerElement);
32142
32112
  }
32143
32113
  cursor = cursor.parent;
32144
32114
  }
@@ -32198,7 +32168,7 @@ var vnode_ensureTextInflated = (journal, vnode) => {
32198
32168
  const flags = textVNode.flags;
32199
32169
  if ((flags & 8 /* Inflated */) === 0) {
32200
32170
  const parentNode = vnode_getDomParent(vnode, true);
32201
- isDev24 && assertDefined(parentNode, "Missing parent node.");
32171
+ isDev23 && assertDefined(parentNode, "Missing parent node.");
32202
32172
  const sharedTextNode = textVNode.node;
32203
32173
  const doc2 = fastOwnerDocument(parentNode);
32204
32174
  let vCursor = vnode_getDomSibling(vnode, false, true);
@@ -32247,7 +32217,7 @@ var vnode_locate = (rootVNode, id) => {
32247
32217
  let elementOffset = -1;
32248
32218
  let refElement;
32249
32219
  if (typeof id === "string") {
32250
- isDev24 && assertDefined(qVNodeRefs, "Missing qVNodeRefs.");
32220
+ isDev23 && assertDefined(qVNodeRefs, "Missing qVNodeRefs.");
32251
32221
  elementOffset = parseInt(id);
32252
32222
  refElement = qVNodeRefs.get(elementOffset);
32253
32223
  } else {
@@ -32257,9 +32227,9 @@ var vnode_locate = (rootVNode, id) => {
32257
32227
  return vNode2;
32258
32228
  }
32259
32229
  }
32260
- isDev24 && assertDefined(refElement, "Missing refElement.");
32230
+ isDev23 && assertDefined(refElement, "Missing refElement.");
32261
32231
  if (!vnode_isVNode(refElement)) {
32262
- isDev24 && assertTrue(
32232
+ isDev23 && assertTrue(
32263
32233
  containerElement2.contains(refElement),
32264
32234
  `Couldn't find the element inside the container while locating the VNode.`
32265
32235
  );
@@ -32303,10 +32273,10 @@ var vnode_locate = (rootVNode, id) => {
32303
32273
  };
32304
32274
  var vnode_getChildWithIdx = (vNode, childIdx) => {
32305
32275
  let child = vnode_getFirstChild(vNode);
32306
- isDev24 && assertDefined(child, "Missing child.");
32276
+ isDev23 && assertDefined(child, "Missing child.");
32307
32277
  while (child.flags >>> 11 /* shift */ !== childIdx) {
32308
32278
  child = child.nextSibling;
32309
- isDev24 && assertDefined(child, "Missing child.");
32279
+ isDev23 && assertDefined(child, "Missing child.");
32310
32280
  }
32311
32281
  return child;
32312
32282
  };
@@ -32314,7 +32284,7 @@ var vNodeStack = [];
32314
32284
  var vnode_getVNodeForChildNode = (vNode, childElement) => {
32315
32285
  ensureElementVNode(vNode);
32316
32286
  let child = vnode_getFirstChild(vNode);
32317
- isDev24 && assertDefined(child, "Missing child.");
32287
+ isDev23 && assertDefined(child, "Missing child.");
32318
32288
  while (child && (child instanceof ElementVNode ? child.node !== childElement : true)) {
32319
32289
  if (vnode_isVirtualVNode(child)) {
32320
32290
  const next = child.nextSibling;
@@ -32333,13 +32303,13 @@ var vnode_getVNodeForChildNode = (vNode, childElement) => {
32333
32303
  child = next || vNodeStack.pop();
32334
32304
  }
32335
32305
  }
32336
- isDev24 && assertDefined(child, "Missing child.");
32306
+ isDev23 && assertDefined(child, "Missing child.");
32337
32307
  }
32338
32308
  while (vNodeStack.length) {
32339
32309
  vNodeStack.pop();
32340
32310
  }
32341
32311
  ensureElementVNode(child);
32342
- isDev24 && assertEqual(child.node, childElement, "Child not found.");
32312
+ isDev23 && assertEqual(child.node, childElement, "Child not found.");
32343
32313
  return child;
32344
32314
  };
32345
32315
  var indexOfAlphanumeric = (id, length) => {
@@ -32360,9 +32330,17 @@ var vnode_createErrorDiv = (journal, document2, host, err) => {
32360
32330
  }
32361
32331
  errorDiv.setAttribute("q:key", "_error_");
32362
32332
  const vErrorDiv = vnode_newElement(errorDiv, "errored-host");
32363
- vnode_getDOMChildNodes(journal, host, true).forEach((child) => {
32364
- vnode_insertBefore(journal, vErrorDiv, child, null);
32365
- });
32333
+ if (vnode_isElementOrTextVNode(host)) {
32334
+ vnode_insertBefore(journal, vErrorDiv, host, null);
32335
+ } else {
32336
+ const children = [];
32337
+ vnode_walkDirectChildren(journal, host, (vNode) => {
32338
+ children.push(vNode);
32339
+ });
32340
+ for (let i = 0; i < children.length; i++) {
32341
+ vnode_insertBefore(journal, vErrorDiv, children[i], null);
32342
+ }
32343
+ }
32366
32344
  return vErrorDiv;
32367
32345
  };
32368
32346
  var vnode_journalToString = (journal) => {
@@ -32419,9 +32397,10 @@ var vnode_journalToString = (journal) => {
32419
32397
  lines.push("END JOURNAL");
32420
32398
  return lines.join("\n");
32421
32399
  };
32422
- var vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
32400
+ var vnode_insertElementBefore = (journal, parent, newChild, insertBefore) => {
32423
32401
  ensureElementOrVirtualVNode(parent);
32424
- if (vnode_isElementVNode(parent)) {
32402
+ const parentIsElement = vnode_isElementVNode(parent);
32403
+ if (parentIsElement) {
32425
32404
  ensureMaterialized(parent);
32426
32405
  }
32427
32406
  const newChildCurrentParent = newChild.parent;
@@ -32432,58 +32411,133 @@ var vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
32432
32411
  insertBefore = null;
32433
32412
  }
32434
32413
  }
32435
- const domParentVNode = vnode_getDomParentVNode(parent, false);
32436
- const parentNode = domParentVNode && domParentVNode.node;
32437
- let domChildren = null;
32438
- if (domParentVNode) {
32439
- domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(
32414
+ vnode_unlinkFromOldParent(journal, newChildCurrentParent, parent, newChild);
32415
+ const childNode = newChild.node;
32416
+ const parentIsDeleted = parent.flags & 32 /* Deleted */;
32417
+ const parentNode = parentIsElement ? parent.node : vnode_getDomParent(parent, false);
32418
+ if (parentNode && !parentIsDeleted) {
32419
+ addVNodeOperation(
32440
32420
  journal,
32441
- domParentVNode,
32442
- newChild
32421
+ createInsertOrMoveOperation(
32422
+ childNode,
32423
+ parentNode,
32424
+ vnode_findInsertBefore(journal, parent, insertBefore)?.node ?? null
32425
+ )
32443
32426
  );
32444
32427
  }
32445
- if (newChildCurrentParent && (newChild.previousSibling || newChild.nextSibling || newChildCurrentParent !== parent)) {
32446
- vnode_remove(journal, newChildCurrentParent, newChild, false);
32428
+ vnode_connectSiblings(parent, newChild, insertBefore);
32429
+ if (parentIsDeleted) {
32430
+ newChild.flags |= 32 /* Deleted */;
32447
32431
  }
32448
- const parentIsDeleted = parent.flags & 32 /* Deleted */;
32449
- let adjustedInsertBefore = null;
32450
- if (!parentIsDeleted) {
32451
- if (insertBefore == null) {
32452
- if (vnode_isVirtualVNode(parent)) {
32453
- adjustedInsertBefore = vnode_getDomSibling(parent, true, false);
32454
- }
32455
- } else if (vnode_isVirtualVNode(insertBefore)) {
32456
- adjustedInsertBefore = vnode_getDomSibling(insertBefore, true, true);
32432
+ };
32433
+ var vnode_insertVirtualBefore = (journal, parent, newChild, insertBefore) => {
32434
+ ensureElementOrVirtualVNode(parent);
32435
+ const parentIsElement = vnode_isElementVNode(parent);
32436
+ if (parentIsElement) {
32437
+ ensureMaterialized(parent);
32438
+ }
32439
+ const newChildCurrentParent = newChild.parent;
32440
+ if (newChild === insertBefore) {
32441
+ if (newChildCurrentParent) {
32442
+ return;
32457
32443
  } else {
32458
- adjustedInsertBefore = insertBefore;
32444
+ insertBefore = null;
32459
32445
  }
32460
- adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore);
32461
- if (domChildren && domChildren.length) {
32462
- for (const child of domChildren) {
32446
+ }
32447
+ vnode_unlinkFromOldParent(journal, newChildCurrentParent, parent, newChild);
32448
+ const parentIsDeleted = parent.flags & 32 /* Deleted */;
32449
+ const domParentVNode = parentIsElement ? parent : vnode_getDomParentVNode(parent, false);
32450
+ const parentNode = domParentVNode?.node;
32451
+ const adjustedInsertBefore = vnode_findInsertBefore(journal, parent, insertBefore);
32452
+ const adjustedInsertBeforeNode = adjustedInsertBefore?.node ?? null;
32453
+ const isProjection = vnode_isProjection(newChild);
32454
+ if (isProjection && domParentVNode && (domParentVNode.flags & 1536 /* NAMESPACE_MASK */) !== 0) {
32455
+ const domParentVNode2 = vnode_getDomParentVNode(parent, false);
32456
+ const adjustedInsertBeforeNode2 = vnode_findInsertBefore(journal, parent, insertBefore)?.node ?? null;
32457
+ const { elementNamespace, elementNamespaceFlag } = getNewElementNamespaceData(
32458
+ domParentVNode2,
32459
+ newChild
32460
+ );
32461
+ vnode_walkDirectChildren(journal, newChild, (vNode) => {
32462
+ if (vnode_isTextVNode(vNode)) {
32463
32463
  addVNodeOperation(
32464
32464
  journal,
32465
- createInsertOrMoveOperation(child.node, parentNode, vnode_getNode(adjustedInsertBefore))
32465
+ createInsertOrMoveOperation(vNode.node, parentNode, adjustedInsertBeforeNode2)
32466
+ );
32467
+ } else {
32468
+ if ((vNode.flags & 1536 /* NAMESPACE_MASK */) !== elementNamespaceFlag) {
32469
+ const newChildElement = vnode_cloneElementWithNamespace(
32470
+ vNode,
32471
+ domParentVNode2,
32472
+ elementNamespace,
32473
+ elementNamespaceFlag
32474
+ );
32475
+ if (newChildElement) {
32476
+ vNode.node = newChildElement;
32477
+ }
32478
+ }
32479
+ addVNodeOperation(
32480
+ journal,
32481
+ createInsertOrMoveOperation(vNode.node, parentNode, adjustedInsertBeforeNode2)
32466
32482
  );
32467
32483
  }
32484
+ });
32485
+ } else if (
32486
+ // for projection there can be no parent node
32487
+ parentNode && !parentIsDeleted
32488
+ ) {
32489
+ vnode_walkDirectChildren(journal, newChild, (vNode) => {
32490
+ addVNodeOperation(
32491
+ journal,
32492
+ createInsertOrMoveOperation(vNode.node, parentNode, adjustedInsertBeforeNode)
32493
+ );
32494
+ });
32495
+ }
32496
+ vnode_connectSiblings(parent, newChild, insertBefore);
32497
+ if (parentIsDeleted) {
32498
+ newChild.flags |= 32 /* Deleted */;
32499
+ }
32500
+ };
32501
+ var vnode_findInsertBefore = (journal, parent, insertBefore) => {
32502
+ let adjustedInsertBefore = null;
32503
+ if (insertBefore == null) {
32504
+ if (vnode_isVirtualVNode(parent)) {
32505
+ adjustedInsertBefore = vnode_getDomSibling(parent, true, false);
32468
32506
  }
32507
+ } else if (vnode_isVirtualVNode(insertBefore)) {
32508
+ adjustedInsertBefore = vnode_getDomSibling(insertBefore, true, true);
32509
+ } else {
32510
+ adjustedInsertBefore = insertBefore;
32469
32511
  }
32470
- const vNext = insertBefore;
32512
+ adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore);
32513
+ return adjustedInsertBefore;
32514
+ };
32515
+ var vnode_connectSiblings = (parent, vNode, vNext) => {
32471
32516
  const vPrevious = vNext ? vNext.previousSibling : parent.lastChild;
32472
32517
  if (vNext) {
32473
- vNext.previousSibling = newChild;
32518
+ vNext.previousSibling = vNode;
32474
32519
  } else {
32475
- parent.lastChild = newChild;
32520
+ parent.lastChild = vNode;
32476
32521
  }
32477
32522
  if (vPrevious) {
32478
- vPrevious.nextSibling = newChild;
32523
+ vPrevious.nextSibling = vNode;
32479
32524
  } else {
32480
- parent.firstChild = newChild;
32525
+ parent.firstChild = vNode;
32481
32526
  }
32482
- newChild.previousSibling = vPrevious;
32483
- newChild.nextSibling = vNext;
32484
- newChild.parent = parent;
32485
- if (parentIsDeleted) {
32486
- newChild.flags |= 32 /* Deleted */;
32527
+ vNode.previousSibling = vPrevious;
32528
+ vNode.nextSibling = vNext;
32529
+ vNode.parent = parent;
32530
+ };
32531
+ var vnode_unlinkFromOldParent = (journal, currentParent, newParent, newChild) => {
32532
+ if (currentParent && (newChild.previousSibling || newChild.nextSibling || currentParent !== newParent)) {
32533
+ vnode_remove(journal, currentParent, newChild, false);
32534
+ }
32535
+ };
32536
+ var vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
32537
+ if (vnode_isElementOrTextVNode(newChild)) {
32538
+ vnode_insertElementBefore(journal, parent, newChild, insertBefore);
32539
+ } else {
32540
+ vnode_insertVirtualBefore(journal, parent, newChild, insertBefore);
32487
32541
  }
32488
32542
  };
32489
32543
  var vnode_getDomParent = (vnode, includeProjection) => {
@@ -32497,21 +32551,21 @@ var vnode_getDomParentVNode = (vnode, includeProjection) => {
32497
32551
  return vnode;
32498
32552
  };
32499
32553
  var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
32500
- isDev24 && assertEqual(vParent, vToRemove.parent, "Parent mismatch.");
32554
+ isDev23 && assertEqual(vParent, vToRemove.parent, "Parent mismatch.");
32501
32555
  if (vnode_isTextVNode(vToRemove)) {
32502
32556
  vnode_ensureTextInflated(journal, vToRemove);
32503
32557
  }
32504
32558
  if (removeDOM) {
32505
- const domParent = vnode_getDomParent(vParent, false);
32506
32559
  const isInnerHTMLParent = vnode_getProp(vParent, dangerouslySetInnerHTML, null) !== null;
32507
32560
  if (isInnerHTMLParent) {
32508
32561
  return;
32509
32562
  }
32510
- const children = vnode_getDOMChildNodes(journal, vToRemove, true);
32511
- if (domParent && children.length) {
32512
- for (const child of children) {
32513
- addVNodeOperation(journal, createDeleteOperation(child.node));
32514
- }
32563
+ if (vnode_isElementOrTextVNode(vToRemove)) {
32564
+ addVNodeOperation(journal, createDeleteOperation(vToRemove.node));
32565
+ } else {
32566
+ vnode_walkDirectChildren(journal, vToRemove, (vNode) => {
32567
+ addVNodeOperation(journal, createDeleteOperation(vNode.node));
32568
+ });
32515
32569
  }
32516
32570
  }
32517
32571
  const vPrevious = vToRemove.previousSibling;
@@ -32530,18 +32584,15 @@ var vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
32530
32584
  vToRemove.nextSibling = null;
32531
32585
  };
32532
32586
  var vnode_truncate = (journal, vParent, vDelete, removeDOM = true) => {
32533
- isDev24 && assertDefined(vDelete, "Missing vDelete.");
32587
+ isDev23 && assertDefined(vDelete, "Missing vDelete.");
32534
32588
  const parent = vnode_getDomParent(vParent, true);
32535
32589
  if (parent && removeDOM) {
32536
- if (vnode_isElementVNode(vParent)) {
32590
+ if (vnode_isElementOrTextVNode(vParent)) {
32537
32591
  addVNodeOperation(journal, createRemoveAllChildrenOperation(vParent.node));
32538
32592
  } else {
32539
- const children = vnode_getDOMChildNodes(journal, vParent, true);
32540
- if (children.length) {
32541
- for (const child of children) {
32542
- addVNodeOperation(journal, createDeleteOperation(child.node));
32543
- }
32544
- }
32593
+ vnode_walkDirectChildren(journal, vParent, (vNode) => {
32594
+ addVNodeOperation(journal, createDeleteOperation(vNode.node));
32595
+ });
32545
32596
  }
32546
32597
  }
32547
32598
  const vPrevious = vDelete.previousSibling;
@@ -32627,8 +32678,8 @@ var ensureMaterialized = (vnode) => {
32627
32678
  vFirstChild = vnode_materialize(vParent);
32628
32679
  }
32629
32680
  }
32630
- isDev24 && assertTrue(vParent.firstChild !== void 0, "Did not materialize.");
32631
- isDev24 && assertTrue(vParent.lastChild !== void 0, "Did not materialize.");
32681
+ isDev23 && assertTrue(vParent.firstChild !== void 0, "Did not materialize.");
32682
+ isDev23 && assertTrue(vParent.lastChild !== void 0, "Did not materialize.");
32632
32683
  return vFirstChild;
32633
32684
  };
32634
32685
  var _fastHasAttribute = null;
@@ -32803,7 +32854,7 @@ var materializeFromDOM = (vParent, firstChild, vData) => {
32803
32854
  }
32804
32855
  const id = consumeValue();
32805
32856
  container.$setRawState$(parseInt(id), vParent);
32806
- isDev24 && vnode_setProp(vParent, ELEMENT_ID, id);
32857
+ isDev23 && vnode_setProp(vParent, ELEMENT_ID, id);
32807
32858
  } else if (peek() === VNodeDataChar.BACK_REFS) {
32808
32859
  if (!container) {
32809
32860
  container = getDomContainer(vParent.node);
@@ -32879,7 +32930,7 @@ var vnode_getAttrKeys = (container, vnode) => {
32879
32930
  const keys = [];
32880
32931
  const props = vnode.props;
32881
32932
  if (props) {
32882
- for (const key of Object.keys(props)) {
32933
+ for (const key in props) {
32883
32934
  if (!key.startsWith(Q_PROPS_SEPARATOR)) {
32884
32935
  keys.push(key);
32885
32936
  }
@@ -32908,7 +32959,13 @@ var vnode_getNode = (vnode) => {
32908
32959
  }
32909
32960
  return vnode.node;
32910
32961
  };
32911
- function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false, colorize = true, container = this && vnode_getDOMContainer(this)) {
32962
+ function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings = false, colorize = true, container = null) {
32963
+ if (this && !container) {
32964
+ try {
32965
+ container = vnode_getDOMContainer(this);
32966
+ } catch {
32967
+ }
32968
+ }
32912
32969
  let vnode = this;
32913
32970
  if (depth === 0) {
32914
32971
  return "...";
@@ -32931,12 +32988,14 @@ function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings
32931
32988
  if (vnode.dirty) {
32932
32989
  attrs.push(` dirty:${vnode.dirty}`);
32933
32990
  }
32934
- vnode_getAttrKeys(container, vnode).forEach((key) => {
32935
- if (key !== DEBUG_TYPE && key !== debugStyleScopeIdPrefixAttr) {
32936
- const value = vnode_getProp(vnode, key, null);
32937
- attrs.push(" " + key + "=" + qwikDebugToString(value));
32938
- }
32939
- });
32991
+ if (container) {
32992
+ vnode_getAttrKeys(container, vnode).forEach((key) => {
32993
+ if (key !== DEBUG_TYPE && key !== debugStyleScopeIdPrefixAttr) {
32994
+ const value = vnode_getProp(vnode, key, null);
32995
+ attrs.push(" " + key + "=" + qwikDebugToString(value));
32996
+ }
32997
+ });
32998
+ }
32940
32999
  const name = (colorize ? NAME_COL_PREFIX : "") + (VirtualTypeName[vnode_getProp(vnode, DEBUG_TYPE, null) || "V" /* Virtual */] || VirtualTypeName["V" /* Virtual */]) + (colorize ? NAME_COL_SUFFIX : "");
32941
33000
  strings.push("<" + name + attrs.join("") + ">");
32942
33001
  const child = vnode_getFirstChild(vnode);
@@ -32956,7 +33015,7 @@ function vnode_toString(depth = 20, offset = "", materialize2 = false, siblings
32956
33015
  if (vnode.dirtyChildren) {
32957
33016
  attrs.push(` dirtyChildren[${vnode.dirtyChildren.length}]`);
32958
33017
  }
32959
- const keys = vnode_getAttrKeys(container, vnode);
33018
+ const keys = container ? vnode_getAttrKeys(container, vnode) : [];
32960
33019
  for (const key of keys) {
32961
33020
  const value = vnode_getProp(vnode, key, null);
32962
33021
  attrs.push(" " + key + "=" + qwikDebugToString(value));
@@ -33064,7 +33123,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
33064
33123
  }
33065
33124
  const id = consumeValue();
33066
33125
  container.$setRawState$(parseInt(id), vParent);
33067
- isDev24 && vnode_setProp(vParent, ELEMENT_ID, id);
33126
+ isDev23 && vnode_setProp(vParent, ELEMENT_ID, id);
33068
33127
  } else if (peek() === VNodeDataChar.PROPS) {
33069
33128
  vnode_setProp(vParent, ELEMENT_PROPS, consumeValue());
33070
33129
  } else if (peek() === VNodeDataChar.KEY) {
@@ -33143,8 +33202,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
33143
33202
  if (!container) {
33144
33203
  container = getDomContainer(element);
33145
33204
  }
33146
- for (const component of components) {
33147
- container.ensureProjectionResolved(component);
33205
+ for (let i = 0; i < components.length; i++) {
33206
+ container.ensureProjectionResolved(components[i]);
33148
33207
  }
33149
33208
  components = null;
33150
33209
  }
@@ -33871,7 +33930,10 @@ function diffJsxVNodeChildren(received, expected, path, container, isSsr, diffs)
33871
33930
  `${path.join(" > ")} expecting ${expectedChildren.length} children but was ${receivedChildren.length}`
33872
33931
  );
33873
33932
  diffs.push("EXPECTED", jsxToHTML(expected, " "));
33874
- diffs.push("RECEIVED", received.toString());
33933
+ diffs.push(
33934
+ "RECEIVED",
33935
+ vnode_toString.call(received, 20, " ", true, false, false, container)
33936
+ );
33875
33937
  }
33876
33938
  path.pop();
33877
33939
  }
@@ -34373,17 +34435,17 @@ import { fileURLToPath as fileURLToPath2 } from "url";
34373
34435
  import { expect as expect2 } from "vitest";
34374
34436
 
34375
34437
  // packages/qwik/src/core/preloader/queue.ts
34376
- import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
34438
+ import { isBrowser as isBrowser4 } from "@qwik.dev/core/build";
34377
34439
 
34378
34440
  // packages/qwik/src/core/preloader/constants.ts
34379
- import { isBrowser as isBrowser2 } from "@qwik.dev/core/build";
34380
- var doc = isBrowser2 ? document : void 0;
34441
+ import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
34442
+ var doc = isBrowser3 ? document : void 0;
34381
34443
  var config = {
34382
34444
  $DEBUG$: false,
34383
34445
  $maxIdlePreloads$: 25,
34384
34446
  $invPreloadProbability$: 0.65
34385
34447
  };
34386
- var rel = isBrowser2 && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
34448
+ var rel = isBrowser3 && doc.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
34387
34449
  var loadStart = Date.now();
34388
34450
  var isJSRegex = /\.[mc]?js$/;
34389
34451
 
@@ -34630,11 +34692,11 @@ var preload2 = (name, probability) => {
34630
34692
  } else {
34631
34693
  handleBundle(name, inverseProbability);
34632
34694
  }
34633
- if (isBrowser3) {
34695
+ if (isBrowser4) {
34634
34696
  trigger2();
34635
34697
  }
34636
34698
  };
34637
- if (isBrowser3) {
34699
+ if (isBrowser4) {
34638
34700
  document.addEventListener("qsymbol", (ev) => {
34639
34701
  const { symbol, href } = ev.detail;
34640
34702
  if (href) {
@@ -34646,7 +34708,7 @@ if (isBrowser3) {
34646
34708
 
34647
34709
  // packages/qwik/src/server/platform.ts
34648
34710
  import { setPlatform as setPlatform2 } from "../core.mjs";
34649
- import { isDev as isDev25 } from "@qwik.dev/core/build";
34711
+ import { isDev as isDev24 } from "@qwik.dev/core/build";
34650
34712
  var getDevSegmentPath = (mapper, hash3, symbolName, parent) => {
34651
34713
  const existing = mapper?.[hash3];
34652
34714
  if (existing) {
@@ -34668,9 +34730,9 @@ var getDevSegmentPath = (mapper, hash3, symbolName, parent) => {
34668
34730
  function createPlatform3(opts, resolvedManifest) {
34669
34731
  const mapper = resolvedManifest?.mapper;
34670
34732
  const mapperFn = opts.symbolMapper ? opts.symbolMapper : (symbolName, _chunk, parent) => {
34671
- if (mapper || isDev25 && import.meta.env.MODE !== "test") {
34733
+ if (mapper || isDev24 && import.meta.env.MODE !== "test") {
34672
34734
  const hash3 = getSymbolHash2(symbolName);
34673
- const result2 = !isDev25 ? mapper[hash3] : getDevSegmentPath(mapper, hash3, symbolName, parent);
34735
+ const result2 = !isDev24 ? mapper[hash3] : getDevSegmentPath(mapper, hash3, symbolName, parent);
34674
34736
  if (!result2) {
34675
34737
  if (hash3 === SYNC_QRL) {
34676
34738
  return [hash3, ""];
@@ -34755,8 +34817,11 @@ var versions = {
34755
34817
  };
34756
34818
 
34757
34819
  // packages/qwik/src/server/ssr-container.ts
34758
- import { isDev as isDev27 } from "@qwik.dev/core/build";
34820
+ import { isDev as isDev26 } from "@qwik.dev/core/build";
34759
34821
  import {
34822
+ _createQRL as createQRL2,
34823
+ _qrlToString as qrlToString2,
34824
+ _res,
34760
34825
  _SubscriptionData as SubscriptionData2,
34761
34826
  _SharedContainer as _SharedContainer2,
34762
34827
  _jsxSorted as _jsxSorted2,
@@ -35023,7 +35088,7 @@ function getQwikBackpatchExecutorScript(opts = {}) {
35023
35088
 
35024
35089
  // packages/qwik/src/server/ssr-node.ts
35025
35090
  import { _isJSXNode as isJSXNode2, _EMPTY_ARRAY, _EFFECT_BACK_REF as _EFFECT_BACK_REF2 } from "@qwik.dev/core/internal";
35026
- import { isDev as isDev26 } from "@qwik.dev/core/build";
35091
+ import { isDev as isDev25 } from "@qwik.dev/core/build";
35027
35092
  var SsrNode = class {
35028
35093
  constructor(parentComponent, id, attributesIndex, cleanupQueue, vnodeData, currentFile) {
35029
35094
  this.parentComponent = parentComponent;
@@ -35048,7 +35113,7 @@ var SsrNode = class {
35048
35113
  this.flags = 1 /* Updatable */;
35049
35114
  this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_ARRAY;
35050
35115
  this.parentComponent?.addChild(this);
35051
- if (isDev26 && id.indexOf("undefined") != -1) {
35116
+ if (isDev25 && id.indexOf("undefined") != -1) {
35052
35117
  throw new Error(`Invalid SSR node id: ${id}`);
35053
35118
  }
35054
35119
  }
@@ -35112,7 +35177,7 @@ var SsrNode = class {
35112
35177
  }
35113
35178
  }
35114
35179
  toString() {
35115
- if (isDev26) {
35180
+ if (isDev25) {
35116
35181
  let stringifiedAttrs = "";
35117
35182
  for (let i = 0; i < this.attrs.length; i += 2) {
35118
35183
  const key = this.attrs[i];
@@ -35474,7 +35539,7 @@ var SSRContainer = class extends _SharedContainer2 {
35474
35539
  containerAttributes[QContainerAttr] = "paused" /* PAUSED */;
35475
35540
  containerAttributes[QRuntimeAttr] = "2";
35476
35541
  containerAttributes[QVersionAttr] = this.$version$ ?? "dev";
35477
- containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev27 ? "ssr-dev" : "ssr");
35542
+ containerAttributes[QRenderAttr] = (qRender ? qRender + "-" : "") + (isDev26 ? "ssr-dev" : "ssr");
35478
35543
  containerAttributes[QBaseAttr] = this.$buildBase$ || "";
35479
35544
  containerAttributes[QLocaleAttr] = this.$locale$;
35480
35545
  containerAttributes[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
@@ -35523,7 +35588,7 @@ var SSRContainer = class extends _SharedContainer2 {
35523
35588
  this.write(" " + Q_PROPS_SEPARATOR);
35524
35589
  if (key !== null) {
35525
35590
  this.write(`="${key}"`);
35526
- } else if (isDev27) {
35591
+ } else if (isDev26) {
35527
35592
  this.write('=""');
35528
35593
  }
35529
35594
  if (constAttrs && constAttrs.length) {
@@ -35659,7 +35724,7 @@ var SSRContainer = class extends _SharedContainer2 {
35659
35724
  const slotName = componentFrame.slots[i];
35660
35725
  const children = componentFrame.slots[i + 1];
35661
35726
  this.openFragment(
35662
- isDev27 ? [DEBUG_TYPE, "P" /* Projection */, QSlotParent, componentFrame.componentNode.id] : [QSlotParent, componentFrame.componentNode.id]
35727
+ isDev26 ? [DEBUG_TYPE, "P" /* Projection */, QSlotParent, componentFrame.componentNode.id] : [QSlotParent, componentFrame.componentNode.id]
35663
35728
  );
35664
35729
  const lastNode = this.getOrCreateLastNode();
35665
35730
  if (lastNode.vnodeData) {
@@ -35917,11 +35982,24 @@ var SSRContainer = class extends _SharedContainer2 {
35917
35982
  if (!this.serializationCtx.$roots$.length) {
35918
35983
  return;
35919
35984
  }
35920
- this.openElement("script", null, ["type", "qwik/state"]);
35985
+ const attrs = this.stateScriptAttrs();
35986
+ this.openElement("script", null, attrs);
35921
35987
  return maybeThen(this.serializationCtx.$serialize$(), () => {
35922
35988
  this.closeElement();
35923
35989
  });
35924
35990
  }
35991
+ /** Add q-d:qidle attribute to eagerly resume some state if needed */
35992
+ stateScriptAttrs() {
35993
+ const attrs = ["type", "qwik/state"];
35994
+ const eagerResume = this.serializationCtx.$eagerResume$;
35995
+ if (eagerResume.size > 0) {
35996
+ const qrl = createQRL2(null, "_res", _res, null, [...eagerResume]);
35997
+ const qrlStr = qrlToString2(this.serializationCtx, qrl);
35998
+ attrs.push("q-d:qidle", qrlStr);
35999
+ this.serializationCtx.$eventNames$.add("d:qidle");
36000
+ }
36001
+ return attrs;
36002
+ }
35925
36003
  emitSyncFnsData() {
35926
36004
  const fns = this.serializationCtx.$syncFns$;
35927
36005
  if (fns.length) {
@@ -35969,7 +36047,7 @@ var SSRContainer = class extends _SharedContainer2 {
35969
36047
  scriptAttrs.push("nonce", this.renderOptions.serverData.nonce);
35970
36048
  }
35971
36049
  this.openElement("script", null, scriptAttrs);
35972
- const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev27 });
36050
+ const backpatchScript = getQwikBackpatchExecutorScript({ debug: isDev26 });
35973
36051
  this.write(backpatchScript);
35974
36052
  this.closeElement();
35975
36053
  }
@@ -36059,7 +36137,7 @@ var SSRContainer = class extends _SharedContainer2 {
36059
36137
  }
36060
36138
  createAndPushFrame(elementName, depthFirstElementIdx, currentFile) {
36061
36139
  let tagNesting = 10 /* ANYTHING */;
36062
- if (isDev27) {
36140
+ if (isDev26) {
36063
36141
  if (!this.currentElementFrame) {
36064
36142
  tagNesting = initialTag(elementName);
36065
36143
  } else {
@@ -36105,7 +36183,7 @@ var SSRContainer = class extends _SharedContainer2 {
36105
36183
  elementName,
36106
36184
  depthFirstElementIdx,
36107
36185
  vNodeData: [0 /* NONE */],
36108
- currentFile: isDev27 ? currentFile || null : null
36186
+ currentFile: isDev26 ? currentFile || null : null
36109
36187
  };
36110
36188
  this.currentElementFrame = frame;
36111
36189
  this.vNodeDatas.push(frame.vNodeData);
@@ -36137,7 +36215,7 @@ var SSRContainer = class extends _SharedContainer2 {
36137
36215
  let value = attrs[i];
36138
36216
  let styleScopedId = null;
36139
36217
  if (isSSRUnsafeAttr(key)) {
36140
- if (isDev27) {
36218
+ if (isDev26) {
36141
36219
  throw qError(32 /* unsafeAttr */, [key]);
36142
36220
  }
36143
36221
  continue;
@@ -36192,7 +36270,7 @@ var SSRContainer = class extends _SharedContainer2 {
36192
36270
  }
36193
36271
  if (tag === "textarea" && key === "value") {
36194
36272
  if (value && typeof value !== "string") {
36195
- if (isDev27) {
36273
+ if (isDev26) {
36196
36274
  throw qError(23 /* wrongTextareaValue */, [currentFile, value]);
36197
36275
  }
36198
36276
  continue;
@@ -36300,13 +36378,12 @@ var renderToStream = async (jsx2, opts) => {
36300
36378
  await ssrContainer.$renderPromise$;
36301
36379
  flush();
36302
36380
  const snapshotResult = getSnapshotResult(ssrContainer);
36303
- const isDynamic = snapshotResult.resources.some((r) => r._cache !== Infinity);
36304
36381
  const result2 = {
36305
36382
  snapshotResult,
36306
36383
  flushes: networkFlushes,
36307
36384
  manifest: resolvedManifest?.manifest,
36308
36385
  size: ssrContainer.size,
36309
- isStatic: !isDynamic,
36386
+ isStatic: false,
36310
36387
  timing
36311
36388
  };
36312
36389
  return result2;