@photon-ai/pho-ui 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1606 @@
1
+ "use client";
2
+ import { t as p } from "./cn-ChIgwEl3.js";
3
+ import { n as Me } from "./link-provider-DXzDQ08N.js";
4
+ import { FADE_ENTRANCE as rt, FADE_SWAP as it, SPRING_ENTRANCE as st, TRAVEL_LINEAR as lt, fadeThroughBlur as ee } from "../motion.js";
5
+ import { a as ie, o as pe } from "./button-CdqS_t5a.js";
6
+ import { t as ot } from "./createReactComponent-BqCmnqfX.js";
7
+ import { t as ct } from "./error-D0yoFxCv.js";
8
+ import { t as ne } from "./IconChevronLeft-CSWMKQ4C.js";
9
+ import { a as fe, i as ut, n as dt, r as pt, s as ft } from "./data-table-CHLJfGkS.js";
10
+ import { t as Ee } from "./IconSearch-BKAHkLyX.js";
11
+ import { t as mt } from "./IconX-pZ9vrtSr.js";
12
+ import { t as ht } from "./toast-iSf6NuAS.js";
13
+ import { t as le } from "./input-group-fc9_jD4d.js";
14
+ import { t as gt } from "./animated-height-CCO-Ocoz.js";
15
+ import { n as De, t as Q } from "./scroll-area-BO-9PMM7.js";
16
+ import { i as vt } from "./checkbox-CLPmblNA.js";
17
+ import { t as bt } from "./form-AiHbbw4m.js";
18
+ import { i as W } from "./menu-BQeprfxB.js";
19
+ import { Children as Y, Fragment as yt, createContext as z, isValidElement as He, useCallback as Fe, useContext as R, useEffect as O, useId as xt, useLayoutEffect as V, useMemo as $, useRef as E, useState as w, useSyncExternalStore as me } from "react";
20
+ import { Fragment as he, jsx as t, jsxs as y } from "react/jsx-runtime";
21
+ import { AnimatePresence as G, motion as N, useIsPresent as wt, useReducedMotion as L } from "motion/react";
22
+ import { Dialog as te } from "@base-ui/react/dialog";
23
+ import { createPortal as Ce } from "react-dom";
24
+ var Nt = [["path", {
25
+ d: "M9 6l6 6l-6 6",
26
+ key: "svg-0"
27
+ }]], At = ot("outline", "chevron-right", "ChevronRight", Nt), ge = "rounded-base border border-pho-secondary bg-pho-primary", ae = "divide-y divide-pho-secondary [&>:has(+[data-basic-page-alert])]:border-b-0", Ge = `${ge} ${ae}`, _e = "flex min-w-0 flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5", Et = "flex min-h-[4.25rem] min-w-0 flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6", Ct = "flex flex-col gap-3 px-5 py-4", _t = "-mx-5 -mb-4 flex items-center rounded-b-[calc(0.75rem-1px)] bg-pho-secondary py-1 pr-3 pl-5", kt = "-mx-2 -mt-1.5 flex items-center rounded-sm bg-pho-secondary px-2 py-0.5", T = st, M = rt, j = 12, St = 768;
28
+ function Rt(e) {
29
+ return Math.round(Math.min(Math.max(e * 0.4, 320), 448));
30
+ }
31
+ var ze = z(null), Ve = z(null);
32
+ function Tt(e) {
33
+ const [n, a] = w(null), [r, s] = w(!1), [l, c] = w(!1), [o, i] = w(() => ({
34
+ width: typeof window > "u" ? 0 : window.innerWidth,
35
+ height: null
36
+ }));
37
+ return V(() => {
38
+ const d = e.current;
39
+ if (!r || d == null) return;
40
+ const f = we(d), u = () => {
41
+ const h = d.offsetWidth, v = f?.clientHeight ?? null;
42
+ i((g) => g.width === h && g.height === v ? g : {
43
+ width: h,
44
+ height: v
45
+ });
46
+ };
47
+ if (u(), typeof ResizeObserver > "u") return;
48
+ const m = new ResizeObserver(u);
49
+ return m.observe(d), f != null && m.observe(f), () => m.disconnect();
50
+ }, [e, r]), {
51
+ host: $(() => ({
52
+ slot: n,
53
+ presentation: o.width >= St ? "panel" : "page",
54
+ width: Rt(o.width),
55
+ paneHeight: o.height,
56
+ setOpen: c,
57
+ setPresent: s
58
+ }), [n, o]),
59
+ setSlot: a,
60
+ open: l
61
+ };
62
+ }
63
+ function Pt(e) {
64
+ return e == null ? window.scrollY : e.scrollTop;
65
+ }
66
+ function ke(e, n) {
67
+ e == null ? window.scrollTo({ top: n }) : e.scrollTop = n;
68
+ }
69
+ function It({ condense: e = !0, width: n, className: a, children: r, ref: s, ...l }) {
70
+ const c = R(se)?.adopt ?? !1, o = R(Ve), [i, d] = w(!1), f = E(0), u = Fe((H) => {
71
+ f.current += H ? 1 : -1, d(f.current > 0);
72
+ }, []), m = n === "wide" || n == null && i, [h] = w(ft), v = E(null), [g, C] = w(null), [b, k] = w(null), x = $(() => ({
73
+ setTitle: C,
74
+ setTail: k
75
+ }), []);
76
+ O(() => {
77
+ if (o != null)
78
+ return o.setBack(b), () => o.setBack(null);
79
+ }, [o, b]);
80
+ const { host: _, setSlot: P, open: B } = Tt(v), I = B && _.presentation === "page", D = E(!1), q = E(0);
81
+ V(() => {
82
+ const H = v.current;
83
+ if (I === D.current || H == null) return;
84
+ D.current = I;
85
+ const A = we(H);
86
+ I ? (q.current = Pt(A), ke(A, 0)) : ke(A, q.current);
87
+ }, [I]);
88
+ const U = e ? /* @__PURE__ */ t(Ot, {
89
+ title: g,
90
+ tail: o == null ? b : null,
91
+ silent: I || o != null
92
+ }) : null, J = /* @__PURE__ */ t("div", {
93
+ "data-basic-page-column": "",
94
+ className: p("mx-auto flex w-full min-w-0 flex-1 flex-col px-5 pt-12 pb-12 *:min-w-0", m ? "max-w-[84rem] md:px-8" : "max-w-[44.5rem]", c || o != null ? "[&_[data-basic-page-back]]:hidden" : "has-[[data-basic-page-back]]:pt-16"),
95
+ children: e ? /* @__PURE__ */ t(be.Provider, {
96
+ value: x,
97
+ children: r
98
+ }) : r
99
+ });
100
+ return /* @__PURE__ */ t("div", {
101
+ "data-basic-page-root": "",
102
+ "data-basic-page-width": m ? "wide" : void 0,
103
+ className: p("relative flex min-h-full w-full min-w-0 flex-row", a),
104
+ ...l,
105
+ ref: (H) => {
106
+ v.current = H, typeof s == "function" ? s(H) : s != null && (s.current = H);
107
+ },
108
+ children: /* @__PURE__ */ t(ze.Provider, {
109
+ value: _,
110
+ children: /* @__PURE__ */ t(ut.Provider, {
111
+ value: u,
112
+ children: /* @__PURE__ */ y(fe.Provider, {
113
+ value: h,
114
+ children: [/* @__PURE__ */ y("div", {
115
+ "data-basic-page-main": "",
116
+ className: p("flex min-w-0 flex-1 flex-col", I && "hidden"),
117
+ children: [U, J]
118
+ }), /* @__PURE__ */ t("div", {
119
+ ref: P,
120
+ className: "contents"
121
+ })]
122
+ })
123
+ })
124
+ })
125
+ });
126
+ }
127
+ function Ot({ title: e, tail: n, silent: a = !1 }) {
128
+ const r = L(), [s, l] = w(!1), c = R(se), o = xt();
129
+ O(() => {
130
+ if (c != null) {
131
+ if (a) {
132
+ c.store.clear(o);
133
+ return;
134
+ }
135
+ c.store.set(o, {
136
+ condensed: s,
137
+ title: e?.label ?? null,
138
+ back: n
139
+ });
140
+ }
141
+ }, [
142
+ c,
143
+ o,
144
+ s,
145
+ e,
146
+ n,
147
+ a
148
+ ]), O(() => {
149
+ if (c != null)
150
+ return () => c.store.clear(o);
151
+ }, [c, o]);
152
+ const i = e?.el ?? null;
153
+ return O(() => {
154
+ if (i == null || typeof IntersectionObserver > "u") return;
155
+ const d = new IntersectionObserver(([f]) => l(f != null && !f.isIntersecting), { root: we(i) });
156
+ return d.observe(i), () => d.disconnect();
157
+ }, [i]), /* @__PURE__ */ t("div", {
158
+ "data-basic-page-condense": "",
159
+ className: "sticky top-0 z-20 h-0 overflow-visible",
160
+ children: /* @__PURE__ */ t(G, { children: s && !(c?.adopt ?? !1) && /* @__PURE__ */ y(N.div, {
161
+ initial: {
162
+ opacity: 0,
163
+ y: r ? 0 : Pe
164
+ },
165
+ animate: {
166
+ opacity: 1,
167
+ y: 0
168
+ },
169
+ exit: {
170
+ opacity: 0,
171
+ y: r ? 0 : Pe
172
+ },
173
+ transition: {
174
+ ...xe,
175
+ y: jt
176
+ },
177
+ className: "border-pho-secondary bg-pho-page/85 relative grid h-12 grid-cols-[1fr_minmax(0,auto)_1fr] items-center border-b px-3 backdrop-blur",
178
+ children: [/* @__PURE__ */ t("div", {
179
+ className: "flex min-w-0 items-center justify-start",
180
+ children: n != null && /* @__PURE__ */ t(pe, {
181
+ variant: "ghost",
182
+ size: "sm",
183
+ href: n.href,
184
+ onClick: n.onClick,
185
+ prefix: /* @__PURE__ */ t("span", {
186
+ className: "inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0",
187
+ children: /* @__PURE__ */ t(ne, {})
188
+ }),
189
+ className: "min-w-max",
190
+ children: n.label
191
+ })
192
+ }), /* @__PURE__ */ t("span", {
193
+ className: "text-pho-primary block max-w-full min-w-0 truncate text-center text-base font-medium",
194
+ children: e?.label
195
+ })]
196
+ }) })
197
+ });
198
+ }
199
+ function Lt(e) {
200
+ return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
201
+ }
202
+ function Bt(e) {
203
+ if (!(typeof e != "string" && typeof e != "number"))
204
+ return Lt(String(e)) || void 0;
205
+ }
206
+ function ve(e, n) {
207
+ if (e !== "")
208
+ return e ?? Bt(n);
209
+ }
210
+ var Mt = (e) => `basic-page-morph-${e}`, Dt = { layout: T }, Se = 10, Re = {
211
+ delay: 0.2,
212
+ duration: 0.12,
213
+ ease: "easeOut"
214
+ }, Ht = {
215
+ duration: 0.18,
216
+ ease: "easeOut"
217
+ }, Ft = -8, Gt = {
218
+ duration: 0.16,
219
+ ease: "easeOut"
220
+ }, zt = {
221
+ delay: 0.14,
222
+ duration: 0.16,
223
+ ease: "easeOut"
224
+ }, $e = {
225
+ duration: 0.12,
226
+ ease: "easeOut"
227
+ }, K = [];
228
+ function Vt(e) {
229
+ const n = E({ labels: e });
230
+ n.current.labels = e, V(() => {
231
+ const a = n.current;
232
+ return K.push(a), () => {
233
+ K.splice(K.indexOf(a), 1);
234
+ };
235
+ }, []);
236
+ }
237
+ function je() {
238
+ const [e] = w(() => {
239
+ const n = K[K.length - 1];
240
+ return n ? { labels: [...n.labels] } : null;
241
+ });
242
+ return e;
243
+ }
244
+ var be = z(null), ue = {
245
+ condensed: !1,
246
+ title: null,
247
+ back: null
248
+ }, se = z(null), ye = () => () => {
249
+ }, Te = () => ue;
250
+ function $t({ adopt: e = !0, children: n }) {
251
+ const [a] = w(() => {
252
+ let s = ue, l = null;
253
+ const c = /* @__PURE__ */ new Set(), o = () => {
254
+ for (const i of c) i();
255
+ };
256
+ return {
257
+ get: () => s,
258
+ set(i, d) {
259
+ l = i, s = d, o();
260
+ },
261
+ clear(i) {
262
+ l === i && (l = null, s = ue, o());
263
+ },
264
+ subscribe(i) {
265
+ return c.add(i), () => c.delete(i);
266
+ }
267
+ };
268
+ }), r = $(() => ({
269
+ store: a,
270
+ adopt: e
271
+ }), [a, e]);
272
+ return /* @__PURE__ */ t(se.Provider, {
273
+ value: r,
274
+ children: n
275
+ });
276
+ }
277
+ function fa() {
278
+ const e = R(se);
279
+ return me(e?.store.subscribe ?? ye, e?.store.get ?? Te, e?.store.get ?? Te);
280
+ }
281
+ var xe = it, jt = lt, Pe = -8;
282
+ function we(e) {
283
+ if (typeof getComputedStyle != "function") return null;
284
+ for (let n = e.parentElement; n != null && n !== document.body; n = n.parentElement) {
285
+ const { overflowY: a } = getComputedStyle(n);
286
+ if (a === "auto" || a === "scroll") return n;
287
+ }
288
+ return null;
289
+ }
290
+ var oe = /* @__PURE__ */ new Map(), qt = 96;
291
+ function Wt(e) {
292
+ const n = e.closest("[data-basic-page-root]"), a = n?.querySelector("[data-basic-page-column]");
293
+ return !n || !a ? 0 : a.getBoundingClientRect().left - n.getBoundingClientRect().left;
294
+ }
295
+ function qe(e) {
296
+ const [n] = w(() => {
297
+ if (e == null) return !1;
298
+ const r = oe.get(e);
299
+ return r != null && r.visible && r.el.isConnected && Wt(r.el) <= qt;
300
+ }), a = E(null);
301
+ return O(() => {
302
+ if (e == null || typeof IntersectionObserver > "u") return;
303
+ const r = a.current;
304
+ if (!r) return;
305
+ const s = new IntersectionObserver(([l]) => {
306
+ l && oe.set(e, {
307
+ visible: l.isIntersecting,
308
+ el: r
309
+ });
310
+ });
311
+ return s.observe(r), () => {
312
+ s.disconnect(), oe.delete(e);
313
+ };
314
+ }, [e]), {
315
+ fly: n,
316
+ ref: a
317
+ };
318
+ }
319
+ var Kt = {
320
+ fade: {
321
+ initial: { opacity: 0 },
322
+ animate: { opacity: 1 },
323
+ transition: { opacity: M }
324
+ },
325
+ rise: {
326
+ initial: {
327
+ opacity: 0,
328
+ y: j
329
+ },
330
+ animate: {
331
+ opacity: 1,
332
+ y: 0
333
+ },
334
+ transition: {
335
+ y: T,
336
+ opacity: M
337
+ }
338
+ },
339
+ slide: {
340
+ initial: { x: "-100%" },
341
+ animate: { x: 0 },
342
+ transition: { x: zt }
343
+ }
344
+ };
345
+ function We({ morphId: e, fromClassName: n, fly: a, morphRef: r, arrival: s, className: l, children: c }) {
346
+ const [o, i] = w(!1), d = !a && s != null ? Kt[s] : null;
347
+ return /* @__PURE__ */ y(N.span, {
348
+ ref: r,
349
+ layoutId: Mt(e),
350
+ initial: d?.initial,
351
+ animate: d?.animate,
352
+ transition: a ? Dt : {
353
+ layout: { duration: 0 },
354
+ ...d?.transition
355
+ },
356
+ onLayoutAnimationStart: () => {
357
+ a && i(!0);
358
+ },
359
+ onLayoutAnimationComplete: () => i(!1),
360
+ className: p("relative inline-block", l),
361
+ children: [c, o && /* @__PURE__ */ t(N.span, {
362
+ "aria-hidden": !0,
363
+ initial: { opacity: 1 },
364
+ animate: { opacity: 0 },
365
+ transition: Ht,
366
+ onAnimationComplete: () => i(!1),
367
+ className: p("absolute inset-0", n),
368
+ children: c
369
+ })]
370
+ });
371
+ }
372
+ var Ie = "max-w-full min-w-0 truncate align-top";
373
+ function Xt({ id: e, morphId: n, enter: a, trailing: r, className: s, children: l, ...c }) {
374
+ const o = ve(e, l), i = L(), d = qe(n), f = je(), u = !i && (n != null || a === !0), m = a || f != null ? "rise" : void 0, h = R(be), v = E(null);
375
+ V(() => {
376
+ if (h != null)
377
+ return h.setTitle({
378
+ label: l,
379
+ el: v.current
380
+ }), () => h.setTitle(null);
381
+ }, [h, l]);
382
+ const [g, C] = w(d.fly && f != null);
383
+ V(() => {
384
+ K.length > 0 && C(!1);
385
+ }, []);
386
+ const b = r != null && r !== !1, k = !i && (n != null ? d.fly || m != null : a === !0), x = n != null && !i ? /* @__PURE__ */ t(We, {
387
+ morphId: n,
388
+ fromClassName: "text-pho-secondary",
389
+ fly: d.fly,
390
+ morphRef: d.ref,
391
+ arrival: m,
392
+ className: Ie,
393
+ children: l
394
+ }) : a && !i ? /* @__PURE__ */ t(N.span, {
395
+ initial: {
396
+ opacity: 0,
397
+ y: j
398
+ },
399
+ animate: {
400
+ opacity: 1,
401
+ y: 0
402
+ },
403
+ transition: {
404
+ y: T,
405
+ opacity: M
406
+ },
407
+ className: p("inline-block", Ie),
408
+ children: l
409
+ }) : b ? /* @__PURE__ */ t("span", {
410
+ className: "min-w-0 truncate",
411
+ children: l
412
+ }) : l;
413
+ return /* @__PURE__ */ y("h1", {
414
+ id: o,
415
+ className: p("text-display-base text-pho-primary max-w-full min-w-0 scroll-mt-12 px-5 font-medium", u ? "whitespace-nowrap" : "truncate", s),
416
+ ...c,
417
+ ref: (_) => {
418
+ v.current = _;
419
+ const P = c.ref;
420
+ typeof P == "function" ? P(_) : P != null && (P.current = _);
421
+ },
422
+ children: [b ? /* @__PURE__ */ y("span", {
423
+ className: "flex max-w-full min-w-0 items-center gap-2",
424
+ children: [x, k ? /* @__PURE__ */ t(N.span, {
425
+ "data-basic-page-title-trailing": "",
426
+ initial: {
427
+ opacity: 0,
428
+ y: j
429
+ },
430
+ animate: {
431
+ opacity: 1,
432
+ y: 0
433
+ },
434
+ transition: {
435
+ y: T,
436
+ opacity: M
437
+ },
438
+ className: "shrink-0",
439
+ children: r
440
+ }) : /* @__PURE__ */ t("span", {
441
+ "data-basic-page-title-trailing": "",
442
+ className: "shrink-0",
443
+ children: r
444
+ })]
445
+ }) : x, g && /* @__PURE__ */ t(N.span, {
446
+ "aria-hidden": !0,
447
+ initial: { opacity: 1 },
448
+ animate: { opacity: 0 },
449
+ transition: $e,
450
+ onAnimationComplete: () => C(!1),
451
+ className: p("text-pho-secondary pointer-events-none absolute inline-flex items-center", Tn),
452
+ children: /* @__PURE__ */ t(ne, {})
453
+ })]
454
+ });
455
+ }
456
+ var Ke = z(!1);
457
+ function Qt() {
458
+ const e = R(Ke), n = L(), [a] = w(() => e && !n);
459
+ return a;
460
+ }
461
+ var Yt = {
462
+ height: 0,
463
+ opacity: 0,
464
+ paddingTop: 0,
465
+ paddingBottom: 0,
466
+ borderTopWidth: 0
467
+ }, Ut = {
468
+ y: T,
469
+ opacity: M,
470
+ height: T,
471
+ paddingTop: T,
472
+ paddingBottom: T,
473
+ borderTopWidth: T
474
+ };
475
+ function Ne() {
476
+ const e = Qt(), n = wt(), a = L();
477
+ return {
478
+ initial: e ? {
479
+ opacity: 0,
480
+ y: j
481
+ } : !1,
482
+ animate: {
483
+ opacity: 1,
484
+ y: 0
485
+ },
486
+ exit: Yt,
487
+ transition: a ? { duration: 0 } : Ut,
488
+ leaving: !n
489
+ };
490
+ }
491
+ var Jt = typeof process < "u" && process.env.NODE_ENV !== "production";
492
+ function Xe(e, n, a, r) {
493
+ O(() => {
494
+ if (!Jt || e.current == null || typeof getComputedStyle != "function") return;
495
+ const s = (c) => {
496
+ const o = getComputedStyle(c).rowGap;
497
+ return o === "" || o === "normal" ? null : parseFloat(o);
498
+ }, l = s(e.current);
499
+ l != null && l !== a && console.warn(`[BasicPage.${n}] spaced at ${l}px instead of ${a}px. Spacing is the system's: Stack gap-10 between blocks, a block gap-3, Fields gap-5. Remove the class and move the wrapper instead.`, e.current);
500
+ for (const c of Array.from(e.current.children)) {
501
+ const o = r(c);
502
+ if (o == null || getComputedStyle(c).display === "contents") continue;
503
+ const i = s(c);
504
+ i != null && i !== o && console.warn(`[BasicPage.${n}] a child is spaced at ${i}px instead of ${o}px. Spacing is the system's: Stack gap-10 between blocks, a block gap-3, Fields gap-5. Remove the class and move the wrapper instead.`, c);
505
+ }
506
+ });
507
+ }
508
+ function Zt({ enter: e = !0, className: n, children: a, ref: r, ...s }) {
509
+ const l = L(), c = E(null);
510
+ Xe(c, "Stack", 40, (u) => u.hasAttribute("data-basic-page-fields") ? 20 : 12);
511
+ const o = s["aria-busy"], i = o === !0 || o === "true", d = E(i), f = d.current && !i;
512
+ return O(() => {
513
+ d.current = i;
514
+ }), /* @__PURE__ */ t(N.div, {
515
+ ref: (u) => {
516
+ c.current = u, typeof r == "function" ? r(u) : r != null && (r.current = u);
517
+ },
518
+ "data-basic-page-stack": "",
519
+ initial: l || !e ? !1 : {
520
+ opacity: 0,
521
+ y: j
522
+ },
523
+ animate: {
524
+ opacity: 1,
525
+ y: 0
526
+ },
527
+ transition: {
528
+ y: T,
529
+ opacity: M
530
+ },
531
+ className: p("mt-7 flex min-w-0 flex-col gap-10", "[&:has(>*:first-child:not([data-basic-page-callout])>[data-basic-page-header]:first-child)]:mt-6 [&:has(>*:first-child:not([data-basic-page-callout])>h2:first-child)]:mt-6 [&:has(>[data-basic-page-header]:first-child)]:mt-6 [&:has(>h2:first-child)]:mt-6", "*:flex *:min-w-0 *:flex-col [&>*:not([data-basic-page-fields])]:gap-3", n),
532
+ ...s,
533
+ children: /* @__PURE__ */ t(Ke.Provider, {
534
+ value: f,
535
+ children: a
536
+ })
537
+ });
538
+ }
539
+ var Oe = "@container grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] mb-3 [&>:not([data-basic-page-search]):not([data-basic-page-header-action])]:col-start-1 [[data-basic-page-callout]_&]:mb-0 [[data-basic-page-stack]>*>&]:mb-0";
540
+ function en({ enter: e, className: n, ...a }) {
541
+ const r = L();
542
+ return e && !r ? /* @__PURE__ */ t(N.div, {
543
+ initial: {
544
+ opacity: 0,
545
+ y: j
546
+ },
547
+ animate: {
548
+ opacity: 1,
549
+ y: 0
550
+ },
551
+ transition: {
552
+ y: T,
553
+ opacity: M
554
+ },
555
+ "data-basic-page-header": "",
556
+ className: p(Oe, n),
557
+ ...a
558
+ }) : /* @__PURE__ */ t("div", {
559
+ "data-basic-page-header": "",
560
+ className: p(Oe, n),
561
+ ...a
562
+ });
563
+ }
564
+ function tn({ className: e, ...n }) {
565
+ return /* @__PURE__ */ t("div", {
566
+ "data-basic-page-header-action": "",
567
+ className: p("flex items-center gap-2", "[[data-basic-page-header]>&]:col-start-3 [[data-basic-page-header]>&]:row-span-2 [[data-basic-page-header]>&]:row-start-1 [[data-basic-page-header]>&]:ml-4 [[data-basic-page-header]>&]:self-start [[data-basic-page-header]>&]:justify-self-end", e),
568
+ ...n
569
+ });
570
+ }
571
+ function nn({ id: e, className: n, children: a, ...r }) {
572
+ const s = ve(e, a);
573
+ return /* @__PURE__ */ t("h2", {
574
+ id: s,
575
+ className: p("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate px-5 font-medium", "mb-3 [[data-basic-page-callout]_&]:mb-0 [[data-basic-page-header]>&]:mb-0 [[data-basic-page-stack]>*>&]:mb-0", n),
576
+ ...r,
577
+ children: a
578
+ });
579
+ }
580
+ function Qe({ className: e, ...n }) {
581
+ return /* @__PURE__ */ t("p", {
582
+ className: p("text-display-xs text-pho-description px-5 font-normal", e),
583
+ ...n
584
+ });
585
+ }
586
+ function an({ one: e, other: n, ...a }) {
587
+ const r = R(fe), s = me(r?.subscribe ?? ye, () => r?.get().api ?? null, () => null);
588
+ if (s == null) return null;
589
+ const l = s.query.trim() !== "" ? `${s.matched} of ${s.total}.` : `${s.total} ${s.total === 1 ? e : n}.`;
590
+ return /* @__PURE__ */ t(Qe, {
591
+ ...a,
592
+ children: l
593
+ });
594
+ }
595
+ function rn({ className: e, ...n }) {
596
+ return /* @__PURE__ */ t("p", {
597
+ className: p("text-pho-description px-5 text-xs font-normal", "mt-3 [[data-basic-page-callout]_&]:mt-0 [[data-basic-page-stack]>*>&]:mt-0", e),
598
+ ...n
599
+ });
600
+ }
601
+ function sn({ animateHeight: e, className: n, children: a, ...r }) {
602
+ const s = /* @__PURE__ */ t(G, { children: Y.toArray(a) });
603
+ return e ? /* @__PURE__ */ t("div", {
604
+ className: p(ge, "min-h-0 overflow-hidden", n),
605
+ ...r,
606
+ children: /* @__PURE__ */ t(gt, {
607
+ transition: T,
608
+ className: ae,
609
+ children: s
610
+ })
611
+ }) : /* @__PURE__ */ t("div", {
612
+ className: p(Ge, n),
613
+ ...r,
614
+ children: s
615
+ });
616
+ }
617
+ function ln({ className: e, ...n }) {
618
+ const { leaving: a, ...r } = Ne();
619
+ return /* @__PURE__ */ t(N.div, {
620
+ ...r,
621
+ className: p(Ct, a && "overflow-hidden", e),
622
+ ...n
623
+ });
624
+ }
625
+ function on({ divided: e = !1, className: n, ...a }) {
626
+ return /* @__PURE__ */ t("div", {
627
+ className: p(e ? kt : _t, n),
628
+ ...a
629
+ });
630
+ }
631
+ function cn({ className: e, icon: n, children: a, ...r }) {
632
+ if (n == null || n === !1 || n === !0) return /* @__PURE__ */ t("div", {
633
+ "data-basic-page-callout": "",
634
+ className: p(_e, e),
635
+ ...r,
636
+ children: a
637
+ });
638
+ const [s, ...l] = Y.toArray(a);
639
+ return /* @__PURE__ */ y("div", {
640
+ "data-basic-page-callout": "",
641
+ className: p(_e, e),
642
+ ...r,
643
+ children: [/* @__PURE__ */ y("div", {
644
+ className: "relative",
645
+ children: [/* @__PURE__ */ t("div", {
646
+ className: "min-w-0 pr-16",
647
+ children: s
648
+ }), /* @__PURE__ */ t("div", {
649
+ "aria-hidden": !0,
650
+ className: "text-pho-primary pointer-events-none absolute top-0 right-0 size-14 opacity-[0.275] [&>svg]:size-full",
651
+ children: n
652
+ })]
653
+ }), l]
654
+ });
655
+ }
656
+ function un({ id: e, className: n, children: a, ...r }) {
657
+ const s = ve(e, a);
658
+ return /* @__PURE__ */ t("h2", {
659
+ id: s,
660
+ className: p("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate font-medium", n),
661
+ ...r,
662
+ children: a
663
+ });
664
+ }
665
+ function dn({ className: e, ...n }) {
666
+ return /* @__PURE__ */ t("p", {
667
+ className: p("text-display-xs text-pho-description font-normal", e),
668
+ ...n
669
+ });
670
+ }
671
+ var Ye = z(null), Ue = z(!1);
672
+ function pn({ className: e, children: n, ...a }) {
673
+ let r = !1;
674
+ const s = Y.toArray(n).map((l, c) => {
675
+ if (!He(l)) return l;
676
+ let o;
677
+ return l.props.done ? o = "done" : r ? o = "upcoming" : (r = !0, o = l.props.working ? "working" : l.props.pending ? "pending" : "current"), /* @__PURE__ */ t(Ye.Provider, {
678
+ value: {
679
+ number: c + 1,
680
+ state: o
681
+ },
682
+ children: l
683
+ }, l.key ?? c);
684
+ });
685
+ return /* @__PURE__ */ t("ol", {
686
+ "data-basic-page-onboard": "",
687
+ className: p(Ge, "m-0 list-none p-0", e),
688
+ ...a,
689
+ children: s
690
+ });
691
+ }
692
+ var fn = "relative grid size-5 shrink-0 place-items-center rounded-full border text-xs font-medium tabular-nums transition-[background-color,border-color,color] duration-200 ease-out *:[grid-area:1/1]", mn = {
693
+ done: "border-pho-ink text-pho-primary",
694
+ current: "bg-pho-brand-solid text-pho-on-brand border-transparent",
695
+ working: "border-transparent text-pho-primary",
696
+ pending: "border-pho-ink text-pho-primary border-dashed",
697
+ upcoming: "border-pho-primary text-pho-description"
698
+ }, hn = "pointer-events-none absolute -inset-px rounded-full border border-pho-ink opacity-30", gn = "pointer-events-none absolute -inset-px rounded-full border border-pho-ink border-r-transparent border-b-transparent border-l-transparent animate-pho-spinner", vn = {
699
+ done: "Done.",
700
+ working: "In progress.",
701
+ pending: "Waiting."
702
+ };
703
+ function bn({ icon: e, aside: n, title: a, description: r, done: s, working: l, pending: c, className: o, children: i, ...d }) {
704
+ const f = R(Ye), u = f?.state ?? (s ? "done" : l ? "working" : c ? "pending" : "current"), m = L(), h = u === "current" || u === "working" || u === "pending", v = u === "upcoming", g = vn[u], C = i != null && i !== !1, b = e != null && e !== !1, k = n != null && n !== !1;
705
+ return /* @__PURE__ */ t("li", {
706
+ "data-basic-page-step": u,
707
+ "aria-current": h ? "step" : void 0,
708
+ className: p("relative m-0 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)] items-center gap-x-3 px-5 py-4", "transition-[background-color] duration-200 ease-out first:rounded-t-[calc(0.75rem-1px)] last:rounded-b-[calc(0.75rem-1px)] motion-reduce:transition-none", h && "bg-pho-page", o),
709
+ ...d,
710
+ children: /* @__PURE__ */ y(Ue.Provider, {
711
+ value: !0,
712
+ children: [
713
+ /* @__PURE__ */ y("span", {
714
+ "aria-hidden": !0,
715
+ className: p(fn, mn[u], "col-start-1 row-start-1"),
716
+ children: [/* @__PURE__ */ t(G, {
717
+ initial: !1,
718
+ children: u === "done" ? /* @__PURE__ */ t(N.span, {
719
+ ...ee(m),
720
+ className: "flex",
721
+ children: /* @__PURE__ */ t(vt, { className: "size-3" })
722
+ }, "check") : /* @__PURE__ */ t(N.span, {
723
+ ...ee(m),
724
+ children: f?.number ?? 1
725
+ }, "number")
726
+ }), u === "working" ? /* @__PURE__ */ y(he, { children: [/* @__PURE__ */ t("span", { className: hn }), /* @__PURE__ */ t("span", { className: gn })] }) : null]
727
+ }),
728
+ /* @__PURE__ */ y("div", {
729
+ "data-basic-page-step-title": "",
730
+ className: p("text-display-xs col-start-2 row-start-1 min-w-0 font-medium transition-colors duration-200 ease-out", v ? "text-pho-description" : "text-pho-primary"),
731
+ children: [g ? /* @__PURE__ */ y("span", {
732
+ className: "sr-only",
733
+ children: [g, " "]
734
+ }) : null, a]
735
+ }),
736
+ /* @__PURE__ */ t(Ae, {
737
+ show: h,
738
+ gap: "none",
739
+ clip: !1,
740
+ className: "col-start-2 row-start-2 flex min-w-0 flex-col self-stretch",
741
+ children: /* @__PURE__ */ y("div", {
742
+ "data-basic-page-step-body": "",
743
+ className: "flex min-w-0 flex-1 flex-col",
744
+ children: [r ? /* @__PURE__ */ t("div", {
745
+ className: "text-display-xs text-pho-description font-normal",
746
+ children: r
747
+ }) : null, C ? /* @__PURE__ */ t("div", {
748
+ className: "mt-auto flex flex-wrap items-center gap-2 pt-3",
749
+ children: i
750
+ }) : null]
751
+ })
752
+ }),
753
+ u === "done" && C ? /* @__PURE__ */ t("div", {
754
+ className: "col-start-3 row-start-1 flex min-w-0 items-center gap-2",
755
+ children: i
756
+ }) : k ? /* @__PURE__ */ t(G, {
757
+ initial: !1,
758
+ children: h ? /* @__PURE__ */ t(N.div, {
759
+ ...ee(m),
760
+ className: "col-start-3 row-span-2 row-start-1 self-start",
761
+ children: n
762
+ }, "aside") : null
763
+ }) : b ? /* @__PURE__ */ t(G, {
764
+ initial: !1,
765
+ children: h ? /* @__PURE__ */ t(N.div, {
766
+ "aria-hidden": !0,
767
+ ...ee(m),
768
+ className: "pointer-events-none col-start-3 row-span-2 row-start-1 size-14 self-start",
769
+ children: /* @__PURE__ */ t("div", {
770
+ className: "text-pho-primary size-full opacity-[0.275] [&>svg]:size-full",
771
+ children: e
772
+ })
773
+ }, "icon") : null
774
+ }) : null
775
+ ]
776
+ })
777
+ });
778
+ }
779
+ function yn({ label: e, description: n, htmlFor: a, stacked: r = !1, className: s, children: l, ...c }) {
780
+ const { leaving: o, ...i } = Ne();
781
+ return /* @__PURE__ */ y(N.div, {
782
+ ...i,
783
+ className: p(Et, r && "sm:flex-col sm:items-stretch sm:justify-start sm:gap-3", o && "overflow-hidden", s),
784
+ ...c,
785
+ children: [/* @__PURE__ */ y("div", {
786
+ className: "min-w-0",
787
+ children: [a ? /* @__PURE__ */ t("label", {
788
+ htmlFor: a,
789
+ className: "text-pho-primary block text-base font-normal",
790
+ children: e
791
+ }) : /* @__PURE__ */ t("div", {
792
+ className: "text-pho-primary text-base font-normal",
793
+ children: e
794
+ }), n ? /* @__PURE__ */ t("p", {
795
+ className: "text-pho-description text-xs",
796
+ children: n
797
+ }) : null]
798
+ }), /* @__PURE__ */ t("div", {
799
+ className: p("flex w-full min-w-0 items-center gap-2 sm:w-auto", r && "sm:w-full"),
800
+ children: l
801
+ })]
802
+ });
803
+ }
804
+ function xn({ className: e, ...n }) {
805
+ const a = R(Ue);
806
+ return /* @__PURE__ */ t("p", {
807
+ className: p("text-pho-description max-w-full min-w-0 truncate", a ? "text-display-xs font-normal" : "text-base", e),
808
+ ...n
809
+ });
810
+ }
811
+ function wn({ error: e, show: n, className: a, children: r, ...s }) {
812
+ const l = L(), c = R(X), o = e ?? c?.error ?? void 0;
813
+ return /* @__PURE__ */ t(G, {
814
+ initial: !1,
815
+ children: (n ?? !0) && (o != null || r != null) ? /* @__PURE__ */ t(N.div, {
816
+ "data-basic-page-alert": "",
817
+ className: "overflow-hidden",
818
+ initial: {
819
+ height: 0,
820
+ opacity: 0
821
+ },
822
+ animate: {
823
+ height: "auto",
824
+ opacity: 1
825
+ },
826
+ exit: {
827
+ height: 0,
828
+ opacity: 0
829
+ },
830
+ transition: l ? { duration: 0 } : {
831
+ height: T,
832
+ opacity: M
833
+ },
834
+ children: /* @__PURE__ */ t(ct, {
835
+ error: o,
836
+ className: p("px-5 pb-3", a),
837
+ ...s,
838
+ children: r
839
+ })
840
+ }) : null
841
+ });
842
+ }
843
+ function ma() {
844
+ return R(X)?.requestSave ?? null;
845
+ }
846
+ var ha = 800, ce = ht.createToastManager(), X = z(null);
847
+ function Nn({ action: e, errors: n, autoSave: a = !1, className: r, children: s, onChange: l, onBlur: c, ...o }) {
848
+ const [i, d] = w(!1), [f, u] = w(!1), [m, h] = w(null), [v, g] = w(n ?? {}), [C, b] = w(null), k = E(null), x = E(null), _ = E(null), P = E(!1), B = E(!1), I = E(null), D = E(async () => {
849
+ });
850
+ O(() => () => {
851
+ x.current != null && clearTimeout(x.current);
852
+ }, []);
853
+ const q = async () => {
854
+ const A = k.current;
855
+ if (A == null || e == null) return;
856
+ if (P.current) {
857
+ B.current = !0;
858
+ return;
859
+ }
860
+ if (!A.checkValidity()) return;
861
+ const S = Object.fromEntries(new FormData(A).entries()), Z = _.current;
862
+ P.current = !0, b({
863
+ field: Z,
864
+ phase: "saving"
865
+ }), h(null);
866
+ try {
867
+ const F = (await e(S))?.errors;
868
+ if (F != null && Object.keys(F).length > 0) {
869
+ g(F), b(null);
870
+ return;
871
+ }
872
+ g({}), u(!1), b({
873
+ field: Z,
874
+ phase: "saved"
875
+ }), I.current != null && (ce.close(I.current), I.current = null);
876
+ } catch (F) {
877
+ b(null), h(F), I.current != null && ce.close(I.current), I.current = ce.add({
878
+ type: "error",
879
+ title: "Couldn't save",
880
+ description: F instanceof Error && F.message !== "" ? F.message : "The change is still here — try again.",
881
+ timeout: 0,
882
+ actionProps: {
883
+ children: "Retry",
884
+ onClick: () => {
885
+ D.current();
886
+ }
887
+ }
888
+ });
889
+ } finally {
890
+ P.current = !1, B.current && (B.current = !1, D.current());
891
+ }
892
+ };
893
+ D.current = q;
894
+ const U = () => {
895
+ x.current != null && clearTimeout(x.current), x.current = setTimeout(() => {
896
+ x.current = null, D.current();
897
+ }, 800);
898
+ }, J = $(() => a ? (A) => {
899
+ A != null && (_.current = A), u(!0), U();
900
+ } : null, [a]), H = $(() => ({
901
+ pending: i,
902
+ dirty: f,
903
+ error: m,
904
+ auto: C,
905
+ requestSave: J
906
+ }), [
907
+ i,
908
+ f,
909
+ m,
910
+ C,
911
+ J
912
+ ]);
913
+ return /* @__PURE__ */ t(X.Provider, {
914
+ value: H,
915
+ children: /* @__PURE__ */ t(bt, {
916
+ errors: v,
917
+ onFormSubmit: async (A) => {
918
+ if (e != null) {
919
+ d(!0), h(null);
920
+ try {
921
+ const S = (await e(A))?.errors;
922
+ if (S != null && Object.keys(S).length > 0) {
923
+ g(S);
924
+ return;
925
+ }
926
+ g({}), u(!1);
927
+ } catch (S) {
928
+ h(S);
929
+ } finally {
930
+ d(!1);
931
+ }
932
+ }
933
+ },
934
+ onChange: (A) => {
935
+ u(!0), h(null);
936
+ const S = A.target.name;
937
+ S && S in v && g((Z) => {
938
+ const { [S]: F, ...at } = Z;
939
+ return at;
940
+ }), a && (S && (_.current = S), U()), l?.(A);
941
+ },
942
+ onBlur: (A) => {
943
+ a && f && x.current != null && (clearTimeout(x.current), x.current = null, D.current()), c?.(A);
944
+ },
945
+ className: p("contents [[data-basic-page-stack]>&]:flex [[data-basic-page-stack]>&]:min-w-0 [[data-basic-page-stack]>&]:flex-col", r),
946
+ ...o,
947
+ ref: (A) => {
948
+ k.current = A;
949
+ const S = o.ref;
950
+ typeof S == "function" ? S(A) : S != null && (S.current = A);
951
+ },
952
+ children: /* @__PURE__ */ t("fieldset", {
953
+ disabled: i,
954
+ "aria-busy": i || void 0,
955
+ className: "contents",
956
+ children: s
957
+ })
958
+ })
959
+ });
960
+ }
961
+ function An({ name: e, className: n, ...a }) {
962
+ const r = R(X), s = L(), l = r?.auto ?? null, c = l != null && (e == null || l.field === e), [o, i] = w(!1), d = c ? l.phase : null;
963
+ O(() => {
964
+ if (d !== "saved") return;
965
+ i(!0);
966
+ const m = setTimeout(() => i(!1), 1800);
967
+ return () => clearTimeout(m);
968
+ }, [d, l]);
969
+ const f = d === "saving" ? "Saving…" : d === "saved" && o ? "Saved" : null, u = s ? "blur(0px)" : `blur(${De}px)`;
970
+ return /* @__PURE__ */ t("span", {
971
+ className: "grid justify-items-end",
972
+ children: /* @__PURE__ */ t(G, {
973
+ initial: !1,
974
+ children: f != null && /* @__PURE__ */ t(N.output, {
975
+ initial: {
976
+ opacity: 0,
977
+ filter: u
978
+ },
979
+ animate: {
980
+ opacity: 1,
981
+ filter: "blur(0px)"
982
+ },
983
+ exit: {
984
+ opacity: 0,
985
+ filter: u
986
+ },
987
+ transition: xe,
988
+ className: p("text-pho-description pl-8 [grid-area:1/1]", n),
989
+ style: { background: "linear-gradient(to left, var(--background-color-pho-primary) calc(100% - 2rem), transparent)" },
990
+ ...a,
991
+ children: f
992
+ }, f)
993
+ })
994
+ });
995
+ }
996
+ var En = "flex min-w-0 flex-col gap-5 p-5 [&>[data-basic-page-alert]]:-mx-5 [&>[data-basic-page-alert]]:-mt-2 [&>[data-basic-page-alert]]:-mb-5 [&>[data-basic-page-footer]]:pr-0 [&>[data-basic-page-reveal]]:flex [&>[data-basic-page-reveal]]:flex-col [&>[data-basic-page-reveal]]:gap-5";
997
+ function Cn({ className: e, ...n }) {
998
+ const a = E(null);
999
+ return Xe(a, "Fields", 20, () => null), /* @__PURE__ */ t("div", {
1000
+ "data-basic-page-fields": "",
1001
+ className: p(ge, En, e),
1002
+ ...n,
1003
+ ref: (r) => {
1004
+ a.current = r;
1005
+ const s = n.ref;
1006
+ typeof s == "function" ? s(r) : s != null && (s.current = r);
1007
+ }
1008
+ });
1009
+ }
1010
+ function _n({ className: e, ...n }) {
1011
+ return /* @__PURE__ */ t("div", {
1012
+ className: p("flex min-w-0 flex-col gap-5 *:min-w-0 sm:flex-row sm:gap-3 sm:*:flex-1", e),
1013
+ ...n
1014
+ });
1015
+ }
1016
+ function kn({ children: e = "Save changes", ...n }) {
1017
+ const a = R(X);
1018
+ return /* @__PURE__ */ t(ie, {
1019
+ type: "submit",
1020
+ variant: "effect",
1021
+ size: "sm",
1022
+ loading: a?.pending,
1023
+ ...n,
1024
+ children: e
1025
+ });
1026
+ }
1027
+ function Sn({ show: e, className: n, ...a }) {
1028
+ const r = R(X), s = e === "dirty" ? r?.dirty ?? !1 : e, l = /* @__PURE__ */ t("div", {
1029
+ "data-basic-page-footer": "",
1030
+ className: p("flex items-center justify-end gap-3 pr-[calc(1.25rem+2.5px)]", n),
1031
+ ...a
1032
+ });
1033
+ return s === void 0 ? l : /* @__PURE__ */ t(Ae, {
1034
+ show: s,
1035
+ gap: "block",
1036
+ clip: !1,
1037
+ children: l
1038
+ });
1039
+ }
1040
+ var Rn = {
1041
+ stack: "-2.5rem",
1042
+ block: "-0.75rem",
1043
+ fields: "-1.25rem",
1044
+ none: "0px"
1045
+ };
1046
+ function Ae({ show: e, clip: n = !0, gap: a = "stack", dividers: r, className: s, ...l }) {
1047
+ const c = L(), o = Rn[r ? "none" : a], i = E(null), d = E(e !== !0);
1048
+ O(() => {
1049
+ d.current = !0;
1050
+ }, []);
1051
+ const f = () => {
1052
+ n && i.current && (i.current.style.overflow = "hidden");
1053
+ }, u = () => {
1054
+ i.current && (i.current.style.overflow = "");
1055
+ };
1056
+ return e === void 0 ? /* @__PURE__ */ t(N.div, {
1057
+ initial: c ? !1 : {
1058
+ opacity: 0,
1059
+ y: j
1060
+ },
1061
+ animate: {
1062
+ opacity: 1,
1063
+ y: 0
1064
+ },
1065
+ transition: {
1066
+ y: T,
1067
+ opacity: M
1068
+ },
1069
+ className: p(r && ae, s),
1070
+ ...l
1071
+ }) : /* @__PURE__ */ t(G, {
1072
+ initial: !1,
1073
+ children: e ? /* @__PURE__ */ t(N.div, {
1074
+ "data-basic-page-reveal": "",
1075
+ ref: (m) => {
1076
+ i.current = m, n && m && d.current && (m.style.overflow = "hidden");
1077
+ },
1078
+ onAnimationStart: f,
1079
+ onAnimationComplete: u,
1080
+ initial: {
1081
+ height: 0,
1082
+ opacity: 0,
1083
+ marginTop: o
1084
+ },
1085
+ animate: {
1086
+ height: "auto",
1087
+ opacity: 1,
1088
+ marginTop: 0
1089
+ },
1090
+ exit: {
1091
+ height: 0,
1092
+ opacity: 0,
1093
+ marginTop: o
1094
+ },
1095
+ transition: c ? { duration: 0 } : {
1096
+ height: T,
1097
+ marginTop: T,
1098
+ opacity: M
1099
+ },
1100
+ className: p(r && ae, s),
1101
+ ...l
1102
+ }) : null
1103
+ });
1104
+ }
1105
+ var Tn = "top-4 left-5 h-8 text-base [&>svg]:size-[1.125em] [&>svg]:shrink-0", Pn = "(min-width: 40rem)";
1106
+ function In() {
1107
+ return typeof window < "u" && typeof window.matchMedia == "function" && !window.matchMedia(Pn).matches;
1108
+ }
1109
+ var Je = z(null);
1110
+ function Ze({ className: e, children: n, ...a }) {
1111
+ const r = Y.toArray(n).filter(He), s = r.map((k) => k.props.children ?? null), l = je();
1112
+ Vt(s);
1113
+ const [c] = w(In), o = L(), i = r.length, d = Me(), f = !c && i >= On, u = R(be), m = i > 0 ? r[i - 1]?.props : null, h = m?.children ?? "Back", v = m?.href, g = m?.onClick;
1114
+ V(() => {
1115
+ if (!(u == null || v == null))
1116
+ return u.setTail({
1117
+ label: h,
1118
+ href: v,
1119
+ onClick: g
1120
+ }), () => u.setTail(null);
1121
+ }, [
1122
+ u,
1123
+ h,
1124
+ v,
1125
+ g
1126
+ ]);
1127
+ const [C, b] = w(!o && !c && l != null && l.labels.length > i);
1128
+ return /* @__PURE__ */ t("nav", {
1129
+ "aria-label": "Breadcrumb",
1130
+ "data-basic-page-back": "",
1131
+ className: p("absolute top-4 left-3 flex min-w-max items-center", e),
1132
+ ...a,
1133
+ children: /* @__PURE__ */ y("ol", {
1134
+ className: "m-0 flex list-none items-center p-0",
1135
+ children: [r.map((k, x) => f && x > 0 && x < i - 2 ? null : /* @__PURE__ */ y(yt, { children: [f && x === i - 2 && /* @__PURE__ */ y("li", {
1136
+ className: "m-0 flex items-center max-sm:hidden",
1137
+ children: [/* @__PURE__ */ t("span", {
1138
+ "aria-hidden": !0,
1139
+ className: de,
1140
+ children: re
1141
+ }), /* @__PURE__ */ y(W.Root, { children: [/* @__PURE__ */ t(W.Trigger, { render: /* @__PURE__ */ t(ie, {
1142
+ variant: "ghost",
1143
+ size: "sm",
1144
+ "aria-label": "Hidden pages",
1145
+ className: "px-2",
1146
+ children: Ln
1147
+ }) }), /* @__PURE__ */ t(W.Portal, { children: /* @__PURE__ */ t(W.Positioner, {
1148
+ align: "start",
1149
+ sideOffset: 4,
1150
+ children: /* @__PURE__ */ t(W.Popup, { children: r.slice(1, i - 2).map((_, P) => {
1151
+ const B = _.props;
1152
+ return /* @__PURE__ */ t(W.LinkItem, {
1153
+ render: /* @__PURE__ */ t(d, {
1154
+ href: B.href,
1155
+ onClick: B.onClick
1156
+ }),
1157
+ children: B.children ?? "Back"
1158
+ }, _.key ?? P);
1159
+ }) })
1160
+ }) })] })]
1161
+ }), /* @__PURE__ */ t("li", {
1162
+ className: p("m-0 flex items-center", x < i - 1 && "max-sm:hidden"),
1163
+ children: /* @__PURE__ */ t(Je.Provider, {
1164
+ value: {
1165
+ index: x,
1166
+ count: i,
1167
+ departing: l,
1168
+ narrow: c
1169
+ },
1170
+ children: k
1171
+ })
1172
+ })] }, k.key ?? x)), C && /* @__PURE__ */ t("li", {
1173
+ "aria-hidden": !0,
1174
+ className: "m-0 flex items-center max-sm:hidden",
1175
+ children: /* @__PURE__ */ t(N.span, {
1176
+ initial: { opacity: 1 },
1177
+ animate: { opacity: 0 },
1178
+ transition: $e,
1179
+ onAnimationComplete: () => b(!1),
1180
+ className: de,
1181
+ children: re
1182
+ })
1183
+ })]
1184
+ })
1185
+ });
1186
+ }
1187
+ var de = "text-pho-description -mx-1 inline-flex shrink-0 text-base select-none", re = "/", On = 4, Ln = "…";
1188
+ function et({ href: e, className: n, morphId: a, children: r = "Back", ...s }) {
1189
+ const l = R(Je), c = L(), o = a != null && !c, i = qe(o ? a : void 0);
1190
+ if (l == null) throw new Error("BasicPage.Crumb must be rendered inside BasicPage.Breadcrumbs");
1191
+ const { index: d, count: f, departing: u, narrow: m } = l, h = d === 0, v = d === f - 1, g = u != null && u.labels.length < f, C = u != null && u.labels.length > f, b = v && (u == null || g || m), k = h || v, x = h && v ? "" : h ? "max-sm:hidden" : "sm:hidden", _ = u != null, P = v ? m ? C ? "slide" : "fade" : b ? "fade" : void 0 : void 0, [B, I] = w(o && m && i.fly && u != null && !C ? u.labels[u.labels.length - 1] : null), D = o && k && !_, q = o && !h && v && (u == null || g);
1192
+ return /* @__PURE__ */ y(he, { children: [!h && /* @__PURE__ */ t("span", {
1193
+ "aria-hidden": !0,
1194
+ className: p(de, "max-sm:hidden"),
1195
+ children: q ? /* @__PURE__ */ t(N.span, {
1196
+ initial: i.fly ? {
1197
+ opacity: 0,
1198
+ x: Se
1199
+ } : { opacity: 0 },
1200
+ animate: i.fly ? {
1201
+ opacity: 1,
1202
+ x: 0
1203
+ } : { opacity: 1 },
1204
+ transition: i.fly ? Re : M,
1205
+ className: "inline-flex",
1206
+ children: re
1207
+ }) : re
1208
+ }), /* @__PURE__ */ t(pe, {
1209
+ variant: "ghost",
1210
+ size: "sm",
1211
+ href: e,
1212
+ prefix: k ? D ? /* @__PURE__ */ t(N.span, {
1213
+ initial: i.fly ? {
1214
+ opacity: 0,
1215
+ x: Se
1216
+ } : { opacity: 0 },
1217
+ animate: i.fly ? {
1218
+ opacity: 1,
1219
+ x: 0
1220
+ } : { opacity: 1 },
1221
+ transition: i.fly ? Re : M,
1222
+ className: p("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", x),
1223
+ children: /* @__PURE__ */ t(ne, {})
1224
+ }) : /* @__PURE__ */ t("span", {
1225
+ className: p("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", x),
1226
+ children: /* @__PURE__ */ t(ne, {})
1227
+ }) : /* @__PURE__ */ t("span", { className: "hidden" }),
1228
+ className: p("min-w-max", n),
1229
+ ...s,
1230
+ children: o && a != null ? /* @__PURE__ */ y("span", {
1231
+ className: p("relative block", !i.fly && P === "slide" && "overflow-hidden", !v && "max-w-40 truncate"),
1232
+ children: [/* @__PURE__ */ t(We, {
1233
+ morphId: a,
1234
+ fromClassName: "text-pho-primary",
1235
+ fly: i.fly,
1236
+ morphRef: i.ref,
1237
+ arrival: P,
1238
+ children: r
1239
+ }), B != null && /* @__PURE__ */ t(N.span, {
1240
+ "aria-hidden": !0,
1241
+ initial: {
1242
+ x: 0,
1243
+ opacity: 1
1244
+ },
1245
+ animate: {
1246
+ x: Ft,
1247
+ opacity: 0
1248
+ },
1249
+ transition: Gt,
1250
+ onAnimationComplete: () => I(null),
1251
+ className: "pointer-events-none absolute inset-y-0 left-0 whitespace-nowrap",
1252
+ children: B
1253
+ })]
1254
+ }) : /* @__PURE__ */ t("span", {
1255
+ className: p("block", !v && "max-w-40 truncate"),
1256
+ children: r
1257
+ })
1258
+ })] });
1259
+ }
1260
+ function Bn({ className: e, ...n }) {
1261
+ return /* @__PURE__ */ t(Ze, {
1262
+ className: e,
1263
+ children: /* @__PURE__ */ t(et, { ...n })
1264
+ });
1265
+ }
1266
+ function Mn({ label: e, description: n, leading: a, href: r, className: s, children: l, ...c }) {
1267
+ const o = Me(), i = $(() => N.create(o), [o]), { leaving: d, ...f } = Ne();
1268
+ return /* @__PURE__ */ y(i, {
1269
+ href: r,
1270
+ ...f,
1271
+ ...c,
1272
+ className: p("flex min-h-[4.25rem] min-w-0 flex-row items-center justify-between gap-6 px-5 py-4", "group outline-pho-brand hover:bg-pho-primary-hover cursor-pointer transition-colors focus-visible:outline-2 focus-visible:-outline-offset-2", "aria-[current=page]:bg-pho-primary-hover", "first:rounded-t-[calc(var(--radius-base)-1px)] last:rounded-b-[calc(var(--radius-base)-1px)]", d && "overflow-hidden", s),
1273
+ children: [/* @__PURE__ */ y("div", {
1274
+ className: p("flex min-w-0 flex-1 items-center", a != null && "gap-3"),
1275
+ children: [a, /* @__PURE__ */ y("div", {
1276
+ className: "min-w-0",
1277
+ children: [/* @__PURE__ */ t("div", {
1278
+ className: "flex min-w-0 items-center gap-1",
1279
+ children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ t("p", {
1280
+ className: "text-pho-primary truncate text-base font-medium",
1281
+ children: e
1282
+ }) : e
1283
+ }), n ? /* @__PURE__ */ t("div", {
1284
+ className: "text-pho-description truncate text-xs",
1285
+ children: n
1286
+ }) : null]
1287
+ })]
1288
+ }), /* @__PURE__ */ y("div", {
1289
+ className: "flex min-w-0 items-center justify-end gap-2",
1290
+ children: [l != null ? /* @__PURE__ */ t("div", {
1291
+ className: "min-w-0",
1292
+ children: l
1293
+ }) : null, /* @__PURE__ */ t(At, {
1294
+ "aria-hidden": !0,
1295
+ className: "text-pho-secondary group-hover:text-pho-secondary-hover size-4 shrink-0 transition-colors"
1296
+ })]
1297
+ })]
1298
+ });
1299
+ }
1300
+ function Dn({ open: e, variant: n = "overlay", modal: a = !1, placeholder: r, onClose: s, children: l }) {
1301
+ const c = R(ze), o = e ?? Y.toArray(l).length > 0, i = c?.setOpen, d = c?.setPresent;
1302
+ return V(() => {
1303
+ if (d != null)
1304
+ return d(!0), () => d(!1);
1305
+ }, [d]), V(() => {
1306
+ if (i != null)
1307
+ return i(o), () => i(!1);
1308
+ }, [i, o]), O(() => {
1309
+ c == null && typeof process < "u" && process.env.NODE_ENV !== "production" && console.warn("BasicPage.Aside: needs a `BasicPage.Root` around it.");
1310
+ }, [c]), c == null || c.slot == null ? null : c.presentation === "page" ? Ce(o ? /* @__PURE__ */ t("div", {
1311
+ "data-basic-page-aside": "page",
1312
+ className: "flex min-w-0 flex-1 flex-col",
1313
+ children: l
1314
+ }) : null, c.slot) : n === "inline" ? Ce(/* @__PURE__ */ t(Hn, {
1315
+ width: c.width,
1316
+ paneHeight: c.paneHeight,
1317
+ onClose: s,
1318
+ open: o,
1319
+ placeholder: r,
1320
+ children: l
1321
+ }), c.slot) : /* @__PURE__ */ t(Fn, {
1322
+ container: c.slot,
1323
+ width: c.width,
1324
+ paneHeight: c.paneHeight,
1325
+ onClose: s,
1326
+ open: o,
1327
+ modal: a,
1328
+ children: l
1329
+ });
1330
+ }
1331
+ function tt() {
1332
+ const [e, n] = w(null), a = $(() => ({ setBack: n }), []), r = E(null);
1333
+ return {
1334
+ back: e,
1335
+ panel: a,
1336
+ closeRef: r,
1337
+ leave: Fe(() => {
1338
+ const s = r.current?.querySelector("a, button");
1339
+ return s == null ? !1 : (s.click(), !0);
1340
+ }, [])
1341
+ };
1342
+ }
1343
+ var Le = {
1344
+ variant: "ghost",
1345
+ size: "sm",
1346
+ svgOnly: !0,
1347
+ "aria-label": "Close",
1348
+ children: /* @__PURE__ */ t(mt, {})
1349
+ };
1350
+ function nt({ back: e, onClose: n, closeRef: a, panel: r, children: s }) {
1351
+ return /* @__PURE__ */ y(he, { children: [/* @__PURE__ */ t("span", {
1352
+ ref: a,
1353
+ className: "absolute top-2 right-2 z-30",
1354
+ children: e != null ? /* @__PURE__ */ t(pe, {
1355
+ ...Le,
1356
+ href: e.href,
1357
+ onClick: e.onClick
1358
+ }) : n != null ? /* @__PURE__ */ t(ie, {
1359
+ ...Le,
1360
+ onClick: n
1361
+ }) : null
1362
+ }), /* @__PURE__ */ y(Q.Root, {
1363
+ className: "min-h-0 flex-1",
1364
+ children: [/* @__PURE__ */ t(Q.Viewport, { children: /* @__PURE__ */ t(Q.Content, {
1365
+ className: "flex min-h-full flex-col",
1366
+ children: /* @__PURE__ */ t(Ve.Provider, {
1367
+ value: r,
1368
+ children: s
1369
+ })
1370
+ }) }), /* @__PURE__ */ t(Q.Scrollbar, { children: /* @__PURE__ */ t(Q.Thumb, {}) })]
1371
+ })] });
1372
+ }
1373
+ function Hn({ width: e, paneHeight: n, onClose: a, open: r, placeholder: s, children: l }) {
1374
+ const c = L(), { back: o, panel: i, closeRef: d, leave: f } = tt(), u = c ? "blur(0px)" : `blur(${De}px)`, m = n ?? "100dvh";
1375
+ O(() => {
1376
+ const v = (g) => {
1377
+ g.key !== "Escape" || g.defaultPrevented || f() && g.preventDefault();
1378
+ };
1379
+ return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
1380
+ }, [f]);
1381
+ const h = {
1382
+ initial: {
1383
+ opacity: 0,
1384
+ filter: u
1385
+ },
1386
+ animate: {
1387
+ opacity: 1,
1388
+ filter: "blur(0px)"
1389
+ },
1390
+ exit: {
1391
+ opacity: 0,
1392
+ filter: u
1393
+ },
1394
+ transition: c ? { duration: 0 } : xe
1395
+ };
1396
+ return /* @__PURE__ */ t("aside", {
1397
+ "data-basic-page-aside": "panel",
1398
+ "data-basic-page-aside-variant": "inline",
1399
+ className: "relative flex shrink-0 flex-col",
1400
+ style: {
1401
+ width: e,
1402
+ minHeight: m
1403
+ },
1404
+ children: /* @__PURE__ */ t("div", {
1405
+ className: "border-pho-secondary bg-pho-primary sticky top-0 grid border-l *:min-h-0 *:[grid-area:1/1]",
1406
+ style: { height: m },
1407
+ children: /* @__PURE__ */ t(G, {
1408
+ initial: !1,
1409
+ children: r ? /* @__PURE__ */ t(N.div, {
1410
+ ...h,
1411
+ className: "relative flex flex-col",
1412
+ children: /* @__PURE__ */ t(nt, {
1413
+ back: o,
1414
+ onClose: a,
1415
+ closeRef: d,
1416
+ panel: i,
1417
+ children: l
1418
+ })
1419
+ }, "page") : /* @__PURE__ */ t(N.div, {
1420
+ ...h,
1421
+ className: "flex flex-col",
1422
+ children: s
1423
+ }, "empty")
1424
+ })
1425
+ })
1426
+ });
1427
+ }
1428
+ function Fn({ container: e, width: n, paneHeight: a, onClose: r, open: s, modal: l, children: c }) {
1429
+ const { back: o, panel: i, closeRef: d, leave: f } = tt(), u = a ?? "100dvh";
1430
+ return /* @__PURE__ */ t(te.Root, {
1431
+ open: s,
1432
+ modal: l ? "trap-focus" : !1,
1433
+ disablePointerDismissal: !0,
1434
+ onOpenChange: (m, h) => {
1435
+ m || (h.cancel(), f());
1436
+ },
1437
+ children: /* @__PURE__ */ y(te.Portal, {
1438
+ container: e,
1439
+ className: "contents",
1440
+ children: [l ? /* @__PURE__ */ t(te.Backdrop, {
1441
+ "data-basic-page-aside-backdrop": "",
1442
+ className: p("bg-pho-overlay absolute inset-0 z-30 transition-opacity duration-200 ease-out motion-reduce:transition-none", "data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"),
1443
+ onClick: f
1444
+ }) : null, /* @__PURE__ */ t(te.Popup, {
1445
+ "data-basic-page-aside": "panel",
1446
+ "data-basic-page-aside-variant": "overlay",
1447
+ initialFocus: l ? void 0 : !1,
1448
+ finalFocus: l ? void 0 : !1,
1449
+ className: p("absolute inset-y-0 right-0 z-30 flex flex-col outline-none", "transition-[translate,opacity] duration-250 ease-out motion-reduce:transition-none", "data-[ending-style]:translate-x-3 data-[ending-style]:opacity-0 data-[ending-style]:duration-200 data-[starting-style]:translate-x-3 data-[starting-style]:opacity-0"),
1450
+ style: { width: n },
1451
+ children: /* @__PURE__ */ t("div", {
1452
+ className: "border-pho-secondary bg-pho-primary shadow-pho-xl sticky top-0 flex flex-col border-l",
1453
+ style: { height: u },
1454
+ children: /* @__PURE__ */ t(nt, {
1455
+ back: o,
1456
+ onClose: r,
1457
+ closeRef: d,
1458
+ panel: i,
1459
+ children: c
1460
+ })
1461
+ })
1462
+ })]
1463
+ })
1464
+ });
1465
+ }
1466
+ var Gn = "14rem", zn = "transition-[width] duration-[330ms] ease-pho-spring motion-reduce:transition-none", Be = "transition-[opacity,visibility] duration-200 ease-out motion-reduce:transition-none";
1467
+ function Vn({ variant: e = "box", fold: n = "auto", value: a, onValueChange: r, placeholder: s, label: l, className: c, ...o }) {
1468
+ const i = R(fe), d = me(i?.subscribe ?? ye, () => i?.get().api ?? null, () => null), f = a != null;
1469
+ O(() => {
1470
+ if (!(i == null || f))
1471
+ return i.adopt(!0), () => i.adopt(!1);
1472
+ }, [i, f]);
1473
+ const u = f ? {
1474
+ query: a,
1475
+ setQuery: r,
1476
+ placeholder: s ?? "Search",
1477
+ label: l ?? s ?? "Search"
1478
+ } : d == null ? null : {
1479
+ query: d.query,
1480
+ setQuery: d.setQuery,
1481
+ placeholder: d.placeholder,
1482
+ label: l ?? d.placeholder
1483
+ }, [m, h] = w(!1), v = E(null), g = m || (u?.query ?? "") !== "";
1484
+ if (O(() => {
1485
+ if (!m) return;
1486
+ let b = 0, k = 0;
1487
+ const x = () => {
1488
+ const _ = v.current;
1489
+ _ != null && (_.focus(), document.activeElement !== _ && k++ < 5 && (b = requestAnimationFrame(x)));
1490
+ };
1491
+ return b = requestAnimationFrame(x), () => cancelAnimationFrame(b);
1492
+ }, [m]), e === "ghost") return /* @__PURE__ */ t("div", {
1493
+ "data-basic-page-search": "",
1494
+ "data-variant": "ghost",
1495
+ className: p("flex min-w-0 flex-1", u == null && "hidden", c),
1496
+ ...o,
1497
+ children: u != null && /* @__PURE__ */ t(pt, {
1498
+ value: u.query,
1499
+ onChange: u.setQuery,
1500
+ placeholder: u.placeholder,
1501
+ "aria-label": u.label,
1502
+ onKeyDown: (b) => {
1503
+ b.key === "Escape" && (b.preventDefault(), u.setQuery(""), b.currentTarget.blur());
1504
+ }
1505
+ })
1506
+ });
1507
+ const C = n === "auto";
1508
+ return /* @__PURE__ */ t("div", {
1509
+ "data-basic-page-search": "",
1510
+ "data-expanded": g || void 0,
1511
+ className: p("grid min-w-0 content-center", "[[data-basic-page-header]>&]:col-start-2 [[data-basic-page-header]>&]:row-span-2 [[data-basic-page-header]>&]:row-start-1 [[data-basic-page-header]>&]:ml-4 [[data-basic-page-header]>&]:justify-items-end [[data-basic-page-header]>&]:self-center", "[[data-basic-page-header]:has([data-basic-page-header-action])>&]:self-start", u == null && "hidden", c),
1512
+ ...o,
1513
+ children: u != null && /* @__PURE__ */ y("div", {
1514
+ className: p("grid w-9 max-w-full justify-items-end *:[grid-area:1/1]", zn, C && "@[36rem]:w-56"),
1515
+ style: g ? { width: Gn } : void 0,
1516
+ children: [/* @__PURE__ */ t(ie, {
1517
+ variant: "outlined",
1518
+ size: "sm",
1519
+ shape: "circle",
1520
+ svgOnly: !0,
1521
+ "aria-label": u.label,
1522
+ "aria-hidden": g || void 0,
1523
+ tabIndex: g ? -1 : void 0,
1524
+ onClick: () => h(!0),
1525
+ className: p(Be, g ? "pointer-events-none invisible opacity-0" : "visible opacity-100", C && "@[36rem]:pointer-events-none @[36rem]:invisible @[36rem]:opacity-0"),
1526
+ children: /* @__PURE__ */ t(Ee, {})
1527
+ }), /* @__PURE__ */ t("div", {
1528
+ inert: !C && !g,
1529
+ className: p("w-full min-w-0", Be, g ? "visible opacity-100" : "pointer-events-none invisible opacity-0", C && "@[36rem]:pointer-events-auto @[36rem]:visible @[36rem]:opacity-100"),
1530
+ children: /* @__PURE__ */ y(le.Root, {
1531
+ size: "sm",
1532
+ className: "w-full",
1533
+ children: [/* @__PURE__ */ t(le.Addon, { children: /* @__PURE__ */ t(Ee, {}) }), /* @__PURE__ */ t(le.Input, {
1534
+ ref: v,
1535
+ type: "search",
1536
+ value: u.query,
1537
+ onChange: (b) => u.setQuery(b.target.value),
1538
+ onBlur: () => {
1539
+ u.query === "" && h(!1);
1540
+ },
1541
+ onKeyDown: (b) => {
1542
+ b.key === "Escape" && (b.preventDefault(), u.setQuery(""), h(!1), b.currentTarget.blur());
1543
+ },
1544
+ placeholder: u.placeholder,
1545
+ "aria-label": u.label
1546
+ })]
1547
+ })
1548
+ })]
1549
+ })
1550
+ });
1551
+ }
1552
+ var ga = {
1553
+ Root: It,
1554
+ Aside: Dn,
1555
+ Search: Vn,
1556
+ Table: dt,
1557
+ CondenseScope: $t,
1558
+ Breadcrumbs: Ze,
1559
+ Crumb: et,
1560
+ Back: Bn,
1561
+ Title: Xt,
1562
+ Stack: Zt,
1563
+ Header: en,
1564
+ HeaderAction: tn,
1565
+ SectionTitle: nn,
1566
+ Description: Qe,
1567
+ TableCount: an,
1568
+ SectionFooter: rn,
1569
+ Card: sn,
1570
+ Item: ln,
1571
+ ItemPanel: on,
1572
+ Callout: cn,
1573
+ CalloutTitle: un,
1574
+ CalloutDescription: dn,
1575
+ Onboard: pn,
1576
+ Step: bn,
1577
+ Row: yn,
1578
+ RowLink: Mn,
1579
+ Value: xn,
1580
+ Alert: wn,
1581
+ Footer: Sn,
1582
+ Form: Nn,
1583
+ Saved: An,
1584
+ Fields: Cn,
1585
+ Inline: _n,
1586
+ Submit: kn,
1587
+ Reveal: Ae
1588
+ };
1589
+ export {
1590
+ _t as a,
1591
+ ga as c,
1592
+ jt as d,
1593
+ ce as f,
1594
+ Ct as i,
1595
+ xe as l,
1596
+ fa as m,
1597
+ _e as n,
1598
+ kt as o,
1599
+ ma as p,
1600
+ Ge as r,
1601
+ Et as s,
1602
+ ha as t,
1603
+ Pe as u
1604
+ };
1605
+
1606
+ //# sourceMappingURL=basic-page-CJwG4I83.js.map