@qwik.dev/core 2.0.0-beta.13 → 2.0.0-beta.15

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.
Files changed (53) hide show
  1. package/dist/backpatch/package.json +1 -1
  2. package/dist/build/package.json +1 -1
  3. package/dist/cli.mjs +5633 -0
  4. package/dist/core-internal.d.ts +123 -65
  5. package/dist/core.min.mjs +1 -1
  6. package/dist/core.mjs +548 -246
  7. package/dist/core.mjs.map +1 -1
  8. package/dist/core.prod.mjs +349 -198
  9. package/dist/loader/index.mjs +2 -2
  10. package/dist/loader/package.json +1 -1
  11. package/dist/optimizer.mjs +1290 -1294
  12. package/dist/qwikloader.debug.js +43 -10
  13. package/dist/qwikloader.js +1 -1
  14. package/dist/server.mjs +5 -5
  15. package/dist/starters/adapters/aws-lambda/package.json +2 -1
  16. package/dist/starters/adapters/azure-swa/package.json +2 -1
  17. package/dist/starters/adapters/bun/package.json +2 -1
  18. package/dist/starters/adapters/cloud-run/package.json +2 -1
  19. package/dist/starters/adapters/cloudflare-pages/package.json +2 -1
  20. package/dist/starters/adapters/deno/package.json +2 -1
  21. package/dist/starters/adapters/express/package.json +2 -1
  22. package/dist/starters/adapters/fastify/package.json +2 -1
  23. package/dist/starters/adapters/firebase/package.json +2 -1
  24. package/dist/starters/adapters/netlify-edge/package.json +2 -1
  25. package/dist/starters/adapters/node-server/package.json +2 -1
  26. package/dist/starters/adapters/ssg/package.json +2 -1
  27. package/dist/starters/adapters/vercel-edge/package.json +2 -1
  28. package/dist/starters/features/csr/package.json +1 -1
  29. package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
  30. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  31. package/dist/testing/index.d.ts +8 -9
  32. package/dist/testing/index.mjs +483 -222
  33. package/dist/testing/package.json +1 -1
  34. package/package.json +14 -48
  35. package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
  36. package/dist/backpatch/index.cjs +0 -6
  37. package/dist/build/index.cjs +0 -35
  38. package/dist/build/index.cjs.map +0 -7
  39. package/dist/build/index.dev.cjs +0 -37
  40. package/dist/build/index.dev.cjs.map +0 -7
  41. package/dist/build/index.prod.cjs +0 -37
  42. package/dist/build/index.prod.cjs.map +0 -7
  43. package/dist/cli.cjs +0 -12956
  44. package/dist/core.cjs +0 -13036
  45. package/dist/core.cjs.map +0 -1
  46. package/dist/core.prod.cjs +0 -6377
  47. package/dist/insights/index.qwik.cjs +0 -1
  48. package/dist/insights/vite/index.cjs +0 -1
  49. package/dist/loader/index.cjs +0 -4
  50. package/dist/optimizer.cjs +0 -217
  51. package/dist/preloader.cjs +0 -266
  52. package/dist/server.cjs +0 -3294
  53. package/dist/testing/index.cjs +0 -36225
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.13-dev+cb19ff7
3
+ * @qwik.dev/core/testing 2.0.0-beta.15-dev+920f1a4
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
@@ -23640,7 +23640,7 @@ error: ${text}`);
23640
23640
  });
23641
23641
 
23642
23642
  // packages/qwik/src/testing/vdom-diff.unit-util.ts
23643
- import { Fragment as Fragment2, Slot as Slot2, _getDomContainer, isSignal as isSignal2 } from "../core.mjs";
23643
+ import { Fragment as Fragment2, Slot as Slot2, _getDomContainer, isSignal as isSignal2, untrack as untrack2 } from "../core.mjs";
23644
23644
  import { _isJSXNode, _isStringifiable } from "@qwik.dev/core/internal";
23645
23645
  import { expect } from "vitest";
23646
23646
 
@@ -24005,7 +24005,6 @@ var ELEMENT_PROPS = "q:props";
24005
24005
  var ELEMENT_SEQ = "q:seq";
24006
24006
  var ELEMENT_SEQ_IDX = "q:seqIdx";
24007
24007
  var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
24008
- var Q_PREFIX = "q:";
24009
24008
  var NON_SERIALIZABLE_MARKER_PREFIX = ":";
24010
24009
  var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
24011
24010
  var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
@@ -24045,6 +24044,7 @@ var STORE_ALL_PROPS = Symbol("store.all");
24045
24044
  var _CONST_PROPS = Symbol("CONST");
24046
24045
  var _VAR_PROPS = Symbol("VAR");
24047
24046
  var _OWNER = Symbol("OWNER");
24047
+ var _PROPS_HANDLER = Symbol("PROPS_HANDLER");
24048
24048
  var _IMMUTABLE = Symbol("IMMUTABLE");
24049
24049
  var _UNINITIALIZED = Symbol("UNINITIALIZED");
24050
24050
 
@@ -24109,6 +24109,13 @@ var getEventDataFromHtmlAttribute = (htmlKey) => {
24109
24109
  }
24110
24110
  return ["document", htmlKey.substring(12)];
24111
24111
  };
24112
+ var getScopedEventName = (scope, eventName) => {
24113
+ const suffix = ":" + eventName;
24114
+ return scope ? scope + suffix : suffix;
24115
+ };
24116
+ var getLoaderScopedEventName = (scope, scopedEvent) => {
24117
+ return scope ? "-" + scopedEvent : scopedEvent;
24118
+ };
24112
24119
 
24113
24120
  // packages/qwik/src/core/shared/utils/flyweight.ts
24114
24121
  var EMPTY_ARRAY = [];
@@ -24123,16 +24130,18 @@ function createPropsProxy(owner) {
24123
24130
  var PropsProxyHandler = class {
24124
24131
  constructor(owner) {
24125
24132
  this.owner = owner;
24133
+ __publicField(this, "$effects$");
24134
+ __publicField(this, "$container$", null);
24126
24135
  }
24127
24136
  get(_, prop) {
24128
24137
  if (prop === _CONST_PROPS) {
24129
24138
  return this.owner.constProps;
24130
- }
24131
- if (prop === _VAR_PROPS) {
24139
+ } else if (prop === _VAR_PROPS) {
24132
24140
  return this.owner.varProps;
24133
- }
24134
- if (prop === _OWNER) {
24141
+ } else if (prop === _OWNER) {
24135
24142
  return this.owner;
24143
+ } else if (prop === _PROPS_HANDLER) {
24144
+ return this;
24136
24145
  }
24137
24146
  let value;
24138
24147
  if (prop === "children") {
@@ -24145,6 +24154,9 @@ var PropsProxyHandler = class {
24145
24154
  }
24146
24155
  }
24147
24156
  value = directGetPropsProxyProp(this.owner, prop);
24157
+ if (prop in this.owner.varProps) {
24158
+ addPropsProxyEffect(this, prop);
24159
+ }
24148
24160
  }
24149
24161
  return value instanceof WrappedSignalImpl && value.$flags$ & 4 /* UNWRAP */ ? value.value : value;
24150
24162
  }
@@ -24153,6 +24165,10 @@ var PropsProxyHandler = class {
24153
24165
  this.owner = value;
24154
24166
  } else if (prop === "children") {
24155
24167
  this.owner.children = value;
24168
+ } else if (prop === _CONST_PROPS) {
24169
+ this.owner.constProps = value;
24170
+ } else if (prop === _VAR_PROPS) {
24171
+ this.owner.varProps = value;
24156
24172
  } else {
24157
24173
  if (typeof prop === "string" && typeof this.owner.type === "string") {
24158
24174
  const attr = jsxEventToHtmlAttribute(prop);
@@ -24161,26 +24177,25 @@ var PropsProxyHandler = class {
24161
24177
  }
24162
24178
  }
24163
24179
  if (this.owner.constProps && prop in this.owner.constProps) {
24164
- this.owner.constProps[prop] = void 0;
24165
- if (!(prop in this.owner.varProps)) {
24166
- this.owner.toSort = true;
24167
- }
24168
- this.owner.varProps[prop] = value;
24169
- } else {
24170
- if (this.owner.varProps === EMPTY_OBJ) {
24171
- this.owner.varProps = {};
24172
- } else {
24173
- if (!(prop in this.owner.varProps)) {
24174
- this.owner.toSort = true;
24175
- }
24176
- }
24180
+ delete this.owner.constProps[prop];
24181
+ }
24182
+ if (this.owner.varProps === EMPTY_OBJ) {
24183
+ this.owner.varProps = {};
24184
+ } else if (!(prop in this.owner.varProps)) {
24185
+ this.owner.toSort = true;
24186
+ }
24187
+ if (this.owner.varProps[prop] !== value) {
24177
24188
  this.owner.varProps[prop] = value;
24189
+ triggerPropsProxyEffect(this, prop);
24178
24190
  }
24179
24191
  }
24180
24192
  return true;
24181
24193
  }
24182
24194
  deleteProperty(_, prop) {
24183
24195
  let didDelete = delete this.owner.varProps[prop];
24196
+ if (didDelete) {
24197
+ triggerPropsProxyEffect(this, prop);
24198
+ }
24184
24199
  if (this.owner.constProps) {
24185
24200
  didDelete = delete this.owner.constProps[prop] || didDelete;
24186
24201
  }
@@ -24196,13 +24211,19 @@ var PropsProxyHandler = class {
24196
24211
  } else if (prop === _CONST_PROPS || prop === _VAR_PROPS) {
24197
24212
  return true;
24198
24213
  }
24199
- if (typeof prop === "string" && typeof this.owner.type === "string") {
24200
- const attr = jsxEventToHtmlAttribute(prop);
24201
- if (attr) {
24202
- prop = attr;
24214
+ const inVarProps = prop in this.owner.varProps;
24215
+ if (typeof prop === "string") {
24216
+ if (inVarProps) {
24217
+ addPropsProxyEffect(this, prop);
24218
+ }
24219
+ if (typeof this.owner.type === "string") {
24220
+ const attr = jsxEventToHtmlAttribute(prop);
24221
+ if (attr) {
24222
+ prop = attr;
24223
+ }
24203
24224
  }
24204
24225
  }
24205
- return prop in this.owner.varProps || (this.owner.constProps ? prop in this.owner.constProps : false);
24226
+ return inVarProps || (this.owner.constProps ? prop in this.owner.constProps : false);
24206
24227
  }
24207
24228
  getOwnPropertyDescriptor(_, p) {
24208
24229
  const value = p === "children" ? this.owner.children : this.owner.constProps && p in this.owner.constProps ? this.owner.constProps[p] : this.owner.varProps[p];
@@ -24227,6 +24248,39 @@ var PropsProxyHandler = class {
24227
24248
  return out;
24228
24249
  }
24229
24250
  };
24251
+ var addPropsProxyEffect = (propsProxy, prop) => {
24252
+ const ctx = tryGetInvokeContext();
24253
+ if (ctx) {
24254
+ if (propsProxy.$container$ === null) {
24255
+ if (ctx.$container$) {
24256
+ propsProxy.$container$ = ctx.$container$;
24257
+ }
24258
+ } else {
24259
+ assertTrue(
24260
+ !ctx.$container$ || ctx.$container$ === propsProxy.$container$,
24261
+ "Do not use props across containers"
24262
+ );
24263
+ }
24264
+ }
24265
+ const effectSubscriber = ctx?.$effectSubscriber$;
24266
+ if (effectSubscriber) {
24267
+ addStoreEffect(propsProxy.owner._proxy, prop, propsProxy, effectSubscriber);
24268
+ }
24269
+ };
24270
+ var triggerPropsProxyEffect = (propsProxy, prop) => {
24271
+ const effects = getEffects(propsProxy.$effects$, prop);
24272
+ if (effects) {
24273
+ propsProxy.$container$?.$scheduler$(
24274
+ 7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
24275
+ void 0,
24276
+ propsProxy,
24277
+ effects
24278
+ );
24279
+ }
24280
+ };
24281
+ function getEffects(effects, prop) {
24282
+ return effects?.get(prop);
24283
+ }
24230
24284
  var directGetPropsProxyProp = (jsx2, prop) => {
24231
24285
  return jsx2.constProps && prop in jsx2.constProps ? jsx2.constProps[prop] : jsx2.varProps[prop];
24232
24286
  };
@@ -24234,6 +24288,19 @@ var isPropsProxy = (obj) => {
24234
24288
  return obj && _VAR_PROPS in obj;
24235
24289
  };
24236
24290
 
24291
+ // packages/qwik/src/core/use/utils/destroyable.ts
24292
+ var cleanupDestroyable = (destroyable) => {
24293
+ const destroy = destroyable.$destroy$;
24294
+ if (destroy) {
24295
+ destroyable.$destroy$ = null;
24296
+ try {
24297
+ destroy();
24298
+ } catch (err) {
24299
+ logError(err);
24300
+ }
24301
+ }
24302
+ };
24303
+
24237
24304
  // packages/qwik/src/core/reactive-primitives/subscriber.ts
24238
24305
  import { isServer as isServer3 } from "@qwik.dev/core/build";
24239
24306
  function getSubscriber(effect, prop, data) {
@@ -24293,13 +24360,13 @@ var cleanupFn = (target, handleError) => {
24293
24360
  cleanupFns = [];
24294
24361
  target.$destroy$ = noSerialize(() => {
24295
24362
  target.$destroy$ = null;
24296
- cleanupFns.forEach((fn2) => {
24363
+ for (const fn2 of cleanupFns) {
24297
24364
  try {
24298
24365
  fn2();
24299
24366
  } catch (err) {
24300
24367
  handleError(err);
24301
24368
  }
24302
- });
24369
+ }
24303
24370
  });
24304
24371
  }
24305
24372
  cleanupFns.push(fn);
@@ -24316,7 +24383,7 @@ var SignalImpl = class {
24316
24383
  constructor(container, value) {
24317
24384
  __publicField(this, "$untrackedValue$");
24318
24385
  /** Store a list of effects which are dependent on this signal. */
24319
- __publicField(this, "$effects$", null);
24386
+ __publicField(this, "$effects$");
24320
24387
  __publicField(this, "$container$", null);
24321
24388
  __publicField(this, "$wrappedSignal$", null);
24322
24389
  this.$container$ = container;
@@ -24330,7 +24397,7 @@ var SignalImpl = class {
24330
24397
  force() {
24331
24398
  this.$container$?.$scheduler$(
24332
24399
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
24333
- null,
24400
+ void 0,
24334
24401
  this,
24335
24402
  this.$effects$
24336
24403
  );
@@ -24355,7 +24422,7 @@ var SignalImpl = class {
24355
24422
  this.$untrackedValue$ = value;
24356
24423
  this.$container$?.$scheduler$(
24357
24424
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
24358
- null,
24425
+ void 0,
24359
24426
  this,
24360
24427
  this.$effects$
24361
24428
  );
@@ -24421,7 +24488,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a = _EFFECT_BACK_REF,
24421
24488
  */
24422
24489
  __publicField(this, "$computeQrl$");
24423
24490
  __publicField(this, "$flags$");
24424
- __publicField(this, _a, null);
24491
+ __publicField(this, _a);
24425
24492
  this.$computeQrl$ = fn;
24426
24493
  this.$flags$ = flags;
24427
24494
  }
@@ -24429,7 +24496,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a = _EFFECT_BACK_REF,
24429
24496
  this.$flags$ |= 1 /* INVALID */;
24430
24497
  this.$container$?.$scheduler$(
24431
24498
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
24432
- null,
24499
+ void 0,
24433
24500
  this,
24434
24501
  this.$effects$
24435
24502
  );
@@ -24500,12 +24567,13 @@ var AsyncComputedSignalImpl = class extends (_b2 = ComputedSignalImpl, _a2 = _EF
24500
24567
  constructor(container, fn, flags = 1 /* INVALID */) {
24501
24568
  super(container, fn, flags);
24502
24569
  __publicField(this, "$untrackedLoading$", false);
24503
- __publicField(this, "$untrackedError$", null);
24504
- __publicField(this, "$loadingEffects$", null);
24505
- __publicField(this, "$errorEffects$", null);
24570
+ __publicField(this, "$untrackedError$");
24571
+ __publicField(this, "$loadingEffects$");
24572
+ __publicField(this, "$errorEffects$");
24506
24573
  __publicField(this, "$destroy$");
24507
24574
  __publicField(this, "$promiseValue$", NEEDS_COMPUTATION);
24508
- __publicField(this, _a2, null);
24575
+ __publicField(this, "$promise$", null);
24576
+ __publicField(this, _a2);
24509
24577
  }
24510
24578
  /**
24511
24579
  * Loading is true if the signal is still waiting for the promise to resolve, false if the promise
@@ -24523,7 +24591,7 @@ var AsyncComputedSignalImpl = class extends (_b2 = ComputedSignalImpl, _a2 = _EF
24523
24591
  this.$untrackedLoading$ = value;
24524
24592
  this.$container$?.$scheduler$(
24525
24593
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
24526
- null,
24594
+ void 0,
24527
24595
  this,
24528
24596
  this.$loadingEffects$
24529
24597
  );
@@ -24545,7 +24613,7 @@ var AsyncComputedSignalImpl = class extends (_b2 = ComputedSignalImpl, _a2 = _EF
24545
24613
  this.$untrackedError$ = value;
24546
24614
  this.$container$?.$scheduler$(
24547
24615
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
24548
- null,
24616
+ void 0,
24549
24617
  this,
24550
24618
  this.$errorEffects$
24551
24619
  );
@@ -24556,9 +24624,10 @@ var AsyncComputedSignalImpl = class extends (_b2 = ComputedSignalImpl, _a2 = _EF
24556
24624
  }
24557
24625
  invalidate() {
24558
24626
  super.invalidate();
24559
- this.$promiseValue$ = NEEDS_COMPUTATION;
24627
+ this.$promise$ = null;
24560
24628
  }
24561
- async resolve() {
24629
+ async promise() {
24630
+ this.$promise$ = null;
24562
24631
  await retryOnPromise(() => this.$computeIfNeeded$());
24563
24632
  return this.$untrackedValue$;
24564
24633
  }
@@ -24566,31 +24635,62 @@ var AsyncComputedSignalImpl = class extends (_b2 = ComputedSignalImpl, _a2 = _EF
24566
24635
  if (!(this.$flags$ & 1 /* INVALID */)) {
24567
24636
  return;
24568
24637
  }
24569
- const [cleanup2] = cleanupFn(this, (err) => this.$container$?.handleError(err, null));
24570
- const untrackedValue = this.$promiseValue$ === NEEDS_COMPUTATION ? this.$computeQrl$.getFn()({
24571
- track: trackFn(this, this.$container$),
24572
- cleanup: cleanup2
24573
- }) : this.$promiseValue$;
24638
+ const untrackedValue = (
24639
+ // first time
24640
+ this.$promiseValue$ === NEEDS_COMPUTATION || // or after invalidation
24641
+ this.$promise$ === null ? this.$promiseComputation$() : this.$promiseValue$
24642
+ );
24574
24643
  if (isPromise(untrackedValue)) {
24644
+ const isFirstComputation = this.$promiseValue$ === NEEDS_COMPUTATION;
24575
24645
  this.untrackedLoading = true;
24576
- this.untrackedError = null;
24577
- throw untrackedValue.then((promiseValue) => {
24646
+ this.untrackedError = void 0;
24647
+ if (this.$promiseValue$ !== NEEDS_COMPUTATION) {
24648
+ cleanupDestroyable(this);
24649
+ }
24650
+ const promise = untrackedValue.then((promiseValue) => {
24651
+ DEBUG3 && log3("Promise resolved", promiseValue);
24578
24652
  this.$promiseValue$ = promiseValue;
24579
24653
  this.untrackedLoading = false;
24580
- this.untrackedError = null;
24654
+ this.untrackedError = void 0;
24655
+ if (this.setValue(promiseValue)) {
24656
+ DEBUG3 && log3("Scheduling effects for subscribers", this.$effects$?.size);
24657
+ scheduleEffects(this.$container$, this, this.$effects$);
24658
+ }
24581
24659
  }).catch((err) => {
24660
+ if (isPromise(err)) {
24661
+ return;
24662
+ }
24663
+ DEBUG3 && log3("Error caught in promise.catch", err);
24582
24664
  this.$promiseValue$ = err;
24583
24665
  this.untrackedLoading = false;
24584
24666
  this.untrackedError = err;
24585
24667
  });
24668
+ if (isFirstComputation) {
24669
+ throw promise;
24670
+ } else {
24671
+ DEBUG3 && log3("Returning stale value", this.$untrackedValue$, "while computing", untrackedValue);
24672
+ return promise;
24673
+ }
24674
+ } else {
24675
+ this.setValue(untrackedValue);
24586
24676
  }
24587
- this.$promiseValue$ = NEEDS_COMPUTATION;
24588
- DEBUG3 && log3("Signal.$asyncCompute$", untrackedValue);
24677
+ }
24678
+ async $promiseComputation$() {
24679
+ if (!this.$promise$) {
24680
+ const [cleanup2] = cleanupFn(this, (err) => this.$container$?.handleError(err, null));
24681
+ this.$promise$ = this.$computeQrl$.getFn()({
24682
+ track: trackFn(this, this.$container$),
24683
+ cleanup: cleanup2
24684
+ });
24685
+ }
24686
+ return this.$promise$;
24687
+ }
24688
+ setValue(value) {
24589
24689
  this.$flags$ &= ~1 /* INVALID */;
24590
- const didChange = untrackedValue !== this.$untrackedValue$;
24690
+ const didChange = value !== this.$untrackedValue$;
24591
24691
  if (didChange) {
24692
+ this.$untrackedValue$ = value;
24592
24693
  this.$flags$ |= 2 /* RUN_EFFECTS */;
24593
- this.$untrackedValue$ = untrackedValue;
24594
24694
  }
24595
24695
  return didChange;
24596
24696
  }
@@ -24950,8 +25050,8 @@ var WrappedSignalImpl = class extends (_b3 = SignalImpl, _a3 = _EFFECT_BACK_REF,
24950
25050
  __publicField(this, "$func$");
24951
25051
  __publicField(this, "$funcStr$");
24952
25052
  __publicField(this, "$flags$");
24953
- __publicField(this, "$hostElement$", null);
24954
- __publicField(this, _a3, null);
25053
+ __publicField(this, "$hostElement$");
25054
+ __publicField(this, _a3);
24955
25055
  this.$args$ = args;
24956
25056
  this.$func$ = fn;
24957
25057
  this.$funcStr$ = fnStr;
@@ -25166,7 +25266,7 @@ var StoreHandler = class {
25166
25266
  constructor($flags$, $container$) {
25167
25267
  this.$flags$ = $flags$;
25168
25268
  this.$container$ = $container$;
25169
- __publicField(this, "$effects$", null);
25269
+ __publicField(this, "$effects$");
25170
25270
  }
25171
25271
  toString() {
25172
25272
  return "[Store]";
@@ -25175,9 +25275,9 @@ var StoreHandler = class {
25175
25275
  const target = getStoreTarget(this);
25176
25276
  this.$container$?.$scheduler$(
25177
25277
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
25178
- null,
25278
+ void 0,
25179
25279
  this,
25180
- getEffects(target, prop, this.$effects$)
25280
+ getEffects2(target, prop, this.$effects$)
25181
25281
  );
25182
25282
  }
25183
25283
  get(target, prop) {
@@ -25249,9 +25349,9 @@ var StoreHandler = class {
25249
25349
  if (!Array.isArray(target)) {
25250
25350
  this.$container$?.$scheduler$(
25251
25351
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
25252
- null,
25352
+ void 0,
25253
25353
  this,
25254
- getEffects(target, prop, this.$effects$)
25354
+ getEffects2(target, prop, this.$effects$)
25255
25355
  );
25256
25356
  }
25257
25357
  return true;
@@ -25312,17 +25412,17 @@ function addStoreEffect(target, prop, store, effectSubscription) {
25312
25412
  }
25313
25413
  function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
25314
25414
  target[prop] = value;
25315
- const effects = getEffects(target, prop, currentStore.$effects$);
25415
+ const effects = getEffects2(target, prop, currentStore.$effects$);
25316
25416
  if (effects) {
25317
25417
  currentStore.$container$?.$scheduler$(
25318
25418
  7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
25319
- null,
25419
+ void 0,
25320
25420
  currentStore,
25321
25421
  effects
25322
25422
  );
25323
25423
  }
25324
25424
  }
25325
- function getEffects(target, prop, storeEffects) {
25425
+ function getEffects2(target, prop, storeEffects) {
25326
25426
  let effectsToTrigger;
25327
25427
  if (storeEffects) {
25328
25428
  if (Array.isArray(target)) {
@@ -25343,7 +25443,7 @@ function getEffects(target, prop, storeEffects) {
25343
25443
  effectsToTrigger.add(effect);
25344
25444
  }
25345
25445
  }
25346
- return effectsToTrigger || null;
25446
+ return effectsToTrigger;
25347
25447
  }
25348
25448
 
25349
25449
  // packages/qwik/src/core/reactive-primitives/subscription-data.ts
@@ -25359,7 +25459,7 @@ var _a4;
25359
25459
  _a4 = _EFFECT_BACK_REF;
25360
25460
  var BackRef = class {
25361
25461
  constructor() {
25362
- __publicField(this, _a4, null);
25462
+ __publicField(this, _a4);
25363
25463
  }
25364
25464
  };
25365
25465
  function clearAllEffects(container, consumer) {
@@ -25373,6 +25473,7 @@ function clearAllEffects(container, consumer) {
25373
25473
  for (const [, effect] of effects) {
25374
25474
  clearEffectSubscription(container, effect);
25375
25475
  }
25476
+ effects.clear();
25376
25477
  }
25377
25478
  function clearEffectSubscription(container, effect) {
25378
25479
  const backRefs = effect[2 /* BACK_REF */];
@@ -25384,12 +25485,16 @@ function clearEffectSubscription(container, effect) {
25384
25485
  clearSignal(container, producer, effect);
25385
25486
  } else if (producer instanceof AsyncComputedSignalImpl) {
25386
25487
  clearAsyncComputedSignal(producer, effect);
25488
+ } else if (isPropsProxy(producer)) {
25489
+ const propsHandler = producer[_PROPS_HANDLER];
25490
+ clearStoreOrProps(propsHandler, effect);
25387
25491
  } else if (container.$storeProxyMap$.has(producer)) {
25388
25492
  const target = container.$storeProxyMap$.get(producer);
25389
25493
  const storeHandler = getStoreHandler(target);
25390
- clearStore(storeHandler, effect);
25494
+ clearStoreOrProps(storeHandler, effect);
25391
25495
  }
25392
25496
  }
25497
+ backRefs.clear();
25393
25498
  }
25394
25499
  function clearSignal(container, producer, effect) {
25395
25500
  const effects = producer.$effects$;
@@ -25397,7 +25502,7 @@ function clearSignal(container, producer, effect) {
25397
25502
  effects.delete(effect);
25398
25503
  }
25399
25504
  if (producer instanceof WrappedSignalImpl) {
25400
- producer.$hostElement$ = null;
25505
+ producer.$hostElement$ = void 0;
25401
25506
  clearAllEffects(container, producer);
25402
25507
  }
25403
25508
  }
@@ -25411,12 +25516,15 @@ function clearAsyncComputedSignal(producer, effect) {
25411
25516
  pendingEffects.delete(effect);
25412
25517
  }
25413
25518
  }
25414
- function clearStore(producer, effect) {
25519
+ function clearStoreOrProps(producer, effect) {
25415
25520
  const effects = producer?.$effects$;
25416
25521
  if (effects) {
25417
- for (const propEffects of effects.values()) {
25522
+ for (const [prop, propEffects] of effects.entries()) {
25418
25523
  if (propEffects.has(effect)) {
25419
25524
  propEffects.delete(effect);
25525
+ if (propEffects.size === 0) {
25526
+ effects.delete(prop);
25527
+ }
25420
25528
  }
25421
25529
  }
25422
25530
  }
@@ -25479,7 +25587,7 @@ var useSequentialScope = () => {
25479
25587
  // packages/qwik/src/core/use/use-task.ts
25480
25588
  var runTask = (task, container, host) => {
25481
25589
  task.$flags$ &= ~8 /* DIRTY */;
25482
- cleanupTask(task);
25590
+ cleanupDestroyable(task);
25483
25591
  const iCtx = newInvokeContext(container.$locale$, host, void 0, TaskEvent);
25484
25592
  iCtx.$container$ = container;
25485
25593
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
@@ -25498,17 +25606,6 @@ var runTask = (task, container, host) => {
25498
25606
  }
25499
25607
  );
25500
25608
  };
25501
- var cleanupTask = (task) => {
25502
- const destroy = task.$destroy$;
25503
- if (destroy) {
25504
- task.$destroy$ = null;
25505
- try {
25506
- destroy();
25507
- } catch (err) {
25508
- logError(err);
25509
- }
25510
- }
25511
- };
25512
25609
  var Task = class extends BackRef {
25513
25610
  constructor($flags$, $index$, $el$, $qrl$, $state$, $destroy$) {
25514
25611
  super();
@@ -25686,12 +25783,12 @@ var _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
25686
25783
  for (const k in varProps) {
25687
25784
  if (k === "children") {
25688
25785
  children || (children = varProps.children);
25689
- varProps.children = void 0;
25786
+ delete varProps.children;
25690
25787
  } else if (k === "key") {
25691
25788
  key || (key = varProps.key);
25692
- varProps.key = void 0;
25789
+ delete varProps.key;
25693
25790
  } else if (constProps && k in constProps) {
25694
- varProps[k] = void 0;
25791
+ delete varProps[k];
25695
25792
  }
25696
25793
  }
25697
25794
  }
@@ -26369,6 +26466,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26369
26466
  let journal = container.$journal$;
26370
26467
  const stack2 = [];
26371
26468
  const asyncQueue = [];
26469
+ const asyncAttributePromises = [];
26372
26470
  let vParent = null;
26373
26471
  let vCurrent = null;
26374
26472
  let vNewNode = null;
@@ -26413,8 +26511,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26413
26511
  } else if (isSignal(jsxValue)) {
26414
26512
  expectVirtual("S" /* WrappedSignal */, null);
26415
26513
  const unwrappedSignal = jsxValue instanceof WrappedSignalImpl ? jsxValue.$unwrapIfSignal$() : jsxValue;
26416
- const currentSignal = vCurrent?.[_EFFECT_BACK_REF]?.get("." /* VNODE */)?.[0 /* CONSUMER */];
26417
- if (currentSignal !== unwrappedSignal) {
26514
+ const hasUnwrappedSignal = vCurrent?.[_EFFECT_BACK_REF]?.get("." /* VNODE */)?.[2 /* BACK_REF */]?.has(unwrappedSignal);
26515
+ if (!hasUnwrappedSignal) {
26418
26516
  const vHost = vNewNode || vCurrent;
26419
26517
  descend(
26420
26518
  resolveSignalAndDescend(
@@ -26708,6 +26806,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26708
26806
  diff(jsxNode2, vHostNode);
26709
26807
  }
26710
26808
  }
26809
+ if (asyncAttributePromises.length) {
26810
+ const promises = asyncAttributePromises.splice(0);
26811
+ return Promise.all(promises).then(() => {
26812
+ return drainAsyncQueue();
26813
+ });
26814
+ }
26711
26815
  }
26712
26816
  function expectNoChildren() {
26713
26817
  const vFirstChild = vCurrent && vnode_getFirstChild(vCurrent);
@@ -26749,11 +26853,11 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26749
26853
  if (vHost.flags & 64 /* NS_svg */) {
26750
26854
  const namespace = getAttributeNamespace(key2);
26751
26855
  if (namespace) {
26752
- element.setAttributeNS(namespace, key2, String(value));
26856
+ element.setAttributeNS(namespace, key2, value);
26753
26857
  return;
26754
26858
  }
26755
26859
  }
26756
- element.setAttribute(key2, String(value));
26860
+ element.setAttribute(key2, value);
26757
26861
  }
26758
26862
  }
26759
26863
  const { constProps } = jsx2;
@@ -26764,14 +26868,15 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26764
26868
  if (isHtmlAttributeAnEventName(key2)) {
26765
26869
  const data = getEventDataFromHtmlAttribute(key2);
26766
26870
  if (data) {
26767
- const scope = data[0];
26768
- const eventName = data[1];
26871
+ const [scope, eventName] = data;
26872
+ const scopedEvent = getScopedEventName(scope, eventName);
26873
+ const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
26769
26874
  if (eventName) {
26770
- vNewNode.setProp(HANDLER_PREFIX + ":" + scope + ":" + eventName, value);
26875
+ vNewNode.setProp(HANDLER_PREFIX + ":" + scopedEvent, value);
26771
26876
  if (scope) {
26772
26877
  vNewNode.setAttr(key2, "", journal);
26773
26878
  }
26774
- registerQwikLoaderEvent(eventName);
26879
+ registerQwikLoaderEvent(loaderScopedEvent);
26775
26880
  }
26776
26881
  }
26777
26882
  needsQDispatchEventPatch = true;
@@ -26799,7 +26904,10 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26799
26904
  }
26800
26905
  if (isPromise(value)) {
26801
26906
  const vHost = vNewNode;
26802
- value.then((resolvedValue) => setAttribute(key2, resolvedValue, vHost));
26907
+ const attributePromise = value.then(
26908
+ (resolvedValue) => setAttribute(key2, resolvedValue, vHost)
26909
+ );
26910
+ asyncAttributePromises.push(attributePromise);
26803
26911
  continue;
26804
26912
  }
26805
26913
  if (key2 === dangerouslySetInnerHTML) {
@@ -26921,14 +27029,24 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26921
27029
  let srcIdx = 0;
26922
27030
  let dstIdx = 0;
26923
27031
  let patchEventDispatch = false;
26924
- const setAttribute = (key, value, vHost) => {
26925
- vHost.setAttr(
26926
- key,
26927
- value !== null ? serializeAttribute(key, value, scopedStyleIdPrefix) : null,
26928
- journal
26929
- );
27032
+ const setAttributeDirect = (vnode2, key, value, dstIdx2, isNewKey) => {
27033
+ const serializedValue = value != null ? serializeAttribute(key, value, scopedStyleIdPrefix) : null;
27034
+ if (isNewKey) {
27035
+ if (serializedValue != null) {
27036
+ dstAttrs.splice(dstIdx2, 0, key, serializedValue);
27037
+ journal.push(2 /* SetAttribute */, vnode2.element, key, serializedValue);
27038
+ }
27039
+ } else {
27040
+ if (serializedValue != null) {
27041
+ dstAttrs[dstIdx2 + 1] = serializedValue;
27042
+ journal.push(2 /* SetAttribute */, vnode2.element, key, serializedValue);
27043
+ } else {
27044
+ dstAttrs.splice(dstIdx2, 2);
27045
+ journal.push(2 /* SetAttribute */, vnode2.element, key, null);
27046
+ }
27047
+ }
26930
27048
  };
26931
- const record = (key, value) => {
27049
+ const record = (key, value, dstIdx2, isNewKey) => {
26932
27050
  if (key.startsWith(":")) {
26933
27051
  vnode.setProp(key, value);
26934
27052
  return;
@@ -26972,24 +27090,32 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26972
27090
  }
26973
27091
  if (isPromise(value)) {
26974
27092
  const vHost = vnode;
26975
- value.then((resolvedValue) => setAttribute(key, resolvedValue, vHost));
27093
+ const attributePromise = value.then((resolvedValue) => {
27094
+ const idx = mapApp_findIndx(dstAttrs, key, 0);
27095
+ const isNewKey2 = idx < 0;
27096
+ const currentDstIdx = isNewKey2 ? idx ^ -1 : idx;
27097
+ setAttributeDirect(vHost, key, resolvedValue, currentDstIdx, isNewKey2);
27098
+ });
27099
+ asyncAttributePromises.push(attributePromise);
26976
27100
  return;
26977
27101
  }
26978
- setAttribute(key, value, vnode);
27102
+ setAttributeDirect(vnode, key, value, dstIdx2, isNewKey);
26979
27103
  };
26980
27104
  const recordJsxEvent = (key, value) => {
26981
27105
  const data = getEventDataFromHtmlAttribute(key);
26982
27106
  if (data) {
26983
27107
  const [scope, eventName] = data;
26984
- record(":" + scope + ":" + eventName, value);
26985
- registerQwikLoaderEvent(eventName);
27108
+ const scopedEvent = getScopedEventName(scope, eventName);
27109
+ const loaderScopedEvent = getLoaderScopedEventName(scope, scopedEvent);
27110
+ record(":" + scopedEvent, value, 0, false);
27111
+ registerQwikLoaderEvent(loaderScopedEvent);
26986
27112
  patchEventDispatch = true;
26987
27113
  }
26988
27114
  };
26989
27115
  while (srcIdx < srcAttrs.length || dstIdx < dstAttrs.length) {
26990
27116
  const srcKey = srcIdx < srcAttrs.length ? srcAttrs[srcIdx] : void 0;
26991
27117
  const dstKey = dstIdx < dstAttrs.length ? dstAttrs[dstIdx] : void 0;
26992
- if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith(Q_PREFIX)) {
27118
+ if (dstKey?.startsWith(HANDLER_PREFIX)) {
26993
27119
  dstIdx += 2;
26994
27120
  continue;
26995
27121
  }
@@ -26997,14 +27123,14 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
26997
27123
  if (isHtmlAttributeAnEventName(dstKey)) {
26998
27124
  dstIdx += 2;
26999
27125
  } else {
27000
- record(dstKey, null);
27126
+ record(dstKey, null, dstIdx, false);
27001
27127
  }
27002
27128
  } else if (dstKey === void 0) {
27003
27129
  const srcValue = srcAttrs[srcIdx + 1];
27004
27130
  if (isHtmlAttributeAnEventName(srcKey)) {
27005
27131
  recordJsxEvent(srcKey, srcValue);
27006
27132
  } else {
27007
- record(srcKey, srcValue);
27133
+ record(srcKey, srcValue, dstIdx, true);
27008
27134
  }
27009
27135
  srcIdx += 2;
27010
27136
  dstIdx += 2;
@@ -27016,7 +27142,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
27016
27142
  if (isEventHandler) {
27017
27143
  recordJsxEvent(srcKey, srcValue);
27018
27144
  } else {
27019
- record(srcKey, srcValue);
27145
+ record(srcKey, srcValue, dstIdx, false);
27020
27146
  }
27021
27147
  } else if (isEventHandler && !vnode.element.qDispatchEvent) {
27022
27148
  recordJsxEvent(srcKey, srcValue);
@@ -27028,7 +27154,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
27028
27154
  if (isHtmlAttributeAnEventName(srcKey)) {
27029
27155
  recordJsxEvent(srcKey, srcValue);
27030
27156
  } else {
27031
- record(srcKey, srcValue);
27157
+ record(srcKey, srcValue, dstIdx, true);
27032
27158
  }
27033
27159
  srcIdx += 2;
27034
27160
  dstIdx += 2;
@@ -27036,7 +27162,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
27036
27162
  if (isHtmlAttributeAnEventName(dstKey)) {
27037
27163
  dstIdx += 2;
27038
27164
  } else {
27039
- record(dstKey, null);
27165
+ record(dstKey, null, dstIdx, false);
27040
27166
  }
27041
27167
  }
27042
27168
  }
@@ -27220,32 +27346,14 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
27220
27346
  deleteFromSideBuffer(null, lookupKey);
27221
27347
  }
27222
27348
  if (host) {
27223
- let vNodeProps = host.getProp(
27349
+ const vNodeProps = host.getProp(
27224
27350
  ELEMENT_PROPS,
27225
27351
  container.$getObjectById$
27226
27352
  );
27227
- let propsAreDifferent = false;
27228
27353
  if (!shouldRender) {
27229
- propsAreDifferent = propsDiffer(
27230
- jsxProps[_CONST_PROPS],
27231
- vNodeProps?.[_CONST_PROPS]
27232
- ) || propsDiffer(
27233
- jsxProps[_VAR_PROPS],
27234
- vNodeProps?.[_VAR_PROPS]
27235
- );
27236
- shouldRender = shouldRender || propsAreDifferent;
27354
+ shouldRender || (shouldRender = handleProps(host, jsxProps, vNodeProps, container));
27237
27355
  }
27238
27356
  if (shouldRender) {
27239
- if (propsAreDifferent) {
27240
- if (vNodeProps) {
27241
- vNodeProps[_CONST_PROPS] = jsxProps[_CONST_PROPS];
27242
- vNodeProps[_VAR_PROPS] = jsxProps[_VAR_PROPS];
27243
- vNodeProps[_OWNER] = jsxProps[_OWNER];
27244
- } else if (jsxProps) {
27245
- host.setProp(ELEMENT_PROPS, jsxProps);
27246
- vNodeProps = jsxProps;
27247
- }
27248
- }
27249
27357
  host.setProp(OnRenderProp, componentQRL);
27250
27358
  host.flags &= ~32 /* Deleted */;
27251
27359
  container.$scheduler$(6 /* COMPONENT */, host, componentQRL, vNodeProps);
@@ -27353,7 +27461,41 @@ function getComponentHash(vNode, getObject) {
27353
27461
  }
27354
27462
  function Projection() {
27355
27463
  }
27356
- function propsDiffer(src, dst) {
27464
+ function handleProps(host, jsxProps, vNodeProps, container) {
27465
+ let shouldRender = false;
27466
+ let propsAreDifferent = false;
27467
+ if (vNodeProps) {
27468
+ const effects = vNodeProps[_PROPS_HANDLER].$effects$;
27469
+ const constPropsDifferent = handleChangedProps(
27470
+ jsxProps[_CONST_PROPS],
27471
+ vNodeProps[_CONST_PROPS],
27472
+ vNodeProps[_PROPS_HANDLER],
27473
+ container,
27474
+ false
27475
+ );
27476
+ propsAreDifferent = constPropsDifferent;
27477
+ shouldRender || (shouldRender = constPropsDifferent);
27478
+ if (effects && effects.size > 0) {
27479
+ const varPropsDifferent = handleChangedProps(
27480
+ jsxProps[_VAR_PROPS],
27481
+ vNodeProps[_VAR_PROPS],
27482
+ vNodeProps[_PROPS_HANDLER],
27483
+ container
27484
+ );
27485
+ propsAreDifferent || (propsAreDifferent = varPropsDifferent);
27486
+ }
27487
+ }
27488
+ if (propsAreDifferent) {
27489
+ if (vNodeProps) {
27490
+ vNodeProps[_OWNER] = jsxProps[_OWNER];
27491
+ } else if (jsxProps) {
27492
+ host.setProp(ELEMENT_PROPS, jsxProps);
27493
+ vNodeProps = jsxProps;
27494
+ }
27495
+ }
27496
+ return shouldRender;
27497
+ }
27498
+ function handleChangedProps(src, dst, propsHandler, container, triggerEffects = true) {
27357
27499
  const srcEmpty = isPropsEmpty(src);
27358
27500
  const dstEmpty = isPropsEmpty(dst);
27359
27501
  if (srcEmpty && dstEmpty) {
@@ -27381,15 +27523,22 @@ function propsDiffer(src, dst) {
27381
27523
  if (srcLen !== dstLen) {
27382
27524
  return true;
27383
27525
  }
27526
+ let changed = false;
27527
+ propsHandler.$container$ = container;
27384
27528
  for (const key of srcKeys) {
27385
27529
  if (key === "children" || key === QBackRefs) {
27386
27530
  continue;
27387
27531
  }
27388
27532
  if (!Object.prototype.hasOwnProperty.call(dst, key) || src[key] !== dst[key]) {
27389
- return true;
27533
+ changed = true;
27534
+ if (triggerEffects) {
27535
+ triggerPropsProxyEffect(propsHandler, key);
27536
+ } else {
27537
+ return true;
27538
+ }
27390
27539
  }
27391
27540
  }
27392
- return false;
27541
+ return changed;
27393
27542
  }
27394
27543
  function isPropsEmpty(props) {
27395
27544
  if (!props) {
@@ -27409,25 +27558,26 @@ function cleanup(container, vNode) {
27409
27558
  if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
27410
27559
  clearAllEffects(container, vCursor);
27411
27560
  markVNodeAsDeleted(vCursor);
27412
- if (type & 2 /* Virtual */) {
27561
+ const isComponent = type & 2 /* Virtual */ && vCursor.getProp(OnRenderProp, null) !== null;
27562
+ if (isComponent) {
27413
27563
  const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
27414
27564
  if (seq) {
27415
27565
  for (let i = 0; i < seq.length; i++) {
27416
27566
  const obj = seq[i];
27417
- if (isTask(obj)) {
27418
- const task = obj;
27419
- clearAllEffects(container, task);
27420
- if (task.$flags$ & 1 /* VISIBLE_TASK */) {
27421
- container.$scheduler$(32 /* CLEANUP_VISIBLE */, task);
27422
- } else {
27423
- cleanupTask(task);
27567
+ if (isObject(obj)) {
27568
+ const objIsTask = isTask(obj);
27569
+ if (objIsTask && obj.$flags$ & 1 /* VISIBLE_TASK */) {
27570
+ container.$scheduler$(32 /* CLEANUP_VISIBLE */, obj);
27571
+ continue;
27572
+ } else if (obj instanceof SignalImpl || isStore(obj)) {
27573
+ clearAllEffects(container, obj);
27574
+ }
27575
+ if (objIsTask || obj instanceof AsyncComputedSignalImpl) {
27576
+ cleanupDestroyable(obj);
27424
27577
  }
27425
27578
  }
27426
27579
  }
27427
27580
  }
27428
- }
27429
- const isComponent = type & 2 /* Virtual */ && vCursor.getProp(OnRenderProp, null) !== null;
27430
- if (isComponent) {
27431
27581
  const attrs = vnode_getProps(vCursor);
27432
27582
  for (let i = 0; i < attrs.length; i = i + 2) {
27433
27583
  const key = attrs[i];
@@ -27528,7 +27678,7 @@ var createResourceReturn = (container, opts, initialPromise) => {
27528
27678
  };
27529
27679
  var runResource = (task, container, host) => {
27530
27680
  task.$flags$ &= ~8 /* DIRTY */;
27531
- cleanupTask(task);
27681
+ cleanupDestroyable(task);
27532
27682
  const iCtx = newInvokeContext(container.$locale$, host, void 0, ResourceEvent);
27533
27683
  iCtx.$container$ = container;
27534
27684
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
@@ -27618,7 +27768,7 @@ var runResource = (task, container, host) => {
27618
27768
  promise,
27619
27769
  delay(timeout).then(() => {
27620
27770
  if (setState(false, new Error("timeout"))) {
27621
- cleanupTask(task);
27771
+ cleanupDestroyable(task);
27622
27772
  }
27623
27773
  })
27624
27774
  ]);
@@ -27729,7 +27879,7 @@ function findAncestorBlockingChore(chore, type) {
27729
27879
  const blockingChores = isNormalQueue ? current.chores : current.blockedChores;
27730
27880
  if (blockingChores) {
27731
27881
  for (const blockingChore of blockingChores) {
27732
- if (blockingChore.$type$ < 16 /* VISIBLE */ && blockingChore.$type$ !== 3 /* TASK */ && blockingChore.$type$ !== 1 /* QRL_RESOLVE */ && blockingChore.$type$ !== 2 /* RUN_QRL */) {
27882
+ if (blockingChore.$type$ < 16 /* VISIBLE */ && blockingChore.$type$ !== 3 /* TASK */ && blockingChore.$type$ !== 1 /* QRL_RESOLVE */ && blockingChore.$type$ !== 2 /* RUN_QRL */ && blockingChore.$state$ === 0 /* NONE */) {
27733
27883
  return blockingChore;
27734
27884
  }
27735
27885
  }
@@ -27755,17 +27905,17 @@ function findBlockingChore(chore, choreQueue, blockedChores, runningChores, cont
27755
27905
  continue;
27756
27906
  }
27757
27907
  for (const candidate of choreQueue) {
27758
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
27908
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ === 0 /* NONE */) {
27759
27909
  return candidate;
27760
27910
  }
27761
27911
  }
27762
27912
  for (const candidate of blockedChores) {
27763
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
27913
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ === 0 /* NONE */) {
27764
27914
  return candidate;
27765
27915
  }
27766
27916
  }
27767
27917
  for (const candidate of runningChores) {
27768
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
27918
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ !== 2 /* FAILED */) {
27769
27919
  return candidate;
27770
27920
  }
27771
27921
  }
@@ -27791,7 +27941,7 @@ function findBlockingChoreForVisible(chore, runningChores, container) {
27791
27941
  continue;
27792
27942
  }
27793
27943
  for (const candidate of runningChores) {
27794
- if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container)) {
27944
+ if (candidate.$type$ === rule.blockingType && rule.match(chore, candidate, container) && candidate.$state$ !== 2 /* FAILED */) {
27795
27945
  return candidate;
27796
27946
  }
27797
27947
  }
@@ -27972,7 +28122,7 @@ function choreComparator(a, b) {
27972
28122
  }
27973
28123
  return 1;
27974
28124
  }
27975
- if (a.$type$ === 7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && b.$type$ === 7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && (a.$target$ instanceof StoreHandler && b.$target$ instanceof StoreHandler || a.$target$ instanceof AsyncComputedSignalImpl && b.$target$ instanceof AsyncComputedSignalImpl) && a.$payload$ !== b.$payload$) {
28125
+ if (a.$type$ === 7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && b.$type$ === 7 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && (a.$target$ instanceof StoreHandler && b.$target$ instanceof StoreHandler || a.$target$ instanceof PropsProxyHandler && b.$target$ instanceof PropsProxyHandler || a.$target$ instanceof AsyncComputedSignalImpl && b.$target$ instanceof AsyncComputedSignalImpl) && a.$payload$ !== b.$payload$) {
27976
28126
  return 1;
27977
28127
  }
27978
28128
  return 0;
@@ -28003,6 +28153,8 @@ var createScheduler = (container, journalFlush, choreQueue, blockedChores, runni
28003
28153
  let currentTime = performance.now();
28004
28154
  const nextTick = createNextTick(drainChoreQueue);
28005
28155
  let flushTimerId = null;
28156
+ let blockingChoresCount = 0;
28157
+ let currentChore = null;
28006
28158
  function drainInNextTick() {
28007
28159
  if (!drainScheduled) {
28008
28160
  drainScheduled = true;
@@ -28073,12 +28225,22 @@ Problematic chore:
28073
28225
  This is often caused by modifying a signal in an already rendered component during SSR.`;
28074
28226
  logWarn(warningMessage);
28075
28227
  DEBUG6 && debugTrace("schedule.SKIPPED host is not updatable", chore, choreQueue, blockedChores);
28228
+ if (isRenderBlocking(type)) {
28229
+ blockingChoresCount--;
28230
+ }
28076
28231
  return chore;
28077
28232
  }
28078
28233
  }
28079
28234
  }
28080
28235
  const shouldBlock = chore.$type$ !== 1 /* QRL_RESOLVE */ && chore.$type$ !== 2 /* RUN_QRL */;
28081
28236
  if (shouldBlock) {
28237
+ const runningChore = getRunningChore(chore);
28238
+ if (runningChore) {
28239
+ if (isResourceChore(runningChore)) {
28240
+ addBlockedChore(chore, runningChore, blockedChores);
28241
+ }
28242
+ return chore;
28243
+ }
28082
28244
  const blockingChore = findBlockingChore(
28083
28245
  chore,
28084
28246
  choreQueue,
@@ -28090,14 +28252,14 @@ This is often caused by modifying a signal in an already rendered component duri
28090
28252
  addBlockedChore(chore, blockingChore, blockedChores);
28091
28253
  return chore;
28092
28254
  }
28093
- const runningChore = getRunningChore(chore);
28094
- if (runningChore) {
28095
- addBlockedChore(chore, runningChore, blockedChores);
28096
- return chore;
28097
- }
28098
28255
  }
28099
- addChore(chore, choreQueue);
28100
- DEBUG6 && debugTrace("schedule", chore, choreQueue, blockedChores);
28256
+ addChoreAndIncrementBlockingCounter(chore, choreQueue);
28257
+ DEBUG6 && debugTrace(
28258
+ isRenderBlocking(type) ? `schedule (blocking ${blockingChoresCount})` : "schedule",
28259
+ chore,
28260
+ choreQueue,
28261
+ blockedChores
28262
+ );
28101
28263
  const runImmediately = isServer6 && type === 6 /* COMPONENT */ || type === 2 /* RUN_QRL */;
28102
28264
  if (runImmediately && !isDraining) {
28103
28265
  immediateDrain();
@@ -28139,6 +28301,15 @@ This is often caused by modifying a signal in an already rendered component duri
28139
28301
  }, delay2);
28140
28302
  }
28141
28303
  function applyJournalFlush() {
28304
+ if (blockingChoresCount > 0) {
28305
+ DEBUG6 && debugTrace(
28306
+ `journalFlush.BLOCKED (${blockingChoresCount} blocking chores)`,
28307
+ null,
28308
+ choreQueue,
28309
+ blockedChores
28310
+ );
28311
+ return;
28312
+ }
28142
28313
  if (!isJournalFlushRunning) {
28143
28314
  isJournalFlushRunning = true;
28144
28315
  journalFlush();
@@ -28204,7 +28375,7 @@ This is often caused by modifying a signal in an already rendered component duri
28204
28375
  if (vnode_isVNode(blockedChore.$host$)) {
28205
28376
  blockedChore.$host$.blockedChores?.delete(blockedChore);
28206
28377
  }
28207
- addChore(blockedChore, choreQueue);
28378
+ addChoreAndIncrementBlockingCounter(blockedChore, choreQueue);
28208
28379
  DEBUG6 && debugTrace("schedule.UNBLOCKED", blockedChore, choreQueue, blockedChores);
28209
28380
  blockedChoresScheduled = true;
28210
28381
  }
@@ -28215,7 +28386,6 @@ This is often caused by modifying a signal in an already rendered component duri
28215
28386
  drainInNextTick();
28216
28387
  }
28217
28388
  };
28218
- let currentChore = null;
28219
28389
  try {
28220
28390
  while (choreQueue.length) {
28221
28391
  currentTime = performance.now();
@@ -28229,13 +28399,16 @@ This is often caused by modifying a signal in an already rendered component duri
28229
28399
  if (vnode_isVNode(chore.$host$)) {
28230
28400
  chore.$host$.chores?.delete(chore);
28231
28401
  }
28402
+ if (isRenderBlocking(chore.$type$)) {
28403
+ blockingChoresCount--;
28404
+ }
28232
28405
  continue;
28233
28406
  }
28234
28407
  if (chore.$type$ === 16 /* VISIBLE */) {
28235
28408
  applyJournalFlush();
28236
28409
  const blockingChore = findBlockingChoreForVisible(chore, runningChores, container);
28237
28410
  if (blockingChore && blockingChore.$state$ === 1 /* RUNNING */) {
28238
- addBlockedChore(chore, blockingChore, blockedChores);
28411
+ (blockingChore.$blockedChores$ || (blockingChore.$blockedChores$ = new ChoreArray())).add(chore);
28239
28412
  continue;
28240
28413
  }
28241
28414
  }
@@ -28290,12 +28463,32 @@ This is often caused by modifying a signal in an already rendered component duri
28290
28463
  if (vnode_isVNode(chore.$host$)) {
28291
28464
  chore.$host$.chores?.delete(chore);
28292
28465
  }
28293
- DEBUG6 && debugTrace("execute.DONE", chore, choreQueue, blockedChores);
28466
+ if (isRenderBlocking(chore.$type$)) {
28467
+ blockingChoresCount--;
28468
+ DEBUG6 && debugTrace(
28469
+ `execute.DONE (blocking ${blockingChoresCount})`,
28470
+ chore,
28471
+ choreQueue,
28472
+ blockedChores
28473
+ );
28474
+ } else {
28475
+ DEBUG6 && debugTrace("execute.DONE", chore, choreQueue, blockedChores);
28476
+ }
28294
28477
  }
28295
28478
  function handleError(chore, e) {
28296
28479
  chore.$endTime$ = performance.now();
28297
28480
  chore.$state$ = 2 /* FAILED */;
28298
- DEBUG6 && debugTrace("execute.ERROR", chore, choreQueue, blockedChores);
28481
+ if (isRenderBlocking(chore.$type$)) {
28482
+ blockingChoresCount--;
28483
+ DEBUG6 && debugTrace(
28484
+ `execute.ERROR (blocking ${blockingChoresCount})`,
28485
+ chore,
28486
+ choreQueue,
28487
+ blockedChores
28488
+ );
28489
+ } else {
28490
+ DEBUG6 && debugTrace("execute.ERROR", chore, choreQueue, blockedChores);
28491
+ }
28299
28492
  chore.$reject$?.(e);
28300
28493
  container.handleError(e, chore.$host$);
28301
28494
  }
@@ -28354,18 +28547,21 @@ This is often caused by modifying a signal in an already rendered component duri
28354
28547
  host
28355
28548
  );
28356
28549
  } else {
28357
- returnValue = runTask(
28358
- payload,
28359
- container,
28360
- host
28361
- );
28550
+ const task = payload;
28551
+ returnValue = runTask(task, container, host);
28552
+ if (task.$flags$ & 16 /* RENDER_BLOCKING */) {
28553
+ blockingChoresCount++;
28554
+ returnValue = maybeThen(returnValue, () => {
28555
+ blockingChoresCount--;
28556
+ });
28557
+ }
28362
28558
  }
28363
28559
  }
28364
28560
  break;
28365
28561
  case 32 /* CLEANUP_VISIBLE */:
28366
28562
  {
28367
28563
  const task = chore.$payload$;
28368
- cleanupTask(task);
28564
+ cleanupDestroyable(task);
28369
28565
  }
28370
28566
  break;
28371
28567
  case 4 /* NODE_DIFF */:
@@ -28468,12 +28664,34 @@ This is often caused by modifying a signal in an already rendered component duri
28468
28664
  }
28469
28665
  return null;
28470
28666
  }
28667
+ function addChoreAndIncrementBlockingCounter(chore, choreArray) {
28668
+ if (addChore(chore, choreArray)) {
28669
+ blockingChoresCount++;
28670
+ }
28671
+ }
28471
28672
  };
28673
+ function addChore(chore, choreArray) {
28674
+ var _a5;
28675
+ const idx = choreArray.add(chore);
28676
+ if (idx < 0) {
28677
+ if (vnode_isVNode(chore.$host$)) {
28678
+ ((_a5 = chore.$host$).chores || (_a5.chores = new ChoreArray())).add(chore);
28679
+ }
28680
+ return isRenderBlocking(chore.$type$);
28681
+ }
28682
+ return false;
28683
+ }
28472
28684
  function vNodeAlreadyDeleted(chore) {
28473
28685
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$.flags & 32 /* Deleted */);
28474
28686
  }
28687
+ function isResourceChore(chore) {
28688
+ return chore.$type$ === 3 /* TASK */ && !!chore.$payload$ && !!(chore.$payload$.$flags$ & 4 /* RESOURCE */);
28689
+ }
28475
28690
  function addBlockedChore(blockedChore, blockingChore, blockedChores) {
28476
28691
  var _a5;
28692
+ if (!isResourceChore(blockedChore) && choreComparator(blockedChore, blockingChore) === 0) {
28693
+ return;
28694
+ }
28477
28695
  DEBUG6 && debugTrace(
28478
28696
  `blocked chore by ${debugChoreToString(blockingChore)}`,
28479
28697
  blockedChore,
@@ -28486,12 +28704,8 @@ function addBlockedChore(blockedChore, blockingChore, blockedChores) {
28486
28704
  ((_a5 = blockedChore.$host$).blockedChores || (_a5.blockedChores = new ChoreArray())).add(blockedChore);
28487
28705
  }
28488
28706
  }
28489
- function addChore(chore, choreArray) {
28490
- var _a5;
28491
- const idx = choreArray.add(chore);
28492
- if (idx < 0 && vnode_isVNode(chore.$host$)) {
28493
- ((_a5 = chore.$host$).chores || (_a5.chores = new ChoreArray())).add(chore);
28494
- }
28707
+ function isRenderBlocking(type) {
28708
+ return type === 4 /* NODE_DIFF */ || type === 6 /* COMPONENT */;
28495
28709
  }
28496
28710
  function choreTypeToName(type) {
28497
28711
  return {
@@ -28577,9 +28791,9 @@ function debugTrace(action, arg, queue2, blockedChores) {
28577
28791
  lines.push(line);
28578
28792
  }
28579
28793
  }
28580
- if (blockedChores && blockedChores.size > 0) {
28794
+ if (blockedChores && blockedChores.length > 0) {
28581
28795
  lines.push("");
28582
- lines.push(`\u{1F6AB} Blocked Chores (${blockedChores.size} items):`);
28796
+ lines.push(`\u{1F6AB} Blocked Chores (${blockedChores.length} items):`);
28583
28797
  Array.from(blockedChores).forEach((chore, index) => {
28584
28798
  const type = debugChoreTypeToString(chore.$type$);
28585
28799
  const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
@@ -28713,15 +28927,16 @@ function qrlToString(serializationContext, value, raw) {
28713
28927
  chunk = "";
28714
28928
  symbol = String(serializationContext.$addSyncFn$(null, 0, fn));
28715
28929
  }
28716
- if (!value.$capture$ && Array.isArray(value.$captureRef$) && value.$captureRef$.length > 0) {
28717
- value.$capture$ = value.$captureRef$.map((ref) => `${serializationContext.$addRoot$(ref)}`);
28930
+ let capturedIds = null;
28931
+ if (Array.isArray(value.$captureRef$) && value.$captureRef$.length > 0) {
28932
+ capturedIds = value.$captureRef$.map((ref) => `${serializationContext.$addRoot$(ref)}`);
28718
28933
  }
28719
28934
  if (raw) {
28720
- return [chunk, symbol, value.$capture$];
28935
+ return [chunk, symbol, capturedIds];
28721
28936
  }
28722
28937
  let qrlStringInline = `${chunk}#${symbol}`;
28723
- if (value.$capture$ && value.$capture$.length > 0) {
28724
- qrlStringInline += `[${value.$capture$.join(" ")}]`;
28938
+ if (capturedIds && capturedIds.length > 0) {
28939
+ qrlStringInline += `[${capturedIds.join(" ")}]`;
28725
28940
  }
28726
28941
  return qrlStringInline;
28727
28942
  }
@@ -28765,15 +28980,15 @@ async function serialize(serializationContext) {
28765
28980
  const s11nWeakRefs = /* @__PURE__ */ new Map();
28766
28981
  let parent;
28767
28982
  const qrlMap = /* @__PURE__ */ new Map();
28768
- const outputArray = (value, keepNulls, writeFn) => {
28983
+ const outputArray = (value, keepUndefined, writeFn) => {
28769
28984
  $writer$.write("[");
28770
28985
  let separator = false;
28771
28986
  let length;
28772
- if (keepNulls) {
28987
+ if (keepUndefined) {
28773
28988
  length = value.length;
28774
28989
  } else {
28775
28990
  length = value.length - 1;
28776
- while (length >= 0 && value[length] === null) {
28991
+ while (length >= 0 && value[length] === void 0) {
28777
28992
  length--;
28778
28993
  }
28779
28994
  length++;
@@ -28788,7 +29003,7 @@ async function serialize(serializationContext) {
28788
29003
  }
28789
29004
  $writer$.write("]");
28790
29005
  };
28791
- const output = (type, value, keepNulls) => {
29006
+ const output = (type, value, keepUndefined) => {
28792
29007
  $writer$.write(`${type},`);
28793
29008
  if (typeof value === "number") {
28794
29009
  $writer$.write(value.toString());
@@ -28803,7 +29018,7 @@ async function serialize(serializationContext) {
28803
29018
  }
28804
29019
  $writer$.write(lastIdx === 0 ? s : s.slice(lastIdx));
28805
29020
  } else {
28806
- outputArray(value, keepNulls, (valueItem, idx) => {
29021
+ outputArray(value, !!keepUndefined, (valueItem, idx) => {
28807
29022
  writeValue(valueItem, idx);
28808
29023
  });
28809
29024
  }
@@ -28959,7 +29174,12 @@ async function serialize(serializationContext) {
28959
29174
  const writeObjectValue = (value) => {
28960
29175
  if (isPropsProxy(value)) {
28961
29176
  const owner = value[_OWNER];
28962
- output(32 /* PropsProxy */, [_serializationWeakRef(owner), owner.varProps, owner.constProps]);
29177
+ output(32 /* PropsProxy */, [
29178
+ _serializationWeakRef(owner),
29179
+ owner.varProps,
29180
+ owner.constProps,
29181
+ value[_PROPS_HANDLER].$effects$
29182
+ ]);
28963
29183
  } else if (value instanceof SubscriptionData) {
28964
29184
  output(33 /* SubscriptionData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
28965
29185
  } else if (isStore(value)) {
@@ -28988,7 +29208,7 @@ async function serialize(serializationContext) {
28988
29208
  }
28989
29209
  }
28990
29210
  const out = [storeTarget, flags, effects, ...innerStores];
28991
- while (out[out.length - 1] == null) {
29211
+ while (out[out.length - 1] === void 0) {
28992
29212
  out.pop();
28993
29213
  }
28994
29214
  output(29 /* Store */, out);
@@ -28997,7 +29217,13 @@ async function serialize(serializationContext) {
28997
29217
  const result2 = value[SerializerSymbol](value);
28998
29218
  if (isPromise(result2)) {
28999
29219
  const forwardRef = resolvePromise(result2, $addRoot$, (resolved, resolvedValue) => {
29000
- return new PromiseResult(28 /* SerializerSignal */, resolved, resolvedValue, null, null);
29220
+ return new PromiseResult(
29221
+ 28 /* SerializerSignal */,
29222
+ resolved,
29223
+ resolvedValue,
29224
+ void 0,
29225
+ void 0
29226
+ );
29001
29227
  });
29002
29228
  output(2 /* ForwardRef */, forwardRef);
29003
29229
  } else {
@@ -29026,10 +29252,9 @@ async function serialize(serializationContext) {
29026
29252
  } else if (value instanceof SignalImpl) {
29027
29253
  if (value instanceof SerializerSignalImpl) {
29028
29254
  addPreloadQrl(value.$computeQrl$);
29029
- const forwardRefId = resolvePromise(
29030
- getCustomSerializerPromise(value, value.$untrackedValue$),
29031
- $addRoot$,
29032
- (resolved, resolvedValue) => {
29255
+ const maybeValue = getCustomSerializerPromise(value, value.$untrackedValue$);
29256
+ if (isPromise(maybeValue)) {
29257
+ const forwardRefId = resolvePromise(maybeValue, $addRoot$, (resolved, resolvedValue) => {
29033
29258
  return new PromiseResult(
29034
29259
  28 /* SerializerSignal */,
29035
29260
  resolved,
@@ -29037,9 +29262,11 @@ async function serialize(serializationContext) {
29037
29262
  value.$effects$,
29038
29263
  value.$computeQrl$
29039
29264
  );
29040
- }
29041
- );
29042
- output(2 /* ForwardRef */, forwardRefId);
29265
+ });
29266
+ output(2 /* ForwardRef */, forwardRefId);
29267
+ } else {
29268
+ output(28 /* SerializerSignal */, [value.$computeQrl$, value.$effects$, maybeValue]);
29269
+ }
29043
29270
  return;
29044
29271
  }
29045
29272
  if (value instanceof WrappedSignalImpl) {
@@ -29074,12 +29301,22 @@ async function serialize(serializationContext) {
29074
29301
  value.$untrackedError$
29075
29302
  );
29076
29303
  }
29304
+ let keepUndefined = false;
29077
29305
  if (v !== NEEDS_COMPUTATION) {
29078
29306
  out.push(v);
29307
+ if (!isAsync && v === void 0) {
29308
+ keepUndefined = true;
29309
+ }
29079
29310
  }
29080
- output(isAsync ? 27 /* AsyncComputedSignal */ : 26 /* ComputedSignal */, out);
29311
+ output(isAsync ? 27 /* AsyncComputedSignal */ : 26 /* ComputedSignal */, out, keepUndefined);
29081
29312
  } else {
29082
- output(24 /* Signal */, [value.$untrackedValue$, ...value.$effects$ || []]);
29313
+ const v = value.$untrackedValue$;
29314
+ const keepUndefined = v === void 0;
29315
+ const out = [v];
29316
+ if (value.$effects$) {
29317
+ out.push(...value.$effects$);
29318
+ }
29319
+ output(24 /* Signal */, out, keepUndefined);
29083
29320
  }
29084
29321
  } else if (value instanceof URL) {
29085
29322
  output(6 /* URL */, value.href);
@@ -29146,9 +29383,9 @@ async function serialize(serializationContext) {
29146
29383
  value.varProps,
29147
29384
  value.constProps,
29148
29385
  value.children,
29149
- value.toSort || null
29386
+ value.toSort || void 0
29150
29387
  ];
29151
- while (out[out.length - 1] == null) {
29388
+ while (out[out.length - 1] === void 0) {
29152
29389
  out.pop();
29153
29390
  }
29154
29391
  output(31 /* JSXNode */, out);
@@ -29161,7 +29398,7 @@ async function serialize(serializationContext) {
29161
29398
  value[_EFFECT_BACK_REF],
29162
29399
  value.$state$
29163
29400
  ];
29164
- while (out[out.length - 1] == null) {
29401
+ while (out[out.length - 1] === void 0) {
29165
29402
  out.pop();
29166
29403
  }
29167
29404
  output(21 /* Task */, out);
@@ -29265,7 +29502,7 @@ async function serialize(serializationContext) {
29265
29502
  await outputRoots();
29266
29503
  }
29267
29504
  var PromiseResult = class {
29268
- constructor($type$, $resolved$, $value$, $effects$ = null, $qrl$ = null) {
29505
+ constructor($type$, $resolved$, $value$, $effects$ = void 0, $qrl$ = void 0) {
29269
29506
  this.$type$ = $type$;
29270
29507
  this.$resolved$ = $resolved$;
29271
29508
  this.$value$ = $value$;
@@ -29274,20 +29511,27 @@ var PromiseResult = class {
29274
29511
  }
29275
29512
  };
29276
29513
  function getCustomSerializerPromise(signal, value) {
29277
- return new Promise((resolve) => {
29278
- signal.$computeQrl$.resolve().then((arg) => {
29514
+ if (value === NEEDS_COMPUTATION) {
29515
+ return value;
29516
+ }
29517
+ return maybeThen(
29518
+ signal.$computeQrl$.resolved || signal.$computeQrl$.resolve(),
29519
+ (arg) => {
29279
29520
  let data;
29521
+ if (typeof arg === "function") {
29522
+ arg = arg();
29523
+ }
29280
29524
  if (arg.serialize) {
29281
29525
  data = arg.serialize(value);
29282
- } else if (SerializerSymbol in value) {
29526
+ } else if (typeof value === "object" && SerializerSymbol in value) {
29283
29527
  data = value[SerializerSymbol](value);
29284
29528
  }
29285
29529
  if (data === void 0) {
29286
29530
  data = NEEDS_COMPUTATION;
29287
29531
  }
29288
- resolve(data);
29289
- });
29290
- });
29532
+ return data;
29533
+ }
29534
+ );
29291
29535
  }
29292
29536
  var discoverValuesForVNodeData = (vnodeData, callback) => {
29293
29537
  for (const value of vnodeData) {
@@ -29324,7 +29568,7 @@ function serializeWrappingFn(serializationContext, value) {
29324
29568
  return [syncFnId, value.$args$];
29325
29569
  }
29326
29570
  function filterEffectBackRefs(effectBackRef) {
29327
- let effectBackRefToSerialize = null;
29571
+ let effectBackRefToSerialize = void 0;
29328
29572
  if (effectBackRef) {
29329
29573
  for (const [effectProp, effect] of effectBackRef) {
29330
29574
  if (effect[2 /* BACK_REF */]) {
@@ -29479,7 +29723,7 @@ var _SharedContainer = class {
29479
29723
  throw Error("Not implemented");
29480
29724
  };
29481
29725
  const choreQueue = new ChoreArray();
29482
- const blockedChores = /* @__PURE__ */ new Set();
29726
+ const blockedChores = new ChoreArray();
29483
29727
  const runningChores = /* @__PURE__ */ new Set();
29484
29728
  this.$scheduler$ = createScheduler(
29485
29729
  this,
@@ -29988,10 +30232,11 @@ var inflate = (container, target, typeId, data) => {
29988
30232
  asyncComputed.$loadingEffects$ = new Set(d2[2]);
29989
30233
  asyncComputed.$errorEffects$ = new Set(d2[3]);
29990
30234
  asyncComputed.$untrackedLoading$ = d2[4];
29991
- asyncComputed.$untrackedError$ = d2[5] || null;
30235
+ asyncComputed.$untrackedError$ = d2[5];
29992
30236
  const hasValue = d2.length > 6;
29993
30237
  if (hasValue) {
29994
30238
  asyncComputed.$untrackedValue$ = d2[6];
30239
+ asyncComputed.$promiseValue$ = d2[6];
29995
30240
  }
29996
30241
  asyncComputed.$flags$ |= 1 /* INVALID */;
29997
30242
  break;
@@ -30002,7 +30247,9 @@ var inflate = (container, target, typeId, data) => {
30002
30247
  const computed = target;
30003
30248
  const d2 = data;
30004
30249
  computed.$computeQrl$ = d2[0];
30005
- computed.$effects$ = new Set(d2[1]);
30250
+ if (d2[1]) {
30251
+ computed.$effects$ = new Set(d2[1]);
30252
+ }
30006
30253
  const hasValue = d2.length > 2;
30007
30254
  if (hasValue) {
30008
30255
  computed.$untrackedValue$ = d2[2];
@@ -30087,6 +30334,7 @@ var inflate = (container, target, typeId, data) => {
30087
30334
  owner._proxy = propsProxy;
30088
30335
  }
30089
30336
  propsProxy[_OWNER] = owner;
30337
+ propsProxy[_PROPS_HANDLER].$effects$ = d[3];
30090
30338
  break;
30091
30339
  case 33 /* SubscriptionData */: {
30092
30340
  const effectData = target;
@@ -30981,6 +31229,9 @@ var DomContainer = class extends _SharedContainer {
30981
31229
  preprocessState(this.$rawStateData$, this);
30982
31230
  this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
30983
31231
  }
31232
+ if (!qTest && element.isConnected) {
31233
+ element.dispatchEvent(new CustomEvent("qresume", { bubbles: true }));
31234
+ }
30984
31235
  }
30985
31236
  $setRawState$(id, vParent) {
30986
31237
  this.$stateData$[id] = vParent;
@@ -31909,19 +32160,18 @@ var vnode_applyJournal = (journal) => {
31909
32160
  key = "class";
31910
32161
  }
31911
32162
  const value = journal[idx++];
32163
+ const shouldRemove = value == null || value === false;
31912
32164
  if (isBooleanAttr(element, key)) {
31913
32165
  element[key] = parseBoolean(value);
31914
- } else if (key === "value" && key in element) {
31915
- element.value = String(value);
31916
32166
  } else if (key === dangerouslySetInnerHTML) {
31917
32167
  element.innerHTML = value;
31918
32168
  element.setAttribute(QContainerAttr, "html" /* HTML */);
32169
+ } else if (shouldRemove) {
32170
+ element.removeAttribute(key);
32171
+ } else if (key === "value" && key in element) {
32172
+ element.value = String(value);
31919
32173
  } else {
31920
- if (value == null || value === false) {
31921
- element.removeAttribute(key);
31922
- } else {
31923
- element.setAttribute(key, String(value));
31924
- }
32174
+ element.setAttribute(key, String(value));
31925
32175
  }
31926
32176
  break;
31927
32177
  case 3 /* HoistStyles */:
@@ -32553,6 +32803,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
32553
32803
  const nodeIsElement = isElement(node);
32554
32804
  return !nodeIsElement || nodeIsElement && shouldSkipElement(node);
32555
32805
  };
32806
+ let components = null;
32556
32807
  processVNodeData2(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
32557
32808
  if (isNumber2(peek())) {
32558
32809
  while (shouldSkipNode(child)) {
@@ -32575,6 +32826,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
32575
32826
  } else if (peek() === VNodeDataChar.SCOPED_STYLE) {
32576
32827
  vParent.setAttr(QScopedStyle, consumeValue(), null);
32577
32828
  } else if (peek() === VNodeDataChar.RENDER_FN) {
32829
+ (components || (components = [])).push(vParent);
32578
32830
  vParent.setAttr(OnRenderProp, consumeValue(), null);
32579
32831
  } else if (peek() === VNodeDataChar.ID) {
32580
32832
  if (!container) {
@@ -32656,6 +32908,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
32656
32908
  textIdx += length;
32657
32909
  }
32658
32910
  });
32911
+ if (components) {
32912
+ if (!container) {
32913
+ container = getDomContainer(element);
32914
+ }
32915
+ for (const component of components) {
32916
+ container.ensureProjectionResolved(component);
32917
+ }
32918
+ components = null;
32919
+ }
32659
32920
  vParent.lastChild = vLast;
32660
32921
  return vFirst;
32661
32922
  }
@@ -33296,7 +33557,7 @@ function diffJsxVNode(received, expected, path = [], container, isSsr) {
33296
33557
  }
33297
33558
  const propLowerCased = prop.toLowerCase();
33298
33559
  let receivedValue = received.getAttr(prop) || received.getAttr(propLowerCased) || receivedElement?.getAttribute(prop) || receivedElement?.getAttribute(propLowerCased);
33299
- let expectedValue = prop === "key" || prop === ELEMENT_KEY ? receivedValue : expected.props[prop];
33560
+ let expectedValue = prop === "key" || prop === ELEMENT_KEY ? receivedValue : untrack2(() => expected.props[prop]);
33300
33561
  if (typeof receivedValue === "boolean" || typeof receivedValue === "number") {
33301
33562
  receivedValue = serializeBooleanOrNumberAttribute(receivedValue);
33302
33563
  }
@@ -34344,7 +34605,7 @@ var preloaderPre = (container, options, nonce) => {
34344
34605
  ]);
34345
34606
  container.closeElement();
34346
34607
  const script2 = `let b=fetch("${bundleGraphPath}");import("${preloaderBundle}").then(({l})=>l(${JSON.stringify(base2)},b${optsStr}));`;
34347
- const scriptAttrs = ["type", "module", "async", true];
34608
+ const scriptAttrs = ["type", "module", "async", true, "crossorigin", "anonymous"];
34348
34609
  if (nonce) {
34349
34610
  scriptAttrs.push("nonce", nonce);
34350
34611
  }