@sylwellsoftware/fray 0.6.0 → 1.0.0

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 (117) hide show
  1. package/README.md +426 -205
  2. package/colors/README.md +26 -23
  3. package/colors/gray/colors.css +1 -42
  4. package/colors/green/colors.css +1 -42
  5. package/colors/iceblue/colors.css +5 -43
  6. package/colors/ocean/colors.css +1 -42
  7. package/colors/orange/colors.css +1 -42
  8. package/colors/purple/colors.css +1 -42
  9. package/colors/red/colors.css +1 -42
  10. package/colors/yellow/colors.css +1 -42
  11. package/dist/Components/Placeholder.d.ts +1 -2
  12. package/dist/Components/Placeholder.d.ts.map +1 -1
  13. package/dist/Components/component.d.ts +15 -7
  14. package/dist/Components/component.d.ts.map +1 -1
  15. package/dist/Components/data/descriptionList.d.ts +3 -1
  16. package/dist/Components/data/descriptionList.d.ts.map +1 -1
  17. package/dist/Components/data/listview/listview.d.ts +1 -2
  18. package/dist/Components/data/listview/listview.d.ts.map +1 -1
  19. package/dist/Components/data/table/DataTable.d.ts +1 -1
  20. package/dist/Components/data/table/DataTable.d.ts.map +1 -1
  21. package/dist/Components/data/table/FilterPanel.d.ts +2 -4
  22. package/dist/Components/data/table/FilterPanel.d.ts.map +1 -1
  23. package/dist/Components/data/table/TableHeader.d.ts +2 -0
  24. package/dist/Components/data/table/TableHeader.d.ts.map +1 -1
  25. package/dist/Components/data/table/TableHeaderCell.d.ts +1 -1
  26. package/dist/Components/data/table/TableHeaderCell.d.ts.map +1 -1
  27. package/dist/Components/data/treeview/treeitem.d.ts +1 -0
  28. package/dist/Components/data/treeview/treeitem.d.ts.map +1 -1
  29. package/dist/Components/data/treeview/treeview.d.ts +2 -1
  30. package/dist/Components/data/treeview/treeview.d.ts.map +1 -1
  31. package/dist/Components/dialog/dialog.d.ts +6 -2
  32. package/dist/Components/dialog/dialog.d.ts.map +1 -1
  33. package/dist/Components/layout/header.d.ts +19 -0
  34. package/dist/Components/layout/header.d.ts.map +1 -0
  35. package/dist/Components/layout/panel.d.ts +7 -3
  36. package/dist/Components/layout/panel.d.ts.map +1 -1
  37. package/dist/Components/layout/sidebar.d.ts +4 -0
  38. package/dist/Components/layout/sidebar.d.ts.map +1 -1
  39. package/dist/Components/layout/splitView.d.ts +1 -1
  40. package/dist/Components/layout/splitView.d.ts.map +1 -1
  41. package/dist/Components/layout/tabpanel/tab.d.ts +3 -0
  42. package/dist/Components/layout/tabpanel/tab.d.ts.map +1 -1
  43. package/dist/Components/layout/tabpanel/tabline.d.ts +1 -2
  44. package/dist/Components/layout/tabpanel/tabline.d.ts.map +1 -1
  45. package/dist/Components/layout/tabpanel/tabpanel.d.ts +10 -2
  46. package/dist/Components/layout/tabpanel/tabpanel.d.ts.map +1 -1
  47. package/dist/Components/lineinputs/CheckableControl.d.ts +7 -0
  48. package/dist/Components/lineinputs/CheckableControl.d.ts.map +1 -0
  49. package/dist/Components/lineinputs/LabeledInputControl.d.ts +7 -0
  50. package/dist/Components/lineinputs/LabeledInputControl.d.ts.map +1 -0
  51. package/dist/Components/lineinputs/SelectControl.d.ts +7 -0
  52. package/dist/Components/lineinputs/SelectControl.d.ts.map +1 -0
  53. package/dist/Components/lineinputs/checkbox/Checkbox.d.ts +11 -6
  54. package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -1
  55. package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts +1 -2
  56. package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts.map +1 -1
  57. package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts +1 -2
  58. package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts.map +1 -1
  59. package/dist/Components/lineinputs/dropdown.d.ts +7 -6
  60. package/dist/Components/lineinputs/dropdown.d.ts.map +1 -1
  61. package/dist/Components/lineinputs/label.d.ts +14 -0
  62. package/dist/Components/lineinputs/label.d.ts.map +1 -0
  63. package/dist/Components/lineinputs/radio.d.ts +64 -0
  64. package/dist/Components/lineinputs/radio.d.ts.map +1 -0
  65. package/dist/Components/lineinputs/textbox.d.ts +7 -6
  66. package/dist/Components/lineinputs/textbox.d.ts.map +1 -1
  67. package/dist/Components/lineinputs/toggle.d.ts +10 -3
  68. package/dist/Components/lineinputs/toggle.d.ts.map +1 -1
  69. package/dist/Components/menu/button.d.ts +6 -3
  70. package/dist/Components/menu/button.d.ts.map +1 -1
  71. package/dist/Components/menu/toolbar.d.ts +1 -1
  72. package/dist/Components/menu/toolbar.d.ts.map +1 -1
  73. package/dist/Components/status/progressBar.d.ts +1 -1
  74. package/dist/Components/status/progressBar.d.ts.map +1 -1
  75. package/dist/Components/theme/stylesheetPicker.d.ts +6 -7
  76. package/dist/Components/theme/stylesheetPicker.d.ts.map +1 -1
  77. package/dist/index.d.ts +11 -1
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +3378 -1454
  80. package/dist/index.js.map +1 -1
  81. package/dist/jsx-dev-runtime-CRDpvXOH.js +1208 -0
  82. package/dist/jsx-dev-runtime-CRDpvXOH.js.map +1 -0
  83. package/dist/jsx-dev-runtime.js +1 -1
  84. package/dist/jsx-runtime.js +1 -1
  85. package/dist/routing/RouteLink.d.ts +18 -0
  86. package/dist/routing/RouteLink.d.ts.map +1 -0
  87. package/dist/routing/RouteQuery.d.ts +19 -0
  88. package/dist/routing/RouteQuery.d.ts.map +1 -0
  89. package/dist/routing/RouteScope.d.ts +18 -0
  90. package/dist/routing/RouteScope.d.ts.map +1 -0
  91. package/dist/routing/RouteValue.d.ts +19 -0
  92. package/dist/routing/RouteValue.d.ts.map +1 -0
  93. package/dist/routing/navigationAdapter.d.ts +33 -0
  94. package/dist/routing/navigationAdapter.d.ts.map +1 -0
  95. package/dist/routing/route.d.ts +64 -0
  96. package/dist/routing/route.d.ts.map +1 -0
  97. package/dist/routing/router.d.ts +109 -0
  98. package/dist/routing/router.d.ts.map +1 -0
  99. package/dist/runtime.d.ts +10 -13
  100. package/dist/runtime.d.ts.map +1 -1
  101. package/dist/styling/styleRegistry.d.ts +0 -4
  102. package/dist/styling/styleRegistry.d.ts.map +1 -1
  103. package/dist/styling/theme.d.ts +14 -2
  104. package/dist/styling/theme.d.ts.map +1 -1
  105. package/package.json +5 -6
  106. package/styles/structural.css +942 -320
  107. package/themes/README.md +30 -72
  108. package/themes/base.css +311 -0
  109. package/themes/java/theme.css +14 -411
  110. package/themes/minimal/theme.css +3 -407
  111. package/themes/shiny/theme.css +127 -500
  112. package/dist/jsx-dev-runtime-CqunwZ8j.js +0 -1174
  113. package/dist/jsx-dev-runtime-CqunwZ8j.js.map +0 -1
  114. package/dist/styling/baseStyleDefinitions.d.ts +0 -75
  115. package/dist/styling/baseStyleDefinitions.d.ts.map +0 -1
  116. package/themes/dark.css +0 -86
  117. package/themes/light.css +0 -86
@@ -0,0 +1,1208 @@
1
+ var ye = Object.defineProperty;
2
+ var be = (e, t, n) => t in e ? ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var l = (e, t, n) => be(e, typeof t != "symbol" ? t + "" : t, n);
4
+ const D = "data-fray-structural-styles";
5
+ let ge = 1;
6
+ class G {
7
+ constructor(t = `runtime-${ge++}`) {
8
+ l(this, "id");
9
+ l(this, "cssFragments", /* @__PURE__ */ new Map());
10
+ if (typeof t != "string") throw new TypeError("StyleRegistry id must be a string");
11
+ this.id = t;
12
+ }
13
+ registerCSS(t) {
14
+ if (typeof t != "string") throw new TypeError("Component CSS must be a string");
15
+ const n = t.trim();
16
+ return n.length > 0 && this.cssFragments.set(`raw:${n}`, { kind: "raw", css: n }), this;
17
+ }
18
+ /** @internal Collect a host-relative component template without resolving it yet. */
19
+ registerHostCSS(t, n) {
20
+ if (typeof t != "string") throw new TypeError("Component CSS must be a string");
21
+ if (typeof n != "string" || n.trim().length === 0)
22
+ throw new TypeError("Component CSS host must be a non-empty selector");
23
+ const r = t.trim();
24
+ if (r.length === 0) return this;
25
+ if (!r.includes("&")) return this.registerCSS(r);
26
+ const i = `host:${r}`, s = this.cssFragments.get(i);
27
+ return s == null ? this.cssFragments.set(i, {
28
+ kind: "host",
29
+ css: r,
30
+ hosts: /* @__PURE__ */ new Set([n.trim()])
31
+ }) : s.kind === "host" && s.hosts.add(n.trim()), this;
32
+ }
33
+ generateCSS() {
34
+ return [...this.cssFragments.values()].map((t) => t.kind === "raw" ? t.css : J(t.css, [...t.hosts])).join(`
35
+
36
+ `);
37
+ }
38
+ injectAll(t = globalThis.document) {
39
+ if ((t == null ? void 0 : t.head) == null)
40
+ throw new TypeError("StyleRegistry.injectAll requires a document with a head");
41
+ const n = `style[${D}="${ve(this.id)}"]`;
42
+ let r = t.head.querySelector(n);
43
+ r == null && (r = t.createElement("style"), r.setAttribute(D, this.id), t.head.prepend(r));
44
+ const i = this.generateCSS();
45
+ return r.textContent !== i && (r.textContent = i), r;
46
+ }
47
+ reset() {
48
+ this.cssFragments.clear();
49
+ }
50
+ }
51
+ function we() {
52
+ return new G();
53
+ }
54
+ const Se = new G("");
55
+ function ve(e) {
56
+ return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
57
+ }
58
+ function J(e, t) {
59
+ let n = "", r = 0;
60
+ for (; r < e.length; ) {
61
+ const i = Re(e, r);
62
+ if (i < 0) return n + e.slice(r);
63
+ const s = Te(e, i);
64
+ if (s < 0) return n + e.slice(r);
65
+ const o = e.slice(r, i), a = e.slice(i + 1, s), c = o.trim();
66
+ n += c.startsWith("@") ? `${o}{${J(a, t)}}` : `${Ee(o, t)}{${a}}`, r = s + 1;
67
+ }
68
+ return n;
69
+ }
70
+ function Ee(e, t) {
71
+ var o, a, c;
72
+ if (t.length === 1 || !e.includes("&"))
73
+ return t.length === 1 ? e.replaceAll("&", t[0]) : e;
74
+ const n = ((o = e.match(/^\s*/)) == null ? void 0 : o[0]) ?? "", r = ((a = e.match(/\s*$/)) == null ? void 0 : a[0]) ?? "", i = Ce(e.trim()), s = ((c = n.match(/(?:^|\n)([ \t]*)$/)) == null ? void 0 : c[1]) ?? "";
75
+ return n + i.flatMap((u) => u.includes("&") ? t.map((p) => u.replaceAll("&", p)) : [u]).join(`,
76
+ ${s}`) + r;
77
+ }
78
+ function Ce(e) {
79
+ const t = [];
80
+ let n = 0, r = 0, i = 0, s = null;
81
+ for (let o = 0; o < e.length; o += 1) {
82
+ const a = e[o];
83
+ if (s != null) {
84
+ a === "\\" ? o += 1 : a === s && (s = null);
85
+ continue;
86
+ }
87
+ a === '"' || a === "'" ? s = a : a === "(" ? r += 1 : a === ")" ? r -= 1 : a === "[" ? i += 1 : a === "]" ? i -= 1 : a === "," && r === 0 && i === 0 && (t.push(e.slice(n, o).trim()), n = o + 1);
88
+ }
89
+ return t.push(e.slice(n).trim()), t.filter(Boolean);
90
+ }
91
+ function Re(e, t) {
92
+ for (let n = t; n < e.length; n += 1) {
93
+ const r = e[n];
94
+ if (r === '"' || r === "'")
95
+ n = Q(e, n);
96
+ else if (r === "/" && e[n + 1] === "*")
97
+ n = X(e, n);
98
+ else if (r === "{")
99
+ return n;
100
+ }
101
+ return -1;
102
+ }
103
+ function Te(e, t) {
104
+ let n = 1;
105
+ for (let r = t + 1; r < e.length; r += 1) {
106
+ const i = e[r];
107
+ if (i === '"' || i === "'")
108
+ r = Q(e, r);
109
+ else if (i === "/" && e[r + 1] === "*")
110
+ r = X(e, r);
111
+ else if (i === "{")
112
+ n += 1;
113
+ else if (i === "}" && --n === 0)
114
+ return r;
115
+ }
116
+ return -1;
117
+ }
118
+ function Q(e, t) {
119
+ const n = e[t];
120
+ for (let r = t + 1; r < e.length; r += 1)
121
+ if (e[r] === "\\") r += 1;
122
+ else if (e[r] === n) return r;
123
+ return e.length;
124
+ }
125
+ function X(e, t) {
126
+ const n = e.indexOf("*/", t + 2);
127
+ return n < 0 ? e.length : n + 1;
128
+ }
129
+ const ee = /* @__PURE__ */ new WeakSet(), te = /* @__PURE__ */ new WeakSet();
130
+ function et(e) {
131
+ if (typeof e != "string" || e.trim() === "")
132
+ throw new TypeError("Service name must be a non-empty string");
133
+ const t = Object.freeze({ name: e.trim() });
134
+ return ee.add(t), t;
135
+ }
136
+ function tt(e, t) {
137
+ if (z(e), typeof t != "function")
138
+ throw new TypeError(`Service provider "${e.name}" requires a factory function`);
139
+ const n = Object.freeze({ key: e, create: t });
140
+ return te.add(n), n;
141
+ }
142
+ class ne {
143
+ constructor(t = []) {
144
+ l(this, "providers", /* @__PURE__ */ new Map());
145
+ l(this, "instances", /* @__PURE__ */ new Map());
146
+ l(this, "creationOrder", []);
147
+ l(this, "resolving", []);
148
+ l(this, "disposed", !1);
149
+ if (!Array.isArray(t))
150
+ throw new TypeError("ServiceScope providers must be an array");
151
+ for (const n of t) {
152
+ if (Pe(n), this.providers.has(n.key))
153
+ throw new Error(`Service "${n.key.name}" is registered more than once`);
154
+ this.providers.set(n.key, n);
155
+ }
156
+ }
157
+ get isDisposed() {
158
+ return this.disposed;
159
+ }
160
+ has(t) {
161
+ return this.assertActive(), z(t), this.providers.has(t);
162
+ }
163
+ require(t) {
164
+ if (this.assertActive(), z(t), this.instances.has(t)) return this.instances.get(t);
165
+ const n = this.providers.get(t);
166
+ if (n == null) throw new Error(`Service "${t.name}" is not registered`);
167
+ const r = this.resolving.indexOf(t);
168
+ if (r >= 0) {
169
+ const i = [...this.resolving.slice(r), t].map((s) => s.name).join(" -> ");
170
+ throw new Error(`Circular service dependency: ${i}`);
171
+ }
172
+ this.resolving.push(t);
173
+ try {
174
+ const i = n.create(this);
175
+ return this.instances.set(t, i), this.creationOrder.push(t), i;
176
+ } finally {
177
+ this.resolving.pop();
178
+ }
179
+ }
180
+ dispose() {
181
+ if (this.disposed) return;
182
+ this.disposed = !0;
183
+ const t = [];
184
+ for (const n of [...this.creationOrder].reverse()) {
185
+ const r = this.instances.get(n);
186
+ try {
187
+ const i = Oe(r);
188
+ i != null && i.call(r);
189
+ } catch (i) {
190
+ t.push(i);
191
+ }
192
+ }
193
+ if (this.instances.clear(), this.creationOrder.length = 0, this.resolving.length = 0, t.length === 1) throw t[0];
194
+ if (t.length > 1)
195
+ throw new AggregateError(t, "Several services failed during disposal");
196
+ }
197
+ assertActive() {
198
+ if (this.disposed) throw new Error("ServiceScope has been disposed");
199
+ }
200
+ }
201
+ function je(e = []) {
202
+ return new ne(e);
203
+ }
204
+ function Ae(e) {
205
+ return e != null && (typeof e == "object" || typeof e == "function") && ee.has(e);
206
+ }
207
+ function z(e) {
208
+ if (!Ae(e)) throw new TypeError("Expected a service key created by defineService()");
209
+ }
210
+ function Pe(e) {
211
+ if (e == null || typeof e != "object" && typeof e != "function" || !te.has(e))
212
+ throw new TypeError("Expected a service provider created by provideService()");
213
+ }
214
+ function Oe(e) {
215
+ if (e == null || typeof e != "object" && typeof e != "function") return null;
216
+ const t = Reflect.get(e, "dispose");
217
+ return typeof t == "function" ? t : null;
218
+ }
219
+ const _e = /* @__PURE__ */ new Set([
220
+ "annotation-xml",
221
+ "color-profile",
222
+ "font-face",
223
+ "font-face-src",
224
+ "font-face-uri",
225
+ "font-face-format",
226
+ "font-face-name",
227
+ "missing-glyph"
228
+ ]);
229
+ class B {
230
+ constructor(t = {}, n = we()) {
231
+ l(this, "styleRegistry");
232
+ l(this, "services");
233
+ l(this, "router");
234
+ l(this, "routedRoots", /* @__PURE__ */ new WeakSet());
235
+ if (t == null || typeof t != "object" || Array.isArray(t))
236
+ throw new TypeError("FrayRuntime options must be an object");
237
+ if (Object.hasOwn(t, "elementNames"))
238
+ throw new TypeError("FrayRuntime no longer supports configurable element names");
239
+ if (this.styleRegistry = n, this.services = t.services ?? je(), !(this.services instanceof ne))
240
+ throw new TypeError("Fray services must be a ServiceScope");
241
+ if (this.router = t.router ?? null, this.router != null && (typeof this.router != "object" || typeof this.router.openScope != "function" || typeof this.router.completeScope != "function"))
242
+ throw new TypeError("Fray router must be a BrowserRouter");
243
+ }
244
+ /** Resolve a fixed one-hyphen public host name for a built-in component. */
245
+ resolveElementName(t) {
246
+ re(t, "Fray component host name");
247
+ const n = `fray-${t.replaceAll("-", "")}`;
248
+ return Fe(n), n;
249
+ }
250
+ resolveHostSelector(t, n) {
251
+ if (typeof t != "string") throw new TypeError("Host selector must be a string");
252
+ return t.replaceAll("&", this.resolveElementName(n));
253
+ }
254
+ resolveHostCSS(t, n) {
255
+ if (typeof t != "string") throw new TypeError("Host CSS must be a string");
256
+ return t.replaceAll("&", this.resolveElementName(n));
257
+ }
258
+ create(t, ...n) {
259
+ const r = new t(...n);
260
+ return r._setRuntime(this), r;
261
+ }
262
+ mount(t, n, r = null) {
263
+ t._setRuntime(this);
264
+ let i = null;
265
+ this.router != null && !this.routedRoots.has(t) && (this.routedRoots.add(t), i = this.router.openScope(this.router.root, t), t.onCleanup(i));
266
+ try {
267
+ t.mount(n, r), this.router != null && i != null && this.router.completeScope(this.router.root, t);
268
+ } catch (s) {
269
+ throw i == null || i(), s;
270
+ }
271
+ return t;
272
+ }
273
+ registerStyles(t) {
274
+ if (t == null || typeof t.registerStyles != "function")
275
+ throw new TypeError("registerStyles requires a Fray component dependency");
276
+ return t.registerStyles(this), this;
277
+ }
278
+ injectStyles(t = globalThis.document) {
279
+ return this.styleRegistry.injectAll(t);
280
+ }
281
+ }
282
+ function nt(e = {}) {
283
+ return new B(e);
284
+ }
285
+ const K = new B({}, Se);
286
+ function re(e, t) {
287
+ if (typeof e != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e))
288
+ throw new TypeError(`${t} must be a lowercase kebab-case name`);
289
+ }
290
+ function Fe(e) {
291
+ if (re(e, "Fray element name"), !e.includes("-") || _e.has(e))
292
+ throw new TypeError(`Fray element name must be a non-reserved name containing a hyphen: ${e}`);
293
+ }
294
+ const P = Symbol.for("@sylwellsoftware/fray.Fragment"), ie = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new Set([
295
+ "allowFullScreen",
296
+ "async",
297
+ "autoFocus",
298
+ "autoPlay",
299
+ "checked",
300
+ "controls",
301
+ "default",
302
+ "defer",
303
+ "disabled",
304
+ "formNoValidate",
305
+ "hidden",
306
+ "inert",
307
+ "loop",
308
+ "multiple",
309
+ "muted",
310
+ "noModule",
311
+ "noValidate",
312
+ "open",
313
+ "playsInline",
314
+ "readOnly",
315
+ "required",
316
+ "reversed",
317
+ "selected"
318
+ ]), $e = /* @__PURE__ */ new Set([
319
+ "checked",
320
+ "defaultChecked",
321
+ "defaultValue",
322
+ "disabled",
323
+ "indeterminate",
324
+ "multiple",
325
+ "muted",
326
+ "readOnly",
327
+ "required",
328
+ "selected",
329
+ "selectedIndex",
330
+ "tabIndex",
331
+ "value"
332
+ ]), U = "data-fray";
333
+ function rt(e) {
334
+ H(e, "live");
335
+ const t = Object.freeze({ emitter: e });
336
+ return ie.add(t), t;
337
+ }
338
+ function O(e, t = null, ...n) {
339
+ const r = t ?? {};
340
+ if (typeof r != "object" || Array.isArray(r))
341
+ throw new TypeError("VNode props must be an object or null");
342
+ const {
343
+ children: i,
344
+ key: s = null,
345
+ ...o
346
+ } = r;
347
+ return {
348
+ type: e,
349
+ key: s,
350
+ props: {
351
+ ...o,
352
+ children: se([i, n])
353
+ }
354
+ };
355
+ }
356
+ function ke(e, ...t) {
357
+ return e.reduce((n, r, i) => n + r + String(t[i] ?? ""), "");
358
+ }
359
+ const m = class m {
360
+ constructor(t = {}) {
361
+ l(this, "props");
362
+ l(this, "dom", null);
363
+ /** @internal */
364
+ l(this, "_rendered", null);
365
+ /** @internal */
366
+ l(this, "_childComponents", /* @__PURE__ */ new Set());
367
+ /** @internal Component ancestry used to enforce structural invariants. */
368
+ l(this, "_parentComponent", null);
369
+ l(this, "initialized", !1);
370
+ l(this, "mounted", !1);
371
+ l(this, "destroyed", !1);
372
+ l(this, "updating", !1);
373
+ l(this, "updateRequested", !1);
374
+ l(this, "cleanupFunctions", /* @__PURE__ */ new Set());
375
+ l(this, "watched", /* @__PURE__ */ new Map());
376
+ l(this, "renderReadSubscriptions", /* @__PURE__ */ new Map());
377
+ l(this, "collectingRenderReads", null);
378
+ /** @internal */
379
+ l(this, "_runtime", K);
380
+ /** @internal Route lineage inherited by nested routed components. */
381
+ l(this, "_routeContext", null);
382
+ /** JSX component for this instance's runtime-configured custom host. */
383
+ l(this, "Host", ({
384
+ children: t = [],
385
+ ...n
386
+ }) => this.host(n, t));
387
+ if (t == null || typeof t != "object" || Array.isArray(t))
388
+ throw new TypeError(`${this.constructor.name} props must be an object`);
389
+ this.props = t;
390
+ }
391
+ static new(...t) {
392
+ const n = new this(...t);
393
+ if (!(n instanceof m))
394
+ throw new TypeError("Component.new() requires a Component constructor");
395
+ return n.mount();
396
+ }
397
+ static registerStyles(t = K, n = /* @__PURE__ */ new Set()) {
398
+ if (n.has(this)) return;
399
+ n.add(this);
400
+ const r = this.hostName ?? null, i = Je(this);
401
+ for (const s of i)
402
+ Object.hasOwn(s, "css") && s.css && (r == null ? t.styleRegistry.registerCSS(s.css) : t.styleRegistry.registerHostCSS(
403
+ s.css,
404
+ t.resolveElementName(r)
405
+ ));
406
+ for (const s of i)
407
+ if (Object.hasOwn(s, "dependencies"))
408
+ for (const o of s.dependencies ?? [])
409
+ o.registerStyles(t, n);
410
+ }
411
+ /** One-time setup hook. Constructors must not subscribe or render. */
412
+ initialize() {
413
+ }
414
+ render() {
415
+ throw new Error(`${this.constructor.name} must implement render()`);
416
+ }
417
+ /** Render this component's configured custom host element. */
418
+ host(t = null, ...n) {
419
+ const i = this.constructor.hostName;
420
+ if (i == null)
421
+ throw new Error(`${this.constructor.name} does not declare a custom host name`);
422
+ const {
423
+ class: s,
424
+ className: o,
425
+ ...a
426
+ } = t ?? {}, c = o ?? s, u = this.props.island === !0 ? Qe(c, "island") : c;
427
+ return O(this._runtime.resolveElementName(i), {
428
+ ...a,
429
+ ...u == null ? {} : { className: u },
430
+ "data-fray-component": i
431
+ }, ...n);
432
+ }
433
+ /** @internal Assign an immutable application runtime before initialization or mounting. */
434
+ _setRuntime(t) {
435
+ var n;
436
+ if (!(t instanceof B))
437
+ throw new TypeError("Component runtime must be a FrayRuntime");
438
+ if (t === this._runtime) return this;
439
+ if (this.initialized || this.mounted || this._rendered != null)
440
+ throw new Error("Cannot change a component runtime after initialization");
441
+ return this._runtime = t, this._routeContext == null && (this._routeContext = ((n = t.router) == null ? void 0 : n.root) ?? null), this;
442
+ }
443
+ /** @internal Assign contextual route lineage before initialization. */
444
+ _setRouteContext(t) {
445
+ if (this.initialized || this.mounted || this._rendered != null)
446
+ throw new Error("Cannot change a component route context after initialization");
447
+ return this._routeContext = t, this;
448
+ }
449
+ /** @internal Route lineage inherited by component children. */
450
+ _routeContextForChildren() {
451
+ return this._routeContext;
452
+ }
453
+ /** @internal Assign the renderer-owned component ancestry. */
454
+ _setParentComponent(t) {
455
+ if (this._parentComponent != null && this._parentComponent !== t)
456
+ throw new Error("A component instance cannot move between component owners");
457
+ return this._parentComponent = t, this.validateIslandAncestry(this.props), this;
458
+ }
459
+ mount(t = null, n = null) {
460
+ if (this.destroyed) throw new Error("Cannot mount a destroyed component");
461
+ this.validateIslandAncestry(this.props);
462
+ let r = !1;
463
+ return this.initialized || (this.validateRequiredServices(), this.initialized = !0, this.initialize()), this.mounted || (this.mounted = !0, this.update(), r = !0), t != null && (Ge(t), V(t, this._rendered, n)), r && this.afterMount(this.dom), this;
464
+ }
465
+ attachTo(t) {
466
+ return this.mount(t), this;
467
+ }
468
+ update(t) {
469
+ if (this.destroyed) return this;
470
+ if (!this.mounted) return this.mount();
471
+ if (this.updating)
472
+ return this.updateRequested = !0, this;
473
+ this.updating = !0;
474
+ try {
475
+ do {
476
+ this.updateRequested = !1;
477
+ const n = /* @__PURE__ */ new Set();
478
+ this.collectingRenderReads = n;
479
+ let r;
480
+ try {
481
+ r = R(this.render());
482
+ } finally {
483
+ this.collectingRenderReads = null;
484
+ }
485
+ this._rendered = M(this._rendered, r, this), this.dom = ue(this._rendered), this.reconcileRenderReads(n), this.afterUpdate(this.dom);
486
+ } while (this.updateRequested && !this.destroyed);
487
+ } finally {
488
+ this.updating = !1;
489
+ }
490
+ return this;
491
+ }
492
+ setProps(t) {
493
+ if (t == null || typeof t != "object" || Array.isArray(t))
494
+ throw new TypeError(`${this.constructor.name} props must be an object`);
495
+ return this.validateIslandAncestry(t), this.props = t, this.mounted && this.update(), this;
496
+ }
497
+ afterMount(t) {
498
+ }
499
+ afterUpdate(t) {
500
+ }
501
+ watch(...t) {
502
+ for (const n of t) {
503
+ if (n == null || typeof n.subscribe != "function")
504
+ throw new TypeError("watch requires emitter-like values");
505
+ if (this.watched.has(n)) continue;
506
+ const r = n.subscribe(({ event: i }) => {
507
+ this.mounted && !this.destroyed && this.update(i);
508
+ }, { emitCurrent: !1 });
509
+ this.watched.set(n, r), this.onCleanup(() => {
510
+ r(), this.watched.delete(n);
511
+ });
512
+ }
513
+ return this;
514
+ }
515
+ watchFutureValues(...t) {
516
+ return this.watch(...t);
517
+ }
518
+ /** Read an emitter during render and rerender when that dependency changes. */
519
+ read(t) {
520
+ return this.trackRenderRead(t), t.get();
521
+ }
522
+ /** Read a Glue value, fetch state, and error as one tracked render dependency. */
523
+ snapshot(t) {
524
+ return this.trackRenderRead(t), Object.freeze({
525
+ value: t.get(),
526
+ fetchState: t.getFetchState(),
527
+ error: t.getError()
528
+ });
529
+ }
530
+ onCleanup(t) {
531
+ if (typeof t != "function") throw new TypeError("cleanup must be a function");
532
+ if (this.destroyed)
533
+ return t(), () => {
534
+ };
535
+ this.cleanupFunctions.add(t);
536
+ let n = !0;
537
+ return () => {
538
+ n && (n = !1, this.cleanupFunctions.delete(t), t());
539
+ };
540
+ }
541
+ /** Resolve one explicitly declared application service from this component's runtime. */
542
+ requireService(t) {
543
+ if (!this.initialized)
544
+ throw new Error("Components may resolve services during initialize() or later");
545
+ const n = this.constructor;
546
+ if (!n.requiredServices.includes(t))
547
+ throw new Error(
548
+ `${n.name} must declare service "${t.name}" in requiredServices`
549
+ );
550
+ return this._runtime.services.require(t);
551
+ }
552
+ listen(t, n, r, i) {
553
+ if (t == null || typeof t.addEventListener != "function")
554
+ throw new TypeError("listen target must be an EventTarget");
555
+ const s = r;
556
+ return t.addEventListener(n, s, i), this.onCleanup(() => t.removeEventListener(n, s, i)), this;
557
+ }
558
+ registerChild(t) {
559
+ if (!(t instanceof m))
560
+ throw new TypeError("registerChild requires a Component");
561
+ return this._childComponents.add(t), t;
562
+ }
563
+ destroy() {
564
+ if (!this.destroyed) {
565
+ this.destroyed = !0, this.mounted = !1;
566
+ for (const t of [...this.cleanupFunctions]) t();
567
+ this.cleanupFunctions.clear(), this.watched.clear();
568
+ for (const t of this.renderReadSubscriptions.values()) t();
569
+ this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && g(this._rendered, !0), this._rendered = null, this.dom = null, this._childComponents.clear(), this.onDestroy();
570
+ }
571
+ }
572
+ validateRequiredServices() {
573
+ const t = this.constructor;
574
+ for (const n of t.requiredServices)
575
+ if (!this._runtime.services.has(n))
576
+ throw new Error(`${t.name} requires unregistered service "${n.name}"`);
577
+ }
578
+ validateIslandAncestry(t) {
579
+ if (!k(t)) return;
580
+ if (this.hasIslandDescendant())
581
+ throw new Error("An island component cannot contain another island");
582
+ let n = this._parentComponent;
583
+ for (; n != null; ) {
584
+ if (k(n.props))
585
+ throw new Error("An island component cannot be nested inside another island");
586
+ n = n._parentComponent;
587
+ }
588
+ }
589
+ hasIslandDescendant() {
590
+ for (const t of this._childComponents)
591
+ if (k(t.props) || t.hasIslandDescendant()) return !0;
592
+ return !1;
593
+ }
594
+ onDestroy() {
595
+ }
596
+ trackRenderRead(t) {
597
+ if (H(t, "Component.read"), this.collectingRenderReads == null)
598
+ throw new Error("Component.read() and snapshot() may only be called during render()");
599
+ this.collectingRenderReads.add(t);
600
+ }
601
+ reconcileRenderReads(t) {
602
+ for (const [n, r] of this.renderReadSubscriptions)
603
+ t.has(n) || (r(), this.renderReadSubscriptions.delete(n));
604
+ for (const n of t) {
605
+ if (this.watched.has(n) || this.renderReadSubscriptions.has(n)) continue;
606
+ const r = n.subscribe(({ event: i }) => {
607
+ this.mounted && !this.destroyed && this.update(i);
608
+ }, { emitCurrent: !1 });
609
+ this.renderReadSubscriptions.set(n, r);
610
+ }
611
+ }
612
+ };
613
+ l(m, "dependencies", []), l(m, "requiredServices", []), /** Component `live()` bindings are opt-in; subclasses declare their allowlist. */
614
+ l(m, "liveProps", []), l(m, "css", ke`
615
+ .fray-fill-horizontal,
616
+ .fray-fill-vertical {
617
+ box-sizing: border-box;
618
+ background: var(--application-background);
619
+ }
620
+
621
+ .fray-fill-horizontal {
622
+ width: 100vw;
623
+ max-width: 100vw;
624
+ min-width: 0;
625
+ overflow-x: auto;
626
+ }
627
+
628
+ .fray-fill-vertical {
629
+ height: 100vh;
630
+ max-height: 100vh;
631
+ min-height: 0;
632
+ overflow-y: auto;
633
+ }
634
+
635
+ .island {
636
+ box-sizing: border-box;
637
+ min-width: 0;
638
+ min-height: 0;
639
+ margin: var(--island-margin);
640
+ padding: var(--island-padding);
641
+ background: var(--island-background);
642
+ border: var(--island-border);
643
+ border-radius: var(--island-radius);
644
+ box-shadow: var(--island-shadow);
645
+ }
646
+
647
+ .fray-fill-horizontal.island,
648
+ .fray-fill-horizontal .island {
649
+ max-width: calc(100% - (2 * var(--island-margin)));
650
+ overflow-x: auto;
651
+ }
652
+
653
+ .fray-fill-vertical.island,
654
+ .fray-fill-vertical .island {
655
+ max-height: calc(100% - (2 * var(--island-margin)));
656
+ overflow-y: auto;
657
+ }
658
+ `), l(m, "hostName", null);
659
+ let d = m;
660
+ function R(e) {
661
+ return Array.isArray(e) ? O(P, null, e) : e == null || typeof e == "boolean" ? O(P) : e;
662
+ }
663
+ function se(e) {
664
+ const t = [], n = (r) => {
665
+ if (Array.isArray(r))
666
+ for (const i of r) n(i);
667
+ else r != null && typeof r != "boolean" && t.push(r);
668
+ };
669
+ return n(e), t;
670
+ }
671
+ function T(e, t) {
672
+ if (typeof e == "string" || typeof e == "number")
673
+ return {
674
+ kind: "text",
675
+ key: null,
676
+ value: e,
677
+ node: document.createTextNode(String(e)),
678
+ owner: t
679
+ };
680
+ if (N(e)) {
681
+ const s = document.createComment("fray-emitter-start"), o = document.createComment("fray-emitter-end"), a = e.get();
682
+ if (Object.is(a, e))
683
+ throw new TypeError("A Fray emitter child cannot render itself");
684
+ const c = document.createDocumentFragment();
685
+ c.append(s, o);
686
+ const u = T(R(a), t);
687
+ V(c, u, o);
688
+ const p = {
689
+ kind: "emitter",
690
+ key: null,
691
+ source: e,
692
+ start: s,
693
+ end: o,
694
+ child: u,
695
+ unsubscribe: () => {
696
+ },
697
+ owner: t
698
+ };
699
+ return p.unsubscribe = e.subscribe(({ value: b }) => {
700
+ if (Object.is(b, e))
701
+ throw new TypeError("A Fray emitter child cannot render itself");
702
+ p.child = M(p.child, R(b), t);
703
+ }, { emitCurrent: !1 }), p;
704
+ }
705
+ if (e instanceof d)
706
+ return e._setRuntime(t._runtime), e._setRouteContext(t._routeContextForChildren()), e._setParentComponent(t), e.mount(), t.registerChild(e), {
707
+ kind: "component",
708
+ key: fe(e.props),
709
+ type: e.constructor,
710
+ instance: e,
711
+ prebuilt: !0,
712
+ props: e.props,
713
+ liveProps: /* @__PURE__ */ new Map(),
714
+ owner: t
715
+ };
716
+ if (!y(e))
717
+ throw new TypeError(`Invalid Fray child: ${Y(e)}`);
718
+ const { type: n, key: r = null, props: i } = e;
719
+ if (n === P) {
720
+ const s = document.createComment("fray-fragment-start"), o = document.createComment("fray-fragment-end"), a = {
721
+ kind: "fragment",
722
+ key: r,
723
+ type: n,
724
+ start: s,
725
+ end: o,
726
+ children: [],
727
+ owner: t
728
+ }, c = document.createDocumentFragment();
729
+ return c.append(s, o), a.children = _(
730
+ c,
731
+ [],
732
+ i.children,
733
+ t,
734
+ o,
735
+ s
736
+ ), a;
737
+ }
738
+ if (typeof n == "string") {
739
+ const s = document.createElement(n), o = {
740
+ kind: "element",
741
+ key: r,
742
+ type: n,
743
+ node: s,
744
+ props: {},
745
+ listeners: /* @__PURE__ */ new Map(),
746
+ liveProps: /* @__PURE__ */ new Map(),
747
+ nativeBindings: /* @__PURE__ */ new Map(),
748
+ ref: null,
749
+ children: [],
750
+ owner: t
751
+ };
752
+ return ce(o, i), o.children = _(s, [], i.children, t), o;
753
+ }
754
+ if (he(n)) {
755
+ const s = i;
756
+ le(n, s);
757
+ const o = W(s), a = new n(o);
758
+ a._setRuntime(t._runtime), a._setRouteContext(t._routeContextForChildren()), a._setParentComponent(t);
759
+ const c = {
760
+ kind: "component",
761
+ key: r,
762
+ type: n,
763
+ instance: a,
764
+ prebuilt: !1,
765
+ props: o,
766
+ liveProps: /* @__PURE__ */ new Map(),
767
+ owner: t
768
+ };
769
+ return ae(c, s), a.mount(), t.registerChild(a), c;
770
+ }
771
+ if (typeof n == "function") {
772
+ const s = n, o = i, a = W(o), c = R(s(a)), u = {
773
+ kind: "function",
774
+ key: r,
775
+ type: s,
776
+ props: a,
777
+ sourceProps: o,
778
+ liveProps: /* @__PURE__ */ new Map(),
779
+ child: T(c, t),
780
+ owner: t
781
+ };
782
+ return Le(u), u;
783
+ }
784
+ throw new TypeError(`Unsupported vnode type: ${Y(n)}`);
785
+ }
786
+ function M(e, t, n) {
787
+ if (e == null) return T(t, n);
788
+ if (pe(e, t)) return oe(e, t, n);
789
+ const r = T(t, n), i = ue(e), s = (i == null ? void 0 : i.parentNode) ?? null;
790
+ return s && V(s, r, i), g(e, !0), r;
791
+ }
792
+ function oe(e, t, n) {
793
+ return e.kind === "text" ? (typeof t != "string" && typeof t != "number" || Object.is(e.value, t) || (e.value = t, e.node.data = String(t)), e) : e.kind === "emitter" ? (!N(t) || e.source !== t, e) : e.kind === "component" ? (t instanceof d || y(t) && ze(e, t.props), e) : y(t) ? e.kind === "function" ? (qe(e, t.props), e) : e.kind === "fragment" ? (e.children = _(
794
+ e.start.parentNode,
795
+ e.children,
796
+ t.props.children,
797
+ n,
798
+ e.end,
799
+ e.start
800
+ ), e) : (ce(e, t.props), e.children = _(
801
+ e.node,
802
+ e.children,
803
+ t.props.children,
804
+ n
805
+ ), e) : e;
806
+ }
807
+ function W(e) {
808
+ return Object.fromEntries(Object.entries(e).map(([t, n]) => [
809
+ t,
810
+ v(n) ? n.emitter.get() : n
811
+ ]));
812
+ }
813
+ function ae(e, t) {
814
+ x(e.liveProps, t, (n, r) => {
815
+ e.props = { ...e.props, [n]: r }, e.instance.setProps(e.props);
816
+ }), e.props = I(e.liveProps, t), e.instance.setProps(e.props);
817
+ }
818
+ function ze(e, t) {
819
+ le(e.type, t), ae(e, t);
820
+ }
821
+ function le(e, t) {
822
+ const n = Reflect.get(e, "liveProps");
823
+ if (n == null) return;
824
+ if (!Array.isArray(n) || n.some((i) => typeof i != "string"))
825
+ throw new TypeError(`${e.name || "Component"}.liveProps must be an array`);
826
+ const r = new Set(n);
827
+ for (const [i, s] of Object.entries(t))
828
+ if (v(s) && !r.has(i))
829
+ throw new TypeError(
830
+ `${e.name || "Component"} prop "${i}" does not support live()`
831
+ );
832
+ }
833
+ function Le(e) {
834
+ x(e.liveProps, e.sourceProps, (t, n) => {
835
+ e.props = { ...e.props, [t]: n }, L(e);
836
+ }), e.props = I(e.liveProps, e.sourceProps);
837
+ }
838
+ function qe(e, t) {
839
+ e.sourceProps = t, x(e.liveProps, t, (n, r) => {
840
+ e.props = { ...e.props, [n]: r }, L(e);
841
+ }), e.props = I(e.liveProps, t), L(e);
842
+ }
843
+ function L(e) {
844
+ const t = R(e.type(e.props));
845
+ e.child = M(e.child, t, e.owner);
846
+ }
847
+ function x(e, t, n) {
848
+ for (const [r, i] of e) {
849
+ const s = t[r];
850
+ v(s) && s.emitter === i.source || (i.unsubscribe(), e.delete(r));
851
+ }
852
+ for (const [r, i] of Object.entries(t)) {
853
+ if (!v(i) || e.has(r)) continue;
854
+ const s = {
855
+ source: i.emitter,
856
+ value: i.emitter.get(),
857
+ unsubscribe: () => {
858
+ }
859
+ };
860
+ s.unsubscribe = i.emitter.subscribe(({ value: o }) => {
861
+ e.get(r) === s && (s.value = o, n(r, o));
862
+ }, { emitCurrent: !1 }), e.set(r, s);
863
+ }
864
+ }
865
+ function I(e, t) {
866
+ return Object.fromEntries(Object.entries(t).map(([n, r]) => {
867
+ var i;
868
+ return [
869
+ n,
870
+ v(r) ? ((i = e.get(n)) == null ? void 0 : i.value) ?? r.emitter.get() : r
871
+ ];
872
+ }));
873
+ }
874
+ function _(e, t, n, r, i = null, s = null) {
875
+ if (e == null) throw new Error("Cannot patch a detached fragment range");
876
+ const o = se(n), a = /* @__PURE__ */ new Map(), c = [];
877
+ for (const f of t)
878
+ f.key == null ? c.push(f) : a.has(f.key) || a.set(f.key, f);
879
+ const u = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), b = [];
880
+ let me = 0;
881
+ for (const f of o) {
882
+ const h = C(f);
883
+ if (h != null) {
884
+ if (u.has(h)) throw new Error(`Duplicate sibling key: ${String(h)}`);
885
+ u.add(h);
886
+ }
887
+ const j = h == null ? c[me++] : a.get(h);
888
+ j && pe(j, f) ? (p.add(j), b.push(oe(j, f, r))) : b.push(T(f, r));
889
+ }
890
+ for (const f of t)
891
+ p.has(f) || g(f, !0);
892
+ let E = s ? s.nextSibling : e.firstChild;
893
+ for (const f of b)
894
+ for (const h of w(f))
895
+ h === E ? E = E.nextSibling : (e.insertBefore(h, E ?? i), E = h.nextSibling);
896
+ return b;
897
+ }
898
+ function ce(e, t) {
899
+ const n = Object.fromEntries(Object.entries(t).filter(
900
+ ([s]) => s !== "children" && A(s) !== U
901
+ )), r = e.props, i = /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(n)]);
902
+ for (const s of ["value", "checked"])
903
+ if (Object.hasOwn(n, s) && Object.hasOwn(n, `bind:${s}`))
904
+ throw new Error(`${s} and bind:${s} cannot be used together`);
905
+ for (const s of i) {
906
+ const o = r[s], a = n[s];
907
+ if (Ue(s))
908
+ Me(e, s, a);
909
+ else if (s === "ref")
910
+ o !== a && Ie(e, a);
911
+ else if (Ke(s))
912
+ xe(e, s, a);
913
+ else if (v(a))
914
+ Be(e, s, a);
915
+ else {
916
+ const c = e.liveProps.get(s);
917
+ c && (c.unsubscribe(), e.liveProps.delete(s));
918
+ const u = (c == null ? void 0 : c.value) ?? o;
919
+ Object.is(u, a) || S(e.node, s, u, a);
920
+ }
921
+ }
922
+ e.node.setAttribute(U, ""), e.props = { ...n };
923
+ }
924
+ function Be(e, t, n) {
925
+ const r = e.liveProps.get(t);
926
+ if ((r == null ? void 0 : r.source) === n.emitter) return;
927
+ r == null || r.unsubscribe();
928
+ const i = n.emitter.get();
929
+ S(e.node, t, (r == null ? void 0 : r.value) ?? e.props[t], i);
930
+ const s = {
931
+ source: n.emitter,
932
+ value: i,
933
+ unsubscribe: () => {
934
+ }
935
+ };
936
+ s.unsubscribe = n.emitter.subscribe(({ value: o }) => {
937
+ const a = s.value;
938
+ s.value = o, Object.is(a, o) || S(e.node, t, a, o);
939
+ }, { emitCurrent: !1 }), e.liveProps.set(t, s);
940
+ }
941
+ function Me(e, t, n) {
942
+ const r = t.slice(5), i = e.nativeBindings.get(t);
943
+ if (n == null) {
944
+ i && (i.unsubscribe(), e.node.removeEventListener(i.eventName, i.listener), e.nativeBindings.delete(t), S(e.node, r, i.value, void 0));
945
+ return;
946
+ }
947
+ if (We(n, t), (i == null ? void 0 : i.source) === n) return;
948
+ i && (i.unsubscribe(), e.node.removeEventListener(i.eventName, i.listener)), Ze(e.node, r);
949
+ const s = Ye(e.node, r), o = n.get();
950
+ S(e.node, r, i == null ? void 0 : i.value, o);
951
+ const a = () => {
952
+ n.set(Reflect.get(e.node, r), `${t} changed`);
953
+ }, c = {
954
+ source: n,
955
+ value: o,
956
+ eventName: s,
957
+ listener: a,
958
+ unsubscribe: () => {
959
+ }
960
+ };
961
+ c.unsubscribe = n.subscribe(({ value: u }) => {
962
+ const p = c.value;
963
+ c.value = u, Object.is(p, u) || S(e.node, r, p, u);
964
+ }, { emitCurrent: !1 }), e.node.addEventListener(s, a), e.nativeBindings.set(t, c);
965
+ }
966
+ function xe(e, t, n) {
967
+ const r = t.slice(2).toLowerCase(), i = e.listeners.get(t);
968
+ if (i && i !== n && (e.node.removeEventListener(r, i), e.listeners.delete(t)), n != null && typeof n != "function")
969
+ throw new TypeError(`${t} must be a function or null`);
970
+ if (typeof n == "function" && i !== n) {
971
+ const s = n;
972
+ e.node.addEventListener(r, s), e.listeners.set(t, s);
973
+ }
974
+ }
975
+ function Ie(e, t) {
976
+ if (q(e.ref, null), t != null && typeof t != "function" && typeof t != "object")
977
+ throw new TypeError("ref must be a function, object, or null");
978
+ e.ref = t, q(e.ref, e.node);
979
+ }
980
+ function S(e, t, n, r) {
981
+ if (t === "class" || t === "className") {
982
+ $(e, "class", r);
983
+ return;
984
+ }
985
+ if (t === "for" || t === "htmlFor") {
986
+ $(e, "for", r);
987
+ return;
988
+ }
989
+ if (t === "dataset") {
990
+ Ve(e, n, r);
991
+ return;
992
+ }
993
+ if (t === "style") {
994
+ He(e, n, r);
995
+ return;
996
+ }
997
+ if (t === "dangerouslySetInnerHTML")
998
+ throw new Error("dangerouslySetInnerHTML is not supported");
999
+ const i = De(t);
1000
+ if (Ne.has(i)) {
1001
+ const s = !!r;
1002
+ i in e && Reflect.set(e, i, s), e.toggleAttribute(A(t), s);
1003
+ return;
1004
+ }
1005
+ if ($e.has(i) && i in e) {
1006
+ const s = r ?? (i === "value" ? "" : !1);
1007
+ Object.is(Reflect.get(e, i), s) || Reflect.set(e, i, s), r == null && e.removeAttribute(A(t));
1008
+ return;
1009
+ }
1010
+ $(e, A(t), r);
1011
+ }
1012
+ function Ve(e, t, n) {
1013
+ const r = F(t, "dataset"), i = F(n, "dataset");
1014
+ for (const s of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])) {
1015
+ const o = i[s];
1016
+ o == null ? delete e.dataset[s] : e.dataset[s] = String(o);
1017
+ }
1018
+ }
1019
+ function He(e, t, n) {
1020
+ if (typeof n == "string") {
1021
+ e.style.cssText = n;
1022
+ return;
1023
+ }
1024
+ const r = typeof t == "string" ? {} : F(t, "style"), i = F(n, "style");
1025
+ typeof t == "string" && (e.style.cssText = "");
1026
+ for (const s of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])) {
1027
+ const o = i[s];
1028
+ s.startsWith("--") ? o == null ? e.style.removeProperty(s) : e.style.setProperty(s, String(o)) : Reflect.set(e.style, s, o == null ? "" : String(o));
1029
+ }
1030
+ }
1031
+ function F(e, t) {
1032
+ if (e == null) return {};
1033
+ if (typeof e != "object" || Array.isArray(e))
1034
+ throw new TypeError(`${t} must be an object or null`);
1035
+ return e;
1036
+ }
1037
+ function $(e, t, n) {
1038
+ n == null || n === !1 ? e.removeAttribute(t) : n === !0 ? e.setAttribute(t, "") : e.setAttribute(t, String(n));
1039
+ }
1040
+ function De(e) {
1041
+ return e === "readonly" ? "readOnly" : e === "autofocus" ? "autoFocus" : e;
1042
+ }
1043
+ function A(e) {
1044
+ return e === "className" ? "class" : e === "htmlFor" ? "for" : e === "minLength" ? "minlength" : e === "maxLength" ? "maxlength" : e === "autoComplete" ? "autocomplete" : e === "inputMode" ? "inputmode" : /^aria[A-Z]/.test(e) || /^data[A-Z]/.test(e) ? Z(e) : e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
1045
+ }
1046
+ function Z(e) {
1047
+ return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
1048
+ }
1049
+ function q(e, t) {
1050
+ e != null && (typeof e == "function" ? e(t) : e.current = t);
1051
+ }
1052
+ function g(e, t) {
1053
+ if (e.kind === "emitter") {
1054
+ if (e.unsubscribe(), g(e.child, !1), t)
1055
+ for (const n of w(e)) n.remove();
1056
+ return;
1057
+ }
1058
+ if (e.kind === "component") {
1059
+ for (const n of e.liveProps.values()) n.unsubscribe();
1060
+ e.liveProps.clear(), e.owner._childComponents.delete(e.instance), e.instance.destroy();
1061
+ return;
1062
+ }
1063
+ if (e.kind === "function") {
1064
+ for (const n of e.liveProps.values()) n.unsubscribe();
1065
+ e.liveProps.clear(), g(e.child, t);
1066
+ return;
1067
+ }
1068
+ if (e.kind === "element") {
1069
+ q(e.ref, null);
1070
+ for (const [n, r] of e.listeners)
1071
+ e.node.removeEventListener(n.slice(2).toLowerCase(), r);
1072
+ e.listeners.clear();
1073
+ for (const n of e.liveProps.values()) n.unsubscribe();
1074
+ e.liveProps.clear();
1075
+ for (const n of e.nativeBindings.values())
1076
+ n.unsubscribe(), e.node.removeEventListener(n.eventName, n.listener);
1077
+ e.nativeBindings.clear();
1078
+ for (const n of e.children) g(n, !1);
1079
+ t && e.node.remove();
1080
+ return;
1081
+ }
1082
+ if (e.kind === "fragment") {
1083
+ for (const n of e.children) g(n, !1);
1084
+ if (t)
1085
+ for (const n of w(e)) n.remove();
1086
+ return;
1087
+ }
1088
+ t && e.node.remove();
1089
+ }
1090
+ function V(e, t, n = null) {
1091
+ if (t != null)
1092
+ for (const r of w(t)) e.insertBefore(r, n);
1093
+ }
1094
+ function w(e) {
1095
+ if (e == null) return [];
1096
+ if (e.kind === "text" || e.kind === "element") return [e.node];
1097
+ if (e.kind === "component") return w(e.instance._rendered);
1098
+ if (e.kind === "function") return w(e.child);
1099
+ const t = [];
1100
+ let n = e.start;
1101
+ for (; n && (t.push(n), n !== e.end); )
1102
+ n = n.nextSibling;
1103
+ return t;
1104
+ }
1105
+ function ue(e) {
1106
+ return w(e)[0] ?? null;
1107
+ }
1108
+ function C(e) {
1109
+ return e instanceof d ? fe(e.props) : y(e) ? e.key : null;
1110
+ }
1111
+ function fe(e) {
1112
+ const t = e.key;
1113
+ return typeof t == "string" || typeof t == "number" ? t : null;
1114
+ }
1115
+ function pe(e, t) {
1116
+ return e.kind === "text" ? typeof t == "string" || typeof t == "number" : e.kind === "emitter" ? N(t) && e.source === t : e.kind === "component" ? t instanceof d ? e.instance === t : y(t) && he(t.type) && e.type === t.type && e.key === C(t) : e.kind === "function" ? y(t) && e.type === t.type && e.key === C(t) : e.kind === "fragment" ? y(t) && t.type === P && e.key === C(t) : y(t) && typeof t.type == "string" && e.type === t.type && e.key === C(t);
1117
+ }
1118
+ function y(e) {
1119
+ return e != null && typeof e == "object" && Object.hasOwn(e, "type");
1120
+ }
1121
+ function he(e) {
1122
+ return typeof e == "function" && (e === d || e.prototype instanceof d);
1123
+ }
1124
+ function Ke(e) {
1125
+ return /^on[A-Z]/.test(e);
1126
+ }
1127
+ function Ue(e) {
1128
+ return e === "bind:value" || e === "bind:checked";
1129
+ }
1130
+ function v(e) {
1131
+ return e != null && typeof e == "object" && ie.has(e);
1132
+ }
1133
+ function N(e) {
1134
+ return (typeof e != "object" || e == null) && typeof e != "function" ? !1 : typeof Reflect.get(e, "get") == "function" && typeof Reflect.get(e, "getFetchState") == "function" && typeof Reflect.get(e, "getError") == "function" && typeof Reflect.get(e, "subscribe") == "function";
1135
+ }
1136
+ function H(e, t) {
1137
+ if (!N(e)) throw new TypeError(`${t} requires a readable emitter`);
1138
+ }
1139
+ function We(e, t) {
1140
+ if (H(e, t), typeof Reflect.get(e, "set") != "function")
1141
+ throw new TypeError(`${t} requires a writable emitter`);
1142
+ }
1143
+ function Ze(e, t) {
1144
+ const n = e.localName;
1145
+ if (!(t === "checked" ? n === "input" : n === "input" || n === "textarea" || n === "select")) throw new TypeError(`bind:${t} is not supported on ${n}`);
1146
+ }
1147
+ function Ye(e, t) {
1148
+ return t === "value" && e.localName !== "select" ? "input" : "change";
1149
+ }
1150
+ function Ge(e) {
1151
+ if (e == null || typeof e != "object" && typeof e != "function" || typeof Reflect.get(e, "insertBefore") != "function")
1152
+ throw new TypeError("Component parent must be a DOM ParentNode");
1153
+ }
1154
+ function Y(e) {
1155
+ try {
1156
+ return String(e);
1157
+ } catch {
1158
+ return Object.prototype.toString.call(e);
1159
+ }
1160
+ }
1161
+ function Je(e) {
1162
+ const t = [];
1163
+ let n = e;
1164
+ for (; n != null && typeof n == "function" && (t.unshift(n), n !== d); )
1165
+ n = Object.getPrototypeOf(n);
1166
+ return t;
1167
+ }
1168
+ function Qe(...e) {
1169
+ return [...new Set(e.flatMap((t) => typeof t == "string" ? t.split(/\s+/) : []).filter(Boolean))].join(" ");
1170
+ }
1171
+ function k(e) {
1172
+ if (e.island === !0) return !0;
1173
+ const t = e.className ?? e.class;
1174
+ return typeof t == "string" && t.split(/\s+/).includes("island");
1175
+ }
1176
+ function de(e, t, n) {
1177
+ const r = t == null ? {} : { ...t };
1178
+ return n !== void 0 && (r.key = n), O(e, r);
1179
+ }
1180
+ const it = de, st = de;
1181
+ function ot(e) {
1182
+ if (!(e instanceof d))
1183
+ throw new TypeError("createPrebuiltElement requires a Component instance");
1184
+ return e;
1185
+ }
1186
+ export {
1187
+ d as C,
1188
+ P as F,
1189
+ ne as S,
1190
+ it as a,
1191
+ B as b,
1192
+ ke as c,
1193
+ G as d,
1194
+ nt as e,
1195
+ je as f,
1196
+ we as g,
1197
+ O as h,
1198
+ y as i,
1199
+ de as j,
1200
+ K as k,
1201
+ et as l,
1202
+ st as m,
1203
+ rt as n,
1204
+ ot as o,
1205
+ tt as p,
1206
+ Se as s
1207
+ };
1208
+ //# sourceMappingURL=jsx-dev-runtime-CRDpvXOH.js.map