@photon-ai/pho-ui 2.4.0 → 2.6.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,1295 @@
1
+ "use client";
2
+ import { t as d } from "./cn-ChIgwEl3.js";
3
+ import { n as Ae } from "./link-provider-9TFNyDqO.js";
4
+ import { a as se, o as le } from "./button-DNNs5RsT.js";
5
+ import { t as De } from "./createReactComponent-BqCmnqfX.js";
6
+ import { t as Fe } from "./error-Crs-wqMC.js";
7
+ import { t as q } from "./IconChevronLeft-CSWMKQ4C.js";
8
+ import { t as Ve } from "./IconX-pZ9vrtSr.js";
9
+ import { t as Ge } from "./toast-DoXaRPIZ.js";
10
+ import { t as ze } from "./animated-height-C2eQstGy.js";
11
+ import { t as K } from "./scroll-area-Bu7egArU.js";
12
+ import { t as $e } from "./form-AiHbbw4m.js";
13
+ import { i as z } from "./menu-BQeprfxB.js";
14
+ import { Children as J, Fragment as je, createContext as G, isValidElement as We, useContext as T, useEffect as O, useId as Xe, useLayoutEffect as F, useMemo as V, useRef as N, useState as y, useSyncExternalStore as Ke } from "react";
15
+ import { Fragment as Ye, jsx as n, jsxs as x } from "react/jsx-runtime";
16
+ import { AnimatePresence as j, motion as w, useIsPresent as qe, useReducedMotion as I } from "motion/react";
17
+ import { createPortal as he } from "react-dom";
18
+ var Ue = [["path", {
19
+ d: "M9 6l6 6l-6 6",
20
+ key: "svg-0"
21
+ }]], Qe = De("outline", "chevron-right", "ChevronRight", Ue), oe = "rounded-base border border-pho-secondary bg-pho-primary", U = "divide-y divide-pho-secondary [&>:has(+[data-basic-page-alert])]:border-b-0", Je = `${oe} ${U}`, ge = "flex min-w-0 flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5", Ze = "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", et = "flex flex-col gap-3 px-5 py-4", tt = "-mx-5 -mb-4 flex items-center rounded-b-[calc(0.75rem-1px)] bg-pho-secondary py-1 pr-3 pl-5", nt = "-mx-2 -mt-1.5 flex items-center rounded-sm bg-pho-secondary px-2 py-0.5", S = {
22
+ type: "spring",
23
+ stiffness: 400,
24
+ damping: 40
25
+ }, M = {
26
+ duration: 0.25,
27
+ ease: "easeOut"
28
+ }, W = 12, at = 768;
29
+ function rt(e) {
30
+ return Math.round(Math.min(Math.max(e * 0.4, 320), 448));
31
+ }
32
+ var Ce = G(null), Ee = G(null);
33
+ function it(e) {
34
+ const [t, a] = y(null), [i, r] = y(!1), [o, c] = y(!1), [l, s] = y(() => ({
35
+ width: typeof window > "u" ? 0 : window.innerWidth,
36
+ height: null
37
+ }));
38
+ return F(() => {
39
+ const u = e.current;
40
+ if (!i || u == null) return;
41
+ const f = de(u), m = () => {
42
+ const h = u.offsetWidth, g = f?.clientHeight ?? null;
43
+ s((v) => v.width === h && v.height === g ? v : {
44
+ width: h,
45
+ height: g
46
+ });
47
+ };
48
+ if (m(), typeof ResizeObserver > "u") return;
49
+ const p = new ResizeObserver(m);
50
+ return p.observe(u), f != null && p.observe(f), () => p.disconnect();
51
+ }, [e, i]), {
52
+ host: V(() => ({
53
+ slot: t,
54
+ presentation: l.width >= at ? "panel" : "page",
55
+ width: rt(l.width),
56
+ paneHeight: l.height,
57
+ setOpen: c,
58
+ setPresent: r
59
+ }), [t, l]),
60
+ setSlot: a,
61
+ open: o
62
+ };
63
+ }
64
+ function st(e) {
65
+ return e == null ? window.scrollY : e.scrollTop;
66
+ }
67
+ function ve(e, t) {
68
+ e == null ? window.scrollTo({ top: t }) : e.scrollTop = t;
69
+ }
70
+ function lt({ condense: e = !0, width: t = "base", className: a, children: i, ref: r, ...o }) {
71
+ const c = T(Z)?.adopt ?? !1, l = T(Ee), s = t === "wide", u = N(null), [f, m] = y(null), [p, h] = y(null), g = V(() => ({
72
+ setTitle: m,
73
+ setTail: h
74
+ }), []);
75
+ O(() => {
76
+ if (l != null)
77
+ return l.setBack(p), () => l.setBack(null);
78
+ }, [l, p]);
79
+ const { host: v, setSlot: E, open: A } = it(u), _ = A && v.presentation === "page", b = N(!1), L = N(0);
80
+ F(() => {
81
+ const R = u.current;
82
+ if (_ === b.current || R == null) return;
83
+ b.current = _;
84
+ const B = de(R);
85
+ _ ? (L.current = st(B), ve(B, 0)) : ve(B, L.current);
86
+ }, [_]);
87
+ const H = e ? /* @__PURE__ */ n(ot, {
88
+ title: f,
89
+ tail: l == null ? p : null,
90
+ silent: _ || l != null
91
+ }) : null, P = /* @__PURE__ */ n("div", {
92
+ "data-basic-page-column": "",
93
+ className: d("mx-auto flex w-full min-w-0 flex-1 flex-col px-5 pt-12 pb-12 *:min-w-0", s ? "max-w-[82.5rem]" : "max-w-[44.5rem]", c || l != null ? "[&_[data-basic-page-back]]:hidden" : "has-[[data-basic-page-back]]:pt-16"),
94
+ children: e ? /* @__PURE__ */ n(ue.Provider, {
95
+ value: g,
96
+ children: i
97
+ }) : i
98
+ });
99
+ return /* @__PURE__ */ n("div", {
100
+ "data-basic-page-root": "",
101
+ "data-basic-page-width": s ? "wide" : void 0,
102
+ className: d("relative flex min-h-full w-full min-w-0 flex-row", a),
103
+ ...o,
104
+ ref: (R) => {
105
+ u.current = R, typeof r == "function" ? r(R) : r != null && (r.current = R);
106
+ },
107
+ children: /* @__PURE__ */ x(Ce.Provider, {
108
+ value: v,
109
+ children: [/* @__PURE__ */ x("div", {
110
+ "data-basic-page-main": "",
111
+ className: d("flex min-w-0 flex-1 flex-col", _ && "hidden"),
112
+ children: [H, P]
113
+ }), /* @__PURE__ */ n("div", {
114
+ ref: E,
115
+ className: "contents"
116
+ })]
117
+ })
118
+ });
119
+ }
120
+ function ot({ title: e, tail: t, silent: a = !1 }) {
121
+ const i = I(), [r, o] = y(!1), c = T(Z), l = Xe();
122
+ O(() => {
123
+ if (c != null) {
124
+ if (a) {
125
+ c.store.clear(l);
126
+ return;
127
+ }
128
+ c.store.set(l, {
129
+ condensed: r,
130
+ title: e?.label ?? null,
131
+ back: t
132
+ });
133
+ }
134
+ }, [
135
+ c,
136
+ l,
137
+ r,
138
+ e,
139
+ t,
140
+ a
141
+ ]), O(() => {
142
+ if (c != null)
143
+ return () => c.store.clear(l);
144
+ }, [c, l]);
145
+ const s = e?.el ?? null;
146
+ return O(() => {
147
+ if (s == null || typeof IntersectionObserver > "u") return;
148
+ const u = new IntersectionObserver(([f]) => o(f != null && !f.isIntersecting), { root: de(s) });
149
+ return u.observe(s), () => u.disconnect();
150
+ }, [s]), /* @__PURE__ */ n("div", {
151
+ "data-basic-page-condense": "",
152
+ className: "sticky top-0 z-20 h-0 overflow-visible",
153
+ children: /* @__PURE__ */ n(j, { children: r && !(c?.adopt ?? !1) && /* @__PURE__ */ x(w.div, {
154
+ initial: {
155
+ opacity: 0,
156
+ y: i ? 0 : -8
157
+ },
158
+ animate: {
159
+ opacity: 1,
160
+ y: 0
161
+ },
162
+ exit: {
163
+ opacity: 0,
164
+ y: i ? 0 : -8
165
+ },
166
+ transition: {
167
+ ...ee,
168
+ y: xt
169
+ },
170
+ 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",
171
+ children: [/* @__PURE__ */ n("div", {
172
+ className: "flex min-w-0 items-center justify-start",
173
+ children: t != null && /* @__PURE__ */ n(le, {
174
+ variant: "ghost",
175
+ size: "sm",
176
+ href: t.href,
177
+ onClick: t.onClick,
178
+ prefix: /* @__PURE__ */ n("span", {
179
+ className: "inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0",
180
+ children: /* @__PURE__ */ n(q, {})
181
+ }),
182
+ className: "min-w-max",
183
+ children: t.label
184
+ })
185
+ }), /* @__PURE__ */ n("span", {
186
+ className: "text-pho-primary block max-w-full min-w-0 truncate text-center text-base font-medium",
187
+ children: e?.label
188
+ })]
189
+ }) })
190
+ });
191
+ }
192
+ function ct(e) {
193
+ return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
194
+ }
195
+ function ut(e) {
196
+ if (!(typeof e != "string" && typeof e != "number"))
197
+ return ct(String(e)) || void 0;
198
+ }
199
+ function ce(e, t) {
200
+ if (e !== "")
201
+ return e ?? ut(t);
202
+ }
203
+ var dt = (e) => `basic-page-morph-${e}`, ft = { layout: S }, ye = 10, be = {
204
+ delay: 0.2,
205
+ duration: 0.12,
206
+ ease: "easeOut"
207
+ }, mt = {
208
+ duration: 0.18,
209
+ ease: "easeOut"
210
+ }, pt = -8, ht = {
211
+ duration: 0.16,
212
+ ease: "easeOut"
213
+ }, gt = {
214
+ delay: 0.14,
215
+ duration: 0.16,
216
+ ease: "easeOut"
217
+ }, _e = {
218
+ duration: 0.12,
219
+ ease: "easeOut"
220
+ }, $ = [];
221
+ function vt(e) {
222
+ const t = N({ labels: e });
223
+ t.current.labels = e, F(() => {
224
+ const a = t.current;
225
+ return $.push(a), () => {
226
+ $.splice($.indexOf(a), 1);
227
+ };
228
+ }, []);
229
+ }
230
+ function ke() {
231
+ const [e] = y(() => {
232
+ const t = $[$.length - 1];
233
+ return t ? { labels: [...t.labels] } : null;
234
+ });
235
+ return e;
236
+ }
237
+ var ue = G(null), re = {
238
+ condensed: !1,
239
+ title: null,
240
+ back: null
241
+ }, Z = G(null), yt = () => () => {
242
+ }, xe = () => re;
243
+ function bt({ adopt: e = !0, children: t }) {
244
+ const [a] = y(() => {
245
+ let r = re, o = null;
246
+ const c = /* @__PURE__ */ new Set(), l = () => {
247
+ for (const s of c) s();
248
+ };
249
+ return {
250
+ get: () => r,
251
+ set(s, u) {
252
+ o = s, r = u, l();
253
+ },
254
+ clear(s) {
255
+ o === s && (o = null, r = re, l());
256
+ },
257
+ subscribe(s) {
258
+ return c.add(s), () => c.delete(s);
259
+ }
260
+ };
261
+ }), i = V(() => ({
262
+ store: a,
263
+ adopt: e
264
+ }), [a, e]);
265
+ return /* @__PURE__ */ n(Z.Provider, {
266
+ value: i,
267
+ children: t
268
+ });
269
+ }
270
+ function Cn() {
271
+ const e = T(Z);
272
+ return Ke(e?.store.subscribe ?? yt, e?.store.get ?? xe, e?.store.get ?? xe);
273
+ }
274
+ var ee = {
275
+ duration: 0.2,
276
+ ease: "easeOut"
277
+ }, xt = {
278
+ duration: ee.duration,
279
+ ease: "linear"
280
+ }, En = -8;
281
+ function de(e) {
282
+ if (typeof getComputedStyle != "function") return null;
283
+ for (let t = e.parentElement; t != null && t !== document.body; t = t.parentElement) {
284
+ const { overflowY: a } = getComputedStyle(t);
285
+ if (a === "auto" || a === "scroll") return t;
286
+ }
287
+ return null;
288
+ }
289
+ var ne = /* @__PURE__ */ new Map(), wt = 96;
290
+ function Nt(e) {
291
+ const t = e.closest("[data-basic-page-root]"), a = t?.querySelector("[data-basic-page-column]");
292
+ return !t || !a ? 0 : a.getBoundingClientRect().left - t.getBoundingClientRect().left;
293
+ }
294
+ function Re(e) {
295
+ const [t] = y(() => {
296
+ if (e == null) return !1;
297
+ const i = ne.get(e);
298
+ return i != null && i.visible && i.el.isConnected && Nt(i.el) <= wt;
299
+ }), a = N(null);
300
+ return O(() => {
301
+ if (e == null || typeof IntersectionObserver > "u") return;
302
+ const i = a.current;
303
+ if (!i) return;
304
+ const r = new IntersectionObserver(([o]) => {
305
+ o && ne.set(e, {
306
+ visible: o.isIntersecting,
307
+ el: i
308
+ });
309
+ });
310
+ return r.observe(i), () => {
311
+ r.disconnect(), ne.delete(e);
312
+ };
313
+ }, [e]), {
314
+ fly: t,
315
+ ref: a
316
+ };
317
+ }
318
+ var At = {
319
+ fade: {
320
+ initial: { opacity: 0 },
321
+ animate: { opacity: 1 },
322
+ transition: { opacity: M }
323
+ },
324
+ rise: {
325
+ initial: {
326
+ opacity: 0,
327
+ y: W
328
+ },
329
+ animate: {
330
+ opacity: 1,
331
+ y: 0
332
+ },
333
+ transition: {
334
+ y: S,
335
+ opacity: M
336
+ }
337
+ },
338
+ slide: {
339
+ initial: { x: "-100%" },
340
+ animate: { x: 0 },
341
+ transition: { x: gt }
342
+ }
343
+ };
344
+ function Se({ morphId: e, fromClassName: t, fly: a, morphRef: i, arrival: r, className: o, children: c }) {
345
+ const [l, s] = y(!1), u = !a && r != null ? At[r] : null;
346
+ return /* @__PURE__ */ x(w.span, {
347
+ ref: i,
348
+ layoutId: dt(e),
349
+ initial: u?.initial,
350
+ animate: u?.animate,
351
+ transition: a ? ft : {
352
+ layout: { duration: 0 },
353
+ ...u?.transition
354
+ },
355
+ onLayoutAnimationStart: () => {
356
+ a && s(!0);
357
+ },
358
+ onLayoutAnimationComplete: () => s(!1),
359
+ className: d("relative inline-block", o),
360
+ children: [c, l && /* @__PURE__ */ n(w.span, {
361
+ "aria-hidden": !0,
362
+ initial: { opacity: 1 },
363
+ animate: { opacity: 0 },
364
+ transition: mt,
365
+ onAnimationComplete: () => s(!1),
366
+ className: d("absolute inset-0", t),
367
+ children: c
368
+ })]
369
+ });
370
+ }
371
+ var we = "max-w-full min-w-0 truncate align-top";
372
+ function Ct({ id: e, morphId: t, enter: a, className: i, children: r, ...o }) {
373
+ const c = ce(e, r), l = I(), s = Re(t), u = ke(), f = !l && (t != null || a === !0), m = a || u != null ? "rise" : void 0, p = T(ue), h = N(null);
374
+ F(() => {
375
+ if (p != null)
376
+ return p.setTitle({
377
+ label: r,
378
+ el: h.current
379
+ }), () => p.setTitle(null);
380
+ }, [p, r]);
381
+ const [g, v] = y(s.fly && u != null);
382
+ return F(() => {
383
+ $.length > 0 && v(!1);
384
+ }, []), /* @__PURE__ */ x("h1", {
385
+ id: c,
386
+ className: d("text-display-base text-pho-primary max-w-full min-w-0 scroll-mt-12 px-5 font-medium", f ? "whitespace-nowrap" : "truncate", i),
387
+ ...o,
388
+ ref: (E) => {
389
+ h.current = E;
390
+ const A = o.ref;
391
+ typeof A == "function" ? A(E) : A != null && (A.current = E);
392
+ },
393
+ children: [t != null && !l ? /* @__PURE__ */ n(Se, {
394
+ morphId: t,
395
+ fromClassName: "text-pho-secondary",
396
+ fly: s.fly,
397
+ morphRef: s.ref,
398
+ arrival: m,
399
+ className: we,
400
+ children: r
401
+ }) : a && !l ? /* @__PURE__ */ n(w.span, {
402
+ initial: {
403
+ opacity: 0,
404
+ y: W
405
+ },
406
+ animate: {
407
+ opacity: 1,
408
+ y: 0
409
+ },
410
+ transition: {
411
+ y: S,
412
+ opacity: M
413
+ },
414
+ className: d("inline-block", we),
415
+ children: r
416
+ }) : r, g && /* @__PURE__ */ n(w.span, {
417
+ "aria-hidden": !0,
418
+ initial: { opacity: 1 },
419
+ animate: { opacity: 0 },
420
+ transition: _e,
421
+ onAnimationComplete: () => v(!1),
422
+ className: d("text-pho-secondary pointer-events-none absolute inline-flex items-center", Qt),
423
+ children: /* @__PURE__ */ n(q, {})
424
+ })]
425
+ });
426
+ }
427
+ var Te = G(!1);
428
+ function Et() {
429
+ const e = T(Te), t = I(), [a] = y(() => e && !t);
430
+ return a;
431
+ }
432
+ var _t = {
433
+ height: 0,
434
+ opacity: 0,
435
+ paddingTop: 0,
436
+ paddingBottom: 0,
437
+ borderTopWidth: 0
438
+ }, kt = {
439
+ y: S,
440
+ opacity: M,
441
+ height: S,
442
+ paddingTop: S,
443
+ paddingBottom: S,
444
+ borderTopWidth: S
445
+ };
446
+ function fe() {
447
+ const e = Et(), t = qe(), a = I();
448
+ return {
449
+ initial: e ? {
450
+ opacity: 0,
451
+ y: W
452
+ } : !1,
453
+ animate: {
454
+ opacity: 1,
455
+ y: 0
456
+ },
457
+ exit: _t,
458
+ transition: a ? { duration: 0 } : kt,
459
+ leaving: !t
460
+ };
461
+ }
462
+ var Rt = typeof process < "u" && process.env.NODE_ENV !== "production";
463
+ function Pe(e, t, a, i) {
464
+ O(() => {
465
+ if (!Rt || e.current == null || typeof getComputedStyle != "function") return;
466
+ const r = (c) => {
467
+ const l = getComputedStyle(c).rowGap;
468
+ return l === "" || l === "normal" ? null : parseFloat(l);
469
+ }, o = r(e.current);
470
+ o != null && o !== a && console.warn(`[BasicPage.${t}] spaced at ${o}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);
471
+ for (const c of Array.from(e.current.children)) {
472
+ const l = i(c);
473
+ if (l == null || getComputedStyle(c).display === "contents") continue;
474
+ const s = r(c);
475
+ s != null && s !== l && console.warn(`[BasicPage.${t}] a child is spaced at ${s}px instead of ${l}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);
476
+ }
477
+ });
478
+ }
479
+ function St({ className: e, children: t, ...a }) {
480
+ const i = I(), r = N(null);
481
+ Pe(r, "Stack", 40, (u) => u.hasAttribute("data-basic-page-fields") ? 20 : 12);
482
+ const o = a["aria-busy"], c = o === !0 || o === "true", l = N(c), s = l.current && !c;
483
+ return O(() => {
484
+ l.current = c;
485
+ }), /* @__PURE__ */ n(w.div, {
486
+ ref: (u) => {
487
+ r.current = u;
488
+ const f = a.ref;
489
+ typeof f == "function" ? f(u) : f != null && (f.current = u);
490
+ },
491
+ "data-basic-page-stack": "",
492
+ initial: i ? !1 : {
493
+ opacity: 0,
494
+ y: W
495
+ },
496
+ animate: {
497
+ opacity: 1,
498
+ y: 0
499
+ },
500
+ transition: {
501
+ y: S,
502
+ opacity: M
503
+ },
504
+ className: d("mt-6 flex min-w-0 flex-col gap-10", "*:flex *:min-w-0 *:flex-col [&>*:not([data-basic-page-fields])]:gap-3", e),
505
+ ...a,
506
+ children: /* @__PURE__ */ n(Te.Provider, {
507
+ value: s,
508
+ children: t
509
+ })
510
+ });
511
+ }
512
+ var Ne = "flex min-w-0 flex-col mb-3 [[data-basic-page-callout]_&]:mb-0 [[data-basic-page-stack]>*>&]:mb-0";
513
+ function Tt({ enter: e, className: t, ...a }) {
514
+ const i = I();
515
+ return e && !i ? /* @__PURE__ */ n(w.div, {
516
+ initial: {
517
+ opacity: 0,
518
+ y: W
519
+ },
520
+ animate: {
521
+ opacity: 1,
522
+ y: 0
523
+ },
524
+ transition: {
525
+ y: S,
526
+ opacity: M
527
+ },
528
+ "data-basic-page-header": "",
529
+ className: d(Ne, t),
530
+ ...a
531
+ }) : /* @__PURE__ */ n("div", {
532
+ "data-basic-page-header": "",
533
+ className: d(Ne, t),
534
+ ...a
535
+ });
536
+ }
537
+ function Pt({ id: e, className: t, children: a, ...i }) {
538
+ const r = ce(e, a);
539
+ return /* @__PURE__ */ n("h2", {
540
+ id: r,
541
+ className: d("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", t),
542
+ ...i,
543
+ children: a
544
+ });
545
+ }
546
+ function Ot({ className: e, ...t }) {
547
+ return /* @__PURE__ */ n("p", {
548
+ className: d("text-display-xs text-pho-description px-5 font-normal", e),
549
+ ...t
550
+ });
551
+ }
552
+ function It({ className: e, ...t }) {
553
+ return /* @__PURE__ */ n("p", {
554
+ className: d("text-pho-description px-5 text-xs font-normal", "mt-3 [[data-basic-page-callout]_&]:mt-0 [[data-basic-page-stack]>*>&]:mt-0", e),
555
+ ...t
556
+ });
557
+ }
558
+ function Lt({ animateHeight: e, className: t, children: a, ...i }) {
559
+ const r = /* @__PURE__ */ n(j, { children: J.toArray(a) });
560
+ return e ? /* @__PURE__ */ n("div", {
561
+ className: d(oe, "min-h-0 overflow-hidden", t),
562
+ ...i,
563
+ children: /* @__PURE__ */ n(ze, {
564
+ transition: S,
565
+ className: U,
566
+ children: r
567
+ })
568
+ }) : /* @__PURE__ */ n("div", {
569
+ className: d(Je, t),
570
+ ...i,
571
+ children: r
572
+ });
573
+ }
574
+ function Bt({ className: e, ...t }) {
575
+ const { leaving: a, ...i } = fe();
576
+ return /* @__PURE__ */ n(w.div, {
577
+ ...i,
578
+ className: d(et, a && "overflow-hidden", e),
579
+ ...t
580
+ });
581
+ }
582
+ function Mt({ divided: e = !1, className: t, ...a }) {
583
+ return /* @__PURE__ */ n("div", {
584
+ className: d(e ? nt : tt, t),
585
+ ...a
586
+ });
587
+ }
588
+ function Ht({ className: e, icon: t, children: a, ...i }) {
589
+ if (t == null || t === !1 || t === !0) return /* @__PURE__ */ n("div", {
590
+ "data-basic-page-callout": "",
591
+ className: d(ge, e),
592
+ ...i,
593
+ children: a
594
+ });
595
+ const [r, ...o] = J.toArray(a);
596
+ return /* @__PURE__ */ x("div", {
597
+ "data-basic-page-callout": "",
598
+ className: d(ge, e),
599
+ ...i,
600
+ children: [/* @__PURE__ */ x("div", {
601
+ className: "relative",
602
+ children: [/* @__PURE__ */ n("div", {
603
+ className: "min-w-0 pr-16",
604
+ children: r
605
+ }), /* @__PURE__ */ n("div", {
606
+ "aria-hidden": !0,
607
+ className: "text-pho-primary pointer-events-none absolute top-0 right-0 size-14 opacity-[0.275] [&>svg]:size-full",
608
+ children: t
609
+ })]
610
+ }), o]
611
+ });
612
+ }
613
+ function Dt({ id: e, className: t, children: a, ...i }) {
614
+ const r = ce(e, a);
615
+ return /* @__PURE__ */ n("h2", {
616
+ id: r,
617
+ className: d("text-display-xs text-pho-primary max-w-full min-w-0 scroll-mt-12 truncate font-medium", t),
618
+ ...i,
619
+ children: a
620
+ });
621
+ }
622
+ function Ft({ className: e, ...t }) {
623
+ return /* @__PURE__ */ n("p", {
624
+ className: d("text-display-xs text-pho-description font-normal", e),
625
+ ...t
626
+ });
627
+ }
628
+ function Vt({ label: e, description: t, htmlFor: a, stacked: i = !1, className: r, children: o, ...c }) {
629
+ const { leaving: l, ...s } = fe();
630
+ return /* @__PURE__ */ x(w.div, {
631
+ ...s,
632
+ className: d(Ze, i && "sm:flex-col sm:items-stretch sm:justify-start sm:gap-3", l && "overflow-hidden", r),
633
+ ...c,
634
+ children: [/* @__PURE__ */ x("div", {
635
+ className: "min-w-0",
636
+ children: [a ? /* @__PURE__ */ n("label", {
637
+ htmlFor: a,
638
+ className: "text-pho-primary block text-base font-normal",
639
+ children: e
640
+ }) : /* @__PURE__ */ n("div", {
641
+ className: "text-pho-primary text-base font-normal",
642
+ children: e
643
+ }), t ? /* @__PURE__ */ n("p", {
644
+ className: "text-pho-description text-xs",
645
+ children: t
646
+ }) : null]
647
+ }), /* @__PURE__ */ n("div", {
648
+ className: d("flex w-full min-w-0 items-center gap-2 sm:w-auto", i && "sm:w-full"),
649
+ children: o
650
+ })]
651
+ });
652
+ }
653
+ function Gt({ className: e, ...t }) {
654
+ return /* @__PURE__ */ n("p", {
655
+ className: d("text-pho-description max-w-full min-w-0 truncate text-base", e),
656
+ ...t
657
+ });
658
+ }
659
+ function zt({ error: e, show: t, className: a, children: i, ...r }) {
660
+ const o = I(), c = T(X), l = e ?? c?.error ?? void 0;
661
+ return /* @__PURE__ */ n(j, {
662
+ initial: !1,
663
+ children: (t ?? !0) && (l != null || i != null) ? /* @__PURE__ */ n(w.div, {
664
+ "data-basic-page-alert": "",
665
+ className: "overflow-hidden",
666
+ initial: {
667
+ height: 0,
668
+ opacity: 0
669
+ },
670
+ animate: {
671
+ height: "auto",
672
+ opacity: 1
673
+ },
674
+ exit: {
675
+ height: 0,
676
+ opacity: 0
677
+ },
678
+ transition: o ? { duration: 0 } : {
679
+ height: S,
680
+ opacity: M
681
+ },
682
+ children: /* @__PURE__ */ n(Fe, {
683
+ error: l,
684
+ className: d("px-5 pb-3", a),
685
+ ...r,
686
+ children: i
687
+ })
688
+ }) : null
689
+ });
690
+ }
691
+ function _n() {
692
+ return T(X)?.requestSave ?? null;
693
+ }
694
+ var kn = 800, ae = Ge.createToastManager(), X = G(null);
695
+ function $t({ action: e, errors: t, autoSave: a = !1, className: i, children: r, onChange: o, onBlur: c, ...l }) {
696
+ const [s, u] = y(!1), [f, m] = y(!1), [p, h] = y(null), [g, v] = y(t ?? {}), [E, A] = y(null), _ = N(null), b = N(null), L = N(null), H = N(!1), P = N(!1), R = N(null), B = N(async () => {
697
+ });
698
+ O(() => () => {
699
+ b.current != null && clearTimeout(b.current);
700
+ }, []);
701
+ const te = async () => {
702
+ const k = _.current;
703
+ if (k == null || e == null) return;
704
+ if (H.current) {
705
+ P.current = !0;
706
+ return;
707
+ }
708
+ if (!k.checkValidity()) return;
709
+ const C = Object.fromEntries(new FormData(k).entries()), Y = L.current;
710
+ H.current = !0, A({
711
+ field: Y,
712
+ phase: "saving"
713
+ }), h(null);
714
+ try {
715
+ const D = (await e(C))?.errors;
716
+ if (D != null && Object.keys(D).length > 0) {
717
+ v(D), A(null);
718
+ return;
719
+ }
720
+ v({}), m(!1), A({
721
+ field: Y,
722
+ phase: "saved"
723
+ }), R.current != null && (ae.close(R.current), R.current = null);
724
+ } catch (D) {
725
+ A(null), h(D), R.current != null && ae.close(R.current), R.current = ae.add({
726
+ type: "error",
727
+ title: "Couldn't save",
728
+ description: D instanceof Error && D.message !== "" ? D.message : "The change is still here — try again.",
729
+ timeout: 0,
730
+ actionProps: {
731
+ children: "Retry",
732
+ onClick: () => {
733
+ B.current();
734
+ }
735
+ }
736
+ });
737
+ } finally {
738
+ H.current = !1, P.current && (P.current = !1, B.current());
739
+ }
740
+ };
741
+ B.current = te;
742
+ const me = () => {
743
+ b.current != null && clearTimeout(b.current), b.current = setTimeout(() => {
744
+ b.current = null, B.current();
745
+ }, 800);
746
+ }, pe = V(() => a ? (k) => {
747
+ k != null && (L.current = k), m(!0), me();
748
+ } : null, [a]), Me = V(() => ({
749
+ pending: s,
750
+ dirty: f,
751
+ error: p,
752
+ auto: E,
753
+ requestSave: pe
754
+ }), [
755
+ s,
756
+ f,
757
+ p,
758
+ E,
759
+ pe
760
+ ]);
761
+ return /* @__PURE__ */ n(X.Provider, {
762
+ value: Me,
763
+ children: /* @__PURE__ */ n($e, {
764
+ errors: g,
765
+ onFormSubmit: async (k) => {
766
+ if (e != null) {
767
+ u(!0), h(null);
768
+ try {
769
+ const C = (await e(k))?.errors;
770
+ if (C != null && Object.keys(C).length > 0) {
771
+ v(C);
772
+ return;
773
+ }
774
+ v({}), m(!1);
775
+ } catch (C) {
776
+ h(C);
777
+ } finally {
778
+ u(!1);
779
+ }
780
+ }
781
+ },
782
+ onChange: (k) => {
783
+ m(!0), h(null);
784
+ const C = k.target.name;
785
+ C && C in g && v((Y) => {
786
+ const { [C]: D, ...He } = Y;
787
+ return He;
788
+ }), a && (C && (L.current = C), me()), o?.(k);
789
+ },
790
+ onBlur: (k) => {
791
+ a && f && b.current != null && (clearTimeout(b.current), b.current = null, B.current()), c?.(k);
792
+ },
793
+ className: d("contents [[data-basic-page-stack]>&]:flex [[data-basic-page-stack]>&]:min-w-0 [[data-basic-page-stack]>&]:flex-col", i),
794
+ ...l,
795
+ ref: (k) => {
796
+ _.current = k;
797
+ const C = l.ref;
798
+ typeof C == "function" ? C(k) : C != null && (C.current = k);
799
+ },
800
+ children: /* @__PURE__ */ n("fieldset", {
801
+ disabled: s,
802
+ "aria-busy": s || void 0,
803
+ className: "contents",
804
+ children: r
805
+ })
806
+ })
807
+ });
808
+ }
809
+ function jt({ name: e, className: t, ...a }) {
810
+ const i = T(X), r = I(), o = i?.auto ?? null, c = o != null && (e == null || o.field === e), [l, s] = y(!1), u = c ? o.phase : null;
811
+ O(() => {
812
+ if (u !== "saved") return;
813
+ s(!0);
814
+ const p = setTimeout(() => s(!1), 1800);
815
+ return () => clearTimeout(p);
816
+ }, [u, o]);
817
+ const f = u === "saving" ? "Saving…" : u === "saved" && l ? "Saved" : null, m = r ? "blur(0px)" : "blur(1px)";
818
+ return /* @__PURE__ */ n("span", {
819
+ className: "grid justify-items-end",
820
+ children: /* @__PURE__ */ n(j, {
821
+ initial: !1,
822
+ children: f != null && /* @__PURE__ */ n(w.output, {
823
+ initial: {
824
+ opacity: 0,
825
+ filter: m
826
+ },
827
+ animate: {
828
+ opacity: 1,
829
+ filter: "blur(0px)"
830
+ },
831
+ exit: {
832
+ opacity: 0,
833
+ filter: m
834
+ },
835
+ transition: ee,
836
+ className: d("text-pho-description pl-8 [grid-area:1/1]", t),
837
+ style: { background: "linear-gradient(to left, var(--background-color-pho-primary) calc(100% - 2rem), transparent)" },
838
+ ...a,
839
+ children: f
840
+ }, f)
841
+ })
842
+ });
843
+ }
844
+ var Wt = "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";
845
+ function Xt({ className: e, ...t }) {
846
+ const a = N(null);
847
+ return Pe(a, "Fields", 20, () => null), /* @__PURE__ */ n("div", {
848
+ "data-basic-page-fields": "",
849
+ className: d(oe, Wt, e),
850
+ ...t,
851
+ ref: (i) => {
852
+ a.current = i;
853
+ const r = t.ref;
854
+ typeof r == "function" ? r(i) : r != null && (r.current = i);
855
+ }
856
+ });
857
+ }
858
+ function Kt({ className: e, ...t }) {
859
+ return /* @__PURE__ */ n("div", {
860
+ className: d("flex min-w-0 flex-col gap-5 *:min-w-0 sm:flex-row sm:gap-3 sm:*:flex-1", e),
861
+ ...t
862
+ });
863
+ }
864
+ function Yt({ children: e = "Save changes", ...t }) {
865
+ const a = T(X);
866
+ return /* @__PURE__ */ n(se, {
867
+ type: "submit",
868
+ variant: "effect",
869
+ size: "sm",
870
+ loading: a?.pending,
871
+ ...t,
872
+ children: e
873
+ });
874
+ }
875
+ function qt({ show: e, className: t, ...a }) {
876
+ const i = T(X), r = e === "dirty" ? i?.dirty ?? !1 : e, o = /* @__PURE__ */ n("div", {
877
+ "data-basic-page-footer": "",
878
+ className: d("flex items-center justify-end gap-3 pr-[calc(1.25rem+2.5px)]", t),
879
+ ...a
880
+ });
881
+ return r === void 0 ? o : /* @__PURE__ */ n(Oe, {
882
+ show: r,
883
+ gap: "block",
884
+ clip: !1,
885
+ children: o
886
+ });
887
+ }
888
+ var Ut = {
889
+ stack: "-2.5rem",
890
+ block: "-0.75rem",
891
+ fields: "-1.25rem",
892
+ none: "0px"
893
+ };
894
+ function Oe({ show: e, clip: t = !0, gap: a = "stack", dividers: i, className: r, ...o }) {
895
+ const c = I(), l = Ut[i ? "none" : a], s = N(null), u = N(e !== !0);
896
+ O(() => {
897
+ u.current = !0;
898
+ }, []);
899
+ const f = () => {
900
+ t && s.current && (s.current.style.overflow = "hidden");
901
+ }, m = () => {
902
+ s.current && (s.current.style.overflow = "");
903
+ };
904
+ return e === void 0 ? /* @__PURE__ */ n(w.div, {
905
+ initial: c ? !1 : {
906
+ opacity: 0,
907
+ y: W
908
+ },
909
+ animate: {
910
+ opacity: 1,
911
+ y: 0
912
+ },
913
+ transition: {
914
+ y: S,
915
+ opacity: M
916
+ },
917
+ className: d(i && U, r),
918
+ ...o
919
+ }) : /* @__PURE__ */ n(j, {
920
+ initial: !1,
921
+ children: e ? /* @__PURE__ */ n(w.div, {
922
+ "data-basic-page-reveal": "",
923
+ ref: (p) => {
924
+ s.current = p, t && p && u.current && (p.style.overflow = "hidden");
925
+ },
926
+ onAnimationStart: f,
927
+ onAnimationComplete: m,
928
+ initial: {
929
+ height: 0,
930
+ opacity: 0,
931
+ marginTop: l
932
+ },
933
+ animate: {
934
+ height: "auto",
935
+ opacity: 1,
936
+ marginTop: 0
937
+ },
938
+ exit: {
939
+ height: 0,
940
+ opacity: 0,
941
+ marginTop: l
942
+ },
943
+ transition: c ? { duration: 0 } : {
944
+ height: S,
945
+ marginTop: S,
946
+ opacity: M
947
+ },
948
+ className: d(i && U, r),
949
+ ...o
950
+ }) : null
951
+ });
952
+ }
953
+ var Qt = "top-4 left-5 h-8 text-base [&>svg]:size-[1.125em] [&>svg]:shrink-0", Jt = "(min-width: 40rem)";
954
+ function Zt() {
955
+ return typeof window < "u" && typeof window.matchMedia == "function" && !window.matchMedia(Jt).matches;
956
+ }
957
+ var Ie = G(null);
958
+ function Le({ className: e, children: t, ...a }) {
959
+ const i = J.toArray(t).filter(We), r = i.map((_) => _.props.children ?? null), o = ke();
960
+ vt(r);
961
+ const [c] = y(Zt), l = I(), s = i.length, u = Ae(), f = !c && s >= en, m = T(ue), p = s > 0 ? i[s - 1]?.props : null, h = p?.children ?? "Back", g = p?.href, v = p?.onClick;
962
+ F(() => {
963
+ if (!(m == null || g == null))
964
+ return m.setTail({
965
+ label: h,
966
+ href: g,
967
+ onClick: v
968
+ }), () => m.setTail(null);
969
+ }, [
970
+ m,
971
+ h,
972
+ g,
973
+ v
974
+ ]);
975
+ const [E, A] = y(!l && !c && o != null && o.labels.length > s);
976
+ return /* @__PURE__ */ n("nav", {
977
+ "aria-label": "Breadcrumb",
978
+ "data-basic-page-back": "",
979
+ className: d("absolute top-4 left-3 flex min-w-max items-center", e),
980
+ ...a,
981
+ children: /* @__PURE__ */ x("ol", {
982
+ className: "m-0 flex list-none items-center p-0",
983
+ children: [i.map((_, b) => f && b > 0 && b < s - 2 ? null : /* @__PURE__ */ x(je, { children: [f && b === s - 2 && /* @__PURE__ */ x("li", {
984
+ className: "m-0 flex items-center max-sm:hidden",
985
+ children: [/* @__PURE__ */ n("span", {
986
+ "aria-hidden": !0,
987
+ className: ie,
988
+ children: Q
989
+ }), /* @__PURE__ */ x(z.Root, { children: [/* @__PURE__ */ n(z.Trigger, { render: /* @__PURE__ */ n(se, {
990
+ variant: "ghost",
991
+ size: "sm",
992
+ "aria-label": "Hidden pages",
993
+ className: "px-2",
994
+ children: tn
995
+ }) }), /* @__PURE__ */ n(z.Portal, { children: /* @__PURE__ */ n(z.Positioner, {
996
+ align: "start",
997
+ sideOffset: 4,
998
+ children: /* @__PURE__ */ n(z.Popup, { children: i.slice(1, s - 2).map((L, H) => {
999
+ const P = L.props;
1000
+ return /* @__PURE__ */ n(z.LinkItem, {
1001
+ render: /* @__PURE__ */ n(u, {
1002
+ href: P.href,
1003
+ onClick: P.onClick
1004
+ }),
1005
+ children: P.children ?? "Back"
1006
+ }, L.key ?? H);
1007
+ }) })
1008
+ }) })] })]
1009
+ }), /* @__PURE__ */ n("li", {
1010
+ className: d("m-0 flex items-center", b < s - 1 && "max-sm:hidden"),
1011
+ children: /* @__PURE__ */ n(Ie.Provider, {
1012
+ value: {
1013
+ index: b,
1014
+ count: s,
1015
+ departing: o,
1016
+ narrow: c
1017
+ },
1018
+ children: _
1019
+ })
1020
+ })] }, _.key ?? b)), E && /* @__PURE__ */ n("li", {
1021
+ "aria-hidden": !0,
1022
+ className: "m-0 flex items-center max-sm:hidden",
1023
+ children: /* @__PURE__ */ n(w.span, {
1024
+ initial: { opacity: 1 },
1025
+ animate: { opacity: 0 },
1026
+ transition: _e,
1027
+ onAnimationComplete: () => A(!1),
1028
+ className: ie,
1029
+ children: Q
1030
+ })
1031
+ })]
1032
+ })
1033
+ });
1034
+ }
1035
+ var ie = "text-pho-description -mx-1 inline-flex shrink-0 text-base select-none", Q = "/", en = 4, tn = "…";
1036
+ function Be({ href: e, className: t, morphId: a, children: i = "Back", ...r }) {
1037
+ const o = T(Ie), c = I(), l = a != null && !c, s = Re(l ? a : void 0);
1038
+ if (o == null) throw new Error("BasicPage.Crumb must be rendered inside BasicPage.Breadcrumbs");
1039
+ const { index: u, count: f, departing: m, narrow: p } = o, h = u === 0, g = u === f - 1, v = m != null && m.labels.length < f, E = m != null && m.labels.length > f, A = g && (m == null || v || p), _ = h || g, b = h && g ? "" : h ? "max-sm:hidden" : "sm:hidden", L = m != null, H = g ? p ? E ? "slide" : "fade" : A ? "fade" : void 0 : void 0, [P, R] = y(l && p && s.fly && m != null && !E ? m.labels[m.labels.length - 1] : null), B = l && _ && !L, te = l && !h && g && (m == null || v);
1040
+ return /* @__PURE__ */ x(Ye, { children: [!h && /* @__PURE__ */ n("span", {
1041
+ "aria-hidden": !0,
1042
+ className: d(ie, "max-sm:hidden"),
1043
+ children: te ? /* @__PURE__ */ n(w.span, {
1044
+ initial: s.fly ? {
1045
+ opacity: 0,
1046
+ x: ye
1047
+ } : { opacity: 0 },
1048
+ animate: s.fly ? {
1049
+ opacity: 1,
1050
+ x: 0
1051
+ } : { opacity: 1 },
1052
+ transition: s.fly ? be : M,
1053
+ className: "inline-flex",
1054
+ children: Q
1055
+ }) : Q
1056
+ }), /* @__PURE__ */ n(le, {
1057
+ variant: "ghost",
1058
+ size: "sm",
1059
+ href: e,
1060
+ prefix: _ ? B ? /* @__PURE__ */ n(w.span, {
1061
+ initial: s.fly ? {
1062
+ opacity: 0,
1063
+ x: ye
1064
+ } : { opacity: 0 },
1065
+ animate: s.fly ? {
1066
+ opacity: 1,
1067
+ x: 0
1068
+ } : { opacity: 1 },
1069
+ transition: s.fly ? be : M,
1070
+ className: d("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", b),
1071
+ children: /* @__PURE__ */ n(q, {})
1072
+ }) : /* @__PURE__ */ n("span", {
1073
+ className: d("inline-flex [&>svg]:size-[1.125em] [&>svg]:shrink-0", b),
1074
+ children: /* @__PURE__ */ n(q, {})
1075
+ }) : /* @__PURE__ */ n("span", { className: "hidden" }),
1076
+ className: d("min-w-max", t),
1077
+ ...r,
1078
+ children: l && a != null ? /* @__PURE__ */ x("span", {
1079
+ className: d("relative block", !s.fly && H === "slide" && "overflow-hidden", !g && "max-w-40 truncate"),
1080
+ children: [/* @__PURE__ */ n(Se, {
1081
+ morphId: a,
1082
+ fromClassName: "text-pho-primary",
1083
+ fly: s.fly,
1084
+ morphRef: s.ref,
1085
+ arrival: H,
1086
+ children: i
1087
+ }), P != null && /* @__PURE__ */ n(w.span, {
1088
+ "aria-hidden": !0,
1089
+ initial: {
1090
+ x: 0,
1091
+ opacity: 1
1092
+ },
1093
+ animate: {
1094
+ x: pt,
1095
+ opacity: 0
1096
+ },
1097
+ transition: ht,
1098
+ onAnimationComplete: () => R(null),
1099
+ className: "pointer-events-none absolute inset-y-0 left-0 whitespace-nowrap",
1100
+ children: P
1101
+ })]
1102
+ }) : /* @__PURE__ */ n("span", {
1103
+ className: d("block", !g && "max-w-40 truncate"),
1104
+ children: i
1105
+ })
1106
+ })] });
1107
+ }
1108
+ function nn({ className: e, ...t }) {
1109
+ return /* @__PURE__ */ n(Le, {
1110
+ className: e,
1111
+ children: /* @__PURE__ */ n(Be, { ...t })
1112
+ });
1113
+ }
1114
+ function an({ label: e, description: t, leading: a, href: i, className: r, children: o, ...c }) {
1115
+ const l = Ae(), s = V(() => w.create(l), [l]), { leaving: u, ...f } = fe();
1116
+ return /* @__PURE__ */ x(s, {
1117
+ href: i,
1118
+ ...f,
1119
+ ...c,
1120
+ className: d("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)]", u && "overflow-hidden", r),
1121
+ children: [/* @__PURE__ */ x("div", {
1122
+ className: d("flex min-w-0 flex-1 items-center", a != null && "gap-3"),
1123
+ children: [a, /* @__PURE__ */ x("div", {
1124
+ className: "min-w-0",
1125
+ children: [/* @__PURE__ */ n("div", {
1126
+ className: "flex min-w-0 items-center gap-1",
1127
+ children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ n("p", {
1128
+ className: "text-pho-primary truncate text-base font-medium",
1129
+ children: e
1130
+ }) : e
1131
+ }), t ? /* @__PURE__ */ n("div", {
1132
+ className: "text-pho-description truncate text-xs",
1133
+ children: t
1134
+ }) : null]
1135
+ })]
1136
+ }), /* @__PURE__ */ x("div", {
1137
+ className: "flex min-w-0 items-center justify-end gap-2",
1138
+ children: [o != null ? /* @__PURE__ */ n("div", {
1139
+ className: "min-w-0",
1140
+ children: o
1141
+ }) : null, /* @__PURE__ */ n(Qe, {
1142
+ "aria-hidden": !0,
1143
+ className: "text-pho-secondary group-hover:text-pho-secondary-hover size-4 shrink-0 transition-colors"
1144
+ })]
1145
+ })]
1146
+ });
1147
+ }
1148
+ function rn({ open: e, placeholder: t, onClose: a, children: i }) {
1149
+ const r = T(Ce), o = e ?? J.toArray(i).length > 0, c = r?.setOpen, l = r?.setPresent;
1150
+ return F(() => {
1151
+ if (l != null)
1152
+ return l(!0), () => l(!1);
1153
+ }, [l]), F(() => {
1154
+ if (c != null)
1155
+ return c(o), () => c(!1);
1156
+ }, [c, o]), O(() => {
1157
+ r == null && typeof process < "u" && process.env.NODE_ENV !== "production" && console.warn("BasicPage.Aside: needs a `BasicPage.Root` around it.");
1158
+ }, [r]), r == null || r.slot == null ? null : r.presentation === "page" ? he(o ? /* @__PURE__ */ n("div", {
1159
+ "data-basic-page-aside": "page",
1160
+ className: "flex min-w-0 flex-1 flex-col",
1161
+ children: i
1162
+ }) : null, r.slot) : he(/* @__PURE__ */ n(sn, {
1163
+ width: r.width,
1164
+ paneHeight: r.paneHeight,
1165
+ onClose: a,
1166
+ open: o,
1167
+ placeholder: t,
1168
+ children: i
1169
+ }), r.slot);
1170
+ }
1171
+ function sn({ width: e, paneHeight: t, onClose: a, open: i, placeholder: r, children: o }) {
1172
+ const c = I(), [l, s] = y(null), u = V(() => ({ setBack: s }), []), f = N(null), m = c ? "blur(0px)" : "blur(1px)", p = t ?? "100dvh", h = {
1173
+ variant: "ghost",
1174
+ size: "sm",
1175
+ svgOnly: !0,
1176
+ "aria-label": "Close",
1177
+ children: /* @__PURE__ */ n(Ve, {})
1178
+ };
1179
+ O(() => {
1180
+ const v = (E) => {
1181
+ if (E.key !== "Escape" || E.defaultPrevented) return;
1182
+ const A = f.current?.querySelector("a, button");
1183
+ A != null && (E.preventDefault(), A.click());
1184
+ };
1185
+ return document.addEventListener("keydown", v), () => document.removeEventListener("keydown", v);
1186
+ }, []);
1187
+ const g = {
1188
+ initial: {
1189
+ opacity: 0,
1190
+ filter: m
1191
+ },
1192
+ animate: {
1193
+ opacity: 1,
1194
+ filter: "blur(0px)"
1195
+ },
1196
+ exit: {
1197
+ opacity: 0,
1198
+ filter: m
1199
+ },
1200
+ transition: c ? { duration: 0 } : ee
1201
+ };
1202
+ return /* @__PURE__ */ n("aside", {
1203
+ "data-basic-page-aside": "panel",
1204
+ className: "relative flex shrink-0 flex-col",
1205
+ style: {
1206
+ width: e,
1207
+ minHeight: p
1208
+ },
1209
+ children: /* @__PURE__ */ n("div", {
1210
+ className: "border-pho-secondary bg-pho-primary sticky top-0 grid border-l *:min-h-0 *:[grid-area:1/1]",
1211
+ style: { height: p },
1212
+ children: /* @__PURE__ */ n(j, {
1213
+ initial: !1,
1214
+ children: i ? /* @__PURE__ */ x(w.div, {
1215
+ ...g,
1216
+ className: "relative flex flex-col",
1217
+ children: [/* @__PURE__ */ n("span", {
1218
+ ref: f,
1219
+ className: "absolute top-2 right-2 z-30",
1220
+ children: l != null ? /* @__PURE__ */ n(le, {
1221
+ ...h,
1222
+ href: l.href,
1223
+ onClick: l.onClick
1224
+ }) : a != null ? /* @__PURE__ */ n(se, {
1225
+ ...h,
1226
+ onClick: a
1227
+ }) : null
1228
+ }), /* @__PURE__ */ x(K.Root, {
1229
+ className: "min-h-0 flex-1",
1230
+ children: [/* @__PURE__ */ n(K.Viewport, { children: /* @__PURE__ */ n(K.Content, {
1231
+ className: "flex min-h-full flex-col",
1232
+ children: /* @__PURE__ */ n(Ee.Provider, {
1233
+ value: u,
1234
+ children: o
1235
+ })
1236
+ }) }), /* @__PURE__ */ n(K.Scrollbar, { children: /* @__PURE__ */ n(K.Thumb, {}) })]
1237
+ })]
1238
+ }, "page") : /* @__PURE__ */ n(w.div, {
1239
+ ...g,
1240
+ className: "flex flex-col",
1241
+ children: r
1242
+ }, "empty")
1243
+ })
1244
+ })
1245
+ });
1246
+ }
1247
+ var Rn = {
1248
+ Root: lt,
1249
+ Aside: rn,
1250
+ CondenseScope: bt,
1251
+ Breadcrumbs: Le,
1252
+ Crumb: Be,
1253
+ Back: nn,
1254
+ Title: Ct,
1255
+ Stack: St,
1256
+ Header: Tt,
1257
+ SectionTitle: Pt,
1258
+ Description: Ot,
1259
+ SectionFooter: It,
1260
+ Card: Lt,
1261
+ Item: Bt,
1262
+ ItemPanel: Mt,
1263
+ Callout: Ht,
1264
+ CalloutTitle: Dt,
1265
+ CalloutDescription: Ft,
1266
+ Row: Vt,
1267
+ RowLink: an,
1268
+ Value: Gt,
1269
+ Alert: zt,
1270
+ Footer: qt,
1271
+ Form: $t,
1272
+ Saved: jt,
1273
+ Fields: Xt,
1274
+ Inline: Kt,
1275
+ Submit: Yt,
1276
+ Reveal: Oe
1277
+ };
1278
+ export {
1279
+ tt as a,
1280
+ Rn as c,
1281
+ xt as d,
1282
+ ae as f,
1283
+ et as i,
1284
+ ee as l,
1285
+ Cn as m,
1286
+ ge as n,
1287
+ nt as o,
1288
+ _n as p,
1289
+ Je as r,
1290
+ Ze as s,
1291
+ kn as t,
1292
+ En as u
1293
+ };
1294
+
1295
+ //# sourceMappingURL=basic-page-DsI1xo6p.js.map