@aiquants/console-ui 0.6.4 → 0.7.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.
- package/README.md +84 -40
- package/dist/chunk-H4DAGEIG.js +1 -0
- package/dist/chunk-WUST5VT6.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +39 -9
- package/dist/index.d.ts +39 -9
- package/dist/index.js +1 -1
- package/dist/styles/console-ui.css +35 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +6 -2
- package/dist/testing.d.ts +6 -2
- package/dist/testing.js +1 -1
- package/package.json +6 -4
- package/dist/chunk-5TR7VUZM.js +0 -1
- package/dist/chunk-K7BETTSL.cjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { ConsoleUiLocale, ConsoleUiLabels, ColumnWidth, FgRole, TypeToken, SpaceToken, ResourceFailure, TextFace, ResourceOutcome, KeysetPage, NextPage, PagedState, PagedContent, ResourceState } from "./core.js";
|
|
2
2
|
export { AccentRole, COMPACT_ROW_PX, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, CellContent, ColorScheme, ColorToken, ColumnHeaderText, ColumnWidthSource, CommandOutcome, ConsoleUiTokens, ContrastRole, FIGURE_RING_REACH_PX, FLEXIBLE_COLUMN_MIN_PX, FigureBoxLines, FigureBoxPlan, FigureDiscLabelPlan, HTTP_FORBIDDEN, LATTICE_PX, MasterDetailOptions, MasterDetailPlan, MotionToken, PageFailure, PagedValue, ROW_WITH_CONTROL_PX, RadiusToken, ReloadCause, SchemeColor, SizeToken, Srgb, StrokeToken, SurfaceRole, TARGET_PX, TOKENS, TONES, TONE_HUES, TONE_ROLES, TileGridPlan, TileGridStep, TokenName, Tone, ToneHue, ToneRole, WeightToken, ZonedTimeError, ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, ceilToLattice, cellContentInlinePx, comparisonAttributePx, contrastRatio, countSampleText, cssVar, figureBoxPlan, figureDiscLabelPlan, fillLabel, fixedColumnPx, flatMapOutcome, formatByteSize, formatCount, formatInstant, goldenSectionPx, hexToSrgb, instantSampleText, isReadableText, keepLastGood, lightDark, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, placeholderRule, pxToRem, readDecimalText, readIntegerText, reasonAside, resolveConsoleUiLabels, settleFirstPage, settlePage, spacedTextWidthEm, tableFrameMinInlinePx, tableMinInlinePx, textWidthEm, tileGridPlan, tileMinInlinePx, toOffsetIso, toWallTime } from "./core.js";
|
|
3
3
|
import * as react from "react";
|
|
4
|
-
import { ReactNode, MouseEvent, Ref,
|
|
4
|
+
import { ReactNode, MouseEvent, Ref, RefObject, DOMAttributes, RefCallback, KeyboardEvent } from "react";
|
|
5
|
+
import { AccessFailureAction, AccessFailureView, AccessFailurePresenter, AccessFailurePlace } from "@aiquants/auth-core";
|
|
6
|
+
type AccessFailureHandlers = Readonly<Partial<Record<AccessFailureAction, () => void>>>;
|
|
7
|
+
type AccessFailureNoticeProps = {
|
|
8
|
+
readonly view: AccessFailureView;
|
|
9
|
+
readonly handlers: AccessFailureHandlers;
|
|
10
|
+
readonly testId: string;
|
|
11
|
+
};
|
|
12
|
+
declare const AccessFailureNotice: ({ view, handlers, testId }: AccessFailureNoticeProps) => react.JSX.Element;
|
|
5
13
|
type BreadcrumbItem = {
|
|
6
14
|
readonly id: string;
|
|
7
15
|
readonly label: string;
|
|
@@ -120,18 +128,21 @@ type ConsoleUiContextValue = {
|
|
|
120
128
|
readonly timeZone: string;
|
|
121
129
|
readonly labels: ConsoleUiLabels;
|
|
122
130
|
readonly announce: (text: string) => void;
|
|
131
|
+
readonly accessFailure: AccessFailurePresenter<ReactNode>;
|
|
123
132
|
};
|
|
124
133
|
declare const ANNOUNCE_SETTLE_MS = 150;
|
|
125
134
|
type ConsoleUiRootProps = {
|
|
126
135
|
readonly locale: ConsoleUiLocale;
|
|
127
136
|
readonly formatLocale: string;
|
|
128
137
|
readonly timeZone: string;
|
|
138
|
+
readonly accessFailure: AccessFailurePresenter<ReactNode>;
|
|
129
139
|
readonly testId: string;
|
|
130
140
|
readonly children: ReactNode;
|
|
131
141
|
};
|
|
132
|
-
declare const ConsoleUiRoot: ({ locale, formatLocale, timeZone, testId, children }: ConsoleUiRootProps) => react.JSX.Element;
|
|
142
|
+
declare const ConsoleUiRoot: ({ locale, formatLocale, timeZone, accessFailure, testId, children }: ConsoleUiRootProps) => react.JSX.Element;
|
|
133
143
|
declare const useConsoleUi: () => ConsoleUiContextValue;
|
|
134
144
|
declare const useAnnounce: () => ((text: string) => void);
|
|
145
|
+
declare const useAccessFailure: () => AccessFailurePresenter<ReactNode>;
|
|
135
146
|
type ColumnDef<T> = {
|
|
136
147
|
readonly key: string;
|
|
137
148
|
readonly header: string;
|
|
@@ -185,10 +196,11 @@ type DialogProps = {
|
|
|
185
196
|
readonly description?: ReactNode;
|
|
186
197
|
readonly open: boolean;
|
|
187
198
|
readonly onClose: () => void;
|
|
199
|
+
readonly initialFocus?: RefObject<HTMLElement | null>;
|
|
188
200
|
readonly testId: string;
|
|
189
201
|
readonly children: ReactNode;
|
|
190
202
|
};
|
|
191
|
-
declare const Dialog: ({ title, description, open, onClose, testId, children }: DialogProps) => react.JSX.Element;
|
|
203
|
+
declare const Dialog: ({ title, description, open, onClose, initialFocus, testId, children }: DialogProps) => react.JSX.Element;
|
|
192
204
|
type DisclosureProps = {
|
|
193
205
|
readonly summary: ReactNode;
|
|
194
206
|
readonly open: boolean;
|
|
@@ -197,6 +209,19 @@ type DisclosureProps = {
|
|
|
197
209
|
readonly children: ReactNode;
|
|
198
210
|
};
|
|
199
211
|
declare const Disclosure: ({ summary, open, onOpenChange, testId, children }: DisclosureProps) => react.JSX.Element;
|
|
212
|
+
type FailureMessageProps = {
|
|
213
|
+
readonly failure: {
|
|
214
|
+
readonly status: number | null;
|
|
215
|
+
readonly reason: string;
|
|
216
|
+
readonly occurrence: number;
|
|
217
|
+
};
|
|
218
|
+
readonly place: Exclude<AccessFailurePlace, "page">;
|
|
219
|
+
readonly deniedSentence: string;
|
|
220
|
+
readonly failed: (reason: string) => string;
|
|
221
|
+
readonly retry: (() => void) | null;
|
|
222
|
+
readonly testId: string;
|
|
223
|
+
};
|
|
224
|
+
declare const FailureMessage: ({ failure, place, deniedSentence, failed, retry, testId }: FailureMessageProps) => react.JSX.Element;
|
|
200
225
|
type FieldControl = {
|
|
201
226
|
readonly id: string;
|
|
202
227
|
readonly "aria-describedby": string | undefined;
|
|
@@ -218,7 +243,9 @@ declare const Field: ({ label, description, error, errorId: namedErrorId, testId
|
|
|
218
243
|
type TextInputProps = FieldTexts & {
|
|
219
244
|
readonly value: string;
|
|
220
245
|
readonly onValueChange: (value: string) => void;
|
|
221
|
-
readonly type: "text" | "search" | "datetime-local";
|
|
246
|
+
readonly type: "text" | "search" | "email" | "datetime-local";
|
|
247
|
+
readonly name?: string;
|
|
248
|
+
readonly maxLength?: number;
|
|
222
249
|
readonly inputMode?: "numeric" | "decimal";
|
|
223
250
|
readonly prefix?: string;
|
|
224
251
|
readonly labelHidden?: boolean;
|
|
@@ -241,11 +268,13 @@ declare const PasswordInput: (props: PasswordInputProps) => react.JSX.Element;
|
|
|
241
268
|
type TextAreaProps = FieldTexts & {
|
|
242
269
|
readonly value: string;
|
|
243
270
|
readonly onValueChange: (value: string) => void;
|
|
271
|
+
readonly name?: string;
|
|
272
|
+
readonly maxLength?: number;
|
|
244
273
|
readonly required?: boolean;
|
|
245
274
|
readonly testId: string;
|
|
246
275
|
readonly ref?: Ref<HTMLTextAreaElement>;
|
|
247
276
|
};
|
|
248
|
-
declare const TextArea: ({ label, description, error, errorId: namedErrorId, value, onValueChange, required, testId, ref }: TextAreaProps) => react.JSX.Element;
|
|
277
|
+
declare const TextArea: ({ label, description, error, errorId: namedErrorId, value, onValueChange, name, maxLength, required, testId, ref }: TextAreaProps) => react.JSX.Element;
|
|
249
278
|
type FieldOption = {
|
|
250
279
|
readonly value: string;
|
|
251
280
|
readonly label: string;
|
|
@@ -254,12 +283,13 @@ type SelectProps = FieldTexts & {
|
|
|
254
283
|
readonly value: string;
|
|
255
284
|
readonly options: readonly FieldOption[];
|
|
256
285
|
readonly onValueChange: (value: string) => void;
|
|
286
|
+
readonly name?: string;
|
|
257
287
|
readonly labelHidden?: boolean;
|
|
258
288
|
readonly unavailable?: Unavailable;
|
|
259
289
|
readonly testId: string;
|
|
260
290
|
readonly ref?: Ref<HTMLSelectElement>;
|
|
261
291
|
};
|
|
262
|
-
declare const Select: ({ label, description, error, errorId: namedErrorId, value, options, onValueChange, labelHidden, unavailable, testId, ref }: SelectProps) => react.JSX.Element;
|
|
292
|
+
declare const Select: ({ label, description, error, errorId: namedErrorId, value, options, onValueChange, name, labelHidden, unavailable, testId, ref }: SelectProps) => react.JSX.Element;
|
|
263
293
|
type RadioGroupProps = FieldErrorId & {
|
|
264
294
|
readonly legend: string;
|
|
265
295
|
readonly description?: string;
|
|
@@ -513,12 +543,12 @@ declare const PanelTabs: ({ label, items, value, onValueChange, testId, panelDes
|
|
|
513
543
|
type ResourceFailedProps = {
|
|
514
544
|
readonly failure: ResourceFailure;
|
|
515
545
|
readonly onReload: () => void;
|
|
516
|
-
readonly
|
|
546
|
+
readonly deniedSentence: string;
|
|
517
547
|
readonly failureMessage?: (reason: string) => string;
|
|
518
548
|
readonly rescueRef: RefCallback<HTMLElement>;
|
|
519
549
|
readonly testId: string;
|
|
520
550
|
};
|
|
521
|
-
declare const ResourceFailed: ({ failure, onReload,
|
|
551
|
+
declare const ResourceFailed: ({ failure, onReload, deniedSentence, failureMessage, rescueRef, testId }: ResourceFailedProps) => react.JSX.Element;
|
|
522
552
|
type SegmentedOption = {
|
|
523
553
|
readonly value: string;
|
|
524
554
|
readonly label: string;
|
|
@@ -689,4 +719,4 @@ type VisuallyHiddenProps = {
|
|
|
689
719
|
readonly children: ReactNode;
|
|
690
720
|
};
|
|
691
721
|
declare const VisuallyHidden: ({ testId, children }: VisuallyHiddenProps) => react.JSX.Element;
|
|
692
|
-
export { ANNOUNCE_SETTLE_MS, AlertMessage, type AlertMessageProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, type ButtonVariant, Card, type CardProps, CardSection, type CardSectionProps, CheckboxGroup, type CheckboxGroupProps, Cluster, type ClusterProps, CodeBlock, type CodeBlockProps, type ColumnDef, ColumnWidth, type ComparisonAttribute, type ComparisonColumn, ComparisonGrid, type ComparisonGridProps, type ComparisonLayout, type ConsoleUiContextValue, ConsoleUiLabels, ConsoleUiLocale, ConsoleUiRoot, type ConsoleUiRootProps, type DataAttributes, DataTable, type DataTableProps, type DataTableRowDetail, type DescriptionItem, DescriptionList, type DescriptionListProps, Dialog, type DialogProps, Disclosure, type DisclosureProps, FgRole, Field, type FieldControl, type FieldOption, type FieldProps, Figure, FigureEdge, type FigureEdgeProps, FigureNode, type FigureNodeNote, type FigureNodePress, type FigureNodeProps, type FigureNodeShape, type FigurePointer, type FigureProps, FragmentLink, type FragmentLinkProps, Heading, type HeadingProps, type HeadingType, InlineChange, type InlineChangeKind, type InlineChangeProps, type JobCancel, JobCard, type JobCardProps, KeysetPage, Link, type LinkProps, List, ListItem, type ListItemProps, type ListMarking, type ListProps, type ListTextType, LoadMore, type LoadMoreProps, MasterDetail, type MasterDetailProps, Measured, type MeasuredKeep, type MeasuredProps, Meter, type MeterProps, MetricTile, type MetricTileProps, type MetricTileTone, NextPage, Notice, type NoticeProps, PagedContent, type PagedLoaders, PagedState, type PanelTab, PanelTabs, type PanelTabsProps, PasswordInput, type PasswordInputProps, type PendingPress, Pill, type PillProps, type PillTone, ProgressBar, type ProgressBarProps, RadioGroup, type RadioGroupProps, ResourceFailed, type ResourceFailedProps, ResourceFailure, ResourceOutcome, ResourceState, RowButton, type RowButtonProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectProps, SelectableList, type SelectableListProps, Slider, type SliderProps, SpaceToken, Stack, type StackProps, type StepState, Stepper, type StepperItem, type StepperProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, TextFace, TextInput, type TextInputProps, type TextProps, TileGrid, type TileGridProps, Toolbar, type ToolbarProps, TypeToken, type Unavailable, type UsePagedResourceResult, type UseResourceResult, VisuallyHidden, type VisuallyHiddenProps, useAnnounce, useConsoleUi, useEscapeToClose, useFocusRescue, usePagedResource, usePendingPress, useResource };
|
|
722
|
+
export { ANNOUNCE_SETTLE_MS, type AccessFailureHandlers, AccessFailureNotice, type AccessFailureNoticeProps, AlertMessage, type AlertMessageProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, type ButtonVariant, Card, type CardProps, CardSection, type CardSectionProps, CheckboxGroup, type CheckboxGroupProps, Cluster, type ClusterProps, CodeBlock, type CodeBlockProps, type ColumnDef, ColumnWidth, type ComparisonAttribute, type ComparisonColumn, ComparisonGrid, type ComparisonGridProps, type ComparisonLayout, type ConsoleUiContextValue, ConsoleUiLabels, ConsoleUiLocale, ConsoleUiRoot, type ConsoleUiRootProps, type DataAttributes, DataTable, type DataTableProps, type DataTableRowDetail, type DescriptionItem, DescriptionList, type DescriptionListProps, Dialog, type DialogProps, Disclosure, type DisclosureProps, FailureMessage, type FailureMessageProps, FgRole, Field, type FieldControl, type FieldOption, type FieldProps, Figure, FigureEdge, type FigureEdgeProps, FigureNode, type FigureNodeNote, type FigureNodePress, type FigureNodeProps, type FigureNodeShape, type FigurePointer, type FigureProps, FragmentLink, type FragmentLinkProps, Heading, type HeadingProps, type HeadingType, InlineChange, type InlineChangeKind, type InlineChangeProps, type JobCancel, JobCard, type JobCardProps, KeysetPage, Link, type LinkProps, List, ListItem, type ListItemProps, type ListMarking, type ListProps, type ListTextType, LoadMore, type LoadMoreProps, MasterDetail, type MasterDetailProps, Measured, type MeasuredKeep, type MeasuredProps, Meter, type MeterProps, MetricTile, type MetricTileProps, type MetricTileTone, NextPage, Notice, type NoticeProps, PagedContent, type PagedLoaders, PagedState, type PanelTab, PanelTabs, type PanelTabsProps, PasswordInput, type PasswordInputProps, type PendingPress, Pill, type PillProps, type PillTone, ProgressBar, type ProgressBarProps, RadioGroup, type RadioGroupProps, ResourceFailed, type ResourceFailedProps, ResourceFailure, ResourceOutcome, ResourceState, RowButton, type RowButtonProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectProps, SelectableList, type SelectableListProps, Slider, type SliderProps, SpaceToken, Stack, type StackProps, type StepState, Stepper, type StepperItem, type StepperProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Text, TextArea, type TextAreaProps, TextFace, TextInput, type TextInputProps, type TextProps, TileGrid, type TileGridProps, Toolbar, type ToolbarProps, TypeToken, type Unavailable, type UsePagedResourceResult, type UseResourceResult, VisuallyHidden, type VisuallyHiddenProps, useAccessFailure, useAnnounce, useConsoleUi, useEscapeToClose, useFocusRescue, usePagedResource, usePendingPress, useResource };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as yt,A as S,B as ga,C as ba,D as ha,E as Ra,F as Ta,G as xa,H as va,I as Ea,J as wa,K as Pa,L as Ca,M as Na,N as at,O as it,P as st,Q as W,R as U,S as ka,T as I,U as La,V as dt,W as lt,X as Sa,Y as ut,Z as ct,_ as pt,a as ue,aa as ft,b as ra,ba as Me,c as tt,ca as Fa,d as na,da as Aa,e as oa,ea as Da,f as D,fa as Ha,g as aa,ga as Oa,h as ia,i as sa,j as da,k as la,l as yr,m as ua,n as ca,o as Ne,p as ke,q as rt,r as Le,s as pa,t as ya,u as nt,v as Se,w as fa,x as V,y as ma,z as ot}from"./chunk-5TR7VUZM.js";import{a as Ma,b as Ia,c as $a,d as mt}from"./chunk-FXEGLGL7.js";import{createContext as fr,useCallback as mr,useContext as xt,useLayoutEffect as gr,useMemo as gt,useRef as bt}from"react";import{jsx as Tt,jsxs as wr}from"react/jsx-runtime";var Ie=fr(null),vt=" ",ht='[inert], [aria-hidden="true" i]',Et="dialog:modal",$e="data-cui-dialog-announcer",br=`:scope > [${$e}]`,hr=e=>{if(e.closest(ht)!==null)return{hidden:'an ancestor is inert or aria-hidden="true"'};let t=e.ownerDocument,r=[...t.querySelectorAll(Et)],n=t.activeElement,a=r.filter(s=>s.contains(n)),o=a.length>0?a:r;if(o.every(s=>s.contains(e)))return{region:e};let i=o.find(s=>o.every(l=>l.contains(s)));if(i===void 0)return{hidden:"focus is in no open modal dialog and they do not nest, so which one is topmost cannot be told"};let d=i.querySelector(br);return d===null?{hidden:"the topmost open modal dialog neither contains the console nor is a Dialog"}:d.closest(ht)!==null?{hidden:'the topmost open modal dialog is a Dialog whose live region has an inert or aria-hidden="true" ancestor'}:{region:d}},Rr=e=>{try{e.querySelectorAll(Et)}catch(t){throw typeof t=="object"&&t!==null&&"name"in t&&t.name==="SyntaxError"?new Error("ConsoleUiRoot requires the :modal selector (Chrome 105, Firefox 103, Safari 15.6, jsdom 27 or later): announcements check whether a modal dialog hides the live region",{cause:t}):t}},ce=150,Tr=1e3,Rt=new WeakMap,xr=(e,t)=>{let r=Rt.get(e)??new Set,n={text:t};Rt.set(e,r.add(n)),setTimeout(()=>r.delete(n),ce);let a=e.ownerDocument.createElement("span");a.textContent=[...r].map(o=>o.text).join(vt),e.replaceChildren(a)},vr=({locale:e,formatLocale:t,timeZone:r,testId:n,children:a})=>{if(xt(Ie)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");let i=nt(e),[d]=Intl.getCanonicalLocales(t),s=gt(()=>new Intl.DateTimeFormat(d,{timeZone:r}).resolvedOptions().timeZone,[d,r]),l=bt(null),p=bt(null);gr(()=>{Rr(l.current.ownerDocument)},[]);let u=mr(y=>{if(y.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let f=()=>{let{texts:h,settle:T,deadline:x}=p.current;p.current=null,clearTimeout(T),clearTimeout(x);let b=l.current;if(b===null)return;let R=h.join(vt),v=hr(b);if("hidden"in v)throw new Error(`announce: the live region is hidden from assistive technology (${v.hidden}), so this announcement would be lost: ${R}`);xr(v.region,R)},m=p.current;if(m===null){p.current={texts:[y],settle:setTimeout(f,ce),deadline:setTimeout(f,Tr)};return}m.texts.push(y),clearTimeout(m.settle),m.settle=setTimeout(f,ce)},[]),c=gt(()=>({locale:e,formatLocale:d,timeZone:s,labels:i,announce:u}),[e,d,s,i,u]);return Tt(Ie.Provider,{value:c,children:wr("div",{"data-cui-root":"","data-cui-surface":"surface","data-cui-fg":"fg","data-testid":n,children:[a,Tt("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${n}-announcer`,ref:l})]})})},k=()=>{let e=xt(Ie);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},g=()=>{k()},Er=()=>k().announce;var pe=(e,t,r)=>{e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),r(t))};import{jsx as te,jsxs as wt}from"react/jsx-runtime";var Pr=({items:e,current:t,onNavigate:r,testId:n})=>{let{labels:a}=k();if(new Set(e.map(o=>o.id)).size!==e.length)throw new RangeError(`Breadcrumb keys must be unique: ${e.map(o=>o.id).join(", ")}`);return te("nav",{className:"cui-breadcrumb","aria-label":a.breadcrumb,"data-testid":n,children:wt("ol",{className:"cui-breadcrumb-list",role:"list","data-cui-type":"body",children:[e.map(o=>wt("li",{className:"cui-breadcrumb-item",children:[te("a",{className:"cui-link",href:o.href,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":`${n}-${o.id}`,onClick:i=>pe(i,o.href,r),children:o.label}),te("span",{className:"cui-breadcrumb-separator","aria-hidden":"true","data-cui-fg":"fg-muted",children:"\u203A"})]},o.id)),te("li",{className:"cui-breadcrumb-item",children:te("span",{"aria-current":"page","data-cui-fg":"fg","data-testid":`${n}-current`,children:t})})]})})};import{useId as Mr,useRef as Ir}from"react";var w=e=>{if(e===void 0)return{};for(let t of Object.keys(e))if(!t.startsWith("data-")||t.startsWith("data-cui-")||t==="data-testid")throw new RangeError(`Caller attributes must be data-* and must not override data-cui-* or data-testid: ${t}`);return e};import{useLayoutEffect as Cr}from"react";var Nr=new Set(["abbr","b","bdi","bdo","br","cite","code","data","del","dfn","em","i","ins","kbd","mark","q","s","samp","small","span","strong","sub","sup","time","u","var","wbr"]),kr=e=>{for(let t of e.querySelectorAll("*")){let r=t.localName;if(!Nr.has(r)||t.hasAttribute("tabindex")||t.hasAttribute("contenteditable"))return r}return null},H=(e,{testId:t,part:r,host:n})=>{Cr(()=>{let a=kr(e.current);if(a!==null)throw new RangeError(`${t}: the ${r} is the content of a ${n} and holds only non-interactive phrasing content, not <${a}>`)})};import{jsx as Lr}from"react/jsx-runtime";var P=({fg:e,type:t,face:r,as:n="span",space:a,testId:o,id:i,tabIndex:d,ref:s,children:l})=>(g(),Lr(n,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":r,"data-cui-space":a,"data-cui-measure":n==="p"?"reading":void 0,"data-testid":o,id:i,tabIndex:d,ref:s,children:l}));var Sr=/\s/,Fe=(e,t)=>{if(e===""||Sr.test(e))throw new RangeError(`The id of ${t} must be one token without whitespace: "${e}"`);return e},z=(e,t)=>{if(e!==void 0){if(e.reason!==void 0){if(e.reason.trim()==="")throw new RangeError("An unavailable control needs a reason that is not blank");return t}return Fe(e.reasonId,"an unavailable control's reason")}},K=(...e)=>{let t=e.filter(r=>r!==void 0);return t.length===0?void 0:t.join(" ")};import{jsx as O,jsxs as Hr}from"react/jsx-runtime";var $r={primary:{fg:"on-solid",surface:"info-solid",type:"body"},secondary:{fg:"fg",surface:void 0,type:"body"},danger:{fg:"on-solid",surface:"danger-solid",type:"body"},link:{fg:"info-fg",surface:void 0,type:"body"}},Ae=({subject:e,children:t})=>{let r=Ir(null);return H(r,e),O("span",{ref:r,children:t})},F=({variant:e,children:t,testId:r,type:n="button",onClick:a,unavailable:o,describedBy:i,expanded:d,controls:s,ref:l,dataAttributes:p,busy:u,busyLabel:c})=>{g();let y=Mr(),f=z(o,y),m=u===!0||o!==void 0,h=$r[e],T=x=>{if(m){x.preventDefault();return}a?.(x)};return Hr("span",{className:"cui-button-group",children:[O("button",{className:"cui-button",type:n==="submit"?"submit":"button","data-cui-variant":e,"data-cui-fg":h.fg,"data-cui-surface":h.surface,"data-cui-type":h.type,"data-testid":r,"aria-disabled":m?!0:void 0,"aria-busy":u===!0?!0:void 0,"aria-describedby":K(i,f),"aria-expanded":d,"aria-controls":s,onClick:T,ref:l,...w(p),children:O(Ae,{subject:{testId:r,part:"label",host:"button"},children:u===!0?c:t})}),o?.reason===void 0?null:O(P,{fg:"fg-muted",type:"body",id:y,testId:`${r}-reason`,children:o.reason})]})},Fr=({onNavigate:e,children:t,testId:r,ref:n})=>(g(),O("button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"body","data-testid":r,onClick:e,ref:n,children:O(Ae,{subject:{testId:r,part:"label",host:"button"},children:t})})),Ar=/^[^\s#]+$/,Dr=({targetId:e,children:t,testId:r,onFollow:n,dataAttributes:a})=>{if(g(),!Ar.test(e))throw new RangeError(`A fragment link needs the target's id without "#" or white space: "${e}"`);return O("a",{className:"cui-link",href:`#${e}`,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":r,onClick:n,...w(a),children:O(Ae,{subject:{testId:r,part:"label",host:"link"},children:t})})};import{useId as Pt}from"react";import{useCallback as Or}from"react";var Ur=229,Kr=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),De=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&Kr.has(e.type)&&(e.value!==""||e.validity.badInput),B=(e,t)=>{e.key!=="Escape"||e.nativeEvent.isComposing||e.keyCode===Ur||De(e.target)||(e.stopPropagation(),t())},Br=e=>Or(t=>B(t,e),[e]);import{Fragment as Gr,jsx as _,jsxs as re}from"react/jsx-runtime";var Ct=e=>e===void 0?void 0:t=>B(t,e),He=({id:e,title:t,description:r,actions:n,onEscape:a,testId:o,headingRef:i,ref:d,dataAttributes:s,children:l})=>{g();let p=Pt(),u=Ct(a);return re("section",{className:"cui-card",id:e,"aria-labelledby":p,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":o,ref:d,onKeyDown:u,...w(s),children:[re("div",{className:"cui-card-header",children:[re("div",{className:"cui-card-heading",children:[_("h2",{className:"cui-card-title",id:p,"data-cui-type":"title","data-testid":`${o}-heading`,ref:i,tabIndex:i===void 0?void 0:-1,children:t}),r===void 0?null:_("div",{className:"cui-card-description","data-cui-fg":"fg-muted","data-cui-type":"body","data-cui-measure":"reading",children:r})]}),n===void 0?null:_("div",{className:"cui-card-actions",children:n})]}),l]})},_r={3:"h3",4:"h4"},qr=({id:e,title:t,subtitle:r,level:n=3,region:a=!1,onEscape:o,testId:i,headingRef:d,ref:s,dataAttributes:l,children:p})=>{g();let u=Pt(),c=Ct(o),y=_r[n],f=re(Gr,{children:[re("div",{className:"cui-card-section-heading",children:[_(y,{className:"cui-card-section-title",id:u,"data-cui-type":"body","data-testid":`${i}-heading`,ref:d,tabIndex:d===void 0?void 0:-1,children:t}),r===void 0?null:_("div",{className:"cui-card-section-subtitle","data-cui-fg":"fg-muted","data-cui-type":"body","data-cui-measure":"reading",children:r})]}),p]});return a?_("section",{className:"cui-card-section",id:e,"aria-labelledby":u,"data-testid":i,ref:s,onKeyDown:c,...w(l),children:f}):_("div",{className:"cui-card-section",id:e,"data-testid":i,ref:s,...w(l),children:f})};import{jsx as Nt}from"react/jsx-runtime";var Vr=({label:e,code:t,testId:r})=>(g(),Nt("section",{className:"cui-code-frame",tabIndex:0,"aria-label":e,"data-cui-surface":"sunken","data-testid":r,children:Nt("pre",{className:"cui-code","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"mono","data-testid":`${r}-code`,children:t})}));import{useId as zr}from"react";import{jsx as Wr}from"react/jsx-runtime";var J=({ruleKey:e,css:t})=>Wr("style",{href:e,precedence:"cui",children:t});import{jsx as N,jsxs as q}from"react/jsx-runtime";var Jr=({caption:e,attributes:t,columns:r,attributePx:n,columnMinPx:a,testId:o})=>{g();let i=zr();for(let u of[n,a])if(!(Number.isFinite(u)&&u>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${u}`);if(r.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let u of r)for(let c of t)if(!Object.hasOwn(u.cells,c.key))throw new RangeError(`Column "${u.key}" has no value for attribute "${c.key}"`);let d=n+r.length*a,s=`cui-comparison-a${n}-c${a}-n${r.length}`,l=u=>`[data-cui-comparison="${s}"][data-cui-comparison-layout="${u}"]`,p=`${l("table")}{display:none}@container (min-width:${I(d)}){${l("table")}{display:block}${l("stack")}{display:none}}`;return q("div",{className:"cui-container","data-cui-stack-below-px":d,"data-testid":o,children:[N(J,{ruleKey:s,css:p}),N("div",{className:"cui-comparison-frame","data-cui-comparison":s,"data-cui-comparison-layout":"table",children:q("table",{className:"cui-comparison-table","data-cui-type":"body",children:[N("caption",{className:"cui-visually-hidden",children:e}),q("colgroup",{children:[N("col",{style:{width:I(n)}}),r.map(u=>N("col",{},u.key))]}),N("thead",{children:q("tr",{children:[N("td",{}),r.map(u=>N("th",{scope:"col",children:u.heading},u.key))]})}),N("tbody",{children:t.map(u=>q("tr",{children:[N("th",{scope:"row",children:u.label}),r.map(c=>N("td",{children:c.cells[u.key]("table")},c.key))]},u.key))})]})}),N("div",{className:"cui-comparison-stack","data-cui-comparison":s,"data-cui-comparison-layout":"stack",children:r.map((u,c)=>{let y=`${i}-column-${c}`;return q("div",{className:"cui-comparison-column",role:"group","aria-labelledby":y,"data-cui-type":"body",children:[N("div",{className:"cui-comparison-heading",id:y,children:u.heading}),N("dl",{className:"cui-comparison-list",children:t.map(f=>q("div",{children:[N("dt",{children:f.label}),N("dd",{children:u.cells[f.key]("stack")})]},f.key))})]},u.key)})})]})};import{Fragment as Qr,useCallback as en,useId as tn,useLayoutEffect as St,useRef as Be}from"react";var ne="[data-cui-row-focus]",Oe="[data-cui-row-detail]",Xr=e=>e===null?[]:[...e.querySelectorAll(`:scope > ${ne}`)],kt=(e,t)=>{let r=new Map;t!==null&&r.set(t,0);let n=-1;for(let a of e===null?[]:e.children)a.matches(ne)?(n+=1,r.set(a,n)):n>=0&&a.matches(Oe)&&r.set(a,n);return r},Lt=(e,t,r,n)=>{let a=Xr(t);if(a.length===0)return r;let o=n.get(e);if(o===void 0)throw new RangeError(`rowFocusTarget: <${e.localName}> left holding focus with no position in the table (only its rows, row details and empty text hold one)`);return a[Math.min(o,a.length-1)]};import{useCallback as jr,useLayoutEffect as Ue,useReducer as Yr,useRef as Ke}from"react";var Zr=e=>e+1,oe=e=>{let t=Ke(e),r=Ke(null),n=Ke(!1),[,a]=Yr(Zr,0),o=jr((i=>()=>{n.current&&i.contains(document.activeElement)&&(r.current=i,a())}),[]);return Ue(()=>(n.current=!0,()=>{n.current=!1,r.current=null}),[]),Ue(()=>{t.current=e}),Ue(()=>{let i=r.current;if(i===null)return;r.current=null;let d=[null,document.body].includes(document.activeElement);i.isConnected||!d||t.current(i)?.focus()}),o};import{jsx as L,jsxs as ye}from"react/jsx-runtime";var rn=new Map,nn='a[href], audio[controls], button, details, embed, iframe, img[usemap], input:not([type="hidden"]), label, select, textarea, video[controls], [tabindex], [contenteditable]',on=(e,t,r)=>{St(()=>{let n=e.current;if(t!=="row-compact"||n===null)return;let a=[...n.querySelectorAll(nn)].find(o=>o.parentElement!==n);if(a!==void 0)throw new RangeError(`${r}: a compact row holds no control or focus target (a ${V} px target does not fit its ${ot} px; use row-control), not <${a.localName}>`)})},an=(e,t)=>{let r=e.filter(a=>a.rowHeader===!0).map(a=>a.key);if(r.length>1)throw new RangeError(`${t}: a table has at most one row header column, not ${r.length} (${r.join(", ")})`);let n=e.find(a=>a.rowHeader!==!0&&a.rowHeaderNote!==void 0);if(n!==void 0)throw new RangeError(`${t}: a row header note belongs to the row header column, not to ${n.key}`)},sn=e=>e==null?null:L("div",{className:"cui-table-header-note",children:e}),dn=(e,t,r,n,a)=>{let o=e.open(t);return L("tr",{ref:a,hidden:!o,"data-cui-row-detail":o?"open":"closed","data-testid":`${n}-detail`,children:L("td",{colSpan:r,id:e.id(t),children:o?e.render(t):null})})},ln=({caption:e,captionHidden:t,columns:r,rows:n,rowKey:a,rowTestId:o,rowData:i,rowSize:d,rowDetail:s,empty:l,testId:p,ref:u})=>{g();let c=tn(),y=Be(null);on(y,d,p);let f=Be(null),m=Be(rn),h=oe(b=>Lt(b,y.current,f.current,m.current));St(()=>{m.current=kt(y.current,f.current)});let T=en(b=>{f.current=b;let R=h(b);return()=>{f.current=null,R()}},[h]),x=lt(r);return an(r,p),L("div",{className:"cui-container","data-testid":p,ref:u,children:n.length===0?L(P,{as:"p",fg:"fg-muted",type:"prose",tabIndex:-1,ref:T,testId:`${p}-empty`,children:l}):L("section",{ref:h,className:"cui-table-frame",tabIndex:0,"aria-labelledby":c,"data-testid":`${p}-frame`,children:ye("table",{className:"cui-table","data-cui-type":"body","data-cui-row-size":d,style:{"--cui-table-min":I(x)},children:[L("caption",{className:t?"cui-visually-hidden":"cui-table-caption",id:c,children:e}),L("colgroup",{children:r.map(b=>L("col",{style:b.width.fixedPx===void 0?void 0:{width:I(b.width.fixedPx)}},b.key))}),L("thead",{children:L("tr",{children:r.map(b=>ye("th",{scope:"col","data-cui-align":b.align,"data-cui-surface":"subtle","data-cui-type":"caption",children:[b.header,b.note===void 0?null:L("div",{className:"cui-table-header-note",children:b.note})]},b.key))})}),L("tbody",{ref:y,children:n.map(b=>ye(Qr,{children:[L("tr",{ref:h,tabIndex:-1,"data-cui-row-focus":"","data-testid":o,...w(i?.(b)),children:r.map(R=>R.rowHeader===!0?ye("th",{scope:"row","data-cui-align":R.align,children:[R.cell(b),R.rowHeaderNote===void 0?null:sn(R.rowHeaderNote(b))]},R.key):L("td",{"data-cui-align":R.align,children:R.cell(b)},R.key))}),s===void 0?null:dn(s,b,r.length,o,h)]},a(b)))})]})})})};import{jsx as _e,jsxs as cn}from"react/jsx-runtime";var un=({items:e,testId:t})=>{if(g(),new Set(e.map(r=>r.key)).size!==e.length)throw new RangeError(`Description keys must be unique: ${e.map(r=>r.key).join(", ")}`);return _e("dl",{className:"cui-description-list","data-cui-type":"body","data-testid":t,children:e.map(r=>cn("div",{className:"cui-description-row","data-testid":`${t}-${r.key}`,children:[_e("dt",{"data-cui-fg":"fg-secondary",children:r.term}),_e("dd",{"data-cui-fg":"fg",children:r.description})]},r.key))})};import{useId as Mt,useLayoutEffect as It,useRef as $t}from"react";import{jsx as ae,jsxs as At}from"react/jsx-runtime";var Ft=e=>{e instanceof HTMLElement&&e.isConnected&&e.focus()},pn=({title:e,description:t,open:r,onClose:n,testId:a,children:o})=>{let{labels:i}=k(),d=Mt(),s=Mt(),l=$t(null),p=$t(null);return It(()=>{let y=l.current;r&&!y.open?(p.current=y.ownerDocument.activeElement,y.showModal()):!r&&y.open&&y.close()},[r]),It(()=>{let y=l.current;return()=>{y.open&&(y.close(),Ft(p.current),p.current=null)}},[]),At("dialog",{className:"cui-dialog","aria-labelledby":d,"aria-describedby":t===void 0?void 0:s,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":a,ref:l,onClose:y=>{y.currentTarget.open||(Ft(p.current),p.current=null,r&&n())},onCancel:y=>{De(y.currentTarget.ownerDocument.activeElement)&&y.preventDefault()},children:[At("div",{className:"cui-dialog-header",children:[ae("h2",{className:"cui-dialog-title",id:d,"data-cui-type":"title",children:e}),ae("div",{className:"cui-dialog-actions",children:ae(F,{variant:"secondary",testId:`${a}-close`,onClick:()=>l.current?.close(),children:i.close})})]}),t===void 0?null:ae("div",{id:s,"data-cui-measure":"reading","data-testid":`${a}-description`,children:t}),o,ae("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true",[$e]:"","data-testid":`${a}-announcer`})]})};import{useId as yn,useRef as fn}from"react";import{jsx as qe,jsxs as Dt}from"react/jsx-runtime";var mn=({summary:e,open:t,onOpenChange:r,testId:n,children:a})=>{g();let o=yn(),i=fn(null);return H(i,{testId:n,part:"summary",host:"button"}),Dt("div",{className:"cui-disclosure","data-testid":n,children:[Dt("button",{className:"cui-disclosure-button",type:"button","aria-expanded":t,"aria-controls":o,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${n}-button`,onClick:()=>r(!t),children:[qe("span",{className:"cui-disclosure-marker","aria-hidden":"true",children:t?"\u25BE":"\u25B8"}),qe("span",{ref:i,children:e})]}),qe("div",{className:"cui-disclosure-panel",id:o,hidden:!t,"data-testid":`${n}-panel`,children:a})]})};import{useId as X}from"react";import{Fragment as En,jsx as E,jsxs as $}from"react/jsx-runtime";var j=({description:e,error:t,errorId:r})=>{g();let n=X(),a=X(),o=X(),i=r===void 0?o:Fe(r,"a field's error"),d=[e===void 0?null:a,t===void 0?null:i].filter(l=>l!==null).join(" ");return{control:{id:n,"aria-describedby":d===""?void 0:d,"aria-invalid":t===void 0?void 0:!0},descriptionId:a,errorId:i}},Y=({description:e,error:t,descriptionId:r,errorId:n,testId:a})=>$(En,{children:[e===void 0?null:E(P,{as:"p",fg:"fg-muted",type:"body",id:r,testId:`${a}-description`,children:e}),t===void 0?null:E(P,{as:"p",fg:"danger-fg",type:"body",id:n,testId:`${a}-error`,children:t})]}),fe=({htmlFor:e,hidden:t,children:r})=>E("label",{className:t===!0?"cui-visually-hidden":"cui-field-label",htmlFor:e,"data-cui-type":"body",children:r}),gn=({label:e,description:t,error:r,errorId:n,testId:a,children:o})=>{let{control:i,descriptionId:d,errorId:s}=j({label:e,description:t,error:r,errorId:n});return $("div",{className:"cui-field","data-invalid":r!==void 0,"data-testid":a,children:[E(fe,{htmlFor:i.id,hidden:void 0,children:e}),o(i),E(Y,{description:t,error:r,descriptionId:d,errorId:s,testId:a})]})},Ht=({label:e,description:t,error:r,errorId:n,value:a,onValueChange:o,type:i,list:d,autoComplete:s,inputMode:l,prefix:p,labelHidden:u,required:c,testId:y,ref:f})=>{let{control:m,descriptionId:h,errorId:T}=j({label:e,description:t,error:r,errorId:n}),x=X();if(p!==void 0&&p.trim()==="")throw new RangeError("An input's prefix must not be blank");let b=i==="password",R=E("input",{className:"cui-input",type:i,value:a,list:d,autoComplete:s,inputMode:l,spellCheck:b?!1:void 0,autoCapitalize:b?"none":void 0,required:c,onChange:v=>o(v.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":y,ref:f,...m,"aria-describedby":K(p===void 0?void 0:x,m["aria-describedby"])});return $("div",{className:"cui-field","data-invalid":r!==void 0,"data-testid":`${y}-field`,children:[E(fe,{htmlFor:m.id,hidden:u,children:e}),p===void 0?R:$("div",{className:"cui-input-group",children:[E("span",{className:"cui-input-prefix",id:x,"data-cui-fg":"fg-secondary","data-cui-surface":"sunken","data-cui-type":"body","data-testid":`${y}-prefix`,children:p}),R]}),E(Y,{description:t,error:r,descriptionId:h,errorId:T,testId:y})]})},bn=e=>E(Ht,{...e}),hn=e=>E(Ht,{...e,type:"password"}),Rn=({label:e,description:t,error:r,errorId:n,value:a,onValueChange:o,required:i,testId:d,ref:s})=>{let{control:l,descriptionId:p,errorId:u}=j({label:e,description:t,error:r,errorId:n});return $("div",{className:"cui-field","data-invalid":r!==void 0,"data-testid":`${d}-field`,children:[E(fe,{htmlFor:l.id,hidden:void 0,children:e}),E("textarea",{className:"cui-input cui-textarea",value:a,required:i,onChange:c=>o(c.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":d,ref:s,...l}),E(Y,{description:t,error:r,descriptionId:p,errorId:u,testId:d})]})},Tn=({label:e,description:t,error:r,errorId:n,value:a,options:o,onValueChange:i,labelHidden:d,unavailable:s,testId:l,ref:p})=>{let{control:u,descriptionId:c,errorId:y}=j({label:e,description:t,error:r,errorId:n}),f=X(),m=z(s,f);return $("div",{className:"cui-field","data-invalid":r!==void 0,"data-testid":`${l}-field`,children:[E(fe,{htmlFor:u.id,hidden:d,children:e}),E("select",{className:"cui-input",value:a,onChange:h=>{s===void 0&&i(h.target.value)},"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":l,ref:p,...u,"aria-disabled":s===void 0?void 0:!0,"aria-describedby":K(u["aria-describedby"],m),children:o.map(h=>E("option",{value:h.value,children:h.label},h.value))}),E(Y,{description:t,error:r,descriptionId:c,errorId:y,testId:l}),s?.reason===void 0?null:E(P,{as:"p",fg:"fg-muted",type:"body",id:f,testId:`${l}-reason`,children:s.reason})]})},xn=({legend:e,description:t,error:r,errorId:n,value:a,options:o,onValueChange:i,testId:d,ref:s})=>{let l=X(),{control:p,descriptionId:u,errorId:c}=j({label:e,description:t,error:r,errorId:n});return $("fieldset",{className:"cui-radio-group","aria-describedby":p["aria-describedby"],"data-invalid":r!==void 0,"data-testid":d,children:[E("legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),o.map((y,f)=>$("label",{className:"cui-radio","data-cui-type":"body",children:[E("input",{type:"radio",name:l,value:y.value,checked:y.value===a,onChange:()=>i(y.value),"aria-invalid":p["aria-invalid"],"data-testid":`${d}-option-${y.value}`,ref:f===0?s:void 0}),E("span",{children:y.label})]},y.value)),E(Y,{description:t,error:r,descriptionId:u,errorId:c,testId:d})]})},vn=({legend:e,description:t,error:r,errorId:n,values:a,options:o,onValuesChange:i,testId:d,ref:s})=>{let{control:l,descriptionId:p,errorId:u}=j({label:e,description:t,error:r,errorId:n}),c=o.map(m=>m.value);if(c.length===0||new Set(c).size!==c.length)throw new RangeError(`A check box group needs at least one option with unique values: ${c.join(", ")}`);let y=a.filter(m=>!c.includes(m));if(y.length>0)throw new RangeError(`The chosen values are not options: ${y.join(", ")}`);let f=new Set(a);return $("fieldset",{className:"cui-checkbox-group","aria-describedby":l["aria-describedby"],"data-invalid":r!==void 0,"data-testid":d,children:[E("legend",{className:"cui-checkbox-group-legend","data-cui-type":"body",children:e}),o.map((m,h)=>$("label",{className:"cui-checkbox","data-cui-type":"body",children:[E("input",{type:"checkbox",value:m.value,checked:f.has(m.value),onChange:()=>i(c.filter(T=>T===m.value?!f.has(T):f.has(T))),"aria-invalid":l["aria-invalid"],"data-testid":`${d}-option-${m.value}`,ref:h===0?s:void 0}),E("span",{children:m.label})]},m.value)),E(Y,{description:t,error:r,descriptionId:p,errorId:u,testId:d})]})};import{createContext as wn,useContext as Pn,useId as _t,useMemo as Cn}from"react";import{Fragment as Wt,jsx as C,jsxs as me}from"react/jsx-runtime";var qt=wn(null),Ot="surface",Ut={neutral:{face:"surface",line:"border-control"},info:{face:"info-tint",line:"info-accent"},success:{face:"success-tint",line:"success-accent"},warning:{face:"warning-tint",line:"warning-accent"},danger:{face:"danger-tint",line:"danger-accent"}},Kt={face:"info-tint",line:"info-accent"},Gt={normal:"border-control",high:"info-accent"},Nn=["normal","high"],kn=[1,2,3,4],A=S.space["space-2"],Ln="fg",Sn="fg-secondary",Vt=e=>{let t=Pn(qt);if(t===null)throw new Error(`${e} must be rendered inside Figure`);return t},Ge=(e,t,r)=>{if(!(Number.isFinite(r)&&r>0&&r%4===0))throw new RangeError(`${e}: ${t} must be a positive multiple of the ${4} px lattice: ${r}`)},Mn=e=>{g();let t=_t(),{kind:r,widthPx:n,heightPx:a,testId:o,dataAttributes:i,children:d}=e;Ge(o,"widthPx",n),Ge(o,"heightPx",a);let s=Cn(()=>({kind:r,widthPx:n,heightPx:a,arrowIds:{normal:`${t}-arrow-normal`,high:`${t}-arrow-high`}}),[r,n,a,t]),l=me(Wt,{children:[C("defs",{children:Nn.map(y=>C("marker",{id:s.arrowIds[y],viewBox:`0 0 ${A} ${A}`,refX:A,refY:A/2,markerWidth:A,markerHeight:A,markerUnits:"userSpaceOnUse",orient:"auto","data-cui-emphasis":y,children:C("path",{d:`M 0 0 L ${A} ${A/2} L 0 ${A} z`,"data-cui-stroke":Gt[y],"data-testid":`${o}-arrow-${y}`})},y))}),C(qt.Provider,{value:s,children:d})]});if(e.kind==="group"){let{label:y,onEscape:f}=e;if(!D(y))throw new RangeError(`${o}: a group figure's label must hold a readable character: ${JSON.stringify(y)}`);return C("div",{className:"cui-figure-frame","data-testid":`${o}-frame`,children:C("svg",{className:"cui-figure",role:"group","aria-label":y,viewBox:`0 0 ${n} ${a}`,"data-cui-figure":"group","data-cui-surface":Ot,"data-cui-face":"sans",style:{"--cui-figure-inline":I(n),"--cui-figure-block":I(a)},onKeyDown:f===void 0?void 0:m=>B(m,f),"data-testid":o,...w(i),children:l})})}let{viewBox:p,pointer:u,svgRef:c}=e;return C("div",{className:"cui-container","data-testid":`${o}-frame`,children:C("svg",{ref:c,className:"cui-figure","aria-hidden":"true",viewBox:p===void 0?`0 0 ${n} ${a}`:p,"data-cui-figure":"decorative","data-cui-surface":Ot,"data-cui-face":"sans","data-cui-pan":u===void 0?void 0:"true","data-cui-cursor":u?.cursor,style:{"--cui-figure-inline":I(n),"--cui-figure-ratio":String(a/n)},"data-testid":o,...w(i),...u?.handlers,children:l})})},Bt=(e,t)=>{try{return t()}catch(r){throw new RangeError(`${e}: ${r.message}`,{cause:r})}},In=(e,t,r)=>{for(let n of t){let a=mt.light[n.fg],o=r.find(i=>a[i]===void 0);if(o!==void 0)throw new RangeError(`${e}: the note ${JSON.stringify(n.text)} in ${n.fg} is not in the contrast table on ${o}, a face the node takes`)}},$n=e=>{g();let t=Vt("FigureNode"),r=_t(),{x:n,y:a,shape:o,tone:i,outline:d,selected:s,name:l,title:p,press:u,testId:c,dataAttributes:y}=e,f=e.notes===void 0?[]:e.notes;if(!(Number.isFinite(n)&&Number.isFinite(a)))throw new RangeError(`${c}: a node's position must be finite: ${n}, ${a}`);if(t.kind==="group"&&u===void 0)throw new RangeError(`${c}: every node of a group figure must be pressable (pass press)`);if(t.kind==="decorative"&&u!==void 0)throw new RangeError(`${c}: a node of a decorative figure cannot be pressed (it is hidden from assistive technology)`);if(u!==void 0&&!D(u.label))throw new RangeError(`${c}: a pressable node's label must hold a readable character: ${JSON.stringify(u.label)}`);let m=s?Kt:Ut[i];In(c,f,[Ut[i].face,Kt.face]);let h,T,x;if(o.kind==="box"){if(l===null)throw new RangeError(`${c}: a box's name is drawn inside the box and sizes it, so it cannot be null (only a disc may be drawn without a name)`);let R=Bt(c,()=>at({name:l,notes:f.map(M=>M.text)}));if(Ge(c,"a box's widthPx",o.widthPx),o.widthPx<R.minWidthPx)throw new RangeError(`${c}: a box ${o.widthPx} px wide is narrower than its lines under the widest 1.4.12 spacing (${R.minWidthPx} px)`);h={width:o.widthPx,height:R.heightPx,left:n,top:a};let v=it(f.length);T=me("g",{"data-cui-surface":m.face,children:[C("rect",{className:"cui-figure-plate",width:o.widthPx,height:R.heightPx,rx:S.radius["radius-item"],"data-cui-fill":m.face,"data-cui-stroke":m.line,"data-testid":`${c}-plate`}),C("text",{className:"cui-figure-name",x:v.insetPx,y:v.namePx,fontSize:S.type.body.size,"data-cui-fg":Ln,"data-cui-figure-type":"body","data-testid":`${c}-name`,children:l}),f.map((M,ee)=>C("text",{x:v.insetPx,y:v.notesPx[ee],fontSize:S.type.caption.size,"data-cui-fg":M.fg,"data-cui-figure-type":"caption","data-testid":`${c}-note-${ee}`,children:M.text},ee))]}),x=C("rect",{className:"cui-figure-ring",x:-U,y:-U,width:o.widthPx+2*U,height:R.heightPx+2*U,rx:S.radius["radius-item"]+U,"data-cui-stroke":"focus","data-testid":`${c}-ring`})}else{let R=Bt(c,()=>st(l,o.radiusPx));h={width:2*o.radiusPx,height:2*o.radiusPx,left:n-o.radiusPx,top:a-o.radiusPx},T=me(Wt,{children:[C("g",{"data-cui-surface":m.face,children:C("circle",{className:"cui-figure-plate",r:o.radiusPx,"data-cui-fill":m.face,"data-cui-stroke":m.line,"data-testid":`${c}-plate`})}),l===null?null:C("text",{className:"cui-figure-label",x:0,y:R.extentBelowPx-S.type.caption.lineHeight/2,fontSize:S.type.caption.size,"data-cui-fg":Sn,"data-cui-figure-type":"caption","data-testid":`${c}-name`,children:l})]}),x=C("circle",{className:"cui-figure-ring",r:o.radiusPx+U,"data-cui-stroke":"focus","data-testid":`${c}-ring`})}if(u!==void 0){if(h.width<V||h.height<V)throw new RangeError(`${c}: a pressable node must be at least the ${V} px target: ${h.width} \xD7 ${h.height}`);if(h.left<W||h.top<W||h.left+h.width+W>t.widthPx||h.top+h.height+W>t.heightPx)throw new RangeError(`${c}: a pressable node must keep ${W} px to the figure's edge for its focus ring`)}let b=u===void 0?{}:{role:"button",tabIndex:0,"aria-label":u.label,"aria-describedby":u.description===void 0?void 0:r,"aria-expanded":u.expanded,"aria-controls":u.expanded?u.controls:void 0,onClick:R=>{R.currentTarget.focus(),u.onPress()},onKeyDown:R=>{R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),R.repeat||u.onPress())}};return me("g",{className:"cui-figure-node",transform:`translate(${n} ${a})`,"data-cui-tone":i,"data-cui-outline":d,"data-selected":String(s),...b,"data-testid":c,...w(y),children:[p===void 0?null:C("title",{children:p}),u?.description===void 0?null:C("desc",{id:r,"data-testid":`${c}-description`,children:u.description}),u===void 0?null:x,T]})},Fn=({d:e,emphasis:t,weight:r,arrow:n,title:a,testId:o,dataAttributes:i})=>{g();let d=Vt("FigureEdge");if(!kn.includes(r))throw new RangeError(`${o}: an edge's weight must be 1, 2, 3 or 4: ${r}`);return C("path",{className:"cui-figure-edge",d:e,markerEnd:n?`url(#${d.arrowIds[t]})`:void 0,"data-cui-stroke":Gt[t],"data-cui-weight":r,"data-cui-emphasis":t,"data-testid":o,...w(i),children:a===void 0?null:C("title",{children:a})})};import{jsx as Hn}from"react/jsx-runtime";var An={1:"h1",2:"h2",3:"h3"},Dn=({level:e,type:t,testId:r,headingRef:n,children:a})=>{g();let o=An[e];return Hn(o,{className:"cui-heading","data-cui-type":t,"data-cui-fg":"fg","data-testid":r,ref:n,tabIndex:n===void 0?void 0:-1,children:a})};import{jsx as Kn}from"react/jsx-runtime";var On={removed:"danger-tint",added:"success-tint"},Un=({kind:e,testId:t,children:r})=>{if(g(),r==="")throw new RangeError(`${t}: a changed fragment must hold at least one character`);return Kn(e==="removed"?"del":"ins",{className:"cui-change","data-cui-change":e,"data-cui-surface":On[e],"data-cui-fg":"fg","data-testid":t,children:r})};import{jsx as qn}from"react/jsx-runtime";var Bn={neutral:{fg:"fg-secondary",surface:"sunken"},info:{fg:"info-fg",surface:"info-tint"},success:{fg:"success-fg",surface:"success-tint"},warning:{fg:"warning-fg",surface:"warning-tint"},danger:{fg:"danger-fg",surface:"danger-tint"}},_n={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},Ve=({tone:e,variant:t,testId:r,dataAttributes:n,children:a})=>{g();let o=t==="tint"?Bn[e]:{fg:"on-solid",surface:_n[e]};return qn("span",{className:"cui-pill","data-cui-tone":e,"data-cui-variant":t,"data-cui-fg":o.fg,"data-cui-surface":o.surface,"data-cui-type":"caption","data-testid":r,...w(n),children:a})};import{useId as Gn}from"react";import{jsx as ie,jsxs as Vn}from"react/jsx-runtime";var We=({label:e,valueText:t,value:r,max:n,testId:a})=>{g();let o=Gn();if(n!==null){if(!(Number.isFinite(n)&&n>0))throw new RangeError(`Progress maximum must be positive: ${n}`);if(r===null||!(Number.isFinite(r)&&r>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${r}`)}let i=n===null?null:{max:n,now:Math.min(r,n)};return Vn("div",{className:"cui-progress","data-testid":a,children:[ie(P,{as:"p",fg:"fg",type:"body",id:o,children:e}),ie("div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":o,"aria-valuetext":t,"aria-valuemin":i===null?void 0:0,"aria-valuemax":i?.max,"aria-valuenow":i?.now,"data-cui-surface":"sunken","data-cui-indeterminate":i===null,"data-testid":`${a}-bar`,children:ie("div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:i===null?void 0:{inlineSize:`${i.now/i.max*100}%`},"data-testid":`${a}-fill`})}),ie("div",{"aria-hidden":"true",children:ie(P,{as:"p",fg:"fg-secondary",type:"body",testId:`${a}-value`,children:t})})]})};import{jsx as ge,jsxs as zt}from"react/jsx-runtime";var Wn=({title:e,status:t,progress:r,cancel:n,testId:a,children:o})=>zt(He,{title:e,actions:n===void 0?void 0:ge(F,{variant:"secondary",busy:n.busy,busyLabel:n.busyLabel,onClick:n.onCancel,testId:`${a}-cancel`,children:n.label}),testId:a,children:[zt("div",{className:"cui-job-status",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${a}-status`,children:[ge("span",{className:"cui-visually-hidden",children:`${e} `}),ge(Ve,{tone:t.tone,variant:"tint",testId:`${a}-status-pill`,children:t.label})]}),r===void 0?null:ge(We,{...r,testId:`${a}-progress`}),o]});import{createContext as zn,useContext as Jn}from"react";import{jsx as se}from"react/jsx-runtime";var ze=zn(null),Xn="space-2",jn=e=>{g();let{gap:t,label:r,id:n,hidden:a,testId:o,children:i}=e;if(r!==void 0&&!D(r))throw new RangeError(`${o}: a list's label must hold a readable character: ${JSON.stringify(r)}`);let d=e.marker==="none"?void 0:e.type,s=d!==void 0,l=e.marker==="number"||e.marker==="none"&&e.ordered?"ol":"ul";return se(ze.Provider,{value:e.marker,children:se(l,{className:"cui-list",role:"list","aria-label":r,id:n,hidden:a,"data-cui-gap":s?void 0:t,"data-cui-row-gap":s?t:void 0,"data-cui-column-gap":s?Xn:void 0,"data-cui-marker":s?e.marker:void 0,"data-cui-type":d,"data-testid":o,children:i})})},Yn=({testId:e,dataAttributes:t,children:r})=>{g();let n=Jn(ze);if(n===null)throw new Error("ListItem must be rendered inside List, not inside another ListItem");return se("li",{className:"cui-list-item","data-testid":e,...w(t),children:se("div",{className:"cui-list-body","data-cui-measure":n==="none"?void 0:"reading",children:se(ze.Provider,{value:null,children:r})})})};import{useCallback as Xt,useLayoutEffect as Qn,useRef as be}from"react";import{jsx as Jt}from"react/jsx-runtime";var Zn=({tone:e,testId:t,children:r})=>(g(),Jt("div",{className:"cui-notice","data-cui-tone":e,"data-cui-surface":e==="info"?"info-tint":"warning-tint","data-cui-fg":"fg","data-cui-type":"prose","data-cui-measure":"reading","data-testid":t,children:r})),de=({occurrence:e,testId:t,children:r})=>(g(),Jt("div",{className:"cui-alert",role:"alert","data-cui-surface":"danger-tint","data-cui-fg":"danger-fg","data-cui-type":"prose","data-cui-measure":"reading","data-cui-occurrence":e,"data-testid":t,children:r},e));import{jsx as he,jsxs as no}from"react/jsx-runtime";var jt=e=>[...e.querySelectorAll(ne)].filter(t=>{let r=t.closest(Oe);return r===null||!e.contains(r)}),eo=e=>{let t=e.ref.current;if(t===null)throw new Error("LoadMore: rows.ref is not attached to the element holding the rows");let r=jt(t);if(r.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${r.length} ${ne} elements for ${e.count} rows`);return r},to=(e,t)=>{let r=-1;return e.forEach((n,a)=>{t.has(n)&&(r=a)}),e[r+1]},ro=({onLoad:e,busy:t,done:r,failure:n,limit:a,rows:o,testId:i})=>{let{formatLocale:d,labels:s}=k(),l=be(null),p=be(null),u=be(null),c=be(!1),y=()=>{let T=o.ref.current;l.current={shown:new Set(T===null?[]:jt(T)),failureOccurrence:n===null?null:n.occurrence,busySeen:!1},e()};Qn(()=>{let T=c.current;c.current=!1;let x=l.current;if(x===null)return;let b=eo(o);if(t){x.busySeen=!0,x.shown=new Set(b);return}let R=to(b,x.shown),v=n!==null&&n.occurrence!==x.failureOccurrence;if(!(x.busySeen||R!==void 0||v||r)||(l.current=null,v||R===void 0))return;let M=[null,document.body].includes(document.activeElement);(u.current!==null&&document.activeElement===u.current||T&&M)&&R.focus()});let f=oe(()=>r?p.current:u.current),m=Xt((T=>{u.current=T;let x=f(T);return()=>{u.current=null,c.current=T===document.activeElement,x()}}),[f]),h=Xt((T=>{p.current=T;let x=f(T);return()=>{p.current=null,x()}}),[f]);return r?he("div",{className:"cui-load-more","data-testid":i,children:he(P,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:h,testId:`${i}-end`,children:s.endOfRecords})}):no("div",{className:"cui-load-more","data-testid":i,children:[he(F,{variant:"secondary",busy:t,busyLabel:s.loading,onClick:y,ref:m,testId:`${i}-button`,children:s.loadMore(ue(a,d))}),n===null?null:he(de,{occurrence:n.occurrence,testId:`${i}-failure`,children:s.loadFailed(n.reason)})]})};import{jsx as Je,jsxs as Yt}from"react/jsx-runtime";var oo=({master:e,detail:t,masterMinPx:r,detailMinPx:n,testId:a})=>{g();let o=dt({masterMinPx:r,detailMinPx:n,gapPx:S.space["space-6"]});return Yt("div",{className:"cui-container","data-testid":a,children:[Je(J,{ruleKey:o.key,css:o.css}),Yt("div",{className:"cui-master-detail","data-cui-master-detail":o.key,children:[Je("div",{className:"cui-master-detail-pane","data-testid":`${a}-master`,children:e}),Je("div",{className:"cui-master-detail-pane","data-testid":`${a}-detail`,children:t})]})]})};import{jsx as Re}from"react/jsx-runtime";var Te=e=>{let{formatLocale:t,labels:r}=k(),{testId:n}=e;if(e.keep===void 0){let{value:i,unit:d}=e;if(d!==void 0&&!D(d))throw new RangeError(`${n}: a unit must hold a readable character: ${JSON.stringify(d)}`);if(i===null)return Re("span",{className:"cui-measured","data-measured":"false","data-testid":n,children:r.unmeasured});let s=ue(i,t);return Re("span",{className:"cui-measured","data-measured":"true","data-testid":n,children:tt(s,d)})}let{text:a,keep:o}=e;if(a===null)return Re("span",{className:"cui-measured","data-measured":"false","data-cui-keep":o,"data-testid":n,children:r.unmeasured});if(!D(a))throw new RangeError(`${n}: a measured text must hold a readable character (pass null when the value was not measured): ${JSON.stringify(a)}`);return Re("span",{className:"cui-measured","data-measured":"true","data-cui-keep":o,"data-testid":n,children:a})};import{jsx as xe,jsxs as io}from"react/jsx-runtime";var ao=({label:e,value:t,min:r,max:n,valueText:a,testId:o})=>{if(g(),!(Number.isFinite(r)&&Number.isFinite(n)&&r<n))throw new RangeError(`Meter needs a finite range with min below max: min ${r}, max ${n}`);if(!(Number.isFinite(t)&&t>=r&&t<=n))throw new RangeError(`Meter value must be a finite number in its range: value ${t}, min ${r}, max ${n}`);return io("span",{className:"cui-meter","data-testid":o,children:[xe("span",{className:"cui-meter-track",role:"meter","aria-label":e,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":t,"aria-valuetext":a,"data-cui-surface":"sunken","data-testid":`${o}-bar`,children:xe("span",{className:"cui-meter-fill","data-cui-accent":"info-accent",style:{inlineSize:`${(t-r)/(n-r)*100}%`},"data-testid":`${o}-fill`})}),xe("span",{"aria-hidden":"true",children:xe(P,{fg:"fg",type:"body",testId:`${o}-value`,children:a})})]})};import{useId as so,useRef as lo}from"react";import{jsx as Xe,jsxs as po}from"react/jsx-runtime";var uo={ArrowLeft:-1,ArrowRight:1},co=({label:e,items:t,value:r,onValueChange:n,testId:a,panelDescribedBy:o,children:i})=>{g();let d=so(),s=lo(new Map);if(t.length===0)throw new RangeError("PanelTabs needs at least one tab");let l=t.map(m=>m.id);if(new Set(l).size!==l.length)throw new RangeError(`Tab keys must be unique: ${l.join(", ")}`);let p=l.indexOf(r);if(p<0)throw new RangeError(`The selected tab "${r}" is not one of the tabs: ${l.join(", ")}`);let u=m=>`${d}-tab-${m}`,c=`${d}-panel`,y=m=>{let h=t[m];h.id!==r&&n(h.id),s.current.get(h.id)?.focus()};return po("div",{className:"cui-panel-tabs","data-testid":a,children:[Xe("div",{className:"cui-tabs-list",role:"tablist","aria-label":e,onKeyDown:m=>{let h=t.findIndex(R=>s.current.get(R.id)===m.target),T=h<0?p:h,x=uo[m.key],b;if(x!==void 0){let R=getComputedStyle(m.currentTarget).direction==="rtl"?-x:x;b=(T+R+t.length)%t.length}else if(m.key==="Home")b=0;else if(m.key==="End")b=t.length-1;else return;m.preventDefault(),y(b)},children:t.map((m,h)=>{let T=h===p;return Xe("button",{className:"cui-tab cui-panel-tab",type:"button",role:"tab",id:u(h),"aria-selected":T,"aria-controls":c,tabIndex:T?0:-1,"data-cui-fg":T?"fg":"fg-secondary","data-cui-type":"body","data-testid":`${a}-${m.id}`,ref:x=>{x===null?s.current.delete(m.id):s.current.set(m.id,x)},onClick:()=>y(h),children:m.label},m.id)})}),Xe("div",{role:"tabpanel",id:c,"aria-labelledby":u(p),"aria-describedby":o,"data-testid":`${a}-panel`,children:i})]})};import{jsx as Zt,jsxs as fo}from"react/jsx-runtime";var yo=({failure:e,onReload:t,forbiddenMessage:r,failureMessage:n,rescueRef:a,testId:o})=>{let{labels:i}=k();return fo("div",{className:"cui-resource-failed","data-testid":o,children:[Zt(de,{occurrence:e.occurrence,testId:`${o}-alert`,children:i.failureSentence(e,r,n===void 0?i.loadFailed:n)}),e.status===403?null:Zt(F,{variant:"secondary",busy:e.retrying,busyLabel:i.loading,onClick:t,ref:a,testId:`${o}-reload`,children:i.reload})]})};import{jsx as je,jsxs as go}from"react/jsx-runtime";var mo=({label:e,options:t,value:r,onValueChange:n,testId:a})=>{g();let o=new Set(t.map(i=>i.value));if(t.length<2||o.size!==t.length)throw new RangeError(`A segmented control needs at least two options with unique values: ${t.map(i=>i.value).join(", ")}`);if(!o.has(r))throw new RangeError(`The pressed value "${r}" is not one of the options: ${[...o].join(", ")}`);return go("fieldset",{className:"cui-segmented-group","data-testid":a,children:[je("legend",{className:"cui-segmented-legend","data-cui-type":"body",children:e}),je("div",{className:"cui-segmented",children:t.map(i=>{let d=i.value===r;return je("button",{className:"cui-segment",type:"button","aria-pressed":d,"data-cui-fg":d?"on-solid":"fg","data-cui-surface":d?"info-solid":void 0,"data-cui-type":"body","data-testid":`${a}-${i.value}`,onClick:()=>{d||n(i.value)},children:i.label},i.value)})})]})};import{useCallback as bo,useRef as ho}from"react";import{jsx as Z}from"react/jsx-runtime";var Qt=({selected:e,controls:t,onSelect:r,testId:n,dataAttributes:a,ref:o,children:i})=>{g();let d=ho(null);H(d,{testId:n,part:"row",host:"button"});let s=bo(l=>{if(d.current=l,typeof o=="function")return o(l);o!=null&&(o.current=l)},[o]);return Z("button",{className:"cui-row-button",type:"button","data-selected":e,"aria-expanded":e,"aria-controls":t,"data-cui-row-focus":"","data-cui-surface":e?"info-tint":"surface","data-cui-fg":"fg","data-cui-type":"body","data-testid":n,onClick:r,ref:s,...w(a),children:i})},Ro=({label:e,items:t,itemKey:r,selectedKey:n,onSelect:a,detailId:o,renderRow:i,rowTestId:d,rowData:s,empty:l,testId:p,ref:u})=>(g(),Z("div",{className:"cui-selectable","data-testid":p,ref:u,children:t.length===0?Z(P,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:l}):Z("ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let y=r(c);return Z("li",{children:Z(Qt,{selected:y===n,controls:o,onSelect:()=>a(c),testId:d,dataAttributes:s?.(c),children:i(c)})},y)})})}));import{useId as To}from"react";import{jsx as ve,jsxs as er}from"react/jsx-runtime";var xo=({label:e,value:t,min:r,max:n,step:a,valueText:o,onValueChange:i,testId:d})=>{g();let s=To();if(!([t,r,n,a].every(Number.isFinite)&&r<n&&a>0&&r<=t&&t<=n))throw new RangeError(`Slider needs finite min < max, a positive step and min <= value <= max: value ${t}, min ${r}, max ${n}, step ${a}`);let l=o(t);return er("div",{className:"cui-field","data-testid":`${d}-field`,children:[ve("label",{className:"cui-field-label",htmlFor:s,"data-cui-type":"body",children:e}),er("div",{className:"cui-slider",children:[ve("input",{className:"cui-slider-input",id:s,type:"range",min:r,max:n,step:a,value:t,"aria-valuetext":l,"data-testid":d,onChange:p=>i(p.currentTarget.valueAsNumber)}),ve("span",{className:"cui-slider-value","aria-hidden":"true",children:ve(P,{fg:"fg",type:"body",testId:`${d}-value`,children:l})})]})]})};import{jsx as tr}from"react/jsx-runtime";var vo=({gap:e,testId:t,children:r})=>(g(),tr("div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:r})),Eo=({gap:e,as:t="div",testId:r,children:n})=>(g(),tr(t,{className:"cui-cluster","data-cui-gap":e,"data-testid":r,children:n}));import{jsx as Ye,jsxs as nr}from"react/jsx-runtime";var rr={done:0,current:1,pending:2},wo={done:{fg:"on-solid",surface:"success-solid"},current:{fg:"on-solid",surface:"info-solid"},pending:{fg:"fg-secondary",surface:void 0}},Po=({label:e,steps:t,testId:r})=>{let{labels:n}=k();if(t.length===0||new Set(t.map(o=>o.id)).size!==t.length)throw new RangeError(`A stepper needs at least one step with unique keys: ${t.map(o=>o.id).join(", ")}`);if(t.filter(o=>o.state==="current").length>1||t.some((o,i)=>i>0&&rr[o.state]<rr[t[i-1].state]))throw new RangeError(`Step states must run done, at most one current, then pending: ${t.map(o=>o.state).join(", ")}`);let a={done:n.stepDone,current:null,pending:n.stepPending};return Ye("ol",{className:"cui-stepper",role:"list","aria-label":e,"data-cui-type":"body","data-testid":r,children:t.map((o,i)=>{let d=wo[o.state],s=a[o.state];return nr("li",{className:"cui-step","aria-current":o.state==="current"?"step":void 0,"data-cui-step":o.state,"data-testid":`${r}-${o.id}`,children:[Ye("span",{className:"cui-step-marker","aria-hidden":"true","data-cui-fg":d.fg,"data-cui-surface":d.surface,"data-cui-type":"caption",children:o.state==="done"?"\u2713":i+1}),nr("span",{className:"cui-step-label","data-cui-fg":"fg",children:[o.label,s===null?null:Ye("span",{className:"cui-visually-hidden",children:` (${s})`})]})]},o.id)})})};import{useId as Co,useRef as No}from"react";import{jsx as Ee,jsxs as or}from"react/jsx-runtime";var ko=({label:e,labelHidden:t,checked:r,onCheckedChange:n,unavailable:a,testId:o,ref:i,dataAttributes:d})=>{g();let s=Co(),l=No(null);H(l,{testId:o,part:"label",host:"button"});let p=z(a,s),u=a!==void 0,c=or("button",{className:"cui-switch",type:"button",role:"switch","aria-checked":r,"aria-disabled":u?!0:void 0,"aria-describedby":K(p),"data-cui-fg":"fg","data-cui-type":"body","data-testid":o,ref:i,onClick:()=>{u||n(!r)},...w(d),children:[Ee("span",{className:"cui-switch-track","aria-hidden":"true","data-cui-surface":r?"info-solid":"sunken","data-testid":`${o}-track`,children:Ee("span",{className:"cui-switch-thumb","data-cui-surface":r?"surface":"neutral-solid","data-testid":`${o}-thumb`})}),Ee("span",{className:t===!0?"cui-visually-hidden":void 0,ref:l,children:e})]});return a?.reason===void 0?c:or("span",{className:"cui-button-group",children:[c,Ee(P,{fg:"fg-muted",type:"body",id:s,testId:`${o}-reason`,children:a.reason})]})};import{useCallback as Lo,useEffect as So,useId as Mo,useRef as ar,useState as Io}from"react";import{jsx as le,jsxs as ir}from"react/jsx-runtime";var $o=({label:e,items:t,currentId:r,onNavigate:n,testId:a,collapsible:o=!1})=>{if(g(),t.length===0)throw new RangeError("Tabs needs at least one tab");let i=new Set(t.map(f=>f.id));if(i.size!==t.length)throw new RangeError(`Tab keys must be unique: ${t.map(f=>f.id).join(", ")}`);let d=t.find(f=>f.id===r);if(d===void 0)throw new RangeError(`The current tab "${r}" is not one of the tabs: ${[...i].join(", ")}`);let[s,l]=Io(!1),p=ar(null),u=ar(null),c=Mo(),y=Lo(f=>{l(!1),f&&p.current?.contains(document.activeElement)&&u.current?.focus()},[]);return So(()=>{if(!(o&&s))return;let f=m=>{p.current!==null&&!p.current.contains(m.target)&&y(!0)};return document.addEventListener("pointerdown",f,!0),()=>document.removeEventListener("pointerdown",f,!0)},[o,s,y]),ir("nav",{ref:p,className:"cui-tabs","aria-label":e,"data-testid":a,"data-cui-collapsible":o?"":void 0,"data-cui-open":o&&s?"":void 0,onKeyDown:o&&s?f=>B(f,()=>y(!0)):void 0,children:[o?ir("button",{ref:u,type:"button",className:"cui-tabs-summary","aria-expanded":s,"aria-controls":c,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${a}-summary`,onClick:()=>l(f=>!f),children:[le("span",{className:"cui-tabs-summary-label",children:d.label}),le("span",{className:"cui-tabs-summary-marker","aria-hidden":"true",children:s?"\u25B4":"\u25BE"})]}):null,le("ul",{className:"cui-tabs-list",id:c,role:"list","data-cui-surface":o?"surface":void 0,children:t.map(f=>{let m=f.id===r;return le("li",{className:"cui-tabs-item",children:le("a",{className:"cui-tab",href:f.href,"aria-current":m?"page":void 0,"data-cui-fg":m?"fg":"fg-secondary","data-cui-type":"body","data-testid":`${a}-${f.id}`,onClick:h=>{pe(h,f.href,n),h.defaultPrevented&&y(!1)},children:f.label})},f.id)})})]})};import{Children as Fo,Fragment as Ao,isValidElement as Do}from"react";import{jsx as G,jsxs as dr}from"react/jsx-runtime";var Ho={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},Oo=e=>{g();let{label:t,sublabel:r,tone:n,testId:a,dataAttributes:o}=e;if((e.text===void 0?e.value===null:e.text===null)&&n!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${n}`);let d=`${a}-value`;return dr("div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":n,"data-testid":a,...w(o),children:[G("p",{className:"cui-tile-label","data-cui-type":"caption","data-cui-measure":"reading",children:t}),G("p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption","data-cui-measure":"reading",children:r}),G("p",{className:"cui-tile-value","data-cui-fg":Ho[n],"data-cui-type":"heading","data-cui-measure":"reading",children:e.text===void 0?G(Te,{value:e.value,unit:e.unit,testId:d}):G(Te,{text:e.text,keep:"wrap",testId:d})})]})},sr=e=>Fo.toArray(e).flatMap(t=>{if(!Do(t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===Ao?sr(t.props.children):[t]}),Uo=({count:e,minInlinePx:t,testId:r,children:n})=>{g();let a=ut(e,t,S.space["space-2"]),o=sr(n).length;if(o!==e)throw new RangeError(`TileGrid has ${o} tiles but count is ${e}`);return dr("div",{className:"cui-container","data-testid":r,children:[G(J,{ruleKey:a.key,css:a.css}),G("div",{className:"cui-tile-grid","data-cui-tile-grid":a.key,"data-cui-gap":"space-2",children:n})]})};import{useLayoutEffect as Ko,useRef as lr}from"react";import{jsx as _o}from"react/jsx-runtime";var we=e=>[...e.querySelectorAll("button")],Bo=({label:e,testId:t,children:r})=>{g();let n=lr(null),a=lr(null);Ko(()=>{let s=we(n.current),l=a.current!==null&&s.includes(a.current)?a.current:s[0]??null;a.current=l;for(let p of s)p.tabIndex=p===l?0:-1});let o=s=>{for(let l of we(n.current))l.tabIndex=l===s?0:-1;a.current=s};return _o("div",{className:"cui-toolbar",role:"toolbar","aria-label":e,"aria-orientation":"horizontal","data-testid":t,ref:n,onFocus:s=>{let l=we(s.currentTarget).find(p=>p.contains(s.target));l!==void 0&&o(l)},onKeyDown:s=>{let l=we(s.currentTarget),p=l.indexOf(s.target);if(p===-1)return;let u=getComputedStyle(s.currentTarget).direction==="rtl"?"ArrowLeft":"ArrowRight",c=u==="ArrowRight"?"ArrowLeft":"ArrowRight",f={[u]:(p+1)%l.length,[c]:(p-1+l.length)%l.length,Home:0,End:l.length-1}[s.key];if(f===void 0)return;s.preventDefault();let m=l[f];o(m),m.focus()},children:r})};import{useCallback as Q,useEffect as Vo,useLayoutEffect as cr,useRef as et}from"react";import{useCallback as Pe,useEffect as qo,useLayoutEffect as Go,useRef as Ze,useState as Qe}from"react";var ur=e=>e===null?Ne:ke,Ce=(e,t,r,n,a)=>{let[o,i]=Qe(()=>({key:e,state:ur(e)})),[d,s]=Qe(0),[l,p]=Qe(0),u=Ze(t),c=Ze(null),y=Ze(d);Go(()=>{u.current=t}),qo(()=>{if(e===null){i({key:null,state:Ne});return}let b=new AbortController;c.current=e;let R=d===y.current?"revision":"reload";return y.current=d,i(v=>Object.is(v.key,e)?{key:e,state:n(v.state,R)}:{key:e,state:ke}),u.current(b.signal).then(v=>{b.signal.aborted||(c.current=null,i(M=>({key:e,state:a(M.state,v)})))},v=>{b.signal.aborted||i(()=>{throw v})}),()=>{b.abort(),c.current=null}},[e,r,d,l]);let f=Pe(()=>s(b=>b+1),[]),m=Pe(()=>p(b=>b+1),[]),h=Pe((b,R)=>{i(v=>Object.is(v.key,b)?{key:b,state:R(v.state)}:v)},[]),T=Pe((b,R)=>{h(b,R),Object.is(c.current,b)&&m()},[h,m]);return{state:Object.is(o.key,e)?o.state:ur(e),reload:f,refresh:m,update:h,write:T}};var Wo=(e,t,r)=>{let n=et(t);cr(()=>{n.current=t});let a=Q(T=>n.current.first(T),[]),{state:o,reload:i,refresh:d,update:s,write:l}=Ce(e,a,r,ct,pt),p=et({key:e,state:o});cr(()=>{p.current={key:e,state:o}});let u=et(null),c=Q(()=>{u.current?.controller.abort(),u.current=null},[]);Vo(()=>c,[e,r,c]);let y=Q(()=>{c(),i()},[c,i]),f=Q(()=>{c(),d()},[c,d]),m=Q(()=>{let{key:T,state:x}=p.current;if(T===null||x.kind!=="ready"||x.refreshing||x.value.next===null||x.value.loadingMore)throw new Error("usePagedResource: loadMore needs a shown list with a next cursor, no page in flight and no re-read in flight");let b=x.value.next,R={key:T,controller:new AbortController,maps:[]};u.current=R,s(T,yt),n.current.next(b,R.controller.signal).then(v=>{u.current===R&&(u.current=null,s(T,M=>R.maps.reduce((ee,pr)=>Me(ee,pr),ft(M,b,v))))},v=>{u.current===R&&s(T,()=>{throw v})})},[s]),h=Q((T,x)=>{let b=u.current;b!==null&&Object.is(b.key,T)&&b.maps.push(x),l(T,R=>Me(R,x))},[l]);return{state:o,reload:y,refresh:f,loadMore:m,updateList:h}};import{useCallback as zo,useRef as Jo,useState as Xo}from"react";var jo=e=>typeof e=="object"&&e!==null&&typeof e.then=="function",Yo=()=>{let[e,t]=Xo(null),r=Jo(null),n=zo((a,o)=>{let i=o();if(!jo(i))return;let d=Symbol(a);r.current=d,t(a);let s=()=>{r.current===d&&(r.current=null,t(null))};i.then(s,s)},[]);return{pendingKey:e,press:n}};import{useCallback as Zo}from"react";var Qo=(e,t,r)=>{let{state:n,reload:a,refresh:o,write:i}=Ce(e,t,r,rt,Le),d=Zo((s,l)=>i(s,p=>Le(p,{ok:!0,value:l})),[i]);return{state:n,reload:a,refresh:o,put:d}};import{jsx as ta}from"react/jsx-runtime";var ea=({testId:e,children:t})=>(g(),ta("span",{className:"cui-visually-hidden","data-testid":e,children:t}));export{ce as ANNOUNCE_SETTLE_MS,de as AlertMessage,Pr as Breadcrumb,F as Button,ot as COMPACT_ROW_PX,ya as CONSOLE_UI_LABEL_CATALOGS,$a as CONTRAST_MINIMUM,mt as CONTRAST_PAIRS,He as Card,qr as CardSection,vn as CheckboxGroup,Eo as Cluster,Vr as CodeBlock,Jr as ComparisonGrid,vr as ConsoleUiRoot,ln as DataTable,un as DescriptionList,pn as Dialog,mn as Disclosure,W as FIGURE_RING_REACH_PX,va as FLEXIBLE_COLUMN_MIN_PX,gn as Field,Mn as Figure,Fn as FigureEdge,$n as FigureNode,Dr as FragmentLink,yr as HTTP_FORBIDDEN,Dn as Heading,Un as InlineChange,Wn as JobCard,Se as LATTICE_PX,Fr as Link,jn as List,Yn as ListItem,ro as LoadMore,oo as MasterDetail,Te as Measured,ao as Meter,Oo as MetricTile,Zn as Notice,co as PanelTabs,hn as PasswordInput,Ve as Pill,We as ProgressBar,ma as ROW_WITH_CONTROL_PX,xn as RadioGroup,yo as ResourceFailed,Qt as RowButton,mo as SegmentedControl,Tn as Select,Ro as SelectableList,xo as Slider,vo as Stack,Po as Stepper,ko as Switch,V as TARGET_PX,S as TOKENS,Oa as TONES,Da as TONE_HUES,Ha as TONE_ROLES,$o as Tabs,P as Text,Rn as TextArea,bn as TextInput,Uo as TileGrid,Bo as Toolbar,ea as VisuallyHidden,aa as ZonedTimeError,yt as beginPage,ct as beginPagedReload,rt as beginReload,Ra as ceil8,fa as ceilToLattice,Ta as cellContentInlinePx,Ea as comparisonAttributePx,Ia as contrastRatio,Pa as countSampleText,ga as cssVar,at as figureBoxPlan,st as figureDiscLabelPlan,la as fillLabel,xa as fixedColumnPx,ca as flatMapOutcome,ra as formatByteSize,ue as formatCount,da as formatInstant,ka as goldenSectionPx,Ma as hexToSrgb,wa as instantSampleText,D as isReadableText,Le as keepLastGood,Fa as lightDark,ua as mapOutcome,Me as mapPagedList,La as masterDetailPlan,ha as monoTextWidthEm,Aa as placeholderRule,I as pxToRem,na as readDecimalText,oa as readIntegerText,pa as reasonAside,nt as resolveConsoleUiLabels,pt as settleFirstPage,ft as settlePage,Na as spacedTextWidthEm,Sa as tableFrameMinInlinePx,lt as tableMinInlinePx,ba as textWidthEm,ut as tileGridPlan,Ca as tileMinInlinePx,ia as toOffsetIso,sa as toWallTime,Er as useAnnounce,k as useConsoleUi,Br as useEscapeToClose,oe as useFocusRescue,Wo as usePagedResource,Yo as usePendingPress,Qo as useResource};
|
|
1
|
+
import{$ as xt,A as Ua,B as Ba,C as _a,D as qa,E as Ga,F as Va,G as yt,H as ft,I as mt,J as z,K as U,L as Wa,M as F,N as za,O as gt,P as bt,Q as Ja,R as ht,S as Xa,T as ja,U as Ya,V as Me,W as Ie,X as Rt,Y as Fe,Z as Tt,_ as Et,a as ue,aa as vt,b as xa,ba as $e,c as ut,ca as ti,d as va,da as ni,e as wa,ea as ri,f as D,fa as oi,g as Pa,ga as ai,h as Na,i as Ca,j as ka,k as La,l as Sa,m as Ma,n as ct,o as Se,p as Ia,q as W,r as Fa,s as pt,t as M,u as $a,v as Aa,w as Da,x as Ha,y as Oa,z as Ka}from"./chunk-H4DAGEIG.js";import{a as Za,b as Qa,c as ei,d as wt}from"./chunk-FXEGLGL7.js";import{useEffect as Jn,useRef as Xn}from"react";import{useId as Un,useRef as Bn}from"react";import{createContext as wn,useCallback as Pn,useContext as St,useLayoutEffect as Nn,useMemo as Pt,useRef as Nt}from"react";import{jsx as Lt,jsxs as $n}from"react/jsx-runtime";var Ae=wn(null),Mt=" ",Ct='[inert], [aria-hidden="true" i]',It="dialog:modal",De="data-cui-dialog-announcer",Cn=`:scope > [${De}]`,kn=e=>{if(e.closest(Ct)!==null)return{hidden:'an ancestor is inert or aria-hidden="true"'};let t=e.ownerDocument,n=[...t.querySelectorAll(It)],o=t.activeElement,a=n.filter(s=>s.contains(o)),r=a.length>0?a:n;if(r.every(s=>s.contains(e)))return{region:e};let i=r.find(s=>r.every(u=>u.contains(s)));if(i===void 0)return{hidden:"focus is in no open modal dialog and they do not nest, so which one is topmost cannot be told"};let d=i.querySelector(Cn);return d===null?{hidden:"the topmost open modal dialog neither contains the console nor is a Dialog"}:d.closest(Ct)!==null?{hidden:'the topmost open modal dialog is a Dialog whose live region has an inert or aria-hidden="true" ancestor'}:{region:d}},Ln=e=>{try{e.querySelectorAll(It)}catch(t){throw typeof t=="object"&&t!==null&&"name"in t&&t.name==="SyntaxError"?new Error("ConsoleUiRoot requires the :modal selector (Chrome 105, Firefox 103, Safari 15.6, jsdom 27 or later): announcements check whether a modal dialog hides the live region",{cause:t}):t}},ce=150,Sn=1e3,kt=new WeakMap,Mn=(e,t)=>{let n=kt.get(e)??new Set,o={text:t};kt.set(e,n.add(o)),setTimeout(()=>n.delete(o),ce);let a=e.ownerDocument.createElement("span");a.textContent=[...n].map(r=>r.text).join(Mt),e.replaceChildren(a)},In=({locale:e,formatLocale:t,timeZone:n,accessFailure:o,testId:a,children:r})=>{if(St(Ae)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");if(typeof o!="function")throw new TypeError("ConsoleUiRoot: accessFailure must be the host's presenter of access failures (a function)");let d=ct(e),[s]=Intl.getCanonicalLocales(t),u=Pt(()=>new Intl.DateTimeFormat(s,{timeZone:n}).resolvedOptions().timeZone,[s,n]),p=Nt(null),l=Nt(null);Nn(()=>{Ln(p.current.ownerDocument)},[]);let c=Pn(m=>{if(m.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let f=()=>{let{texts:y,settle:E,deadline:R}=l.current;l.current=null,clearTimeout(E),clearTimeout(R);let T=p.current;if(T===null)return;let x=y.join(Mt),k=kn(T);if("hidden"in k)throw new Error(`announce: the live region is hidden from assistive technology (${k.hidden}), so this announcement would be lost: ${x}`);Mn(k.region,x)},h=l.current;if(h===null){l.current={texts:[m],settle:setTimeout(f,ce),deadline:setTimeout(f,Sn)};return}h.texts.push(m),clearTimeout(h.settle),h.settle=setTimeout(f,ce)},[]),b=Pt(()=>({locale:e,formatLocale:s,timeZone:u,labels:d,announce:c,accessFailure:o}),[e,s,u,d,c,o]);return Lt(Ae.Provider,{value:b,children:$n("div",{"data-cui-root":"","data-cui-surface":"surface","data-cui-fg":"fg","data-testid":a,children:[r,Lt("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${a}-announcer`,ref:p})]})})},C=()=>{let e=St(Ae);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},g=()=>{C()},He=()=>C().announce,Fn=()=>C().accessFailure;var w=e=>{if(e===void 0)return{};for(let t of Object.keys(e))if(!t.startsWith("data-")||t.startsWith("data-cui-")||t==="data-testid")throw new RangeError(`Caller attributes must be data-* and must not override data-cui-* or data-testid: ${t}`);return e};var pe=e=>{let t=e.currentTarget;t.ownerDocument.activeElement!==t&&t.focus({preventScroll:!0})};import{useLayoutEffect as An}from"react";var Dn=new Set(["abbr","b","bdi","bdo","br","cite","code","data","del","dfn","em","i","ins","kbd","mark","q","s","samp","small","span","strong","sub","sup","time","u","var","wbr"]),Hn=e=>{for(let t of e.querySelectorAll("*")){let n=t.localName;if(!Dn.has(n)||t.hasAttribute("tabindex")||t.hasAttribute("contenteditable"))return n}return null},H=(e,{testId:t,part:n,host:o})=>{An(()=>{let a=Hn(e.current);if(a!==null)throw new RangeError(`${t}: the ${n} is the content of a ${o} and holds only non-interactive phrasing content, not <${a}>`)})};import{jsx as On}from"react/jsx-runtime";var P=({fg:e,type:t,face:n,as:o="span",space:a,testId:r,id:i,tabIndex:d,ref:s,children:u})=>(g(),On(o,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":n,"data-cui-space":a,"data-cui-measure":o==="p"?"reading":void 0,"data-testid":r,id:i,tabIndex:d,ref:s,children:u}));var Kn=/\s/,Oe=(e,t)=>{if(e===""||Kn.test(e))throw new RangeError(`The id of ${t} must be one token without whitespace: "${e}"`);return e},J=(e,t)=>{if(e!==void 0){if(e.reason!==void 0){if(e.reason.trim()==="")throw new RangeError("An unavailable control needs a reason that is not blank");return t}return Oe(e.reasonId,"an unavailable control's reason")}},B=(...e)=>{let t=e.filter(n=>n!==void 0);return t.length===0?void 0:t.join(" ")};import{jsx as O,jsxs as Wn}from"react/jsx-runtime";var _n={primary:{fg:"on-solid",surface:"info-solid",type:"body"},secondary:{fg:"fg",surface:void 0,type:"body"},danger:{fg:"on-solid",surface:"danger-solid",type:"body"},link:{fg:"info-fg",surface:void 0,type:"body"}},Ke=({subject:e,children:t})=>{let n=Bn(null);return H(n,e),O("span",{ref:n,children:t})},I=({variant:e,children:t,testId:n,type:o="button",onClick:a,unavailable:r,describedBy:i,expanded:d,controls:s,ref:u,dataAttributes:p,busy:l,busyLabel:c})=>{g();let b=Un(),m=J(r,b),f=l===!0||r!==void 0,h=_n[e],y=E=>{if(pe(E),f){E.preventDefault();return}a?.(E)};return Wn("span",{className:"cui-button-group",children:[O("button",{className:"cui-button",type:o==="submit"?"submit":"button","data-cui-variant":e,"data-cui-fg":h.fg,"data-cui-surface":h.surface,"data-cui-type":h.type,"data-testid":n,"aria-disabled":f?!0:void 0,"aria-busy":l===!0?!0:void 0,"aria-describedby":B(i,m),"aria-expanded":d,"aria-controls":s,onClick:y,ref:u,...w(p),children:O(Ke,{subject:{testId:n,part:"label",host:"button"},children:l===!0?c:t})}),r?.reason===void 0?null:O(P,{fg:"fg-muted",type:"body",id:b,testId:`${n}-reason`,children:r.reason})]})},qn=({onNavigate:e,children:t,testId:n,ref:o})=>(g(),O("button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"body","data-testid":n,onClick:e,ref:o,children:O(Ke,{subject:{testId:n,part:"label",host:"button"},children:t})})),Gn=/^[^\s#]+$/,Vn=({targetId:e,children:t,testId:n,onFollow:o,dataAttributes:a})=>{if(g(),!Gn.test(e))throw new RangeError(`A fragment link needs the target's id without "#" or white space: "${e}"`);return O("a",{className:"cui-link",href:`#${e}`,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":n,onClick:o,...w(a),children:O(Ke,{subject:{testId:n,part:"label",host:"link"},children:t})})};import{jsx as Ft}from"react/jsx-runtime";var zn=({gap:e,testId:t,children:n})=>(g(),Ft("div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:n})),Ue=({gap:e,as:t="div",testId:n,children:o})=>(g(),Ft(t,{className:"cui-cluster","data-cui-gap":e,"data-testid":n,children:o}));import{jsx as ye,jsxs as $t}from"react/jsx-runtime";var jn=new Set(["sign-in","sign-in-again","sign-in-again-in-new-window"]),Yn=" ",Zn=({view:e,handlers:t,testId:n})=>{let o=He(),a=e.actions.map(({action:d,label:s})=>{let u=t[d];if(u===void 0)throw new TypeError(`AccessFailureNotice: no handler for the action ${JSON.stringify(d)}`);return{action:d,label:s,handler:u}}),r=e.politeness==="status"?[e.title,...e.sentences].join(Yn):null,i=Xn(null);return Jn(()=>{r===null||i.current===r||(i.current=r,o(r))},[o,r]),$t("div",{className:"cui-access-failure","data-cui-access-failure":e.kind,"data-testid":n,children:[$t("div",{className:"cui-notice cui-access-failure-message",role:e.politeness==="alert"?"alert":void 0,"data-cui-tone":"warning","data-cui-surface":"warning-tint","data-cui-fg":"fg","data-cui-type":"prose","data-cui-measure":"reading","data-testid":`${n}-message`,children:[ye("p",{className:"cui-access-failure-title","data-cui-measure":"reading","data-testid":`${n}-title`,children:e.title}),e.sentences.map(d=>ye("p",{className:"cui-access-failure-sentence","data-cui-measure":"reading",children:d},d))]}),a.length===0?null:ye(Ue,{gap:"space-2",testId:`${n}-actions`,children:a.map(({action:d,label:s,handler:u})=>ye(I,{variant:jn.has(d)?"primary":"secondary",onClick:u,testId:`${n}-${d}`,children:s},d))})]})};var fe=(e,t,n)=>{e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n(t))};import{jsx as te,jsxs as At}from"react/jsx-runtime";var Qn=({items:e,current:t,onNavigate:n,testId:o})=>{let{labels:a}=C();if(new Set(e.map(r=>r.id)).size!==e.length)throw new RangeError(`Breadcrumb keys must be unique: ${e.map(r=>r.id).join(", ")}`);return te("nav",{className:"cui-breadcrumb","aria-label":a.breadcrumb,"data-testid":o,children:At("ol",{className:"cui-breadcrumb-list",role:"list","data-cui-type":"body",children:[e.map(r=>At("li",{className:"cui-breadcrumb-item",children:[te("a",{className:"cui-link",href:r.href,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":`${o}-${r.id}`,onClick:i=>fe(i,r.href,n),children:r.label}),te("span",{className:"cui-breadcrumb-separator","aria-hidden":"true","data-cui-fg":"fg-muted",children:"\u203A"})]},r.id)),te("li",{className:"cui-breadcrumb-item",children:te("span",{"aria-current":"page","data-cui-fg":"fg","data-testid":`${o}-current`,children:t})})]})})};import{useId as Dt}from"react";import{useCallback as er}from"react";var tr=229,nr=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),me=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&nr.has(e.type)&&(e.value!==""||e.validity.badInput),Be=e=>e.nativeEvent.isComposing||e.keyCode===tr,_=(e,t)=>{e.key!=="Escape"||Be(e)||me(e.target)||(e.stopPropagation(),t())},rr=e=>er(t=>_(t,e),[e]);import{Fragment as ir,jsx as q,jsxs as ne}from"react/jsx-runtime";var Ht=e=>e===void 0?void 0:t=>_(t,e),_e=({id:e,title:t,description:n,actions:o,onEscape:a,testId:r,headingRef:i,ref:d,dataAttributes:s,children:u})=>{g();let p=Dt(),l=Ht(a);return ne("section",{className:"cui-card",id:e,"aria-labelledby":p,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":r,ref:d,onKeyDown:l,...w(s),children:[ne("div",{className:"cui-card-header",children:[ne("div",{className:"cui-card-heading",children:[q("h2",{className:"cui-card-title",id:p,"data-cui-type":"title","data-testid":`${r}-heading`,ref:i,tabIndex:i===void 0?void 0:-1,children:t}),n===void 0?null:q("div",{className:"cui-card-description","data-cui-fg":"fg-muted","data-cui-type":"body","data-cui-measure":"reading",children:n})]}),o===void 0?null:q("div",{className:"cui-card-actions",children:o})]}),u]})},or={3:"h3",4:"h4"},ar=({id:e,title:t,subtitle:n,level:o=3,region:a=!1,onEscape:r,testId:i,headingRef:d,ref:s,dataAttributes:u,children:p})=>{g();let l=Dt(),c=Ht(r),b=or[o],m=ne(ir,{children:[ne("div",{className:"cui-card-section-heading",children:[q(b,{className:"cui-card-section-title",id:l,"data-cui-type":"body","data-testid":`${i}-heading`,ref:d,tabIndex:d===void 0?void 0:-1,children:t}),n===void 0?null:q("div",{className:"cui-card-section-subtitle","data-cui-fg":"fg-muted","data-cui-type":"body","data-cui-measure":"reading",children:n})]}),p]});return a?q("section",{className:"cui-card-section",id:e,"aria-labelledby":l,"data-testid":i,ref:s,onKeyDown:c,...w(u),children:m}):q("div",{className:"cui-card-section",id:e,"data-testid":i,ref:s,...w(u),children:m})};import{jsx as Ot}from"react/jsx-runtime";var sr=({label:e,code:t,testId:n})=>(g(),Ot("section",{className:"cui-code-frame",tabIndex:0,"aria-label":e,"data-cui-surface":"sunken","data-testid":n,children:Ot("pre",{className:"cui-code","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"mono","data-testid":`${n}-code`,children:t})}));import{useId as lr}from"react";import{jsx as dr}from"react/jsx-runtime";var X=({ruleKey:e,css:t})=>dr("style",{href:e,precedence:"cui",children:t});import{jsx as L,jsxs as G}from"react/jsx-runtime";var ur=({caption:e,attributes:t,columns:n,attributePx:o,columnMinPx:a,testId:r})=>{g();let i=lr();for(let l of[o,a])if(!(Number.isFinite(l)&&l>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${l}`);if(n.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let l of n)for(let c of t)if(!Object.hasOwn(l.cells,c.key))throw new RangeError(`Column "${l.key}" has no value for attribute "${c.key}"`);let d=o+n.length*a,s=`cui-comparison-a${o}-c${a}-n${n.length}`,u=l=>`[data-cui-comparison="${s}"][data-cui-comparison-layout="${l}"]`,p=`${u("table")}{display:none}@container (min-width:${F(d)}){${u("table")}{display:block}${u("stack")}{display:none}}`;return G("div",{className:"cui-container","data-cui-stack-below-px":d,"data-testid":r,children:[L(X,{ruleKey:s,css:p}),L("div",{className:"cui-comparison-frame","data-cui-comparison":s,"data-cui-comparison-layout":"table",children:G("table",{className:"cui-comparison-table","data-cui-type":"body",children:[L("caption",{className:"cui-visually-hidden",children:e}),G("colgroup",{children:[L("col",{style:{width:F(o)}}),n.map(l=>L("col",{},l.key))]}),L("thead",{children:G("tr",{children:[L("td",{}),n.map(l=>L("th",{scope:"col",children:l.heading},l.key))]})}),L("tbody",{children:t.map(l=>G("tr",{children:[L("th",{scope:"row",children:l.label}),n.map(c=>L("td",{children:c.cells[l.key]("table")},c.key))]},l.key))})]})}),L("div",{className:"cui-comparison-stack","data-cui-comparison":s,"data-cui-comparison-layout":"stack",children:n.map((l,c)=>{let b=`${i}-column-${c}`;return G("div",{className:"cui-comparison-column",role:"group","aria-labelledby":b,"data-cui-type":"body",children:[L("div",{className:"cui-comparison-heading",id:b,children:l.heading}),L("dl",{className:"cui-comparison-list",children:t.map(m=>G("div",{children:[L("dt",{children:m.label}),L("dd",{children:l.cells[m.key]("stack")})]},m.key))})]},l.key)})})]})};import{Fragment as mr,useCallback as gr,useId as br,useLayoutEffect as Bt,useRef as We}from"react";var re="[data-cui-row-focus]",qe="[data-cui-row-detail]",cr=e=>e===null?[]:[...e.querySelectorAll(`:scope > ${re}`)],Kt=(e,t)=>{let n=new Map;t!==null&&n.set(t,0);let o=-1;for(let a of e===null?[]:e.children)a.matches(re)?(o+=1,n.set(a,o)):o>=0&&a.matches(qe)&&n.set(a,o);return n},Ut=(e,t,n,o)=>{let a=cr(t);if(a.length===0)return n;let r=o.get(e);if(r===void 0)throw new RangeError(`rowFocusTarget: <${e.localName}> left holding focus with no position in the table (only its rows, row details and empty text hold one)`);return a[Math.min(r,a.length-1)]};import{useCallback as pr,useLayoutEffect as Ge,useReducer as yr,useRef as Ve}from"react";var fr=e=>e+1,oe=e=>{let t=Ve(e),n=Ve(null),o=Ve(!1),[,a]=yr(fr,0),r=pr((i=>()=>{o.current&&i.contains(document.activeElement)&&(n.current=i,a())}),[]);return Ge(()=>(o.current=!0,()=>{o.current=!1,n.current=null}),[]),Ge(()=>{t.current=e}),Ge(()=>{let i=n.current;if(i===null)return;n.current=null;let d=[null,document.body].includes(document.activeElement);i.isConnected||!d||t.current(i)?.focus()}),r};import{jsx as S,jsxs as ge}from"react/jsx-runtime";var hr=new Map,Rr='a[href], audio[controls], button, details, embed, iframe, img[usemap], input:not([type="hidden"]), label, select, textarea, video[controls], [tabindex], [contenteditable]',Tr=(e,t,n)=>{Bt(()=>{let o=e.current;if(t!=="row-compact"||o===null)return;let a=[...o.querySelectorAll(Rr)].find(r=>r.parentElement!==o);if(a!==void 0)throw new RangeError(`${n}: a compact row holds no control or focus target (a ${W} px target does not fit its ${pt} px; use row-control), not <${a.localName}>`)})},Er=(e,t)=>{let n=e.filter(a=>a.rowHeader===!0).map(a=>a.key);if(n.length>1)throw new RangeError(`${t}: a table has at most one row header column, not ${n.length} (${n.join(", ")})`);let o=e.find(a=>a.rowHeader!==!0&&a.rowHeaderNote!==void 0);if(o!==void 0)throw new RangeError(`${t}: a row header note belongs to the row header column, not to ${o.key}`)},xr=e=>e==null?null:S("div",{className:"cui-table-header-note",children:e}),vr=(e,t,n,o,a)=>{let r=e.open(t);return S("tr",{ref:a,hidden:!r,"data-cui-row-detail":r?"open":"closed","data-testid":`${o}-detail`,children:S("td",{colSpan:n,id:e.id(t),children:r?e.render(t):null})})},wr=({caption:e,captionHidden:t,columns:n,rows:o,rowKey:a,rowTestId:r,rowData:i,rowSize:d,rowDetail:s,empty:u,testId:p,ref:l})=>{g();let c=br(),b=We(null);Tr(b,d,p);let m=We(null),f=We(hr),h=oe(R=>Ut(R,b.current,m.current,f.current));Bt(()=>{f.current=Kt(b.current,m.current)});let y=gr(R=>{m.current=R;let T=h(R);return()=>{m.current=null,T()}},[h]),E=bt(n);return Er(n,p),S("div",{className:"cui-container","data-testid":p,ref:l,children:o.length===0?S(P,{as:"p",fg:"fg-muted",type:"prose",tabIndex:-1,ref:y,testId:`${p}-empty`,children:u}):S("section",{ref:h,className:"cui-table-frame",tabIndex:0,"aria-labelledby":c,"data-testid":`${p}-frame`,children:ge("table",{className:"cui-table","data-cui-type":"body","data-cui-row-size":d,style:{"--cui-table-min":F(E)},children:[S("caption",{className:t?"cui-visually-hidden":"cui-table-caption",id:c,children:e}),S("colgroup",{children:n.map(R=>S("col",{style:R.width.fixedPx===void 0?void 0:{width:F(R.width.fixedPx)}},R.key))}),S("thead",{children:S("tr",{children:n.map(R=>ge("th",{scope:"col","data-cui-align":R.align,"data-cui-surface":"subtle","data-cui-type":"caption",children:[R.header,R.note===void 0?null:S("div",{className:"cui-table-header-note",children:R.note})]},R.key))})}),S("tbody",{ref:b,children:o.map(R=>ge(mr,{children:[S("tr",{ref:h,tabIndex:-1,"data-cui-row-focus":"","data-testid":r,...w(i?.(R)),children:n.map(T=>T.rowHeader===!0?ge("th",{scope:"row","data-cui-align":T.align,children:[T.cell(R),T.rowHeaderNote===void 0?null:xr(T.rowHeaderNote(R))]},T.key):S("td",{"data-cui-align":T.align,children:T.cell(R)},T.key))}),s===void 0?null:vr(s,R,n.length,r,h)]},a(R)))})]})})})};import{jsx as ze,jsxs as Nr}from"react/jsx-runtime";var Pr=({items:e,testId:t})=>{if(g(),new Set(e.map(n=>n.key)).size!==e.length)throw new RangeError(`Description keys must be unique: ${e.map(n=>n.key).join(", ")}`);return ze("dl",{className:"cui-description-list","data-cui-type":"body","data-testid":t,children:e.map(n=>Nr("div",{className:"cui-description-row","data-testid":`${t}-${n.key}`,children:[ze("dt",{"data-cui-fg":"fg-secondary",children:n.term}),ze("dd",{"data-cui-fg":"fg",children:n.description})]},n.key))})};import{useId as _t,useLayoutEffect as qt,useRef as Je}from"react";import{jsx as ae,jsxs as Vt}from"react/jsx-runtime";var Gt=e=>{e instanceof HTMLElement&&e.isConnected&&e.focus()},Cr=(e,t)=>{if(t===null||!e.contains(t))throw new RangeError("A dialog's initial focus must be an element inside the dialog");return t},kr=(e,t)=>{if(t.focus(),e.ownerDocument.activeElement!==t)throw e.close(),new RangeError("A dialog's initial focus must be an element that takes focus")},Lr=e=>e instanceof HTMLInputElement&&e.type==="search",Sr=({title:e,description:t,open:n,onClose:o,initialFocus:a,testId:r,children:i})=>{let{labels:d}=C(),s=_t(),u=_t(),p=Je(null),l=Je(null),c=Je(!1);return qt(()=>{let y=p.current;if(n&&!y.open){let E=a===void 0?null:Cr(y,a.current);l.current=y.ownerDocument.activeElement,y.showModal(),E!==null&&kr(y,E)}else!n&&y.open&&y.close()},[n,a]),qt(()=>{let y=p.current;return()=>{y.open&&(y.close(),Gt(l.current),l.current=null)}},[]),Vt("dialog",{className:"cui-dialog","aria-labelledby":s,"aria-describedby":t===void 0?void 0:u,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":r,ref:p,onClose:y=>{y.currentTarget.open||(Gt(l.current),l.current=null,n&&o())},onCancel:y=>{let E=c.current;c.current=!1,(E||me(y.currentTarget.ownerDocument.activeElement))&&y.preventDefault()},onKeyDownCapture:y=>{let E=Be(y);c.current=E,y.key==="Escape"&&!E&&me(y.target)&&!Lr(y.target)&&y.preventDefault()},onKeyUpCapture:()=>{c.current=!1},children:[Vt("div",{className:"cui-dialog-header",children:[ae("h2",{className:"cui-dialog-title",id:s,"data-cui-type":"title",children:e}),ae("div",{className:"cui-dialog-actions",children:ae(I,{variant:"secondary",testId:`${r}-close`,onClick:()=>p.current?.close(),children:d.close})})]}),t===void 0?null:ae("div",{id:u,"data-cui-measure":"reading","data-testid":`${r}-description`,children:t}),i,ae("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true",[De]:"","data-testid":`${r}-announcer`})]})};import{useId as Mr,useRef as Ir}from"react";import{jsx as Xe,jsxs as Wt}from"react/jsx-runtime";var Fr=({summary:e,open:t,onOpenChange:n,testId:o,children:a})=>{g();let r=Mr(),i=Ir(null);return H(i,{testId:o,part:"summary",host:"button"}),Wt("div",{className:"cui-disclosure","data-testid":o,children:[Wt("button",{className:"cui-disclosure-button",type:"button","aria-expanded":t,"aria-controls":r,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${o}-button`,onClick:()=>n(!t),children:[Xe("span",{className:"cui-disclosure-marker","aria-hidden":"true",children:t?"\u25BE":"\u25B8"}),Xe("span",{ref:i,children:e})]}),Xe("div",{className:"cui-disclosure-panel",id:r,hidden:!t,"data-testid":`${o}-panel`,children:a})]})};import{accessFailureKindOfStatus as Ar}from"@aiquants/auth-core";import{Fragment as Dr}from"react";import{jsx as zt}from"react/jsx-runtime";var $r=({tone:e,testId:t,children:n})=>(g(),zt("div",{className:"cui-notice","data-cui-tone":e,"data-cui-surface":e==="info"?"info-tint":"warning-tint","data-cui-fg":"fg","data-cui-type":"prose","data-cui-measure":"reading","data-testid":t,children:n})),ie=({occurrence:e,testId:t,children:n})=>(g(),zt("div",{className:"cui-alert",role:"alert","data-cui-surface":"danger-tint","data-cui-fg":"danger-fg","data-cui-type":"prose","data-cui-measure":"reading","data-cui-occurrence":e,"data-testid":t,children:n},e));import{jsx as Jt}from"react/jsx-runtime";var je=({failure:e,place:t,deniedSentence:n,failed:o,retry:a,testId:r})=>{let{labels:i,accessFailure:d}=C();if(n.trim()==="")throw new RangeError("FailureMessage: deniedSentence must be a non-empty sentence");let s=e.status===null?null:Ar(e.status);return s===null?Jt(ie,{occurrence:e.occurrence,testId:r,children:i.failureSentence(e,o)}):Jt(Dr,{children:d({kind:s,place:t,deniedSentence:s==="forbidden"?i.forbiddenBecause(n,e.reason):null,retry:a})},e.occurrence)};import{useId as j}from"react";import{Fragment as Vr,jsx as v,jsxs as $}from"react/jsx-runtime";var Hr=/\s/,Ye=e=>{if(e!==void 0&&(typeof e!="string"||e===""||Hr.test(e)))throw new RangeError(`A control's name must be one token without whitespace: "${e}"`);return e},Xt=e=>{if(e!==void 0&&!(Number.isInteger(e)&&e>0))throw new RangeError(`A field's maxLength must be a positive integer: ${e}`);return e},Y=({description:e,error:t,errorId:n})=>{g();let o=j(),a=j(),r=j(),i=n===void 0?r:Oe(n,"a field's error"),d=[e===void 0?null:a,t===void 0?null:i].filter(u=>u!==null).join(" ");return{control:{id:o,"aria-describedby":d===""?void 0:d,"aria-invalid":t===void 0?void 0:!0},descriptionId:a,errorId:i}},Z=({description:e,error:t,descriptionId:n,errorId:o,testId:a})=>$(Vr,{children:[e===void 0?null:v(P,{as:"p",fg:"fg-muted",type:"body",id:n,testId:`${a}-description`,children:e}),t===void 0?null:v(P,{as:"p",fg:"danger-fg",type:"body",id:o,testId:`${a}-error`,children:t})]}),be=({htmlFor:e,hidden:t,children:n})=>v("label",{className:t===!0?"cui-visually-hidden":"cui-field-label",htmlFor:e,"data-cui-type":"body",children:n}),Or=({label:e,description:t,error:n,errorId:o,testId:a,children:r})=>{let{control:i,descriptionId:d,errorId:s}=Y({label:e,description:t,error:n,errorId:o});return $("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":a,children:[v(be,{htmlFor:i.id,hidden:void 0,children:e}),r(i),v(Z,{description:t,error:n,descriptionId:d,errorId:s,testId:a})]})},jt=({label:e,description:t,error:n,errorId:o,value:a,onValueChange:r,type:i,name:d,maxLength:s,list:u,autoComplete:p,inputMode:l,prefix:c,labelHidden:b,required:m,testId:f,ref:h})=>{let{control:y,descriptionId:E,errorId:R}=Y({label:e,description:t,error:n,errorId:o}),T=j();if(c!==void 0&&c.trim()==="")throw new RangeError("An input's prefix must not be blank");if(s!==void 0&&i==="datetime-local")throw new RangeError(`A ${i} input takes no maxLength: ${s}`);let x=i==="password",k=v("input",{className:"cui-input",type:i,name:Ye(d),maxLength:Xt(s),value:a,list:u,autoComplete:p,inputMode:l,spellCheck:x?!1:void 0,autoCapitalize:x?"none":void 0,required:m,onChange:K=>r(K.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":f,ref:h,...y,"aria-describedby":B(c===void 0?void 0:T,y["aria-describedby"])});return $("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${f}-field`,children:[v(be,{htmlFor:y.id,hidden:b,children:e}),c===void 0?k:$("div",{className:"cui-input-group",children:[v("span",{className:"cui-input-prefix",id:T,"data-cui-fg":"fg-secondary","data-cui-surface":"sunken","data-cui-type":"body","data-testid":`${f}-prefix`,children:c}),k]}),v(Z,{description:t,error:n,descriptionId:E,errorId:R,testId:f})]})},Kr=e=>v(jt,{...e}),Ur=e=>v(jt,{...e,type:"password"}),Br=({label:e,description:t,error:n,errorId:o,value:a,onValueChange:r,name:i,maxLength:d,required:s,testId:u,ref:p})=>{let{control:l,descriptionId:c,errorId:b}=Y({label:e,description:t,error:n,errorId:o});return $("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${u}-field`,children:[v(be,{htmlFor:l.id,hidden:void 0,children:e}),v("textarea",{className:"cui-input cui-textarea",name:Ye(i),maxLength:Xt(d),value:a,required:s,onChange:m=>r(m.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":u,ref:p,...l}),v(Z,{description:t,error:n,descriptionId:c,errorId:b,testId:u})]})},_r=({label:e,description:t,error:n,errorId:o,value:a,options:r,onValueChange:i,name:d,labelHidden:s,unavailable:u,testId:p,ref:l})=>{let{control:c,descriptionId:b,errorId:m}=Y({label:e,description:t,error:n,errorId:o}),f=j(),h=J(u,f);return $("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${p}-field`,children:[v(be,{htmlFor:c.id,hidden:s,children:e}),v("select",{className:"cui-input",name:Ye(d),value:a,onChange:y=>{u===void 0&&i(y.target.value)},"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":p,ref:l,...c,"aria-disabled":u===void 0?void 0:!0,"aria-describedby":B(c["aria-describedby"],h),children:r.map(y=>v("option",{value:y.value,children:y.label},y.value))}),v(Z,{description:t,error:n,descriptionId:b,errorId:m,testId:p}),u?.reason===void 0?null:v(P,{as:"p",fg:"fg-muted",type:"body",id:f,testId:`${p}-reason`,children:u.reason})]})},qr=({legend:e,description:t,error:n,errorId:o,value:a,options:r,onValueChange:i,testId:d,ref:s})=>{let u=j(),{control:p,descriptionId:l,errorId:c}=Y({label:e,description:t,error:n,errorId:o});return $("fieldset",{className:"cui-radio-group","aria-describedby":p["aria-describedby"],"data-invalid":n!==void 0,"data-testid":d,children:[v("legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),r.map((b,m)=>$("label",{className:"cui-radio","data-cui-type":"body",children:[v("input",{type:"radio",name:u,value:b.value,checked:b.value===a,onChange:()=>i(b.value),"aria-invalid":p["aria-invalid"],"data-testid":`${d}-option-${b.value}`,ref:m===0?s:void 0}),v("span",{children:b.label})]},b.value)),v(Z,{description:t,error:n,descriptionId:l,errorId:c,testId:d})]})},Gr=({legend:e,description:t,error:n,errorId:o,values:a,options:r,onValuesChange:i,testId:d,ref:s})=>{let{control:u,descriptionId:p,errorId:l}=Y({label:e,description:t,error:n,errorId:o}),c=r.map(f=>f.value);if(c.length===0||new Set(c).size!==c.length)throw new RangeError(`A check box group needs at least one option with unique values: ${c.join(", ")}`);let b=a.filter(f=>!c.includes(f));if(b.length>0)throw new RangeError(`The chosen values are not options: ${b.join(", ")}`);let m=new Set(a);return $("fieldset",{className:"cui-checkbox-group","aria-describedby":u["aria-describedby"],"data-invalid":n!==void 0,"data-testid":d,children:[v("legend",{className:"cui-checkbox-group-legend","data-cui-type":"body",children:e}),r.map((f,h)=>$("label",{className:"cui-checkbox","data-cui-type":"body",children:[v("input",{type:"checkbox",value:f.value,checked:m.has(f.value),onChange:()=>i(c.filter(y=>y===f.value?!m.has(y):m.has(y))),"aria-invalid":u["aria-invalid"],"data-testid":`${d}-option-${f.value}`,ref:h===0?s:void 0}),v("span",{children:f.label})]},f.value)),v(Z,{description:t,error:n,descriptionId:p,errorId:l,testId:d})]})};import{createContext as Wr,useContext as zr,useId as tn,useMemo as Jr}from"react";import{Fragment as an,jsx as N,jsxs as he}from"react/jsx-runtime";var nn=Wr(null),Yt="surface",Zt={neutral:{face:"surface",line:"border-control"},info:{face:"info-tint",line:"info-accent"},success:{face:"success-tint",line:"success-accent"},warning:{face:"warning-tint",line:"warning-accent"},danger:{face:"danger-tint",line:"danger-accent"}},Qt={face:"info-tint",line:"info-accent"},rn={normal:"border-control",high:"info-accent"},Xr=["normal","high"],jr=[1,2,3,4],A=M.space["space-2"],Yr="fg",Zr="fg-secondary",on=e=>{let t=zr(nn);if(t===null)throw new Error(`${e} must be rendered inside Figure`);return t},Ze=(e,t,n)=>{if(!(Number.isFinite(n)&&n>0&&n%4===0))throw new RangeError(`${e}: ${t} must be a positive multiple of the ${4} px lattice: ${n}`)},Qr=e=>{g();let t=tn(),{kind:n,widthPx:o,heightPx:a,testId:r,dataAttributes:i,children:d}=e;Ze(r,"widthPx",o),Ze(r,"heightPx",a);let s=Jr(()=>({kind:n,widthPx:o,heightPx:a,arrowIds:{normal:`${t}-arrow-normal`,high:`${t}-arrow-high`}}),[n,o,a,t]),u=he(an,{children:[N("defs",{children:Xr.map(b=>N("marker",{id:s.arrowIds[b],viewBox:`0 0 ${A} ${A}`,refX:A,refY:A/2,markerWidth:A,markerHeight:A,markerUnits:"userSpaceOnUse",orient:"auto","data-cui-emphasis":b,children:N("path",{d:`M 0 0 L ${A} ${A/2} L 0 ${A} z`,"data-cui-stroke":rn[b],"data-testid":`${r}-arrow-${b}`})},b))}),N(nn.Provider,{value:s,children:d})]});if(e.kind==="group"){let{label:b,onEscape:m}=e;if(!D(b))throw new RangeError(`${r}: a group figure's label must hold a readable character: ${JSON.stringify(b)}`);return N("div",{className:"cui-figure-frame","data-testid":`${r}-frame`,children:N("svg",{className:"cui-figure",role:"group","aria-label":b,viewBox:`0 0 ${o} ${a}`,"data-cui-figure":"group","data-cui-surface":Yt,"data-cui-face":"sans",style:{"--cui-figure-inline":F(o),"--cui-figure-block":F(a)},onKeyDown:m===void 0?void 0:f=>_(f,m),"data-testid":r,...w(i),children:u})})}let{viewBox:p,pointer:l,svgRef:c}=e;return N("div",{className:"cui-container","data-testid":`${r}-frame`,children:N("svg",{ref:c,className:"cui-figure","aria-hidden":"true",viewBox:p===void 0?`0 0 ${o} ${a}`:p,"data-cui-figure":"decorative","data-cui-surface":Yt,"data-cui-face":"sans","data-cui-pan":l===void 0?void 0:"true","data-cui-cursor":l?.cursor,style:{"--cui-figure-inline":F(o),"--cui-figure-ratio":String(a/o)},"data-testid":r,...w(i),...l?.handlers,children:u})})},en=(e,t)=>{try{return t()}catch(n){throw new RangeError(`${e}: ${n.message}`,{cause:n})}},eo=(e,t,n)=>{for(let o of t){let a=wt.light[o.fg],r=n.find(i=>a[i]===void 0);if(r!==void 0)throw new RangeError(`${e}: the note ${JSON.stringify(o.text)} in ${o.fg} is not in the contrast table on ${r}, a face the node takes`)}},to=e=>{g();let t=on("FigureNode"),n=tn(),{x:o,y:a,shape:r,tone:i,outline:d,selected:s,name:u,title:p,press:l,testId:c,dataAttributes:b}=e,m=e.notes===void 0?[]:e.notes;if(!(Number.isFinite(o)&&Number.isFinite(a)))throw new RangeError(`${c}: a node's position must be finite: ${o}, ${a}`);if(t.kind==="group"&&l===void 0)throw new RangeError(`${c}: every node of a group figure must be pressable (pass press)`);if(t.kind==="decorative"&&l!==void 0)throw new RangeError(`${c}: a node of a decorative figure cannot be pressed (it is hidden from assistive technology)`);if(l!==void 0&&!D(l.label))throw new RangeError(`${c}: a pressable node's label must hold a readable character: ${JSON.stringify(l.label)}`);let f=s?Qt:Zt[i];eo(c,m,[Zt[i].face,Qt.face]);let h,y,E;if(r.kind==="box"){if(u===null)throw new RangeError(`${c}: a box's name is drawn inside the box and sizes it, so it cannot be null (only a disc may be drawn without a name)`);let T=en(c,()=>yt({name:u,notes:m.map(k=>k.text)}));if(Ze(c,"a box's widthPx",r.widthPx),r.widthPx<T.minWidthPx)throw new RangeError(`${c}: a box ${r.widthPx} px wide is narrower than its lines under the widest 1.4.12 spacing (${T.minWidthPx} px)`);h={width:r.widthPx,height:T.heightPx,left:o,top:a};let x=ft(m.length);y=he("g",{"data-cui-surface":f.face,children:[N("rect",{className:"cui-figure-plate",width:r.widthPx,height:T.heightPx,rx:M.radius["radius-item"],"data-cui-fill":f.face,"data-cui-stroke":f.line,"data-testid":`${c}-plate`}),N("text",{className:"cui-figure-name",x:x.insetPx,y:x.namePx,fontSize:M.type.body.size,"data-cui-fg":Yr,"data-cui-figure-type":"body","data-testid":`${c}-name`,children:u}),m.map((k,K)=>N("text",{x:x.insetPx,y:x.notesPx[K],fontSize:M.type.caption.size,"data-cui-fg":k.fg,"data-cui-figure-type":"caption","data-testid":`${c}-note-${K}`,children:k.text},K))]}),E=N("rect",{className:"cui-figure-ring",x:-U,y:-U,width:r.widthPx+2*U,height:T.heightPx+2*U,rx:M.radius["radius-item"]+U,"data-cui-stroke":"focus","data-testid":`${c}-ring`})}else{let T=en(c,()=>mt(u,r.radiusPx));h={width:2*r.radiusPx,height:2*r.radiusPx,left:o-r.radiusPx,top:a-r.radiusPx},y=he(an,{children:[N("g",{"data-cui-surface":f.face,children:N("circle",{className:"cui-figure-plate",r:r.radiusPx,"data-cui-fill":f.face,"data-cui-stroke":f.line,"data-testid":`${c}-plate`})}),u===null?null:N("text",{className:"cui-figure-label",x:0,y:T.extentBelowPx-M.type.caption.lineHeight/2,fontSize:M.type.caption.size,"data-cui-fg":Zr,"data-cui-figure-type":"caption","data-testid":`${c}-name`,children:u})]}),E=N("circle",{className:"cui-figure-ring",r:r.radiusPx+U,"data-cui-stroke":"focus","data-testid":`${c}-ring`})}if(l!==void 0){if(h.width<W||h.height<W)throw new RangeError(`${c}: a pressable node must be at least the ${W} px target: ${h.width} \xD7 ${h.height}`);if(h.left<z||h.top<z||h.left+h.width+z>t.widthPx||h.top+h.height+z>t.heightPx)throw new RangeError(`${c}: a pressable node must keep ${z} px to the figure's edge for its focus ring`)}let R=l===void 0?{}:{role:"button",tabIndex:0,"aria-label":l.label,"aria-describedby":l.description===void 0?void 0:n,"aria-expanded":l.expanded,"aria-controls":l.expanded?l.controls:void 0,onClick:T=>{T.currentTarget.focus(),l.onPress()},onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),T.repeat||l.onPress())}};return he("g",{className:"cui-figure-node",transform:`translate(${o} ${a})`,"data-cui-tone":i,"data-cui-outline":d,"data-selected":String(s),...R,"data-testid":c,...w(b),children:[p===void 0?null:N("title",{children:p}),l?.description===void 0?null:N("desc",{id:n,"data-testid":`${c}-description`,children:l.description}),l===void 0?null:E,y]})},no=({d:e,emphasis:t,weight:n,arrow:o,title:a,testId:r,dataAttributes:i})=>{g();let d=on("FigureEdge");if(!jr.includes(n))throw new RangeError(`${r}: an edge's weight must be 1, 2, 3 or 4: ${n}`);return N("path",{className:"cui-figure-edge",d:e,markerEnd:o?`url(#${d.arrowIds[t]})`:void 0,"data-cui-stroke":rn[t],"data-cui-weight":n,"data-cui-emphasis":t,"data-testid":r,...w(i),children:a===void 0?null:N("title",{children:a})})};import{jsx as ao}from"react/jsx-runtime";var ro={1:"h1",2:"h2",3:"h3"},oo=({level:e,type:t,testId:n,headingRef:o,children:a})=>{g();let r=ro[e];return ao(r,{className:"cui-heading","data-cui-type":t,"data-cui-fg":"fg","data-testid":n,ref:o,tabIndex:o===void 0?void 0:-1,children:a})};import{jsx as lo}from"react/jsx-runtime";var io={removed:"danger-tint",added:"success-tint"},so=({kind:e,testId:t,children:n})=>{if(g(),n==="")throw new RangeError(`${t}: a changed fragment must hold at least one character`);return lo(e==="removed"?"del":"ins",{className:"cui-change","data-cui-change":e,"data-cui-surface":io[e],"data-cui-fg":"fg","data-testid":t,children:n})};import{jsx as po}from"react/jsx-runtime";var uo={neutral:{fg:"fg-secondary",surface:"sunken"},info:{fg:"info-fg",surface:"info-tint"},success:{fg:"success-fg",surface:"success-tint"},warning:{fg:"warning-fg",surface:"warning-tint"},danger:{fg:"danger-fg",surface:"danger-tint"}},co={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},Qe=({tone:e,variant:t,testId:n,dataAttributes:o,children:a})=>{g();let r=t==="tint"?uo[e]:{fg:"on-solid",surface:co[e]};return po("span",{className:"cui-pill","data-cui-tone":e,"data-cui-variant":t,"data-cui-fg":r.fg,"data-cui-surface":r.surface,"data-cui-type":"caption","data-testid":n,...w(o),children:a})};import{useId as yo}from"react";import{jsx as se,jsxs as fo}from"react/jsx-runtime";var et=({label:e,valueText:t,value:n,max:o,testId:a})=>{g();let r=yo();if(o!==null){if(!(Number.isFinite(o)&&o>0))throw new RangeError(`Progress maximum must be positive: ${o}`);if(n===null||!(Number.isFinite(n)&&n>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${n}`)}let i=o===null?null:{max:o,now:Math.min(n,o)};return fo("div",{className:"cui-progress","data-testid":a,children:[se(P,{as:"p",fg:"fg",type:"body",id:r,children:e}),se("div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":r,"aria-valuetext":t,"aria-valuemin":i===null?void 0:0,"aria-valuemax":i?.max,"aria-valuenow":i?.now,"data-cui-surface":"sunken","data-cui-indeterminate":i===null,"data-testid":`${a}-bar`,children:se("div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:i===null?void 0:{inlineSize:`${i.now/i.max*100}%`},"data-testid":`${a}-fill`})}),se("div",{"aria-hidden":"true",children:se(P,{as:"p",fg:"fg-secondary",type:"body",testId:`${a}-value`,children:t})})]})};import{jsx as Re,jsxs as sn}from"react/jsx-runtime";var mo=({title:e,status:t,progress:n,cancel:o,testId:a,children:r})=>sn(_e,{title:e,actions:o===void 0?void 0:Re(I,{variant:"secondary",busy:o.busy,busyLabel:o.busyLabel,onClick:o.onCancel,testId:`${a}-cancel`,children:o.label}),testId:a,children:[sn("div",{className:"cui-job-status",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${a}-status`,children:[Re("span",{className:"cui-visually-hidden",children:`${e} `}),Re(Qe,{tone:t.tone,variant:"tint",testId:`${a}-status-pill`,children:t.label})]}),n===void 0?null:Re(et,{...n,testId:`${a}-progress`}),r]});import{createContext as go,useContext as bo}from"react";import{jsx as de}from"react/jsx-runtime";var tt=go(null),ho="space-2",Ro=e=>{g();let{gap:t,label:n,id:o,hidden:a,testId:r,children:i}=e;if(n!==void 0&&!D(n))throw new RangeError(`${r}: a list's label must hold a readable character: ${JSON.stringify(n)}`);let d=e.marker==="none"?void 0:e.type,s=d!==void 0,u=e.marker==="number"||e.marker==="none"&&e.ordered?"ol":"ul";return de(tt.Provider,{value:e.marker,children:de(u,{className:"cui-list",role:"list","aria-label":n,id:o,hidden:a,"data-cui-gap":s?void 0:t,"data-cui-row-gap":s?t:void 0,"data-cui-column-gap":s?ho:void 0,"data-cui-marker":s?e.marker:void 0,"data-cui-type":d,"data-testid":r,children:i})})},To=({testId:e,dataAttributes:t,children:n})=>{g();let o=bo(tt);if(o===null)throw new Error("ListItem must be rendered inside List, not inside another ListItem");return de("li",{className:"cui-list-item","data-testid":e,...w(t),children:de("div",{className:"cui-list-body","data-cui-measure":o==="none"?void 0:"reading",children:de(tt.Provider,{value:null,children:n})})})};import{useCallback as dn,useLayoutEffect as Eo,useRef as Te}from"react";import{jsx as Ee,jsxs as Po}from"react/jsx-runtime";var ln=e=>[...e.querySelectorAll(re)].filter(t=>{let n=t.closest(qe);return n===null||!e.contains(n)}),xo=e=>{let t=e.ref.current;if(t===null)throw new Error("LoadMore: rows.ref is not attached to the element holding the rows");let n=ln(t);if(n.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${n.length} ${re} elements for ${e.count} rows`);return n},vo=(e,t)=>{let n=-1;return e.forEach((o,a)=>{t.has(o)&&(n=a)}),e[n+1]},wo=({onLoad:e,busy:t,done:n,failure:o,limit:a,rows:r,testId:i})=>{let{formatLocale:d,labels:s}=C(),u=Te(null),p=Te(null),l=Te(null),c=Te(!1),b=()=>{let y=r.ref.current;u.current={shown:new Set(y===null?[]:ln(y)),failureOccurrence:o===null?null:o.occurrence,busySeen:!1},e()};Eo(()=>{let y=c.current;c.current=!1;let E=u.current;if(E===null)return;let R=xo(r);if(t){E.busySeen=!0,E.shown=new Set(R);return}let T=vo(R,E.shown),x=o!==null&&o.occurrence!==E.failureOccurrence;if(!(E.busySeen||T!==void 0||x||n)||(u.current=null,x||T===void 0))return;let k=[null,document.body].includes(document.activeElement);(l.current!==null&&document.activeElement===l.current||y&&k)&&T.focus()});let m=oe(()=>n?p.current:l.current),f=dn((y=>{l.current=y;let E=m(y);return()=>{l.current=null,c.current=y===document.activeElement,E()}}),[m]),h=dn((y=>{p.current=y;let E=m(y);return()=>{p.current=null,E()}}),[m]);return n?Ee("div",{className:"cui-load-more","data-testid":i,children:Ee(P,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:h,testId:`${i}-end`,children:s.endOfRecords})}):Po("div",{className:"cui-load-more","data-testid":i,children:[Ee(I,{variant:"secondary",busy:t,busyLabel:s.loading,onClick:b,ref:f,testId:`${i}-button`,children:s.loadMore(ue(a,d))}),o===null?null:Ee(ie,{occurrence:o.occurrence,testId:`${i}-failure`,children:s.loadFailed(o.reason)})]})};import{jsx as nt,jsxs as un}from"react/jsx-runtime";var No=({master:e,detail:t,masterMinPx:n,detailMinPx:o,testId:a})=>{g();let r=gt({masterMinPx:n,detailMinPx:o,gapPx:M.space["space-6"]});return un("div",{className:"cui-container","data-testid":a,children:[nt(X,{ruleKey:r.key,css:r.css}),un("div",{className:"cui-master-detail","data-cui-master-detail":r.key,children:[nt("div",{className:"cui-master-detail-pane","data-testid":`${a}-master`,children:e}),nt("div",{className:"cui-master-detail-pane","data-testid":`${a}-detail`,children:t})]})]})};import{jsx as xe}from"react/jsx-runtime";var ve=e=>{let{formatLocale:t,labels:n}=C(),{testId:o}=e;if(e.keep===void 0){let{value:i,unit:d}=e;if(d!==void 0&&!D(d))throw new RangeError(`${o}: a unit must hold a readable character: ${JSON.stringify(d)}`);if(i===null)return xe("span",{className:"cui-measured","data-measured":"false","data-testid":o,children:n.unmeasured});let s=ue(i,t);return xe("span",{className:"cui-measured","data-measured":"true","data-testid":o,children:ut(s,d)})}let{text:a,keep:r}=e;if(a===null)return xe("span",{className:"cui-measured","data-measured":"false","data-cui-keep":r,"data-testid":o,children:n.unmeasured});if(!D(a))throw new RangeError(`${o}: a measured text must hold a readable character (pass null when the value was not measured): ${JSON.stringify(a)}`);return xe("span",{className:"cui-measured","data-measured":"true","data-cui-keep":r,"data-testid":o,children:a})};import{jsx as we,jsxs as ko}from"react/jsx-runtime";var Co=({label:e,value:t,min:n,max:o,valueText:a,testId:r})=>{if(g(),!(Number.isFinite(n)&&Number.isFinite(o)&&n<o))throw new RangeError(`Meter needs a finite range with min below max: min ${n}, max ${o}`);if(!(Number.isFinite(t)&&t>=n&&t<=o))throw new RangeError(`Meter value must be a finite number in its range: value ${t}, min ${n}, max ${o}`);return ko("span",{className:"cui-meter","data-testid":r,children:[we("span",{className:"cui-meter-track",role:"meter","aria-label":e,"aria-valuemin":n,"aria-valuemax":o,"aria-valuenow":t,"aria-valuetext":a,"data-cui-surface":"sunken","data-testid":`${r}-bar`,children:we("span",{className:"cui-meter-fill","data-cui-accent":"info-accent",style:{inlineSize:`${(t-n)/(o-n)*100}%`},"data-testid":`${r}-fill`})}),we("span",{"aria-hidden":"true",children:we(P,{fg:"fg",type:"body",testId:`${r}-value`,children:a})})]})};import{useId as Lo,useRef as So}from"react";import{jsx as rt,jsxs as Fo}from"react/jsx-runtime";var Mo={ArrowLeft:-1,ArrowRight:1},Io=({label:e,items:t,value:n,onValueChange:o,testId:a,panelDescribedBy:r,children:i})=>{g();let d=Lo(),s=So(new Map);if(t.length===0)throw new RangeError("PanelTabs needs at least one tab");let u=t.map(f=>f.id);if(new Set(u).size!==u.length)throw new RangeError(`Tab keys must be unique: ${u.join(", ")}`);let p=u.indexOf(n);if(p<0)throw new RangeError(`The selected tab "${n}" is not one of the tabs: ${u.join(", ")}`);let l=f=>`${d}-tab-${f}`,c=`${d}-panel`,b=f=>{let h=t[f];h.id!==n&&o(h.id),s.current.get(h.id)?.focus()};return Fo("div",{className:"cui-panel-tabs","data-testid":a,children:[rt("div",{className:"cui-tabs-list",role:"tablist","aria-label":e,onKeyDown:f=>{let h=t.findIndex(T=>s.current.get(T.id)===f.target),y=h<0?p:h,E=Mo[f.key],R;if(E!==void 0){let T=getComputedStyle(f.currentTarget).direction==="rtl"?-E:E;R=(y+T+t.length)%t.length}else if(f.key==="Home")R=0;else if(f.key==="End")R=t.length-1;else return;f.preventDefault(),b(R)},children:t.map((f,h)=>{let y=h===p;return rt("button",{className:"cui-tab cui-panel-tab",type:"button",role:"tab",id:l(h),"aria-selected":y,"aria-controls":c,tabIndex:y?0:-1,"data-cui-fg":y?"fg":"fg-secondary","data-cui-type":"body","data-testid":`${a}-${f.id}`,ref:E=>{E===null?s.current.delete(f.id):s.current.set(f.id,E)},onClick:()=>b(h),children:f.label},f.id)})}),rt("div",{role:"tabpanel",id:c,"aria-labelledby":l(p),"aria-describedby":r,"data-testid":`${a}-panel`,children:i})]})};import{accessFailureKindOfStatus as $o}from"@aiquants/auth-core";import{jsx as ot,jsxs as Do}from"react/jsx-runtime";var Ao=({failure:e,onReload:t,deniedSentence:n,failureMessage:o,rescueRef:a,testId:r})=>{let{labels:i}=C(),d=ot(je,{failure:e,place:"read",deniedSentence:n,failed:o===void 0?i.loadFailed:o,retry:t,testId:`${r}-alert`});return e.status!==null&&$o(e.status)!==null?ot("div",{className:"cui-resource-failed",ref:a,"data-testid":r,children:d},e.occurrence):Do("div",{className:"cui-resource-failed","data-testid":r,children:[d,ot(I,{variant:"secondary",busy:e.retrying,busyLabel:i.loading,onClick:t,ref:a,testId:`${r}-reload`,children:i.reload})]})};import{jsx as at,jsxs as Oo}from"react/jsx-runtime";var Ho=({label:e,options:t,value:n,onValueChange:o,testId:a})=>{g();let r=new Set(t.map(i=>i.value));if(t.length<2||r.size!==t.length)throw new RangeError(`A segmented control needs at least two options with unique values: ${t.map(i=>i.value).join(", ")}`);if(!r.has(n))throw new RangeError(`The pressed value "${n}" is not one of the options: ${[...r].join(", ")}`);return Oo("fieldset",{className:"cui-segmented-group","data-testid":a,children:[at("legend",{className:"cui-segmented-legend","data-cui-type":"body",children:e}),at("div",{className:"cui-segmented",children:t.map(i=>{let d=i.value===n;return at("button",{className:"cui-segment",type:"button","aria-pressed":d,"data-cui-fg":d?"on-solid":"fg","data-cui-surface":d?"info-solid":void 0,"data-cui-type":"body","data-testid":`${a}-${i.value}`,onClick:()=>{d||o(i.value)},children:i.label},i.value)})})]})};import{useCallback as Ko,useRef as Uo}from"react";import{jsx as Q}from"react/jsx-runtime";var cn=({selected:e,controls:t,onSelect:n,testId:o,dataAttributes:a,ref:r,children:i})=>{g();let d=Uo(null);H(d,{testId:o,part:"row",host:"button"});let s=Ko(p=>{if(d.current=p,typeof r=="function")return r(p);r!=null&&(r.current=p)},[r]);return Q("button",{className:"cui-row-button",type:"button","data-selected":e,"aria-expanded":e,"aria-controls":t,"data-cui-row-focus":"","data-cui-surface":e?"info-tint":"surface","data-cui-fg":"fg","data-cui-type":"body","data-testid":o,onClick:p=>{pe(p),n()},ref:s,...w(a),children:i})},Bo=({label:e,items:t,itemKey:n,selectedKey:o,onSelect:a,detailId:r,renderRow:i,rowTestId:d,rowData:s,empty:u,testId:p,ref:l})=>(g(),Q("div",{className:"cui-selectable","data-testid":p,ref:l,children:t.length===0?Q(P,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:u}):Q("ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let b=n(c);return Q("li",{children:Q(cn,{selected:b===o,controls:r,onSelect:()=>a(c),testId:d,dataAttributes:s?.(c),children:i(c)})},b)})})}));import{useId as _o}from"react";import{jsx as Pe,jsxs as pn}from"react/jsx-runtime";var qo=({label:e,value:t,min:n,max:o,step:a,valueText:r,onValueChange:i,testId:d})=>{g();let s=_o();if(!([t,n,o,a].every(Number.isFinite)&&n<o&&a>0&&n<=t&&t<=o))throw new RangeError(`Slider needs finite min < max, a positive step and min <= value <= max: value ${t}, min ${n}, max ${o}, step ${a}`);let u=r(t);return pn("div",{className:"cui-field","data-testid":`${d}-field`,children:[Pe("label",{className:"cui-field-label",htmlFor:s,"data-cui-type":"body",children:e}),pn("div",{className:"cui-slider",children:[Pe("input",{className:"cui-slider-input",id:s,type:"range",min:n,max:o,step:a,value:t,"aria-valuetext":u,"data-testid":d,onChange:p=>i(p.currentTarget.valueAsNumber)}),Pe("span",{className:"cui-slider-value","aria-hidden":"true",children:Pe(P,{fg:"fg",type:"body",testId:`${d}-value`,children:u})})]})]})};import{jsx as it,jsxs as fn}from"react/jsx-runtime";var yn={done:0,current:1,pending:2},Go={done:{fg:"on-solid",surface:"success-solid"},current:{fg:"on-solid",surface:"info-solid"},pending:{fg:"fg-secondary",surface:void 0}},Vo=({label:e,steps:t,testId:n})=>{let{labels:o}=C();if(t.length===0||new Set(t.map(r=>r.id)).size!==t.length)throw new RangeError(`A stepper needs at least one step with unique keys: ${t.map(r=>r.id).join(", ")}`);if(t.filter(r=>r.state==="current").length>1||t.some((r,i)=>i>0&&yn[r.state]<yn[t[i-1].state]))throw new RangeError(`Step states must run done, at most one current, then pending: ${t.map(r=>r.state).join(", ")}`);let a={done:o.stepDone,current:null,pending:o.stepPending};return it("ol",{className:"cui-stepper",role:"list","aria-label":e,"data-cui-type":"body","data-testid":n,children:t.map((r,i)=>{let d=Go[r.state],s=a[r.state];return fn("li",{className:"cui-step","aria-current":r.state==="current"?"step":void 0,"data-cui-step":r.state,"data-testid":`${n}-${r.id}`,children:[it("span",{className:"cui-step-marker","aria-hidden":"true","data-cui-fg":d.fg,"data-cui-surface":d.surface,"data-cui-type":"caption",children:r.state==="done"?"\u2713":i+1}),fn("span",{className:"cui-step-label","data-cui-fg":"fg",children:[r.label,s===null?null:it("span",{className:"cui-visually-hidden",children:` (${s})`})]})]},r.id)})})};import{useId as Wo,useRef as zo}from"react";import{jsx as Ne,jsxs as mn}from"react/jsx-runtime";var Jo=({label:e,labelHidden:t,checked:n,onCheckedChange:o,unavailable:a,testId:r,ref:i,dataAttributes:d})=>{g();let s=Wo(),u=zo(null);H(u,{testId:r,part:"label",host:"button"});let p=J(a,s),l=a!==void 0,c=mn("button",{className:"cui-switch",type:"button",role:"switch","aria-checked":n,"aria-disabled":l?!0:void 0,"aria-describedby":B(p),"data-cui-fg":"fg","data-cui-type":"body","data-testid":r,ref:i,onClick:()=>{l||o(!n)},...w(d),children:[Ne("span",{className:"cui-switch-track","aria-hidden":"true","data-cui-surface":n?"info-solid":"sunken","data-testid":`${r}-track`,children:Ne("span",{className:"cui-switch-thumb","data-cui-surface":n?"surface":"neutral-solid","data-testid":`${r}-thumb`})}),Ne("span",{className:t===!0?"cui-visually-hidden":void 0,ref:u,children:e})]});return a?.reason===void 0?c:mn("span",{className:"cui-button-group",children:[c,Ne(P,{fg:"fg-muted",type:"body",id:s,testId:`${r}-reason`,children:a.reason})]})};import{useCallback as Xo,useEffect as jo,useId as Yo,useRef as gn,useState as Zo}from"react";import{jsx as le,jsxs as bn}from"react/jsx-runtime";var Qo=({label:e,items:t,currentId:n,onNavigate:o,testId:a,collapsible:r=!1})=>{if(g(),t.length===0)throw new RangeError("Tabs needs at least one tab");let i=new Set(t.map(m=>m.id));if(i.size!==t.length)throw new RangeError(`Tab keys must be unique: ${t.map(m=>m.id).join(", ")}`);let d=t.find(m=>m.id===n);if(d===void 0)throw new RangeError(`The current tab "${n}" is not one of the tabs: ${[...i].join(", ")}`);let[s,u]=Zo(!1),p=gn(null),l=gn(null),c=Yo(),b=Xo(m=>{u(!1),m&&p.current?.contains(document.activeElement)&&l.current?.focus()},[]);return jo(()=>{if(!(r&&s))return;let m=y=>p.current!==null&&!p.current.contains(y),f=y=>{m(y.target)&&b(!0)},h=y=>{m(y.target)&&b(!1)};return document.addEventListener("pointerdown",f,!0),document.addEventListener("focusin",h,!0),()=>{document.removeEventListener("pointerdown",f,!0),document.removeEventListener("focusin",h,!0)}},[r,s,b]),bn("nav",{ref:p,className:"cui-tabs","aria-label":e,"data-testid":a,"data-cui-collapsible":r?"":void 0,"data-cui-open":r&&s?"":void 0,onKeyDown:r&&s?m=>_(m,()=>b(!0)):void 0,children:[r?bn("button",{ref:l,type:"button",className:"cui-tabs-summary","aria-expanded":s,"aria-controls":c,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${a}-summary`,onClick:()=>u(m=>!m),children:[le("span",{className:"cui-tabs-summary-label",children:d.label}),le("span",{className:"cui-tabs-summary-marker","aria-hidden":"true",children:s?"\u25B4":"\u25BE"})]}):null,le("ul",{className:"cui-tabs-list",id:c,role:"list","data-cui-surface":r?"surface":void 0,children:t.map(m=>{let f=m.id===n;return le("li",{className:"cui-tabs-item",children:le("a",{className:"cui-tab",href:m.href,"aria-current":f?"page":void 0,"data-cui-fg":f?"fg":"fg-secondary","data-cui-type":"body","data-testid":`${a}-${m.id}`,onClick:h=>{fe(h,m.href,o),h.defaultPrevented&&b(!1)},children:m.label})},m.id)})})]})};import{Children as ea,Fragment as ta,isValidElement as na}from"react";import{jsx as V,jsxs as Rn}from"react/jsx-runtime";var ra={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},oa=e=>{g();let{label:t,sublabel:n,tone:o,testId:a,dataAttributes:r}=e;if((e.text===void 0?e.value===null:e.text===null)&&o!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${o}`);let d=`${a}-value`;return Rn("div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":o,"data-testid":a,...w(r),children:[V("p",{className:"cui-tile-label","data-cui-type":"caption","data-cui-measure":"reading",children:t}),V("p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption","data-cui-measure":"reading",children:n}),V("p",{className:"cui-tile-value","data-cui-fg":ra[o],"data-cui-type":"heading","data-cui-measure":"reading",children:e.text===void 0?V(ve,{value:e.value,unit:e.unit,testId:d}):V(ve,{text:e.text,keep:"wrap",testId:d})})]})},hn=e=>ea.toArray(e).flatMap(t=>{if(!na(t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===ta?hn(t.props.children):[t]}),aa=({count:e,minInlinePx:t,testId:n,children:o})=>{g();let a=ht(e,t,M.space["space-2"]),r=hn(o).length;if(r!==e)throw new RangeError(`TileGrid has ${r} tiles but count is ${e}`);return Rn("div",{className:"cui-container","data-testid":n,children:[V(X,{ruleKey:a.key,css:a.css}),V("div",{className:"cui-tile-grid","data-cui-tile-grid":a.key,"data-cui-gap":"space-2",children:o})]})};import{useLayoutEffect as ia,useRef as Tn}from"react";import{jsx as da}from"react/jsx-runtime";var Ce=e=>[...e.querySelectorAll("button")],sa=({label:e,testId:t,children:n})=>{g();let o=Tn(null),a=Tn(null);ia(()=>{let s=Ce(o.current),u=a.current!==null&&s.includes(a.current)?a.current:s[0]??null;a.current=u;for(let p of s)p.tabIndex=p===u?0:-1});let r=s=>{for(let u of Ce(o.current))u.tabIndex=u===s?0:-1;a.current=s};return da("div",{className:"cui-toolbar",role:"toolbar","aria-label":e,"aria-orientation":"horizontal","data-testid":t,ref:o,onFocus:s=>{let u=Ce(s.currentTarget).find(p=>p.contains(s.target));u!==void 0&&r(u)},onKeyDown:s=>{let u=Ce(s.currentTarget),p=u.indexOf(s.target);if(p===-1)return;let l=getComputedStyle(s.currentTarget).direction==="rtl"?"ArrowLeft":"ArrowRight",c=l==="ArrowRight"?"ArrowLeft":"ArrowRight",m={[l]:(p+1)%u.length,[c]:(p-1+u.length)%u.length,Home:0,End:u.length-1}[s.key];if(m===void 0)return;s.preventDefault();let f=u[m];r(f),f.focus()},children:n})};import{useCallback as ee,useEffect as ca,useLayoutEffect as xn,useRef as lt}from"react";import{useCallback as ke,useEffect as la,useLayoutEffect as ua,useRef as st,useState as dt}from"react";var En=e=>e===null?Me:Ie,Le=(e,t,n,o,a)=>{let[r,i]=dt(()=>({key:e,state:En(e)})),[d,s]=dt(0),[u,p]=dt(0),l=st(t),c=st(null),b=st(d);ua(()=>{l.current=t}),la(()=>{if(e===null){i({key:null,state:Me});return}let R=new AbortController;c.current=e;let T=d===b.current?"revision":"reload";return b.current=d,i(x=>Object.is(x.key,e)?{key:e,state:o(x.state,T)}:{key:e,state:Ie}),l.current(R.signal).then(x=>{R.signal.aborted||(c.current=null,i(k=>({key:e,state:a(k.state,x)})))},x=>{R.signal.aborted||i(()=>{throw x})}),()=>{R.abort(),c.current=null}},[e,n,d,u]);let m=ke(()=>s(R=>R+1),[]),f=ke(()=>p(R=>R+1),[]),h=ke((R,T)=>{i(x=>Object.is(x.key,R)?{key:R,state:T(x.state)}:x)},[]),y=ke((R,T)=>{h(R,T),Object.is(c.current,R)&&f()},[h,f]);return{state:Object.is(r.key,e)?r.state:En(e),reload:m,refresh:f,update:h,write:y}};var pa=(e,t,n)=>{let o=lt(t);xn(()=>{o.current=t});let a=ee(y=>o.current.first(y),[]),{state:r,reload:i,refresh:d,update:s,write:u}=Le(e,a,n,Tt,Et),p=lt({key:e,state:r});xn(()=>{p.current={key:e,state:r}});let l=lt(null),c=ee(()=>{l.current?.controller.abort(),l.current=null},[]);ca(()=>c,[e,n,c]);let b=ee(()=>{c(),i()},[c,i]),m=ee(()=>{c(),d()},[c,d]),f=ee(()=>{let{key:y,state:E}=p.current;if(y===null||E.kind!=="ready"||E.refreshing||E.value.next===null||E.value.loadingMore)throw new Error("usePagedResource: loadMore needs a shown list with a next cursor, no page in flight and no re-read in flight");let R=E.value.next,T={key:y,controller:new AbortController,maps:[]};l.current=T,s(y,xt),o.current.next(R,T.controller.signal).then(x=>{l.current===T&&(l.current=null,s(y,k=>T.maps.reduce((K,vn)=>$e(K,vn),vt(k,R,x))))},x=>{l.current===T&&s(y,()=>{throw x})})},[s]),h=ee((y,E)=>{let R=l.current;R!==null&&Object.is(R.key,y)&&R.maps.push(E),u(y,T=>$e(T,E))},[u]);return{state:r,reload:b,refresh:m,loadMore:f,updateList:h}};import{useCallback as ya,useRef as fa,useState as ma}from"react";var ga=e=>typeof e=="object"&&e!==null&&typeof e.then=="function",ba=()=>{let[e,t]=ma(null),n=fa(null),o=ya((a,r)=>{let i=r();if(!ga(i))return;let d=Symbol(a);n.current=d,t(a);let s=()=>{n.current===d&&(n.current=null,t(null))};i.then(s,s)},[]);return{pendingKey:e,press:o}};import{useCallback as ha}from"react";var Ra=(e,t,n)=>{let{state:o,reload:a,refresh:r,write:i}=Le(e,t,n,Rt,Fe),d=ha((s,u)=>i(s,p=>Fe(p,{ok:!0,value:u})),[i]);return{state:o,reload:a,refresh:r,put:d}};import{jsx as Ea}from"react/jsx-runtime";var Ta=({testId:e,children:t})=>(g(),Ea("span",{className:"cui-visually-hidden","data-testid":e,children:t}));export{ce as ANNOUNCE_SETTLE_MS,Zn as AccessFailureNotice,ie as AlertMessage,Qn as Breadcrumb,I as Button,pt as COMPACT_ROW_PX,Ma as CONSOLE_UI_LABEL_CATALOGS,ei as CONTRAST_MINIMUM,wt as CONTRAST_PAIRS,_e as Card,ar as CardSection,Gr as CheckboxGroup,Ue as Cluster,sr as CodeBlock,ur as ComparisonGrid,In as ConsoleUiRoot,wr as DataTable,Pr as DescriptionList,Sr as Dialog,Fr as Disclosure,z as FIGURE_RING_REACH_PX,Ua as FLEXIBLE_COLUMN_MIN_PX,je as FailureMessage,Or as Field,Qr as Figure,no as FigureEdge,to as FigureNode,Vn as FragmentLink,Xa as HTTP_FORBIDDEN,oo as Heading,so as InlineChange,mo as JobCard,Se as LATTICE_PX,qn as Link,Ro as List,To as ListItem,wo as LoadMore,No as MasterDetail,ve as Measured,Co as Meter,oa as MetricTile,$r as Notice,Io as PanelTabs,Ur as PasswordInput,Qe as Pill,et as ProgressBar,Fa as ROW_WITH_CONTROL_PX,qr as RadioGroup,Ao as ResourceFailed,cn as RowButton,Ho as SegmentedControl,_r as Select,Bo as SelectableList,qo as Slider,zn as Stack,Vo as Stepper,Jo as Switch,W as TARGET_PX,M as TOKENS,ai as TONES,ri as TONE_HUES,oi as TONE_ROLES,Qo as Tabs,P as Text,Br as TextArea,Kr as TextInput,aa as TileGrid,sa as Toolbar,Ta as VisuallyHidden,Pa as ZonedTimeError,xt as beginPage,Tt as beginPagedReload,Rt as beginReload,Ha as ceil8,Ia as ceilToLattice,Oa as cellContentInlinePx,Ba as comparisonAttributePx,Qa as contrastRatio,qa as countSampleText,$a as cssVar,yt as figureBoxPlan,mt as figureDiscLabelPlan,La as fillLabel,Ka as fixedColumnPx,Ya as flatMapOutcome,xa as formatByteSize,ue as formatCount,ka as formatInstant,Wa as goldenSectionPx,Za as hexToSrgb,_a as instantSampleText,D as isReadableText,Fe as keepLastGood,ti as lightDark,ja as mapOutcome,$e as mapPagedList,za as masterDetailPlan,Da as monoTextWidthEm,ni as placeholderRule,F as pxToRem,va as readDecimalText,wa as readIntegerText,Sa as reasonAside,ct as resolveConsoleUiLabels,Et as settleFirstPage,vt as settlePage,Va as spacedTextWidthEm,Ja as tableFrameMinInlinePx,bt as tableMinInlinePx,Aa as textWidthEm,ht as tileGridPlan,Ga as tileMinInlinePx,Na as toOffsetIso,Ca as toWallTime,Fn as useAccessFailure,He as useAnnounce,C as useConsoleUi,rr as useEscapeToClose,oe as useFocusRescue,pa as usePagedResource,ba as usePendingPress,Ra as useResource};
|
|
@@ -864,6 +864,32 @@
|
|
|
864
864
|
gap: var(--cui-space-2);
|
|
865
865
|
}
|
|
866
866
|
|
|
867
|
+
/* アクセスの失敗の知らせ: 題と文を持つ注記の箱の下に操作の横並びを置く。ボタンは塗りの外の面に置くので、枠と焦点の輪は
|
|
868
|
+
面の上の配色の組のまま (警告の塗りの上の組は配色の表に無い) */
|
|
869
|
+
.cui-access-failure {
|
|
870
|
+
display: flex;
|
|
871
|
+
flex-direction: column;
|
|
872
|
+
align-items: flex-start;
|
|
873
|
+
gap: var(--cui-space-2);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/* 題と文は 1 つずつの段落で、注記の箱の中に間を空けて積む */
|
|
877
|
+
.cui-access-failure-message {
|
|
878
|
+
display: flex;
|
|
879
|
+
flex-direction: column;
|
|
880
|
+
gap: var(--cui-space-1);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
.cui-access-failure-title,
|
|
884
|
+
.cui-access-failure-sentence {
|
|
885
|
+
margin: 0;
|
|
886
|
+
overflow-wrap: anywhere;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
.cui-access-failure-title {
|
|
890
|
+
font-weight: var(--cui-font-weight-bold);
|
|
891
|
+
}
|
|
892
|
+
|
|
867
893
|
/* 主の一覧: 1 行の行は上下の余白 12 と body の行 20 で 44。行と行の間は 4 */
|
|
868
894
|
.cui-selectable-list {
|
|
869
895
|
display: flex;
|
|
@@ -1129,6 +1155,15 @@
|
|
|
1129
1155
|
resize: vertical;
|
|
1130
1156
|
}
|
|
1131
1157
|
|
|
1158
|
+
/* iOS は字が 16px 未満の欄に焦点が来るたびに頁を拡大する。粗い指し示し (タッチの画面) では、欄と、欄と 1 つの枠に並ぶ前置きの字を
|
|
1159
|
+
本文の段と 16px の大きい方にする。16px は iOS の閾で、根の字の大きさに依らないので rem で書かない。行の高さは段のままなので、1 行の
|
|
1160
|
+
欄は 44 のまま */
|
|
1161
|
+
@media (pointer: coarse) {
|
|
1162
|
+
[data-cui-root] :is(.cui-input, .cui-input-prefix) {
|
|
1163
|
+
font-size: max(16px, var(--cui-font-size-body));
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1132
1167
|
.cui-radio-group,
|
|
1133
1168
|
.cui-checkbox-group,
|
|
1134
1169
|
.cui-segmented-group {
|
package/dist/testing.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7M4I26BScjs = require('./chunk-7M4I26BS.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7M4I26BScjs = require('./chunk-7M4I26BS.cjs');var E=new Set,T=new WeakMap,v="[autofocus], a[href], button, input, select, textarea, [tabindex]:not([tabindex='-1'])",_= exports.openModals =()=>[...E].filter(e=>e.isConnected&&e.open),A= exports.sendCloseRequest =e=>{let t=e.dispatchEvent(new Event("cancel",{cancelable:!0}));return t&&e.close(),t},C= exports.pressEscape =e=>e.ownerDocument.activeElement.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",code:"Escape",bubbles:!0,cancelable:!0,composed:!0}))&&A(e),I= exports.installDialogModel =()=>{typeof HTMLDialogElement>"u"||"showModal"in HTMLDialogElement.prototype||Object.defineProperties(HTMLDialogElement.prototype,{showModal:{configurable:!0,writable:!0,value(){if(!this.isConnected)throw new DOMException("The dialog is not connected","InvalidStateError");if(this.open){if(E.has(this))return;throw new DOMException("The dialog is already open as a non-modal dialog","InvalidStateError")}T.set(this,this.ownerDocument.activeElement),this.setAttribute("open",""),E.add(this),_optionalChain([this, 'access', _2 => _2.querySelector, 'call', _3 => _3(v), 'optionalAccess', _4 => _4.focus, 'call', _5 => _5()])}},close:{configurable:!0,writable:!0,value(){if(!this.open)return;this.removeAttribute("open"),E.delete(this);let e=_nullishCoalesce(T.get(this), () => (null));T.delete(this),e instanceof HTMLElement&&e.isConnected&&e.focus(),setTimeout(()=>{this.dispatchEvent(new Event("close"))},0)}}})};var H=/color|background|fill|stroke|shadow|^border(?:-(?:top|right|bottom|left|block|inline)(?:-(?:start|end))?)?$|^border-image|^(?:outline|text-decoration|column-rule|text-emphasis|opacity)$|filter$|blend-mode$/,P=/^(?:fill|stroke|color|bgcolor|opacity|[a-z]+(?:-[a-z]+)*-opacity|stop-color|flood-color|lighting-color|filter|mask)$/,x="http://www.w3.org/2000/svg",S="path, rect, circle, ellipse, line, polyline, polygon",q="title, desc, metadata",$="[data-cui-marker]",U=/^\[data-[a-z0-9_-]+(?:[~|^$*]?="[^"\\]*")?\]$/,j=e=>{let t=e.style,l=[];for(let s=0;s<t.length;s+=1){let n=t.item(s);H.test(n)&&l.push(n)}return l},O=(e,t,l)=>{let s=[];for(let n=t;n!==null;n=n.parentElement){let i=j(n);i.length>0&&s.push(`\u30A4\u30F3\u30E9\u30A4\u30F3\u306E\u8272: ${e} \u306E ${n.tagName} \u306E ${i.join(", ")}`);let c=n.getAttributeNames().filter(d=>P.test(d));if(c.length>0&&s.push(`\u5857\u308A\u306E\u5C5E\u6027: ${e} \u306E ${n.tagName} \u306E ${c.join(", ")}`),n===l)break}return s},K=e=>{let t=e.closest("[data-testid]");return t===null?e.tagName:`${e.tagName} ${t.getAttribute("data-testid")}`},z=e=>{for(let t=e.parentElement;t!==null;t=t.parentElement)if(t.hasAttribute("data-cui-surface"))return t;return null},B=e=>Object.hasOwn(_chunk7M4I26BScjs.e,e)&&_chunk7M4I26BScjs.e[e]==="nonText",F=(e,t)=>{let l=_chunk7M4I26BScjs.d.light,s=t.closest("[data-cui-fg]"),n=t.closest("[data-cui-surface]");if(s===null||n===null)return{failures:[`\u5F79\u5272\u306E\u7121\u3044\u6587\u5B57: ${e}`],pair:null};let i=s.getAttribute("data-cui-fg"),c=n.getAttribute("data-cui-surface");return Object.hasOwn(l,i)&&Object.hasOwn(l[i],c)?{failures:O(e,t,s.contains(n)?s:n),pair:`${i}/${c}`}:{failures:[`\u8868\u306B\u7121\u3044\u7D44: ${e}: ${i} on ${c}`],pair:null}},G=(e,t)=>t.flatMap(l=>{if(!U.test(l))throw new RangeError(`A role scan excludes only by one data-* attribute selector: ${l}`);if(e.matches(l))throw new RangeError(`A role scan exclusion must not match the root it scans: ${l}`);let s=[...e.querySelectorAll(l)];if(s.length===0)throw new RangeError(`A role scan exclusion matches no element under the root: ${l}`);return s}),W= exports.scanColourRoles =(e,t)=>{let l=G(e,t===void 0?[]:t.exclude),s=o=>l.some(r=>r.contains(o)),n=[],i=new Set,c=new Set,d=0,b=0,M=_chunk7M4I26BScjs.d.light,R=(o,r)=>{d+=1;let a=F(o,r);n.push(...a.failures),a.pair!==null&&i.add(a.pair)},w=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let o=w.nextNode();o!==null;o=w.nextNode()){let r=o.data.trim(),a=o.parentElement;r===""||_optionalChain([a, 'access', _6 => _6.closest, 'call', _7 => _7(q), 'optionalAccess', _8 => _8.namespaceURI])===x||s(a)||R(r,a)}let N=[e,...e.querySelectorAll($)].filter(o=>o.matches($)&&!s(o));for(let o of N)for(let r of o.children)s(r)||R(`\u5370 ${_nullishCoalesce(r.getAttribute("data-testid"), () => (r.tagName))}`,r);let L=[e,...e.querySelectorAll(S)].filter(o=>o.namespaceURI===x&&o.matches(S)&&!s(o));for(let o of L){b+=1;let r=K(o),a=o.getAttribute("data-cui-stroke"),u=o.getAttribute("data-cui-fill"),p=o.closest("[data-cui-surface]");if(a===null&&u===null||p===null){n.push(`\u5F79\u5272\u306E\u7121\u3044\u56F3\u5F62: ${r}`);continue}let f=p.getAttribute("data-cui-surface");u!==null&&u!==f&&n.push(`\u9762\u3068\u9055\u3046\u5857\u308A: ${r}: ${u} on ${f}`);let m=u===null?null:z(p),D=m===null?p:m;if(a!==null){let k=m===null?[f]:[f,m.getAttribute("data-cui-surface")];for(let g of k)B(a)&&Object.hasOwn(M[a],g)?c.add(`${a}/${g}`):n.push(`\u8868\u306B\u7121\u3044\u7DDA\u306E\u7D44: ${r}: ${a} on ${g}`)}n.push(...O(r,o,D))}return{failures:n,measured:i,texts:d,measuredGraphics:c,graphics:b}};exports.installDialogModel = I; exports.openModals = _; exports.pressEscape = C; exports.scanColourRoles = W; exports.sendCloseRequest = A;
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
declare const openModals: () => readonly HTMLDialogElement[];
|
|
2
|
+
declare const sendCloseRequest: (dialog: HTMLDialogElement) => boolean;
|
|
2
3
|
declare const pressEscape: (dialog: HTMLDialogElement) => boolean;
|
|
3
4
|
declare const installDialogModel: () => void;
|
|
5
|
+
type RoleScanOptions = {
|
|
6
|
+
readonly exclude: readonly string[];
|
|
7
|
+
};
|
|
4
8
|
type RoleScanResult = {
|
|
5
9
|
readonly failures: readonly string[];
|
|
6
10
|
readonly measured: ReadonlySet<string>;
|
|
@@ -8,5 +12,5 @@ type RoleScanResult = {
|
|
|
8
12
|
readonly measuredGraphics: ReadonlySet<string>;
|
|
9
13
|
readonly graphics: number;
|
|
10
14
|
};
|
|
11
|
-
declare const scanColourRoles: (root: Element) => RoleScanResult;
|
|
12
|
-
export { type RoleScanResult, installDialogModel, openModals, pressEscape, scanColourRoles };
|
|
15
|
+
declare const scanColourRoles: (root: Element, options?: RoleScanOptions) => RoleScanResult;
|
|
16
|
+
export { type RoleScanOptions, type RoleScanResult, installDialogModel, openModals, pressEscape, scanColourRoles, sendCloseRequest };
|