@photon-ai/pho-ui 4.18.6 → 4.19.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.
@@ -1,14 +1,15 @@
1
1
  "use client";
2
- import { t as h } from "./cn-CPbhpG1q.js";
3
- import { a as x, o as R } from "./button-CLfWdqm-.js";
2
+ import { t as p } from "./cn-CPbhpG1q.js";
3
+ import { a as E, o as R } from "./button-CLfWdqm-.js";
4
4
  import { t as C } from "./createReactComponent-yKZn9MIX.js";
5
5
  import { t as S } from "./IconInfoCircle-CTAynhe8.js";
6
6
  import { t as g } from "./IconAlertCircleFilled-D6mUlVaE.js";
7
+ import { t as A } from "./IconAlertTriangleFilled-QV-gsVQW.js";
7
8
  import { t as l } from "./popover-B0NBrYV5.js";
8
9
  import { i as _ } from "./status-view-I_Y6eEyX.js";
9
- import { useEffect as A, useRef as P, useState as L } from "react";
10
- import { Fragment as c, jsx as n, jsxs as s } from "react/jsx-runtime";
11
- var k = [
10
+ import { useEffect as P, useRef as L, useState as k } from "react";
11
+ import { Fragment as c, jsx as r, jsxs as s } from "react/jsx-runtime";
12
+ var z = [
12
13
  ["path", {
13
14
  d: "M12 9v4",
14
15
  key: "svg-0"
@@ -21,23 +22,23 @@ var k = [
21
22
  d: "M12 16h.01",
22
23
  key: "svg-2"
23
24
  }]
24
- ], z = C("outline", "alert-triangle", "AlertTriangle", k);
25
- function m(t) {
25
+ ], D = C("outline", "alert-triangle", "AlertTriangle", z);
26
+ function f(t) {
26
27
  if (typeof t != "object" || t === null) return !1;
27
28
  const e = t;
28
29
  return typeof e.title == "string" && typeof e.status == "number" && Number.isInteger(e.status) && e.status >= 400 && e.status <= 599 && (e.code === void 0 || typeof e.code == "string");
29
30
  }
30
- function D(t) {
31
+ function F(t) {
31
32
  let e = t;
32
- for (let r = 0; r < 8 && typeof e == "object" && e !== null; r++) {
33
- if (m(e)) return e;
33
+ for (let n = 0; n < 8 && typeof e == "object" && e !== null; n++) {
34
+ if (f(e)) return e;
34
35
  const i = e.problem;
35
- if (m(i)) return i;
36
+ if (f(i)) return i;
36
37
  e = e.cause;
37
38
  }
38
39
  return null;
39
40
  }
40
- var $ = "Something went wrong.", f = {
41
+ var $ = "Something went wrong.", h = {
41
42
  400: "Bad Request",
42
43
  401: "Unauthorized",
43
44
  403: "Forbidden",
@@ -76,29 +77,29 @@ function B(t) {
76
77
  return typeof t.code == "string" && t.code !== "";
77
78
  }
78
79
  function v(t, e) {
79
- if (f[t]) return f[t];
80
+ if (h[t]) return h[t];
80
81
  if (e && e !== "Something went wrong." && e !== "Request failed") return e.replace(/\.$/, "");
81
82
  }
82
- function F(t) {
83
+ function U(t) {
83
84
  return j[t] ?? "The request failed with an unexpected status.";
84
85
  }
85
86
  function u(t) {
86
87
  if (!t) return t;
87
- const e = t.charAt(0), r = e.toUpperCase();
88
- return e === r ? t : r + t.slice(1);
88
+ const e = t.charAt(0), n = e.toUpperCase();
89
+ return e === n ? t : n + t.slice(1);
89
90
  }
90
91
  function y(t) {
91
- const e = D(t);
92
+ const e = F(t);
92
93
  if (e == null) return { title: $ };
93
- const r = [e.detail, e.remediation?.action].filter((i) => typeof i == "string" && i !== "").join(" ") || void 0;
94
- return !B(e) && r == null ? {
94
+ const n = [e.detail, e.remediation?.action].filter((i) => typeof i == "string" && i !== "").join(" ") || void 0;
95
+ return !B(e) && n == null ? {
95
96
  title: u(v(e.status, e.title) ?? "Something went wrong."),
96
- description: F(e.status),
97
+ description: U(e.status),
97
98
  requestId: e.requestId,
98
99
  problem: e
99
100
  } : {
100
101
  title: u(e.title || "Something went wrong."),
101
- description: r ? u(r) : void 0,
102
+ description: n ? u(n) : void 0,
102
103
  documentation: e.remediation?.documentation,
103
104
  requestId: e.requestId,
104
105
  problem: e
@@ -107,23 +108,23 @@ function y(t) {
107
108
  function d(t) {
108
109
  return typeof t == "string" ? u(t) : t;
109
110
  }
110
- var T = "Learn more", U = "Try again";
111
- function M({ error: t, children: e, className: r, ...i }) {
111
+ var T = "Learn more", M = "Try again";
112
+ function O({ error: t, children: e, className: n, ...i }) {
112
113
  if (t == null && e == null) return null;
113
114
  const o = y(t);
114
115
  return /* @__PURE__ */ s("div", {
115
116
  role: "alert",
116
- className: h("text-pho-error flex min-w-0 items-start gap-1.5 text-base", r),
117
+ className: p("text-pho-error flex min-w-0 items-start gap-1.5 text-base", n),
117
118
  ...i,
118
- children: [/* @__PURE__ */ n("span", {
119
+ children: [/* @__PURE__ */ r("span", {
119
120
  "aria-hidden": !0,
120
121
  className: "flex h-[1lh] shrink-0 items-center",
121
- children: /* @__PURE__ */ n(g, { className: "size-4" })
122
+ children: /* @__PURE__ */ r(g, { className: "size-4" })
122
123
  }), /* @__PURE__ */ s("span", {
123
124
  className: "min-w-0",
124
125
  children: [
125
126
  d(e ?? o.description ?? o.title),
126
- o.documentation != null && /* @__PURE__ */ s(c, { children: [" ", /* @__PURE__ */ n("a", {
127
+ o.documentation != null && /* @__PURE__ */ s(c, { children: [" ", /* @__PURE__ */ r("a", {
127
128
  href: o.documentation,
128
129
  target: "_blank",
129
130
  rel: "noreferrer",
@@ -131,15 +132,31 @@ function M({ error: t, children: e, className: r, ...i }) {
131
132
  children: T
132
133
  })] }),
133
134
  " ",
134
- /* @__PURE__ */ n(O, { copy: o })
135
+ /* @__PURE__ */ r(H, { copy: o })
135
136
  ]
136
137
  })]
137
138
  });
138
139
  }
139
- M.displayName = "Error";
140
- function O({ copy: t }) {
141
- const { problem: e, requestId: r } = t;
142
- if (e == null && r == null) return null;
140
+ O.displayName = "Error";
141
+ function G({ children: t, className: e, ...n }) {
142
+ const i = t != null && t !== !1 && t !== "";
143
+ return /* @__PURE__ */ r("output", {
144
+ className: i ? p("text-pho-warning flex min-w-0 items-start gap-1.5 text-base", e) : "sr-only",
145
+ ...n,
146
+ children: i && /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ r("span", {
147
+ "aria-hidden": !0,
148
+ className: "flex h-[1lh] shrink-0 items-center",
149
+ children: /* @__PURE__ */ r(A, { className: "size-4" })
150
+ }), /* @__PURE__ */ r("span", {
151
+ className: "min-w-0",
152
+ children: d(t)
153
+ })] })
154
+ });
155
+ }
156
+ G.displayName = "Warning";
157
+ function H({ copy: t }) {
158
+ const { problem: e, requestId: n } = t;
159
+ if (e == null && n == null) return null;
143
160
  let i = null;
144
161
  if (e != null)
145
162
  if (e.code) i = `${e.status} ${e.code}`;
@@ -147,33 +164,33 @@ function O({ copy: t }) {
147
164
  const o = v(e.status, e.title);
148
165
  i = o ? `${e.status} ${o}` : String(e.status);
149
166
  }
150
- return /* @__PURE__ */ s(l.Root, { children: [/* @__PURE__ */ n(l.Trigger, {
167
+ return /* @__PURE__ */ s(l.Root, { children: [/* @__PURE__ */ r(l.Trigger, {
151
168
  openOnHover: !0,
152
169
  delay: 150,
153
170
  "aria-label": "Error details",
154
171
  className: "outline-pho-brand inline-flex size-4 shrink-0 translate-y-[3px] cursor-help items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2",
155
- children: /* @__PURE__ */ n(S, { className: "size-3.5" })
156
- }), /* @__PURE__ */ n(l.Portal, { children: /* @__PURE__ */ n(l.Positioner, {
172
+ children: /* @__PURE__ */ r(S, { className: "size-3.5" })
173
+ }), /* @__PURE__ */ r(l.Portal, { children: /* @__PURE__ */ r(l.Positioner, {
157
174
  align: "start",
158
175
  children: /* @__PURE__ */ s(l.Popup, {
159
176
  className: "text-pho-error",
160
177
  children: [
161
178
  /* @__PURE__ */ s(l.Title, {
162
179
  className: "text-pho-error flex items-start gap-1.5",
163
- children: [/* @__PURE__ */ n("span", {
180
+ children: [/* @__PURE__ */ r("span", {
164
181
  "aria-hidden": !0,
165
182
  className: "flex h-[1lh] shrink-0 items-center",
166
- children: /* @__PURE__ */ n(g, { className: "size-4" })
183
+ children: /* @__PURE__ */ r(g, { className: "size-4" })
167
184
  }), t.title]
168
185
  }),
169
- t.description != null && /* @__PURE__ */ n(l.Description, {
186
+ t.description != null && /* @__PURE__ */ r(l.Description, {
170
187
  className: "text-pho-error",
171
188
  children: t.description
172
189
  }),
173
- (i != null || r != null) && /* @__PURE__ */ s("div", {
190
+ (i != null || n != null) && /* @__PURE__ */ s("div", {
174
191
  className: "text-pho-error mt-1 font-mono text-[10px] leading-snug",
175
- children: [i != null && /* @__PURE__ */ n("p", { children: i }), r != null && /* @__PURE__ */ n(b, {
176
- requestId: r,
192
+ children: [i != null && /* @__PURE__ */ r("p", { children: i }), n != null && /* @__PURE__ */ r(b, {
193
+ requestId: n,
177
194
  className: "mt-0"
178
195
  })]
179
196
  })
@@ -182,18 +199,18 @@ function O({ copy: t }) {
182
199
  }) })] });
183
200
  }
184
201
  function b({ requestId: t, className: e }) {
185
- const [r, i] = L(!1), o = P(null);
186
- return A(() => () => {
202
+ const [n, i] = k(!1), o = L(null);
203
+ return P(() => () => {
187
204
  o.current && clearTimeout(o.current);
188
205
  }, []), /* @__PURE__ */ s("span", {
189
- className: h("mt-1 block font-mono text-[10px] leading-snug", e),
206
+ className: p("mt-1 block font-mono text-[10px] leading-snug", e),
190
207
  children: [
191
208
  "Request ID:",
192
209
  " ",
193
- /* @__PURE__ */ n("button", {
210
+ /* @__PURE__ */ r("button", {
194
211
  type: "button",
195
212
  className: "outline-pho-brand inline cursor-pointer underline-offset-2 select-all hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:-outline-offset-1",
196
- "aria-label": r ? "Request ID copied" : `Copy request ID ${t}`,
213
+ "aria-label": n ? "Request ID copied" : `Copy request ID ${t}`,
197
214
  onClick: async () => {
198
215
  try {
199
216
  await navigator.clipboard.writeText(t);
@@ -204,21 +221,21 @@ function b({ requestId: t, className: e }) {
204
221
  },
205
222
  children: t
206
223
  }),
207
- /* @__PURE__ */ n("output", {
224
+ /* @__PURE__ */ r("output", {
208
225
  className: "sr-only",
209
226
  "aria-live": "polite",
210
- children: r ? "Copied" : ""
227
+ children: n ? "Copied" : ""
211
228
  })
212
229
  ]
213
230
  });
214
231
  }
215
- function G({ error: t, title: e, description: r, icon: i, onRetry: o, actions: N, size: w = "base", ...q }) {
232
+ function V({ error: t, title: e, description: n, icon: i, onRetry: o, actions: N, size: w = "base", ...x }) {
216
233
  if (t == null && e == null) return null;
217
- const a = y(t), p = d(r ?? a.description), I = p != null || a.requestId != null ? /* @__PURE__ */ s(c, { children: [p, a.requestId != null && /* @__PURE__ */ n(b, { requestId: a.requestId })] }) : void 0, E = N ?? (o != null || a.documentation != null ? /* @__PURE__ */ s(c, { children: [o != null && /* @__PURE__ */ n(x, {
234
+ const a = y(t), m = d(n ?? a.description), q = m != null || a.requestId != null ? /* @__PURE__ */ s(c, { children: [m, a.requestId != null && /* @__PURE__ */ r(b, { requestId: a.requestId })] }) : void 0, I = N ?? (o != null || a.documentation != null ? /* @__PURE__ */ s(c, { children: [o != null && /* @__PURE__ */ r(E, {
218
235
  size: "sm",
219
236
  onClick: o,
220
- children: U
221
- }), a.documentation != null && /* @__PURE__ */ n(R, {
237
+ children: M
238
+ }), a.documentation != null && /* @__PURE__ */ r(R, {
222
239
  size: "sm",
223
240
  variant: "outlined",
224
241
  href: a.documentation,
@@ -226,27 +243,28 @@ function G({ error: t, title: e, description: r, icon: i, onRetry: o, actions: N
226
243
  rel: "noreferrer",
227
244
  children: T
228
245
  })] }) : void 0);
229
- return /* @__PURE__ */ n(_, {
246
+ return /* @__PURE__ */ r(_, {
230
247
  role: "alert",
231
248
  size: w,
232
- icon: i ?? /* @__PURE__ */ n(z, {}),
249
+ icon: i ?? /* @__PURE__ */ r(D, {}),
233
250
  title: d(e ?? a.title),
234
- description: I,
235
- actions: E,
236
- ...q
251
+ description: q,
252
+ actions: I,
253
+ ...x
237
254
  });
238
255
  }
239
- G.displayName = "ErrorView";
256
+ V.displayName = "ErrorView";
240
257
  export {
241
- y as a,
242
- m as c,
243
- u as i,
244
- D as l,
245
- G as n,
246
- v as o,
247
- $ as r,
248
- F as s,
249
- M as t
258
+ u as a,
259
+ U as c,
260
+ $ as i,
261
+ f as l,
262
+ V as n,
263
+ y as o,
264
+ G as r,
265
+ v as s,
266
+ O as t,
267
+ F as u
250
268
  };
251
269
 
252
- //# sourceMappingURL=error-yAVi4cBu.js.map
270
+ //# sourceMappingURL=error-BObcQClz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-BObcQClz.js","names":["_Fragment","cn","Button","ButtonLink","createReactComponent","IconInfoCircle","IconAlertCircleFilled","IconAlertTriangleFilled","Popover","StatusView","useEffect","useRef","useState","Fragment$1","jsx","jsxs","__iconNode","IconAlertTriangle","isProblem","value","v","parseProblem","error","current","depth","carried","GENERIC_ERROR_TITLE","HTTP_REASON_PHRASE","HTTP_STATUS_EXPLANATION","hasContractCode","problem","httpReasonPhrase","status","fallbackTitle","httpStatusExplanation","capitalizeFirst","text","first","upper","describeError","description","part","displayCopy","DOC_LINK_LABEL","RETRY_LABEL","Error","children","className","props","copy","ErrorDetails","Warning","shown","requestId","statusLine","reason","RequestId","copied","setCopied","copiedTimer","ErrorView","title","icon","onRetry","actions","size","resolvedDescription","body","resolvedActions"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.mjs","../../src/components/error/problem.ts","../../src/components/error/error.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M12 9v4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M12 16h.01\", \"key\": \"svg-2\" }]];\nconst IconAlertTriangle = createReactComponent(\"outline\", \"alert-triangle\", \"AlertTriangle\", __iconNode);\n\nexport { __iconNode, IconAlertTriangle as default };\n","/**\n * Client-side mirror of the `@photon-hq/error` response contract — the\n * RFC 9457 Problem Details body every Photon service returns for 4xx / 5xx.\n * Machine logic branches on `code`; `title` / `detail` / `remediation` are\n * the human-readable copy, already reviewed server-side and safe to render.\n *\n * Fetch layers may also hand us a thin status-only shape when the response\n * was not ok but the body was not a contract problem — `title` + `status`\n * still count so the UI can disclose the HTTP code we already know.\n */\n\nexport interface ProblemRemediation {\n /** What the user can do about it — a full sentence. */\n action?: string;\n /** Docs URL explaining the problem. */\n documentation?: string;\n}\n\nexport interface Problem {\n /** Stable machine-readable key (`RATE_LIMITED`) — the field to branch on. */\n code?: string;\n /** Human summary of the problem type (\"Too Many Requests\"). */\n title: string;\n /** HTTP status (4xx / 5xx). */\n status: number;\n /** Problem type URI (`urn:photon:problem:*` or an https URL). */\n type?: string;\n /** Occurrence-specific human sentence. */\n detail?: string;\n /** Correlation id for support (`X-Request-ID`). */\n requestId?: string;\n remediation?: ProblemRemediation;\n /** RFC 9457 extensions (`issues`, `actualVersion`, …). */\n [extension: string]: unknown;\n}\n\n/** Structural check: `title` + a 4xx/5xx status. `code` is optional. */\nexport function isProblem(value: unknown): value is Problem {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Record<string, unknown>;\n return (\n typeof v.title === \"string\" &&\n typeof v.status === \"number\" &&\n Number.isInteger(v.status) &&\n v.status >= 400 &&\n v.status <= 599 &&\n (v.code === undefined || typeof v.code === \"string\")\n );\n}\n\n/**\n * Find the problem a caught value carries — the value itself, one typed onto\n * an error as a `problem` field (dashboard's `ApiError` shape), or one\n * wrapped in an `Error` `cause` chain (how fetch layers usually rethrow a\n * parsed body). Returns `null` when there is none.\n */\nexport function parseProblem(error: unknown): Problem | null {\n let current: unknown = error;\n for (\n let depth = 0;\n depth < 8 && typeof current === \"object\" && current !== null;\n depth++\n ) {\n if (isProblem(current)) return current;\n const carried = (current as { problem?: unknown }).problem;\n if (isProblem(carried)) return carried;\n current = (current as { cause?: unknown }).cause;\n }\n return null;\n}\n\nexport interface ErrorDescription {\n /** Short name of the failure — the problem `title`, or a generic fallback. */\n title: string;\n /** Sentence(s) to show — `detail` and `remediation.action` joined. */\n description?: string;\n /** Docs URL from `remediation.documentation`. */\n documentation?: string;\n /** Correlation id for support. */\n requestId?: string;\n /** The matched problem, when the input carried one. */\n problem?: Problem;\n}\n\n/**\n * Anything that isn't a problem renders as this — raw `Error` messages are\n * not contract copy and never shown (the same fail-closed stance as the\n * server side of `@photon-hq/error`). Always a full sentence (trailing\n * period).\n */\nexport const GENERIC_ERROR_TITLE = \"Something went wrong.\";\n\n/** Standard reason phrases for statuses we commonly surface without a body. */\nconst HTTP_REASON_PHRASE: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 413: \"Payload Too Large\",\n 415: \"Unsupported Media Type\",\n 422: \"Unprocessable Entity\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n};\n\n/** One-sentence explanations when the server gave a status but no problem copy. */\nconst HTTP_STATUS_EXPLANATION: Record<number, string> = {\n 400: \"The request was malformed or incomplete.\",\n 401: \"You need to sign in again.\",\n 403: \"You don't have permission to do that.\",\n 404: \"The requested resource was not found.\",\n 408: \"The request timed out before the server responded.\",\n 409: \"The request conflicts with the current state.\",\n 410: \"That resource is no longer available.\",\n 413: \"The request was too large for the server to accept.\",\n 415: \"That media type isn't supported.\",\n 422: \"The request was understood but couldn't be processed.\",\n 429: \"Request rate limit exceeded. Wait a moment before trying again.\",\n 500: \"The server hit an unexpected error.\",\n 501: \"The server doesn't support that operation.\",\n 502: \"The gateway got an invalid response from an upstream server.\",\n 503: \"The service is temporarily unavailable.\",\n 504: \"The gateway timed out waiting for an upstream server.\",\n};\n\nfunction hasContractCode(problem: Problem): boolean {\n return typeof problem.code === \"string\" && problem.code !== \"\";\n}\n\n/** Reason phrase for a status — map first, then a non-generic `problem.title`. */\nexport function httpReasonPhrase(\n status: number,\n fallbackTitle?: string,\n): string | undefined {\n if (HTTP_REASON_PHRASE[status]) return HTTP_REASON_PHRASE[status];\n if (\n fallbackTitle &&\n fallbackTitle !== GENERIC_ERROR_TITLE &&\n fallbackTitle !== \"Request failed\"\n ) {\n return fallbackTitle.replace(/\\.$/, \"\");\n }\n return undefined;\n}\n\n/** Human sentence for a bare HTTP status, when the body carried no copy. */\nexport function httpStatusExplanation(status: number): string {\n return (\n HTTP_STATUS_EXPLANATION[status] ??\n \"The request failed with an unexpected status.\"\n );\n}\n\n/**\n * Sentence-case the first character. Server `detail` / `title` sometimes\n * arrive fully lowercase; UI copy always leads with a capital.\n */\nexport function capitalizeFirst(text: string): string {\n if (!text) return text;\n const first = text.charAt(0);\n const upper = first.toUpperCase();\n if (first === upper) return text;\n return upper + text.slice(1);\n}\n\n/**\n * Turn a caught value into displayable copy. `Error` and `ErrorView` call\n * this internally; use it directly for other surfaces (a toast, a banner).\n *\n * Status-only failures (HTTP not ok, but no contract `code` / copy) still\n * keep `problem` so the details panel can show the status. Title becomes the\n * reason phrase (e.g. \"Bad Gateway\"); description is a short explanation —\n * not just the numeric code.\n */\nexport function describeError(error: unknown): ErrorDescription {\n const problem = parseProblem(error);\n if (problem == null) return { title: GENERIC_ERROR_TITLE };\n\n const description =\n [problem.detail, problem.remediation?.action]\n .filter((part): part is string => typeof part === \"string\" && part !== \"\")\n .join(\" \") || undefined;\n\n if (!hasContractCode(problem) && description == null) {\n const reason = httpReasonPhrase(problem.status, problem.title);\n return {\n title: capitalizeFirst(reason ?? GENERIC_ERROR_TITLE),\n description: httpStatusExplanation(problem.status),\n requestId: problem.requestId,\n problem,\n };\n }\n\n return {\n title: capitalizeFirst(problem.title || GENERIC_ERROR_TITLE),\n description: description ? capitalizeFirst(description) : undefined,\n documentation: problem.remediation?.documentation,\n requestId: problem.requestId,\n problem,\n };\n}\n","import {\n useEffect,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport {\n IconAlertCircleFilled,\n IconAlertTriangle,\n IconAlertTriangleFilled,\n IconInfoCircle,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, ButtonLink } from \"../button/button\";\nimport { Popover } from \"../popover/popover\";\nimport { StatusView, type StatusViewSize } from \"../status-view/status-view\";\nimport {\n capitalizeFirst,\n describeError,\n httpReasonPhrase,\n type ErrorDescription,\n} from \"./problem\";\n\n/** Capitalize string copy; leave custom ReactNode overrides alone. */\nfunction displayCopy(value: ReactNode): ReactNode {\n return typeof value === \"string\" ? capitalizeFirst(value) : value;\n}\n\n/**\n * Design notes:\n * - ONE input: `error` is the caught value, whatever it is — a Problem\n * Details body from `@photon-hq/error`, an `Error` carrying one as\n * `cause`, or something unknown. The component derives its copy via\n * `describeError`; unknowns fall back to a generic line rather than\n * leaking raw messages.\n * - TWO presentations, one per altitude: `Error` is the inline line for\n * forms, cards, and action rows; `ErrorView` is the region / page state\n * built on StatusView (same `sm` / `base` size axis).\n * - Both render `null` when there is nothing to show, so they can sit\n * unconditionally in JSX (`<Error error={mutation.error} />`).\n * - `Warning` is the inline line's second state: the same row in warning\n * ink, for something the user may go ahead with but should look at\n * twice. It never blocks, so it takes its copy and nothing else.\n * - Client-side *validation* is not this component's job — that belongs to\n * `Field.Error`, wired to control validity.\n */\n\nconst DOC_LINK_LABEL = \"Learn more\";\nconst RETRY_LABEL = \"Try again\";\n\ninterface ErrorBaseProps {\n /** The caught value — a problem body, an `Error` wrapping one, or unknown. */\n error?: unknown;\n /** Override the derived message. */\n children?: ReactNode;\n}\n\nexport interface ErrorProps\n extends ErrorBaseProps, Omit<ComponentProps<\"div\">, keyof ErrorBaseProps> {}\n\n/**\n * Error — one line of red ink naming a server failure (4xx / 5xx), placed\n * inline: under a form, in a card, beside the action that failed. Give it the\n * caught value and it renders the problem's `detail` (falling back to `title`,\n * then to a generic line), plus a docs link when the problem carries one.\n * Renders nothing while `error` is nullish, so it can stay mounted.\n *\n * For a region or page that failed to load, use {@link ErrorView}.\n */\nexport function Error({ error, children, className, ...props }: ErrorProps) {\n if (error == null && children == null) return null;\n const copy = describeError(error);\n return (\n <div\n role=\"alert\"\n className={cn(\n \"text-pho-error flex min-w-0 items-start gap-1.5 text-base\",\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertCircleFilled className=\"size-4\" />\n </span>\n <span className=\"min-w-0\">\n {displayCopy(children ?? copy.description ?? copy.title)}\n {copy.documentation != null && (\n <>\n {\" \"}\n <a\n href={copy.documentation}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-medium underline underline-offset-2\"\n >\n {DOC_LINK_LABEL}\n </a>\n </>\n )}\n {/* Trailing whitespace collapses when the details render null. */}{\" \"}\n <ErrorDetails copy={copy} />\n </span>\n </div>\n );\n}\n\nError.displayName = \"Error\";\n\nexport interface WarningProps extends Omit<\n ComponentProps<\"output\">,\n \"children\"\n> {\n /** What to look at twice. Shows nothing while nullish. */\n children?: ReactNode;\n}\n\n/**\n * Warning — the inline `Error` line in warning ink, a triangle in place of\n * the circle: something the user can go ahead with but may not mean (an\n * address outside the team, a value that differs from the usual one). Same\n * row, glyph seat and type as `Error`, so the two can take turns in one\n * place. It doesn't stop anything, so it announces politely (an `output`,\n * role `status`) and carries no details disclosure.\n *\n * A polite region is announced when its content changes, not when it is\n * inserted, so the `output` stays mounted while the copy is nullish:\n * empty and `sr-only`, the way pho-ui's other live regions sit, it keeps\n * its role and, out of flow, adds no gap to a stack.\n */\nexport function Warning({ children, className, ...props }: WarningProps) {\n // `{cond && copy}` leaves false behind: no copy either.\n const shown = children != null && children !== false && children !== \"\";\n return (\n <output\n className={\n shown\n ? cn(\n \"text-pho-warning flex min-w-0 items-start gap-1.5 text-base\",\n className,\n )\n : \"sr-only\"\n }\n {...props}\n >\n {shown && (\n <>\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertTriangleFilled className=\"size-4\" />\n </span>\n <span className=\"min-w-0\">{displayCopy(children)}</span>\n </>\n )}\n </output>\n );\n}\n\nWarning.displayName = \"Warning\";\n\n/**\n * Hover / focus disclosure on the inline line — the request's fuller story:\n * problem `title` (with the same alert icon + `text-pho-error` ink as the\n * inline line), the untruncated description, then `status` + `code` and the\n * copyable request id grouped below for a support handoff. Renders only when\n * the caught value actually carried a problem (or at least a request id); a\n * generic unknown has nothing more to disclose. Built on `Popover` rather\n * than `Tooltip` because the panel holds an interactive control (the copy\n * button) — `openOnHover` keeps the tooltip-like gesture.\n */\nfunction ErrorDetails({ copy }: { copy: ErrorDescription }) {\n const { problem, requestId } = copy;\n if (problem == null && requestId == null) return null;\n\n // Contract problems show `status CODE`; status-only shows `status Reason`.\n let statusLine: string | null = null;\n if (problem != null) {\n if (problem.code) {\n statusLine = `${problem.status} ${problem.code}`;\n } else {\n const reason = httpReasonPhrase(problem.status, problem.title);\n statusLine = reason\n ? `${problem.status} ${reason}`\n : String(problem.status);\n }\n }\n\n return (\n <Popover.Root>\n <Popover.Trigger\n openOnHover\n delay={150}\n aria-label=\"Error details\"\n className=\"outline-pho-brand inline-flex size-4 shrink-0 translate-y-[3px] cursor-help items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2\"\n >\n <IconInfoCircle className=\"size-3.5\" />\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner align=\"start\">\n <Popover.Popup className=\"text-pho-error\">\n <Popover.Title className=\"text-pho-error flex items-start gap-1.5\">\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertCircleFilled className=\"size-4\" />\n </span>\n {copy.title}\n </Popover.Title>\n {copy.description != null && (\n <Popover.Description className=\"text-pho-error\">\n {copy.description}\n </Popover.Description>\n )}\n {(statusLine != null || requestId != null) && (\n <div className=\"text-pho-error mt-1 font-mono text-[10px] leading-snug\">\n {statusLine != null && <p>{statusLine}</p>}\n {requestId != null && (\n <RequestId requestId={requestId} className=\"mt-0\" />\n )}\n </div>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n\n/** Request-id footnote — click copies the id for support handoff. */\nfunction RequestId({\n requestId,\n className,\n}: {\n requestId: string;\n className?: string;\n}) {\n const [copied, setCopied] = useState(false);\n const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n },\n [],\n );\n\n return (\n <span\n className={cn(\"mt-1 block font-mono text-[10px] leading-snug\", className)}\n >\n Request ID:{\" \"}\n <button\n type=\"button\"\n className=\"outline-pho-brand inline cursor-pointer underline-offset-2 select-all hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:-outline-offset-1\"\n aria-label={\n copied ? \"Request ID copied\" : `Copy request ID ${requestId}`\n }\n onClick={async () => {\n try {\n await navigator.clipboard.writeText(requestId);\n } catch {\n return;\n }\n setCopied(true);\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n copiedTimer.current = setTimeout(() => setCopied(false), 1500);\n }}\n >\n {requestId}\n </button>\n <output className=\"sr-only\" aria-live=\"polite\">\n {copied ? \"Copied\" : \"\"}\n </output>\n </span>\n );\n}\n\ninterface ErrorViewBaseProps {\n /** The caught value — a problem body, an `Error` wrapping one, or unknown. */\n error?: unknown;\n /** Override the derived title. */\n title?: ReactNode;\n /** Override the derived description. */\n description?: ReactNode;\n /** Override the warning glyph. */\n icon?: ReactNode;\n /** Offer a retry — renders a \"Try again\" button. */\n onRetry?: () => void;\n /** Replace the built-in action row entirely. */\n actions?: ReactNode;\n /** Size variant — StatusView's axis. @default \"base\" */\n size?: StatusViewSize;\n}\n\nexport interface ErrorViewProps\n extends\n ErrorViewBaseProps,\n Omit<ComponentProps<\"div\">, keyof ErrorViewBaseProps | \"children\"> {}\n\n/**\n * ErrorView — the failed state of a region or page, built on StatusView:\n * warning icon over the problem's `title`, its `detail` and remediation\n * below, an action row (`onRetry` and the problem's docs link), and the\n * request id as a footnote for support. Announces via `role=\"alert\"`.\n *\n * Use `size=\"sm\"` inside cards and panels, the default `base` for whole\n * pages. Renders nothing while `error` is nullish (unless given a static\n * `title`), so it can sit unconditionally next to a query.\n */\nexport function ErrorView({\n error,\n title,\n description,\n icon,\n onRetry,\n actions,\n size = \"base\",\n ...props\n}: ErrorViewProps) {\n if (error == null && title == null) return null;\n const copy = describeError(error);\n\n const resolvedDescription = displayCopy(description ?? copy.description);\n const body =\n resolvedDescription != null || copy.requestId != null ? (\n <>\n {resolvedDescription}\n {copy.requestId != null && <RequestId requestId={copy.requestId} />}\n </>\n ) : undefined;\n\n const resolvedActions =\n actions ??\n (onRetry != null || copy.documentation != null ? (\n <>\n {onRetry != null && (\n <Button size=\"sm\" onClick={onRetry}>\n {RETRY_LABEL}\n </Button>\n )}\n {copy.documentation != null && (\n <ButtonLink\n size=\"sm\"\n variant=\"outlined\"\n href={copy.documentation}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {DOC_LINK_LABEL}\n </ButtonLink>\n )}\n </>\n ) : undefined);\n\n return (\n <StatusView\n role=\"alert\"\n size={size}\n icon={icon ?? <IconAlertTriangle />}\n title={displayCopy(title ?? copy.title)}\n description={body}\n actions={resolvedActions}\n {...props}\n />\n );\n}\n\nErrorView.displayName = \"ErrorView\";\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;AASA,IAAMgB,IAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAW,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAA4I,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAc,KA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I;AAAA,IAEH,UAAAN;AAAA,EACS,CAAA,CAEd,EAAA,CAAA,IACA;AAEN,SACE,gBAAA7B,EAACL,GAAD;AAAA,IACE,MAAK;AAAA,IACC,MAAAwD;AAAA,IACN,MAAMH,KAAQ,gBAAAhD,EAACG,GAAD,CAAoB,CAAA;AAAA,IAClC,OAAOyB,EAAYmB,KAASZ,EAAK,KAAK;AAAA,IACtC,aAAakB;AAAA,IACb,SAASC;AAAA,IACT,GAAIpB;AAAA,EACL,CAAA;AAEL;AAEAY,EAAU,cAAc"}
@@ -1,33 +1,31 @@
1
1
  "use client";
2
2
  import { t as n } from "./cn-CPbhpG1q.js";
3
- import { FADE_SWAP as _ } from "../motion.js";
4
- import { n as y } from "./spinner-BSutFL4l.js";
3
+ import { FADE_SWAP as y } from "../motion.js";
4
+ import { n as _ } from "./spinner-BSutFL4l.js";
5
5
  import { a as b } from "./button-CLfWdqm-.js";
6
- import { t as i } from "./createReactComponent-yKZn9MIX.js";
6
+ import { t as s } from "./createReactComponent-yKZn9MIX.js";
7
7
  import { t as w } from "./IconX-DnPlFC68.js";
8
- import { n as k } from "./scroll-area-Dhl5hqay.js";
8
+ import { t as k } from "./IconAlertTriangleFilled-QV-gsVQW.js";
9
+ import { n as T } from "./scroll-area-Dhl5hqay.js";
9
10
  import "react";
10
- import { jsx as t, jsxs as l } from "react/jsx-runtime";
11
- import { AnimatePresence as z, motion as T, useReducedMotion as N } from "motion/react";
11
+ import { jsx as t, jsxs as i } from "react/jsx-runtime";
12
+ import { AnimatePresence as z, motion as N, useReducedMotion as A } from "motion/react";
12
13
  import { Toast as o } from "@base-ui/react/toast";
13
- var A = [["path", {
14
+ var C = [["path", {
14
15
  d: "M14.897 1a4 4 0 0 1 2.664 1.016l.165 .156l4.1 4.1a4 4 0 0 1 1.168 2.605l.006 .227v5.794a4 4 0 0 1 -1.016 2.664l-.156 .165l-4.1 4.1a4 4 0 0 1 -2.603 1.168l-.227 .006h-5.795a3.999 3.999 0 0 1 -2.664 -1.017l-.165 -.156l-4.1 -4.1a4 4 0 0 1 -1.168 -2.604l-.006 -.227v-5.794a4 4 0 0 1 1.016 -2.664l.156 -.165l4.1 -4.1a4 4 0 0 1 2.605 -1.168l.227 -.006h5.793zm-2.887 14l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z",
15
16
  key: "svg-0"
16
- }]], C = i("filled", "alert-octagon-filled", "AlertOctagonFilled", A), M = [["path", {
17
- d: "M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z",
18
- key: "svg-0"
19
- }]], P = i("filled", "alert-triangle-filled", "AlertTriangleFilled", M), F = [["path", {
17
+ }]], P = s("filled", "alert-octagon-filled", "AlertOctagonFilled", C), M = [["path", {
20
18
  d: "M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z",
21
19
  key: "svg-0"
22
- }]], I = i("filled", "circle-check-filled", "CircleCheckFilled", F), S = [["path", {
20
+ }]], F = s("filled", "circle-check-filled", "CircleCheckFilled", M), I = [["path", {
23
21
  d: "M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z",
24
22
  key: "svg-0"
25
- }]], Y = i("filled", "info-circle-filled", "InfoCircleFilled", S), X = _, c = o.Provider, d = o.Portal, p = o.Action, $ = o.useToastManager, O = o.createToastManager, R = {
26
- success: I,
27
- error: C,
28
- warning: P,
29
- info: Y
30
- }, D = {
23
+ }]], S = s("filled", "info-circle-filled", "InfoCircleFilled", I), Y = y, c = o.Provider, d = o.Portal, p = o.Action, X = o.useToastManager, $ = o.createToastManager, O = {
24
+ success: F,
25
+ error: P,
26
+ warning: k,
27
+ info: S
28
+ }, R = {
31
29
  success: "bg-[color-mix(in_oklab,var(--text-color-pho-success)_7%,transparent)]",
32
30
  error: "bg-[color-mix(in_oklab,var(--text-color-pho-error)_7%,transparent)]",
33
31
  warning: "bg-[color-mix(in_oklab,var(--text-color-pho-warning)_7%,transparent)]",
@@ -71,36 +69,36 @@ function u({ className: a, ...e }) {
71
69
  ...e
72
70
  });
73
71
  }
74
- function j({ type: a }) {
75
- if (a === "loading") return /* @__PURE__ */ t(y, {
72
+ function D({ type: a }) {
73
+ if (a === "loading") return /* @__PURE__ */ t(_, {
76
74
  "aria-hidden": !0,
77
75
  className: "mb-2 size-6 shrink-0"
78
76
  });
79
- const e = a != null ? R[a] : void 0;
77
+ const e = a != null ? O[a] : void 0;
80
78
  return e == null ? null : /* @__PURE__ */ t(e, {
81
79
  "aria-hidden": !0,
82
80
  "data-toast-icon": !0,
83
81
  className: "mb-2 size-6 shrink-0"
84
82
  });
85
83
  }
86
- function W() {
87
- const { toasts: a, close: e } = o.useToastManager(), s = N() ? "blur(0px)" : `blur(${k}px)`;
88
- return a.map((r) => /* @__PURE__ */ l(h, {
84
+ function j() {
85
+ const { toasts: a, close: e } = o.useToastManager(), l = A() ? "blur(0px)" : `blur(${T}px)`;
86
+ return a.map((r) => /* @__PURE__ */ i(h, {
89
87
  toast: r,
90
88
  children: [
91
89
  /* @__PURE__ */ t("div", {
92
90
  "aria-hidden": !0,
93
- className: n("pointer-events-none absolute inset-0 rounded-[inherit] transition-colors duration-200 ease-out", r.type != null ? D[r.type] : void 0)
91
+ className: n("pointer-events-none absolute inset-0 rounded-[inherit] transition-colors duration-200 ease-out", r.type != null ? R[r.type] : void 0)
94
92
  }),
95
93
  /* @__PURE__ */ t(v, { children: /* @__PURE__ */ t("span", {
96
94
  className: "grid",
97
95
  children: /* @__PURE__ */ t(z, {
98
96
  initial: !1,
99
- children: /* @__PURE__ */ l(T.div, {
97
+ children: /* @__PURE__ */ i(N.div, {
100
98
  className: "flex min-w-0 flex-col [grid-area:1/1]",
101
99
  initial: {
102
100
  opacity: 0,
103
- filter: s
101
+ filter: l
104
102
  },
105
103
  animate: {
106
104
  opacity: 1,
@@ -108,11 +106,11 @@ function W() {
108
106
  },
109
107
  exit: {
110
108
  opacity: 0,
111
- filter: s
109
+ filter: l
112
110
  },
113
- transition: X,
111
+ transition: Y,
114
112
  children: [
115
- /* @__PURE__ */ t(j, { type: r.type }),
113
+ /* @__PURE__ */ t(D, { type: r.type }),
116
114
  /* @__PURE__ */ t(f, { children: r.title }),
117
115
  /* @__PURE__ */ t(x, { children: r.description }),
118
116
  r.actionProps != null ? /* @__PURE__ */ t(p, {
@@ -139,9 +137,9 @@ function W() {
139
137
  }, r.id));
140
138
  }
141
139
  function Z({ children: a, toastManager: e }) {
142
- return /* @__PURE__ */ l(c, {
140
+ return /* @__PURE__ */ i(c, {
143
141
  toastManager: e,
144
- children: [a, /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(W, {}) }) })]
142
+ children: [a, /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(j, {}) }) })]
145
143
  });
146
144
  }
147
145
  var tt = {
@@ -154,12 +152,12 @@ var tt = {
154
152
  Description: x,
155
153
  Close: u,
156
154
  Action: p,
157
- useToastManager: $,
158
- createToastManager: O
155
+ useToastManager: X,
156
+ createToastManager: $
159
157
  };
160
158
  export {
161
159
  Z as n,
162
160
  tt as t
163
161
  };
164
162
 
165
- //# sourceMappingURL=toast-DrLKzrDJ.js.map
163
+ //# sourceMappingURL=toast-B3oURNJC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toast-B3oURNJC.js","names":["__iconNode","__iconNode","BaseToast","Toast","cn","FADE_SWAP","Spinner","Button","createReactComponent","IconX","IconAlertTriangleFilled","BLUR_MAX_PX","jsx","jsxs","AnimatePresence","motion","useReducedMotion","Toast","__iconNode$2","IconAlertOctagonFilled","__iconNode$1","IconCircleCheckFilled","__iconNode","IconInfoCircleFilled","FACE_SWAP","Provider","Portal","Action","useToastManager","createToastManager","TOAST_ICONS","TOAST_WASH","Viewport","className","props","Root","Content","Title","Description","Close","TypeIcon","type","Glyph","ToastyList","toasts","close","blurAway","toast","event","Toasty","children","toastManager","Toast$1"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertOctagonFilled.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheckFilled.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconInfoCircleFilled.mjs","../../src/components/toast/toast.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M14.897 1a4 4 0 0 1 2.664 1.016l.165 .156l4.1 4.1a4 4 0 0 1 1.168 2.605l.006 .227v5.794a4 4 0 0 1 -1.016 2.664l-.156 .165l-4.1 4.1a4 4 0 0 1 -2.603 1.168l-.227 .006h-5.795a3.999 3.999 0 0 1 -2.664 -1.017l-.165 -.156l-4.1 -4.1a4 4 0 0 1 -1.168 -2.604l-.006 -.227v-5.794a4 4 0 0 1 1.016 -2.664l.156 -.165l4.1 -4.1a4 4 0 0 1 2.605 -1.168l.227 -.006h5.793zm-2.887 14l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z\", \"key\": \"svg-0\" }]];\nconst IconAlertOctagonFilled = createReactComponent(\"filled\", \"alert-octagon-filled\", \"AlertOctagonFilled\", __iconNode);\n\nexport { __iconNode, IconAlertOctagonFilled as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z\", \"key\": \"svg-0\" }]];\nconst IconCircleCheckFilled = createReactComponent(\"filled\", \"circle-check-filled\", \"CircleCheckFilled\", __iconNode);\n\nexport { __iconNode, IconCircleCheckFilled as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z\", \"key\": \"svg-0\" }]];\nconst IconInfoCircleFilled = createReactComponent(\"filled\", \"info-circle-filled\", \"InfoCircleFilled\", __iconNode);\n\nexport { __iconNode, IconInfoCircleFilled as default };\n","import { type ComponentProps, type ElementType, type ReactNode } from \"react\";\nimport { FADE_SWAP } from \"../../motion\";\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport {\n IconAlertOctagonFilled,\n IconAlertTriangleFilled,\n IconCircleCheckFilled,\n IconInfoCircleFilled,\n IconX,\n type Icon,\n} from \"@tabler/icons-react\";\nimport { BLUR_MAX_PX } from \"../scroll-area\";\nimport { Button } from \"../button\";\nimport { Spinner } from \"../spinner\";\nimport { cn } from \"../../utils/cn\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\n/** The system's swap: fade through the 1px soft focus, ease-out. */\nconst FACE_SWAP = FADE_SWAP;\n\nconst Provider = BaseToast.Provider;\nconst Portal = BaseToast.Portal;\nconst Action = BaseToast.Action;\n\n/** Imperative toast API: `const toast = useToastManager(); toast.add({ title })`. */\nconst useToastManager = BaseToast.useToastManager;\nconst createToastManager = BaseToast.createToastManager;\n\n/**\n * Status glyphs per toast `type` (Kumo's set in Tabler's hand): the glyph\n * and the title take the status ink, the hairline tints with it, and a\n * translucent wash of the same ink sits over the surface. `info` speaks\n * in the brand ink — Pho has no separate info hue. `loading` is what\n * `manager.promise` shows while the work runs.\n */\nconst TOAST_ICONS: Record<string, Icon> = {\n success: IconCircleCheckFilled,\n error: IconAlertOctagonFilled,\n warning: IconAlertTriangleFilled,\n info: IconInfoCircleFilled,\n};\n\nconst TOAST_WASH: Record<string, string> = {\n success:\n \"bg-[color-mix(in_oklab,var(--text-color-pho-success)_7%,transparent)]\",\n error: \"bg-[color-mix(in_oklab,var(--text-color-pho-error)_7%,transparent)]\",\n warning:\n \"bg-[color-mix(in_oklab,var(--text-color-pho-warning)_7%,transparent)]\",\n info: \"bg-[color-mix(in_oklab,var(--text-color-pho-brand)_7%,transparent)]\",\n};\n\nfunction Viewport({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Viewport>) {\n return (\n <BaseToast.Viewport\n // The stack's anchor box; the cards position themselves absolutely\n // against its bottom edge, and hovering any card expands the stack.\n className={cn(\n \"fixed right-4 bottom-4 z-50 flex w-[calc(100%-2rem)] outline-none sm:w-[22rem]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Root({ className, ...props }: StyledProps<typeof BaseToast.Root>) {\n return (\n <BaseToast.Root\n className={cn(\n // Floating layer: keeps its elevation shadow, sits on the card surface\n // with the site hairline (ring-pho-secondary).\n \"bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary rounded-base absolute right-0 bottom-0 w-full origin-bottom ring-1 select-none ring-inset\",\n // Kumo's stack math on Base UI's variables: a 12px gap folded into\n // the expanded offsets, a 12px peek and −10% scale per depth at\n // rest, the newest card on top.\n \"[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]\",\n \"[--offset-y:calc(var(--toast-offset-y)*-1+var(--toast-index)*var(--gap)*-1+var(--toast-swipe-movement-y,0px))]\",\n \"[z-index:calc(1000-var(--toast-index))] h-[var(--height)]\",\n \"[transform:translateX(var(--toast-swipe-movement-x,0px))_translateY(calc(var(--toast-swipe-movement-y,0px)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))]\",\n \"[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s,box-shadow_0.2s_ease-out]\",\n // Invisible bridge below each card so the hover survives the gaps.\n \"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n // Hovering (or focusing) the stack expands it into a true list.\n \"data-[expanded]:h-[var(--toast-height)] data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x,0px))_translateY(var(--offset-y))]\",\n // Beyond the provider's limit a card parks invisibly until room frees.\n \"data-[limited]:opacity-0\",\n // In from below; out along the swipe, or back down when timed out.\n \"data-[starting-style]:[transform:translateY(150%)]\",\n \"data-[ending-style]:opacity-0\",\n \"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]\",\n \"data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)+150%))]\",\n \"data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)-150%))]\",\n \"data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)-150%))_translateY(var(--offset-y))]\",\n \"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)+150%))_translateY(var(--offset-y))]\",\n \"data-[swiping]:[transition:none]\",\n // Status inks: hairline, glyph, and title tint together per type.\n \"data-[type=success]:[&_[data-toast-icon]]:text-pho-success data-[type=success]:[&_[data-toast-title]]:text-pho-success data-[type=success]:[&_[data-toast-action]]:text-pho-success data-[type=success]:[&_[data-toast-close]]:text-pho-success data-[type=success]:ring-[color-mix(in_oklab,var(--text-color-pho-success)_45%,transparent)] data-[type=success]:[&_[data-toast-action]]:ring-[color-mix(in_oklab,var(--text-color-pho-success)_45%,transparent)]\",\n \"data-[type=error]:[&_[data-toast-icon]]:text-pho-error data-[type=error]:[&_[data-toast-title]]:text-pho-error data-[type=error]:[&_[data-toast-action]]:text-pho-error data-[type=error]:[&_[data-toast-close]]:text-pho-error data-[type=error]:ring-[color-mix(in_oklab,var(--text-color-pho-error)_45%,transparent)] data-[type=error]:[&_[data-toast-action]]:ring-[color-mix(in_oklab,var(--text-color-pho-error)_45%,transparent)]\",\n \"data-[type=warning]:[&_[data-toast-icon]]:text-pho-warning data-[type=warning]:[&_[data-toast-title]]:text-pho-warning data-[type=warning]:[&_[data-toast-action]]:text-pho-warning data-[type=warning]:[&_[data-toast-close]]:text-pho-warning data-[type=warning]:ring-[color-mix(in_oklab,var(--text-color-pho-warning)_45%,transparent)] data-[type=warning]:[&_[data-toast-action]]:ring-[color-mix(in_oklab,var(--text-color-pho-warning)_45%,transparent)]\",\n \"data-[type=info]:[&_[data-toast-icon]]:text-pho-brand data-[type=info]:[&_[data-toast-title]]:text-pho-brand data-[type=info]:[&_[data-toast-action]]:text-pho-brand data-[type=info]:[&_[data-toast-close]]:text-pho-brand data-[type=info]:ring-[color-mix(in_oklab,var(--text-color-pho-brand)_45%,transparent)] data-[type=info]:[&_[data-toast-action]]:ring-[color-mix(in_oklab,var(--text-color-pho-brand)_45%,transparent)]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Content({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Content>) {\n return (\n <BaseToast.Content\n // Cards behind the front one show only their peeking edge — the\n // words appear when the stack expands.\n className={cn(\n \"isolate flex flex-col p-4 pr-10 transition-opacity [transition-duration:250ms]\",\n \"data-[behind]:pointer-events-none data-[behind]:opacity-0 data-[expanded]:pointer-events-auto data-[expanded]:opacity-100\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Title({ className, ...props }: StyledProps<typeof BaseToast.Title>) {\n return (\n <BaseToast.Title\n data-toast-title\n className={cn(\"text-pho-primary text-md font-medium\", className)}\n {...props}\n />\n );\n}\n\nfunction Description({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Description>) {\n return (\n <BaseToast.Description\n className={cn(\"text-pho-description text-md\", className)}\n {...props}\n />\n );\n}\n\nfunction Close({ className, ...props }: StyledProps<typeof BaseToast.Close>) {\n return (\n <BaseToast.Close\n data-toast-close\n className={cn(\n \"text-pho-secondary hover:text-pho-secondary-hover hover:bg-pho-ghost-hover outline-pho-brand absolute top-2.5 right-2.5 flex size-6 cursor-pointer items-center justify-center rounded-sm transition focus-visible:outline-2 [&>svg]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * The status glyph for a typed toast — its own row above the title, the\n * Dialog header's arrangement at card scale, an 8px breath before the\n * title. `loading` shows the spinner.\n */\nfunction TypeIcon({ type }: { type?: string }) {\n if (type === \"loading\") {\n return <Spinner aria-hidden className=\"mb-2 size-6 shrink-0\" />;\n }\n const Glyph = type != null ? TOAST_ICONS[type] : undefined;\n if (Glyph == null) return null;\n return <Glyph aria-hidden data-toast-icon className=\"mb-2 size-6 shrink-0\" />;\n}\n\nfunction ToastyList() {\n const { toasts, close } = BaseToast.useToastManager();\n const reduceMotion = useReducedMotion();\n const blurAway = reduceMotion ? \"blur(0px)\" : `blur(${BLUR_MAX_PX}px)`;\n return toasts.map((toast) => (\n <Root key={toast.id} toast={toast}>\n {/* The status wash: a breath of the status ink over the surface. */}\n <div\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-0 rounded-[inherit] transition-colors duration-200 ease-out\",\n toast.type != null ? TOAST_WASH[toast.type] : undefined,\n )}\n />\n <Content>\n {/* One grid cell, faces stacked: when a promise walks the card\n from loading to its outcome, the old face fades out through\n the system's soft focus exactly where the new one fades in —\n the values ride each face, so the goer keeps its words. */}\n <span className=\"grid\">\n <AnimatePresence initial={false}>\n <motion.div\n key={`${toast.type ?? \"\"}|${String(toast.title ?? \"\")}`}\n className=\"flex min-w-0 flex-col [grid-area:1/1]\"\n initial={{ opacity: 0, filter: blurAway }}\n animate={{ opacity: 1, filter: \"blur(0px)\" }}\n exit={{ opacity: 0, filter: blurAway }}\n transition={FACE_SWAP}\n >\n <TypeIcon type={toast.type} />\n <Title>{toast.title}</Title>\n <Description>{toast.description}</Description>\n {toast.actionProps != null ? (\n <Action\n data-toast-action\n render={<Button variant=\"outlined\" size=\"sm\" />}\n className=\"mt-2 self-start\"\n onClick={(event) => {\n toast.actionProps?.onClick?.(event);\n close(toast.id);\n }}\n >\n {toast.actionProps.children}\n </Action>\n ) : null}\n </motion.div>\n </AnimatePresence>\n </span>\n </Content>\n <Close aria-label=\"Dismiss\">\n <IconX />\n </Close>\n </Root>\n ));\n}\n\n/**\n * Toasty — the whole toast system in one wrapper, Kumo-shaped: provider,\n * portal, viewport, and the stacked card list with status variants. Wrap\n * the app once and call `Toast.useToastManager().add({ title, type })`\n * from any child; pass a `toastManager` from `createToastManager()` so\n * code outside the tree (a form's auto-save, a query cache) can speak\n * through the same lane. `manager.promise` shows loading → success/error\n * with the matching glyphs.\n */\nexport function Toasty({\n children,\n toastManager,\n}: {\n children?: ReactNode;\n toastManager?: ComponentProps<typeof BaseToast.Provider>[\"toastManager\"];\n}) {\n return (\n <Provider toastManager={toastManager}>\n {children}\n <Portal>\n <Viewport>\n <ToastyList />\n </Viewport>\n </Portal>\n </Provider>\n );\n}\n\n/**\n * Toast built on Base UI `Toast` — transient, non-blocking notifications\n * in a sonner-style stack, styled after Cloudflare's Kumo: at rest the\n * cards collapse into a peek (12px rise and −10% scale per depth, words\n * hidden behind the front card), expand into a true list with a 12px gap\n * on hover or focus, swipe to dismiss, three visible at most. `type`\n * (`success` / `error` / `warning` / `info` / `loading`) tints hairline,\n * glyph, and title together. Reach for `Toasty` unless you need to\n * compose the parts yourself.\n */\nexport const Toast = {\n Provider,\n Portal,\n Viewport,\n Root,\n Content,\n Title,\n Description,\n Close,\n Action,\n useToastManager,\n createToastManager,\n};\n"],"ignoreList":[0,1,2],"mappings":";;;;;;;;;;;;;AASA,IAAMA,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAujB,KAAO;AAAQ,CAAC,CAAC,GACtmBmB,IAAyBX,EAAqB,UAAU,wBAAwB,sBAAsBR,CAAU,GCDhHC,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAgS,KAAO;AAAQ,CAAC,CAAC,GAC/UoB,IAAwBb,EAAqB,UAAU,uBAAuB,qBAAqBP,CAAU,GCD7GqB,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAA6b,KAAO;AAAQ,CAAC,CAAC,GAC5eC,IAAuBf,EAAqB,UAAU,sBAAsB,oBAAoBc,CAAU,GCgB1GE,IAAYnB,GAEZoB,IAAWvB,EAAU,UACrBwB,IAASxB,EAAU,QACnByB,IAASzB,EAAU,QAGnB0B,IAAkB1B,EAAU,iBAC5B2B,IAAqB3B,EAAU,oBAS/B4B,IAAoC;AAAA,EACxC,SAAST;AAAA,EACT,OAAOF;AAAA,EACP,SAAST;AAAA,EACT,MAAMa;AACR,GAEMQ,IAAqC;AAAA,EACzC,SACE;AAAA,EACF,OAAO;AAAA,EACP,SACE;AAAA,EACF,MAAM;AACR;AAEA,SAASC,EAAS,EAChB,WAAAC,GACA,GAAGC,EAAA,GACsC;AACzC,SACE,gBAAAtB,EAACV,EAAU,UAAX;AAAA,IAGE,WAAWE,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F"}
@@ -1,13 +1,14 @@
1
1
  "use client";
2
- import { a, c as s, i as t, l as e, n as o, o as i, r as E, s as p, t as l } from "../chunks/error-yAVi4cBu.js";
2
+ import { a as r, c as s, i as t, l as e, n as i, o, r as E, s as n, t as p, u as l } from "../chunks/error-BObcQClz.js";
3
3
  export {
4
- l as Error,
5
- o as ErrorView,
6
- E as GENERIC_ERROR_TITLE,
7
- t as capitalizeFirst,
8
- a as describeError,
9
- i as httpReasonPhrase,
10
- p as httpStatusExplanation,
11
- s as isProblem,
12
- e as parseProblem
4
+ p as Error,
5
+ i as ErrorView,
6
+ t as GENERIC_ERROR_TITLE,
7
+ E as Warning,
8
+ r as capitalizeFirst,
9
+ o as describeError,
10
+ n as httpReasonPhrase,
11
+ s as httpStatusExplanation,
12
+ e as isProblem,
13
+ l as parseProblem
13
14
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { n as o, t as s } from "../chunks/toast-DrLKzrDJ.js";
2
+ import { n as o, t as s } from "../chunks/toast-B3oURNJC.js";
3
3
  export {
4
4
  s as Toast,
5
5
  o as Toasty