@peripheries/core 0.3.0 → 0.4.1

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.
package/index.js CHANGED
@@ -1,4109 +1,4 @@
1
- import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { Children as r, createContext as i, isValidElement as a, useCallback as o, useContext as s, useEffect as c, useId as l, useLayoutEffect as u, useMemo as d, useReducer as f, useRef as p, useState as m } from "react";
3
- //#region src/core/_shared/props.ts
4
- var h = /* @__PURE__ */ new Set([
5
- "baseProps",
6
- "data",
7
- "status",
8
- "actions",
9
- "_traversal",
10
- "isLoading",
11
- "error",
12
- "navigate",
13
- "onNavigate",
14
- "size",
15
- "store"
16
- ]);
17
- function g(e) {
18
- let t = {};
19
- for (let n in e) h.has(n) || (t[n] = e[n]);
20
- return t;
21
- }
22
- var _ = (...e) => e.filter(Boolean).join(" ") || void 0, v = (e) => e === void 0 ? void 0 : typeof e == "number" ? `${e}px` : e;
23
- function y(e, t) {
24
- let n = Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
25
- return Object.keys(n).length || t ? {
26
- ...n,
27
- ...t
28
- } : void 0;
29
- }
30
- //#endregion
31
- //#region src/core/Box/Box.tsx
32
- function b({ as: e, className: n, children: r, ...i }) {
33
- return /* @__PURE__ */ t(e ?? "div", {
34
- className: _("core-box", n),
35
- ...g(i),
36
- children: r
37
- });
38
- }
39
- //#endregion
40
- //#region src/core/Center/Center.tsx
41
- function x({ minHeight: e, className: n, style: r, children: i, ...a }) {
42
- return /* @__PURE__ */ t(b, {
43
- ...a,
44
- className: _("core-center", n),
45
- style: y({ "--core-center-min-height": v(e) }, r),
46
- children: i
47
- });
48
- }
49
- //#endregion
50
- //#region src/core/Container/Container.tsx
51
- function S({ name: e, className: n, style: r, children: i, ...a }) {
52
- return /* @__PURE__ */ t(b, {
53
- ...a,
54
- className: _("core-container", n),
55
- style: y({ "--core-container-name": e }, r),
56
- children: i
57
- });
58
- }
59
- //#endregion
60
- //#region src/core/Divider/Divider.tsx
61
- function C({ orientation: e = "horizontal", weight: n = "subtle", spacing: r, className: i, style: a, ref: o, ...s }) {
62
- let c = {
63
- className: _("core-divider", i),
64
- "data-weight": n,
65
- "data-orientation": e,
66
- style: y({ "--core-divider-spacing": v(r) }, a)
67
- };
68
- return e === "vertical" ? /* @__PURE__ */ t("span", {
69
- role: "separator",
70
- "aria-orientation": "vertical",
71
- ...c
72
- }) : /* @__PURE__ */ t("hr", {
73
- ref: o,
74
- ...g(s),
75
- ...c
76
- });
77
- }
78
- //#endregion
79
- //#region src/core/Hide/Hide.tsx
80
- function w({ when: e, children: n, as: r = "span" }) {
81
- return /* @__PURE__ */ t(r, {
82
- className: "core-hide",
83
- "data-when": e,
84
- children: n
85
- });
86
- }
87
- //#endregion
88
- //#region src/core/Inline/Inline.tsx
89
- function T({ gap: e, align: n = "center", justify: r = "start", wrap: i = !0, stackWhen: a, className: o, style: s, children: c, ...l }) {
90
- return /* @__PURE__ */ t(b, {
91
- ...l,
92
- className: _("core-inline", o),
93
- "data-align": n,
94
- "data-justify": r,
95
- "data-wrap": i ? "true" : "false",
96
- "data-stack-when": a,
97
- style: y({ "--core-inline-gap": v(e) }, s),
98
- children: c
99
- });
100
- }
101
- //#endregion
102
- //#region src/core/Show/Show.tsx
103
- function E({ when: e, children: n, as: r = "span" }) {
104
- return /* @__PURE__ */ t(r, {
105
- className: "core-show",
106
- "data-when": e,
107
- children: n
108
- });
109
- }
110
- //#endregion
111
- //#region src/core/Spacer/Spacer.tsx
112
- function D({ size: e, className: n, style: r }) {
113
- return /* @__PURE__ */ t("span", {
114
- "aria-hidden": !0,
115
- className: _("core-spacer", n),
116
- style: y({ "--core-spacer-size": v(e) }, r)
117
- });
118
- }
119
- //#endregion
120
- //#region src/core/Stack/Stack.tsx
121
- function O({ gap: e, align: n = "stretch", justify: r = "start", className: i, style: a, children: o, ...s }) {
122
- return /* @__PURE__ */ t(b, {
123
- ...s,
124
- className: _("core-stack", i),
125
- "data-align": n,
126
- "data-justify": r,
127
- style: y({ "--core-stack-gap": v(e) }, a),
128
- children: o
129
- });
130
- }
131
- //#endregion
132
- //#region src/core/page/PageFrame/PageFrame.tsx
133
- function k({ header: e, children: r, measure: i = "page", className: a, ...o }) {
134
- return /* @__PURE__ */ t("div", {
135
- ...g(o),
136
- className: _("core-page-frame", a),
137
- "data-measure": i,
138
- children: /* @__PURE__ */ n("div", {
139
- className: "core-page-frame__column",
140
- children: [e != null && /* @__PURE__ */ t("header", {
141
- className: "core-page-frame__header",
142
- children: e
143
- }), r]
144
- })
145
- });
146
- }
147
- //#endregion
148
- //#region src/core/_shared/warn-once.ts
149
- var A = /* @__PURE__ */ new Set();
150
- function j(e, t) {
151
- A.has(e) || (A.add(e), typeof console < "u" && console.warn(t));
152
- }
153
- //#endregion
154
- //#region src/core/display/_shared/tone.ts
155
- var M = [
156
- "neutral",
157
- "strong",
158
- "accent",
159
- "info",
160
- "success",
161
- "warning",
162
- "danger"
163
- ], N = () => typeof process > "u" || !1;
164
- function P(e, t = "neutral") {
165
- return typeof e == "string" && M.includes(e) ? e : (typeof e == "string" && e && N() && j(`unknown-tone:${e}`, `[core] "${e}" is not a tone (${M.join(", ")}); using "${t}".`), t);
166
- }
167
- //#endregion
168
- //#region src/core/display/Eyebrow/Eyebrow.tsx
169
- var F = [
170
- "subtle",
171
- "on-dark",
172
- "inherit"
173
- ];
174
- function I(e, t) {
175
- return typeof e == "string" && (F.includes(e) || M.includes(e)) ? e : t;
176
- }
177
- function L(e) {
178
- return {
179
- "data-tone": e,
180
- toned: !F.includes(e)
181
- };
182
- }
183
- function R({ children: e, as: n = "span", tone: r, tabular: i = !1, className: a, style: o }) {
184
- let { toned: s, ...c } = L(I(r, "subtle"));
185
- return /* @__PURE__ */ t(n, {
186
- className: _("core-eyebrow", s && "core-toned", a),
187
- ...c,
188
- "data-tabular": i ? "true" : void 0,
189
- style: o,
190
- children: e
191
- });
192
- }
193
- //#endregion
194
- //#region src/core/page/RuleSection/RuleSection.tsx
195
- function z({ label: e, actions: r, children: i, rail: a = !1, anchor: o, className: s, ...c }) {
196
- return /* @__PURE__ */ t("section", {
197
- ...g(c),
198
- id: o,
199
- "aria-label": e,
200
- className: _("core-rule-section", s),
201
- "data-rail": a || void 0,
202
- children: /* @__PURE__ */ n("div", {
203
- className: "core-rule-section__grid",
204
- children: [/* @__PURE__ */ n("div", {
205
- className: "core-rule-section__head",
206
- children: [e && /* @__PURE__ */ t(R, {
207
- as: "p",
208
- children: e
209
- }), r != null && /* @__PURE__ */ t("div", {
210
- className: "core-rule-section__actions",
211
- children: r
212
- })]
213
- }), /* @__PURE__ */ t("div", {
214
- className: "core-rule-section__body",
215
- children: i
216
- })]
217
- })
218
- });
219
- }
220
- //#endregion
221
- //#region src/core/actions/_shared/press.ts
222
- var B = (e) => e.startsWith("/") && !e.startsWith("//") && !e.includes("\\"), ee = (e) => /^#[A-Za-z][\w:.-]*$/.test(e);
223
- function V({ href: e, action: t, input: n, actions: r, navigate: i, onClick: a }) {
224
- let [o, s] = m(!1), c = r && t ? r[t] : void 0;
225
- return {
226
- busy: o,
227
- onClick: (t) => {
228
- if (a) return a(t);
229
- if (c) {
230
- t.preventDefault(), s(!0), c(n).finally(() => s(!1));
231
- return;
232
- }
233
- e && i && B(e) && t.button === 0 && !t.metaKey && !t.ctrlKey && !t.shiftKey && !t.altKey && (t.preventDefault(), i(e));
234
- },
235
- external: !!e && !B(e) && !ee(e)
236
- };
237
- }
238
- //#endregion
239
- //#region src/core/page/UnderlinedAction/UnderlinedAction.tsx
240
- function te({ label: r, children: i, arrow: a = !0, className: o, href: s, action: c, input: l, actions: u, navigate: d, onClick: f, ...p }) {
241
- let m = V({
242
- href: s,
243
- action: c,
244
- input: l,
245
- actions: u,
246
- navigate: d,
247
- onClick: f
248
- }), h = /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", {
249
- className: "core-underlined-action__label",
250
- children: i ?? r
251
- }), a && /* @__PURE__ */ t("svg", {
252
- className: "core-underlined-action__arrow",
253
- viewBox: "0 0 24 24",
254
- fill: "none",
255
- stroke: "currentColor",
256
- strokeWidth: "1.6",
257
- strokeLinecap: "round",
258
- strokeLinejoin: "round",
259
- "aria-hidden": "true",
260
- focusable: "false",
261
- children: /* @__PURE__ */ t("path", { d: "M5 12h14M13 6l6 6-6 6" })
262
- })] }), v = {
263
- ...g(p),
264
- className: _("core-underlined-action", o)
265
- };
266
- return s ? /* @__PURE__ */ t("a", {
267
- ...v,
268
- href: s,
269
- onClick: m.onClick,
270
- ...m.external ? {
271
- target: "_blank",
272
- rel: "noopener noreferrer"
273
- } : {},
274
- children: h
275
- }) : /* @__PURE__ */ t("button", {
276
- ...v,
277
- type: "button",
278
- onClick: m.onClick,
279
- disabled: m.busy,
280
- children: h
281
- });
282
- }
283
- //#endregion
284
- //#region src/core/text/Avatar/Avatar.tsx
285
- var ne = (e = "") => e.trim().split(/\s+/).filter(Boolean).map((e) => e[0].toUpperCase()).filter((e, t, n) => t === 0 || t === n.length - 1).join("").slice(0, 2);
286
- function re({ name: e, initials: n, src: r, alt: i, size: a = "md", className: o, ...s }) {
287
- let [c, l] = m(!1), u = i ?? e ?? "";
288
- return /* @__PURE__ */ t("span", {
289
- ...g(s),
290
- className: _("core-avatar", o),
291
- "data-size": a,
292
- role: "img",
293
- "aria-label": u || void 0,
294
- children: r && !c ? /* @__PURE__ */ t("img", {
295
- src: r,
296
- alt: "",
297
- onError: () => l(!0)
298
- }) : /* @__PURE__ */ t("span", {
299
- "aria-hidden": "true",
300
- children: n ?? ne(e)
301
- })
302
- });
303
- }
304
- //#endregion
305
- //#region src/core/text/Code/Code.tsx
306
- function ie({ code: e, children: n, block: r = !1, className: i, ...a }) {
307
- let o = n ?? e;
308
- return r ? /* @__PURE__ */ t("pre", {
309
- ...g(a),
310
- className: _("core-code", i),
311
- "data-block": "",
312
- children: /* @__PURE__ */ t("code", { children: o })
313
- }) : /* @__PURE__ */ t("code", {
314
- ...g(a),
315
- className: _("core-code", i),
316
- children: o
317
- });
318
- }
319
- //#endregion
320
- //#region src/core/text/Heading/Heading.tsx
321
- var ae = {
322
- 1: "lg",
323
- 2: "md",
324
- 3: "sm",
325
- 4: "xs",
326
- 5: "xs",
327
- 6: "xs"
328
- };
329
- function oe({ text: e, children: n, level: r = 2, size: i, anchor: a, className: o, ...s }) {
330
- let c = Math.min(6, Math.max(1, Math.round(r))), l = `h${c}`;
331
- return /* @__PURE__ */ t(l, {
332
- ...g(s),
333
- id: a,
334
- className: _("core-heading", o),
335
- "data-size": i ?? ae[c],
336
- children: n ?? e
337
- });
338
- }
339
- //#endregion
340
- //#region src/core/text/Text/Text.tsx
341
- var se = {
342
- xs: "eyebrow",
343
- sm: "body-sm",
344
- md: "body",
345
- lg: "title-sm",
346
- xl: "title-md"
347
- };
348
- function ce({ text: e, children: n, as: r = "span", size: i = "md", weight: a = "normal", tone: o = "default", align: s = "start", truncate: c = !1, lines: l, className: u, ...d }) {
349
- let f = r, p = l && l > 0 ? Math.min(6, Math.round(l)) : void 0;
350
- return /* @__PURE__ */ t(f, {
351
- ...g(d),
352
- className: _("core-text", u),
353
- "data-role": se[i] ?? "body",
354
- "data-weight": a,
355
- "data-tone": o,
356
- "data-align": s,
357
- "data-truncate": c || void 0,
358
- "data-lines": p,
359
- children: n ?? e
360
- });
361
- }
362
- //#endregion
363
- //#region src/core/forms/FormField/FormField.tsx
364
- function H({ label: e, hint: r, error: i, required: a, htmlFor: o, hintId: s, errorId: c, as: u = "div", children: d, className: f, style: p }) {
365
- let m = l().replace(/:/g, ""), h = s ?? (r ? `${o ?? m}-hint` : void 0), g = c ?? (i ? `${o ?? m}-error` : void 0), v = u, y = u === "fieldset" ? "legend" : "label";
366
- return /* @__PURE__ */ n(v, {
367
- className: _("core-field", f),
368
- style: p,
369
- "data-invalid": i ? "" : void 0,
370
- children: [
371
- e && /* @__PURE__ */ n(y, {
372
- className: "core-field__label",
373
- ...y === "label" && o ? { htmlFor: o } : {},
374
- children: [e, a && /* @__PURE__ */ n("span", {
375
- className: "core-field__required",
376
- "aria-hidden": "true",
377
- children: [" ", "*"]
378
- })]
379
- }),
380
- r && /* @__PURE__ */ t("p", {
381
- className: "core-field__hint",
382
- id: h,
383
- children: r
384
- }),
385
- d,
386
- i && /* @__PURE__ */ t("p", {
387
- className: "core-field__error",
388
- id: g,
389
- children: i
390
- })
391
- ]
392
- });
393
- }
394
- //#endregion
395
- //#region src/core/forms/_shared/field.tsx
396
- function U(e, t, n) {
397
- let r = l(), i = e ?? `f${r.replace(/:/g, "")}`, a = t ? `${i}-hint` : void 0, o = n ? `${i}-error` : void 0;
398
- return {
399
- control: i,
400
- hintId: a,
401
- errorId: o,
402
- aria: {
403
- "aria-describedby": [a, o].filter(Boolean).join(" ") || void 0,
404
- "aria-invalid": n ? !0 : void 0
405
- }
406
- };
407
- }
408
- function W(e, t) {
409
- return (n) => {
410
- e?.(n), t?.(n);
411
- };
412
- }
413
- //#endregion
414
- //#region src/core/forms/Checkbox/Checkbox.tsx
415
- function le({ value: e, defaultValue: r, onChange: i, setValue: a, id: o, name: s, label: c, children: l, hint: u, error: d, required: f, disabled: p, readOnly: h, className: g, style: v, ref: y }) {
416
- let b = U(o, u, d), [x, S] = m(r ?? !1), C = e ?? x, w = W(i, a);
417
- return /* @__PURE__ */ t(H, {
418
- className: _("core-checkbox", g),
419
- style: v,
420
- hint: u,
421
- error: d,
422
- hintId: b.hintId,
423
- errorId: b.errorId,
424
- children: /* @__PURE__ */ n("label", {
425
- className: "core-choices__option",
426
- "data-disabled": p ? "" : void 0,
427
- children: [/* @__PURE__ */ t("input", {
428
- ref: y,
429
- id: b.control,
430
- type: "checkbox",
431
- name: s,
432
- checked: C,
433
- required: f,
434
- "aria-required": f || void 0,
435
- disabled: p,
436
- "aria-readonly": h || void 0,
437
- onChange: (t) => {
438
- h || (e === void 0 && S(t.target.checked), w(t.target.checked));
439
- },
440
- ...b.aria
441
- }), /* @__PURE__ */ n("span", { children: [l ?? c, f && /* @__PURE__ */ t("span", {
442
- className: "core-field__required",
443
- "aria-hidden": "true",
444
- children: " *"
445
- })] })]
446
- })
447
- });
448
- }
449
- //#endregion
450
- //#region src/core/forms/CheckboxGroup/CheckboxGroup.tsx
451
- function ue({ options: e, value: r, defaultValue: i, onChange: a, setValue: o, id: s, name: c, label: l, hint: u, error: d, required: f, disabled: p, readOnly: h, orientation: g = "vertical", min: v, max: y, className: b, style: x, ref: S }) {
452
- let C = [v === void 0 ? "" : `at least ${v}`, y === void 0 ? "" : `at most ${y}`].filter(Boolean).join(", "), w = [u, C ? `Choose ${C}.` : ""].filter(Boolean).join(" ") || void 0, T = U(s, w, d), [E, D] = m(i ?? []), O = r ?? E, k = W(a, o), A = y !== void 0 && O.length >= y;
453
- return /* @__PURE__ */ t(H, {
454
- as: "fieldset",
455
- className: _("core-choices", b),
456
- style: x,
457
- label: l,
458
- hint: w,
459
- error: d,
460
- required: f,
461
- hintId: T.hintId,
462
- errorId: T.errorId,
463
- children: /* @__PURE__ */ t("div", {
464
- className: "core-choices__list",
465
- "data-orientation": g,
466
- role: "group",
467
- ...T.aria,
468
- children: e.map((i, a) => {
469
- let o = O.includes(i.value);
470
- return /* @__PURE__ */ n("label", {
471
- className: "core-choices__option",
472
- "data-disabled": i.disabled || p ? "" : void 0,
473
- children: [/* @__PURE__ */ t("input", {
474
- ref: a === 0 ? S : void 0,
475
- id: a === 0 ? T.control : void 0,
476
- type: "checkbox",
477
- name: c,
478
- value: i.value,
479
- checked: o,
480
- disabled: i.disabled || p || !o && A || h && !o,
481
- "aria-readonly": h || void 0,
482
- onChange: () => {
483
- if (h) return;
484
- let t = e.map((e) => e.value).filter((e) => e === i.value ? !o : O.includes(e));
485
- r === void 0 && D(t), k(t);
486
- }
487
- }), /* @__PURE__ */ t("span", { children: i.label })]
488
- }, i.value);
489
- })
490
- })
491
- });
492
- }
493
- //#endregion
494
- //#region src/core/forms/DateRange/DateRange.tsx
495
- function de({ value: e, defaultValue: r, onChange: i, setValue: a, id: o, name: s, label: c, hint: l, error: u, required: d, disabled: f, readOnly: p, min: h, max: g, fromLabel: v = "From", toLabel: y = "To", className: b, style: x, ref: S }) {
496
- let C = U(o, l, u), [w, T] = m(r ?? {
497
- from: null,
498
- to: null
499
- }), E = e ?? w, D = W(i, a), O = (t, n) => {
500
- if (p) return;
501
- let r = {
502
- ...E,
503
- [t]: n === "" ? null : n
504
- };
505
- e === void 0 && T(r), D(r);
506
- }, k = {
507
- disabled: f,
508
- readOnly: p,
509
- required: d,
510
- "aria-required": d || void 0,
511
- className: "core-input",
512
- ...C.aria
513
- };
514
- return /* @__PURE__ */ t(H, {
515
- as: "fieldset",
516
- className: _("core-date-range", b),
517
- style: x,
518
- label: c,
519
- hint: l,
520
- error: u,
521
- required: d,
522
- hintId: C.hintId,
523
- errorId: C.errorId,
524
- children: /* @__PURE__ */ n("div", {
525
- className: "core-date-range__row",
526
- children: [/* @__PURE__ */ n("label", {
527
- className: "core-date-range__part",
528
- children: [/* @__PURE__ */ t("span", {
529
- className: "core-date-range__label",
530
- children: v
531
- }), /* @__PURE__ */ t("input", {
532
- ref: S,
533
- id: C.control,
534
- type: "date",
535
- name: s ? `${s}.from` : void 0,
536
- value: E.from ?? "",
537
- min: h,
538
- max: E.to ?? g,
539
- onChange: (e) => O("from", e.target.value),
540
- ...k
541
- })]
542
- }), /* @__PURE__ */ n("label", {
543
- className: "core-date-range__part",
544
- children: [/* @__PURE__ */ t("span", {
545
- className: "core-date-range__label",
546
- children: y
547
- }), /* @__PURE__ */ t("input", {
548
- type: "date",
549
- name: s ? `${s}.to` : void 0,
550
- value: E.to ?? "",
551
- min: E.from ?? h,
552
- max: g,
553
- onChange: (e) => O("to", e.target.value),
554
- ...k
555
- })]
556
- })]
557
- })
558
- });
559
- }
560
- //#endregion
561
- //#region src/core/forms/FileField/FileField.tsx
562
- function fe(e) {
563
- return !Number.isFinite(e) || e < 0 ? "" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(+(e < 10240))} KB` : `${(e / 1048576).toFixed(1)} MB`;
564
- }
565
- function pe({ value: r, defaultValue: i, onChange: a, setValue: o, id: s, name: c, label: l, hint: u, error: d, required: f, disabled: h, readOnly: g, upload: v, accept: y, hash: b = !1, className: x, style: S, ref: C }) {
566
- let w = U(s, u, d), [T, E] = m(i ?? null), D = r === void 0 ? T : r, O = W(a, o), [k, A] = m({
567
- busy: !1,
568
- dragging: !1
569
- }), j = p(null), M = (e) => {
570
- r === void 0 && E(e), O(e);
571
- }, N = async (e) => {
572
- if (e && v && !g && !h) {
573
- A({
574
- busy: !0,
575
- dragging: !1
576
- });
577
- try {
578
- let t = await v(e, { hash: b });
579
- "error" in t ? A({
580
- busy: !1,
581
- failed: t.error,
582
- dragging: !1
583
- }) : (A({
584
- busy: !1,
585
- dragging: !1
586
- }), M(t));
587
- } catch {
588
- A({
589
- busy: !1,
590
- failed: "That file couldn’t be stored. Try again.",
591
- dragging: !1
592
- });
593
- }
594
- }
595
- }, P = (e) => {
596
- e.preventDefault(), N(e.dataTransfer.files?.[0]);
597
- }, F = d ?? k.failed;
598
- return /* @__PURE__ */ t(H, {
599
- className: _("core-file-field", x),
600
- style: S,
601
- label: l,
602
- hint: u,
603
- error: F,
604
- required: f,
605
- htmlFor: w.control,
606
- hintId: w.hintId,
607
- errorId: F ? `${w.control}-error` : void 0,
608
- children: /* @__PURE__ */ n("div", {
609
- className: "core-file-field__box",
610
- "data-dragging": k.dragging ? "" : void 0,
611
- "data-busy": k.busy ? "" : void 0,
612
- onDragOver: (e) => {
613
- g || h || !v || (e.preventDefault(), k.dragging || A((e) => ({
614
- ...e,
615
- dragging: !0
616
- })));
617
- },
618
- onDragLeave: () => A((e) => ({
619
- ...e,
620
- dragging: !1
621
- })),
622
- onDrop: P,
623
- children: [D ? /* @__PURE__ */ n("div", {
624
- className: "core-file-field__file",
625
- children: [
626
- /* @__PURE__ */ t("span", {
627
- className: "core-file-field__name",
628
- children: D.file.name
629
- }),
630
- /* @__PURE__ */ t("span", {
631
- className: "core-file-field__size",
632
- children: fe(D.file.size)
633
- }),
634
- !g && !h && /* @__PURE__ */ t("button", {
635
- type: "button",
636
- className: "core-file-field__button",
637
- onClick: () => M(null),
638
- "aria-label": `Remove ${D.file.name}`,
639
- children: "Remove"
640
- })
641
- ]
642
- }) : k.busy ? /* @__PURE__ */ t("span", {
643
- className: "core-file-field__status",
644
- role: "status",
645
- children: "Uploading…"
646
- }) : /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("button", {
647
- ref: C,
648
- id: w.control,
649
- type: "button",
650
- className: "core-file-field__button",
651
- disabled: h || g || !v,
652
- "aria-required": f || void 0,
653
- "aria-describedby": [w.hintId, F ? `${w.control}-error` : void 0].filter(Boolean).join(" ") || void 0,
654
- "aria-invalid": F ? !0 : void 0,
655
- onClick: () => j.current?.click(),
656
- children: "Choose file"
657
- }), /* @__PURE__ */ t("span", {
658
- className: "core-file-field__drop",
659
- children: "or drop it here"
660
- })] }), /* @__PURE__ */ t("input", {
661
- ref: j,
662
- type: "file",
663
- name: c,
664
- accept: y,
665
- hidden: !0,
666
- tabIndex: -1,
667
- onChange: (e) => void N(e.target.files?.[0])
668
- })]
669
- })
670
- });
671
- }
672
- //#endregion
673
- //#region src/core/forms/RadioGroup/RadioGroup.tsx
674
- function me({ options: e, value: r, defaultValue: i, onChange: a, setValue: o, id: s, name: c, label: l, hint: u, error: d, required: f, disabled: p, readOnly: h, orientation: g = "vertical", className: v, style: y, ref: b }) {
675
- let x = U(s, u, d), [S, C] = m(i ?? null), w = r === void 0 ? S : r, T = W(a, o), E = c ?? x.control;
676
- return /* @__PURE__ */ t(H, {
677
- as: "fieldset",
678
- className: _("core-choices", v),
679
- style: y,
680
- label: l,
681
- hint: u,
682
- error: d,
683
- required: f,
684
- hintId: x.hintId,
685
- errorId: x.errorId,
686
- children: /* @__PURE__ */ t("div", {
687
- className: "core-choices__list",
688
- "data-orientation": g,
689
- role: "radiogroup",
690
- "aria-required": f || void 0,
691
- ...x.aria,
692
- children: e.map((e, i) => /* @__PURE__ */ n("label", {
693
- className: "core-choices__option",
694
- "data-disabled": e.disabled || p ? "" : void 0,
695
- children: [/* @__PURE__ */ t("input", {
696
- ref: i === 0 ? b : void 0,
697
- id: i === 0 ? x.control : void 0,
698
- type: "radio",
699
- name: E,
700
- value: e.value,
701
- checked: w === e.value,
702
- disabled: e.disabled || p || h && w !== e.value,
703
- onChange: () => {
704
- h || (r === void 0 && C(e.value), T(e.value));
705
- }
706
- }), /* @__PURE__ */ t("span", { children: e.label })]
707
- }, e.value))
708
- })
709
- });
710
- }
711
- //#endregion
712
- //#region src/core/forms/TextField/TextField.tsx
713
- var he = (e) => {
714
- if (e.trim() === "") return null;
715
- let t = Number(e);
716
- return Number.isFinite(t) ? t : null;
717
- };
718
- function ge({ type: e = "text", value: r, defaultValue: i, onChange: a, setValue: o, id: s, name: l, label: u, hint: d, error: f, required: p, disabled: h, readOnly: g, placeholder: v, inputMode: y, autoComplete: b, min: x, max: S, step: C, prefix: w, suffix: T, onEnter: E, onKeyDown: D, onBlur: O, className: k, style: A, ref: j }) {
719
- let M = U(s, d, f), [N, P] = m(i), F = r === void 0 ? N : r, I = W(a, o), L = (e) => e == null ? "" : String(e), [R, z] = m(L(F));
720
- c(() => {
721
- e === "number" && he(R) !== (F ?? null) && z(L(F));
722
- }, [F]);
723
- let B = /* @__PURE__ */ t("input", {
724
- ref: j,
725
- id: M.control,
726
- name: l,
727
- type: e === "number" ? "text" : e,
728
- className: "core-input core-text-field__input",
729
- value: e === "number" ? R : L(F),
730
- onChange: (t) => {
731
- let n = t.target.value, i = e === "number" ? he(n) : n;
732
- e === "number" && z(n), r === void 0 && P(i), I(i);
733
- },
734
- onKeyDown: (e) => {
735
- D?.(e), !e.defaultPrevented && E && e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && e.keyCode !== 229 && E(e);
736
- },
737
- onBlur: O,
738
- placeholder: v,
739
- inputMode: y ?? (e === "number" ? "decimal" : void 0),
740
- autoComplete: b,
741
- min: e === "number" ? void 0 : x,
742
- max: e === "number" ? void 0 : S,
743
- step: e === "number" ? void 0 : C,
744
- required: p,
745
- "aria-required": p || void 0,
746
- disabled: h,
747
- readOnly: g,
748
- ...M.aria
749
- }), ee = w || T ? /* @__PURE__ */ n("div", {
750
- className: "core-text-field__affixed",
751
- children: [
752
- w && /* @__PURE__ */ t("span", {
753
- className: "core-text-field__affix",
754
- "aria-hidden": "true",
755
- children: w
756
- }),
757
- B,
758
- T && /* @__PURE__ */ t("span", {
759
- className: "core-text-field__affix",
760
- "aria-hidden": "true",
761
- children: T
762
- })
763
- ]
764
- }) : B;
765
- return /* @__PURE__ */ t(H, {
766
- className: _("core-text-field", k),
767
- style: A,
768
- label: u,
769
- hint: d,
770
- error: f,
771
- required: p,
772
- htmlFor: M.control,
773
- hintId: M.hintId,
774
- errorId: M.errorId,
775
- children: ee
776
- });
777
- }
778
- //#endregion
779
- //#region src/core/forms/SearchField/SearchField.tsx
780
- function _e({ value: e, defaultValue: r, onChange: i, setValue: a, label: o = "Search", onSearch: s, size: c = "md", className: l, ...u }) {
781
- let [d, f] = m(r ?? ""), p = e ?? d, h = (t) => {
782
- e === void 0 && f(t), i?.(t), a?.(t);
783
- };
784
- return /* @__PURE__ */ n("div", {
785
- className: _("core-search-field", l),
786
- "data-filled": p ? "" : void 0,
787
- "data-size": c,
788
- children: [
789
- /* @__PURE__ */ t(ge, {
790
- ...u,
791
- label: o,
792
- value: p,
793
- onChange: (e) => h(typeof e == "string" ? e : ""),
794
- onEnter: () => s?.(p),
795
- inputMode: "search",
796
- className: "core-search-field__field"
797
- }),
798
- /* @__PURE__ */ n("svg", {
799
- className: "core-search-field__icon",
800
- viewBox: "0 0 24 24",
801
- fill: "none",
802
- stroke: "currentColor",
803
- strokeWidth: "1.6",
804
- strokeLinecap: "round",
805
- "aria-hidden": "true",
806
- focusable: "false",
807
- children: [/* @__PURE__ */ t("circle", {
808
- cx: "11",
809
- cy: "11",
810
- r: "6.5"
811
- }), /* @__PURE__ */ t("path", { d: "M16 16l4 4" })]
812
- }),
813
- p && !u.disabled && !u.readOnly && /* @__PURE__ */ t("button", {
814
- type: "button",
815
- className: "core-search-field__clear",
816
- "aria-label": "Clear search",
817
- onClick: () => h(""),
818
- children: /* @__PURE__ */ t("svg", {
819
- viewBox: "0 0 24 24",
820
- fill: "none",
821
- stroke: "currentColor",
822
- strokeWidth: "1.6",
823
- strokeLinecap: "round",
824
- "aria-hidden": "true",
825
- focusable: "false",
826
- children: /* @__PURE__ */ t("path", { d: "M6 6l12 12M18 6L6 18" })
827
- })
828
- })
829
- ]
830
- });
831
- }
832
- //#endregion
833
- //#region src/core/forms/Select/Select.tsx
834
- function ve({ options: e, value: r, defaultValue: i, onChange: a, setValue: o, id: s, name: c, label: l, hint: u, error: d, required: f, disabled: p, readOnly: h, placeholder: g = "Choose…", className: v, style: y, ref: b }) {
835
- let x = U(s, u, d), [S, C] = m(i ?? null), w = r === void 0 ? S : r, T = W(a, o);
836
- return /* @__PURE__ */ t(H, {
837
- className: _("core-select", v),
838
- style: y,
839
- label: l,
840
- hint: u,
841
- error: d,
842
- required: f,
843
- htmlFor: x.control,
844
- hintId: x.hintId,
845
- errorId: x.errorId,
846
- children: /* @__PURE__ */ n("select", {
847
- ref: b,
848
- id: x.control,
849
- name: c,
850
- className: "core-input core-select__input",
851
- value: w ?? "",
852
- onChange: (e) => {
853
- let t = e.target.value === "" ? null : e.target.value;
854
- r === void 0 && C(t), T(t);
855
- },
856
- required: f,
857
- "aria-required": f || void 0,
858
- disabled: p || h,
859
- "aria-readonly": h || void 0,
860
- ...x.aria,
861
- children: [/* @__PURE__ */ t("option", {
862
- value: "",
863
- children: g
864
- }), e.map((e) => /* @__PURE__ */ t("option", {
865
- value: e.value,
866
- disabled: e.disabled,
867
- children: e.label
868
- }, e.value))]
869
- })
870
- });
871
- }
872
- //#endregion
873
- //#region src/core/forms/Slider/Slider.tsx
874
- function ye({ value: e, defaultValue: r, onChange: i, setValue: a, id: o, name: s, label: c, hint: l, error: u, required: d, disabled: f, readOnly: p, min: h = 0, max: g = 100, step: v = 1, format: y = String, className: b, style: x, ref: S }) {
875
- let C = U(o, l, u), [w, T] = m(r ?? h), E = e ?? w, D = W(i, a);
876
- return /* @__PURE__ */ t(H, {
877
- className: _("core-slider", b),
878
- style: x,
879
- label: c,
880
- hint: l,
881
- error: u,
882
- required: d,
883
- htmlFor: C.control,
884
- hintId: C.hintId,
885
- errorId: C.errorId,
886
- children: /* @__PURE__ */ n("div", {
887
- className: "core-slider__row",
888
- children: [/* @__PURE__ */ t("input", {
889
- ref: S,
890
- id: C.control,
891
- name: s,
892
- type: "range",
893
- className: "core-slider__input",
894
- min: h,
895
- max: g,
896
- step: v,
897
- value: E,
898
- disabled: f,
899
- "aria-readonly": p || void 0,
900
- "aria-valuetext": y(E),
901
- onChange: (t) => {
902
- if (p) return;
903
- let n = Number(t.target.value);
904
- e === void 0 && T(n), D(n);
905
- },
906
- ...C.aria
907
- }), /* @__PURE__ */ t("output", {
908
- className: "core-slider__value",
909
- htmlFor: C.control,
910
- children: y(E)
911
- })]
912
- })
913
- });
914
- }
915
- //#endregion
916
- //#region src/core/forms/Switch/Switch.tsx
917
- function be({ value: e, defaultValue: r, onChange: i, setValue: a, id: o, name: s, label: c, hint: l, error: u, disabled: d, readOnly: f, className: p, style: h, ref: g }) {
918
- let v = U(o, l, u), [y, b] = m(r ?? !1), x = e ?? y, S = W(i, a);
919
- return /* @__PURE__ */ n("div", {
920
- className: _("core-switch", p),
921
- style: h,
922
- children: [
923
- /* @__PURE__ */ n("button", {
924
- ref: g,
925
- id: v.control,
926
- name: s,
927
- type: "button",
928
- role: "switch",
929
- "aria-checked": x,
930
- "aria-readonly": f || void 0,
931
- disabled: d,
932
- className: "core-switch__control",
933
- onClick: () => {
934
- f || (e === void 0 && b(!x), S(!x));
935
- },
936
- ...v.aria,
937
- children: [/* @__PURE__ */ t("span", {
938
- className: "core-switch__track",
939
- "aria-hidden": "true",
940
- children: /* @__PURE__ */ t("span", { className: "core-switch__thumb" })
941
- }), /* @__PURE__ */ t("span", {
942
- className: "core-switch__label",
943
- children: c
944
- })]
945
- }),
946
- l && /* @__PURE__ */ t("p", {
947
- className: "core-field__hint",
948
- id: v.hintId,
949
- children: l
950
- }),
951
- u && /* @__PURE__ */ t("p", {
952
- className: "core-field__error",
953
- id: v.errorId,
954
- children: u
955
- })
956
- ]
957
- });
958
- }
959
- //#endregion
960
- //#region src/core/forms/TextArea/TextArea.tsx
961
- function xe({ value: e, defaultValue: r, onChange: i, setValue: a, id: o, name: s, label: c, hint: l, error: d, required: f, disabled: h, readOnly: g, placeholder: v, rows: y = 3, autoGrow: b = !0, maxLength: x, onKeyDown: S, onBlur: C, className: w, style: T, ref: E }) {
962
- let D = U(o, l, d), [O, k] = m(r ?? ""), A = e ?? O, j = W(i, a), M = p(null);
963
- return u(() => {
964
- let e = M.current;
965
- b && e && (e.style.height = "auto", e.style.height = `${e.scrollHeight + 2}px`);
966
- }, [A, b]), /* @__PURE__ */ n(H, {
967
- className: _("core-text-area", w),
968
- style: T,
969
- label: c,
970
- hint: l,
971
- error: d,
972
- required: f,
973
- htmlFor: D.control,
974
- hintId: D.hintId,
975
- errorId: D.errorId,
976
- children: [/* @__PURE__ */ t("textarea", {
977
- ref: (e) => {
978
- M.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
979
- },
980
- id: D.control,
981
- name: s,
982
- className: "core-input core-text-area__input",
983
- rows: y,
984
- value: A,
985
- onChange: (t) => {
986
- e === void 0 && k(t.target.value), j(t.target.value);
987
- },
988
- onKeyDown: S,
989
- onBlur: C,
990
- placeholder: v,
991
- maxLength: x,
992
- required: f,
993
- "aria-required": f || void 0,
994
- disabled: h,
995
- readOnly: g,
996
- ...D.aria
997
- }), x !== void 0 && /* @__PURE__ */ n("span", {
998
- className: "core-field__hint",
999
- "aria-live": "polite",
1000
- children: [
1001
- A.length,
1002
- " / ",
1003
- x
1004
- ]
1005
- })]
1006
- });
1007
- }
1008
- //#endregion
1009
- //#region src/core/feedback/Badge/Badge.tsx
1010
- function Se({ label: e, children: n, tone: r, variant: i = "soft", className: a, ...o }) {
1011
- return /* @__PURE__ */ t("span", {
1012
- ...g(o),
1013
- className: _("core-badge", "core-toned", a),
1014
- "data-tone": P(r),
1015
- "data-variant": i,
1016
- children: n ?? e
1017
- });
1018
- }
1019
- //#endregion
1020
- //#region src/core/feedback/Notice/Notice.tsx
1021
- var Ce = {
1022
- info: "M12 16v-5M12 8h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z",
1023
- success: "M8 12.5l2.5 2.5L16 9.5M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z",
1024
- warning: "M12 9v4M12 17h.01M10.3 3.9L2.2 18a2 2 0 0 0 1.7 3h16.2a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",
1025
- danger: "M12 8v5M12 16h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z"
1026
- };
1027
- function we({ title: e, message: r, children: i, tone: a, action: o, onDismiss: s, className: c, ...l }) {
1028
- let u = P(a, "info"), d = u === "warning" || u === "danger";
1029
- return /* @__PURE__ */ n("div", {
1030
- ...g(l),
1031
- role: d ? "alert" : "status",
1032
- className: _("core-notice", "core-toned", c),
1033
- "data-tone": u,
1034
- children: [
1035
- /* @__PURE__ */ t("svg", {
1036
- className: "core-notice__icon",
1037
- viewBox: "0 0 24 24",
1038
- fill: "none",
1039
- stroke: "currentColor",
1040
- strokeWidth: "1.6",
1041
- strokeLinecap: "round",
1042
- strokeLinejoin: "round",
1043
- "aria-hidden": "true",
1044
- focusable: "false",
1045
- children: /* @__PURE__ */ t("path", { d: Ce[u] ?? Ce.info })
1046
- }),
1047
- /* @__PURE__ */ n("div", {
1048
- className: "core-notice__body",
1049
- children: [e && /* @__PURE__ */ t("p", {
1050
- className: "core-notice__title",
1051
- children: e
1052
- }), /* @__PURE__ */ t("div", {
1053
- className: "core-notice__message",
1054
- children: i ?? r
1055
- })]
1056
- }),
1057
- o && /* @__PURE__ */ t("div", {
1058
- className: "core-notice__action",
1059
- children: o
1060
- }),
1061
- s && /* @__PURE__ */ t("button", {
1062
- type: "button",
1063
- className: "core-notice__dismiss",
1064
- "aria-label": "Dismiss",
1065
- onClick: s,
1066
- children: /* @__PURE__ */ t("svg", {
1067
- viewBox: "0 0 24 24",
1068
- fill: "none",
1069
- stroke: "currentColor",
1070
- strokeWidth: "1.6",
1071
- strokeLinecap: "round",
1072
- "aria-hidden": "true",
1073
- focusable: "false",
1074
- children: /* @__PURE__ */ t("path", { d: "M6 6l12 12M18 6L6 18" })
1075
- })
1076
- })
1077
- ]
1078
- });
1079
- }
1080
- //#endregion
1081
- //#region src/core/feedback/Progress/Progress.tsx
1082
- function Te({ value: e, max: r = 100, label: i, showValue: a = !1, tone: o, size: s = "md", className: c, style: l, ...u }) {
1083
- let d = typeof e == "number" && Number.isFinite(e) && r > 0, f = d ? Math.max(0, Math.min(100, e / r * 100)) : 0;
1084
- return /* @__PURE__ */ n("div", {
1085
- ...g(u),
1086
- className: _("core-progress", "core-toned", c),
1087
- "data-tone": P(o, "accent"),
1088
- "data-size": s,
1089
- style: l,
1090
- children: [(i || a && d) && /* @__PURE__ */ n("div", {
1091
- className: "core-progress__head",
1092
- children: [i && /* @__PURE__ */ t("span", {
1093
- className: "core-progress__label",
1094
- children: i
1095
- }), a && d && /* @__PURE__ */ n("span", {
1096
- className: "core-progress__value",
1097
- children: [Math.round(f), "%"]
1098
- })]
1099
- }), /* @__PURE__ */ t("div", {
1100
- className: "core-progress__track",
1101
- role: "progressbar",
1102
- "aria-label": i,
1103
- "aria-valuemin": 0,
1104
- "aria-valuemax": d ? r : void 0,
1105
- "aria-valuenow": d ? e : void 0,
1106
- "data-indeterminate": d ? void 0 : "",
1107
- style: y({ "--core-progress-fill": `${f}%` }),
1108
- children: /* @__PURE__ */ t("div", { className: "core-progress__fill" })
1109
- })]
1110
- });
1111
- }
1112
- //#endregion
1113
- //#region src/core/feedback/Skeleton/Skeleton.tsx
1114
- function Ee({ shape: e = "text", lines: n = 3, width: r, height: i, className: a, style: o, ...s }) {
1115
- let c = y({
1116
- "--core-skeleton-w": v(r),
1117
- "--core-skeleton-h": v(i)
1118
- }, o);
1119
- if (e !== "text") return /* @__PURE__ */ t("span", {
1120
- ...g(s),
1121
- "aria-hidden": "true",
1122
- className: _("core-skeleton", a),
1123
- "data-shape": e,
1124
- style: c
1125
- });
1126
- let l = Math.max(1, Math.min(12, Math.round(n)));
1127
- return /* @__PURE__ */ t("span", {
1128
- ...g(s),
1129
- "aria-hidden": "true",
1130
- className: _("core-skeleton-lines", a),
1131
- style: c,
1132
- children: Array.from({ length: l }, (e, n) => /* @__PURE__ */ t("span", {
1133
- className: "core-skeleton",
1134
- "data-shape": "line",
1135
- "data-last": n === l - 1 && l > 1 ? "" : void 0
1136
- }, n))
1137
- });
1138
- }
1139
- //#endregion
1140
- //#region src/core/feedback/Spinner/Spinner.tsx
1141
- function De({ label: e = "Loading", size: n = "md", className: r, ...i }) {
1142
- return /* @__PURE__ */ t("span", {
1143
- ...g(i),
1144
- role: "status",
1145
- "aria-label": e,
1146
- className: _("core-spinner", r),
1147
- "data-size": n
1148
- });
1149
- }
1150
- //#endregion
1151
- //#region src/core/feedback/Tooltip/Tooltip.tsx
1152
- function Oe({ content: e, text: r, children: i, side: a = "top", className: o, ...s }) {
1153
- let [u, d] = m(!1), f = l();
1154
- return c(() => {
1155
- if (!u) return;
1156
- let e = (e) => {
1157
- e.key === "Escape" && d(!1);
1158
- };
1159
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1160
- }, [u]), /* @__PURE__ */ n("span", {
1161
- ...g(s),
1162
- className: _("core-tooltip", o),
1163
- "aria-describedby": f,
1164
- onMouseEnter: () => d(!0),
1165
- onMouseLeave: () => d(!1),
1166
- onFocus: () => d(!0),
1167
- onBlur: () => d(!1),
1168
- children: [i, /* @__PURE__ */ t("span", {
1169
- id: f,
1170
- role: "tooltip",
1171
- className: "core-tooltip__bubble",
1172
- "data-side": a,
1173
- "data-open": u ? "" : void 0,
1174
- children: e ?? r
1175
- })]
1176
- });
1177
- }
1178
- //#endregion
1179
- //#region src/core/actions/Button/Button.tsx
1180
- function ke({ children: r, label: i, variant: a = "primary", size: o = "md", tone: s = "neutral", iconLeft: c, iconRight: l, loading: u = !1, disabled: d = !1, type: f = "button", fullWidth: p = !1, className: m, href: h, action: v, input: y, actions: b, navigate: x, onClick: S, ...C }) {
1181
- let w = V({
1182
- href: h,
1183
- action: v,
1184
- input: y,
1185
- actions: b,
1186
- navigate: x,
1187
- onClick: S
1188
- }), T = u || w.busy, E = {
1189
- ...g(C),
1190
- className: _("core-button", m),
1191
- "data-variant": a,
1192
- "data-size": o,
1193
- "data-tone": s,
1194
- "data-full": p || void 0,
1195
- "data-busy": T || void 0
1196
- }, D = /* @__PURE__ */ n(e, { children: [
1197
- T ? /* @__PURE__ */ t("span", {
1198
- className: "core-button__spinner",
1199
- "aria-hidden": "true"
1200
- }) : c,
1201
- /* @__PURE__ */ t("span", {
1202
- className: "core-button__label",
1203
- children: r ?? i
1204
- }),
1205
- l
1206
- ] });
1207
- return h && !d ? /* @__PURE__ */ t("a", {
1208
- ...E,
1209
- href: h,
1210
- onClick: w.onClick,
1211
- "aria-busy": T || void 0,
1212
- ...w.external ? {
1213
- target: "_blank",
1214
- rel: "noopener noreferrer"
1215
- } : {},
1216
- children: D
1217
- }) : /* @__PURE__ */ t("button", {
1218
- ...E,
1219
- type: f,
1220
- disabled: d || T,
1221
- "aria-busy": T || void 0,
1222
- onClick: w.onClick,
1223
- children: D
1224
- });
1225
- }
1226
- //#endregion
1227
- //#region src/core/actions/Chip/Chip.tsx
1228
- function Ae({ children: e, label: r, variant: i = "prompt", size: a = "md", selected: o, onToggle: s, iconLeft: c, disabled: l = !1, className: u, href: d, action: f, input: p, actions: m, navigate: h, onClick: v, ...y }) {
1229
- let b = o !== void 0 || s !== void 0, x = V({
1230
- href: d,
1231
- action: f,
1232
- input: p,
1233
- actions: m,
1234
- navigate: h,
1235
- onClick: v ?? (s ? () => s(!o) : void 0)
1236
- });
1237
- return /* @__PURE__ */ n("button", {
1238
- ...g(y),
1239
- type: "button",
1240
- className: _("core-chip", u),
1241
- "data-variant": i,
1242
- "data-size": a,
1243
- "aria-pressed": b ? !!o : void 0,
1244
- disabled: l || x.busy,
1245
- onClick: x.onClick,
1246
- children: [c, /* @__PURE__ */ t("span", {
1247
- className: "core-chip__label",
1248
- children: e ?? r
1249
- })]
1250
- });
1251
- }
1252
- //#endregion
1253
- //#region src/core/actions/IconButton/IconButton.tsx
1254
- function je({ icon: e, children: n, label: r, size: i = "md", variant: a = "ghost", pressed: o, disabled: s = !1, className: c, href: l, action: u, input: d, actions: f, navigate: p, onClick: m, ...h }) {
1255
- let v = V({
1256
- href: l,
1257
- action: u,
1258
- input: d,
1259
- actions: f,
1260
- navigate: p,
1261
- onClick: m
1262
- }), y = {
1263
- ...g(h),
1264
- className: _("core-icon-button", c),
1265
- "data-size": i,
1266
- "data-variant": a,
1267
- "aria-label": r,
1268
- title: r
1269
- }, b = /* @__PURE__ */ t("span", {
1270
- className: "core-icon-button__glyph",
1271
- "aria-hidden": "true",
1272
- children: e ?? n
1273
- });
1274
- return l && !s ? /* @__PURE__ */ t("a", {
1275
- ...y,
1276
- href: l,
1277
- onClick: v.onClick,
1278
- ...v.external ? {
1279
- target: "_blank",
1280
- rel: "noopener noreferrer"
1281
- } : {},
1282
- children: b
1283
- }) : /* @__PURE__ */ t("button", {
1284
- ...y,
1285
- type: "button",
1286
- "aria-pressed": o,
1287
- disabled: s || v.busy,
1288
- onClick: v.onClick,
1289
- children: b
1290
- });
1291
- }
1292
- //#endregion
1293
- //#region src/core/actions/Link/Link.tsx
1294
- function Me({ href: r, children: i, label: a, variant: o = "default", className: s, navigate: c, onClick: l, ...u }) {
1295
- let d = V({
1296
- href: r,
1297
- navigate: c,
1298
- onClick: l
1299
- });
1300
- return B(r) || ee(r) || /^(https?:|mailto:)/i.test(r) ? /* @__PURE__ */ n("a", {
1301
- ...g(u),
1302
- className: _("core-link", s),
1303
- "data-variant": o,
1304
- href: r,
1305
- onClick: d.onClick,
1306
- ...d.external ? {
1307
- target: "_blank",
1308
- rel: "noopener noreferrer"
1309
- } : {},
1310
- children: [i ?? a, d.external && /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("svg", {
1311
- className: "core-link__away",
1312
- viewBox: "0 0 24 24",
1313
- fill: "none",
1314
- stroke: "currentColor",
1315
- strokeWidth: "1.6",
1316
- strokeLinecap: "round",
1317
- strokeLinejoin: "round",
1318
- "aria-hidden": "true",
1319
- focusable: "false",
1320
- children: /* @__PURE__ */ t("path", { d: "M7 17L17 7M8 7h9v9" })
1321
- }), /* @__PURE__ */ t("span", {
1322
- className: "core-link__note",
1323
- children: " (opens in a new tab)"
1324
- })] })]
1325
- }) : /* @__PURE__ */ t("span", {
1326
- className: _("core-link", s),
1327
- children: i ?? a
1328
- });
1329
- }
1330
- //#endregion
1331
- //#region src/core/actions/SegmentedControl/SegmentedControl.tsx
1332
- function Ne({ options: e, value: n, defaultValue: r, onChange: i, label: a, fullWidth: o = !1, size: s = "md", className: c, setValue: u, ...d }) {
1333
- let [f, h] = m(r ?? e[0]?.value), v = n ?? f, y = l(), b = p([]), x = (e) => {
1334
- n === void 0 && h(e), i?.(e), u?.(e);
1335
- }, S = e.map((e, t) => e.disabled ? -1 : t).filter((e) => e >= 0), C = (t, n) => {
1336
- let r = t.key === "ArrowRight" || t.key === "ArrowDown" ? 1 : t.key === "ArrowLeft" || t.key === "ArrowUp" ? -1 : 0;
1337
- if (!r || !S.length) return;
1338
- t.preventDefault();
1339
- let i = S.indexOf(n), a = S[(i + r + S.length) % S.length];
1340
- b.current[a]?.focus(), x(e[a].value);
1341
- };
1342
- return /* @__PURE__ */ t("div", {
1343
- ...g(d),
1344
- role: "radiogroup",
1345
- "aria-label": a,
1346
- className: _("core-segmented", c),
1347
- "data-full": o || void 0,
1348
- "data-size": s,
1349
- children: e.map((e, n) => {
1350
- let r = e.value === v;
1351
- return /* @__PURE__ */ t("button", {
1352
- ref: (e) => {
1353
- b.current[n] = e;
1354
- },
1355
- type: "button",
1356
- role: "radio",
1357
- name: y,
1358
- "aria-checked": r,
1359
- tabIndex: r || v === void 0 && n === S[0] ? 0 : -1,
1360
- disabled: e.disabled,
1361
- className: "core-segmented__option",
1362
- onClick: () => x(e.value),
1363
- onKeyDown: (e) => C(e, n),
1364
- children: e.label
1365
- }, e.value);
1366
- })
1367
- });
1368
- }
1369
- //#endregion
1370
- //#region src/core/Accordion/Accordion.tsx
1371
- function Pe({ items: e = [], children: r, numbered: i = !1, single: a = !1, rules: o = "subtle", className: s, ...c }) {
1372
- let u = l(), d = i ? "ol" : "ul";
1373
- return /* @__PURE__ */ n("div", {
1374
- ...g(c),
1375
- className: _("core-accordion", s),
1376
- "data-rules": o,
1377
- children: [e.length > 0 && /* @__PURE__ */ t(d, {
1378
- className: "core-accordion__list",
1379
- "data-numbered": i || void 0,
1380
- children: e.map((e, r) => /* @__PURE__ */ t("li", {
1381
- className: "core-accordion__item",
1382
- children: /* @__PURE__ */ n("details", {
1383
- className: "core-disclosure",
1384
- name: a ? u : void 0,
1385
- open: e.open || void 0,
1386
- children: [/* @__PURE__ */ n("summary", {
1387
- className: "core-disclosure__summary",
1388
- children: [i && /* @__PURE__ */ t("span", {
1389
- className: "core-accordion__number",
1390
- children: r + 1
1391
- }), e.question]
1392
- }), /* @__PURE__ */ t("div", {
1393
- className: "core-disclosure__content",
1394
- children: e.answer
1395
- })]
1396
- })
1397
- }, e.id ?? r))
1398
- }), r]
1399
- });
1400
- }
1401
- //#endregion
1402
- //#region src/core/Card/Card.tsx
1403
- function Fe({ media: e, header: r, body: i, footer: a, children: o, tone: s = "plain", className: c, ...l }) {
1404
- return /* @__PURE__ */ n("article", {
1405
- ...g(l),
1406
- className: _("core-card", c),
1407
- "data-tone": s,
1408
- children: [
1409
- e != null && /* @__PURE__ */ t("div", {
1410
- className: "core-card__media",
1411
- children: e
1412
- }),
1413
- r != null && /* @__PURE__ */ t("header", {
1414
- className: "core-card__header",
1415
- children: r
1416
- }),
1417
- (i != null || o != null) && /* @__PURE__ */ n("div", {
1418
- className: "core-card__body",
1419
- children: [i, o]
1420
- }),
1421
- a != null && /* @__PURE__ */ t("footer", {
1422
- className: "core-card__footer",
1423
- children: a
1424
- })
1425
- ]
1426
- });
1427
- }
1428
- //#endregion
1429
- //#region src/core/Columns/Columns.tsx
1430
- var Ie = {
1431
- "1:1": "1fr 1fr",
1432
- "2:1": "2fr 1fr",
1433
- "1:2": "1fr 2fr",
1434
- "3:1": "3fr 1fr",
1435
- "1:3": "1fr 3fr"
1436
- };
1437
- function Le({ start: e, end: r, children: i, ratio: a = "1:1", gap: o, stackBelow: s = "compact", className: c, ...l }) {
1438
- return /* @__PURE__ */ n("div", {
1439
- ...g(l),
1440
- className: _("core-columns", c),
1441
- "data-stack": s,
1442
- children: [/* @__PURE__ */ n("div", {
1443
- className: "core-columns__grid",
1444
- style: y({
1445
- "--core-columns-template": Ie[a] ?? Ie["1:1"],
1446
- "--core-columns-gap": v(o)
1447
- }),
1448
- children: [/* @__PURE__ */ t("div", {
1449
- className: "core-columns__start",
1450
- children: e
1451
- }), /* @__PURE__ */ t("div", {
1452
- className: "core-columns__end",
1453
- children: r
1454
- })]
1455
- }), i]
1456
- });
1457
- }
1458
- var Re = Le;
1459
- //#endregion
1460
- //#region src/core/Disclosure/Disclosure.tsx
1461
- function ze({ summary: e, content: r, children: i, open: a = !1, onToggle: o, className: s, ...c }) {
1462
- return /* @__PURE__ */ n("details", {
1463
- ...g(c),
1464
- className: _("core-disclosure", s),
1465
- open: a || void 0,
1466
- onToggle: o ? (e) => o(e.currentTarget.open) : void 0,
1467
- children: [/* @__PURE__ */ t("summary", {
1468
- className: "core-disclosure__summary",
1469
- children: e
1470
- }), /* @__PURE__ */ n("div", {
1471
- className: "core-disclosure__content",
1472
- children: [r, i]
1473
- })]
1474
- });
1475
- }
1476
- //#endregion
1477
- //#region src/core/Grid/Grid.tsx
1478
- function Be({ items: e, children: n, min: i, columns: a, gap: o, className: s, style: c, ...l }) {
1479
- let u = [...r.toArray(e), ...r.toArray(n)];
1480
- return /* @__PURE__ */ t("div", {
1481
- ...g(l),
1482
- className: _("core-grid", s),
1483
- "data-capped": a && a > 0 ? "" : void 0,
1484
- style: y({
1485
- "--core-grid-min": v(i),
1486
- "--core-grid-gap": v(o),
1487
- "--core-grid-cols": a && a > 0 ? String(Math.round(a)) : void 0
1488
- }, c),
1489
- children: u
1490
- });
1491
- }
1492
- //#endregion
1493
- //#region src/core/Repeat/Repeat.tsx
1494
- function Ve({ item: e, each: n, as: i, layout: a = "stack", gap: o, min: s, empty: c, className: l, style: u, ...d }) {
1495
- let f = r.toArray(e);
1496
- return f.length ? /* @__PURE__ */ t("div", {
1497
- ...g(d),
1498
- className: _("core-repeat", l),
1499
- "data-layout": a,
1500
- style: y({
1501
- "--core-repeat-gap": v(o),
1502
- "--core-repeat-min": v(s)
1503
- }, u),
1504
- children: f
1505
- }) : c ? /* @__PURE__ */ t("p", {
1506
- className: "core-repeat__empty",
1507
- children: c
1508
- }) : null;
1509
- }
1510
- //#endregion
1511
- //#region src/core/document/profiles/profile.ts
1512
- var He = [
1513
- "page-x-of-y",
1514
- "page-number",
1515
- "page-count"
1516
- ], Ue = {
1517
- display: {
1518
- size: 46,
1519
- lineHeight: .98,
1520
- weight: 500,
1521
- tracking: "-0.032em"
1522
- },
1523
- heading: {
1524
- size: 28,
1525
- lineHeight: 1.05,
1526
- weight: 500,
1527
- tracking: "-0.03em"
1528
- },
1529
- subhead: {
1530
- size: 20,
1531
- lineHeight: 1.15,
1532
- weight: 500,
1533
- tracking: "-0.02em"
1534
- },
1535
- title: {
1536
- size: 17,
1537
- lineHeight: 1.3,
1538
- weight: 500,
1539
- tracking: "-0.018em"
1540
- },
1541
- body: {
1542
- size: 15,
1543
- lineHeight: 1.65,
1544
- weight: 400,
1545
- tracking: "-0.012em"
1546
- },
1547
- bodySmall: {
1548
- size: 13,
1549
- lineHeight: 1.65,
1550
- weight: 400,
1551
- tracking: "-0.012em"
1552
- },
1553
- label: {
1554
- size: 13,
1555
- lineHeight: 1.4,
1556
- weight: 500,
1557
- tracking: "-0.015em"
1558
- },
1559
- note: {
1560
- size: 12,
1561
- lineHeight: 1.7,
1562
- weight: 400,
1563
- tracking: "-0.012em"
1564
- },
1565
- eyebrow: {
1566
- size: 11,
1567
- lineHeight: 1,
1568
- weight: 600,
1569
- tracking: "0.14em",
1570
- uppercase: !0
1571
- }
1572
- }, We = {
1573
- full: "var(--color-text)",
1574
- muted: "var(--color-text-muted)",
1575
- subtle: "var(--color-text-subtle)",
1576
- border: "var(--color-border)",
1577
- accent: "var(--color-accent)",
1578
- accentText: "var(--color-link)",
1579
- sunken: "var(--color-surface-sunken)"
1580
- }, Ge = [
1581
- "cover",
1582
- "what-this-is",
1583
- "told-us",
1584
- "meaning",
1585
- "next-steps",
1586
- "talk-it-through",
1587
- "notes",
1588
- "footer"
1589
- ], Ke = [
1590
- {
1591
- id: "workbook",
1592
- label: "Workbook",
1593
- sheet: {
1594
- width: "8.5in",
1595
- height: "11in"
1596
- },
1597
- margins: {
1598
- top: "0.60in",
1599
- right: "0.70in",
1600
- bottom: "0.55in",
1601
- left: "0.95in"
1602
- },
1603
- measure: "6.85in",
1604
- bodyMeasureCh: 64,
1605
- rail: { placement: "strip" },
1606
- ink: We,
1607
- rules: {
1608
- head: "2px",
1609
- structural: "1px",
1610
- row: "1px",
1611
- hairline: "1px"
1612
- },
1613
- type: Ue,
1614
- floorPx: 11,
1615
- depth: {
1616
- max: 1,
1617
- indent: ["0"],
1618
- numbering: "none"
1619
- },
1620
- fills: !0,
1621
- regions: { "page-footer": {
1622
- left: "member-ref",
1623
- centre: "document-id",
1624
- right: "page-x-of-y"
1625
- } },
1626
- sections: {
1627
- known: Ge,
1628
- required: ["next-steps", "talk-it-through"]
1629
- }
1630
- },
1631
- {
1632
- id: "report",
1633
- extends: "workbook",
1634
- label: "Report",
1635
- regions: { "page-footer": { right: "page-x-of-y" } },
1636
- requiredBindings: [],
1637
- sections: {
1638
- known: Ge,
1639
- required: ["next-steps", "talk-it-through"]
1640
- }
1641
- },
1642
- {
1643
- id: "instrument",
1644
- extends: "workbook",
1645
- label: "Instrument",
1646
- sheet: {
1647
- width: "8.5in",
1648
- height: "11in"
1649
- },
1650
- margins: {
1651
- top: "1.00in",
1652
- right: "1.00in",
1653
- bottom: "1.00in",
1654
- left: "1.25in"
1655
- },
1656
- measure: "4.50in",
1657
- bodyMeasureCh: void 0,
1658
- rail: {
1659
- placement: "column",
1660
- axis: "4.75in",
1661
- width: "1.50in",
1662
- gutter: "0.25in"
1663
- },
1664
- ink: {
1665
- full: "#000000",
1666
- muted: "rgba(0,0,0,0.70)",
1667
- subtle: "rgba(0,0,0,0.45)",
1668
- border: "rgba(0,0,0,0.45)",
1669
- accent: "#000000",
1670
- accentText: "#000000",
1671
- sunken: "transparent"
1672
- },
1673
- rules: {
1674
- structural: "0.75pt",
1675
- hairline: "0.25pt"
1676
- },
1677
- type: {
1678
- ...Ue,
1679
- eyebrow: {
1680
- ...Ue.eyebrow,
1681
- tracking: "0.08em"
1682
- }
1683
- },
1684
- depth: {
1685
- max: 3,
1686
- indent: [
1687
- "0",
1688
- "0.375in",
1689
- "0.75in"
1690
- ],
1691
- numbering: "ladder"
1692
- },
1693
- fills: !1,
1694
- regions: { "page-footer": {
1695
- left: "execution-state",
1696
- right: "page-x-of-y"
1697
- } },
1698
- requiredBindings: ["execution-state"],
1699
- sections: { required: [] }
1700
- }
1701
- ], G = /* @__PURE__ */ new Map();
1702
- function qe(e) {
1703
- G.set(e.id, e);
1704
- }
1705
- for (let e of Ke) qe(e);
1706
- function Je() {
1707
- return [...G.keys()].sort();
1708
- }
1709
- function Ye(e) {
1710
- let t = G.get(e);
1711
- if (!t) throw Error(`[document-profile] unknown profile "${e}". Registered: ${Je().join(", ")}`);
1712
- if (!t.extends) return t;
1713
- let n = G.get(t.extends);
1714
- if (!n) throw Error(`[document-profile] "${e}" extends unknown profile "${t.extends}"`);
1715
- if (n.extends) throw Error(`[document-profile] "${e}" extends "${n.id}", which extends "${n.extends}": inheritance is one level deep.`);
1716
- return {
1717
- ...n,
1718
- ...t,
1719
- id: t.id,
1720
- extends: t.extends
1721
- };
1722
- }
1723
- function Xe() {
1724
- let e = {};
1725
- for (let t of Je()) try {
1726
- e[t] = Ye(t);
1727
- } catch (e) {
1728
- console.warn(`[document-profile] skipping "${t}": ${e instanceof Error ? e.message : String(e)}`);
1729
- }
1730
- return e;
1731
- }
1732
- var Ze = Object.freeze(Xe()), Qe = "workbook";
1733
- function $e(e, t) {
1734
- try {
1735
- return Ye(e);
1736
- } catch {
1737
- return j(`unknown-profile:${e}`, `[document-profile] unknown profile "${e}" (first seen in ${t}): rendering with fallback values.`), null;
1738
- }
1739
- }
1740
- function K(e, t) {
1741
- return e === void 0 ? (j("no-profile", `[document-profile] no profileId supplied (first seen in ${t}): falling back to "${Qe}". If this document is an instrument, its numbering and depth are being dropped.`), $e(Qe, t)) : $e(e, t);
1742
- }
1743
- //#endregion
1744
- //#region src/core/document/profiles/tokens.ts
1745
- var et = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), tt = [
1746
- "full",
1747
- "muted",
1748
- "subtle",
1749
- "border",
1750
- "accent",
1751
- "accentText",
1752
- "sunken"
1753
- ], nt = [
1754
- "structural",
1755
- "hairline",
1756
- "head",
1757
- "row"
1758
- ], rt = [
1759
- "display",
1760
- "heading",
1761
- "subhead",
1762
- "title",
1763
- "body",
1764
- "bodySmall",
1765
- "label",
1766
- "note",
1767
- "eyebrow"
1768
- ], it = 3, q = "initial";
1769
- function at(e) {
1770
- let t = {
1771
- "--doc-sheet-width": e.sheet.width,
1772
- "--doc-sheet-height": e.sheet.height,
1773
- "--doc-margin-top": e.margins.top,
1774
- "--doc-margin-right": e.margins.right,
1775
- "--doc-margin-bottom": e.margins.bottom,
1776
- "--doc-margin-left": e.margins.left,
1777
- "--doc-measure": e.measure,
1778
- "--doc-body-measure": e.bodyMeasureCh ? `${e.bodyMeasureCh}ch` : "none",
1779
- "--doc-rail-axis": e.rail.axis ?? q,
1780
- "--doc-rail-width": e.rail.width ?? q,
1781
- "--doc-rail-gutter": e.rail.gutter ?? q,
1782
- "--doc-floor": `${e.floorPx}px`
1783
- };
1784
- for (let n of tt) t[`--doc-ink-${et(n)}`] = e.ink[n];
1785
- for (let n of nt) t[`--doc-rule-${n}`] = e.rules[n] ?? q;
1786
- for (let n of rt) {
1787
- let r = e.type[n], i = `--doc-type-${et(n)}`;
1788
- t[`${i}-size`] = `${r.size}px`, t[`${i}-leading`] = String(r.lineHeight), t[`${i}-weight`] = String(r.weight), t[`${i}-tracking`] = r.tracking, t[`${i}-case`] = r.uppercase ? "uppercase" : "none";
1789
- }
1790
- for (let n = 1; n <= it; n++) t[`--doc-indent-${n}`] = e.depth.indent[n - 1] ?? q;
1791
- return t;
1792
- }
1793
- var ot = (e, t) => `${e} {\n${Object.entries(t).map(([e, t]) => ` ${e}: ${t};`).join("\n")}\n}`;
1794
- function st(e, t) {
1795
- return e.map((e) => ot(e.id === t ? `:root,\n[data-profile='${e.id}']` : `[data-profile='${e.id}']`, at(e))).join("\n\n");
1796
- }
1797
- //#endregion
1798
- //#region src/core/document/_shared/blocks.ts
1799
- var ct = [
1800
- "prose",
1801
- "clause",
1802
- "definitions",
1803
- "table",
1804
- "notice",
1805
- "figure",
1806
- "execution"
1807
- ], lt = /\{\{ref:([^}|]+?)(?:\|(title|full|number))?\}\}/g, J = "[a-z0-9][a-z0-9_-]*", ut = RegExp(`^(?:(${J}):)?(${J}(?:\\.${J})*)(?:#(${J}))?$`);
1808
- RegExp(`^${J}$`);
1809
- function dt(e, t) {
1810
- let n = e.trim(), r = ut.exec(n);
1811
- return r ? {
1812
- key: n,
1813
- ...r[1] ? { doc: r[1] } : {},
1814
- unit: r[2],
1815
- ...r[3] ? { element: r[3] } : {},
1816
- ...t ? { form: t } : {}
1817
- } : null;
1818
- }
1819
- function ft(e) {
1820
- let t = e.lastIndexOf(".");
1821
- return t < 0 ? e : e.slice(t + 1);
1822
- }
1823
- function pt(e) {
1824
- let t = [], n = 0;
1825
- for (let r of e.matchAll(new RegExp(lt.source, "g"))) {
1826
- let i = dt(r[1], r[2]);
1827
- i && (r.index > n && t.push({
1828
- kind: "text",
1829
- text: e.slice(n, r.index)
1830
- }), t.push({
1831
- kind: "ref",
1832
- ...i
1833
- }), n = r.index + r[0].length);
1834
- }
1835
- return n < e.length && t.push({
1836
- kind: "text",
1837
- text: e.slice(n)
1838
- }), t;
1839
- }
1840
- function mt(e) {
1841
- return e.includes("{{ref:");
1842
- }
1843
- //#endregion
1844
- //#region src/core/document/_shared/profile.ts
1845
- var Y = (e) => e ? { "data-profile": e } : {}, ht = (e) => e?.fills === !1 ? { "data-fills": "none" } : {}, gt = {
1846
- note: "ⓘ",
1847
- tip: "💡",
1848
- warning: "⚠️",
1849
- important: "❗"
1850
- };
1851
- function _t({ children: e, tone: r = "note", title: i, profileId: a, profile: o, className: s, style: c }) {
1852
- let l = o ?? K(a, "Aside"), u = l?.fills === !1;
1853
- return /* @__PURE__ */ n("aside", {
1854
- className: _("core-aside", s),
1855
- "data-tone": r,
1856
- ...Y(o?.id ?? a),
1857
- ...ht(l),
1858
- style: c,
1859
- children: [u ? null : /* @__PURE__ */ t("span", {
1860
- className: "core-aside__icon",
1861
- "aria-hidden": !0,
1862
- children: gt[r]
1863
- }), /* @__PURE__ */ n("div", {
1864
- className: "core-aside__body",
1865
- children: [i && /* @__PURE__ */ t("div", {
1866
- className: "core-aside__title",
1867
- children: i
1868
- }), /* @__PURE__ */ t("div", {
1869
- className: "core-aside__text",
1870
- children: e
1871
- })]
1872
- })]
1873
- });
1874
- }
1875
- //#endregion
1876
- //#region src/core/document/Prose/Prose.tsx
1877
- function vt({ children: e, profileId: n, profile: r, full: i = !1, className: a, style: o }) {
1878
- return r || K(n, "Prose"), /* @__PURE__ */ t("div", {
1879
- className: _("core-prose", a),
1880
- "data-full": i ? "" : void 0,
1881
- ...Y(r?.id ?? n),
1882
- style: o,
1883
- children: e
1884
- });
1885
- }
1886
- //#endregion
1887
- //#region src/core/document/Quote/Quote.tsx
1888
- function yt({ children: e, citation: r, className: i, style: a }) {
1889
- return /* @__PURE__ */ n("figure", {
1890
- className: _("core-quote", i),
1891
- style: a,
1892
- children: [/* @__PURE__ */ t("blockquote", {
1893
- className: "core-quote__body",
1894
- children: e
1895
- }), r && /* @__PURE__ */ n("figcaption", {
1896
- className: "core-quote__citation",
1897
- children: ["— ", r]
1898
- })]
1899
- });
1900
- }
1901
- //#endregion
1902
- //#region src/core/document/Definition/Definition.tsx
1903
- function bt({ term: e, description: r, pairs: i, profileId: a, profile: o, className: s, style: c }) {
1904
- o || K(a, "Definition");
1905
- let l = i ?? (e === void 0 ? [] : [{
1906
- term: e,
1907
- description: r
1908
- }]);
1909
- return /* @__PURE__ */ t("dl", {
1910
- className: _("core-definition", s),
1911
- ...Y(o?.id ?? a),
1912
- style: c,
1913
- children: l.map((e, r) => /* @__PURE__ */ n("div", {
1914
- className: "core-definition__item",
1915
- children: [/* @__PURE__ */ t("dt", {
1916
- className: "core-definition__term",
1917
- children: e.term
1918
- }), /* @__PURE__ */ t("dd", {
1919
- className: "core-definition__description",
1920
- children: e.description
1921
- })]
1922
- }, r))
1923
- });
1924
- }
1925
- //#endregion
1926
- //#region src/core/document/Math/Math.tsx
1927
- var xt = "katex";
1928
- function St(e) {
1929
- if (typeof document > "u") return !1;
1930
- for (let t of document.querySelectorAll("script[type=\"importmap\"]")) try {
1931
- if (JSON.parse(t.textContent ?? "").imports?.[e]) return !0;
1932
- } catch {}
1933
- return !1;
1934
- }
1935
- var Ct = (e) => import(
1936
- /* @vite-ignore */
1937
- e
1938
- ), wt;
1939
- function Tt() {
1940
- return wt ??= St(xt) ? Ct(xt).then((e) => {
1941
- let t = e, n = t.default ?? t;
1942
- return typeof n.render == "function" ? n : null;
1943
- }, () => null) : Promise.resolve(null), wt;
1944
- }
1945
- function Et({ children: e = "", mode: n = "inline", className: r }) {
1946
- let i = p(null), [a, o] = m(null), [s, l] = m(null), u = `${n}:${e}`;
1947
- return c(() => {
1948
- let e = !0;
1949
- return Tt().then((t) => {
1950
- e && t && o(() => t);
1951
- }), () => {
1952
- e = !1;
1953
- };
1954
- }, []), c(() => {
1955
- if (a && i.current && s !== u) try {
1956
- a.render(e, i.current, {
1957
- displayMode: n === "block",
1958
- throwOnError: !1
1959
- });
1960
- } catch {
1961
- l(u);
1962
- }
1963
- }, [
1964
- a,
1965
- e,
1966
- n,
1967
- u,
1968
- s
1969
- ]), !a || s === u ? /* @__PURE__ */ t("span", {
1970
- className: _("core-math", r),
1971
- "data-mode": n,
1972
- "data-fallback": "",
1973
- title: "KaTeX not available — showing TeX source",
1974
- children: e
1975
- }) : /* @__PURE__ */ t("span", {
1976
- ref: i,
1977
- className: _("core-math", r),
1978
- "data-mode": n
1979
- });
1980
- }
1981
- //#endregion
1982
- //#region src/core/document/_shared/footnote-context.tsx
1983
- function Dt(e, t) {
1984
- switch (t.type) {
1985
- case "register": return e.footnotes.some((e) => e.id === t.entry.id) ? e : { footnotes: [...e.footnotes, t.entry] };
1986
- case "unregister": return { footnotes: e.footnotes.filter((e) => e.id !== t.id) };
1987
- default: return e;
1988
- }
1989
- }
1990
- var Ot = i(null);
1991
- function kt() {
1992
- return s(Ot);
1993
- }
1994
- function At({ children: e }) {
1995
- let [n, r] = f(Dt, { footnotes: [] }), i = p(0), a = o((e) => {
1996
- i.current += 1;
1997
- let t = i.current;
1998
- return r({
1999
- type: "register",
2000
- entry: {
2001
- ...e,
2002
- number: t
2003
- }
2004
- }), t;
2005
- }, []), s = o((e) => r({
2006
- type: "unregister",
2007
- id: e
2008
- }), []), c = d(() => ({
2009
- state: n,
2010
- registerFootnote: a,
2011
- unregisterFootnote: s
2012
- }), [
2013
- n,
2014
- a,
2015
- s
2016
- ]);
2017
- return /* @__PURE__ */ t(Ot.Provider, {
2018
- value: c,
2019
- children: e
2020
- });
2021
- }
2022
- //#endregion
2023
- //#region src/core/document/Footnote/Footnote.tsx
2024
- function jt({ children: e }) {
2025
- let r = l(), i = kt(), [a, o] = m(null);
2026
- return c(() => {
2027
- if (!i) return;
2028
- let t = i.registerFootnote({
2029
- id: r,
2030
- content: e
2031
- });
2032
- return o(t), () => i.unregisterFootnote(r);
2033
- }, [r]), i ? a === null ? null : /* @__PURE__ */ t("sup", {
2034
- id: `core-footnote-ref-${a}`,
2035
- className: "core-footnote",
2036
- children: /* @__PURE__ */ n("a", {
2037
- href: `#core-footnote-${a}`,
2038
- className: "core-footnote__link",
2039
- children: [
2040
- "[",
2041
- a,
2042
- "]"
2043
- ]
2044
- })
2045
- }) : /* @__PURE__ */ n("span", {
2046
- className: "core-footnote",
2047
- "data-fallback": "",
2048
- children: [
2049
- " ",
2050
- "(",
2051
- e,
2052
- ")"
2053
- ]
2054
- });
2055
- }
2056
- //#endregion
2057
- //#region src/core/document/Figure/Figure.tsx
2058
- function Mt({ children: e, caption: r, profileId: i, profile: a, className: o, style: s }) {
2059
- return a || K(i, "Figure"), /* @__PURE__ */ n("figure", {
2060
- className: _("core-figure", o),
2061
- ...Y(a?.id ?? i),
2062
- style: s,
2063
- children: [/* @__PURE__ */ t("div", {
2064
- className: "core-figure__body",
2065
- children: e
2066
- }), r && /* @__PURE__ */ t("figcaption", {
2067
- className: "core-figure__caption",
2068
- children: r
2069
- })]
2070
- });
2071
- }
2072
- //#endregion
2073
- //#region src/core/document/PageBreak/PageBreak.tsx
2074
- function Nt({ className: e }) {
2075
- return /* @__PURE__ */ t("div", {
2076
- className: _("core-page-break", e),
2077
- "aria-hidden": !0
2078
- });
2079
- }
2080
- //#endregion
2081
- //#region src/core/document/DocumentLabel/DocumentLabel.tsx
2082
- function Pt({ children: e, as: n = "div", profileId: r, profile: i, tone: a = "subtle", className: o, style: s }) {
2083
- return i || K(r, "DocumentLabel"), /* @__PURE__ */ t(n, {
2084
- className: _("core-document-label", o),
2085
- "data-tone": a,
2086
- ...Y(i?.id ?? r),
2087
- style: s,
2088
- children: e
2089
- });
2090
- }
2091
- //#endregion
2092
- //#region src/core/document/_shared/ordinal-format.ts
2093
- var Ft = [
2094
- "one",
2095
- "two",
2096
- "three",
2097
- "four",
2098
- "five",
2099
- "six",
2100
- "seven",
2101
- "eight",
2102
- "nine",
2103
- "ten"
2104
- ];
2105
- function It(e) {
2106
- if (e.length !== 1) return null;
2107
- let t = e[0], n = Ft[t - 1];
2108
- return n ? `Article ${n}` : `Article ${t}`;
2109
- }
2110
- function Lt(e) {
2111
- return e.length === 0 ? null : e.length === 1 ? `Article ${e[0]}` : e.join(".");
2112
- }
2113
- function Rt(e, t, n) {
2114
- let r = n === "ladder" && e !== void 0 && e.length > 0, i = [];
2115
- return t.map(({ level: t, marker: n }) => {
2116
- let a = Math.min(Number.isInteger(t) && t >= 1 ? t : 1, i.length + 1);
2117
- return i.length = a, i[a - 1] = (i[a - 1] ?? 0) + 1, n === void 0 ? r ? [...e, ...i].join(".") : void 0 : n;
2118
- });
2119
- }
2120
- //#endregion
2121
- //#region src/core/document/_shared/section-anchors.ts
2122
- function zt(e, t) {
2123
- return e?.[t] ?? t;
2124
- }
2125
- //#endregion
2126
- //#region src/core/document/Reference/Reference.tsx
2127
- function Bt({ target: e, form: n, sectionReferences: r, sectionNumbers: i, sectionTitles: a, sectionAnchors: o, profileId: s, profile: c, className: l, style: u }) {
2128
- let d = c ?? K(s, "Reference"), f = dt(e), p = r?.[e], m = p?.openable === !1, h = f !== null && f.doc === void 0, g = f ? ft(f.unit) : e, v = p?.number ?? (h && f.element === void 0 ? i?.[g] : void 0), y = p?.title ?? (h && f.element === void 0 ? a?.[g] : void 0), b = null;
2129
- if (f?.element !== void 0) {
2130
- let e = p?.element;
2131
- b = e ? Rt(p.number, e.shape, d?.depth.numbering)[e.index] ?? null : null;
2132
- } else v && (b = Lt(v));
2133
- let x = n === "full" || f?.doc !== void 0 && n !== "title", S;
2134
- S = m ? null : n === "title" ? y ?? b : x && b && y && f?.element === void 0 ? `${b} (${y})` : b ?? y ?? null;
2135
- let C = S !== null, w = C ? p ? p.href : `#${zt(o, g)}` : void 0, T = {
2136
- className: _("core-reference", l),
2137
- "data-target": e,
2138
- "data-unresolved": C || m ? void 0 : "",
2139
- "data-closed": m ? "" : void 0,
2140
- ...Y(c?.id ?? s),
2141
- style: u
2142
- };
2143
- return w ? /* @__PURE__ */ t("a", {
2144
- href: w,
2145
- ...T,
2146
- children: S
2147
- }) : /* @__PURE__ */ t("span", {
2148
- ...T,
2149
- children: S ?? e
2150
- });
2151
- }
2152
- //#endregion
2153
- //#region src/core/document/DocumentTable/DocumentTable.tsx
2154
- function Vt({ columns: e, rows: r, caption: i, profileId: a, profile: o, className: s, style: c }) {
2155
- return o || K(a, "DocumentTable"), e.length === 0 ? null : /* @__PURE__ */ n("div", {
2156
- className: _("core-document-table", s),
2157
- ...Y(o?.id ?? a),
2158
- style: c,
2159
- children: [i === void 0 ? null : /* @__PURE__ */ t("div", {
2160
- className: "core-document-table__caption",
2161
- children: i
2162
- }), /* @__PURE__ */ n("table", {
2163
- className: "core-document-table__table",
2164
- children: [/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { children: e.map((e, n) => /* @__PURE__ */ t("th", {
2165
- scope: "col",
2166
- className: "core-document-table__head",
2167
- "data-align": e.align ?? "left",
2168
- children: e.header
2169
- }, n)) }) }), /* @__PURE__ */ t("tbody", { children: r.map((n, r) => /* @__PURE__ */ t("tr", { children: e.map((e, r) => /* @__PURE__ */ t("td", {
2170
- className: "core-document-table__cell",
2171
- "data-align": e.align ?? "left",
2172
- children: n[r] ?? null
2173
- }, r)) }, r)) })]
2174
- })]
2175
- });
2176
- }
2177
- //#endregion
2178
- //#region src/core/document/RowList/RowList.tsx
2179
- function Ht({ items: e, profileId: r, profile: i, markerWidth: a = 44, secondaryWidth: o = 190, missingLabel: s = "Not answered yet", className: c, style: l }) {
2180
- return i || K(r, "RowList"), e.length === 0 ? null : /* @__PURE__ */ t("div", {
2181
- className: _("core-row-list", c),
2182
- ...Y(i?.id ?? r),
2183
- style: y({
2184
- "--core-row-list-marker-width": v(a),
2185
- "--core-row-list-secondary-width": v(o)
2186
- }, l),
2187
- children: e.map((e, r) => /* @__PURE__ */ n("div", {
2188
- className: "core-row-list__row",
2189
- children: [
2190
- e.marker !== void 0 && /* @__PURE__ */ t("div", {
2191
- className: "core-row-list__marker",
2192
- children: e.marker
2193
- }),
2194
- /* @__PURE__ */ t("div", {
2195
- className: "core-row-list__primary",
2196
- children: e.primary
2197
- }),
2198
- (e.secondary !== void 0 || e.missing) && /* @__PURE__ */ t("div", {
2199
- className: "core-row-list__secondary",
2200
- "data-missing": e.missing ? "" : void 0,
2201
- children: e.missing ? s : e.secondary
2202
- })
2203
- ]
2204
- }, r))
2205
- });
2206
- }
2207
- //#endregion
2208
- //#region src/core/document/AnswerRows/AnswerRows.tsx
2209
- var Ut = 190;
2210
- function Wt({ items: e, profileId: n, profile: r, missingLabel: i = "Not answered yet", answerWidth: a = 190, className: o, style: s }) {
2211
- let c = e.map((e) => {
2212
- let t = typeof e.answer == "string" && e.answer.trim().length > 0;
2213
- return {
2214
- marker: e.reference,
2215
- primary: e.question,
2216
- secondary: t ? e.answer : void 0,
2217
- missing: !t
2218
- };
2219
- });
2220
- return /* @__PURE__ */ t("div", {
2221
- className: _("core-answer-rows", o),
2222
- ...Y(r?.id ?? n),
2223
- style: s,
2224
- children: /* @__PURE__ */ t(Ht, {
2225
- items: c,
2226
- profileId: n,
2227
- profile: r,
2228
- secondaryWidth: a,
2229
- missingLabel: i
2230
- })
2231
- });
2232
- }
2233
- //#endregion
2234
- //#region src/core/_shared/formatters.ts
2235
- function X(e) {
2236
- if (e == null) return "";
2237
- if (typeof e == "string") return e;
2238
- let t = e.precision ?? (e.format === "number" ? Gt(e.value) : void 0), n = Kt(e.format, e.value, {
2239
- precision: t,
2240
- signed: e.signed
2241
- });
2242
- return e.unit && n !== "—" ? `${n}\u00a0${e.unit}` : n;
2243
- }
2244
- function Gt(e) {
2245
- if (typeof e != "number" || !Number.isFinite(e)) return 0;
2246
- let t = String(Number(e.toFixed(3))), n = t.indexOf(".");
2247
- return n === -1 || t.includes("e") ? 0 : t.length - n - 1;
2248
- }
2249
- function Kt(e, t, n = {}) {
2250
- if (!Number.isFinite(t)) return "—";
2251
- let r = n.signed === !0, i = t < 0, a = Math.abs(t), o = i ? "-" : r ? "+" : "";
2252
- switch (e) {
2253
- case "currency": {
2254
- let e = n.precision ?? 0;
2255
- return `${o}$${a.toLocaleString("en-CA", {
2256
- minimumFractionDigits: e,
2257
- maximumFractionDigits: e
2258
- })}`;
2259
- }
2260
- case "currency-k": {
2261
- let e = n.precision ?? 0;
2262
- return a >= 1e3 ? `${o}$${(a / 1e3).toFixed(e)}k` : `${o}$${a.toFixed(0)}`;
2263
- }
2264
- case "currency-m": {
2265
- let e = n.precision ?? 1;
2266
- return a >= 1e6 ? `${o}$${(a / 1e6).toFixed(e)}M` : a >= 1e3 ? `${o}$${(a / 1e3).toFixed(0)}k` : `${o}$${a.toFixed(0)}`;
2267
- }
2268
- case "currency-compact": {
2269
- if (a >= 1e9) {
2270
- let e = n.precision ?? 1;
2271
- return `${o}$${(a / 1e9).toFixed(e)}B`;
2272
- }
2273
- if (a >= 1e6) {
2274
- let e = n.precision ?? 1;
2275
- return `${o}$${(a / 1e6).toFixed(e)}M`;
2276
- }
2277
- if (a >= 1e3) {
2278
- let e = n.precision ?? 1;
2279
- return `${o}$${(a / 1e3).toFixed(e)}k`;
2280
- }
2281
- let e = n.precision ?? 0;
2282
- return `${o}$${a.toFixed(e)}`;
2283
- }
2284
- case "currency-monthly": {
2285
- let e = n.precision ?? 0;
2286
- return `${o}$${a.toLocaleString("en-CA", {
2287
- minimumFractionDigits: e,
2288
- maximumFractionDigits: e
2289
- })}/mo`;
2290
- }
2291
- case "percent": {
2292
- let e = n.precision ?? 1;
2293
- return `${o}${a.toFixed(e)}%`;
2294
- }
2295
- case "age": return `Age ${Math.round(t)}`;
2296
- case "years": {
2297
- let e = n.precision ?? 0;
2298
- return `${o}${a.toFixed(e)} yrs`;
2299
- }
2300
- case "number": {
2301
- let e = n.precision ?? 0;
2302
- return `${o}${a.toLocaleString("en-CA", {
2303
- minimumFractionDigits: e,
2304
- maximumFractionDigits: e
2305
- })}`;
2306
- }
2307
- default: {
2308
- let e = n.precision ?? 0;
2309
- return `${o}$${(a / 1e3).toFixed(e)}k`;
2310
- }
2311
- }
2312
- }
2313
- //#endregion
2314
- //#region src/core/document/ComparisonBars/ComparisonBars.tsx
2315
- var qt = 40;
2316
- function Jt({ bars: e, target: r, targetLabel: i, max: a, profileId: o, profile: s, className: c, style: l }) {
2317
- let u = s ?? K(o, "ComparisonBars");
2318
- if (e.length === 0) return null;
2319
- let d = e.map((e) => e.value), f = a ?? Math.max(...d, r ?? 0);
2320
- if (!Number.isFinite(f) || f <= 0) return j("ComparisonBars:no-scale", "[ComparisonBars] every value is zero or negative, so there is no scale to draw against. Rendering nothing rather than a full-width or zero-width bar, either of which reads as a chart and is not one."), null;
2321
- let p = r !== void 0 && r > 0 && r <= f ? r / f * 100 : void 0;
2322
- return /* @__PURE__ */ n("figure", {
2323
- className: _("core-comparison-bars", c),
2324
- ...Y(s?.id ?? o),
2325
- ...ht(u),
2326
- style: l,
2327
- children: [e.map((e) => {
2328
- let r = Math.max(0, Math.min(100, e.value / f * 100));
2329
- return /* @__PURE__ */ n("div", {
2330
- className: "core-comparison-bars__bar",
2331
- style: y({ "--core-comparison-bars-value": `${r}%` }),
2332
- children: [/* @__PURE__ */ t("div", {
2333
- className: "core-comparison-bars__label",
2334
- children: e.label
2335
- }), /* @__PURE__ */ n("div", {
2336
- className: "core-comparison-bars__track",
2337
- style: y({ "--core-comparison-bars-target": p === void 0 ? void 0 : `${p}%` }),
2338
- children: [
2339
- /* @__PURE__ */ t("div", { className: "core-comparison-bars__fill" }),
2340
- /* @__PURE__ */ t("span", {
2341
- className: "core-comparison-bars__value",
2342
- "data-placement": r > qt ? "inside" : "outside",
2343
- children: X(e.display)
2344
- }),
2345
- p !== void 0 && /* @__PURE__ */ t("div", {
2346
- className: "core-comparison-bars__target",
2347
- "aria-hidden": "true"
2348
- })
2349
- ]
2350
- })]
2351
- }, e.label);
2352
- }), r !== void 0 && i && /* @__PURE__ */ t("figcaption", {
2353
- className: "core-comparison-bars__target-label",
2354
- children: i
2355
- })]
2356
- });
2357
- }
2358
- //#endregion
2359
- //#region src/core/document/NextSteps/NextSteps.tsx
2360
- var Yt = 3, Xt = 5;
2361
- function Zt({ items: e, profileId: r, profile: i, checkboxes: a = !0, className: o, style: s }) {
2362
- return i || K(r, "NextSteps"), e.length === 0 ? null : ((e.length < Yt || e.length > Xt) && j(`NextSteps:count:${e.length}`, `[NextSteps] ${e.length} step(s). A next-steps list takes three to five: fewer reads as an afterthought, more stops being a list a reader acts on this week. Rendering anyway — a document with six steps is far better than one with none.`), /* @__PURE__ */ t("ol", {
2363
- className: _("core-next-steps", o),
2364
- ...Y(i?.id ?? r),
2365
- style: s,
2366
- children: e.map((e, r) => /* @__PURE__ */ n("li", {
2367
- className: "core-next-steps__step",
2368
- children: [
2369
- /* @__PURE__ */ t("span", {
2370
- className: "core-next-steps__marker",
2371
- children: e.marker ?? String(r + 1).padStart(2, "0")
2372
- }),
2373
- a && /* @__PURE__ */ t("span", {
2374
- className: "core-next-steps__box",
2375
- "aria-hidden": "true"
2376
- }),
2377
- /* @__PURE__ */ t("span", {
2378
- className: "core-next-steps__body",
2379
- children: e.body
2380
- })
2381
- ]
2382
- }, r))
2383
- }));
2384
- }
2385
- //#endregion
2386
- //#region src/core/document/Notes/Notes.tsx
2387
- var Qt = 38;
2388
- function $t({ title: e = "Notes", lines: r = 4, profileId: i, profile: a, className: o, style: s }) {
2389
- return a || K(i, "Notes"), r < 1 ? null : /* @__PURE__ */ n("section", {
2390
- className: _("core-notes", o),
2391
- ...Y(a?.id ?? i),
2392
- style: s,
2393
- children: [/* @__PURE__ */ t("div", {
2394
- className: "core-notes__title",
2395
- children: e
2396
- }), /* @__PURE__ */ t("div", {
2397
- className: "core-notes__lines",
2398
- "aria-hidden": "true",
2399
- children: Array.from({ length: r }, (e, n) => /* @__PURE__ */ t("div", { className: "core-notes__line" }, n))
2400
- })]
2401
- });
2402
- }
2403
- //#endregion
2404
- //#region src/core/document/SkippedSection/SkippedSection.tsx
2405
- var en = "You left this section open, so it is not covered here.";
2406
- function tn({ wouldTell: e, openingLine: r = en, profileId: i, profile: a, className: o, style: s }) {
2407
- return a || K(i, "SkippedSection"), /* @__PURE__ */ n("div", {
2408
- className: _("core-skipped-section", o),
2409
- ...Y(a?.id ?? i),
2410
- style: s,
2411
- children: [
2412
- /* @__PURE__ */ t("span", {
2413
- className: "core-skipped-section__standard",
2414
- children: r
2415
- }),
2416
- " ",
2417
- /* @__PURE__ */ t("span", {
2418
- className: "core-skipped-section__would-tell",
2419
- children: e
2420
- })
2421
- ]
2422
- });
2423
- }
2424
- //#endregion
2425
- //#region src/core/document/TalkItThrough/TalkItThrough.tsx
2426
- var nn = "Nothing here is settled. If a number looks wrong, or a step does not fit your situation, say so and we will work through it together.";
2427
- function rn({ advisor: e, title: r = "Talk it through", invitation: i = nn, profileId: a, profile: o, className: s, style: c }) {
2428
- if (o || K(a, "TalkItThrough"), !e?.name?.trim()) return j("TalkItThrough:no-advisor", "[TalkItThrough] no advisor name — rendering NOTHING rather than an empty box. This section is mandatory in an approved output because it is the door to a human; a door with nobody behind it passes a structural check and fails the reader."), null;
2429
- let l = [e.phone, e.email].filter((e) => typeof e == "string" && e.trim().length > 0);
2430
- return l.length === 0 && j("TalkItThrough:no-contact", `[TalkItThrough] "${e.name}" has no phone and no email. The section is the advisor's name, HOW TO REACH THEM, and an open invitation — a name alone is not a route. Rendering, because a named advisor is still better than a dropped section.`), /* @__PURE__ */ n("section", {
2431
- className: _("core-talk-it-through", s),
2432
- ...Y(o?.id ?? a),
2433
- style: c,
2434
- children: [
2435
- /* @__PURE__ */ t("h3", {
2436
- className: "core-talk-it-through__title",
2437
- children: r
2438
- }),
2439
- /* @__PURE__ */ t("p", {
2440
- className: "core-talk-it-through__invitation",
2441
- children: i
2442
- }),
2443
- /* @__PURE__ */ n("div", {
2444
- className: "core-talk-it-through__advisor",
2445
- children: [
2446
- /* @__PURE__ */ t("div", {
2447
- className: "core-talk-it-through__name",
2448
- children: e.name
2449
- }),
2450
- e.role && /* @__PURE__ */ t("div", {
2451
- className: "core-talk-it-through__role",
2452
- children: e.role
2453
- }),
2454
- l.length > 0 && /* @__PURE__ */ t("div", {
2455
- className: "core-talk-it-through__contact",
2456
- children: l.map((e) => /* @__PURE__ */ t("span", { children: e }, e))
2457
- })
2458
- ]
2459
- })
2460
- ]
2461
- });
2462
- }
2463
- //#endregion
2464
- //#region src/core/document/WriteInField/WriteInField.tsx
2465
- var an = 38;
2466
- function on({ question: e, answer: r, lines: i = 1, profileId: a, profile: o, className: s, style: c }) {
2467
- o || K(a, "WriteInField");
2468
- let l = typeof r == "string" && r.trim().length > 0, u = Math.max(1, i);
2469
- return /* @__PURE__ */ n("div", {
2470
- className: _("core-write-in-field", s),
2471
- "data-answered": l ? "" : void 0,
2472
- ...Y(o?.id ?? a),
2473
- style: c,
2474
- children: [e && /* @__PURE__ */ t("div", {
2475
- className: "core-write-in-field__question",
2476
- children: e
2477
- }), l ? /* @__PURE__ */ t("div", {
2478
- className: "core-write-in-field__answer",
2479
- children: r
2480
- }) : Array.from({ length: u }, (e, n) => /* @__PURE__ */ t("div", {
2481
- className: "core-write-in-field__line",
2482
- "aria-hidden": "true"
2483
- }, n))]
2484
- });
2485
- }
2486
- //#endregion
2487
- //#region src/core/document/Masthead/Masthead.tsx
2488
- function sn({ mark: e, identity: r, codes: i, profileId: a, profile: o, className: s, style: c }) {
2489
- return o || K(a, "Masthead"), e === void 0 && r === void 0 && i === void 0 ? null : /* @__PURE__ */ n("header", {
2490
- className: _("core-masthead", s),
2491
- "data-page-region": "page-header",
2492
- ...Y(o?.id ?? a),
2493
- style: c,
2494
- children: [
2495
- e !== void 0 && /* @__PURE__ */ t("div", {
2496
- className: "core-masthead__mark",
2497
- "data-slot": "mark",
2498
- children: e
2499
- }),
2500
- r !== void 0 && /* @__PURE__ */ t("div", {
2501
- className: "core-masthead__identity",
2502
- "data-slot": "identity",
2503
- children: r
2504
- }),
2505
- i !== void 0 && /* @__PURE__ */ t("div", {
2506
- className: "core-masthead__codes",
2507
- "data-slot": "codes",
2508
- children: i
2509
- })
2510
- ]
2511
- });
2512
- }
2513
- //#endregion
2514
- //#region src/core/document/MetaRail/MetaRail.tsx
2515
- var cn = 4;
2516
- function ln({ fields: e, profileId: r, profile: i, className: a, style: o }) {
2517
- let s = (i ?? K(r, "MetaRail"))?.rail.placement ?? "strip";
2518
- return s === "none" || e.length === 0 ? null : (s !== "column" && e.length > cn && typeof console < "u" && console.warn(`[MetaRail] ${e.length} fields in a strip; the spec allows ${cn}. Rendering all of them — check the layout.`), /* @__PURE__ */ t("div", {
2519
- className: _("core-meta-rail", a),
2520
- "data-placement": s,
2521
- ...Y(i?.id ?? r),
2522
- style: o,
2523
- children: e.map((e) => /* @__PURE__ */ n("div", {
2524
- className: "core-meta-rail__field",
2525
- children: [/* @__PURE__ */ t("div", {
2526
- className: "core-meta-rail__label",
2527
- children: e.label
2528
- }), /* @__PURE__ */ t("div", {
2529
- className: "core-meta-rail__value",
2530
- children: e.value
2531
- })]
2532
- }, `${e.label}:${e.value}`))
2533
- }));
2534
- }
2535
- //#endregion
2536
- //#region src/core/document/RunningFooter/RunningFooter.tsx
2537
- var un = {
2538
- left: "bottom-left",
2539
- centre: "bottom-center",
2540
- right: "bottom-right"
2541
- };
2542
- function dn({ left: e, centre: n, right: r, profileId: i, profile: a, className: o, style: s }) {
2543
- a || K(i, "RunningFooter");
2544
- let c = [
2545
- ["left", e],
2546
- ["centre", n],
2547
- ["right", r]
2548
- ].filter(([, e]) => e != null);
2549
- return c.length === 0 ? null : /* @__PURE__ */ t("footer", {
2550
- className: _("core-running-footer", o),
2551
- "data-page-region": "page-footer",
2552
- ...Y(a?.id ?? i),
2553
- style: s,
2554
- children: c.map(([e, n]) => /* @__PURE__ */ t("span", {
2555
- className: "core-running-footer__slot",
2556
- "data-region-slot": e,
2557
- "data-margin-box": un[e],
2558
- children: n
2559
- }, e))
2560
- });
2561
- }
2562
- //#endregion
2563
- //#region src/core/document/DocumentShell/DocumentShell.tsx
2564
- function fn({ children: r, rail: i, profileId: a, profile: o, className: s, style: c }) {
2565
- let l = o ?? K(a, "DocumentShell"), u = l?.rail.placement === "column" && i !== void 0;
2566
- return /* @__PURE__ */ t(At, { children: /* @__PURE__ */ n("div", {
2567
- className: _("core-document-shell", s),
2568
- ...Y(l?.id ?? a),
2569
- "data-has-rail": u ? "" : void 0,
2570
- style: c,
2571
- children: [/* @__PURE__ */ t("div", {
2572
- className: "core-document-shell__body",
2573
- children: r
2574
- }), u && /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("div", {
2575
- className: "core-document-shell__gutter",
2576
- "aria-hidden": !0
2577
- }), /* @__PURE__ */ t("aside", {
2578
- className: "core-document-shell__rail",
2579
- children: i
2580
- })] })]
2581
- }) });
2582
- }
2583
- //#endregion
2584
- //#region src/core/document/Contents/Contents.tsx
2585
- function pn(e, t) {
2586
- return !e || e.length === 0 ? null : t === 0 ? String(e[0]).padStart(2, "0") : e.join(".");
2587
- }
2588
- function mn({ entries: e, depth: r, title: i, profileId: a, profile: o, className: s, style: c }) {
2589
- let l = o ?? K(a, "Contents"), u = l?.depth.max ?? Infinity, d = e ?? [], f = r === void 0 ? d : d.filter((e) => e.level < r);
2590
- if (f.length === 0) return null;
2591
- let p = l?.depth.numbering ?? "none", m = f.some((e) => e.page !== void 0);
2592
- return /* @__PURE__ */ n("nav", {
2593
- "aria-label": "Table of contents",
2594
- className: _("core-contents", s),
2595
- ...Y(o?.id ?? a),
2596
- style: c,
2597
- children: [i && /* @__PURE__ */ t("div", {
2598
- className: "core-contents__title",
2599
- children: i
2600
- }), /* @__PURE__ */ t("ol", {
2601
- className: "core-contents__list",
2602
- children: f.map((e) => {
2603
- let r = p === "none" ? null : pn(e.ordinal, e.level);
2604
- return /* @__PURE__ */ n("li", {
2605
- className: "core-contents__entry",
2606
- "data-level": e.level,
2607
- "data-overdeep": e.level >= u ? "" : void 0,
2608
- style: y({ "--core-contents-level": String(e.level) }),
2609
- children: [
2610
- r && /* @__PURE__ */ t("span", {
2611
- className: "core-contents__ordinal",
2612
- children: r
2613
- }),
2614
- /* @__PURE__ */ t("a", {
2615
- href: `#${e.id}`,
2616
- className: "core-contents__link",
2617
- children: e.title
2618
- }),
2619
- m && /* @__PURE__ */ t("span", {
2620
- className: "core-contents__page",
2621
- children: e.page ?? ""
2622
- })
2623
- ]
2624
- }, e.id);
2625
- })
2626
- })]
2627
- });
2628
- }
2629
- //#endregion
2630
- //#region src/core/document/ExecutionBlock/ExecutionBlock.tsx
2631
- function hn({ s: e, dated: r }) {
2632
- return /* @__PURE__ */ n("div", {
2633
- className: "core-execution-block__signature",
2634
- children: [/* @__PURE__ */ n("div", {
2635
- className: "core-execution-block__lines",
2636
- children: [/* @__PURE__ */ t("div", {
2637
- className: "core-execution-block__line",
2638
- "data-line": "sign"
2639
- }), r ? /* @__PURE__ */ t("div", {
2640
- className: "core-execution-block__line",
2641
- "data-line": "date"
2642
- }) : null]
2643
- }), /* @__PURE__ */ n("div", {
2644
- className: "core-execution-block__captions",
2645
- children: [/* @__PURE__ */ n("div", {
2646
- className: "core-execution-block__party",
2647
- children: [
2648
- e.role ? /* @__PURE__ */ t("div", {
2649
- className: "core-execution-block__role",
2650
- children: e.role
2651
- }) : null,
2652
- e.name ? /* @__PURE__ */ t("div", {
2653
- className: "core-execution-block__name",
2654
- children: e.name
2655
- }) : null,
2656
- e.detail ? /* @__PURE__ */ t("div", {
2657
- className: "core-execution-block__detail",
2658
- children: e.detail
2659
- }) : null
2660
- ]
2661
- }), r ? /* @__PURE__ */ t("div", {
2662
- className: "core-execution-block__date-label",
2663
- children: "Date"
2664
- }) : null]
2665
- })]
2666
- });
2667
- }
2668
- function gn({ attestation: e, label: r, signatories: i, columns: a = 1, note: o, profileId: s, profile: c, className: l, style: u }) {
2669
- c || K(s, "ExecutionBlock");
2670
- let d = Array.isArray(i) ? i : [];
2671
- return /* @__PURE__ */ n("section", {
2672
- className: _("core-execution-block", l),
2673
- ...Y(c?.id ?? s),
2674
- style: u,
2675
- children: [
2676
- r ? /* @__PURE__ */ t("div", {
2677
- className: "core-execution-block__label",
2678
- children: r
2679
- }) : null,
2680
- e ? /* @__PURE__ */ t("div", {
2681
- className: "core-execution-block__attestation",
2682
- children: e
2683
- }) : null,
2684
- /* @__PURE__ */ t("div", {
2685
- className: "core-execution-block__signatories",
2686
- "data-columns": a,
2687
- children: d.map((e, n) => /* @__PURE__ */ t(hn, {
2688
- s: e,
2689
- dated: e.dated === !0
2690
- }, n))
2691
- }),
2692
- o ? /* @__PURE__ */ t("div", {
2693
- className: "core-execution-block__note",
2694
- children: o
2695
- }) : null
2696
- ]
2697
- });
2698
- }
2699
- //#endregion
2700
- //#region src/core/document/DocumentBlocks/DocumentBlocks.tsx
2701
- function _n({ kind: e }) {
2702
- return /* @__PURE__ */ n("div", {
2703
- className: "core-document-blocks__unrenderable",
2704
- "data-unrenderable-block": e,
2705
- role: "alert",
2706
- children: [
2707
- /* @__PURE__ */ t("strong", { children: "This provision could not be rendered." }),
2708
- " The document contains a block of type “",
2709
- e,
2710
- "”, which this bundle has no renderer for. Nothing has been omitted silently — the content is present in the source document and is missing only from this page. Do not sign or rely on this document until it renders in full."
2711
- ]
2712
- });
2713
- }
2714
- function vn({ blocks: e, profileId: n, sectionNumbers: r, sectionAnchors: i, sectionTitles: a, sectionReferences: o, sectionOrdinal: s, className: c, style: l }) {
2715
- let u = K(n, "DocumentBlocks");
2716
- if (e.length === 0) return null;
2717
- let d = Rt(s, e.flatMap((e) => e.kind === "clause" ? e.items : []), u?.depth.numbering), f = 0, p = (e, s) => mt(e) ? pt(e).map((e, c) => e.kind === "text" ? e.text : /* @__PURE__ */ t(Bt, {
2718
- target: e.key,
2719
- form: e.form,
2720
- sectionReferences: o,
2721
- sectionNumbers: r,
2722
- sectionTitles: a,
2723
- sectionAnchors: i,
2724
- profileId: n
2725
- }, `${s}-ref-${c}`)) : e, m = e.some((e) => e.kind === "execution");
2726
- return /* @__PURE__ */ t("div", {
2727
- className: _("core-document-blocks", c),
2728
- "data-pinned": m ? "execution" : void 0,
2729
- ...Y(n),
2730
- style: l,
2731
- children: e.map((e, r) => {
2732
- let i = `${e.kind}-${r}`;
2733
- switch (e.kind) {
2734
- case "prose": return /* @__PURE__ */ t(vt, {
2735
- profileId: n,
2736
- full: e.full,
2737
- children: p(e.text, i)
2738
- }, i);
2739
- case "clause": return /* @__PURE__ */ t(Ht, {
2740
- profileId: n,
2741
- items: e.items.map((e, t) => ({
2742
- marker: d[f++],
2743
- primary: p(e.text, `${i}-${t}`),
2744
- secondary: e.note ? p(e.note, `${i}-${t}-n`) : void 0,
2745
- missing: e.missing
2746
- }))
2747
- }, i);
2748
- case "definitions": return /* @__PURE__ */ t(bt, {
2749
- profileId: n,
2750
- pairs: e.pairs.map((e, t) => ({
2751
- term: e.term,
2752
- description: p(e.description, `${i}-${t}`)
2753
- }))
2754
- }, i);
2755
- case "table": return /* @__PURE__ */ t(Vt, {
2756
- profileId: n,
2757
- caption: e.caption ? p(e.caption, `${i}-cap`) : void 0,
2758
- columns: e.columns,
2759
- rows: e.rows.map((e, t) => e.map((e, n) => p(e, `${i}-${t}-${n}`)))
2760
- }, i);
2761
- case "notice": return /* @__PURE__ */ t(_t, {
2762
- profileId: n,
2763
- tone: e.tone,
2764
- title: e.title,
2765
- children: p(e.text, i)
2766
- }, i);
2767
- case "figure": return /* @__PURE__ */ t(Mt, {
2768
- profileId: n,
2769
- caption: p(e.caption, i),
2770
- children: e.placeholder ?? null
2771
- }, i);
2772
- case "execution": return /* @__PURE__ */ t(gn, {
2773
- profileId: n,
2774
- label: e.label,
2775
- attestation: e.attestation,
2776
- signatories: e.signatories,
2777
- columns: e.columns,
2778
- note: e.note
2779
- }, i);
2780
- default: return /* @__PURE__ */ t(_n, { kind: String(e.kind) }, i);
2781
- }
2782
- })
2783
- });
2784
- }
2785
- //#endregion
2786
- //#region src/core/document/DocumentSection/DocumentSection.tsx
2787
- var yn = [
2788
- "h2",
2789
- "h3",
2790
- "h4",
2791
- "h5",
2792
- "h6"
2793
- ];
2794
- function bn({ sectionId: e, title: r, level: i = 0, ordinal: a, sectionNumbers: o, sectionAnchors: s, sectionTitles: c, sectionReferences: l, sectionLevels: u, continued: d = !1, continuedCount: f, children: p, blocks: m, profileId: h, profile: g, className: v, style: b }) {
2795
- let x = g ?? K(h, "DocumentSection"), S = o?.[e], C = u?.[e], w = S ?? a, T = C === void 0 ? i : Math.max(0, C - 1), E = T >= (x?.depth.max ?? Infinity), D = Math.min(T, (x?.depth.indent.length ?? 1) - 1) + 1, O = x?.depth.numbering === "ladder" && w !== void 0 && w.length > 0, k = O ? It(w) : null, A = yn[Math.min(T, yn.length - 1)], j = zt(s, e), M = `${j}-doc-heading`;
2796
- return /* @__PURE__ */ n("section", {
2797
- id: j,
2798
- className: _("core-document-section", v),
2799
- "data-level": T,
2800
- "data-ordinal-source": w ? S ? "derived" : "baked" : void 0,
2801
- "data-overdeep": E ? "" : void 0,
2802
- "aria-labelledby": M,
2803
- ...Y(g?.id ?? h),
2804
- style: y({ "--core-document-section-indent": `var(--doc-indent-${D}, 0)` }, b),
2805
- children: [
2806
- k && /* @__PURE__ */ t("div", {
2807
- className: "core-document-section__article",
2808
- children: k
2809
- }),
2810
- /* @__PURE__ */ n(A, {
2811
- id: M,
2812
- className: "core-document-section__heading",
2813
- children: [
2814
- O && !k && /* @__PURE__ */ t("span", {
2815
- className: "core-document-section__ordinal",
2816
- children: w.join(".")
2817
- }),
2818
- r,
2819
- d && /* @__PURE__ */ t("span", {
2820
- className: "core-document-section__continued",
2821
- children: "continued"
2822
- })
2823
- ]
2824
- }),
2825
- d && f && /* @__PURE__ */ t("div", {
2826
- className: "core-document-section__count",
2827
- children: `Items ${f.from} to ${f.to} of ${f.of}`
2828
- }),
2829
- /* @__PURE__ */ t("div", {
2830
- className: "core-document-section__body",
2831
- children: p ?? (m ? /* @__PURE__ */ t(vn, {
2832
- blocks: m,
2833
- profileId: h,
2834
- sectionNumbers: o,
2835
- sectionAnchors: s,
2836
- sectionTitles: c,
2837
- sectionReferences: l,
2838
- sectionOrdinal: O ? w : void 0
2839
- }) : null)
2840
- })
2841
- ]
2842
- });
2843
- }
2844
- var xn = {
2845
- prose: {
2846
- type: "object",
2847
- required: ["kind", "text"],
2848
- additionalProperties: !1,
2849
- properties: {
2850
- kind: { const: "prose" },
2851
- text: {
2852
- type: "string",
2853
- description: "ONE paragraph. Two paragraphs in one value run together on the page: emit a second prose block instead."
2854
- },
2855
- full: {
2856
- type: "boolean",
2857
- description: "Fill the measure rather than the reading-width cap. For a caption or text beside a table."
2858
- }
2859
- }
2860
- },
2861
- clause: {
2862
- type: "object",
2863
- required: ["kind", "items"],
2864
- additionalProperties: !1,
2865
- properties: {
2866
- kind: { const: "clause" },
2867
- items: {
2868
- type: "array",
2869
- minItems: 1,
2870
- items: {
2871
- type: "object",
2872
- required: ["text"],
2873
- additionalProperties: !1,
2874
- properties: {
2875
- marker: {
2876
- type: "string",
2877
- description: "An explicit number that overrides the derived one, only for numbering fixed by statute or a standard form. Omit it and the renderer numbers the clause from its article (\"6.3\")."
2878
- },
2879
- level: {
2880
- type: "integer",
2881
- minimum: 1,
2882
- description: "Depth within the section: 1 a clause, 2 a sub-clause, 3 a sub-sub-clause. Default 1."
2883
- },
2884
- id: {
2885
- type: "string",
2886
- pattern: "^[a-z0-9][a-z0-9_-]*$",
2887
- description: "A slug, unique in the document, written only when prose cites this clause as {{ref:<section>#<id>}}. Keep it stable across edits."
2888
- },
2889
- text: { type: "string" },
2890
- note: {
2891
- type: "string",
2892
- description: "A parenthetical, cross-reference or jurisdictional note set beside the text."
2893
- },
2894
- missing: {
2895
- type: "boolean",
2896
- description: "The value is not yet known. Use this instead of writing a [REQUIRED: ...] marker into the text."
2897
- }
2898
- }
2899
- }
2900
- }
2901
- }
2902
- },
2903
- definitions: {
2904
- type: "object",
2905
- required: ["kind", "pairs"],
2906
- additionalProperties: !1,
2907
- properties: {
2908
- kind: { const: "definitions" },
2909
- pairs: {
2910
- type: "array",
2911
- minItems: 1,
2912
- items: {
2913
- type: "object",
2914
- required: ["term", "description"],
2915
- additionalProperties: !1,
2916
- properties: {
2917
- term: { type: "string" },
2918
- description: { type: "string" }
2919
- }
2920
- }
2921
- }
2922
- }
2923
- },
2924
- table: {
2925
- type: "object",
2926
- required: [
2927
- "kind",
2928
- "columns",
2929
- "rows"
2930
- ],
2931
- additionalProperties: !1,
2932
- properties: {
2933
- kind: { const: "table" },
2934
- caption: { type: "string" },
2935
- columns: {
2936
- type: "array",
2937
- minItems: 1,
2938
- items: {
2939
- type: "object",
2940
- required: ["header"],
2941
- additionalProperties: !1,
2942
- properties: {
2943
- header: { type: "string" },
2944
- align: {
2945
- enum: [
2946
- "left",
2947
- "right",
2948
- "center"
2949
- ],
2950
- description: "Right-align money and any other figure column."
2951
- }
2952
- }
2953
- }
2954
- },
2955
- rows: {
2956
- type: "array",
2957
- items: {
2958
- type: "array",
2959
- items: { type: "string" }
2960
- },
2961
- description: "One array per row, each EXACTLY as long as columns. A short row is refused: a table that loses its last column loses data."
2962
- }
2963
- }
2964
- },
2965
- notice: {
2966
- type: "object",
2967
- required: [
2968
- "kind",
2969
- "tone",
2970
- "text"
2971
- ],
2972
- additionalProperties: !1,
2973
- properties: {
2974
- kind: { const: "notice" },
2975
- tone: { enum: [
2976
- "note",
2977
- "warning",
2978
- "important"
2979
- ] },
2980
- title: { type: "string" },
2981
- text: { type: "string" }
2982
- }
2983
- },
2984
- figure: {
2985
- type: "object",
2986
- required: ["kind", "caption"],
2987
- additionalProperties: !1,
2988
- properties: {
2989
- kind: { const: "figure" },
2990
- caption: {
2991
- type: "string",
2992
- description: "Required. An uncaptioned exhibit cannot be cited from the text that relies on it."
2993
- },
2994
- src: {
2995
- type: "string",
2996
- description: "Reference the host resolves. Never a data URI."
2997
- },
2998
- placeholder: {
2999
- type: "string",
3000
- description: "Text stand-in when src is absent, so a figure never renders empty."
3001
- }
3002
- }
3003
- },
3004
- execution: {
3005
- type: "object",
3006
- required: ["kind", "signatories"],
3007
- additionalProperties: !1,
3008
- properties: {
3009
- kind: { const: "execution" },
3010
- label: { type: "string" },
3011
- attestation: {
3012
- type: "string",
3013
- description: "The attestation clause, as running text."
3014
- },
3015
- signatories: {
3016
- type: "array",
3017
- minItems: 1,
3018
- items: {
3019
- type: "object",
3020
- required: ["role"],
3021
- additionalProperties: !1,
3022
- properties: {
3023
- role: {
3024
- type: "string",
3025
- description: "Capacity: \"Testator\", \"Witness\", \"Grantor\"."
3026
- },
3027
- name: {
3028
- type: "string",
3029
- description: "Printed BELOW the signing rule, never on it."
3030
- },
3031
- detail: { type: "string" },
3032
- dated: {
3033
- type: "boolean",
3034
- description: "Add a second, shorter rule for the date."
3035
- }
3036
- }
3037
- }
3038
- },
3039
- columns: { enum: [1, 2] },
3040
- note: { type: "string" }
3041
- }
3042
- }
3043
- }, Sn = [
3044
- "md",
3045
- "lg",
3046
- "xl"
3047
- ], Cn = 5;
3048
- function wn(e) {
3049
- let t = Sn.indexOf(e);
3050
- return t > 0 ? Sn[t - 1] : e;
3051
- }
3052
- var Tn = (e) => typeof e == "object" && !!e && "format" in e && "value" in e;
3053
- function En(e) {
3054
- let t = Number(e);
3055
- return Number.isFinite(t) ? Math.max(0, Math.min(100, t)) : 0;
3056
- }
3057
- function Dn({ value: e, label: r, size: i = "lg", tone: a, progress: o, progressLabel: s, autoStepDown: c = !0, className: l, style: u }) {
3058
- let d = Tn(e) ? X(e) : e, f = typeof d == "string" || typeof d == "number" ? String(d).length : 0, p = c && f > Cn ? wn(i) : i, m = I(a, "strong"), { toned: h, ...g } = L(m), v = o == null ? null : En(o);
3059
- return /* @__PURE__ */ n("div", {
3060
- className: _("core-stat", h && "core-toned", l),
3061
- ...g,
3062
- "data-size": p,
3063
- style: u,
3064
- children: [
3065
- /* @__PURE__ */ t("div", {
3066
- className: "core-stat__value",
3067
- children: d
3068
- }),
3069
- r != null && /* @__PURE__ */ t(R, {
3070
- className: "core-stat__label",
3071
- tone: m === "on-dark" || m === "inherit" ? m : "subtle",
3072
- children: r
3073
- }),
3074
- v !== null && /* @__PURE__ */ t("div", {
3075
- className: "core-stat__progress",
3076
- role: "progressbar",
3077
- "aria-label": s ?? (typeof r == "string" ? r : "Progress"),
3078
- "aria-valuemin": 0,
3079
- "aria-valuemax": 100,
3080
- "aria-valuenow": v,
3081
- style: y({ "--core-stat-progress": `${v}%` }),
3082
- children: /* @__PURE__ */ t("div", { className: "core-stat__progress-fill" })
3083
- })
3084
- ]
3085
- });
3086
- }
3087
- function On({ children: e, minColumnWidth: n = 200, maxColumns: r = 4, gap: i = 32, className: a, style: o }) {
3088
- return /* @__PURE__ */ t("div", {
3089
- className: _("core-stat-group", a),
3090
- style: y({
3091
- "--core-stat-group-min": `${n}px`,
3092
- "--core-stat-group-max": String(Math.max(1, r)),
3093
- "--core-stat-group-gap": `${i}px`
3094
- }, o),
3095
- children: e
3096
- });
3097
- }
3098
- //#endregion
3099
- //#region src/core/display/_shared/Reveal.tsx
3100
- var kn = {
3101
- up: [0, 28],
3102
- left: [-40, 0],
3103
- right: [40, 0],
3104
- none: [0, 0]
3105
- };
3106
- function An({ direction: e = "up", delay: n = 0, duration: r = .5, threshold: i = .15, once: a = !0, className: o, style: s, children: l }) {
3107
- let u = p(null), [d, f] = m(!1);
3108
- c(() => {
3109
- let e = u.current;
3110
- if (!e) return;
3111
- if (typeof IntersectionObserver > "u") {
3112
- f(!0);
3113
- return;
3114
- }
3115
- let t = new IntersectionObserver((e) => {
3116
- let n = e[e.length - 1];
3117
- n && (n.isIntersecting ? (f(!0), a && t.disconnect()) : a || f(!1));
3118
- }, { threshold: Math.min(1, Math.max(0, i)) });
3119
- return t.observe(e), () => t.disconnect();
3120
- }, [a, i]);
3121
- let [h, g] = kn[e];
3122
- return /* @__PURE__ */ t("div", {
3123
- ref: u,
3124
- className: _("core-reveal", o),
3125
- "data-revealed": d ? "true" : "false",
3126
- style: y({
3127
- "--core-reveal-x": `${h}px`,
3128
- "--core-reveal-y": `${g}px`,
3129
- "--core-reveal-duration": `${r}s`,
3130
- "--core-reveal-delay": `${n}s`
3131
- }, s),
3132
- children: l
3133
- });
3134
- }
3135
- //#endregion
3136
- //#region src/core/display/SectionHeader/SectionHeader.tsx
3137
- function jn({ eyebrow: e, title: r, description: i, trailing: a, revealDelay: o = 0, className: s, style: c }) {
3138
- return /* @__PURE__ */ t(An, {
3139
- direction: "up",
3140
- delay: o,
3141
- className: _("core-section-header", s),
3142
- style: c,
3143
- children: /* @__PURE__ */ n("div", {
3144
- className: "core-section-header__inner",
3145
- "data-described": i ? "true" : void 0,
3146
- children: [/* @__PURE__ */ n("div", {
3147
- className: "core-section-header__text",
3148
- children: [
3149
- e ? /* @__PURE__ */ t(R, {
3150
- className: "core-section-header__eyebrow",
3151
- children: e
3152
- }) : null,
3153
- /* @__PURE__ */ t("h2", {
3154
- className: "core-section-header__title",
3155
- children: r
3156
- }),
3157
- i ? /* @__PURE__ */ t("p", {
3158
- className: "core-section-header__description",
3159
- children: i
3160
- }) : null
3161
- ]
3162
- }), a != null && a !== "" ? /* @__PURE__ */ t("div", {
3163
- className: "core-section-header__trailing",
3164
- children: a
3165
- }) : null]
3166
- })
3167
- });
3168
- }
3169
- //#endregion
3170
- //#region src/core/display/HighlightBox/HighlightBox.tsx
3171
- function Mn({ tone: e, label: r, headline: i, children: a, trailing: o, className: s, style: c }) {
3172
- let l = P(e, "accent"), u = o != null && o !== "";
3173
- return /* @__PURE__ */ n("div", {
3174
- className: _("core-highlight-box", "core-toned", s),
3175
- "data-tone": l,
3176
- style: c,
3177
- children: [/* @__PURE__ */ n("div", {
3178
- className: "core-highlight-box__text",
3179
- children: [
3180
- r ? /* @__PURE__ */ t("div", {
3181
- className: "core-highlight-box__label",
3182
- children: r
3183
- }) : null,
3184
- i ? /* @__PURE__ */ t("div", {
3185
- className: "core-highlight-box__headline",
3186
- children: i
3187
- }) : null,
3188
- a != null && a !== "" ? /* @__PURE__ */ t("div", {
3189
- className: "core-highlight-box__body",
3190
- children: a
3191
- }) : null
3192
- ]
3193
- }), u ? /* @__PURE__ */ t("div", {
3194
- className: "core-highlight-box__trailing",
3195
- children: o
3196
- }) : null]
3197
- });
3198
- }
3199
- //#endregion
3200
- //#region src/core/display/DisclaimerBlock/DisclaimerBlock.tsx
3201
- function Nn({ label: r, children: i, className: a, style: o }) {
3202
- return /* @__PURE__ */ n("div", {
3203
- className: _("core-disclaimer-block", a),
3204
- style: o,
3205
- children: [r ? /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("strong", {
3206
- className: "core-disclaimer-block__label",
3207
- children: r
3208
- }), " "] }) : null, i]
3209
- });
3210
- }
3211
- //#endregion
3212
- //#region src/core/display/StatStrip/StatStrip.tsx
3213
- function Pn(e) {
3214
- let t = Number(e);
3215
- return Number.isFinite(t) ? Math.max(0, Math.min(100, t)) : 0;
3216
- }
3217
- function Fn({ label: e, value: r, fillPercent: i, subtitle: a, tone: o, className: s, style: c }) {
3218
- let l = Pn(i);
3219
- return /* @__PURE__ */ n("div", {
3220
- className: _("core-stat-strip", "core-toned", s),
3221
- "data-tone": P(o, "info"),
3222
- style: y({ "--core-stat-strip-fill": `${l}%` }, c),
3223
- children: [
3224
- /* @__PURE__ */ n("div", {
3225
- className: "core-stat-strip__row",
3226
- children: [/* @__PURE__ */ t("span", {
3227
- className: "core-stat-strip__label",
3228
- children: e
3229
- }), /* @__PURE__ */ t("span", {
3230
- className: "core-stat-strip__value",
3231
- children: X(r)
3232
- })]
3233
- }),
3234
- /* @__PURE__ */ t("div", {
3235
- className: "core-stat-strip__track",
3236
- children: /* @__PURE__ */ t("div", { className: "core-stat-strip__fill" })
3237
- }),
3238
- a ? /* @__PURE__ */ t("div", {
3239
- className: "core-stat-strip__subtitle",
3240
- children: X(a)
3241
- }) : null
3242
- ]
3243
- });
3244
- }
3245
- //#endregion
3246
- //#region src/core/display/_shared/ValueBadge.tsx
3247
- function In({ text: e, tone: n, className: r }) {
3248
- return /* @__PURE__ */ t("span", {
3249
- className: _("core-value-badge", "core-toned", r),
3250
- "data-tone": P(n),
3251
- children: X(e)
3252
- });
3253
- }
3254
- //#endregion
3255
- //#region src/core/display/OptionCard/OptionCard.tsx
3256
- var Ln = 8, Rn = {
3257
- good: "success",
3258
- warn: "warning",
3259
- critical: "danger"
3260
- };
3261
- function zn(e, t, n) {
3262
- let r = { series: String(n % Ln + 1) }, i = e ?? t;
3263
- if (typeof i != "string" || i === "") return r;
3264
- if (i === "muted") return { series: "muted" };
3265
- let a = /^series-([1-9]\d*)$/.exec(i);
3266
- if (a) return { series: String((Number(a[1]) - 1) % Ln + 1) };
3267
- let o = Rn[i];
3268
- return o ? { tone: o } : M.includes(i) ? { tone: i } : (j("OptionCard:colour", `[OptionCard] bar fill "${i}" is not a tone or a series slot; using the chart series by position. Name a tone (success, danger, …) or a slot (series-1…series-8).`), r);
3269
- }
3270
- function Bn(e) {
3271
- return typeof e == "number" && Number.isFinite(e) ? {
3272
- text: String(e).padStart(2, "0"),
3273
- kind: "numeral"
3274
- } : typeof e != "string" || e.trim() === "" ? null : /^\d+$/.test(e.trim()) ? {
3275
- text: e.trim().padStart(2, "0"),
3276
- kind: "numeral"
3277
- } : {
3278
- text: e,
3279
- kind: "label"
3280
- };
3281
- }
3282
- function Vn(e) {
3283
- let { number: r, title: i, description: a, badgeText: o, badgeTone: s, bars: c, tone: l, isSelected: u = !1, className: d, style: f } = e, p = Array.isArray(c) ? c : [], m = Bn(r);
3284
- return /* @__PURE__ */ n("div", {
3285
- className: _("core-option-card", d),
3286
- "data-selected": u ? "true" : void 0,
3287
- "data-described": a ? "true" : void 0,
3288
- style: f,
3289
- children: [
3290
- /* @__PURE__ */ n("div", {
3291
- className: "core-option-card__head",
3292
- children: [m ? /* @__PURE__ */ t("div", {
3293
- className: "core-option-card__number",
3294
- "data-kind": m.kind,
3295
- children: m.text
3296
- }) : /* @__PURE__ */ t("span", {}), o != null && o !== "" ? /* @__PURE__ */ t(In, {
3297
- text: o,
3298
- tone: P(s)
3299
- }) : null]
3300
- }),
3301
- i ? /* @__PURE__ */ t("div", {
3302
- className: "core-option-card__title",
3303
- children: i
3304
- }) : null,
3305
- a ? /* @__PURE__ */ t("p", {
3306
- className: "core-option-card__description",
3307
- children: a
3308
- }) : null,
3309
- p.map((e, r) => {
3310
- let i = zn(e.tone, l, r), a = Math.min(100, Math.max(0, Number(e.fillPercent) || 0)), o = e.valueTone === void 0 || e.valueTone === "default" ? void 0 : P(e.valueTone);
3311
- return /* @__PURE__ */ n("div", {
3312
- className: "core-option-card__bar",
3313
- children: [/* @__PURE__ */ n("div", {
3314
- className: "core-option-card__bar-head",
3315
- children: [/* @__PURE__ */ t("span", {
3316
- className: "core-option-card__bar-label",
3317
- children: e.label
3318
- }), /* @__PURE__ */ t("span", {
3319
- className: _("core-option-card__bar-value", o && "core-toned"),
3320
- "data-tone": o,
3321
- children: X(e.value)
3322
- })]
3323
- }), /* @__PURE__ */ t("div", {
3324
- className: "core-option-card__track",
3325
- children: /* @__PURE__ */ t("div", {
3326
- className: _("core-option-card__fill", "tone" in i && "core-toned"),
3327
- "data-tone": "tone" in i ? i.tone : void 0,
3328
- "data-series": "series" in i ? i.series : void 0,
3329
- style: y({ "--core-option-card-fill": `${a}%` })
3330
- })
3331
- })]
3332
- }, r);
3333
- })
3334
- ]
3335
- });
3336
- }
3337
- //#endregion
3338
- //#region src/core/display/ProfileCard/ProfileCard.tsx
3339
- function Hn(e) {
3340
- let { title: r, subtitle: i, rows: a, className: o, style: s } = e, c = e.tone ?? "info", l = c === "none", u = Array.isArray(a) ? a : [];
3341
- return /* @__PURE__ */ n("div", {
3342
- className: _("core-profile-card", !l && "core-toned", o),
3343
- "data-tone": l ? void 0 : P(c, "info"),
3344
- "data-marker": l ? "none" : void 0,
3345
- style: s,
3346
- children: [/* @__PURE__ */ n("div", {
3347
- className: "core-profile-card__head",
3348
- children: [/* @__PURE__ */ t("div", {
3349
- className: "core-profile-card__title",
3350
- children: r
3351
- }), i ? /* @__PURE__ */ t("div", {
3352
- className: "core-profile-card__subtitle",
3353
- children: i
3354
- }) : null]
3355
- }), u.map((e, r) => /* @__PURE__ */ n("div", {
3356
- className: "core-profile-card__row",
3357
- children: [/* @__PURE__ */ t("span", {
3358
- className: "core-profile-card__label",
3359
- children: e.label
3360
- }), /* @__PURE__ */ n("div", {
3361
- className: "core-profile-card__end",
3362
- children: [/* @__PURE__ */ t("span", {
3363
- className: "core-profile-card__value",
3364
- children: X(e.value)
3365
- }), e.badge ? /* @__PURE__ */ t(In, {
3366
- text: e.badge.text,
3367
- tone: P(e.badge.tone)
3368
- }) : null]
3369
- })]
3370
- }, r))]
3371
- });
3372
- }
3373
- //#endregion
3374
- //#region src/core/display/KpiCardGrid/KpiCardGrid.tsx
3375
- function Un(e) {
3376
- if (typeof e == "string") {
3377
- let t = e.trim();
3378
- return t.startsWith("+") ? "up" : t.startsWith("-") || t.startsWith("−") ? "down" : "flat";
3379
- }
3380
- return e && typeof e == "object" && typeof e.value == "number" ? e.value > 0 ? "up" : e.value < 0 ? "down" : "flat" : "flat";
3381
- }
3382
- var Wn = {
3383
- up: "▲",
3384
- down: "▼",
3385
- flat: "—"
3386
- }, Gn = {
3387
- up: "success",
3388
- down: "danger",
3389
- flat: void 0
3390
- }, Z = (e) => e != null && e !== "";
3391
- function Kn(e) {
3392
- let { columns: r = 4, gap: i = "tight", minColumnWidth: a, className: o, style: s } = e, c = Array.isArray(e.cards) ? e.cards : [], l = Math.max(1, Math.min(6, Math.round(Number(r)) || 4));
3393
- return /* @__PURE__ */ t("div", {
3394
- className: _("core-kpi-card-grid", o),
3395
- "data-gap": i === "normal" ? "normal" : "tight",
3396
- style: y({
3397
- "--core-kpi-card-grid-columns": String(l),
3398
- "--core-kpi-card-grid-min": typeof a == "number" && a > 0 ? `${a}px` : void 0
3399
- }, s),
3400
- children: c.map((e, r) => {
3401
- let { subtitle: i, badge: a } = e, o = Z(e.tone) ? P(e.tone) : void 0, s = Z(e.delta) ? Un(e.delta) : void 0, c = s ? Gn[s] : void 0;
3402
- return /* @__PURE__ */ t(An, {
3403
- direction: "up",
3404
- delay: r * .06,
3405
- className: "core-kpi-card-grid__item",
3406
- children: /* @__PURE__ */ n("div", {
3407
- className: _("core-kpi-card-grid__card", o && "core-toned"),
3408
- "data-tone": o,
3409
- children: [
3410
- /* @__PURE__ */ n("div", {
3411
- className: "core-kpi-card-grid__head",
3412
- children: [/* @__PURE__ */ t("div", {
3413
- className: "core-kpi-card-grid__label",
3414
- children: e.label
3415
- }), a && Z(a.text) ? /* @__PURE__ */ t(In, {
3416
- text: a.text,
3417
- tone: P(a.tone)
3418
- }) : null]
3419
- }),
3420
- /* @__PURE__ */ t("div", {
3421
- className: "core-kpi-card-grid__value",
3422
- children: X(e.value)
3423
- }),
3424
- s ? /* @__PURE__ */ n("div", {
3425
- className: _("core-kpi-card-grid__delta", c && "core-toned"),
3426
- "data-tone": c,
3427
- "data-direction": s,
3428
- children: [
3429
- /* @__PURE__ */ t("span", {
3430
- "aria-hidden": "true",
3431
- children: Wn[s]
3432
- }),
3433
- " ",
3434
- X(e.delta)
3435
- ]
3436
- }) : null,
3437
- Z(i) ? /* @__PURE__ */ t("div", {
3438
- className: "core-kpi-card-grid__subtitle",
3439
- children: X(i)
3440
- }) : null
3441
- ]
3442
- })
3443
- }, r);
3444
- })
3445
- });
3446
- }
3447
- //#endregion
3448
- //#region src/core/display/DataTable/DataTable.tsx
3449
- function qn(e) {
3450
- if (typeof e == "string" && e !== "" && e !== "default") return P(e);
3451
- }
3452
- var Jn = (e) => !!(e && typeof e == "object" && "value" in e && "format" in e), Yn = (e) => !!(e && typeof e == "object" && !Array.isArray(e) && !a(e) && "value" in e && !("format" in e));
3453
- function Xn(e) {
3454
- return Yn(e) ? e : { value: e };
3455
- }
3456
- var Zn = /^\d{4}-\d{2}-\d{2}$/, Qn = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?)?$/;
3457
- function $n(e, t) {
3458
- if (!Qn.test(e)) return e;
3459
- let n = Zn.test(e), r = new Date(n ? `${e}T00:00:00Z` : e.replace(" ", "T"));
3460
- return Number.isNaN(r.getTime()) ? e : r.toLocaleString("en-CA", {
3461
- year: "numeric",
3462
- month: "short",
3463
- day: "numeric",
3464
- ...t === "datetime" && !n ? {
3465
- hour: "numeric",
3466
- minute: "2-digit"
3467
- } : {},
3468
- ...n ? { timeZone: "UTC" } : {}
3469
- });
3470
- }
3471
- function er(e, t) {
3472
- return typeof e == "string" && t ? $n(e, t) : typeof e == "string" || Jn(e) ? X(e) : typeof e == "number" ? String(e) : a(e) ? e : null;
3473
- }
3474
- function tr({ title: e, subtitle: r, columns: i, rows: a, className: o, style: s }) {
3475
- let c = `${l()}-title`, u = Array.isArray(i) ? i : [], d = Array.isArray(a) ? a : [], f = (e) => u[e]?.align ?? (e === 0 ? "left" : "right");
3476
- return /* @__PURE__ */ t(An, {
3477
- direction: "up",
3478
- children: /* @__PURE__ */ n("div", {
3479
- className: _("core-data-table", o),
3480
- style: s,
3481
- children: [e || r ? /* @__PURE__ */ n("div", {
3482
- className: "core-data-table__head",
3483
- children: [e ? /* @__PURE__ */ t("div", {
3484
- id: c,
3485
- className: "core-data-table__title",
3486
- children: e
3487
- }) : null, r ? /* @__PURE__ */ t("div", {
3488
- className: "core-data-table__subtitle",
3489
- children: r
3490
- }) : null]
3491
- }) : null, /* @__PURE__ */ t("div", {
3492
- className: "core-data-table__scroll",
3493
- role: "region",
3494
- "aria-label": e ? void 0 : "Data table, scrollable",
3495
- "aria-labelledby": e ? c : void 0,
3496
- tabIndex: 0,
3497
- children: /* @__PURE__ */ n("table", {
3498
- className: "core-data-table__table",
3499
- children: [/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { children: u.map((e, r) => /* @__PURE__ */ n("th", {
3500
- scope: "col",
3501
- className: "core-data-table__col",
3502
- "data-align": f(r),
3503
- style: y({ "--core-data-table-min": typeof e.minWidth == "number" && e.minWidth > 0 ? `${e.minWidth}px` : void 0 }),
3504
- children: [e.header, e.sublabel ? /* @__PURE__ */ t("span", {
3505
- className: "core-data-table__sublabel",
3506
- children: e.sublabel
3507
- }) : null]
3508
- }, r)) }) }), /* @__PURE__ */ t("tbody", { children: d.map((e, n) => {
3509
- let { highlighted: r, total: i } = e, a = e.cells, o = Array.isArray(a) ? a : a && typeof a == "object" ? u.map((e) => a[e.key]) : [];
3510
- return /* @__PURE__ */ t("tr", {
3511
- className: "core-data-table__row",
3512
- "data-highlighted": r ? "true" : void 0,
3513
- "data-total": i ? "true" : void 0,
3514
- children: o.map((e, n) => {
3515
- let r = Xn(e), i = qn(r.tone), a = {
3516
- className: _("core-data-table__cell", i && "core-toned"),
3517
- "data-align": f(n),
3518
- "data-tone": i
3519
- };
3520
- return n === 0 ? /* @__PURE__ */ t("th", {
3521
- scope: "row",
3522
- ...a,
3523
- children: er(r.value, u[n]?.format)
3524
- }, n) : /* @__PURE__ */ t("td", {
3525
- ...a,
3526
- children: er(r.value, u[n]?.format)
3527
- }, n);
3528
- })
3529
- }, n);
3530
- }) })]
3531
- })
3532
- })]
3533
- })
3534
- });
3535
- }
3536
- //#endregion
3537
- //#region src/core/events/_shared/event.ts
3538
- function nr(e, t, n) {
3539
- return e.cardComponent && typeof t == "function" ? t(e.cardComponent, {
3540
- ...n,
3541
- event: e
3542
- }) ?? null : null;
3543
- }
3544
- var rr = [
3545
- "accepted",
3546
- "tentative",
3547
- "declined"
3548
- ], ir = (e, t) => new Intl.DateTimeFormat(e, {
3549
- weekday: "short",
3550
- month: "short",
3551
- day: "numeric",
3552
- timeZone: t
3553
- }), ar = (e, t) => new Intl.DateTimeFormat(e, {
3554
- hour: "numeric",
3555
- minute: "2-digit",
3556
- timeZone: t
3557
- });
3558
- function or(e, t, n) {
3559
- if (e.startOn) {
3560
- let n = /* @__PURE__ */ new Date(`${e.startOn}T00:00:00Z`), r = ir(t, "UTC").format(n);
3561
- if (!e.endOn) return `${r} (all day)`;
3562
- let i = /* @__PURE__ */ new Date((/* @__PURE__ */ new Date(`${e.endOn}T00:00:00Z`)).getTime() - 864e5);
3563
- return i.getTime() <= n.getTime() ? `${r} (all day)` : `${r} – ${ir(t, "UTC").format(i)}`;
3564
- }
3565
- if (!e.startsAt) return "";
3566
- let r = new Date(e.startsAt);
3567
- if (Number.isNaN(r.getTime())) return "";
3568
- let i = ir(t, n).format(r), a = ar(t, n).format(r);
3569
- if (!e.endsAt) return `${i} · ${a}`;
3570
- let o = new Date(e.endsAt);
3571
- return Number.isNaN(o.getTime()) || o.getTime() === r.getTime() ? `${i} · ${a}` : `${i} · ${a} – ${ar(t, n).format(o)}`;
3572
- }
3573
- var sr = () => Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
3574
- function cr(e) {
3575
- if (!e) return;
3576
- let t = new Date(e);
3577
- return Number.isNaN(t.getTime()) ? void 0 : t.toISOString();
3578
- }
3579
- function lr() {
3580
- let e = /* @__PURE__ */ new Date();
3581
- return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e.toISOString().slice(0, 16);
3582
- }
3583
- function ur(e) {
3584
- return e.success ? "" : e.code === "DENIED" ? "You can't do that here." : e.code === "CONFLICT" ? "Someone changed this first. Reload and try again." : e.code === "INVALID" ? e.errors || "Some details are missing or not valid." : e.errors || "Something went wrong. Try again.";
3585
- }
3586
- function dr(e, t) {
3587
- let n = typeof e == "string" ? new Date(e) : e;
3588
- return new Intl.DateTimeFormat("en-CA", {
3589
- timeZone: t,
3590
- year: "numeric",
3591
- month: "2-digit",
3592
- day: "2-digit"
3593
- }).format(n);
3594
- }
3595
- function Q(e, t) {
3596
- let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
3597
- return n.setUTCDate(n.getUTCDate() + t), n.toISOString().slice(0, 10);
3598
- }
3599
- function fr(e) {
3600
- return Q(e, -(((/* @__PURE__ */ new Date(`${e}T00:00:00Z`)).getUTCDay() + 6) % 7));
3601
- }
3602
- function pr(e, t) {
3603
- if (e.startOn) {
3604
- let t = e.endOn && e.endOn > e.startOn ? e.endOn : Q(e.startOn, 1), n = [];
3605
- for (let r = e.startOn; r < t && n.length < 62; r = Q(r, 1)) n.push(r);
3606
- return n;
3607
- }
3608
- return e.startsAt ? [dr(e.startsAt, t)] : [];
3609
- }
3610
- var $ = (e, t) => e && t ? e.split("{id}").join(encodeURIComponent(t)) : void 0;
3611
- //#endregion
3612
- //#region src/core/events/EventCard/EventCard.tsx
3613
- function mr(r) {
3614
- let { event: i, href: a, locale: o, timeZone: s, className: c, style: l } = r, u = i && typeof i == "object" ? i : { name: "" }, d = or(u, o, s), f = u.status && u.status !== "confirmed" ? u.status : void 0, p = /* @__PURE__ */ n(e, { children: [
3615
- /* @__PURE__ */ n("div", {
3616
- className: "core-event-card__top",
3617
- children: [u.typeName ? /* @__PURE__ */ t("span", {
3618
- className: "core-event-card__type",
3619
- children: u.typeName
3620
- }) : null, f ? /* @__PURE__ */ t("span", {
3621
- className: "core-event-card__status",
3622
- "data-status": f,
3623
- children: f
3624
- }) : null]
3625
- }),
3626
- /* @__PURE__ */ t("div", {
3627
- className: "core-event-card__name",
3628
- children: u.name
3629
- }),
3630
- d ? /* @__PURE__ */ t("div", {
3631
- className: "core-event-card__when",
3632
- children: d
3633
- }) : null,
3634
- u.location ? /* @__PURE__ */ t("div", {
3635
- className: "core-event-card__where",
3636
- children: u.location
3637
- }) : null
3638
- ] });
3639
- return /* @__PURE__ */ t("div", {
3640
- className: _("core-event-card", c),
3641
- "data-kind": u.kind,
3642
- "data-status": u.status,
3643
- style: l,
3644
- children: a ? /* @__PURE__ */ t("a", {
3645
- className: "core-event-card__link",
3646
- href: a,
3647
- children: p
3648
- }) : p
3649
- });
3650
- }
3651
- //#endregion
3652
- //#region src/core/events/EventRespond/EventRespond.tsx
3653
- var hr = {
3654
- accepted: "Accept",
3655
- tentative: "Maybe",
3656
- declined: "Decline"
3657
- };
3658
- function gr(e) {
3659
- let { actions: r, className: i, style: a } = e, [o, s] = m(e.response), [c, l] = m(!1), [u, d] = m(""), f = r?.respond, p = async (e) => {
3660
- if (!f || c) return;
3661
- l(!0), d("");
3662
- let t = await f({ response: e });
3663
- l(!1), t.success ? s(e) : d(ur(t));
3664
- };
3665
- return /* @__PURE__ */ n("div", {
3666
- className: _("core-event-respond", i),
3667
- style: a,
3668
- children: [/* @__PURE__ */ t("div", {
3669
- className: "core-event-respond__choices",
3670
- role: "group",
3671
- "aria-label": "Your response",
3672
- children: rr.map((e) => /* @__PURE__ */ t("button", {
3673
- type: "button",
3674
- className: "core-event-respond__choice",
3675
- "aria-pressed": o === e,
3676
- disabled: !f || c,
3677
- onClick: () => void p(e),
3678
- children: hr[e]
3679
- }, e))
3680
- }), u ? /* @__PURE__ */ t("p", {
3681
- className: "core-event-respond__message",
3682
- role: "alert",
3683
- children: u
3684
- }) : null]
3685
- });
3686
- }
3687
- //#endregion
3688
- //#region src/core/events/EventDetail/EventDetail.tsx
3689
- function _r(e) {
3690
- let { event: r, actions: i, viewerResponse: a, locale: o, timeZone: s, className: c, style: l } = e, u = r && typeof r == "object" ? r : { name: "" }, d = Array.isArray(e.notes) ? e.notes : [], f = Array.isArray(e.participants) ? e.participants : [], p = or(u, o, s);
3691
- return /* @__PURE__ */ n("article", {
3692
- className: _("core-event-detail", c),
3693
- "data-status": u.status,
3694
- style: l,
3695
- children: [
3696
- /* @__PURE__ */ n("header", {
3697
- className: "core-event-detail__head",
3698
- children: [
3699
- u.typeName ? /* @__PURE__ */ t("div", {
3700
- className: "core-event-detail__type",
3701
- children: u.typeName
3702
- }) : null,
3703
- /* @__PURE__ */ t("h2", {
3704
- className: "core-event-detail__name",
3705
- children: u.name
3706
- }),
3707
- p ? /* @__PURE__ */ t("div", {
3708
- className: "core-event-detail__meta",
3709
- children: p
3710
- }) : null,
3711
- u.location ? /* @__PURE__ */ t("div", {
3712
- className: "core-event-detail__meta",
3713
- children: u.location
3714
- }) : null,
3715
- u.status && u.status !== "confirmed" ? /* @__PURE__ */ t("div", {
3716
- className: "core-event-detail__status",
3717
- children: u.status
3718
- }) : null
3719
- ]
3720
- }),
3721
- a === void 0 ? null : /* @__PURE__ */ t(gr, {
3722
- response: a,
3723
- actions: i,
3724
- className: "core-event-detail__respond"
3725
- }),
3726
- f.length ? /* @__PURE__ */ n("section", {
3727
- className: "core-event-detail__section",
3728
- "aria-label": "Participants",
3729
- children: [/* @__PURE__ */ t("h3", {
3730
- className: "core-event-detail__heading",
3731
- children: "Participants"
3732
- }), /* @__PURE__ */ t("ul", {
3733
- className: "core-event-detail__list",
3734
- children: f.map((e, r) => /* @__PURE__ */ n("li", {
3735
- className: "core-event-detail__person",
3736
- children: [/* @__PURE__ */ t("span", { children: e.name }), /* @__PURE__ */ t("span", {
3737
- className: "core-event-detail__muted",
3738
- children: [e.role, e.response && e.response !== "needs_action" ? e.response : void 0].filter(Boolean).join(" · ")
3739
- })]
3740
- }, r))
3741
- })]
3742
- }) : null,
3743
- d.length ? /* @__PURE__ */ n("section", {
3744
- className: "core-event-detail__section",
3745
- "aria-label": "Notes",
3746
- children: [/* @__PURE__ */ t("h3", {
3747
- className: "core-event-detail__heading",
3748
- children: "Notes"
3749
- }), d.map((e, r) => /* @__PURE__ */ n("div", {
3750
- className: "core-event-detail__note",
3751
- "data-audience": e.audience,
3752
- children: [
3753
- e.audience === "staff" ? /* @__PURE__ */ t("div", {
3754
- className: "core-event-detail__badge",
3755
- children: "Staff only"
3756
- }) : null,
3757
- /* @__PURE__ */ t("p", {
3758
- className: "core-event-detail__body",
3759
- children: e.body
3760
- }),
3761
- e.author || e.createdAt ? /* @__PURE__ */ t("div", {
3762
- className: "core-event-detail__muted",
3763
- children: [e.author, e.createdAt ? new Date(e.createdAt).toLocaleString(o, { timeZone: s }) : void 0].filter(Boolean).join(" · ")
3764
- }) : null
3765
- ]
3766
- }, r))]
3767
- }) : null
3768
- ]
3769
- });
3770
- }
3771
- //#endregion
3772
- //#region src/core/events/EventLogForm/EventLogForm.tsx
3773
- var vr = (e) => {
3774
- let t = e?.dataSchema?.properties ?? {}, n = new Set(e?.dataSchema?.required ?? []);
3775
- return Object.entries(t).map(([e, t]) => [
3776
- e,
3777
- t,
3778
- n.has(e)
3779
- ]);
3780
- };
3781
- function yr(e) {
3782
- let { orgId: r, projectId: i, actions: a, onDone: o, canWriteStaffNotes: s, className: c, style: u } = e, f = Array.isArray(e.types) ? e.types : [], p = l(), [h, g] = m(e.defaultTypeId ?? f[0]?.id ?? ""), v = f.find((e) => e.id === h), y = v?.kind === "scheduled", [b, x] = m(""), [S, C] = m(lr()), [w, T] = m(""), [E, D] = m(""), [O, k] = m({}), [A, j] = m(""), [M, N] = m(!!s), [P, F] = m(!1), [I, L] = m(""), R = d(() => vr(v), [v]);
3783
- if (!f.length) return /* @__PURE__ */ t("p", {
3784
- className: _("core-event-log", "core-event-log__empty", c),
3785
- style: u,
3786
- children: "There's nothing you can log here."
3787
- });
3788
- let z = async (t) => {
3789
- if (t.preventDefault(), !a?.logEvent || P || !v) return;
3790
- F(!0), L("");
3791
- let n = cr(S), c = {
3792
- event_type_id: v.id,
3793
- org_id: r,
3794
- name: b.trim() || v.name,
3795
- starts_at: n,
3796
- tzid: sr(),
3797
- data: O,
3798
- subjects: e.subjects ? [...e.subjects] : []
3799
- };
3800
- i && (c.project_id = i), y && w && (c.ends_at = cr(w)), E.trim() && (c.location = E.trim());
3801
- let l = A.trim() ? [{
3802
- body: A.trim(),
3803
- audience: s && M ? "staff" : "shared"
3804
- }] : void 0, u = await a.logEvent(l ? {
3805
- event: c,
3806
- notes: l
3807
- } : { event: c });
3808
- F(!1), u.success ? (x(""), j(""), k({}), o?.(u)) : L(ur(u));
3809
- }, B = (e, t) => k((n) => ({
3810
- ...n,
3811
- [e]: t
3812
- }));
3813
- return /* @__PURE__ */ n("form", {
3814
- className: _("core-event-log", c),
3815
- style: u,
3816
- onSubmit: (e) => void z(e),
3817
- children: [
3818
- /* @__PURE__ */ n("label", {
3819
- className: "core-event-log__field",
3820
- children: [/* @__PURE__ */ t("span", {
3821
- className: "core-event-log__label",
3822
- children: "Type"
3823
- }), /* @__PURE__ */ t("select", {
3824
- value: h,
3825
- onChange: (e) => {
3826
- g(e.target.value), k({});
3827
- },
3828
- children: f.map((e) => /* @__PURE__ */ t("option", {
3829
- value: e.id,
3830
- children: e.name
3831
- }, e.id))
3832
- })]
3833
- }),
3834
- /* @__PURE__ */ n("label", {
3835
- className: "core-event-log__field",
3836
- children: [/* @__PURE__ */ t("span", {
3837
- className: "core-event-log__label",
3838
- children: "Title"
3839
- }), /* @__PURE__ */ t("input", {
3840
- value: b,
3841
- onChange: (e) => x(e.target.value),
3842
- placeholder: v?.name
3843
- })]
3844
- }),
3845
- /* @__PURE__ */ n("div", {
3846
- className: "core-event-log__row",
3847
- children: [/* @__PURE__ */ n("label", {
3848
- className: "core-event-log__field",
3849
- children: [/* @__PURE__ */ t("span", {
3850
- className: "core-event-log__label",
3851
- children: y ? "Starts" : "When"
3852
- }), /* @__PURE__ */ t("input", {
3853
- type: "datetime-local",
3854
- required: !0,
3855
- value: S,
3856
- onChange: (e) => C(e.target.value)
3857
- })]
3858
- }), y ? /* @__PURE__ */ n("label", {
3859
- className: "core-event-log__field",
3860
- children: [/* @__PURE__ */ t("span", {
3861
- className: "core-event-log__label",
3862
- children: "Ends"
3863
- }), /* @__PURE__ */ t("input", {
3864
- type: "datetime-local",
3865
- value: w,
3866
- min: S,
3867
- onChange: (e) => T(e.target.value)
3868
- })]
3869
- }) : null]
3870
- }),
3871
- /* @__PURE__ */ n("label", {
3872
- className: "core-event-log__field",
3873
- children: [/* @__PURE__ */ t("span", {
3874
- className: "core-event-log__label",
3875
- children: "Where"
3876
- }), /* @__PURE__ */ t("input", {
3877
- value: E,
3878
- onChange: (e) => D(e.target.value)
3879
- })]
3880
- }),
3881
- R.map(([e, r, i]) => {
3882
- let a = r.title ?? e;
3883
- if (r.enum) return /* @__PURE__ */ n("label", {
3884
- className: "core-event-log__field",
3885
- children: [/* @__PURE__ */ t("span", {
3886
- className: "core-event-log__label",
3887
- children: a
3888
- }), /* @__PURE__ */ n("select", {
3889
- required: i,
3890
- value: String(O[e] ?? ""),
3891
- onChange: (t) => B(e, t.target.value || void 0),
3892
- children: [/* @__PURE__ */ t("option", {
3893
- value: "",
3894
- children: "—"
3895
- }), r.enum.map((e) => /* @__PURE__ */ t("option", {
3896
- value: e,
3897
- children: e
3898
- }, e))]
3899
- })]
3900
- }, e);
3901
- if (r.type === "boolean") return /* @__PURE__ */ n("label", {
3902
- className: "core-event-log__check",
3903
- children: [/* @__PURE__ */ t("input", {
3904
- type: "checkbox",
3905
- checked: !!O[e],
3906
- onChange: (t) => B(e, t.target.checked)
3907
- }), /* @__PURE__ */ t("span", { children: a })]
3908
- }, e);
3909
- let o = r.type === "number" || r.type === "integer";
3910
- return /* @__PURE__ */ n("label", {
3911
- className: "core-event-log__field",
3912
- children: [/* @__PURE__ */ t("span", {
3913
- className: "core-event-log__label",
3914
- children: a
3915
- }), /* @__PURE__ */ t("input", {
3916
- type: o ? "number" : "text",
3917
- step: r.type === "integer" ? 1 : "any",
3918
- required: i,
3919
- value: O[e] === void 0 ? "" : String(O[e]),
3920
- onChange: (t) => B(e, t.target.value === "" ? void 0 : o ? Number(t.target.value) : t.target.value)
3921
- })]
3922
- }, e);
3923
- }),
3924
- /* @__PURE__ */ n("label", {
3925
- className: "core-event-log__field",
3926
- children: [/* @__PURE__ */ t("span", {
3927
- className: "core-event-log__label",
3928
- children: "Note"
3929
- }), /* @__PURE__ */ t("textarea", {
3930
- rows: 3,
3931
- value: A,
3932
- onChange: (e) => j(e.target.value)
3933
- })]
3934
- }),
3935
- s && A.trim() ? /* @__PURE__ */ n("label", {
3936
- className: "core-event-log__check",
3937
- children: [/* @__PURE__ */ t("input", {
3938
- type: "checkbox",
3939
- checked: M,
3940
- onChange: (e) => N(e.target.checked)
3941
- }), /* @__PURE__ */ t("span", { children: "Staff only: the client won't see this note" })]
3942
- }) : null,
3943
- I ? /* @__PURE__ */ t("p", {
3944
- id: `${p}-error`,
3945
- className: "core-event-log__message",
3946
- role: "alert",
3947
- children: I
3948
- }) : null,
3949
- /* @__PURE__ */ t("div", {
3950
- className: "core-event-log__actions",
3951
- children: /* @__PURE__ */ t("button", {
3952
- type: "submit",
3953
- className: "core-event-log__submit",
3954
- disabled: P || !a?.logEvent,
3955
- children: P ? "Saving…" : y ? "Schedule" : "Log"
3956
- })
3957
- })
3958
- ]
3959
- });
3960
- }
3961
- //#endregion
3962
- //#region src/core/events/EventSchedule/EventSchedule.tsx
3963
- var br = (e, t) => new Intl.DateTimeFormat(t, {
3964
- weekday: "short",
3965
- month: "short",
3966
- day: "numeric",
3967
- timeZone: "UTC"
3968
- }).format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`));
3969
- function xr(e) {
3970
- let { view: r = "week", weekParam: i = "week", eventHref: a = "?panel=event:{id}", locale: o, timeZone: s, renderComponent: c, className: l, style: u } = e, d = Array.isArray(e.occurrences) ? e.occurrences : [], f = dr(/* @__PURE__ */ new Date(), s), p = fr(/^\d{4}-\d{2}-\d{2}$/.test(e.weekOf ?? "") ? e.weekOf : f), m = Array.from({ length: 7 }, (e, t) => Q(p, t)), h = new Map(m.map((e) => [e, []]));
3971
- for (let e of d) for (let t of pr(e, s)) h.get(t)?.push(e);
3972
- for (let e of h.values()) e.sort((e, t) => +!e.startOn - !t.startOn || (e.startsAt ?? "").localeCompare(t.startsAt ?? ""));
3973
- let g = r === "agenda" ? m.filter((e) => h.get(e).length) : m;
3974
- return /* @__PURE__ */ n("section", {
3975
- className: _("core-event-schedule", l),
3976
- "data-view": r,
3977
- style: u,
3978
- "aria-label": "Schedule",
3979
- children: [
3980
- /* @__PURE__ */ n("div", {
3981
- className: "core-event-schedule__nav",
3982
- children: [
3983
- /* @__PURE__ */ t("a", {
3984
- className: "core-event-schedule__step",
3985
- href: `?${i}=${Q(p, -7)}`,
3986
- "aria-label": "Previous week",
3987
- children: "‹"
3988
- }),
3989
- /* @__PURE__ */ t("span", {
3990
- className: "core-event-schedule__range",
3991
- children: `${br(m[0], o)} – ${br(m[6], o)}`
3992
- }),
3993
- /* @__PURE__ */ t("a", {
3994
- className: "core-event-schedule__step",
3995
- href: `?${i}=${Q(p, 7)}`,
3996
- "aria-label": "Next week",
3997
- children: "›"
3998
- })
3999
- ]
4000
- }),
4001
- g.length === 0 ? /* @__PURE__ */ t("p", {
4002
- className: "core-event-schedule__empty",
4003
- children: "Nothing scheduled this week."
4004
- }) : null,
4005
- /* @__PURE__ */ t("ol", {
4006
- className: "core-event-schedule__days",
4007
- children: g.map((e) => {
4008
- let r = h.get(e);
4009
- return /* @__PURE__ */ n("li", {
4010
- className: "core-event-schedule__day",
4011
- "data-today": e === f || void 0,
4012
- children: [/* @__PURE__ */ t("h3", {
4013
- className: "core-event-schedule__date",
4014
- children: br(e, o)
4015
- }), r.length ? /* @__PURE__ */ t("ul", {
4016
- className: "core-event-schedule__events",
4017
- children: r.map((e, n) => /* @__PURE__ */ t("li", { children: nr(e, c, {
4018
- href: $(a, e.id),
4019
- locale: o,
4020
- timeZone: s
4021
- }) ?? /* @__PURE__ */ t(mr, {
4022
- event: e,
4023
- href: $(a, e.id),
4024
- locale: o,
4025
- timeZone: s
4026
- }) }, `${e.id ?? n}-${e.startsAt ?? e.startOn ?? n}`))
4027
- }) : /* @__PURE__ */ t("p", {
4028
- className: "core-event-schedule__none",
4029
- children: "—"
4030
- })]
4031
- }, e);
4032
- })
4033
- })
4034
- ]
4035
- });
4036
- }
4037
- //#endregion
4038
- //#region src/core/events/EventTimeline/EventTimeline.tsx
4039
- var Sr = (e, t) => new Intl.DateTimeFormat(t, {
4040
- weekday: "long",
4041
- month: "long",
4042
- day: "numeric",
4043
- year: "numeric",
4044
- timeZone: "UTC"
4045
- }).format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`));
4046
- function Cr(e) {
4047
- let { eventHref: r = "?panel=event:{id}", emptyText: i = "No activity yet.", locale: a, timeZone: o, renderComponent: s, className: c, style: l } = e, u = [...(Array.isArray(e.items) ? e.items : []).filter((e) => e && !Number.isNaN(new Date(e.at).getTime()))].sort((e, t) => new Date(t.at).getTime() - new Date(e.at).getTime()), d = [];
4048
- for (let e of u) {
4049
- let t = dr(e.at, o), n = d[d.length - 1];
4050
- n && n[0] === t ? n[1].push(e) : d.push([t, [e]]);
4051
- }
4052
- let f = new Intl.DateTimeFormat(a, {
4053
- hour: "numeric",
4054
- minute: "2-digit",
4055
- timeZone: o
4056
- });
4057
- return /* @__PURE__ */ n("section", {
4058
- className: _("core-event-timeline", c),
4059
- style: l,
4060
- "aria-label": "Activity",
4061
- children: [d.length === 0 ? /* @__PURE__ */ t("p", {
4062
- className: "core-event-timeline__empty",
4063
- children: i
4064
- }) : null, d.map(([e, i]) => /* @__PURE__ */ n("section", {
4065
- className: "core-event-timeline__day",
4066
- children: [/* @__PURE__ */ t("h3", {
4067
- className: "core-event-timeline__date",
4068
- children: Sr(e, a)
4069
- }), /* @__PURE__ */ t("ol", {
4070
- className: "core-event-timeline__items",
4071
- children: i.map((e, i) => /* @__PURE__ */ n("li", {
4072
- className: "core-event-timeline__item",
4073
- "data-op": e.op || void 0,
4074
- children: [/* @__PURE__ */ n("div", {
4075
- className: "core-event-timeline__line",
4076
- children: [
4077
- /* @__PURE__ */ t("time", {
4078
- className: "core-event-timeline__time",
4079
- dateTime: e.at,
4080
- children: f.format(new Date(e.at))
4081
- }),
4082
- e.summary ? /* @__PURE__ */ t("span", {
4083
- className: "core-event-timeline__summary",
4084
- children: e.summary
4085
- }) : null,
4086
- e.actor ? /* @__PURE__ */ t("span", {
4087
- className: "core-event-timeline__actor",
4088
- children: e.actor
4089
- }) : null
4090
- ]
4091
- }), e.event ? nr(e.event, s, {
4092
- href: $(r, e.event.id),
4093
- locale: a,
4094
- timeZone: o
4095
- }) ?? /* @__PURE__ */ t(mr, {
4096
- event: e.event,
4097
- href: $(r, e.event.id),
4098
- locale: a,
4099
- timeZone: o
4100
- }) : null]
4101
- }, e.id ?? `${e.at}-${i}`))
4102
- })]
4103
- }, e))]
4104
- });
4105
- }
4106
- //#endregion
4107
- export { Ut as ANSWER_COLUMN_PX, Pe as Accordion, Wt as AnswerRows, _t as Aside, re as Avatar, ct as BLOCK_KINDS, xn as BLOCK_SCHEMAS, Se as Badge, b as Box, ke as Button, Fe as Card, x as Center, le as Checkbox, ue as CheckboxGroup, Ae as Chip, ie as Code, Le as Columns, Jt as ComparisonBars, S as Container, mn as Contents, Qe as DEFAULT_PROFILE_ID, tr as DataTable, de as DateRange, bt as Definition, Nn as DisclaimerBlock, ze as Disclosure, C as Divider, vn as DocumentBlocks, Pt as DocumentLabel, bn as DocumentSection, fn as DocumentShell, Vt as DocumentTable, mr as EventCard, _r as EventDetail, yr as EventLogForm, gr as EventRespond, xr as EventSchedule, Cr as EventTimeline, gn as ExecutionBlock, R as Eyebrow, Mt as Figure, pe as FileField, jt as Footnote, H as FormField, Be as Grid, oe as Heading, w as Hide, Mn as HighlightBox, je as IconButton, T as Inline, Kn as KpiCardGrid, Me as Link, sn as Masthead, Et as Math, ln as MetaRail, Zt as NextSteps, $t as Notes, we as Notice, Vn as OptionCard, He as PAGINATOR_BINDINGS, Nt as PageBreak, k as PageFrame, Hn as ProfileCard, Te as Progress, vt as Prose, yt as Quote, me as RadioGroup, Bt as Reference, Ve as Repeat, Ht as RowList, z as RuleSection, dn as RunningFooter, _e as SearchField, jn as SectionHeader, Ne as SegmentedControl, ve as Select, E as Show, Ee as Skeleton, tn as SkippedSection, ye as Slider, D as Spacer, De as Spinner, Re as Split, O as Stack, Dn as Stat, On as StatGroup, Fn as StatStrip, be as Switch, M as TONES, rn as TalkItThrough, ce as Text, xe as TextArea, ge as TextField, Oe as Tooltip, te as UnderlinedAction, an as WRITE_HEIGHT_PX, Qt as WRITE_LINE_HEIGHT_PX, on as WriteInField, _ as cx, Ze as documentProfiles, or as eventWhen, fe as fileSize, Kt as formatValue, ne as initialsOf, I as inkToneOf, v as length, st as profileCss, Je as profileIds, at as profileTokens, qe as registerProfile, X as renderFormatted, Ye as resolveProfile, Xe as resolvedProfiles, he as toNumber, P as toneOf, nr as typeCard, y as vars };
4108
-
4109
- //# sourceMappingURL=index.js.map
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{Children as r,createContext as i,isValidElement as a,useCallback as o,useContext as s,useEffect as c,useId as l,useLayoutEffect as u,useMemo as d,useReducer as f,useRef as p,useState as m}from"react";var h=new Set(["baseProps","data","status","actions","_traversal","isLoading","error","navigate","onNavigate","size","store"]);function g(e2){let t2={};for(let n2 in e2)h.has(n2)||(t2[n2]=e2[n2]);return t2}var _=(...e2)=>e2.filter(Boolean).join(" ")||void 0,v=e2=>e2===void 0?void 0:typeof e2=="number"?`${e2}px`:e2;function y(e2,t2){let n2=Object.fromEntries(Object.entries(e2).filter(([,e3])=>e3!==void 0));return Object.keys(n2).length||t2?{...n2,...t2}:void 0}function b({as:e2,className:n2,children:r2,...i2}){return t(e2??"div",{className:_("core-box",n2),...g(i2),children:r2})}function x({minHeight:e2,className:n2,style:r2,children:i2,...a2}){return t(b,{...a2,className:_("core-center",n2),style:y({"--core-center-min-height":v(e2)},r2),children:i2})}function S({name:e2,className:n2,style:r2,children:i2,...a2}){return t(b,{...a2,className:_("core-container",n2),style:y({"--core-container-name":e2},r2),children:i2})}function C({orientation:e2="horizontal",weight:n2="subtle",spacing:r2,className:i2,style:a2,ref:o2,...s2}){let c2={className:_("core-divider",i2),"data-weight":n2,"data-orientation":e2,style:y({"--core-divider-spacing":v(r2)},a2)};return e2==="vertical"?t("span",{role:"separator","aria-orientation":"vertical",...c2}):t("hr",{ref:o2,...g(s2),...c2})}function w({when:e2,children:n2,as:r2="span"}){return t(r2,{className:"core-hide","data-when":e2,children:n2})}function T({gap:e2,align:n2="center",justify:r2="start",wrap:i2=true,stackWhen:a2,className:o2,style:s2,children:c2,...l2}){return t(b,{...l2,className:_("core-inline",o2),"data-align":n2,"data-justify":r2,"data-wrap":i2?"true":"false","data-stack-when":a2,style:y({"--core-inline-gap":v(e2)},s2),children:c2})}function E({when:e2,children:n2,as:r2="span"}){return t(r2,{className:"core-show","data-when":e2,children:n2})}function D({size:e2,className:n2,style:r2}){return t("span",{"aria-hidden":true,className:_("core-spacer",n2),style:y({"--core-spacer-size":v(e2)},r2)})}function O({gap:e2,align:n2="stretch",justify:r2="start",className:i2,style:a2,children:o2,...s2}){return t(b,{...s2,className:_("core-stack",i2),"data-align":n2,"data-justify":r2,style:y({"--core-stack-gap":v(e2)},a2),children:o2})}var k=e2=>e2.startsWith("/")&&!e2.startsWith("//")&&!e2.includes("\\"),A=e2=>/^#[A-Za-z][\w:.-]*$/.test(e2);function j({href:e2,action:t2,input:n2,actions:r2,navigate:i2,onClick:a2}){let[o2,s2]=m(false),c2=r2&&t2?r2[t2]:void 0;return{busy:o2,onClick:t3=>{if(a2)return a2(t3);if(c2){t3.preventDefault(),s2(true),c2(n2).finally(()=>s2(false));return}e2&&i2&&k(e2)&&t3.button===0&&!t3.metaKey&&!t3.ctrlKey&&!t3.shiftKey&&!t3.altKey&&(t3.preventDefault(),i2(e2))},external:!!e2&&!k(e2)&&!A(e2)}}function M({title:e2,meta:r2,leading:i2,value:a2,trailing:o2,href:s2,navigate:c2,onClick:l2,as:u2="div",className:d2,...f2}){let p2=j({href:s2,navigate:c2,onClick:l2}),m2=u2,h2=s2?t("a",{className:"core-list-row__title core-list-row__link",href:s2,onClick:p2.onClick,...p2.external?{target:"_blank",rel:"noopener noreferrer"}:{},children:e2}):t("span",{className:"core-list-row__title",children:e2});return n(m2,{...g(f2),className:_("core-list-row",d2),children:[i2!=null&&t("div",{className:"core-list-row__leading",children:i2}),n("div",{className:"core-list-row__main",children:[h2,r2!=null&&t("span",{className:"core-list-row__meta",children:r2})]}),a2!=null&&t("div",{className:"core-list-row__value",children:a2}),o2!=null&&t("div",{className:"core-list-row__trailing",children:o2})]})}function N({header:e2,children:r2,measure:i2="page",className:a2,...o2}){return t("div",{...g(o2),className:_("core-page-frame",a2),"data-measure":i2,children:n("div",{className:"core-page-frame__column",children:[e2!=null&&t("header",{className:"core-page-frame__header",children:e2}),r2]})})}var P=new Set;function F(e2,t2){P.has(e2)||(P.add(e2),typeof console<"u"&&console.warn(t2))}var I=["neutral","strong","accent","info","success","warning","danger"],L=()=>typeof process>"u"||false;function R(e2,t2="neutral"){return typeof e2=="string"&&I.includes(e2)?e2:(typeof e2=="string"&&e2&&L()&&F(`unknown-tone:${e2}`,`[core] "${e2}" is not a tone (${I.join(", ")}); using "${t2}".`),t2)}var z=["subtle","on-dark","inherit"];function B(e2,t2){return typeof e2=="string"&&(z.includes(e2)||I.includes(e2))?e2:t2}function ee(e2){return{"data-tone":e2,toned:!z.includes(e2)}}function V({children:e2,as:n2="span",tone:r2,tabular:i2=false,className:a2,style:o2}){let{toned:s2,...c2}=ee(B(r2,"subtle"));return t(n2,{className:_("core-eyebrow",s2&&"core-toned",a2),...c2,"data-tabular":i2?"true":void 0,style:o2,children:e2})}function te({title:e2,eyebrow:r2,intro:i2,actions:a2,className:o2,...s2}){return n("header",{...g(s2),className:_("core-page-head",o2),children:[r2&&t(V,{as:"p",children:r2}),n("div",{className:"core-page-head__row",children:[t("h1",{className:"core-page-head__title",children:e2}),a2!=null&&t("div",{className:"core-page-head__actions",children:a2})]}),i2!=null&&t("p",{className:"core-page-head__intro",children:i2})]})}function ne({label:e2,actions:r2,children:i2,rail:a2=false,anchor:o2,className:s2,...c2}){return t("section",{...g(c2),id:o2,"aria-label":e2,className:_("core-rule-section",s2),"data-rail":a2||void 0,children:n("div",{className:"core-rule-section__grid",children:[n("div",{className:"core-rule-section__head",children:[e2&&t(V,{as:"p",children:e2}),r2!=null&&t("div",{className:"core-rule-section__actions",children:r2})]}),t("div",{className:"core-rule-section__body",children:i2})]})})}function re({label:r2,children:i2,arrow:a2=true,className:o2,href:s2,action:c2,input:l2,actions:u2,navigate:d2,onClick:f2,...p2}){let m2=j({href:s2,action:c2,input:l2,actions:u2,navigate:d2,onClick:f2}),h2=n(e,{children:[t("span",{className:"core-underlined-action__label",children:i2??r2}),a2&&t("svg",{className:"core-underlined-action__arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:t("path",{d:"M5 12h14M13 6l6 6-6 6"})})]}),v2={...g(p2),className:_("core-underlined-action",o2)};return s2?t("a",{...v2,href:s2,onClick:m2.onClick,...m2.external?{target:"_blank",rel:"noopener noreferrer"}:{},children:h2}):t("button",{...v2,type:"button",onClick:m2.onClick,disabled:m2.busy,children:h2})}var ie=(e2="")=>e2.trim().split(/\s+/).filter(Boolean).map(e3=>e3[0].toUpperCase()).filter((e3,t2,n2)=>t2===0||t2===n2.length-1).join("").slice(0,2);function ae({name:e2,initials:n2,src:r2,alt:i2,size:a2="md",className:o2,...s2}){let[c2,l2]=m(false),u2=i2??e2??"";return t("span",{...g(s2),className:_("core-avatar",o2),"data-size":a2,role:"img","aria-label":u2||void 0,children:r2&&!c2?t("img",{src:r2,alt:"",onError:()=>l2(true)}):t("span",{"aria-hidden":"true",children:n2??ie(e2)})})}function oe({code:e2,children:n2,block:r2=false,className:i2,...a2}){let o2=n2??e2;return r2?t("pre",{...g(a2),className:_("core-code",i2),"data-block":"",children:t("code",{children:o2})}):t("code",{...g(a2),className:_("core-code",i2),children:o2})}var se={1:"lg",2:"md",3:"sm",4:"xs",5:"xs",6:"xs"};function ce({text:e2,children:n2,level:r2=2,size:i2,anchor:a2,className:o2,...s2}){let c2=Math.min(6,Math.max(1,Math.round(r2))),l2=`h${c2}`;return t(l2,{...g(s2),id:a2,className:_("core-heading",o2),"data-size":i2??se[c2],children:n2??e2})}var le={xs:"eyebrow",sm:"body-sm",md:"body",lg:"title-sm",xl:"title-md"};function ue({text:e2,children:n2,as:r2="span",size:i2="md",weight:a2="normal",tone:o2="default",align:s2="start",truncate:c2=false,lines:l2,className:u2,...d2}){let f2=r2,p2=l2&&l2>0?Math.min(6,Math.round(l2)):void 0;return t(f2,{...g(d2),className:_("core-text",u2),"data-role":le[i2]??"body","data-weight":a2,"data-tone":o2,"data-align":s2,"data-truncate":c2||void 0,"data-lines":p2,children:n2??e2})}function H({label:e2,hint:r2,error:i2,required:a2,htmlFor:o2,hintId:s2,errorId:c2,as:u2="div",children:d2,className:f2,style:p2}){let m2=l().replace(/:/g,""),h2=s2??(r2?`${o2??m2}-hint`:void 0),g2=c2??(i2?`${o2??m2}-error`:void 0),v2=u2,y2=u2==="fieldset"?"legend":"label";return n(v2,{className:_("core-field",f2),style:p2,"data-invalid":i2?"":void 0,children:[e2&&n(y2,{className:"core-field__label",...y2==="label"&&o2?{htmlFor:o2}:{},children:[e2,a2&&n("span",{className:"core-field__required","aria-hidden":"true",children:[" ","*"]})]}),r2&&t("p",{className:"core-field__hint",id:h2,children:r2}),d2,i2&&t("p",{className:"core-field__error",id:g2,children:i2})]})}function U(e2,t2,n2){let r2=l(),i2=e2??`f${r2.replace(/:/g,"")}`,a2=t2?`${i2}-hint`:void 0,o2=n2?`${i2}-error`:void 0;return{control:i2,hintId:a2,errorId:o2,aria:{"aria-describedby":[a2,o2].filter(Boolean).join(" ")||void 0,"aria-invalid":n2?true:void 0}}}function W(e2,t2){return n2=>{e2?.(n2),t2?.(n2)}}function de({value:e2,defaultValue:r2,onChange:i2,setValue:a2,id:o2,name:s2,label:c2,children:l2,hint:u2,error:d2,required:f2,disabled:p2,readOnly:h2,className:g2,style:v2,ref:y2}){let b2=U(o2,u2,d2),[x2,S2]=m(r2??false),C2=e2??x2,w2=W(i2,a2);return t(H,{className:_("core-checkbox",g2),style:v2,hint:u2,error:d2,hintId:b2.hintId,errorId:b2.errorId,children:n("label",{className:"core-choices__option","data-disabled":p2?"":void 0,children:[t("input",{ref:y2,id:b2.control,type:"checkbox",name:s2,checked:C2,required:f2,"aria-required":f2||void 0,disabled:p2,"aria-readonly":h2||void 0,onChange:t2=>{h2||(e2===void 0&&S2(t2.target.checked),w2(t2.target.checked))},...b2.aria}),n("span",{children:[l2??c2,f2&&t("span",{className:"core-field__required","aria-hidden":"true",children:" *"})]})]})})}function fe({options:e2,value:r2,defaultValue:i2,onChange:a2,setValue:o2,id:s2,name:c2,label:l2,hint:u2,error:d2,required:f2,disabled:p2,readOnly:h2,orientation:g2="vertical",min:v2,max:y2,className:b2,style:x2,ref:S2}){let C2=[v2===void 0?"":`at least ${v2}`,y2===void 0?"":`at most ${y2}`].filter(Boolean).join(", "),w2=[u2,C2?`Choose ${C2}.`:""].filter(Boolean).join(" ")||void 0,T2=U(s2,w2,d2),[E2,D2]=m(i2??[]),O2=r2??E2,k2=W(a2,o2),A2=y2!==void 0&&O2.length>=y2;return t(H,{as:"fieldset",className:_("core-choices",b2),style:x2,label:l2,hint:w2,error:d2,required:f2,hintId:T2.hintId,errorId:T2.errorId,children:t("div",{className:"core-choices__list","data-orientation":g2,role:"group",...T2.aria,children:e2.map((i3,a3)=>{let o3=O2.includes(i3.value);return n("label",{className:"core-choices__option","data-disabled":i3.disabled||p2?"":void 0,children:[t("input",{ref:a3===0?S2:void 0,id:a3===0?T2.control:void 0,type:"checkbox",name:c2,value:i3.value,checked:o3,disabled:i3.disabled||p2||!o3&&A2||h2&&!o3,"aria-readonly":h2||void 0,onChange:()=>{if(h2)return;let t2=e2.map(e3=>e3.value).filter(e3=>e3===i3.value?!o3:O2.includes(e3));r2===void 0&&D2(t2),k2(t2)}}),t("span",{children:i3.label})]},i3.value)})})})}function pe({value:e2,defaultValue:r2,onChange:i2,setValue:a2,id:o2,name:s2,label:c2,hint:l2,error:u2,required:d2,disabled:f2,readOnly:p2,min:h2,max:g2,fromLabel:v2="From",toLabel:y2="To",className:b2,style:x2,ref:S2}){let C2=U(o2,l2,u2),[w2,T2]=m(r2??{from:null,to:null}),E2=e2??w2,D2=W(i2,a2),O2=(t2,n2)=>{if(p2)return;let r3={...E2,[t2]:n2===""?null:n2};e2===void 0&&T2(r3),D2(r3)},k2={disabled:f2,readOnly:p2,required:d2,"aria-required":d2||void 0,className:"core-input",...C2.aria};return t(H,{as:"fieldset",className:_("core-date-range",b2),style:x2,label:c2,hint:l2,error:u2,required:d2,hintId:C2.hintId,errorId:C2.errorId,children:n("div",{className:"core-date-range__row",children:[n("label",{className:"core-date-range__part",children:[t("span",{className:"core-date-range__label",children:v2}),t("input",{ref:S2,id:C2.control,type:"date",name:s2?`${s2}.from`:void 0,value:E2.from??"",min:h2,max:E2.to??g2,onChange:e3=>O2("from",e3.target.value),...k2})]}),n("label",{className:"core-date-range__part",children:[t("span",{className:"core-date-range__label",children:y2}),t("input",{type:"date",name:s2?`${s2}.to`:void 0,value:E2.to??"",min:E2.from??h2,max:g2,onChange:e3=>O2("to",e3.target.value),...k2})]})]})})}function me(e2){return!Number.isFinite(e2)||e2<0?"":e2<1024?`${e2} B`:e2<1048576?`${(e2/1024).toFixed(+(e2<10240))} KB`:`${(e2/1048576).toFixed(1)} MB`}function he({value:r2,defaultValue:i2,onChange:a2,setValue:o2,id:s2,name:c2,label:l2,hint:u2,error:d2,required:f2,disabled:h2,readOnly:g2,upload:v2,accept:y2,hash:b2=false,className:x2,style:S2,ref:C2}){let w2=U(s2,u2,d2),[T2,E2]=m(i2??null),D2=r2===void 0?T2:r2,O2=W(a2,o2),[k2,A2]=m({busy:false,dragging:false}),j2=p(null),M2=e2=>{r2===void 0&&E2(e2),O2(e2)},N2=async e2=>{if(e2&&v2&&!g2&&!h2){A2({busy:true,dragging:false});try{let t2=await v2(e2,{hash:b2});"error"in t2?A2({busy:false,failed:t2.error,dragging:false}):(A2({busy:false,dragging:false}),M2(t2))}catch{A2({busy:false,failed:"That file couldn’t be stored. Try again.",dragging:false})}}},P2=e2=>{e2.preventDefault(),N2(e2.dataTransfer.files?.[0])},F2=d2??k2.failed;return t(H,{className:_("core-file-field",x2),style:S2,label:l2,hint:u2,error:F2,required:f2,htmlFor:w2.control,hintId:w2.hintId,errorId:F2?`${w2.control}-error`:void 0,children:n("div",{className:"core-file-field__box","data-dragging":k2.dragging?"":void 0,"data-busy":k2.busy?"":void 0,onDragOver:e2=>{g2||h2||!v2||(e2.preventDefault(),k2.dragging||A2(e3=>({...e3,dragging:true})))},onDragLeave:()=>A2(e2=>({...e2,dragging:false})),onDrop:P2,children:[D2?n("div",{className:"core-file-field__file",children:[t("span",{className:"core-file-field__name",children:D2.file.name}),t("span",{className:"core-file-field__size",children:me(D2.file.size)}),!g2&&!h2&&t("button",{type:"button",className:"core-file-field__button",onClick:()=>M2(null),"aria-label":`Remove ${D2.file.name}`,children:"Remove"})]}):k2.busy?t("span",{className:"core-file-field__status",role:"status",children:"Uploading…"}):n(e,{children:[t("button",{ref:C2,id:w2.control,type:"button",className:"core-file-field__button",disabled:h2||g2||!v2,"aria-required":f2||void 0,"aria-describedby":[w2.hintId,F2?`${w2.control}-error`:void 0].filter(Boolean).join(" ")||void 0,"aria-invalid":F2?true:void 0,onClick:()=>j2.current?.click(),children:"Choose file"}),t("span",{className:"core-file-field__drop",children:"or drop it here"})]}),t("input",{ref:j2,type:"file",name:c2,accept:y2,hidden:true,tabIndex:-1,onChange:e2=>void N2(e2.target.files?.[0])})]})})}function ge({options:e2,value:r2,defaultValue:i2,onChange:a2,setValue:o2,id:s2,name:c2,label:l2,hint:u2,error:d2,required:f2,disabled:p2,readOnly:h2,orientation:g2="vertical",className:v2,style:y2,ref:b2}){let x2=U(s2,u2,d2),[S2,C2]=m(i2??null),w2=r2===void 0?S2:r2,T2=W(a2,o2),E2=c2??x2.control;return t(H,{as:"fieldset",className:_("core-choices",v2),style:y2,label:l2,hint:u2,error:d2,required:f2,hintId:x2.hintId,errorId:x2.errorId,children:t("div",{className:"core-choices__list","data-orientation":g2,role:"radiogroup","aria-required":f2||void 0,...x2.aria,children:e2.map((e3,i3)=>n("label",{className:"core-choices__option","data-disabled":e3.disabled||p2?"":void 0,children:[t("input",{ref:i3===0?b2:void 0,id:i3===0?x2.control:void 0,type:"radio",name:E2,value:e3.value,checked:w2===e3.value,disabled:e3.disabled||p2||h2&&w2!==e3.value,onChange:()=>{h2||(r2===void 0&&C2(e3.value),T2(e3.value))}}),t("span",{children:e3.label})]},e3.value))})})}var _e=e2=>{if(e2.trim()==="")return null;let t2=Number(e2);return Number.isFinite(t2)?t2:null};function ve({type:e2="text",value:r2,defaultValue:i2,onChange:a2,setValue:o2,id:s2,name:l2,label:u2,hint:d2,error:f2,required:p2,disabled:h2,readOnly:g2,placeholder:v2,inputMode:y2,autoComplete:b2,min:x2,max:S2,step:C2,prefix:w2,suffix:T2,onEnter:E2,onKeyDown:D2,onBlur:O2,className:k2,style:A2,ref:j2}){let M2=U(s2,d2,f2),[N2,P2]=m(i2),F2=r2===void 0?N2:r2,I2=W(a2,o2),L2=e3=>e3==null?"":String(e3),[R2,z2]=m(L2(F2));c(()=>{e2==="number"&&_e(R2)!==(F2??null)&&z2(L2(F2))},[F2]);let B2=t("input",{ref:j2,id:M2.control,name:l2,type:e2==="number"?"text":e2,className:"core-input core-text-field__input",value:e2==="number"?R2:L2(F2),onChange:t2=>{let n2=t2.target.value,i3=e2==="number"?_e(n2):n2;e2==="number"&&z2(n2),r2===void 0&&P2(i3),I2(i3)},onKeyDown:e3=>{D2?.(e3),!e3.defaultPrevented&&E2&&e3.key==="Enter"&&!e3.shiftKey&&!e3.nativeEvent.isComposing&&e3.keyCode!==229&&E2(e3)},onBlur:O2,placeholder:v2,inputMode:y2??(e2==="number"?"decimal":void 0),autoComplete:b2,min:e2==="number"?void 0:x2,max:e2==="number"?void 0:S2,step:e2==="number"?void 0:C2,required:p2,"aria-required":p2||void 0,disabled:h2,readOnly:g2,...M2.aria}),ee2=w2||T2?n("div",{className:"core-text-field__affixed",children:[w2&&t("span",{className:"core-text-field__affix","aria-hidden":"true",children:w2}),B2,T2&&t("span",{className:"core-text-field__affix","aria-hidden":"true",children:T2})]}):B2;return t(H,{className:_("core-text-field",k2),style:A2,label:u2,hint:d2,error:f2,required:p2,htmlFor:M2.control,hintId:M2.hintId,errorId:M2.errorId,children:ee2})}function ye({value:e2,defaultValue:r2,onChange:i2,setValue:a2,label:o2="Search",onSearch:s2,size:c2="md",className:l2,...u2}){let[d2,f2]=m(r2??""),p2=e2??d2,h2=t2=>{e2===void 0&&f2(t2),i2?.(t2),a2?.(t2)};return n("div",{className:_("core-search-field",l2),"data-filled":p2?"":void 0,"data-size":c2,children:[t(ve,{...u2,label:o2,value:p2,onChange:e3=>h2(typeof e3=="string"?e3:""),onEnter:()=>s2?.(p2),inputMode:"search",className:"core-search-field__field"}),n("svg",{className:"core-search-field__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:[t("circle",{cx:"11",cy:"11",r:"6.5"}),t("path",{d:"M16 16l4 4"})]}),p2&&!u2.disabled&&!u2.readOnly&&t("button",{type:"button",className:"core-search-field__clear","aria-label":"Clear search",onClick:()=>h2(""),children:t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:t("path",{d:"M6 6l12 12M18 6L6 18"})})})]})}function be({options:e2,value:r2,defaultValue:i2,onChange:a2,setValue:o2,id:s2,name:c2,label:l2,hint:u2,error:d2,required:f2,disabled:p2,readOnly:h2,placeholder:g2="Choose…",className:v2,style:y2,ref:b2}){let x2=U(s2,u2,d2),[S2,C2]=m(i2??null),w2=r2===void 0?S2:r2,T2=W(a2,o2);return t(H,{className:_("core-select",v2),style:y2,label:l2,hint:u2,error:d2,required:f2,htmlFor:x2.control,hintId:x2.hintId,errorId:x2.errorId,children:n("select",{ref:b2,id:x2.control,name:c2,className:"core-input core-select__input",value:w2??"",onChange:e3=>{let t2=e3.target.value===""?null:e3.target.value;r2===void 0&&C2(t2),T2(t2)},required:f2,"aria-required":f2||void 0,disabled:p2||h2,"aria-readonly":h2||void 0,...x2.aria,children:[t("option",{value:"",children:g2}),e2.map(e3=>t("option",{value:e3.value,disabled:e3.disabled,children:e3.label},e3.value))]})})}function xe({value:e2,defaultValue:r2,onChange:i2,setValue:a2,id:o2,name:s2,label:c2,hint:l2,error:u2,required:d2,disabled:f2,readOnly:p2,min:h2=0,max:g2=100,step:v2=1,format:y2=String,className:b2,style:x2,ref:S2}){let C2=U(o2,l2,u2),[w2,T2]=m(r2??h2),E2=e2??w2,D2=W(i2,a2);return t(H,{className:_("core-slider",b2),style:x2,label:c2,hint:l2,error:u2,required:d2,htmlFor:C2.control,hintId:C2.hintId,errorId:C2.errorId,children:n("div",{className:"core-slider__row",children:[t("input",{ref:S2,id:C2.control,name:s2,type:"range",className:"core-slider__input",min:h2,max:g2,step:v2,value:E2,disabled:f2,"aria-readonly":p2||void 0,"aria-valuetext":y2(E2),onChange:t2=>{if(p2)return;let n2=Number(t2.target.value);e2===void 0&&T2(n2),D2(n2)},...C2.aria}),t("output",{className:"core-slider__value",htmlFor:C2.control,children:y2(E2)})]})})}function Se({value:e2,defaultValue:r2,onChange:i2,setValue:a2,id:o2,name:s2,label:c2,hint:l2,error:u2,disabled:d2,readOnly:f2,className:p2,style:h2,ref:g2}){let v2=U(o2,l2,u2),[y2,b2]=m(r2??false),x2=e2??y2,S2=W(i2,a2);return n("div",{className:_("core-switch",p2),style:h2,children:[n("button",{ref:g2,id:v2.control,name:s2,type:"button",role:"switch","aria-checked":x2,"aria-readonly":f2||void 0,disabled:d2,className:"core-switch__control",onClick:()=>{f2||(e2===void 0&&b2(!x2),S2(!x2))},...v2.aria,children:[t("span",{className:"core-switch__track","aria-hidden":"true",children:t("span",{className:"core-switch__thumb"})}),t("span",{className:"core-switch__label",children:c2})]}),l2&&t("p",{className:"core-field__hint",id:v2.hintId,children:l2}),u2&&t("p",{className:"core-field__error",id:v2.errorId,children:u2})]})}function Ce({value:e2,defaultValue:r2,onChange:i2,setValue:a2,id:o2,name:s2,label:c2,hint:l2,error:d2,required:f2,disabled:h2,readOnly:g2,placeholder:v2,rows:y2=3,autoGrow:b2=true,maxLength:x2,onKeyDown:S2,onBlur:C2,className:w2,style:T2,ref:E2}){let D2=U(o2,l2,d2),[O2,k2]=m(r2??""),A2=e2??O2,j2=W(i2,a2),M2=p(null);return u(()=>{let e3=M2.current;b2&&e3&&(e3.style.height="auto",e3.style.height=`${e3.scrollHeight+2}px`)},[A2,b2]),n(H,{className:_("core-text-area",w2),style:T2,label:c2,hint:l2,error:d2,required:f2,htmlFor:D2.control,hintId:D2.hintId,errorId:D2.errorId,children:[t("textarea",{ref:e3=>{M2.current=e3,typeof E2=="function"?E2(e3):E2&&(E2.current=e3)},id:D2.control,name:s2,className:"core-input core-text-area__input",rows:y2,value:A2,onChange:t2=>{e2===void 0&&k2(t2.target.value),j2(t2.target.value)},onKeyDown:S2,onBlur:C2,placeholder:v2,maxLength:x2,required:f2,"aria-required":f2||void 0,disabled:h2,readOnly:g2,...D2.aria}),x2!==void 0&&n("span",{className:"core-field__hint","aria-live":"polite",children:[A2.length," / ",x2]})]})}function we({label:e2,children:n2,tone:r2,variant:i2="soft",className:a2,...o2}){return t("span",{...g(o2),className:_("core-badge","core-toned",a2),"data-tone":R(r2),"data-variant":i2,children:n2??e2})}function Te({message:e2,title:r2,action:i2,className:a2,...o2}){return n("div",{...g(o2),className:_("core-empty-state",a2),role:"status",children:[r2&&t("p",{className:"core-empty-state__title",children:r2}),t("p",{className:"core-empty-state__message",children:e2}),i2!=null&&t("div",{className:"core-empty-state__action",children:i2})]})}var Ee={info:"M12 16v-5M12 8h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z",success:"M8 12.5l2.5 2.5L16 9.5M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z",warning:"M12 9v4M12 17h.01M10.3 3.9L2.2 18a2 2 0 0 0 1.7 3h16.2a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z",danger:"M12 8v5M12 16h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z"};function De({title:e2,message:r2,children:i2,tone:a2,action:o2,onDismiss:s2,className:c2,...l2}){let u2=R(a2,"info"),d2=u2==="warning"||u2==="danger";return n("div",{...g(l2),role:d2?"alert":"status",className:_("core-notice","core-toned",c2),"data-tone":u2,children:[t("svg",{className:"core-notice__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:t("path",{d:Ee[u2]??Ee.info})}),n("div",{className:"core-notice__body",children:[e2&&t("p",{className:"core-notice__title",children:e2}),t("div",{className:"core-notice__message",children:i2??r2})]}),o2&&t("div",{className:"core-notice__action",children:o2}),s2&&t("button",{type:"button",className:"core-notice__dismiss","aria-label":"Dismiss",onClick:s2,children:t("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":"true",focusable:"false",children:t("path",{d:"M6 6l12 12M18 6L6 18"})})})]})}function Oe({value:e2,max:r2=100,label:i2,showValue:a2=false,tone:o2,size:s2="md",className:c2,style:l2,...u2}){let d2=typeof e2=="number"&&Number.isFinite(e2)&&r2>0,f2=d2?Math.max(0,Math.min(100,e2/r2*100)):0;return n("div",{...g(u2),className:_("core-progress","core-toned",c2),"data-tone":R(o2,"accent"),"data-size":s2,style:l2,children:[(i2||a2&&d2)&&n("div",{className:"core-progress__head",children:[i2&&t("span",{className:"core-progress__label",children:i2}),a2&&d2&&n("span",{className:"core-progress__value",children:[Math.round(f2),"%"]})]}),t("div",{className:"core-progress__track",role:"progressbar","aria-label":i2,"aria-valuemin":0,"aria-valuemax":d2?r2:void 0,"aria-valuenow":d2?e2:void 0,"data-indeterminate":d2?void 0:"",style:y({"--core-progress-fill":`${f2}%`}),children:t("div",{className:"core-progress__fill"})})]})}function ke({shape:e2="text",lines:n2=3,width:r2,height:i2,className:a2,style:o2,...s2}){let c2=y({"--core-skeleton-w":v(r2),"--core-skeleton-h":v(i2)},o2);if(e2!=="text")return t("span",{...g(s2),"aria-hidden":"true",className:_("core-skeleton",a2),"data-shape":e2,style:c2});let l2=Math.max(1,Math.min(12,Math.round(n2)));return t("span",{...g(s2),"aria-hidden":"true",className:_("core-skeleton-lines",a2),style:c2,children:Array.from({length:l2},(e3,n3)=>t("span",{className:"core-skeleton","data-shape":"line","data-last":n3===l2-1&&l2>1?"":void 0},n3))})}function Ae({label:e2="Loading",size:n2="md",className:r2,...i2}){return t("span",{...g(i2),role:"status","aria-label":e2,className:_("core-spinner",r2),"data-size":n2})}function je({content:e2,text:r2,children:i2,side:a2="top",className:o2,...s2}){let[u2,d2]=m(false),f2=l();return c(()=>{if(!u2)return;let e3=e4=>{e4.key==="Escape"&&d2(false)};return document.addEventListener("keydown",e3),()=>document.removeEventListener("keydown",e3)},[u2]),n("span",{...g(s2),className:_("core-tooltip",o2),"aria-describedby":f2,onMouseEnter:()=>d2(true),onMouseLeave:()=>d2(false),onFocus:()=>d2(true),onBlur:()=>d2(false),children:[i2,t("span",{id:f2,role:"tooltip",className:"core-tooltip__bubble","data-side":a2,"data-open":u2?"":void 0,children:e2??r2})]})}function Me({children:r2,label:i2,variant:a2="primary",size:o2="md",tone:s2="neutral",iconLeft:c2,iconRight:l2,loading:u2=false,disabled:d2=false,type:f2="button",fullWidth:p2=false,className:m2,href:h2,action:v2,input:y2,actions:b2,navigate:x2,onClick:S2,...C2}){let w2=j({href:h2,action:v2,input:y2,actions:b2,navigate:x2,onClick:S2}),T2=u2||w2.busy,E2={...g(C2),className:_("core-button",m2),"data-variant":a2,"data-size":o2,"data-tone":s2,"data-full":p2||void 0,"data-busy":T2||void 0},D2=n(e,{children:[T2?t("span",{className:"core-button__spinner","aria-hidden":"true"}):c2,t("span",{className:"core-button__label",children:r2??i2}),l2]});return h2&&!d2?t("a",{...E2,href:h2,onClick:w2.onClick,"aria-busy":T2||void 0,...w2.external?{target:"_blank",rel:"noopener noreferrer"}:{},children:D2}):t("button",{...E2,type:f2,disabled:d2||T2,"aria-busy":T2||void 0,onClick:w2.onClick,children:D2})}function Ne({children:e2,label:r2,variant:i2="prompt",size:a2="md",selected:o2,onToggle:s2,iconLeft:c2,disabled:l2=false,className:u2,href:d2,action:f2,input:p2,actions:m2,navigate:h2,onClick:v2,...y2}){let b2=o2!==void 0||s2!==void 0,x2=j({href:d2,action:f2,input:p2,actions:m2,navigate:h2,onClick:v2??(s2?()=>s2(!o2):void 0)});return n("button",{...g(y2),type:"button",className:_("core-chip",u2),"data-variant":i2,"data-size":a2,"aria-pressed":b2?!!o2:void 0,disabled:l2||x2.busy,onClick:x2.onClick,children:[c2,t("span",{className:"core-chip__label",children:e2??r2})]})}function Pe({icon:e2,children:n2,label:r2,size:i2="md",variant:a2="ghost",pressed:o2,disabled:s2=false,className:c2,href:l2,action:u2,input:d2,actions:f2,navigate:p2,onClick:m2,...h2}){let v2=j({href:l2,action:u2,input:d2,actions:f2,navigate:p2,onClick:m2}),y2={...g(h2),className:_("core-icon-button",c2),"data-size":i2,"data-variant":a2,"aria-label":r2,title:r2},b2=t("span",{className:"core-icon-button__glyph","aria-hidden":"true",children:e2??n2});return l2&&!s2?t("a",{...y2,href:l2,onClick:v2.onClick,...v2.external?{target:"_blank",rel:"noopener noreferrer"}:{},children:b2}):t("button",{...y2,type:"button","aria-pressed":o2,disabled:s2||v2.busy,onClick:v2.onClick,children:b2})}function Fe({href:r2,children:i2,label:a2,variant:o2="default",className:s2,navigate:c2,onClick:l2,...u2}){let d2=j({href:r2,navigate:c2,onClick:l2});return k(r2)||A(r2)||/^(https?:|mailto:)/i.test(r2)?n("a",{...g(u2),className:_("core-link",s2),"data-variant":o2,href:r2,onClick:d2.onClick,...d2.external?{target:"_blank",rel:"noopener noreferrer"}:{},children:[i2??a2,d2.external&&n(e,{children:[t("svg",{className:"core-link__away",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:t("path",{d:"M7 17L17 7M8 7h9v9"})}),t("span",{className:"core-link__note",children:" (opens in a new tab)"})]})]}):t("span",{className:_("core-link",s2),children:i2??a2})}function Ie({options:e2,value:n2,defaultValue:r2,onChange:i2,label:a2,fullWidth:o2=false,size:s2="md",className:c2,setValue:u2,...d2}){let[f2,h2]=m(r2??e2[0]?.value),v2=n2??f2,y2=l(),b2=p([]),x2=e3=>{n2===void 0&&h2(e3),i2?.(e3),u2?.(e3)},S2=e2.map((e3,t2)=>e3.disabled?-1:t2).filter(e3=>e3>=0),C2=(t2,n3)=>{let r3=t2.key==="ArrowRight"||t2.key==="ArrowDown"?1:t2.key==="ArrowLeft"||t2.key==="ArrowUp"?-1:0;if(!r3||!S2.length)return;t2.preventDefault();let i3=S2.indexOf(n3),a3=S2[(i3+r3+S2.length)%S2.length];b2.current[a3]?.focus(),x2(e2[a3].value)};return t("div",{...g(d2),role:"radiogroup","aria-label":a2,className:_("core-segmented",c2),"data-full":o2||void 0,"data-size":s2,children:e2.map((e3,n3)=>{let r3=e3.value===v2;return t("button",{ref:e4=>{b2.current[n3]=e4},type:"button",role:"radio",name:y2,"aria-checked":r3,tabIndex:r3||v2===void 0&&n3===S2[0]?0:-1,disabled:e3.disabled,className:"core-segmented__option",onClick:()=>x2(e3.value),onKeyDown:e4=>C2(e4,n3),children:e3.label},e3.value)})})}function Le({items:e2=[],children:r2,numbered:i2=false,single:a2=false,rules:o2="subtle",className:s2,...c2}){let u2=l(),d2=i2?"ol":"ul";return n("div",{...g(c2),className:_("core-accordion",s2),"data-rules":o2,children:[e2.length>0&&t(d2,{className:"core-accordion__list","data-numbered":i2||void 0,children:e2.map((e3,r3)=>t("li",{className:"core-accordion__item",children:n("details",{className:"core-disclosure",name:a2?u2:void 0,open:e3.open||void 0,children:[n("summary",{className:"core-disclosure__summary",children:[i2&&t("span",{className:"core-accordion__number",children:r3+1}),e3.question]}),t("div",{className:"core-disclosure__content",children:e3.answer})]})},e3.id??r3))}),r2]})}function Re({media:e2,header:r2,body:i2,footer:a2,children:o2,tone:s2="plain",className:c2,...l2}){return n("article",{...g(l2),className:_("core-card",c2),"data-tone":s2,children:[e2!=null&&t("div",{className:"core-card__media",children:e2}),r2!=null&&t("header",{className:"core-card__header",children:r2}),(i2!=null||o2!=null)&&n("div",{className:"core-card__body",children:[i2,o2]}),a2!=null&&t("footer",{className:"core-card__footer",children:a2})]})}var ze={"1:1":"1fr 1fr","2:1":"2fr 1fr","1:2":"1fr 2fr","3:1":"3fr 1fr","1:3":"1fr 3fr"};function Be({start:e2,end:r2,children:i2,ratio:a2="1:1",gap:o2,stackBelow:s2="compact",className:c2,...l2}){return n("div",{...g(l2),className:_("core-columns",c2),"data-stack":s2,children:[n("div",{className:"core-columns__grid",style:y({"--core-columns-template":ze[a2]??ze["1:1"],"--core-columns-gap":v(o2)}),children:[t("div",{className:"core-columns__start",children:e2}),t("div",{className:"core-columns__end",children:r2})]}),i2]})}var Ve=Be;function He({summary:e2,content:r2,children:i2,open:a2=false,onToggle:o2,className:s2,...c2}){return n("details",{...g(c2),className:_("core-disclosure",s2),open:a2||void 0,onToggle:o2?e3=>o2(e3.currentTarget.open):void 0,children:[t("summary",{className:"core-disclosure__summary",children:e2}),n("div",{className:"core-disclosure__content",children:[r2,i2]})]})}function Ue({items:e2,children:n2,min:i2,columns:a2,gap:o2,className:s2,style:c2,...l2}){let u2=[...r.toArray(e2),...r.toArray(n2)];return t("div",{...g(l2),className:_("core-grid",s2),"data-capped":a2&&a2>0?"":void 0,style:y({"--core-grid-min":v(i2),"--core-grid-gap":v(o2),"--core-grid-cols":a2&&a2>0?String(Math.round(a2)):void 0},c2),children:u2})}function We({item:e2,each:n2,as:i2,layout:a2="stack",gap:o2,min:s2,empty:c2,className:l2,style:u2,...d2}){let f2=r.toArray(e2);return f2.length?t("div",{...g(d2),className:_("core-repeat",l2),"data-layout":a2,style:y({"--core-repeat-gap":v(o2),"--core-repeat-min":v(s2)},u2),children:f2}):c2?t("p",{className:"core-repeat__empty",children:c2}):null}var Ge=["page-x-of-y","page-number","page-count"],Ke={display:{size:46,lineHeight:.98,weight:500,tracking:"-0.032em"},heading:{size:28,lineHeight:1.05,weight:500,tracking:"-0.03em"},subhead:{size:20,lineHeight:1.15,weight:500,tracking:"-0.02em"},title:{size:17,lineHeight:1.3,weight:500,tracking:"-0.018em"},body:{size:15,lineHeight:1.65,weight:400,tracking:"-0.012em"},bodySmall:{size:13,lineHeight:1.65,weight:400,tracking:"-0.012em"},label:{size:13,lineHeight:1.4,weight:500,tracking:"-0.015em"},note:{size:12,lineHeight:1.7,weight:400,tracking:"-0.012em"},eyebrow:{size:11,lineHeight:1,weight:600,tracking:"0.14em",uppercase:true}},qe={full:"var(--color-text)",muted:"var(--color-text-muted)",subtle:"var(--color-text-subtle)",border:"var(--color-border)",accent:"var(--color-accent)",accentText:"var(--color-link)",sunken:"var(--color-surface-sunken)"},Je=["cover","what-this-is","told-us","meaning","next-steps","talk-it-through","notes","footer"],Ye=[{id:"workbook",label:"Workbook",sheet:{width:"8.5in",height:"11in"},margins:{top:"0.60in",right:"0.70in",bottom:"0.55in",left:"0.95in"},measure:"6.85in",bodyMeasureCh:64,rail:{placement:"strip"},ink:qe,rules:{head:"2px",structural:"1px",row:"1px",hairline:"1px"},type:Ke,floorPx:11,depth:{max:1,indent:["0"],numbering:"none"},fills:true,regions:{"page-footer":{left:"member-ref",centre:"document-id",right:"page-x-of-y"}},sections:{known:Je,required:["next-steps","talk-it-through"]}},{id:"report",extends:"workbook",label:"Report",regions:{"page-footer":{right:"page-x-of-y"}},requiredBindings:[],sections:{known:Je,required:["next-steps","talk-it-through"]}},{id:"instrument",extends:"workbook",label:"Instrument",sheet:{width:"8.5in",height:"11in"},margins:{top:"1.00in",right:"1.00in",bottom:"1.00in",left:"1.25in"},measure:"4.50in",bodyMeasureCh:void 0,rail:{placement:"column",axis:"4.75in",width:"1.50in",gutter:"0.25in"},ink:{full:"#000000",muted:"rgba(0,0,0,0.70)",subtle:"rgba(0,0,0,0.45)",border:"rgba(0,0,0,0.45)",accent:"#000000",accentText:"#000000",sunken:"transparent"},rules:{structural:"0.75pt",hairline:"0.25pt"},type:{...Ke,eyebrow:{...Ke.eyebrow,tracking:"0.08em"}},depth:{max:3,indent:["0","0.375in","0.75in"],numbering:"ladder"},fills:false,regions:{"page-footer":{left:"execution-state",right:"page-x-of-y"}},requiredBindings:["execution-state"],sections:{required:[]}}],G=new Map;function Xe(e2){G.set(e2.id,e2)}for(let e2 of Ye)Xe(e2);function Ze(){return[...G.keys()].sort()}function Qe(e2){let t2=G.get(e2);if(!t2)throw Error(`[document-profile] unknown profile "${e2}". Registered: ${Ze().join(", ")}`);if(!t2.extends)return t2;let n2=G.get(t2.extends);if(!n2)throw Error(`[document-profile] "${e2}" extends unknown profile "${t2.extends}"`);if(n2.extends)throw Error(`[document-profile] "${e2}" extends "${n2.id}", which extends "${n2.extends}": inheritance is one level deep.`);return{...n2,...t2,id:t2.id,extends:t2.extends}}function $e(){let e2={};for(let t2 of Ze())try{e2[t2]=Qe(t2)}catch(e3){console.warn(`[document-profile] skipping "${t2}": ${e3 instanceof Error?e3.message:String(e3)}`)}return e2}var et=Object.freeze($e()),tt="workbook";function nt(e2,t2){try{return Qe(e2)}catch{return F(`unknown-profile:${e2}`,`[document-profile] unknown profile "${e2}" (first seen in ${t2}): rendering with fallback values.`),null}}function K(e2,t2){return e2===void 0?(F("no-profile",`[document-profile] no profileId supplied (first seen in ${t2}): falling back to "${tt}". If this document is an instrument, its numbering and depth are being dropped.`),nt(tt,t2)):nt(e2,t2)}var rt=e2=>e2.replace(/[A-Z]/g,e3=>`-${e3.toLowerCase()}`),it=["full","muted","subtle","border","accent","accentText","sunken"],at=["structural","hairline","head","row"],ot=["display","heading","subhead","title","body","bodySmall","label","note","eyebrow"],st=3,q="initial";function ct(e2){let t2={"--doc-sheet-width":e2.sheet.width,"--doc-sheet-height":e2.sheet.height,"--doc-margin-top":e2.margins.top,"--doc-margin-right":e2.margins.right,"--doc-margin-bottom":e2.margins.bottom,"--doc-margin-left":e2.margins.left,"--doc-measure":e2.measure,"--doc-body-measure":e2.bodyMeasureCh?`${e2.bodyMeasureCh}ch`:"none","--doc-rail-axis":e2.rail.axis??q,"--doc-rail-width":e2.rail.width??q,"--doc-rail-gutter":e2.rail.gutter??q,"--doc-floor":`${e2.floorPx}px`};for(let n2 of it)t2[`--doc-ink-${rt(n2)}`]=e2.ink[n2];for(let n2 of at)t2[`--doc-rule-${n2}`]=e2.rules[n2]??q;for(let n2 of ot){let r2=e2.type[n2],i2=`--doc-type-${rt(n2)}`;t2[`${i2}-size`]=`${r2.size}px`,t2[`${i2}-leading`]=String(r2.lineHeight),t2[`${i2}-weight`]=String(r2.weight),t2[`${i2}-tracking`]=r2.tracking,t2[`${i2}-case`]=r2.uppercase?"uppercase":"none"}for(let n2=1;n2<=st;n2++)t2[`--doc-indent-${n2}`]=e2.depth.indent[n2-1]??q;return t2}var lt=(e2,t2)=>`${e2} {
2
+ ${Object.entries(t2).map(([e3,t3])=>` ${e3}: ${t3};`).join("\n")}
3
+ }`;function ut(e2,t2){return e2.map(e3=>lt(e3.id===t2?`:root,
4
+ [data-profile='${e3.id}']`:`[data-profile='${e3.id}']`,ct(e3))).join("\n\n")}var dt=["prose","clause","definitions","table","notice","figure","execution"],ft=/\{\{ref:([^}|]+?)(?:\|(title|full|number))?\}\}/g,J="[a-z0-9][a-z0-9_-]*",pt=RegExp(`^(?:(${J}):)?(${J}(?:\\.${J})*)(?:#(${J}))?$`);RegExp(`^${J}$`);function mt(e2,t2){let n2=e2.trim(),r2=pt.exec(n2);return r2?{key:n2,...r2[1]?{doc:r2[1]}:{},unit:r2[2],...r2[3]?{element:r2[3]}:{},...t2?{form:t2}:{}}:null}function ht(e2){let t2=e2.lastIndexOf(".");return t2<0?e2:e2.slice(t2+1)}function gt(e2){let t2=[],n2=0;for(let r2 of e2.matchAll(new RegExp(ft.source,"g"))){let i2=mt(r2[1],r2[2]);i2&&(r2.index>n2&&t2.push({kind:"text",text:e2.slice(n2,r2.index)}),t2.push({kind:"ref",...i2}),n2=r2.index+r2[0].length)}return n2<e2.length&&t2.push({kind:"text",text:e2.slice(n2)}),t2}function _t(e2){return e2.includes("{{ref:")}var Y=e2=>e2?{"data-profile":e2}:{},vt=e2=>e2?.fills===false?{"data-fills":"none"}:{},yt={note:"ⓘ",tip:"💡",warning:"⚠️",important:"❗"};function bt({children:e2,tone:r2="note",title:i2,profileId:a2,profile:o2,className:s2,style:c2}){let l2=o2??K(a2,"Aside"),u2=l2?.fills===false;return n("aside",{className:_("core-aside",s2),"data-tone":r2,...Y(o2?.id??a2),...vt(l2),style:c2,children:[u2?null:t("span",{className:"core-aside__icon","aria-hidden":true,children:yt[r2]}),n("div",{className:"core-aside__body",children:[i2&&t("div",{className:"core-aside__title",children:i2}),t("div",{className:"core-aside__text",children:e2})]})]})}function xt({children:e2,profileId:n2,profile:r2,full:i2=false,className:a2,style:o2}){return r2||K(n2,"Prose"),t("div",{className:_("core-prose",a2),"data-full":i2?"":void 0,...Y(r2?.id??n2),style:o2,children:e2})}function St({children:e2,citation:r2,className:i2,style:a2}){return n("figure",{className:_("core-quote",i2),style:a2,children:[t("blockquote",{className:"core-quote__body",children:e2}),r2&&n("figcaption",{className:"core-quote__citation",children:["— ",r2]})]})}function Ct({term:e2,description:r2,pairs:i2,profileId:a2,profile:o2,className:s2,style:c2}){o2||K(a2,"Definition");let l2=i2??(e2===void 0?[]:[{term:e2,description:r2}]);return t("dl",{className:_("core-definition",s2),...Y(o2?.id??a2),style:c2,children:l2.map((e3,r3)=>n("div",{className:"core-definition__item",children:[t("dt",{className:"core-definition__term",children:e3.term}),t("dd",{className:"core-definition__description",children:e3.description})]},r3))})}var wt="katex";function Tt(e2){if(typeof document>"u")return false;for(let t2 of document.querySelectorAll('script[type="importmap"]'))try{if(JSON.parse(t2.textContent??"").imports?.[e2])return true}catch{}return false}var Et=e2=>import(e2),Dt;function Ot(){return Dt??=Tt(wt)?Et(wt).then(e2=>{let t2=e2,n2=t2.default??t2;return typeof n2.render=="function"?n2:null},()=>null):Promise.resolve(null),Dt}function kt({children:e2="",mode:n2="inline",className:r2}){let i2=p(null),[a2,o2]=m(null),[s2,l2]=m(null),u2=`${n2}:${e2}`;return c(()=>{let e3=true;return Ot().then(t2=>{e3&&t2&&o2(()=>t2)}),()=>{e3=false}},[]),c(()=>{if(a2&&i2.current&&s2!==u2)try{a2.render(e2,i2.current,{displayMode:n2==="block",throwOnError:false})}catch{l2(u2)}},[a2,e2,n2,u2,s2]),!a2||s2===u2?t("span",{className:_("core-math",r2),"data-mode":n2,"data-fallback":"",title:"KaTeX not available — showing TeX source",children:e2}):t("span",{ref:i2,className:_("core-math",r2),"data-mode":n2})}function At(e2,t2){switch(t2.type){case"register":return e2.footnotes.some(e3=>e3.id===t2.entry.id)?e2:{footnotes:[...e2.footnotes,t2.entry]};case"unregister":return{footnotes:e2.footnotes.filter(e3=>e3.id!==t2.id)};default:return e2}}var jt=i(null);function Mt(){return s(jt)}function Nt({children:e2}){let[n2,r2]=f(At,{footnotes:[]}),i2=p(0),a2=o(e3=>{i2.current+=1;let t2=i2.current;return r2({type:"register",entry:{...e3,number:t2}}),t2},[]),s2=o(e3=>r2({type:"unregister",id:e3}),[]),c2=d(()=>({state:n2,registerFootnote:a2,unregisterFootnote:s2}),[n2,a2,s2]);return t(jt.Provider,{value:c2,children:e2})}function Pt({children:e2}){let r2=l(),i2=Mt(),[a2,o2]=m(null);return c(()=>{if(!i2)return;let t2=i2.registerFootnote({id:r2,content:e2});return o2(t2),()=>i2.unregisterFootnote(r2)},[r2]),i2?a2===null?null:t("sup",{id:`core-footnote-ref-${a2}`,className:"core-footnote",children:n("a",{href:`#core-footnote-${a2}`,className:"core-footnote__link",children:["[",a2,"]"]})}):n("span",{className:"core-footnote","data-fallback":"",children:[" ","(",e2,")"]})}function Ft({children:e2,caption:r2,profileId:i2,profile:a2,className:o2,style:s2}){return a2||K(i2,"Figure"),n("figure",{className:_("core-figure",o2),...Y(a2?.id??i2),style:s2,children:[t("div",{className:"core-figure__body",children:e2}),r2&&t("figcaption",{className:"core-figure__caption",children:r2})]})}function It({className:e2}){return t("div",{className:_("core-page-break",e2),"aria-hidden":true})}function Lt({children:e2,as:n2="div",profileId:r2,profile:i2,tone:a2="subtle",className:o2,style:s2}){return i2||K(r2,"DocumentLabel"),t(n2,{className:_("core-document-label",o2),"data-tone":a2,...Y(i2?.id??r2),style:s2,children:e2})}var Rt=["one","two","three","four","five","six","seven","eight","nine","ten"];function zt(e2){if(e2.length!==1)return null;let t2=e2[0],n2=Rt[t2-1];return n2?`Article ${n2}`:`Article ${t2}`}function Bt(e2){return e2.length===0?null:e2.length===1?`Article ${e2[0]}`:e2.join(".")}function Vt(e2,t2,n2){let r2=n2==="ladder"&&e2!==void 0&&e2.length>0,i2=[];return t2.map(({level:t3,marker:n3})=>{let a2=Math.min(Number.isInteger(t3)&&t3>=1?t3:1,i2.length+1);return i2.length=a2,i2[a2-1]=(i2[a2-1]??0)+1,n3===void 0?r2?[...e2,...i2].join("."):void 0:n3})}function Ht(e2,t2){return e2?.[t2]??t2}function Ut({target:e2,form:n2,sectionReferences:r2,sectionNumbers:i2,sectionTitles:a2,sectionAnchors:o2,profileId:s2,profile:c2,className:l2,style:u2}){let d2=c2??K(s2,"Reference"),f2=mt(e2),p2=r2?.[e2],m2=p2?.openable===false,h2=f2!==null&&f2.doc===void 0,g2=f2?ht(f2.unit):e2,v2=p2?.number??(h2&&f2.element===void 0?i2?.[g2]:void 0),y2=p2?.title??(h2&&f2.element===void 0?a2?.[g2]:void 0),b2=null;if(f2?.element!==void 0){let e3=p2?.element;b2=e3?Vt(p2.number,e3.shape,d2?.depth.numbering)[e3.index]??null:null}else v2&&(b2=Bt(v2));let x2=n2==="full"||f2?.doc!==void 0&&n2!=="title",S2;S2=m2?null:n2==="title"?y2??b2:x2&&b2&&y2&&f2?.element===void 0?`${b2} (${y2})`:b2??y2??null;let C2=S2!==null,w2=C2?p2?p2.href:`#${Ht(o2,g2)}`:void 0,T2={className:_("core-reference",l2),"data-target":e2,"data-unresolved":C2||m2?void 0:"","data-closed":m2?"":void 0,...Y(c2?.id??s2),style:u2};return w2?t("a",{href:w2,...T2,children:S2}):t("span",{...T2,children:S2??e2})}function Wt({columns:e2,rows:r2,caption:i2,profileId:a2,profile:o2,className:s2,style:c2}){return o2||K(a2,"DocumentTable"),e2.length===0?null:n("div",{className:_("core-document-table",s2),...Y(o2?.id??a2),style:c2,children:[i2===void 0?null:t("div",{className:"core-document-table__caption",children:i2}),n("table",{className:"core-document-table__table",children:[t("thead",{children:t("tr",{children:e2.map((e3,n2)=>t("th",{scope:"col",className:"core-document-table__head","data-align":e3.align??"left",children:e3.header},n2))})}),t("tbody",{children:r2.map((n2,r3)=>t("tr",{children:e2.map((e3,r4)=>t("td",{className:"core-document-table__cell","data-align":e3.align??"left",children:n2[r4]??null},r4))},r3))})]})]})}function Gt({items:e2,profileId:r2,profile:i2,markerWidth:a2=44,secondaryWidth:o2=190,missingLabel:s2="Not answered yet",className:c2,style:l2}){return i2||K(r2,"RowList"),e2.length===0?null:t("div",{className:_("core-row-list",c2),...Y(i2?.id??r2),style:y({"--core-row-list-marker-width":v(a2),"--core-row-list-secondary-width":v(o2)},l2),children:e2.map((e3,r3)=>n("div",{className:"core-row-list__row",children:[e3.marker!==void 0&&t("div",{className:"core-row-list__marker",children:e3.marker}),t("div",{className:"core-row-list__primary",children:e3.primary}),(e3.secondary!==void 0||e3.missing)&&t("div",{className:"core-row-list__secondary","data-missing":e3.missing?"":void 0,children:e3.missing?s2:e3.secondary})]},r3))})}var Kt=190;function qt({items:e2,profileId:n2,profile:r2,missingLabel:i2="Not answered yet",answerWidth:a2=190,className:o2,style:s2}){let c2=e2.map(e3=>{let t2=typeof e3.answer=="string"&&e3.answer.trim().length>0;return{marker:e3.reference,primary:e3.question,secondary:t2?e3.answer:void 0,missing:!t2}});return t("div",{className:_("core-answer-rows",o2),...Y(r2?.id??n2),style:s2,children:t(Gt,{items:c2,profileId:n2,profile:r2,secondaryWidth:a2,missingLabel:i2})})}function X(e2){if(e2==null)return"";if(typeof e2=="string")return e2;let t2=e2.precision??(e2.format==="number"?Jt(e2.value):void 0),n2=Yt(e2.format,e2.value,{precision:t2,signed:e2.signed});return e2.unit&&n2!=="—"?`${n2} ${e2.unit}`:n2}function Jt(e2){if(typeof e2!="number"||!Number.isFinite(e2))return 0;let t2=String(Number(e2.toFixed(3))),n2=t2.indexOf(".");return n2===-1||t2.includes("e")?0:t2.length-n2-1}function Yt(e2,t2,n2={}){if(!Number.isFinite(t2))return"—";let r2=n2.signed===true,i2=t2<0,a2=Math.abs(t2),o2=i2?"-":r2?"+":"";switch(e2){case"currency":{let e3=n2.precision??0;return`${o2}$${a2.toLocaleString("en-CA",{minimumFractionDigits:e3,maximumFractionDigits:e3})}`}case"currency-k":{let e3=n2.precision??0;return a2>=1e3?`${o2}$${(a2/1e3).toFixed(e3)}k`:`${o2}$${a2.toFixed(0)}`}case"currency-m":{let e3=n2.precision??1;return a2>=1e6?`${o2}$${(a2/1e6).toFixed(e3)}M`:a2>=1e3?`${o2}$${(a2/1e3).toFixed(0)}k`:`${o2}$${a2.toFixed(0)}`}case"currency-compact":{if(a2>=1e9){let e4=n2.precision??1;return`${o2}$${(a2/1e9).toFixed(e4)}B`}if(a2>=1e6){let e4=n2.precision??1;return`${o2}$${(a2/1e6).toFixed(e4)}M`}if(a2>=1e3){let e4=n2.precision??1;return`${o2}$${(a2/1e3).toFixed(e4)}k`}let e3=n2.precision??0;return`${o2}$${a2.toFixed(e3)}`}case"currency-monthly":{let e3=n2.precision??0;return`${o2}$${a2.toLocaleString("en-CA",{minimumFractionDigits:e3,maximumFractionDigits:e3})}/mo`}case"percent":{let e3=n2.precision??1;return`${o2}${a2.toFixed(e3)}%`}case"age":return`Age ${Math.round(t2)}`;case"years":{let e3=n2.precision??0;return`${o2}${a2.toFixed(e3)} yrs`}case"number":{let e3=n2.precision??0;return`${o2}${a2.toLocaleString("en-CA",{minimumFractionDigits:e3,maximumFractionDigits:e3})}`}default:{let e3=n2.precision??0;return`${o2}$${(a2/1e3).toFixed(e3)}k`}}}var Xt=40;function Zt({bars:e2,target:r2,targetLabel:i2,max:a2,profileId:o2,profile:s2,className:c2,style:l2}){let u2=s2??K(o2,"ComparisonBars");if(e2.length===0)return null;let d2=e2.map(e3=>e3.value),f2=a2??Math.max(...d2,r2??0);if(!Number.isFinite(f2)||f2<=0)return F("ComparisonBars:no-scale","[ComparisonBars] every value is zero or negative, so there is no scale to draw against. Rendering nothing rather than a full-width or zero-width bar, either of which reads as a chart and is not one."),null;let p2=r2!==void 0&&r2>0&&r2<=f2?r2/f2*100:void 0;return n("figure",{className:_("core-comparison-bars",c2),...Y(s2?.id??o2),...vt(u2),style:l2,children:[e2.map(e3=>{let r3=Math.max(0,Math.min(100,e3.value/f2*100));return n("div",{className:"core-comparison-bars__bar",style:y({"--core-comparison-bars-value":`${r3}%`}),children:[t("div",{className:"core-comparison-bars__label",children:e3.label}),n("div",{className:"core-comparison-bars__track",style:y({"--core-comparison-bars-target":p2===void 0?void 0:`${p2}%`}),children:[t("div",{className:"core-comparison-bars__fill"}),t("span",{className:"core-comparison-bars__value","data-placement":r3>Xt?"inside":"outside",children:X(e3.display)}),p2!==void 0&&t("div",{className:"core-comparison-bars__target","aria-hidden":"true"})]})]},e3.label)}),r2!==void 0&&i2&&t("figcaption",{className:"core-comparison-bars__target-label",children:i2})]})}var Qt=3,$t=5;function en({items:e2,profileId:r2,profile:i2,checkboxes:a2=true,className:o2,style:s2}){return i2||K(r2,"NextSteps"),e2.length===0?null:((e2.length<Qt||e2.length>$t)&&F(`NextSteps:count:${e2.length}`,`[NextSteps] ${e2.length} step(s). A next-steps list takes three to five: fewer reads as an afterthought, more stops being a list a reader acts on this week. Rendering anyway — a document with six steps is far better than one with none.`),t("ol",{className:_("core-next-steps",o2),...Y(i2?.id??r2),style:s2,children:e2.map((e3,r3)=>n("li",{className:"core-next-steps__step",children:[t("span",{className:"core-next-steps__marker",children:e3.marker??String(r3+1).padStart(2,"0")}),a2&&t("span",{className:"core-next-steps__box","aria-hidden":"true"}),t("span",{className:"core-next-steps__body",children:e3.body})]},r3))}))}var tn=38;function nn({title:e2="Notes",lines:r2=4,profileId:i2,profile:a2,className:o2,style:s2}){return a2||K(i2,"Notes"),r2<1?null:n("section",{className:_("core-notes",o2),...Y(a2?.id??i2),style:s2,children:[t("div",{className:"core-notes__title",children:e2}),t("div",{className:"core-notes__lines","aria-hidden":"true",children:Array.from({length:r2},(e3,n2)=>t("div",{className:"core-notes__line"},n2))})]})}var rn="You left this section open, so it is not covered here.";function an({wouldTell:e2,openingLine:r2=rn,profileId:i2,profile:a2,className:o2,style:s2}){return a2||K(i2,"SkippedSection"),n("div",{className:_("core-skipped-section",o2),...Y(a2?.id??i2),style:s2,children:[t("span",{className:"core-skipped-section__standard",children:r2})," ",t("span",{className:"core-skipped-section__would-tell",children:e2})]})}var on="Nothing here is settled. If a number looks wrong, or a step does not fit your situation, say so and we will work through it together.";function sn({advisor:e2,title:r2="Talk it through",invitation:i2=on,profileId:a2,profile:o2,className:s2,style:c2}){if(o2||K(a2,"TalkItThrough"),!e2?.name?.trim())return F("TalkItThrough:no-advisor","[TalkItThrough] no advisor name — rendering NOTHING rather than an empty box. This section is mandatory in an approved output because it is the door to a human; a door with nobody behind it passes a structural check and fails the reader."),null;let l2=[e2.phone,e2.email].filter(e3=>typeof e3=="string"&&e3.trim().length>0);return l2.length===0&&F("TalkItThrough:no-contact",`[TalkItThrough] "${e2.name}" has no phone and no email. The section is the advisor's name, HOW TO REACH THEM, and an open invitation — a name alone is not a route. Rendering, because a named advisor is still better than a dropped section.`),n("section",{className:_("core-talk-it-through",s2),...Y(o2?.id??a2),style:c2,children:[t("h3",{className:"core-talk-it-through__title",children:r2}),t("p",{className:"core-talk-it-through__invitation",children:i2}),n("div",{className:"core-talk-it-through__advisor",children:[t("div",{className:"core-talk-it-through__name",children:e2.name}),e2.role&&t("div",{className:"core-talk-it-through__role",children:e2.role}),l2.length>0&&t("div",{className:"core-talk-it-through__contact",children:l2.map(e3=>t("span",{children:e3},e3))})]})]})}var cn=38;function ln({question:e2,answer:r2,lines:i2=1,profileId:a2,profile:o2,className:s2,style:c2}){o2||K(a2,"WriteInField");let l2=typeof r2=="string"&&r2.trim().length>0,u2=Math.max(1,i2);return n("div",{className:_("core-write-in-field",s2),"data-answered":l2?"":void 0,...Y(o2?.id??a2),style:c2,children:[e2&&t("div",{className:"core-write-in-field__question",children:e2}),l2?t("div",{className:"core-write-in-field__answer",children:r2}):Array.from({length:u2},(e3,n2)=>t("div",{className:"core-write-in-field__line","aria-hidden":"true"},n2))]})}function un({mark:e2,identity:r2,codes:i2,profileId:a2,profile:o2,className:s2,style:c2}){return o2||K(a2,"Masthead"),e2===void 0&&r2===void 0&&i2===void 0?null:n("header",{className:_("core-masthead",s2),"data-page-region":"page-header",...Y(o2?.id??a2),style:c2,children:[e2!==void 0&&t("div",{className:"core-masthead__mark","data-slot":"mark",children:e2}),r2!==void 0&&t("div",{className:"core-masthead__identity","data-slot":"identity",children:r2}),i2!==void 0&&t("div",{className:"core-masthead__codes","data-slot":"codes",children:i2})]})}var dn=4;function fn({fields:e2,profileId:r2,profile:i2,className:a2,style:o2}){let s2=(i2??K(r2,"MetaRail"))?.rail.placement??"strip";return s2==="none"||e2.length===0?null:(s2!=="column"&&e2.length>dn&&typeof console<"u"&&console.warn(`[MetaRail] ${e2.length} fields in a strip; the spec allows ${dn}. Rendering all of them — check the layout.`),t("div",{className:_("core-meta-rail",a2),"data-placement":s2,...Y(i2?.id??r2),style:o2,children:e2.map(e3=>n("div",{className:"core-meta-rail__field",children:[t("div",{className:"core-meta-rail__label",children:e3.label}),t("div",{className:"core-meta-rail__value",children:e3.value})]},`${e3.label}:${e3.value}`))}))}var pn={left:"bottom-left",centre:"bottom-center",right:"bottom-right"};function mn({left:e2,centre:n2,right:r2,profileId:i2,profile:a2,className:o2,style:s2}){a2||K(i2,"RunningFooter");let c2=[["left",e2],["centre",n2],["right",r2]].filter(([,e3])=>e3!=null);return c2.length===0?null:t("footer",{className:_("core-running-footer",o2),"data-page-region":"page-footer",...Y(a2?.id??i2),style:s2,children:c2.map(([e3,n3])=>t("span",{className:"core-running-footer__slot","data-region-slot":e3,"data-margin-box":pn[e3],children:n3},e3))})}function hn({children:r2,rail:i2,profileId:a2,profile:o2,className:s2,style:c2}){let l2=o2??K(a2,"DocumentShell"),u2=l2?.rail.placement==="column"&&i2!==void 0;return t(Nt,{children:n("div",{className:_("core-document-shell",s2),...Y(l2?.id??a2),"data-has-rail":u2?"":void 0,style:c2,children:[t("div",{className:"core-document-shell__body",children:r2}),u2&&n(e,{children:[t("div",{className:"core-document-shell__gutter","aria-hidden":true}),t("aside",{className:"core-document-shell__rail",children:i2})]})]})})}function gn(e2,t2){return!e2||e2.length===0?null:t2===0?String(e2[0]).padStart(2,"0"):e2.join(".")}function _n({entries:e2,depth:r2,title:i2,profileId:a2,profile:o2,className:s2,style:c2}){let l2=o2??K(a2,"Contents"),u2=l2?.depth.max??Infinity,d2=e2??[],f2=r2===void 0?d2:d2.filter(e3=>e3.level<r2);if(f2.length===0)return null;let p2=l2?.depth.numbering??"none",m2=f2.some(e3=>e3.page!==void 0);return n("nav",{"aria-label":"Table of contents",className:_("core-contents",s2),...Y(o2?.id??a2),style:c2,children:[i2&&t("div",{className:"core-contents__title",children:i2}),t("ol",{className:"core-contents__list",children:f2.map(e3=>{let r3=p2==="none"?null:gn(e3.ordinal,e3.level);return n("li",{className:"core-contents__entry","data-level":e3.level,"data-overdeep":e3.level>=u2?"":void 0,style:y({"--core-contents-level":String(e3.level)}),children:[r3&&t("span",{className:"core-contents__ordinal",children:r3}),t("a",{href:`#${e3.id}`,className:"core-contents__link",children:e3.title}),m2&&t("span",{className:"core-contents__page",children:e3.page??""})]},e3.id)})})]})}function vn({s:e2,dated:r2}){return n("div",{className:"core-execution-block__signature",children:[n("div",{className:"core-execution-block__lines",children:[t("div",{className:"core-execution-block__line","data-line":"sign"}),r2?t("div",{className:"core-execution-block__line","data-line":"date"}):null]}),n("div",{className:"core-execution-block__captions",children:[n("div",{className:"core-execution-block__party",children:[e2.role?t("div",{className:"core-execution-block__role",children:e2.role}):null,e2.name?t("div",{className:"core-execution-block__name",children:e2.name}):null,e2.detail?t("div",{className:"core-execution-block__detail",children:e2.detail}):null]}),r2?t("div",{className:"core-execution-block__date-label",children:"Date"}):null]})]})}function yn({attestation:e2,label:r2,signatories:i2,columns:a2=1,note:o2,profileId:s2,profile:c2,className:l2,style:u2}){c2||K(s2,"ExecutionBlock");let d2=Array.isArray(i2)?i2:[];return n("section",{className:_("core-execution-block",l2),...Y(c2?.id??s2),style:u2,children:[r2?t("div",{className:"core-execution-block__label",children:r2}):null,e2?t("div",{className:"core-execution-block__attestation",children:e2}):null,t("div",{className:"core-execution-block__signatories","data-columns":a2,children:d2.map((e3,n2)=>t(vn,{s:e3,dated:e3.dated===true},n2))}),o2?t("div",{className:"core-execution-block__note",children:o2}):null]})}function bn({kind:e2}){return n("div",{className:"core-document-blocks__unrenderable","data-unrenderable-block":e2,role:"alert",children:[t("strong",{children:"This provision could not be rendered."})," The document contains a block of type “",e2,"”, which this bundle has no renderer for. Nothing has been omitted silently — the content is present in the source document and is missing only from this page. Do not sign or rely on this document until it renders in full."]})}function xn({blocks:e2,profileId:n2,sectionNumbers:r2,sectionAnchors:i2,sectionTitles:a2,sectionReferences:o2,sectionOrdinal:s2,className:c2,style:l2}){let u2=K(n2,"DocumentBlocks");if(e2.length===0)return null;let d2=Vt(s2,e2.flatMap(e3=>e3.kind==="clause"?e3.items:[]),u2?.depth.numbering),f2=0,p2=(e3,s3)=>_t(e3)?gt(e3).map((e4,c3)=>e4.kind==="text"?e4.text:t(Ut,{target:e4.key,form:e4.form,sectionReferences:o2,sectionNumbers:r2,sectionTitles:a2,sectionAnchors:i2,profileId:n2},`${s3}-ref-${c3}`)):e3,m2=e2.some(e3=>e3.kind==="execution");return t("div",{className:_("core-document-blocks",c2),"data-pinned":m2?"execution":void 0,...Y(n2),style:l2,children:e2.map((e3,r3)=>{let i3=`${e3.kind}-${r3}`;switch(e3.kind){case"prose":return t(xt,{profileId:n2,full:e3.full,children:p2(e3.text,i3)},i3);case"clause":return t(Gt,{profileId:n2,items:e3.items.map((e4,t2)=>({marker:d2[f2++],primary:p2(e4.text,`${i3}-${t2}`),secondary:e4.note?p2(e4.note,`${i3}-${t2}-n`):void 0,missing:e4.missing}))},i3);case"definitions":return t(Ct,{profileId:n2,pairs:e3.pairs.map((e4,t2)=>({term:e4.term,description:p2(e4.description,`${i3}-${t2}`)}))},i3);case"table":return t(Wt,{profileId:n2,caption:e3.caption?p2(e3.caption,`${i3}-cap`):void 0,columns:e3.columns,rows:e3.rows.map((e4,t2)=>e4.map((e5,n3)=>p2(e5,`${i3}-${t2}-${n3}`)))},i3);case"notice":return t(bt,{profileId:n2,tone:e3.tone,title:e3.title,children:p2(e3.text,i3)},i3);case"figure":return t(Ft,{profileId:n2,caption:p2(e3.caption,i3),children:e3.placeholder??null},i3);case"execution":return t(yn,{profileId:n2,label:e3.label,attestation:e3.attestation,signatories:e3.signatories,columns:e3.columns,note:e3.note},i3);default:return t(bn,{kind:String(e3.kind)},i3)}})})}var Sn=["h2","h3","h4","h5","h6"];function Cn({sectionId:e2,title:r2,level:i2=0,ordinal:a2,sectionNumbers:o2,sectionAnchors:s2,sectionTitles:c2,sectionReferences:l2,sectionLevels:u2,continued:d2=false,continuedCount:f2,children:p2,blocks:m2,profileId:h2,profile:g2,className:v2,style:b2}){let x2=g2??K(h2,"DocumentSection"),S2=o2?.[e2],C2=u2?.[e2],w2=S2??a2,T2=C2===void 0?i2:Math.max(0,C2-1),E2=T2>=(x2?.depth.max??Infinity),D2=Math.min(T2,(x2?.depth.indent.length??1)-1)+1,O2=x2?.depth.numbering==="ladder"&&w2!==void 0&&w2.length>0,k2=O2?zt(w2):null,A2=Sn[Math.min(T2,Sn.length-1)],j2=Ht(s2,e2),M2=`${j2}-doc-heading`;return n("section",{id:j2,className:_("core-document-section",v2),"data-level":T2,"data-ordinal-source":w2?S2?"derived":"baked":void 0,"data-overdeep":E2?"":void 0,"aria-labelledby":M2,...Y(g2?.id??h2),style:y({"--core-document-section-indent":`var(--doc-indent-${D2}, 0)`},b2),children:[k2&&t("div",{className:"core-document-section__article",children:k2}),n(A2,{id:M2,className:"core-document-section__heading",children:[O2&&!k2&&t("span",{className:"core-document-section__ordinal",children:w2.join(".")}),r2,d2&&t("span",{className:"core-document-section__continued",children:"continued"})]}),d2&&f2&&t("div",{className:"core-document-section__count",children:`Items ${f2.from} to ${f2.to} of ${f2.of}`}),t("div",{className:"core-document-section__body",children:p2??(m2?t(xn,{blocks:m2,profileId:h2,sectionNumbers:o2,sectionAnchors:s2,sectionTitles:c2,sectionReferences:l2,sectionOrdinal:O2?w2:void 0}):null)})]})}var wn={prose:{type:"object",required:["kind","text"],additionalProperties:false,properties:{kind:{const:"prose"},text:{type:"string",description:"ONE paragraph. Two paragraphs in one value run together on the page: emit a second prose block instead."},full:{type:"boolean",description:"Fill the measure rather than the reading-width cap. For a caption or text beside a table."}}},clause:{type:"object",required:["kind","items"],additionalProperties:false,properties:{kind:{const:"clause"},items:{type:"array",minItems:1,items:{type:"object",required:["text"],additionalProperties:false,properties:{marker:{type:"string",description:'An explicit number that overrides the derived one, only for numbering fixed by statute or a standard form. Omit it and the renderer numbers the clause from its article ("6.3").'},level:{type:"integer",minimum:1,description:"Depth within the section: 1 a clause, 2 a sub-clause, 3 a sub-sub-clause. Default 1."},id:{type:"string",pattern:"^[a-z0-9][a-z0-9_-]*$",description:"A slug, unique in the document, written only when prose cites this clause as {{ref:<section>#<id>}}. Keep it stable across edits."},text:{type:"string"},note:{type:"string",description:"A parenthetical, cross-reference or jurisdictional note set beside the text."},missing:{type:"boolean",description:"The value is not yet known. Use this instead of writing a [REQUIRED: ...] marker into the text."}}}}}},definitions:{type:"object",required:["kind","pairs"],additionalProperties:false,properties:{kind:{const:"definitions"},pairs:{type:"array",minItems:1,items:{type:"object",required:["term","description"],additionalProperties:false,properties:{term:{type:"string"},description:{type:"string"}}}}}},table:{type:"object",required:["kind","columns","rows"],additionalProperties:false,properties:{kind:{const:"table"},caption:{type:"string"},columns:{type:"array",minItems:1,items:{type:"object",required:["header"],additionalProperties:false,properties:{header:{type:"string"},align:{enum:["left","right","center"],description:"Right-align money and any other figure column."}}}},rows:{type:"array",items:{type:"array",items:{type:"string"}},description:"One array per row, each EXACTLY as long as columns. A short row is refused: a table that loses its last column loses data."}}},notice:{type:"object",required:["kind","tone","text"],additionalProperties:false,properties:{kind:{const:"notice"},tone:{enum:["note","warning","important"]},title:{type:"string"},text:{type:"string"}}},figure:{type:"object",required:["kind","caption"],additionalProperties:false,properties:{kind:{const:"figure"},caption:{type:"string",description:"Required. An uncaptioned exhibit cannot be cited from the text that relies on it."},src:{type:"string",description:"Reference the host resolves. Never a data URI."},placeholder:{type:"string",description:"Text stand-in when src is absent, so a figure never renders empty."}}},execution:{type:"object",required:["kind","signatories"],additionalProperties:false,properties:{kind:{const:"execution"},label:{type:"string"},attestation:{type:"string",description:"The attestation clause, as running text."},signatories:{type:"array",minItems:1,items:{type:"object",required:["role"],additionalProperties:false,properties:{role:{type:"string",description:'Capacity: "Testator", "Witness", "Grantor".'},name:{type:"string",description:"Printed BELOW the signing rule, never on it."},detail:{type:"string"},dated:{type:"boolean",description:"Add a second, shorter rule for the date."}}}},columns:{enum:[1,2]},note:{type:"string"}}}},Tn=["md","lg","xl"],En=5;function Dn(e2){let t2=Tn.indexOf(e2);return t2>0?Tn[t2-1]:e2}var On=e2=>typeof e2=="object"&&!!e2&&"format"in e2&&"value"in e2;function kn(e2){let t2=Number(e2);return Number.isFinite(t2)?Math.max(0,Math.min(100,t2)):0}function An({value:e2,label:r2,size:i2="lg",tone:a2,progress:o2,progressLabel:s2,autoStepDown:c2=true,className:l2,style:u2}){let d2=On(e2)?X(e2):e2,f2=typeof d2=="string"||typeof d2=="number"?String(d2).length:0,p2=c2&&f2>En?Dn(i2):i2,m2=B(a2,"strong"),{toned:h2,...g2}=ee(m2),v2=o2==null?null:kn(o2);return n("div",{className:_("core-stat",h2&&"core-toned",l2),...g2,"data-size":p2,style:u2,children:[t("div",{className:"core-stat__value",children:d2}),r2!=null&&t(V,{className:"core-stat__label",tone:m2==="on-dark"||m2==="inherit"?m2:"subtle",children:r2}),v2!==null&&t("div",{className:"core-stat__progress",role:"progressbar","aria-label":s2??(typeof r2=="string"?r2:"Progress"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":v2,style:y({"--core-stat-progress":`${v2}%`}),children:t("div",{className:"core-stat__progress-fill"})})]})}function jn({children:e2,minColumnWidth:n2=200,maxColumns:r2=4,gap:i2=32,className:a2,style:o2}){return t("div",{className:_("core-stat-group",a2),style:y({"--core-stat-group-min":`${n2}px`,"--core-stat-group-max":String(Math.max(1,r2)),"--core-stat-group-gap":`${i2}px`},o2),children:e2})}var Mn={up:[0,28],left:[-40,0],right:[40,0],none:[0,0]};function Nn({direction:e2="up",delay:n2=0,duration:r2=.5,threshold:i2=.15,once:a2=true,className:o2,style:s2,children:l2}){let u2=p(null),[d2,f2]=m(false);c(()=>{let e3=u2.current;if(!e3)return;if(typeof IntersectionObserver>"u"){f2(true);return}let t2=new IntersectionObserver(e4=>{let n3=e4[e4.length-1];n3&&(n3.isIntersecting?(f2(true),a2&&t2.disconnect()):a2||f2(false))},{threshold:Math.min(1,Math.max(0,i2))});return t2.observe(e3),()=>t2.disconnect()},[a2,i2]);let[h2,g2]=Mn[e2];return t("div",{ref:u2,className:_("core-reveal",o2),"data-revealed":d2?"true":"false",style:y({"--core-reveal-x":`${h2}px`,"--core-reveal-y":`${g2}px`,"--core-reveal-duration":`${r2}s`,"--core-reveal-delay":`${n2}s`},s2),children:l2})}function Pn({eyebrow:e2,title:r2,description:i2,trailing:a2,revealDelay:o2=0,className:s2,style:c2}){return t(Nn,{direction:"up",delay:o2,className:_("core-section-header",s2),style:c2,children:n("div",{className:"core-section-header__inner","data-described":i2?"true":void 0,children:[n("div",{className:"core-section-header__text",children:[e2?t(V,{className:"core-section-header__eyebrow",children:e2}):null,t("h2",{className:"core-section-header__title",children:r2}),i2?t("p",{className:"core-section-header__description",children:i2}):null]}),a2!=null&&a2!==""?t("div",{className:"core-section-header__trailing",children:a2}):null]})})}function Fn({tone:e2,label:r2,headline:i2,children:a2,trailing:o2,className:s2,style:c2}){let l2=R(e2,"accent"),u2=o2!=null&&o2!=="";return n("div",{className:_("core-highlight-box","core-toned",s2),"data-tone":l2,style:c2,children:[n("div",{className:"core-highlight-box__text",children:[r2?t("div",{className:"core-highlight-box__label",children:r2}):null,i2?t("div",{className:"core-highlight-box__headline",children:i2}):null,a2!=null&&a2!==""?t("div",{className:"core-highlight-box__body",children:a2}):null]}),u2?t("div",{className:"core-highlight-box__trailing",children:o2}):null]})}function In({label:r2,children:i2,className:a2,style:o2}){return n("div",{className:_("core-disclaimer-block",a2),style:o2,children:[r2?n(e,{children:[t("strong",{className:"core-disclaimer-block__label",children:r2})," "]}):null,i2]})}function Ln(e2){let t2=Number(e2);return Number.isFinite(t2)?Math.max(0,Math.min(100,t2)):0}function Rn({label:e2,value:r2,fillPercent:i2,subtitle:a2,tone:o2,className:s2,style:c2}){let l2=Ln(i2);return n("div",{className:_("core-stat-strip","core-toned",s2),"data-tone":R(o2,"info"),style:y({"--core-stat-strip-fill":`${l2}%`},c2),children:[n("div",{className:"core-stat-strip__row",children:[t("span",{className:"core-stat-strip__label",children:e2}),t("span",{className:"core-stat-strip__value",children:X(r2)})]}),t("div",{className:"core-stat-strip__track",children:t("div",{className:"core-stat-strip__fill"})}),a2?t("div",{className:"core-stat-strip__subtitle",children:X(a2)}):null]})}function zn({text:e2,tone:n2,className:r2}){return t("span",{className:_("core-value-badge","core-toned",r2),"data-tone":R(n2),children:X(e2)})}var Bn=8,Vn={good:"success",warn:"warning",critical:"danger"};function Hn(e2,t2,n2){let r2={series:String(n2%Bn+1)},i2=e2??t2;if(typeof i2!="string"||i2==="")return r2;if(i2==="muted")return{series:"muted"};let a2=/^series-([1-9]\d*)$/.exec(i2);if(a2)return{series:String((Number(a2[1])-1)%Bn+1)};let o2=Vn[i2];return o2?{tone:o2}:I.includes(i2)?{tone:i2}:(F("OptionCard:colour",`[OptionCard] bar fill "${i2}" is not a tone or a series slot; using the chart series by position. Name a tone (success, danger, …) or a slot (series-1…series-8).`),r2)}function Un(e2){return typeof e2=="number"&&Number.isFinite(e2)?{text:String(e2).padStart(2,"0"),kind:"numeral"}:typeof e2!="string"||e2.trim()===""?null:/^\d+$/.test(e2.trim())?{text:e2.trim().padStart(2,"0"),kind:"numeral"}:{text:e2,kind:"label"}}function Wn(e2){let{number:r2,title:i2,description:a2,badgeText:o2,badgeTone:s2,bars:c2,tone:l2,isSelected:u2=false,className:d2,style:f2}=e2,p2=Array.isArray(c2)?c2:[],m2=Un(r2);return n("div",{className:_("core-option-card",d2),"data-selected":u2?"true":void 0,"data-described":a2?"true":void 0,style:f2,children:[n("div",{className:"core-option-card__head",children:[m2?t("div",{className:"core-option-card__number","data-kind":m2.kind,children:m2.text}):t("span",{}),o2!=null&&o2!==""?t(zn,{text:o2,tone:R(s2)}):null]}),i2?t("div",{className:"core-option-card__title",children:i2}):null,a2?t("p",{className:"core-option-card__description",children:a2}):null,p2.map((e3,r3)=>{let i3=Hn(e3.tone,l2,r3),a3=Math.min(100,Math.max(0,Number(e3.fillPercent)||0)),o3=e3.valueTone===void 0||e3.valueTone==="default"?void 0:R(e3.valueTone);return n("div",{className:"core-option-card__bar",children:[n("div",{className:"core-option-card__bar-head",children:[t("span",{className:"core-option-card__bar-label",children:e3.label}),t("span",{className:_("core-option-card__bar-value",o3&&"core-toned"),"data-tone":o3,children:X(e3.value)})]}),t("div",{className:"core-option-card__track",children:t("div",{className:_("core-option-card__fill","tone"in i3&&"core-toned"),"data-tone":"tone"in i3?i3.tone:void 0,"data-series":"series"in i3?i3.series:void 0,style:y({"--core-option-card-fill":`${a3}%`})})})]},r3)})]})}function Gn(e2){let{title:r2,subtitle:i2,rows:a2,className:o2,style:s2}=e2,c2=e2.tone??"info",l2=c2==="none",u2=Array.isArray(a2)?a2:[];return n("div",{className:_("core-profile-card",!l2&&"core-toned",o2),"data-tone":l2?void 0:R(c2,"info"),"data-marker":l2?"none":void 0,style:s2,children:[n("div",{className:"core-profile-card__head",children:[t("div",{className:"core-profile-card__title",children:r2}),i2?t("div",{className:"core-profile-card__subtitle",children:i2}):null]}),u2.map((e3,r3)=>n("div",{className:"core-profile-card__row",children:[t("span",{className:"core-profile-card__label",children:e3.label}),n("div",{className:"core-profile-card__end",children:[t("span",{className:"core-profile-card__value",children:X(e3.value)}),e3.badge?t(zn,{text:e3.badge.text,tone:R(e3.badge.tone)}):null]})]},r3))]})}function Kn(e2){if(typeof e2=="string"){let t2=e2.trim();return t2.startsWith("+")?"up":t2.startsWith("-")||t2.startsWith("−")?"down":"flat"}return e2&&typeof e2=="object"&&typeof e2.value=="number"?e2.value>0?"up":e2.value<0?"down":"flat":"flat"}var qn={up:"▲",down:"▼",flat:"—"},Jn={up:"success",down:"danger",flat:void 0},Z=e2=>e2!=null&&e2!=="";function Yn(e2){let{columns:r2=4,gap:i2="tight",minColumnWidth:a2,className:o2,style:s2}=e2,c2=Array.isArray(e2.cards)?e2.cards:[],l2=Math.max(1,Math.min(6,Math.round(Number(r2))||4));return t("div",{className:_("core-kpi-card-grid",o2),"data-gap":i2==="normal"?"normal":"tight",style:y({"--core-kpi-card-grid-columns":String(l2),"--core-kpi-card-grid-min":typeof a2=="number"&&a2>0?`${a2}px`:void 0},s2),children:c2.map((e3,r3)=>{let{subtitle:i3,badge:a3}=e3,o3=Z(e3.tone)?R(e3.tone):void 0,s3=Z(e3.delta)?Kn(e3.delta):void 0,c3=s3?Jn[s3]:void 0;return t(Nn,{direction:"up",delay:r3*.06,className:"core-kpi-card-grid__item",children:n("div",{className:_("core-kpi-card-grid__card",o3&&"core-toned"),"data-tone":o3,children:[n("div",{className:"core-kpi-card-grid__head",children:[t("div",{className:"core-kpi-card-grid__label",children:e3.label}),a3&&Z(a3.text)?t(zn,{text:a3.text,tone:R(a3.tone)}):null]}),t("div",{className:"core-kpi-card-grid__value",children:X(e3.value)}),s3?n("div",{className:_("core-kpi-card-grid__delta",c3&&"core-toned"),"data-tone":c3,"data-direction":s3,children:[t("span",{"aria-hidden":"true",children:qn[s3]})," ",X(e3.delta)]}):null,Z(i3)?t("div",{className:"core-kpi-card-grid__subtitle",children:X(i3)}):null]})},r3)})})}function Xn(e2){if(typeof e2=="string"&&e2!==""&&e2!=="default")return R(e2)}var Zn=e2=>!!(e2&&typeof e2=="object"&&"value"in e2&&"format"in e2),Qn=e2=>!!(e2&&typeof e2=="object"&&!Array.isArray(e2)&&!a(e2)&&"value"in e2&&!("format"in e2));function $n(e2){return Qn(e2)?e2:{value:e2}}var er=/^\d{4}-\d{2}-\d{2}$/,tr=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}(?::?\d{2})?)?)?$/;function nr(e2,t2){if(!tr.test(e2))return e2;let n2=er.test(e2),r2=new Date(n2?`${e2}T00:00:00Z`:e2.replace(" ","T"));return Number.isNaN(r2.getTime())?e2:r2.toLocaleString("en-CA",{year:"numeric",month:"short",day:"numeric",...t2==="datetime"&&!n2?{hour:"numeric",minute:"2-digit"}:{},...n2?{timeZone:"UTC"}:{}})}function rr(e2){if(!/^[a-z][a-z0-9]*([_-][a-z0-9]+)+$/.test(e2))return e2;let t2=e2.replace(/[_-]+/g," ");return t2[0].toUpperCase()+t2.slice(1)}function ir(e2,t2){return typeof e2=="string"&&t2==="raw"?e2:typeof e2=="string"&&t2?nr(e2,t2):typeof e2=="string"&&!t2?X(rr(e2)):typeof e2=="string"||Zn(e2)?X(e2):typeof e2=="number"?String(e2):a(e2)?e2:null}function ar({title:e2,subtitle:r2,columns:i2,rows:a2,className:o2,style:s2}){let c2=`${l()}-title`,u2=Array.isArray(i2)?i2:[],d2=Array.isArray(a2)?a2:[],f2=e3=>u2[e3]?.align??(e3===0?"left":"right");return t(Nn,{direction:"up",children:n("div",{className:_("core-data-table",o2),style:s2,children:[e2||r2?n("div",{className:"core-data-table__head",children:[e2?t("div",{id:c2,className:"core-data-table__title",children:e2}):null,r2?t("div",{className:"core-data-table__subtitle",children:r2}):null]}):null,t("div",{className:"core-data-table__scroll",role:"region","aria-label":e2?void 0:"Data table, scrollable","aria-labelledby":e2?c2:void 0,tabIndex:0,children:n("table",{className:"core-data-table__table",children:[t("thead",{children:t("tr",{children:u2.map((e3,r3)=>n("th",{scope:"col",className:"core-data-table__col","data-align":f2(r3),style:y({"--core-data-table-min":typeof e3.minWidth=="number"&&e3.minWidth>0?`${e3.minWidth}px`:void 0}),children:[e3.header,e3.sublabel?t("span",{className:"core-data-table__sublabel",children:e3.sublabel}):null]},r3))})}),t("tbody",{children:d2.map((e3,n2)=>{let{highlighted:r3,total:i3}=e3,a3=e3.cells,o3=Array.isArray(a3)?a3:a3&&typeof a3=="object"?u2.map(e4=>a3[e4.key]):[];return t("tr",{className:"core-data-table__row","data-highlighted":r3?"true":void 0,"data-total":i3?"true":void 0,children:o3.map((e4,n3)=>{let r4=$n(e4),i4=Xn(r4.tone),a4={className:_("core-data-table__cell",i4&&"core-toned"),"data-align":f2(n3),"data-tone":i4};return n3===0?t("th",{scope:"row",...a4,children:ir(r4.value,u2[n3]?.format)},n3):t("td",{...a4,children:ir(r4.value,u2[n3]?.format)},n3)})},n2)})})]})})]})})}function or(e2,t2,n2){return e2.cardComponent&&typeof t2=="function"?t2(e2.cardComponent,{...n2,event:e2})??null:null}var sr=["accepted","tentative","declined"],cr=(e2,t2)=>new Intl.DateTimeFormat(e2,{weekday:"short",month:"short",day:"numeric",timeZone:t2}),lr=(e2,t2)=>new Intl.DateTimeFormat(e2,{hour:"numeric",minute:"2-digit",timeZone:t2});function ur(e2,t2,n2){if(e2.startOn){let n3=new Date(`${e2.startOn}T00:00:00Z`),r3=cr(t2,"UTC").format(n3);if(!e2.endOn)return`${r3} (all day)`;let i3=new Date(new Date(`${e2.endOn}T00:00:00Z`).getTime()-864e5);return i3.getTime()<=n3.getTime()?`${r3} (all day)`:`${r3} – ${cr(t2,"UTC").format(i3)}`}if(!e2.startsAt)return"";let r2=new Date(e2.startsAt);if(Number.isNaN(r2.getTime()))return"";let i2=cr(t2,n2).format(r2),a2=lr(t2,n2).format(r2);if(!e2.endsAt)return`${i2} · ${a2}`;let o2=new Date(e2.endsAt);return Number.isNaN(o2.getTime())||o2.getTime()===r2.getTime()?`${i2} · ${a2}`:`${i2} · ${a2} – ${lr(t2,n2).format(o2)}`}var dr=()=>Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";function fr(e2){if(!e2)return;let t2=new Date(e2);return Number.isNaN(t2.getTime())?void 0:t2.toISOString()}function pr(){let e2=new Date;return e2.setMinutes(e2.getMinutes()-e2.getTimezoneOffset()),e2.toISOString().slice(0,16)}function mr(e2){return e2.success?"":e2.code==="DENIED"?"You can't do that here.":e2.code==="CONFLICT"?"Someone changed this first. Reload and try again.":e2.code==="INVALID"?e2.errors||"Some details are missing or not valid.":e2.errors||"Something went wrong. Try again."}function hr(e2,t2){let n2=typeof e2=="string"?new Date(e2):e2;return new Intl.DateTimeFormat("en-CA",{timeZone:t2,year:"numeric",month:"2-digit",day:"2-digit"}).format(n2)}function Q(e2,t2){let n2=new Date(`${e2}T00:00:00Z`);return n2.setUTCDate(n2.getUTCDate()+t2),n2.toISOString().slice(0,10)}function gr(e2){return Q(e2,-((new Date(`${e2}T00:00:00Z`).getUTCDay()+6)%7))}function _r(e2,t2){if(e2.startOn){let t3=e2.endOn&&e2.endOn>e2.startOn?e2.endOn:Q(e2.startOn,1),n2=[];for(let r2=e2.startOn;r2<t3&&n2.length<62;r2=Q(r2,1))n2.push(r2);return n2}return e2.startsAt?[hr(e2.startsAt,t2)]:[]}var $=(e2,t2)=>e2&&t2?e2.split("{id}").join(encodeURIComponent(t2)):void 0;function vr(r2){let{event:i2,href:a2,locale:o2,timeZone:s2,className:c2,style:l2}=r2,u2=i2&&typeof i2=="object"?i2:{name:""},d2=ur(u2,o2,s2),f2=u2.status&&u2.status!=="confirmed"?u2.status:void 0,p2=n(e,{children:[n("div",{className:"core-event-card__top",children:[u2.typeName?t("span",{className:"core-event-card__type",children:u2.typeName}):null,f2?t("span",{className:"core-event-card__status","data-status":f2,children:f2}):null]}),t("div",{className:"core-event-card__name",children:u2.name}),d2?t("div",{className:"core-event-card__when",children:d2}):null,u2.location?t("div",{className:"core-event-card__where",children:u2.location}):null]});return t("div",{className:_("core-event-card",c2),"data-kind":u2.kind,"data-status":u2.status,style:l2,children:a2?t("a",{className:"core-event-card__link",href:a2,children:p2}):p2})}var yr={accepted:"Accept",tentative:"Maybe",declined:"Decline"};function br(e2){let{actions:r2,className:i2,style:a2}=e2,[o2,s2]=m(e2.response),[c2,l2]=m(false),[u2,d2]=m(""),f2=r2?.respond,p2=async e3=>{if(!f2||c2)return;l2(true),d2("");let t2=await f2({response:e3});l2(false),t2.success?s2(e3):d2(mr(t2))};return n("div",{className:_("core-event-respond",i2),style:a2,children:[t("div",{className:"core-event-respond__choices",role:"group","aria-label":"Your response",children:sr.map(e3=>t("button",{type:"button",className:"core-event-respond__choice","aria-pressed":o2===e3,disabled:!f2||c2,onClick:()=>void p2(e3),children:yr[e3]},e3))}),u2?t("p",{className:"core-event-respond__message",role:"alert",children:u2}):null]})}function xr(e2){let{event:r2,actions:i2,viewerResponse:a2,locale:o2,timeZone:s2,className:c2,style:l2}=e2,u2=r2&&typeof r2=="object"?r2:{name:""},d2=Array.isArray(e2.notes)?e2.notes:[],f2=Array.isArray(e2.participants)?e2.participants:[],p2=ur(u2,o2,s2);return n("article",{className:_("core-event-detail",c2),"data-status":u2.status,style:l2,children:[n("header",{className:"core-event-detail__head",children:[u2.typeName?t("div",{className:"core-event-detail__type",children:u2.typeName}):null,t("h2",{className:"core-event-detail__name",children:u2.name}),p2?t("div",{className:"core-event-detail__meta",children:p2}):null,u2.location?t("div",{className:"core-event-detail__meta",children:u2.location}):null,u2.status&&u2.status!=="confirmed"?t("div",{className:"core-event-detail__status",children:u2.status}):null]}),a2===void 0?null:t(br,{response:a2,actions:i2,className:"core-event-detail__respond"}),f2.length?n("section",{className:"core-event-detail__section","aria-label":"Participants",children:[t("h3",{className:"core-event-detail__heading",children:"Participants"}),t("ul",{className:"core-event-detail__list",children:f2.map((e3,r3)=>n("li",{className:"core-event-detail__person",children:[t("span",{children:e3.name}),t("span",{className:"core-event-detail__muted",children:[e3.role,e3.response&&e3.response!=="needs_action"?e3.response:void 0].filter(Boolean).join(" · ")})]},r3))})]}):null,d2.length?n("section",{className:"core-event-detail__section","aria-label":"Notes",children:[t("h3",{className:"core-event-detail__heading",children:"Notes"}),d2.map((e3,r3)=>n("div",{className:"core-event-detail__note","data-audience":e3.audience,children:[e3.audience==="staff"?t("div",{className:"core-event-detail__badge",children:"Staff only"}):null,t("p",{className:"core-event-detail__body",children:e3.body}),e3.author||e3.createdAt?t("div",{className:"core-event-detail__muted",children:[e3.author,e3.createdAt?new Date(e3.createdAt).toLocaleString(o2,{timeZone:s2}):void 0].filter(Boolean).join(" · ")}):null]},r3))]}):null]})}var Sr=e2=>{let t2=e2?.dataSchema?.properties??{},n2=new Set(e2?.dataSchema?.required??[]);return Object.entries(t2).map(([e3,t3])=>[e3,t3,n2.has(e3)])};function Cr(e2){let{orgId:r2,projectId:i2,actions:a2,onDone:o2,canWriteStaffNotes:s2,className:c2,style:u2}=e2,f2=Array.isArray(e2.types)?e2.types:[],p2=l(),[h2,g2]=m(e2.defaultTypeId??f2[0]?.id??""),v2=f2.find(e3=>e3.id===h2),y2=v2?.kind==="scheduled",[b2,x2]=m(""),[S2,C2]=m(pr()),[w2,T2]=m(""),[E2,D2]=m(""),[O2,k2]=m({}),[A2,j2]=m(""),[M2,N2]=m(!!s2),[P2,F2]=m(false),[I2,L2]=m(""),R2=d(()=>Sr(v2),[v2]);if(!f2.length)return t("p",{className:_("core-event-log","core-event-log__empty",c2),style:u2,children:"There's nothing you can log here."});let z2=async t2=>{if(t2.preventDefault(),!a2?.logEvent||P2||!v2)return;F2(true),L2("");let n2=fr(S2),c3={event_type_id:v2.id,org_id:r2,name:b2.trim()||v2.name,starts_at:n2,tzid:dr(),data:O2,subjects:e2.subjects?[...e2.subjects]:[]};i2&&(c3.project_id=i2),y2&&w2&&(c3.ends_at=fr(w2)),E2.trim()&&(c3.location=E2.trim());let l2=A2.trim()?[{body:A2.trim(),audience:s2&&M2?"staff":"shared"}]:void 0,u3=await a2.logEvent(l2?{event:c3,notes:l2}:{event:c3});F2(false),u3.success?(x2(""),j2(""),k2({}),o2?.(u3)):L2(mr(u3))},B2=(e3,t2)=>k2(n2=>({...n2,[e3]:t2}));return n("form",{className:_("core-event-log",c2),style:u2,onSubmit:e3=>void z2(e3),children:[n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:"Type"}),t("select",{value:h2,onChange:e3=>{g2(e3.target.value),k2({})},children:f2.map(e3=>t("option",{value:e3.id,children:e3.name},e3.id))})]}),n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:"Title"}),t("input",{value:b2,onChange:e3=>x2(e3.target.value),placeholder:v2?.name})]}),n("div",{className:"core-event-log__row",children:[n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:y2?"Starts":"When"}),t("input",{type:"datetime-local",required:true,value:S2,onChange:e3=>C2(e3.target.value)})]}),y2?n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:"Ends"}),t("input",{type:"datetime-local",value:w2,min:S2,onChange:e3=>T2(e3.target.value)})]}):null]}),n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:"Where"}),t("input",{value:E2,onChange:e3=>D2(e3.target.value)})]}),R2.map(([e3,r3,i3])=>{let a3=r3.title??e3;if(r3.enum)return n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:a3}),n("select",{required:i3,value:String(O2[e3]??""),onChange:t2=>B2(e3,t2.target.value||void 0),children:[t("option",{value:"",children:"—"}),r3.enum.map(e4=>t("option",{value:e4,children:e4},e4))]})]},e3);if(r3.type==="boolean")return n("label",{className:"core-event-log__check",children:[t("input",{type:"checkbox",checked:!!O2[e3],onChange:t2=>B2(e3,t2.target.checked)}),t("span",{children:a3})]},e3);let o3=r3.type==="number"||r3.type==="integer";return n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:a3}),t("input",{type:o3?"number":"text",step:r3.type==="integer"?1:"any",required:i3,value:O2[e3]===void 0?"":String(O2[e3]),onChange:t2=>B2(e3,t2.target.value===""?void 0:o3?Number(t2.target.value):t2.target.value)})]},e3)}),n("label",{className:"core-event-log__field",children:[t("span",{className:"core-event-log__label",children:"Note"}),t("textarea",{rows:3,value:A2,onChange:e3=>j2(e3.target.value)})]}),s2&&A2.trim()?n("label",{className:"core-event-log__check",children:[t("input",{type:"checkbox",checked:M2,onChange:e3=>N2(e3.target.checked)}),t("span",{children:"Staff only: the client won't see this note"})]}):null,I2?t("p",{id:`${p2}-error`,className:"core-event-log__message",role:"alert",children:I2}):null,t("div",{className:"core-event-log__actions",children:t("button",{type:"submit",className:"core-event-log__submit",disabled:P2||!a2?.logEvent,children:P2?"Saving…":y2?"Schedule":"Log"})})]})}var wr=(e2,t2)=>new Intl.DateTimeFormat(t2,{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"}).format(new Date(`${e2}T00:00:00Z`));function Tr(e2){let{view:r2="week",weekParam:i2="week",eventHref:a2="?panel=event:{id}",locale:o2,timeZone:s2,renderComponent:c2,className:l2,style:u2}=e2,d2=Array.isArray(e2.occurrences)?e2.occurrences:[],f2=hr(new Date,s2),p2=gr(/^\d{4}-\d{2}-\d{2}$/.test(e2.weekOf??"")?e2.weekOf:f2),m2=Array.from({length:7},(e3,t2)=>Q(p2,t2)),h2=new Map(m2.map(e3=>[e3,[]]));for(let e3 of d2)for(let t2 of _r(e3,s2))h2.get(t2)?.push(e3);for(let e3 of h2.values())e3.sort((e4,t2)=>+!e4.startOn-!t2.startOn||(e4.startsAt??"").localeCompare(t2.startsAt??""));let g2=r2==="agenda"?m2.filter(e3=>h2.get(e3).length):m2;return n("section",{className:_("core-event-schedule",l2),"data-view":r2,style:u2,"aria-label":"Schedule",children:[n("div",{className:"core-event-schedule__nav",children:[t("a",{className:"core-event-schedule__step",href:`?${i2}=${Q(p2,-7)}`,"aria-label":"Previous week",children:"‹"}),t("span",{className:"core-event-schedule__range",children:`${wr(m2[0],o2)} – ${wr(m2[6],o2)}`}),t("a",{className:"core-event-schedule__step",href:`?${i2}=${Q(p2,7)}`,"aria-label":"Next week",children:"›"})]}),g2.length===0?t("p",{className:"core-event-schedule__empty",children:"Nothing scheduled this week."}):null,t("ol",{className:"core-event-schedule__days",children:g2.map(e3=>{let r3=h2.get(e3);return n("li",{className:"core-event-schedule__day","data-today":e3===f2||void 0,children:[t("h3",{className:"core-event-schedule__date",children:wr(e3,o2)}),r3.length?t("ul",{className:"core-event-schedule__events",children:r3.map((e4,n2)=>t("li",{children:or(e4,c2,{href:$(a2,e4.id),locale:o2,timeZone:s2})??t(vr,{event:e4,href:$(a2,e4.id),locale:o2,timeZone:s2})},`${e4.id??n2}-${e4.startsAt??e4.startOn??n2}`))}):t("p",{className:"core-event-schedule__none",children:"—"})]},e3)})})]})}var Er=(e2,t2)=>new Intl.DateTimeFormat(t2,{weekday:"long",month:"long",day:"numeric",year:"numeric",timeZone:"UTC"}).format(new Date(`${e2}T00:00:00Z`));function Dr(e2){let{eventHref:r2="?panel=event:{id}",emptyText:i2="No activity yet.",locale:a2,timeZone:o2,renderComponent:s2,className:c2,style:l2}=e2,u2=[...(Array.isArray(e2.items)?e2.items:[]).filter(e3=>e3&&!Number.isNaN(new Date(e3.at).getTime()))].sort((e3,t2)=>new Date(t2.at).getTime()-new Date(e3.at).getTime()),d2=[];for(let e3 of u2){let t2=hr(e3.at,o2),n2=d2[d2.length-1];n2&&n2[0]===t2?n2[1].push(e3):d2.push([t2,[e3]])}let f2=new Intl.DateTimeFormat(a2,{hour:"numeric",minute:"2-digit",timeZone:o2});return n("section",{className:_("core-event-timeline",c2),style:l2,"aria-label":"Activity",children:[d2.length===0?t("p",{className:"core-event-timeline__empty",children:i2}):null,d2.map(([e3,i3])=>n("section",{className:"core-event-timeline__day",children:[t("h3",{className:"core-event-timeline__date",children:Er(e3,a2)}),t("ol",{className:"core-event-timeline__items",children:i3.map((e4,i4)=>n("li",{className:"core-event-timeline__item","data-op":e4.op||void 0,children:[n("div",{className:"core-event-timeline__line",children:[t("time",{className:"core-event-timeline__time",dateTime:e4.at,children:f2.format(new Date(e4.at))}),e4.summary?t("span",{className:"core-event-timeline__summary",children:e4.summary}):null,e4.actor?t("span",{className:"core-event-timeline__actor",children:e4.actor}):null]}),e4.event?or(e4.event,s2,{href:$(r2,e4.event.id),locale:a2,timeZone:o2})??t(vr,{event:e4.event,href:$(r2,e4.event.id),locale:a2,timeZone:o2}):null]},e4.id??`${e4.at}-${i4}`))})]},e3))]})}export{Kt as ANSWER_COLUMN_PX,Le as Accordion,qt as AnswerRows,bt as Aside,ae as Avatar,dt as BLOCK_KINDS,wn as BLOCK_SCHEMAS,we as Badge,b as Box,Me as Button,Re as Card,x as Center,de as Checkbox,fe as CheckboxGroup,Ne as Chip,oe as Code,Be as Columns,Zt as ComparisonBars,S as Container,_n as Contents,tt as DEFAULT_PROFILE_ID,ar as DataTable,pe as DateRange,Ct as Definition,In as DisclaimerBlock,He as Disclosure,C as Divider,xn as DocumentBlocks,Lt as DocumentLabel,Cn as DocumentSection,hn as DocumentShell,Wt as DocumentTable,Te as EmptyState,vr as EventCard,xr as EventDetail,Cr as EventLogForm,br as EventRespond,Tr as EventSchedule,Dr as EventTimeline,yn as ExecutionBlock,V as Eyebrow,Ft as Figure,he as FileField,Pt as Footnote,H as FormField,Ue as Grid,ce as Heading,w as Hide,Fn as HighlightBox,Pe as IconButton,T as Inline,Yn as KpiCardGrid,Fe as Link,M as ListRow,un as Masthead,kt as Math,fn as MetaRail,en as NextSteps,nn as Notes,De as Notice,Wn as OptionCard,Ge as PAGINATOR_BINDINGS,It as PageBreak,N as PageFrame,te as PageHead,Gn as ProfileCard,Oe as Progress,xt as Prose,St as Quote,ge as RadioGroup,Ut as Reference,We as Repeat,Gt as RowList,ne as RuleSection,mn as RunningFooter,ye as SearchField,Pn as SectionHeader,Ie as SegmentedControl,be as Select,E as Show,ke as Skeleton,an as SkippedSection,xe as Slider,D as Spacer,Ae as Spinner,Ve as Split,O as Stack,An as Stat,jn as StatGroup,Rn as StatStrip,Se as Switch,I as TONES,sn as TalkItThrough,ue as Text,Ce as TextArea,ve as TextField,je as Tooltip,re as UnderlinedAction,cn as WRITE_HEIGHT_PX,tn as WRITE_LINE_HEIGHT_PX,ln as WriteInField,_ as cx,et as documentProfiles,ur as eventWhen,me as fileSize,Yt as formatValue,ie as initialsOf,B as inkToneOf,v as length,ut as profileCss,Ze as profileIds,ct as profileTokens,Xe as registerProfile,X as renderFormatted,Qe as resolveProfile,$e as resolvedProfiles,_e as toNumber,R as toneOf,or as typeCard,y as vars};