@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.20

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5065 -0
  3. package/dist/server.js +1757 -355
  4. package/dist/{server.cjs → server.observe.js} +1951 -558
  5. package/dist/{dev.cjs → web.dev.js} +945 -550
  6. package/dist/web.js +635 -332
  7. package/dist/{dev.js → web.observe.js} +688 -403
  8. package/frames/dist/assets.js +92 -0
  9. package/frames/dist/client.dev.js +1296 -1198
  10. package/frames/dist/client.js +1128 -1191
  11. package/frames/dist/client.observe.js +2041 -0
  12. package/frames/dist/regions.js +171 -0
  13. package/frames/dist/server.dev.js +2549 -0
  14. package/frames/dist/server.js +1688 -3005
  15. package/frames/dist/server.observe.js +2548 -0
  16. package/frames/dist/trace.js +45 -0
  17. package/frames/dist/wire.js +594 -0
  18. package/frames/package.json +2 -25
  19. package/package.json +244 -256
  20. package/performance-tracks/dist/performance-tracks.dev.js +679 -0
  21. package/performance-tracks/dist/performance-tracks.js +6 -0
  22. package/performance-tracks/dist/performance-tracks.observe.js +667 -0
  23. package/performance-tracks/package.json +7 -0
  24. package/performance-tracks/types/index.d.ts +69 -0
  25. package/serialization/decode/package.json +2 -15
  26. package/serialization/dist/decode.js +121 -25
  27. package/serialization/dist/serialization.js +242 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +85 -158
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +109 -0
  32. package/server-functions/dist/client.dev.js +1462 -0
  33. package/server-functions/dist/client.js +667 -165
  34. package/server-functions/dist/client.observe.js +1441 -0
  35. package/server-functions/dist/rich-args.js +84 -1
  36. package/server-functions/dist/server.dev.js +2714 -297
  37. package/server-functions/dist/server.js +2595 -271
  38. package/server-functions/dist/server.observe.js +3594 -0
  39. package/server-functions/package.json +2 -35
  40. package/server-functions/rich-args/package.json +2 -15
  41. package/skills/server-components/SKILL.md +117 -0
  42. package/storage/package.json +2 -15
  43. package/types/client.d.ts +342 -288
  44. package/types/constants.d.ts +22 -0
  45. package/types/cookies.d.ts +32 -84
  46. package/types/diagnostics.d.ts +80 -0
  47. package/types/frames/assets-tier.d.ts +78 -0
  48. package/types/frames/client.d.ts +40 -1
  49. package/types/frames/frame-client.d.ts +443 -280
  50. package/types/frames/frame-container-plugin.d.ts +64 -0
  51. package/types/frames/frame-morph.d.ts +29 -0
  52. package/types/frames/frame-sink.d.ts +141 -161
  53. package/types/frames/frame-transport.d.ts +263 -184
  54. package/types/frames/regions-tier.d.ts +60 -0
  55. package/types/frames/serializer-decode.d.ts +241 -0
  56. package/types/frames/serializer.d.ts +85 -158
  57. package/types/frames/server.d.ts +2 -2
  58. package/types/frames/trace-tier.d.ts +2 -0
  59. package/types/frames/tree-rewrite.d.ts +39 -0
  60. package/types/frames/wire-tier.d.ts +169 -0
  61. package/types/head.d.ts +20 -0
  62. package/types/index.d.ts +98 -81
  63. package/types/index.server.d.ts +159 -0
  64. package/types/jsx.d.ts +49 -44
  65. package/types/observe.d.ts +535 -0
  66. package/types/reconcile.d.ts +1 -0
  67. package/types/render.d.ts +11 -0
  68. package/types/request-error-hook.d.ts +5 -0
  69. package/types/response.d.ts +95 -147
  70. package/types/serializer-decode.d.ts +173 -114
  71. package/types/serializer.d.ts +85 -158
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +238 -223
  74. package/types/server-functions/flash.d.ts +28 -30
  75. package/types/server-functions/registry.d.ts +105 -0
  76. package/types/server-functions/rich-args.d.ts +1 -10
  77. package/types/server-functions/server.d.ts +539 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +50 -0
  80. package/types/server-mock.d.ts +120 -13
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +571 -422
  83. package/types/trace.d.ts +127 -0
  84. package/LICENSE +0 -21
  85. package/dist/web.cjs +0 -2033
  86. package/frames/dist/client.cjs +0 -2002
  87. package/frames/dist/client.dev.cjs +0 -2022
  88. package/frames/dist/server.cjs +0 -3877
  89. package/serialization/dist/decode.cjs +0 -139
  90. package/serialization/dist/serialization.cjs +0 -261
  91. package/serialization/types-cjs/index.d.cts +0 -182
  92. package/serialization/types-cjs/package.json +0 -3
  93. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  94. package/server-functions/dist/client.cjs +0 -834
  95. package/server-functions/dist/rich-args.cjs +0 -11
  96. package/server-functions/dist/server.cjs +0 -1242
  97. package/server-functions/dist/server.dev.cjs +0 -1242
  98. package/storage/dist/storage.cjs +0 -12
  99. package/storage/types-cjs/index.d.cts +0 -28
  100. package/storage/types-cjs/package.json +0 -3
  101. package/types/core.d.ts +0 -9
  102. package/types-cjs/client.d.cts +0 -337
  103. package/types-cjs/cookies.d.cts +0 -93
  104. package/types-cjs/core.d.cts +0 -9
  105. package/types-cjs/frames/client.d.cts +0 -36
  106. package/types-cjs/frames/frame-client.d.cts +0 -356
  107. package/types-cjs/frames/frame-sink.d.cts +0 -194
  108. package/types-cjs/frames/frame-transport.d.cts +0 -222
  109. package/types-cjs/frames/serializer.d.cts +0 -182
  110. package/types-cjs/frames/server.d.cts +0 -52
  111. package/types-cjs/index.d.cts +0 -244
  112. package/types-cjs/jsx-properties.d.cts +0 -93
  113. package/types-cjs/jsx.d.cts +0 -4159
  114. package/types-cjs/package.json +0 -3
  115. package/types-cjs/response.d.cts +0 -174
  116. package/types-cjs/serializer-decode.d.cts +0 -182
  117. package/types-cjs/serializer.d.cts +0 -182
  118. package/types-cjs/server-functions/client.d.cts +0 -262
  119. package/types-cjs/server-functions/flash.d.cts +0 -38
  120. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  121. package/types-cjs/server-functions/server.d.cts +0 -681
  122. package/types-cjs/server-functions/shared.d.cts +0 -523
  123. package/types-cjs/server-mock.d.cts +0 -286
  124. package/types-cjs/server.d.cts +0 -544
@@ -1,5 +1,6 @@
1
- import { createRenderEffect, createMemo, runWithOwner, sharedConfig, untrack, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, OBSERVE, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
+ import { sharedConfig, enableServerComponentHydration, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, sourceKeys, SOURCE_PROXY, SOURCE_PLAIN, dynamicCore } from 'solid-js/internal';
3
4
 
4
5
  const DOMWithState = {
5
6
  INPUT: {
@@ -48,98 +49,96 @@ const Namespaces = {
48
49
  const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
49
50
  const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
50
51
  const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
52
+ const COMPOSED_BODY_FRAMING = /*#__PURE__*/new Set(["content-length", "content-encoding", "transfer-encoding"]);
51
53
 
52
54
  const transparentOptions = {
53
55
  transparent: true,
54
56
  sync: true
55
57
  };
58
+ let spreadName;
59
+ let spreadLoc;
60
+ function setSpreadName(name, loc) {
61
+ spreadName = name;
62
+ spreadLoc = loc;
63
+ }
56
64
  const syncOptions = {
57
65
  sync: true
58
66
  };
59
- const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
60
- sync: true,
61
- ...options,
62
- transparent: !options.scope
63
- } : transparentOptions);
64
- const memo = fn => createMemo(() => fn(), syncOptions);
65
- const assetGates = new WeakMap();
66
- const waitAsset = promise => {
67
- let gate = assetGates.get(promise);
68
- if (!gate) {
69
- runWithOwner(null, () => {
70
- gate = createMemo(() => promise);
71
- });
72
- assetGates.set(promise, gate);
73
- }
74
- gate();
75
- };
67
+ function effect(fn, effectFn, options) {
68
+ if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
69
+ ...options,
70
+ name: spreadName + ".spread",
71
+ loc: spreadLoc
72
+ };
73
+ const nodeOptions = options ? {
74
+ sync: true,
75
+ ...options,
76
+ transparent: !options.scope
77
+ } : transparentOptions;
78
+ createRenderEffect(fn, effectFn, nodeOptions);
79
+ }
80
+ function memo(fn) {
81
+ return createMemo(() => fn(), syncOptions);
82
+ }
76
83
 
77
84
  function reconcileArrays(parentNode, a, b, marker) {
85
+ let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
86
+ if (active === document.body) active = null;
87
+ const slot = marker || parentNode;
88
+ const insert = (n, ref) => {
89
+ active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
90
+ if (marker || n[$$SLOT]) n[$$SLOT] = slot;
91
+ };
92
+ if (!a.length) {
93
+ for (const n of b) insert(n, marker);
94
+ return;
95
+ }
96
+ const isLive = n => {
97
+ if (!n) return false;
98
+ const tag = n[$$SLOT];
99
+ return n.parentNode === parentNode && (!tag || tag === slot);
100
+ };
78
101
  let bLength = b.length,
79
102
  aEnd = a.length,
80
103
  bEnd = bLength,
81
104
  aStart = 0,
82
105
  bStart = 0,
83
106
  tail = a[aEnd - 1],
84
- tailTag = tail[$$SLOT],
85
- after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
107
+ after = isLive(tail) ? tail.nextSibling : marker || null,
86
108
  map = null,
87
109
  anchor,
88
110
  anchorTag;
89
- const isLive = n => {
90
- if (!n) return false;
91
- const tag = n[$$SLOT];
92
- return n.parentNode === parentNode && (!tag || tag === marker);
93
- };
94
111
  while (aStart < aEnd || bStart < bEnd) {
95
- if (a[aStart] === b[bStart] && isLive(a[aStart])) {
112
+ if (a[aStart] === b[bStart]) {
96
113
  aStart++;
97
114
  bStart++;
98
115
  continue;
99
116
  }
100
- while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
117
+ while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
101
118
  aEnd--;
102
119
  bEnd--;
103
120
  }
104
121
  if (aEnd === aStart) {
105
- let node;
106
- if (bEnd < bLength) {
107
- if (bStart) {
108
- const prev = b[bStart - 1];
109
- const prevTag = prev[$$SLOT];
110
- node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
111
- } else node = b[bEnd - bStart];
112
- } else node = after;
113
- while (bStart < bEnd) {
114
- const n = b[bStart++];
115
- parentNode.insertBefore(n, node);
116
- if (marker) n[$$SLOT] = marker;
117
- }
122
+ let k = bEnd;
123
+ while (k < bLength && !isLive(b[k])) k++;
124
+ const node = k < bLength ? b[k] : after;
125
+ while (bStart < bEnd) insert(b[bStart++], node);
118
126
  } else if (bEnd === bStart) {
119
127
  while (aStart < aEnd) {
120
128
  const n = a[aStart++];
121
- if (!map || !map.has(n)) {
122
- const tag = n[$$SLOT];
123
- if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
124
- }
125
- }
126
- } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
127
- if (marker) {
128
- do {
129
- const n = a[--aEnd];
130
- parentNode.insertBefore(n, anchor);
131
- n[$$SLOT] = marker;
132
- bStart++;
133
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
134
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
135
- } else {
136
- do {
137
- parentNode.insertBefore(a[--aEnd], anchor);
138
- bStart++;
139
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
140
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
129
+ if ((!map || !map.has(n)) && isLive(n)) n.remove();
141
130
  }
131
+ } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
132
+ do {
133
+ insert(a[--aEnd], anchor);
134
+ bStart++;
135
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
136
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
142
137
  } else {
138
+ if (!isLive(a[aStart])) {
139
+ aStart++;
140
+ continue;
141
+ }
143
142
  if (!map) {
144
143
  map = new Map();
145
144
  let i = bStart;
@@ -156,31 +155,16 @@ function reconcileArrays(parentNode, a, b, marker) {
156
155
  sequence++;
157
156
  }
158
157
  if (sequence > index - bStart) {
159
- const head = a[aStart];
160
- const headTag = head[$$SLOT];
161
- const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
162
- while (bStart < index) {
163
- const n = b[bStart++];
164
- parentNode.insertBefore(n, node);
165
- if (marker) n[$$SLOT] = marker;
166
- }
158
+ const node = a[aStart];
159
+ while (bStart < index) insert(b[bStart++], node);
167
160
  } else {
168
- const oldNode = a[aStart++];
169
- const newNode = b[bStart++];
170
- const oldTag = oldNode[$$SLOT];
171
- if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
172
- parentNode.replaceChild(newNode, oldNode);
173
- } else {
174
- parentNode.insertBefore(newNode, after);
175
- }
176
- if (marker) newNode[$$SLOT] = marker;
161
+ const newNode = b[bStart++],
162
+ node = a[aStart++];
163
+ active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
164
+ if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
177
165
  }
178
166
  } else aStart++;
179
- } else {
180
- const n = a[aStart++];
181
- const nTag = n[$$SLOT];
182
- if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
183
- }
167
+ } else a[aStart++].remove();
184
168
  }
185
169
  }
186
170
  }
@@ -217,11 +201,28 @@ function classifyHeadTag(desc) {
217
201
  resource: false
218
202
  };
219
203
  }
204
+ function qualifierValue(name, value) {
205
+ if (value == null || value === false) return null;
206
+ if (name === "imagesrcset" || name === "imagesizes") return typeof value === "string" && value !== "" ? value : null;
207
+ const v = value === true ? "" : String(value);
208
+ if (name === "as") return asciiLowerCase(v);
209
+ if (name !== "crossorigin") return v;
210
+ return v.length === 15 && v.toLowerCase() === "use-credentials" ? v.toLowerCase() : "anonymous";
211
+ }
212
+ function asciiLowerCase(value) {
213
+ return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
214
+ }
215
+ const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
216
+ function headBodyText(tag, props, text) {
217
+ return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
218
+ }
220
219
  function resourceIdentity(tag, props) {
221
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
220
+ const url = String(props.href || props.src || "");
221
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
222
222
  for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
223
223
  const q = RESOURCE_QUALIFIERS[i];
224
- if (props[q] != null) id += ":" + q + "=" + props[q];
224
+ const value = qualifierValue(q, props[q]);
225
+ if (value !== null) id += ":" + q + "=" + value.length + ":" + value;
225
226
  }
226
227
  return id;
227
228
  }
@@ -255,7 +256,6 @@ function resolveHead(groups) {
255
256
  }
256
257
  for (const [identity, tags] of byIdentity) {
257
258
  if (identity === "title") {
258
- if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
259
259
  winners.set(identity, {
260
260
  seq: group.seq,
261
261
  tags: [tags[tags.length - 1]]
@@ -301,6 +301,7 @@ function serializeCookie(name, value, options = {}) {
301
301
  if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
302
302
  if (options.httpOnly) cookie += "; HttpOnly";
303
303
  if (options.secure) cookie += "; Secure";
304
+ if (options.partitioned) cookie += "; Partitioned";
304
305
  if (options.sameSite) {
305
306
  const sameSite = options.sameSite.toLowerCase();
306
307
  cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
@@ -308,7 +309,7 @@ function serializeCookie(name, value, options = {}) {
308
309
  return cookie;
309
310
  }
310
311
  const FLASH_COOKIE = "flash";
311
- const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
312
+ const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
312
313
  function hasFlashCookie(cookieHeader) {
313
314
  return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
314
315
  }
@@ -329,33 +330,96 @@ function getServerFunctionRPC() {
329
330
  return globalThis[SERVER_FUNCTION_RPC];
330
331
  }
331
332
 
332
- const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
333
+ const assetGates = new WeakMap();
334
+ const waitAsset = promise => {
335
+ let gate = assetGates.get(promise);
336
+ if (!gate) {
337
+ runWithOwner(null, () => {
338
+ gate = createMemo(() => promise, {
339
+ transparent: true
340
+ });
341
+ });
342
+ assetGates.set(promise, gate);
343
+ }
344
+ gate();
345
+ };
346
+ const EVENT_KEY = "_$$";
347
+ const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
348
+ const $$EVENT_TUPLE = Symbol();
349
+ const hasOwn = Object.prototype.hasOwnProperty;
333
350
  const INNER_OWNED = {};
334
351
  const delegatedEvents = new Set();
335
352
  const delegatedContainers = new Map();
336
- function render$1(code, element, init, options = {}) {
337
- if (!element) {
338
- throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
353
+ function voidFn() {}
354
+ function generateHydrationScript(_options) {
355
+ return "";
356
+ }
357
+ function HydrationScript(_props) {
358
+ return null;
359
+ }
360
+ const getRequestEvent = voidFn;
361
+ const getHydrationWriter = voidFn;
362
+ function takeHydrationValue(key) {
363
+ const registry = globalThis._$HY && globalThis._$HY.r;
364
+ if (!registry || !(key in registry)) return;
365
+ const v = registry[key];
366
+ delete registry[key];
367
+ if (v !== null && typeof v === "object" && typeof v.then === "function") {
368
+ if (v.s === 1) return {
369
+ status: "resolved",
370
+ value: v.v
371
+ };
372
+ if (v.s === 2) {
373
+ v.then(undefined, voidFn);
374
+ return {
375
+ status: "rejected",
376
+ error: v.v
377
+ };
378
+ }
379
+ return {
380
+ status: "pending",
381
+ promise: v
382
+ };
339
383
  }
384
+ return {
385
+ status: "resolved",
386
+ value: v
387
+ };
388
+ }
389
+ function setLinkClaim(_handler) {
390
+ return false;
391
+ }
392
+ function hasServerLinkState() {
393
+ const registry = globalThis._$HY && globalThis._$HY.r;
394
+ return !!registry && registry.links === 1;
395
+ }
396
+ const getTraceContext = voidFn;
397
+ function render(code, element, init, options = {}) {
340
398
  let disposer;
341
399
  registerDelegatedRoot(element);
342
400
  try {
343
401
  createRoot(dispose => {
344
402
  disposer = dispose;
403
+ if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
345
404
  if (element === document) {
346
405
  const tree = code();
347
406
  effect(() => flatten(tree), () => {});
348
407
  } else {
349
408
  const tree = code();
350
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
409
+ insert(element, () => tree, element.firstChild ? null : undefined, init, {
410
+ ...options.insertOptions,
411
+ schedule: true
412
+ });
351
413
  }
352
414
  }, {
353
415
  id: options.renderId
354
416
  });
417
+ flush();
355
418
  } catch (err) {
356
419
  if (disposer) disposer();
357
420
  unregisterDelegatedRoot(element);
358
421
  throw err;
422
+ } finally {
359
423
  }
360
424
  return () => {
361
425
  disposer();
@@ -364,7 +428,6 @@ function render$1(code, element, init, options = {}) {
364
428
  };
365
429
  }
366
430
  function create(html, bypassGuard, flag) {
367
- if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
368
431
  const t = document.createElement("template");
369
432
  t.innerHTML = html;
370
433
  return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
@@ -372,7 +435,6 @@ function create(html, bypassGuard, flag) {
372
435
  function template(html, flag) {
373
436
  let node;
374
437
  const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
375
- fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
376
438
  return fn;
377
439
  }
378
440
  function delegateEvents(eventNames) {
@@ -415,10 +477,33 @@ function unregisterDelegatedContainer(container, owner = container) {
415
477
  }
416
478
  function attachDelegatedEvent(name, container, state) {
417
479
  if (state.handlers.has(name)) return;
418
- const handler = e => eventHandler(e, container, state);
480
+ const handler = e => dispatchAsInteraction(e, () => eventHandler(e, container, state)) ;
419
481
  state.handlers.set(name, handler);
420
482
  container.addEventListener(name, handler);
421
483
  }
484
+ function describeEventTarget(target) {
485
+ if (!target || typeof target.tagName !== "string") return undefined;
486
+ const tag = target.tagName.toLowerCase();
487
+ let out = tag;
488
+ if (target.id) out += `#${target.id}`;else if (typeof target.name === "string" && target.name) out += `[name=${target.name}]`;
489
+ if (tag !== "input" && tag !== "textarea" && tag !== "select") {
490
+ const text = (target.textContent || "").trim().replace(/\s+/g, " ");
491
+ if (text) out += ` "${text.length > 30 ? text.slice(0, 29) + "…" : text}"`;
492
+ }
493
+ return out;
494
+ }
495
+ function interactionStart(e) {
496
+ const at = e.timeStamp;
497
+ return typeof at === "number" && at >= 0 && at <= performance.now() ? at : undefined;
498
+ }
499
+ function dispatchAsInteraction(e, fn) {
500
+ return OBSERVE.attribution.withInteraction({
501
+ type: e.type,
502
+ target: describeEventTarget(e.target),
503
+ at: interactionStart(e),
504
+ event: e
505
+ }, fn) ;
506
+ }
422
507
  function getDelegatedRoot(node) {
423
508
  while (node) {
424
509
  if (delegatedContainers.get(node)?.roots) return node;
@@ -439,17 +524,35 @@ function findOwner(target, state) {
439
524
  }
440
525
  function setProperty(node, name, value) {
441
526
  if (isHydrating(node)) return;
527
+ const nodeName = node.nodeName;
528
+ if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
529
+ if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
530
+ } else node[name] = value;
531
+ reclaimAttribute(node, name);
532
+ }
533
+ function setStatefulProperty(node, name, value) {
442
534
  node[name] = value;
443
535
  }
444
536
  let claimHandlers = null;
445
- const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
446
- function registerElementClaim(handler) {
537
+ const claimAttributeSets = [];
538
+ const CLAIM_SEAM = Symbol.for("solid.element-claims");
539
+ function registerElementClaim(handler, options) {
447
540
  (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
541
+ claimAttributeSets.push(options?.attributes || ["href", "action"]);
448
542
  return () => {
449
543
  const index = claimHandlers.indexOf(handler);
450
- index > -1 && claimHandlers.splice(index, 1);
544
+ if (index > -1) {
545
+ claimHandlers.splice(index, 1);
546
+ claimAttributeSets.splice(index, 1);
547
+ }
451
548
  };
452
549
  }
550
+ function runClaimHandlers(handlers, node) {
551
+ for (let i = 0; i < handlers.length; i++) handlers[i](node);
552
+ }
553
+ function reclaimAttribute(node, name) {
554
+ if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
555
+ }
453
556
  const CLAIMED_ELEMENTS = "a[href], form[action]";
454
557
  function claimElementTree(root) {
455
558
  const handlers = globalThis[CLAIM_SEAM];
@@ -457,46 +560,70 @@ function claimElementTree(root) {
457
560
  const isElement = root.nodeType === 1;
458
561
  if (!isElement && root.nodeType !== 11) return root;
459
562
  if (isElement && root.matches(CLAIMED_ELEMENTS)) {
460
- for (let i = 0; i < handlers.length; i++) handlers[i](root);
563
+ root._$claimed = true;
564
+ runClaimHandlers(handlers, root);
461
565
  }
462
566
  const found = root.querySelectorAll(CLAIMED_ELEMENTS);
463
567
  for (let i = 0; i < found.length; i++) {
464
- for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
568
+ found[i]._$claimed = true;
569
+ runClaimHandlers(handlers, found[i]);
465
570
  }
466
571
  return root;
467
572
  }
468
- function claimElement(node) {
469
- if (claimHandlers !== null) {
470
- for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
573
+ function claimElement(node, owner) {
574
+ if (claimHandlers !== null && !node._$claimed) {
575
+ node._$claimed = true;
576
+ if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
471
577
  }
472
578
  return node;
473
579
  }
474
580
  function setAttribute(node, name, value) {
475
581
  if (isHydrating(node)) return;
476
- if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
477
- if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
582
+ const selectMultiple = name === "multiple" && node.localName === "select";
583
+ if (value == null || value === false) node.removeAttribute(name);else {
584
+ node.setAttribute(name, value === true ? "" : value);
585
+ if (selectMultiple && !node._$multiple) {
586
+ const options = node.options;
587
+ for (let i = 0; i < options.length; i++) {
588
+ if (options[i].defaultSelected) options[i].selected = true;
589
+ }
590
+ }
591
+ }
592
+ if (selectMultiple) node._$multiple = true;
593
+ reclaimAttribute(node, name);
478
594
  }
479
595
  function setAttributeNS(node, namespace, name, value) {
480
596
  if (isHydrating(node)) return;
481
597
  if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
598
+ reclaimAttribute(node, name);
482
599
  }
483
600
  function className(node, value, prev) {
484
- if (isHydrating(node)) return;
601
+ if (typeof value === "number") value = "" + value;
602
+ if (typeof prev === "number") prev = "" + prev;
603
+ if (isHydrating(node)) {
604
+ node._$classes = value && typeof value === "object" ? classListToObject(value) : undefined;
605
+ return;
606
+ }
485
607
  if (value == null || value === false) {
486
- prev && node.removeAttribute("class");
608
+ if (prev || node._$classes) {
609
+ node.removeAttribute("class");
610
+ node._$classes = undefined;
611
+ }
487
612
  return;
488
613
  }
489
614
  if (typeof value === "string") {
615
+ node._$classes = undefined;
490
616
  value !== prev && node.setAttribute("class", value);
491
617
  return;
492
618
  }
619
+ let applied;
493
620
  if (typeof prev === "string") {
494
- prev = {};
621
+ applied = {};
495
622
  node.removeAttribute("class");
496
- } else prev = classListToObject(prev || {});
623
+ } else applied = node._$classes || classListToObject(prev || {});
497
624
  value = classListToObject(value);
498
- const classKeys = Object.keys(value || {});
499
- const prevKeys = Object.keys(prev);
625
+ const classKeys = Object.keys(value);
626
+ const prevKeys = Object.keys(applied);
500
627
  let i, len;
501
628
  for (i = 0, len = prevKeys.length; i < len; i++) {
502
629
  const key = prevKeys[i];
@@ -506,22 +633,39 @@ function className(node, value, prev) {
506
633
  for (i = 0, len = classKeys.length; i < len; i++) {
507
634
  const key = classKeys[i],
508
635
  classValue = !!value[key];
509
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
636
+ if (!key || key === "undefined" || applied[key] === classValue || !classValue) continue;
510
637
  node.classList.add(key);
511
638
  }
639
+ node._$classes = value;
512
640
  }
513
641
  function addEvent(node, name, handler, delegate) {
514
642
  if (delegate) {
643
+ const key = EVENT_KEY + name;
644
+ let data;
515
645
  if (Array.isArray(handler)) {
516
- node[`$$${name}`] = handler[0];
517
- node[`$$${name}Data`] = handler[1];
518
- } else node[`$$${name}`] = handler;
519
- } else if (Array.isArray(handler)) {
646
+ data = handler[1];
647
+ node[key] = handler[0];
648
+ } else node[key] = handler;
649
+ node[`${key}Data`] = data;
650
+ return;
651
+ }
652
+ if (Array.isArray(handler)) {
520
653
  const handlerFn = handler[0];
521
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
522
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
654
+ const listener = e => dispatchAsInteraction(e, () => handlerFn.call(node, handler[1], e)) ;
655
+ listener[$$EVENT_TUPLE] = handler;
656
+ node.addEventListener(name, listener);
657
+ return listener;
658
+ }
659
+ if (typeof handler === "function") {
660
+ const listener = e => dispatchAsInteraction(e, () => handler.call(node, e));
661
+ node.addEventListener(name, listener);
662
+ return listener;
663
+ }
664
+ node.addEventListener(name, handler, typeof handler !== "function" && handler);
665
+ return handler;
523
666
  }
524
667
  function style(node, value, prev) {
668
+ if (isHydrating(node)) return;
525
669
  if (!value) {
526
670
  if (prev || node._$styles) {
527
671
  setAttribute(node, "style");
@@ -546,12 +690,13 @@ function style(node, value, prev) {
546
690
  }
547
691
  let v, s;
548
692
  for (s in applied) {
549
- if (value[s] == null) {
693
+ if (!hasOwn.call(value, s) || value[s] == null) {
550
694
  nodeStyle.removeProperty(s);
551
695
  delete applied[s];
552
696
  }
553
697
  }
554
698
  for (s in value) {
699
+ if (!hasOwn.call(value, s)) continue;
555
700
  v = value[s];
556
701
  if (v != null && v !== applied[s]) {
557
702
  nodeStyle.setProperty(s, v);
@@ -559,26 +704,134 @@ function style(node, value, prev) {
559
704
  }
560
705
  }
561
706
  }
707
+ function readShallow(value) {
708
+ if (value === null || typeof value !== "object") return value;
709
+ if (Array.isArray(value)) return value.map(readShallow);
710
+ if (value[$PROXY] !== value) return value;
711
+ const keys = Reflect.ownKeys(value);
712
+ const out = {};
713
+ for (let i = 0; i < keys.length; i++) {
714
+ const k = keys[i];
715
+ if (typeof k === "string") out[k] = value[k];
716
+ }
717
+ return out;
718
+ }
562
719
  function setStyleProperty(node, name, value) {
720
+ if (isHydrating(node)) return;
563
721
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
564
722
  }
565
- function spread(node, props = {}, skipChildren) {
723
+ function spread(node, props, skipChildren, skip, name, loc) {
724
+ if (name !== undefined) {
725
+ const outer = spreadName;
726
+ const outerLoc = spreadLoc;
727
+ setSpreadName(name, loc);
728
+ try {
729
+ return spread(node, props, skipChildren, skip);
730
+ } finally {
731
+ setSpreadName(outer, outerLoc);
732
+ }
733
+ }
566
734
  const prevProps = {};
567
- if (!skipChildren) insert(node, () => props.children);
568
- effect(() => {
569
- const r = props.ref;
570
- (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
571
- }, () => {});
735
+ const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
736
+ const apply = newProps => {
737
+ const r = newProps.ref;
738
+ if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
739
+ assign(node, newProps, true, prevProps, true);
740
+ if (owner !== undefined) claimElement(node, owner);
741
+ };
742
+ if (Array.isArray(props)) {
743
+ effect(() => collectSources({}, props, undefined, skip), apply);
744
+ if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
745
+ for (let i = props.length - 1; i >= 0; i--) {
746
+ const s = resolveSource(props[i]);
747
+ if (s != null && entryHas(s, "children")) return entryGet(s, "children");
748
+ }
749
+ });
750
+ return prevProps;
751
+ }
572
752
  effect(() => {
753
+ const source = resolveSource(props);
573
754
  const newProps = {};
574
- for (const prop in props) {
575
- if (prop === "children" || prop === "ref") continue;
576
- newProps[prop] = props[prop];
755
+ const table = resolvedTable(source);
756
+ if (table !== undefined) return collectTable(newProps, table, skip);
757
+ if (source != null) {
758
+ const view = viewOf(source);
759
+ if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
577
760
  }
578
761
  return newProps;
579
- }, props => assign(node, props, true, prevProps, true));
762
+ }, apply);
763
+ if (!skipChildren && !(skip !== undefined && skip("children"))) {
764
+ if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
765
+ const desc = Object.getOwnPropertyDescriptor(props, "children");
766
+ if (desc !== undefined) {
767
+ if (desc.get === undefined) insert(node, desc.value);else insert(node, () => props.children);
768
+ }
769
+ } else insert(node, () => {
770
+ const source = resolveSource(props);
771
+ return source != null && entryHas(source, "children") ? entryGet(source, "children") : undefined;
772
+ });
773
+ }
580
774
  return prevProps;
581
775
  }
776
+ function collectTable(out, table, skip) {
777
+ for (const [prop, leaf] of table) {
778
+ if (typeof prop !== "string" || prop === "children") continue;
779
+ if (skip !== undefined && skip(prop)) continue;
780
+ const v = leaf[prop];
781
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
782
+ }
783
+ return out;
784
+ }
785
+ function resolveSource(s) {
786
+ return typeof s === "function" ? s() : s;
787
+ }
788
+ function entryHas(s, key) {
789
+ const view = viewOf(s);
790
+ return view instanceof OmitView ? sourceHas(view, SOURCE_OMIT, key) : key in s;
791
+ }
792
+ function entryGet(s, key) {
793
+ const view = viewOf(s);
794
+ return view instanceof OmitView ? sourceGet(view, SOURCE_OMIT, key) : s[key];
795
+ }
796
+ function collectSources(out, sources, kinds, skip) {
797
+ const resolved = [];
798
+ const resolvedKinds = [];
799
+ for (let i = 0; i < sources.length; i++) pushEntry(resolved, resolvedKinds, sources[i], kinds !== undefined ? kinds[i] : SOURCE_MEMO);
800
+ for (let i = 0; i < resolved.length; i++) collectProps(out, resolved[i], resolvedKinds[i], skip, resolved, resolvedKinds, i + 1);
801
+ return out;
802
+ }
803
+ function pushEntry(resolved, kinds, s, kind) {
804
+ if (kind !== SOURCE_MEMO) {
805
+ resolved.push(s);
806
+ kinds.push(kind);
807
+ return;
808
+ }
809
+ s = resolveSource(s);
810
+ if (s == null) return;
811
+ const view = viewOf(s);
812
+ if (view instanceof OmitView) {
813
+ resolved.push(view);
814
+ kinds.push(SOURCE_OMIT);
815
+ } else if (view !== undefined) {
816
+ const f = view.sources,
817
+ k = view.kinds;
818
+ for (let j = 0; j < f.length; j++) pushEntry(resolved, kinds, f[j], k[j]);
819
+ } else {
820
+ resolved.push(s);
821
+ kinds.push($PROXY in s ? SOURCE_PROXY : SOURCE_PLAIN);
822
+ }
823
+ }
824
+ function collectProps(out, s, kind, skip, later, laterKinds, from) {
825
+ const keys = sourceKeys(s, kind);
826
+ outer: for (let i = 0; i < keys.length; i++) {
827
+ const prop = keys[i];
828
+ if (typeof prop !== "string" || prop === "children") continue;
829
+ if (skip !== undefined && skip(prop)) continue;
830
+ if (later !== undefined) for (let j = from; j < later.length; j++) if (sourceHas(later[j], laterKinds[j], prop)) continue outer;
831
+ const v = sourceGet(s, kind, prop);
832
+ out[prop] = prop === "style" || prop === "class" ? readShallow(v) : v;
833
+ }
834
+ }
582
835
  function dynamicProperty(props, key) {
583
836
  const src = props[key];
584
837
  Object.defineProperty(props, key, {
@@ -596,11 +849,6 @@ function ref(fn, element) {
596
849
  const resolved = untrack(fn);
597
850
  runWithOwner(null, () => applyRef(resolved, element));
598
851
  }
599
- const PURE_ROW = Symbol.for("solid.pure-row");
600
- function rowProof(fn) {
601
- fn[PURE_ROW] = true;
602
- return fn;
603
- }
604
852
  function scope(fn) {
605
853
  fn.$s = true;
606
854
  return fn;
@@ -609,19 +857,19 @@ const SCOPE_OPTIONS = {
609
857
  scope: true
610
858
  };
611
859
  let hydrationRt = null;
860
+ let selectInsert = null;
612
861
  function installHydrationRuntime() {
613
862
  hydrationRt = {
614
863
  claimInitial(parent, multi, initial) {
615
864
  if (isHydrating(parent)) {
616
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
617
- if (Array.isArray(initial)) stripTextSeparators(initial);
865
+ if (!multi && initial === undefined && parent) initial = claimChildNodes(parent);else if (Array.isArray(initial)) stripTextSeparators(initial);
618
866
  }
619
867
  return initial;
620
868
  },
621
869
  reclaimRegion(current, parent, marker) {
622
- if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
870
+ if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
623
871
  const first = Array.isArray(current) ? current[0] : current;
624
- if (!first || !first.nodeType || first.isConnected) return current;
872
+ if (first == null || first.isConnected) return current;
625
873
  let nodes;
626
874
  if (marker) {
627
875
  nodes = [];
@@ -638,7 +886,7 @@ function installHydrationRuntime() {
638
886
  nodes.unshift(node);
639
887
  node = node.previousSibling;
640
888
  }
641
- } else nodes = [...parent.childNodes];
889
+ } else return claimChildNodes(parent);
642
890
  return stripTextSeparators(nodes);
643
891
  },
644
892
  dedupEvent(e) {
@@ -651,25 +899,42 @@ function stripTextSeparators(nodes) {
651
899
  for (let i = 0; i < nodes.length; i++) {
652
900
  const node = nodes[i],
653
901
  t = node.nodeType;
654
- if (t === 8) {
655
- const v = node.nodeValue;
656
- if (v === "!$") {
657
- node.remove();
658
- continue;
659
- }
660
- if (v.startsWith("pl-")) continue;
661
- } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
902
+ if (t === 8 && node.nodeValue === "!$") {
903
+ node.remove();
904
+ continue;
905
+ }
906
+ if (isPlaceholderScaffolding(node, t)) continue;
662
907
  nodes[j++] = node;
663
908
  }
664
909
  nodes.length = j;
665
910
  return nodes;
666
911
  }
667
- function patchDriver(subject, body) {
668
- {
669
- effect(() => body(subject, subject, false), () => body(subject, undefined, true));
912
+ function claimChildNodes(parent) {
913
+ const live = parent.childNodes;
914
+ const out = [];
915
+ for (let i = 0, n = live.length; i < n; i++) {
916
+ const node = live[i],
917
+ t = node.nodeType;
918
+ if (t === 8 && node.nodeValue === "!$") {
919
+ node.remove();
920
+ i--;
921
+ n--;
922
+ continue;
923
+ }
924
+ if (isPlaceholderScaffolding(node, t)) continue;
925
+ out.push(node);
670
926
  }
927
+ return out;
928
+ }
929
+ function isPlaceholderScaffolding(node, t) {
930
+ return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
671
931
  }
672
932
  function insert(parent, accessor, marker, initial, options) {
933
+ if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
934
+ ...options,
935
+ name: spreadName + ".children",
936
+ loc: spreadLoc
937
+ };
673
938
  const multi = marker !== undefined;
674
939
  const host = options && options.host;
675
940
  if (multi && !initial) initial = [];
@@ -688,17 +953,21 @@ function insert(parent, accessor, marker, initial, options) {
688
953
  initial = [placeholder];
689
954
  }
690
955
  let current = initial;
691
- effect(prev => {
956
+ let ran = false;
957
+ effect(() => {
692
958
  if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
693
959
  const value = normalize(accessor(), current, multi, true);
960
+ const again = ran;
961
+ ran = true;
694
962
  if (typeof value !== "function") return value;
963
+ const innerOptions = again && !(options && options.schedule) ? {
964
+ ...options,
965
+ schedule: true
966
+ } : options;
695
967
  effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
696
968
  current = insertExpression(parent, inner, current, marker);
697
969
  host && tagHost(current, host);
698
- }, prev !== undefined && !(options && options.schedule) ? {
699
- ...options,
700
- schedule: true
701
- } : options);
970
+ }, innerOptions);
702
971
  return INNER_OWNED;
703
972
  }, value => {
704
973
  if (value === INNER_OWNED) return;
@@ -733,10 +1002,16 @@ function assetEntryKey(descriptor) {
733
1002
  if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
734
1003
  return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
735
1004
  }
736
- function findAssetElement(selector, attr, value) {
1005
+ function findAssetElement(selector, attr, value, qualifiers) {
737
1006
  const nodes = document.querySelectorAll(selector);
738
- for (let i = 0; i < nodes.length; i++) {
739
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
1007
+ outer: for (let i = 0; i < nodes.length; i++) {
1008
+ if (nodes[i].getAttribute(attr) !== value) continue;
1009
+ if (!qualifiers) return nodes[i];
1010
+ for (let q = 0; q < RESOURCE_QUALIFIERS.length; q++) {
1011
+ const name = RESOURCE_QUALIFIERS[q];
1012
+ if (qualifierValue(name, qualifiers[name]) !== qualifierValue(name, nodes[i].getAttribute(name))) continue outer;
1013
+ }
1014
+ return nodes[i];
740
1015
  }
741
1016
  return null;
742
1017
  }
@@ -979,7 +1254,6 @@ function flushHeadRegistry() {
979
1254
  if (headApplied.get(identity) === sig) continue;
980
1255
  headApplied.set(identity, sig);
981
1256
  if (identity === "base" || identity === "charset") {
982
- console.warn(`useHead: <${winner.tags[0].tag}> (${identity}) is shell-only and ignored on the client`);
983
1257
  continue;
984
1258
  }
985
1259
  if (identity === "title") {
@@ -1002,16 +1276,15 @@ function flushHeadRegistry() {
1002
1276
  function createHeadElement(tag, props) {
1003
1277
  const el = document.createElement(tag);
1004
1278
  for (const name in props) {
1005
- if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1279
+ if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
1006
1280
  if (!HEAD_ATTR_NAME.test(name)) {
1007
- console.warn(`useHead: ignoring invalid attribute name "${name}"`);
1008
1281
  continue;
1009
1282
  }
1010
1283
  const v = props[name];
1011
1284
  if (v == null || v === false) continue;
1012
1285
  el.setAttribute(name, v === true ? "" : String(v));
1013
1286
  }
1014
- if (props.children != null) el.textContent = String(props.children);
1287
+ if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
1015
1288
  return el;
1016
1289
  }
1017
1290
  function renderHeadElement(t, identity, existing) {
@@ -1026,7 +1299,7 @@ function renderHeadElement(t, identity, existing) {
1026
1299
  function headElementMatches(el, t) {
1027
1300
  if (el.tagName.toLowerCase() !== t.tag) return false;
1028
1301
  for (const name in t.props) {
1029
- if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1302
+ if (name === "children" || name === "ref" || /^on[A-Z]/.test(name)) continue;
1030
1303
  if (!HEAD_ATTR_NAME.test(name)) continue;
1031
1304
  const v = t.props[name];
1032
1305
  if (v == null || v === false) {
@@ -1034,7 +1307,7 @@ function headElementMatches(el, t) {
1034
1307
  } else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
1035
1308
  }
1036
1309
  const children = t.props.children;
1037
- return (children == null ? "" : String(children)) === el.textContent;
1310
+ return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
1038
1311
  }
1039
1312
  function mountHeadResource(tag, props) {
1040
1313
  const identity = resourceIdentity(tag, props);
@@ -1042,8 +1315,8 @@ function mountHeadResource(tag, props) {
1042
1315
  headMountedResources.add(identity);
1043
1316
  const url = props.href || props.src;
1044
1317
  let el = null;
1045
- if (url != null) {
1046
- if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1318
+ if (tag === "link" && url == null && typeof props.imagesrcset === "string") el = findAssetElement(`link[rel="${props.rel}"]`, "href", null, props);else if (url != null) {
1319
+ if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url, props);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1047
1320
  }
1048
1321
  if (!el) document.head.appendChild(createHeadElement(tag, props));
1049
1322
  }
@@ -1065,7 +1338,7 @@ function gateHeadResource(props) {
1065
1338
  if (attrs) descriptor.attrs = attrs;
1066
1339
  effect(() => {
1067
1340
  const entry = warmAsset(descriptor);
1068
- if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1341
+ if (gateable && !isHydrating() && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1069
1342
  }, () => acquireAsset(descriptor));
1070
1343
  }
1071
1344
  function useHead(tags) {
@@ -1083,7 +1356,6 @@ function useHead(tags) {
1083
1356
  for (let i = 0; i < list.length; i++) {
1084
1357
  const desc = list[i];
1085
1358
  if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
1086
- console.warn(`useHead: ignoring non-head tag`, desc);
1087
1359
  continue;
1088
1360
  }
1089
1361
  const cls = classifyHeadTag(desc);
@@ -1148,9 +1420,34 @@ function loadModuleAssets(mapping) {
1148
1420
  }
1149
1421
  return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1150
1422
  }
1151
- function hydrate$1(code, element, options = {}) {
1423
+ function hydrate(code, element, options = {}) {
1424
+ enableHydration();
1152
1425
  installHydrationRuntime();
1153
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
1426
+ const hy = globalThis._$HY;
1427
+ const id = options.renderId || "";
1428
+ if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
1429
+ let started, disposer;
1430
+ const start = () => started || (started = true, disposer = hydrate(code, element, options));
1431
+ (hy.sp || (hy.sp = [])).push([id, start]);
1432
+ hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
1433
+ document.addEventListener("DOMContentLoaded", start, {
1434
+ once: true
1435
+ });
1436
+ return () => {
1437
+ started = true;
1438
+ disposer && disposer();
1439
+ };
1440
+ }
1441
+ if (hy.done) return render(code, element, [...element.childNodes], options);
1442
+ const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
1443
+ if (head && element.contains(head)) {
1444
+ let n = head.firstChild;
1445
+ while (n && n.nodeType === 1 && n.hasAttribute("data-dh") && !n.hasAttribute("data-dhf")) {
1446
+ const next = n.nextSibling;
1447
+ head.appendChild(n);
1448
+ n = next;
1449
+ }
1450
+ }
1154
1451
  options.renderId ||= "";
1155
1452
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1156
1453
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -1185,16 +1482,6 @@ function hydrate$1(code, element, options = {}) {
1185
1482
  });
1186
1483
  };
1187
1484
  sharedConfig.hydrating = true;
1188
- {
1189
- sharedConfig.verifyHydration = () => {
1190
- if (sharedConfig.registry && sharedConfig.registry.size) {
1191
- const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
1192
- sharedConfig.registry.clear();
1193
- if (!orphaned.length) return;
1194
- console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
1195
- }
1196
- };
1197
- }
1198
1485
  const hyr = globalThis._$HY.r;
1199
1486
  const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
1200
1487
  if (rootMapping && typeof rootMapping === "object") {
@@ -1209,45 +1496,39 @@ function hydrate$1(code, element, options = {}) {
1209
1496
  sharedConfig.gather = gather;
1210
1497
  sharedConfig.hydrating = true;
1211
1498
  try {
1212
- disposer = render$1(code, element, [...element.childNodes], options);
1499
+ disposer = render(code, element, [...element.childNodes], options);
1213
1500
  } finally {
1214
1501
  sharedConfig.hydrating = false;
1215
1502
  }
1216
1503
  }, err => {
1217
- console.error("Hydration module preload failed, falling back to client render:", err);
1218
1504
  sharedConfig.hydrating = false;
1219
1505
  sharedConfig.registry = undefined;
1220
- disposer = render$1(code, element, [...element.childNodes], options);
1506
+ if (element.nodeType === 9) {
1507
+ (globalThis.reportError || console.error)(err);
1508
+ return;
1509
+ }
1510
+ console.error("Hydration module preload failed, falling back to client render:", err);
1511
+ disposer = render(code, element, [...element.childNodes], options);
1221
1512
  });
1222
1513
  return () => disposer && disposer();
1223
1514
  }
1224
1515
  }
1225
1516
  try {
1226
1517
  gatherHydratable(element, options.renderId);
1227
- return render$1(code, element, [...element.childNodes], options);
1518
+ return render(code, element, [...element.childNodes], options);
1228
1519
  } finally {
1229
1520
  sharedConfig.hydrating = false;
1230
1521
  }
1231
1522
  }
1232
1523
  function getNextElement(template) {
1233
- let node,
1234
- key,
1235
- hydrating = isHydrating();
1236
- if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
1524
+ let key = sharedConfig.hydrating && getHydrationKey(),
1525
+ node = isHydrating() && sharedConfig.registry.get(key);
1526
+ if (!node) {
1237
1527
  if (!template) {
1238
1528
  throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
1239
1529
  }
1240
- if (hydrating) {
1241
- console.warn(`Hydration key miss for "${key}": no server-rendered element carries this key` + (template._html ? ` (template: ${template._html.slice(0, 60)})` : "") + `. A detached element was created instead; its subtree will not appear in the ` + `document or become interactive. This usually means the server and client ` + `hydration id namespaces are misaligned — when hydrating a subtree of a larger ` + `server render, wrap the document shell in <NoHydration> and re-enter with ` + `<Hydration> around the hydrated subtree (or pass hydrate() a renderId matching ` + `the server's <Hydration id>).`);
1242
- }
1243
1530
  return template(true);
1244
1531
  }
1245
- if (template && template._html) {
1246
- const expected = template._html.match(/^<(\w+)/)?.[1];
1247
- if (expected && node.localName !== expected) {
1248
- console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
1249
- }
1250
- }
1251
1532
  if (sharedConfig.completed) sharedConfig.completed.add(node);
1252
1533
  sharedConfig.registry.delete(key);
1253
1534
  return node;
@@ -1277,48 +1558,12 @@ function getNextMarker(start) {
1277
1558
  }
1278
1559
  function getFirstChild(node, expectedTag) {
1279
1560
  const child = node.firstChild;
1280
- if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
1281
- const isMissing = !child || child.nodeType !== 1;
1282
- console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
1283
- }
1284
1561
  return child;
1285
1562
  }
1286
1563
  function getNextSibling(node, expectedTag) {
1287
1564
  const sibling = node.nextSibling;
1288
- if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
1289
- const parent = node.parentNode;
1290
- const isMissing = !sibling || sibling.nodeType !== 1;
1291
- console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
1292
- }
1293
1565
  return sibling;
1294
1566
  }
1295
- function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
1296
- if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
1297
- const children = [];
1298
- let child = parent.firstChild;
1299
- while (child) {
1300
- if (child.nodeType === 1) children.push(child);
1301
- child = child.nextSibling;
1302
- }
1303
- const pTag = parent.localName || "#fragment";
1304
- if (isMissing) {
1305
- const tags = children.map(c => `<${c.localName}>`).join("");
1306
- return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
1307
- }
1308
- const idx = children.indexOf(mismatchChild);
1309
- let start = 0,
1310
- end = children.length;
1311
- let prefix = "",
1312
- suffix = "";
1313
- if (children.length > 6) {
1314
- start = Math.max(0, idx - 2);
1315
- end = Math.min(children.length, idx + 3);
1316
- if (start > 0) prefix = "...";
1317
- if (end < children.length) suffix = "...";
1318
- }
1319
- const tags = children.slice(start, end).map(c => c === mismatchChild ? `<${c.localName} \u2190 expected ${expectedTag}>` : `<${c.localName}>`).join("");
1320
- return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
1321
- }
1322
1567
  function runHydrationEvents() {
1323
1568
  if (sharedConfig.events && !sharedConfig.events.queued) {
1324
1569
  queueMicrotask(() => {
@@ -1358,6 +1603,7 @@ function runHydrationEvents() {
1358
1603
  matches.sort((a, b) => a.distance - b.distance);
1359
1604
  for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
1360
1605
  } else if (matchContainer) eventHandler(e, matchContainer, matchState);
1606
+ flush();
1361
1607
  }
1362
1608
  if (sharedConfig.done) {
1363
1609
  sharedConfig.events = _$HY.events = null;
@@ -1369,14 +1615,34 @@ function runHydrationEvents() {
1369
1615
  }
1370
1616
  function isHydrating(node) {
1371
1617
  if (!sharedConfig.hydrating) return false;
1618
+ if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
1372
1619
  if (!node || node.isConnected) return true;
1373
- const roots = sharedConfig.claimRoots;
1374
- if (roots) {
1375
- for (let i = 0; i < roots.length; i++) {
1376
- if (roots[i].contains(node)) return true;
1620
+ return serverComponentClaims !== null && serverComponentClaims.claimed(node);
1621
+ }
1622
+ let serverComponentClaims = null;
1623
+ function installServerComponentHydration() {
1624
+ enableServerComponentHydration();
1625
+ if (serverComponentClaims !== null) return;
1626
+ serverComponentClaims = {
1627
+ claimed(node) {
1628
+ const roots = sharedConfig.claimRoots;
1629
+ if (roots) {
1630
+ for (let i = 0; i < roots.length; i++) {
1631
+ if (roots[i].contains(node)) return true;
1632
+ }
1633
+ }
1634
+ return false;
1635
+ },
1636
+ inFrame(element) {
1637
+ const frames = element.querySelectorAll("[data-fid]");
1638
+ const frameCount = frames.length;
1639
+ if (frameCount === 0) return undefined;
1640
+ return node => {
1641
+ for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
1642
+ return false;
1643
+ };
1377
1644
  }
1378
- }
1379
- return false;
1645
+ };
1380
1646
  }
1381
1647
  function classListToObject(classList) {
1382
1648
  if (Array.isArray(classList)) {
@@ -1400,7 +1666,8 @@ function classListToObject(classList) {
1400
1666
  function flattenClassList(list, result) {
1401
1667
  for (let i = 0, len = list.length; i < len; i++) {
1402
1668
  const item = list[i];
1403
- if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
1669
+ if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);
1670
+ else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
1404
1671
  }
1405
1672
  }
1406
1673
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
@@ -1411,22 +1678,26 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
1411
1678
  if (!skipRef && value) ref(() => value, node);
1412
1679
  return value;
1413
1680
  }
1681
+ let c;
1414
1682
  const hasNamespace = prop.indexOf(":") > -1;
1415
- if (!hasNamespace && prop.slice(0, 2) === "on") {
1683
+ if (!hasNamespace && prop.startsWith("on") && (c = prop.charCodeAt(2)) > 64 && c < 91) {
1416
1684
  const name = prop.slice(2).toLowerCase();
1417
1685
  const delegate = DelegatedEvents.has(name);
1418
1686
  if (!delegate && prev) {
1419
- const h = Array.isArray(prev) ? prev[0] : prev;
1420
- node.removeEventListener(name, h);
1687
+ if (Array.isArray(value) && typeof prev === "function" && prev[$$EVENT_TUPLE] === value) return prev;
1688
+ node.removeEventListener(name, prev, typeof prev !== "function" && prev);
1421
1689
  }
1422
1690
  if (delegate || value) {
1423
- addEvent(node, name, value, delegate);
1691
+ const attached = addEvent(node, name, value, delegate);
1424
1692
  delegate && delegateEvents([name]);
1693
+ if (!delegate) return attached;
1425
1694
  }
1426
1695
  } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1427
1696
  if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
1428
- if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
1429
- node[prop] = value ?? "";else node[prop] = value;
1697
+ if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
1698
+ if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
1699
+ } else node[prop] = value;
1700
+ reclaimAttribute(node, prop);
1430
1701
  } else {
1431
1702
  const ns = hasNamespace && Namespaces[prop.split(":")[0]];
1432
1703
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
@@ -1441,27 +1712,21 @@ function eventHandler(e, container, state) {
1441
1712
  if (prev === true || prev === container || !container.contains(prev)) return;
1442
1713
  resumeNode = prev;
1443
1714
  }
1444
- const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1445
- if (state && !owner) return;
1446
- if (owner && owner === resumeNode) return;
1447
- e[$$EVENT_OWNER] = owner || true;
1715
+ const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
1716
+ if (!owner) return;
1717
+ if (owner === resumeNode) return;
1718
+ e[$$EVENT_OWNER] = owner;
1448
1719
  let node = resumeNode || e.target;
1449
- const key = `$$${e.type}`;
1450
- const oriTarget = e.target;
1451
- const boundary = owner || container || e.currentTarget;
1720
+ const key = EVENT_KEY + e.type;
1452
1721
  const retarget = value => Object.defineProperty(e, "target", {
1453
1722
  configurable: true,
1454
1723
  value
1455
1724
  });
1456
1725
  const handleNode = () => {
1457
- let handler = node[key];
1458
- if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
1459
- const seam = globalThis[Symbol.for("dx.bnd")];
1460
- if (seam) handler = seam.resolve(node, e.type);
1461
- }
1726
+ const handler = node[key];
1462
1727
  if (handler && !node.disabled) {
1463
1728
  const data = node[`${key}Data`];
1464
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
1729
+ data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
1465
1730
  if (e.cancelBubble) return;
1466
1731
  }
1467
1732
  node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
@@ -1469,19 +1734,19 @@ function eventHandler(e, container, state) {
1469
1734
  };
1470
1735
  const walkUpTree = () => {
1471
1736
  while (node && handleNode()) {
1472
- if (node === boundary || node.parentNode === boundary) break;
1737
+ if (node === owner || node.parentNode === owner) break;
1473
1738
  node = node._$host || node.parentNode || node.host;
1474
1739
  }
1475
1740
  };
1476
1741
  Object.defineProperty(e, "currentTarget", {
1477
1742
  configurable: true,
1478
1743
  get() {
1479
- return node || boundary || document;
1744
+ return node || owner;
1480
1745
  }
1481
1746
  });
1482
1747
  if (resumeNode) {
1483
1748
  if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1484
- if (node && node !== boundary) walkUpTree();
1749
+ if (node && node !== owner) walkUpTree();
1485
1750
  } else if (e.composedPath) {
1486
1751
  const path = e.composedPath();
1487
1752
  if (path.length) {
@@ -1494,21 +1759,35 @@ function eventHandler(e, container, state) {
1494
1759
  walkUpTree();
1495
1760
  break;
1496
1761
  }
1497
- if (node === boundary || node.parentNode === boundary) {
1762
+ if (node === owner || node.parentNode === owner) {
1498
1763
  break;
1499
1764
  }
1500
1765
  }
1501
1766
  } else walkUpTree();
1502
1767
  }
1503
1768
  else walkUpTree();
1504
- retarget(oriTarget);
1769
+ delete e.target;
1770
+ delete e.currentTarget;
1505
1771
  }
1506
1772
  function insertExpression(parent, value, current, marker) {
1507
1773
  if (hydrationRt !== null && isHydrating(parent)) {
1508
- if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1774
+ if (value && value !== current) {
1775
+ const arr = Array.isArray(value);
1776
+ for (const n of arr ? value : [value]) {
1777
+ if (n && n.nodeType) {
1778
+ if (!isHydrating(n)) return current;
1779
+ } else if (arr && (typeof n === "string" || typeof n === "number")) {
1780
+ return current;
1781
+ }
1782
+ }
1783
+ }
1509
1784
  return value;
1510
1785
  }
1511
1786
  if (value === current) return value;
1787
+ if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
1788
+ const tracked = [].concat(current ?? []);
1789
+ if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
1790
+ }
1512
1791
  const t = typeof value,
1513
1792
  multi = marker !== undefined;
1514
1793
  if (t === "string" || t === "number") {
@@ -1526,29 +1805,65 @@ function insertExpression(parent, value, current, marker) {
1526
1805
  } else if (value.nodeType) {
1527
1806
  if (Array.isArray(current)) {
1528
1807
  cleanChildren(parent, current, multi ? marker : null, value);
1529
- } else if (current && current.nodeType) {
1808
+ } else if (current != null && current.nodeType) {
1530
1809
  current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1531
- } else if (current && parent.firstChild) {
1810
+ } else if (current != null && parent.firstChild) {
1532
1811
  parent.replaceChild(value, parent.firstChild);
1533
1812
  } else {
1534
1813
  parent.appendChild(value);
1535
1814
  }
1536
- if (marker) value[$$SLOT] = marker;
1815
+ if (marker || value[$$SLOT]) value[$$SLOT] = marker || parent;
1537
1816
  } else if (Array.isArray(value)) {
1538
- const currentArray = current && Array.isArray(current);
1817
+ const currentArray = Array.isArray(current);
1818
+ for (let i = 0, len = value.length; i < len; i++) {
1819
+ const item = value[i],
1820
+ t = typeof item;
1821
+ if (t === "string" || t === "number") {
1822
+ const prev = currentArray ? current[i] : undefined;
1823
+ if (prev && prev.nodeType === 3) {
1824
+ if (prev.data !== "" + item) prev.data = item;
1825
+ value[i] = prev;
1826
+ } else value[i] = document.createTextNode(item);
1827
+ }
1828
+ }
1539
1829
  if (value.length === 0) {
1540
1830
  cleanChildren(parent, current, marker);
1541
1831
  } else if (currentArray) {
1542
- if (current.length === 0) {
1543
- appendNodes(parent, value, marker);
1544
- } else reconcileArrays(parent, current, value, marker);
1832
+ reconcileArrays(parent, current, value, marker);
1545
1833
  } else {
1546
- current && cleanChildren(parent, current);
1547
- appendNodes(parent, value);
1834
+ if (current != null) cleanChildren(parent, current);
1835
+ reconcileArrays(parent, [], value);
1548
1836
  }
1549
- } else console.warn(`Unrecognized value. Skipped inserting`, value);
1837
+ } else ;
1838
+ selectInsert && selectInsert(parent);
1550
1839
  return value;
1551
1840
  }
1841
+ function selectChange(e) {
1842
+ (e = e.currentTarget || e)._$v = null;
1843
+ e.removeEventListener("change", selectChange, true);
1844
+ }
1845
+ function writeSelectValue(node, value) {
1846
+ const had = node._$v && node._$v.map,
1847
+ has = value != null && value.map;
1848
+ if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
1849
+ if (value == null) {
1850
+ node._$v = null;
1851
+ return queueMicrotask(() => node.value = value) || (node.value = value);
1852
+ }
1853
+ node._$v = value;
1854
+ (selectInsert ||= applySelectValue)(node);
1855
+ queueMicrotask(() => selectInsert(node));
1856
+ }
1857
+ function applySelectValue(p) {
1858
+ p && p._$v == null && (p = p.parentNode);
1859
+ const v = p && p._$v;
1860
+ if (v == null) return;
1861
+ if (v.map) {
1862
+ const o = [...p.options];
1863
+ for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
1864
+ v.every(x => o.some(el => el.value == x)) && selectChange(p);
1865
+ } else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
1866
+ }
1552
1867
  function normalize(value, current, multi, doNotUnwrap) {
1553
1868
  value = flatten(value, {
1554
1869
  skipNonRendered: true,
@@ -1556,12 +1871,12 @@ function normalize(value, current, multi, doNotUnwrap) {
1556
1871
  });
1557
1872
  if (doNotUnwrap && typeof value === "function") return value;
1558
1873
  if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
1559
- if (Array.isArray(value)) {
1874
+ if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
1560
1875
  for (let i = 0, len = value.length; i < len; i++) {
1561
1876
  const item = value[i],
1562
1877
  prev = current && current[i],
1563
1878
  t = typeof item;
1564
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
1879
+ if ((t === "string" || t === "number") && prev && prev.nodeType === 3 && isHydrating(prev)) value[i] = prev;
1565
1880
  }
1566
1881
  }
1567
1882
  return value;
@@ -1577,13 +1892,6 @@ function tagHost(value, host) {
1577
1892
  });
1578
1893
  }
1579
1894
  }
1580
- function appendNodes(parent, array, marker = null) {
1581
- for (let i = 0, len = array.length; i < len; i++) {
1582
- const n = array[i];
1583
- parent.insertBefore(n, marker);
1584
- if (marker) n[$$SLOT] = marker;
1585
- }
1586
- }
1587
1895
  function ownsAllChildren(parent, current) {
1588
1896
  if (current == null) return true;
1589
1897
  if (Array.isArray(current)) {
@@ -1618,33 +1926,31 @@ function cleanChildren(parent, current, marker, replacement) {
1618
1926
  const el = current[i];
1619
1927
  if (replacement !== el) {
1620
1928
  const tag = el[$$SLOT];
1621
- const owns = el.parentNode === parent && (!tag || tag === marker);
1929
+ const owns = el.parentNode === parent && (!tag || tag === (marker || parent));
1622
1930
  if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
1623
1931
  } else inserted = true;
1624
1932
  }
1625
1933
  } else if (replacement) parent.insertBefore(replacement, marker);
1626
- if (replacement && marker) replacement[$$SLOT] = marker;
1934
+ if (replacement && (marker || replacement[$$SLOT])) replacement[$$SLOT] = marker || parent;
1627
1935
  }
1628
1936
  function gatherHydratable(element, root) {
1629
- const templates = element.querySelectorAll(`*[_hk]`);
1937
+ const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
1938
+ const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
1939
+ const registry = sharedConfig.registry;
1630
1940
  for (let i = 0; i < templates.length; i++) {
1631
1941
  const node = templates[i];
1942
+ if (inFrame !== undefined && inFrame(node)) continue;
1632
1943
  const key = node.getAttribute("_hk");
1633
- if (root) {
1634
- if (!key.startsWith(root)) continue;
1635
- } else {
1636
- const frame = node.closest("[data-fid]");
1637
- if (frame && frame !== element && element.contains(frame)) continue;
1638
- }
1639
- if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
1944
+ if (!registry.has(key)) registry.set(key, node);
1640
1945
  }
1641
1946
  }
1642
1947
  function getHydrationKey() {
1643
1948
  return sharedConfig.getNextContextId();
1644
1949
  }
1645
- const voidFn = () => undefined;
1646
1950
  const RequestContext = Symbol();
1647
1951
 
1952
+ function configureServerErrors(_config) {}
1953
+ function reportRequestFailure(_error, _event) {}
1648
1954
  function throwInBrowser(func) {
1649
1955
  const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
1650
1956
  console.error(err);
@@ -1674,28 +1980,38 @@ function composeMiddleware(middlewares) {
1674
1980
  throwInBrowser(composeMiddleware);
1675
1981
  }
1676
1982
  function ssr(template, ...nodes) {}
1677
- function ssrElement(name, props, children, needsId) {}
1983
+ function ssrElement(name, props, children, needsId, skip, attrs) {}
1984
+ function ssrElementAttribute(key, value) {}
1985
+ function ssrLinkClaim(attrs) {}
1678
1986
  function ssrClassName(value) {}
1679
1987
  function ssrStyle(value) {}
1680
1988
  function ssrStyleProperty(name, value) {}
1989
+ function ssrStyleProperties(...entries) {}
1681
1990
  function ssrAttribute(key, value) {}
1682
1991
  function ssrGroup(fn, n) {}
1683
1992
  function ssrHydrationKey() {}
1684
- function resolveSSRNode(node, result, top) {}
1993
+ function resolveSSRNode(node, result, top, nested) {}
1685
1994
  function escape(s, attr) {}
1686
1995
 
1687
1996
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1688
- // PURE-annotated factory (same convention as solid's MockPromise): the brand
1689
- const ResponseEnvelope = /* @__PURE__ */(() => {
1690
- class ResponseEnvelope {
1691
- constructor(response, value) {
1692
- this.response = response;
1693
- this.value = value;
1694
- }
1997
+ let EnvelopeClass;
1998
+ const ResponseEnvelope = function ResponseEnvelope(response, value) {
1999
+ if (!EnvelopeClass) {
2000
+ EnvelopeClass = class extends Response {
2001
+ constructor(response, value) {
2002
+ super(response ? response.body : null, response && {
2003
+ status: response.status,
2004
+ statusText: response.statusText,
2005
+ headers: copyHeaders(response.headers)
2006
+ });
2007
+ this.response = response ? this : undefined;
2008
+ this.value = value;
2009
+ }
2010
+ };
2011
+ EnvelopeClass.prototype[ENVELOPE] = true;
1695
2012
  }
1696
- ResponseEnvelope.prototype[ENVELOPE] = true;
1697
- return ResponseEnvelope;
1698
- })();
2013
+ return new EnvelopeClass(response, value);
2014
+ };
1699
2015
  function isResponseEnvelope(value) {
1700
2016
  return !!(value && typeof value === "object" && value[ENVELOPE]);
1701
2017
  }
@@ -1718,24 +2034,38 @@ function isSafeError(value) {
1718
2034
  return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1719
2035
  }
1720
2036
  const REVALIDATE_HEADER = "X-Revalidate";
1721
- function initWithRevalidate(init) {
2037
+ const REVALIDATE_ALL = "*";
2038
+ const RESPONSE_HEADER_VALUE_LIMIT = 4096;
2039
+ function copyHeaders(init) {
2040
+ const source = init;
2041
+ if (!source || !source.getSetCookie) return new Headers(init);
2042
+ const headers = new Headers();
2043
+ source.forEach((value, key) => {
2044
+ if (key !== "set-cookie") headers.append(key, value);
2045
+ });
2046
+ for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
2047
+ return headers;
2048
+ }
2049
+ function initWithRevalidate(init = {}) {
2050
+ const resolved = typeof init === "number" ? {
2051
+ status: init
2052
+ } : init;
1722
2053
  const {
1723
2054
  revalidate,
1724
2055
  ...responseInit
1725
- } = init;
1726
- let headers;
1727
- if (responseInit.headers && responseInit.headers.getSetCookie) {
1728
- headers = new Headers();
1729
- responseInit.headers.forEach((value, key) => {
1730
- if (key !== "set-cookie") headers.append(key, value);
1731
- });
1732
- for (const cookie of responseInit.headers.getSetCookie()) {
1733
- headers.append("Set-Cookie", cookie);
2056
+ } = resolved;
2057
+ const headers = copyHeaders(responseInit.headers);
2058
+ if (revalidate !== undefined) {
2059
+ const list = Array.isArray(revalidate) ? revalidate : [revalidate];
2060
+ if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
2061
+ throw new TypeError(`revalidate names "${REVALIDATE_ALL}" alongside other keys; "${REVALIDATE_ALL}" already ` + `means every entry and stands alone — pass revalidate: "${REVALIDATE_ALL}" or the named keys.`);
1734
2062
  }
1735
- } else {
1736
- headers = new Headers(responseInit.headers);
2063
+ const keys = list.join(",");
2064
+ if (keys.length > RESPONSE_HEADER_VALUE_LIMIT) {
2065
+ throw new TypeError(`revalidate names ${keys.length} characters of cache keys; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the ${REVALIDATE_HEADER} header would overflow ` + `receivers (an 8 KiB proxy buffer holds the whole header block) and the response ` + `dies at the socket after the mutation committed. Split the invalidation across ` + `calls or use coarser keys — a dropped key would be a silently stale cache, so ` + `the runtime refuses rather than trims.`);
2066
+ }
2067
+ headers.set(REVALIDATE_HEADER, keys);
1737
2068
  }
1738
- revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
1739
2069
  return {
1740
2070
  responseInit,
1741
2071
  headers
@@ -1748,13 +2078,17 @@ function redirect(url, init = 302) {
1748
2078
  const {
1749
2079
  responseInit,
1750
2080
  headers
1751
- } = initWithRevalidate(typeof init === "number" ? {
1752
- status: init
1753
- } : init);
2081
+ } = initWithRevalidate(init);
1754
2082
  if (responseInit.status === undefined) {
1755
2083
  responseInit.status = 302;
1756
2084
  }
1757
- headers.set("Location", String(url));
2085
+ const target = typeof url === "string" ? url : url[HREF];
2086
+ const location = typeof target === "string" ? target : String(url);
2087
+ const encoded = location.replace(/[^\x00-\x7f]/gu, encodeURIComponent);
2088
+ if (encoded.length > RESPONSE_HEADER_VALUE_LIMIT) {
2089
+ throw new TypeError(`redirect() target is ${encoded.length} characters; past ` + `${RESPONSE_HEADER_VALUE_LIMIT} the Location header (and the scripted transport's ` + `redirect header) would overflow receivers and the response dies at the socket. ` + `A target this size is usually unbounded input echoed into the url — carry the ` + `state server-side instead. Refused rather than trimmed: a cut target is a ` + `different address.`);
2090
+ }
2091
+ headers.set("Location", encoded);
1758
2092
  return new Response(null, {
1759
2093
  ...responseInit,
1760
2094
  headers
@@ -1770,40 +2104,33 @@ function reload(init = {}) {
1770
2104
  headers
1771
2105
  });
1772
2106
  }
2107
+ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
1773
2108
  function respond(value, init = {}) {
1774
2109
  const {
1775
2110
  responseInit,
1776
2111
  headers
1777
2112
  } = initWithRevalidate(init);
2113
+ for (const header of COMPOSED_BODY_FRAMING) headers.delete(header);
2114
+ if (NULL_BODY_STATUSES.has(responseInit.status)) {
2115
+ return new ResponseEnvelope(new Response(null, {
2116
+ ...responseInit,
2117
+ headers
2118
+ }), value);
2119
+ }
1778
2120
  headers.set("Content-Type", "application/json");
1779
- return new ResponseEnvelope(new Response(JSON.stringify(value), {
2121
+ return new ResponseEnvelope(new Response(new ReadableStream({
2122
+ pull(controller) {
2123
+ controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
2124
+ controller.close();
2125
+ }
2126
+ }), {
1780
2127
  ...responseInit,
1781
2128
  headers
1782
2129
  }), value);
1783
2130
  }
1784
2131
 
1785
- const mergeProps = merge;
1786
2132
  const isServer = false;
1787
- const isDev = true;
1788
- function render(code, element, init, options = {}) {
1789
- enforceLoadingBoundary(true);
1790
- try {
1791
- const dispose = render$1(code, element, init, {
1792
- ...options,
1793
- insertOptions: {
1794
- schedule: true
1795
- }
1796
- });
1797
- flush();
1798
- return dispose;
1799
- } finally {
1800
- enforceLoadingBoundary(false);
1801
- }
1802
- }
1803
- const hydrate = (...args) => {
1804
- enableHydration();
1805
- return hydrate$1(...args);
1806
- };
2133
+ const isDev = false;
1807
2134
  function Portal(props) {
1808
2135
  return runWithOwner(createOwner(), () => portalImpl(props));
1809
2136
  }
@@ -1856,67 +2183,25 @@ function portalImpl(props) {
1856
2183
  });
1857
2184
  return treeMarker;
1858
2185
  }
1859
- const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
1860
- function bindingOf(value) {
1861
- return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
1862
- }
1863
- function dynamic(source) {
1864
- let latest = 0;
1865
- const sites = new Set();
1866
- let deliveredAddress;
1867
- const resolveBinding = (next, prev) => {
1868
- const binding = bindingOf(next);
1869
- if (!binding) return next;
1870
- deliveredAddress = binding.address;
1871
- const prevBinding = bindingOf(prev);
1872
- if (prevBinding && prevBinding.component === binding.component) {
1873
- for (const deliver of sites) deliver(binding.address);
1874
- return prev;
1875
- }
1876
- return next;
1877
- };
1878
- const cached = createMemo(prev => {
1879
- const next = source();
1880
- if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1881
- const token = ++latest;
1882
- return {
1883
- then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
1884
- };
1885
- }, {
1886
- lazy: true
1887
- });
1888
- return props => {
1889
- return createMemo(() => {
1890
- const component = cached();
1891
- switch (typeof component) {
1892
- case "function":
1893
- {
1894
- Object.assign(component, {
1895
- [$DEVCOMP]: true
1896
- });
1897
- const binding = bindingOf(component);
1898
- if (binding) {
1899
- const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
1900
- sites.add(setAddress);
1901
- onCleanup(() => sites.delete(setAddress));
1902
- return untrack(() => binding.component(props, address));
1903
- }
1904
- return untrack(() => component(props));
1905
- }
1906
- case "string":
1907
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
1908
- spread(el, props);
1909
- return el;
1910
- }
1911
- });
1912
- };
2186
+ function dynamic(source, options) {
2187
+ return dynamicCore(source, options, staticElement);
2188
+ }
2189
+ function staticElement(tag, props) {
2190
+ const hydrating = sharedConfig.hydrating;
2191
+ const create = () => createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
2192
+ const el = hydrating ? getNextElement(create) : create();
2193
+ spread(el, props);
2194
+ if (hydrating) runHydrationEvents();
2195
+ return el;
1913
2196
  }
1914
2197
  function Dynamic(props) {
1915
2198
  const Comp = dynamic(() => props.component);
1916
2199
  return createComponent(Comp, omit(props, "component"));
1917
2200
  }
1918
- function createElement(tagName, is = undefined) {
1919
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
2201
+ function createElement(tagName, is = undefined, xmlns = undefined) {
2202
+ return xmlns ? document.createElementNS(xmlns, tagName, {
2203
+ is
2204
+ }) : SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1920
2205
  is
1921
2206
  });
1922
2207
  }
@@ -1948,4 +2233,4 @@ _moduleUrl) {
1948
2233
  function httpStatus(_code, _text) {}
1949
2234
  function httpHeader(_name, _value, _options) {}
1950
2235
 
1951
- export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, parseCookieHeader, patchDriver, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, rowProof, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, warmAsset };
2236
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };