@aiquants/console-ui 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -6
- package/dist/chunk-K46FVHUL.js +1 -0
- package/dist/chunk-RA33TN5N.js +1 -0
- package/dist/chunk-W3FRNSCO.cjs +1 -0
- package/dist/chunk-XLOWKWII.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +185 -2
- package/dist/core.d.ts +185 -2
- package/dist/core.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/styles/console-ui.css +34 -3
- package/dist/testing.cjs +1 -1
- package/dist/testing.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-7M4I26BS.cjs +0 -1
- package/dist/chunk-FXEGLGL7.js +0 -1
- package/dist/chunk-H4DAGEIG.js +0 -1
- package/dist/chunk-WUST5VT6.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as vt,A as qa,B as Ga,C as Va,D as Wa,E as za,F as Ja,G as yt,H as ft,I as mt,J,K as U,L as Xa,M as $,N as ja,O as gt,P as bt,Q as Ya,R as ht,S as Za,T as Qa,U as ei,V as Ie,W as $e,X as Rt,Y as Fe,Z as Tt,_ as Et,a as ce,aa as xt,b as Pa,ba as Ae,c as ut,ca as oi,d as Na,da as ai,e as Ca,ea as ii,f as D,fa as si,g as ka,ga as di,h as La,i as Sa,j as Ma,k as Ia,l as $a,m as Fa,n as ct,o as Me,p as Aa,q as z,r as Da,s as pt,t as M,u as Ha,v as Oa,w as Ka,x as Ua,y as Ba,z as _a}from"./chunk-H4DAGEIG.js";import{a as ti,b as ni,c as ri,d as wt}from"./chunk-FXEGLGL7.js";import{useEffect as Xn,useRef as jn}from"react";import{useId as Bn,useRef as _n}from"react";import{createContext as Pn,useCallback as Nn,useContext as St,useLayoutEffect as Cn,useMemo as Pt,useRef as Nt}from"react";import{jsx as Lt,jsxs as An}from"react/jsx-runtime";var De=Pn(null),Mt=" ",Ct='[inert], [aria-hidden="true" i]',It="dialog:modal",He="data-cui-dialog-announcer",kn=`:scope > [${He}]`,Ln=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(i=>i.contains(o)),r=a.length>0?a:n;if(r.every(i=>i.contains(e)))return{region:e};let s=r.find(i=>r.every(l=>l.contains(i)));if(s===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=s.querySelector(kn);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}},Sn=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}},pe=150,Mn=1e3,kt=new WeakMap,In=(e,t)=>{let n=kt.get(e)??new Set,o={text:t};kt.set(e,n.add(o)),setTimeout(()=>n.delete(o),pe);let a=e.ownerDocument.createElement("span");a.textContent=[...n].map(r=>r.text).join(Mt),e.replaceChildren(a)},$n=({locale:e,formatLocale:t,timeZone:n,accessFailure:o,testId:a,children:r})=>{if(St(De)!==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),[i]=Intl.getCanonicalLocales(t),l=Pt(()=>new Intl.DateTimeFormat(i,{timeZone:n}).resolvedOptions().timeZone,[i,n]),p=Nt(null),u=Nt(null);Cn(()=>{Sn(p.current.ownerDocument)},[]);let c=Nn(m=>{if(m.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let f=()=>{let{texts:y,settle:E,deadline:R}=u.current;u.current=null,clearTimeout(E),clearTimeout(R);let T=p.current;if(T===null)return;let v=y.join(Mt),k=Ln(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: ${v}`);In(k.region,v)},h=u.current;if(h===null){u.current={texts:[m],settle:setTimeout(f,pe),deadline:setTimeout(f,Mn)};return}h.texts.push(m),clearTimeout(h.settle),h.settle=setTimeout(f,pe)},[]),b=Pt(()=>({locale:e,formatLocale:i,timeZone:l,labels:d,announce:c,accessFailure:o}),[e,i,l,d,c,o]);return Lt(De.Provider,{value:b,children:An("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(De);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},g=()=>{C()},Oe=()=>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 ye=e=>{let t=e.currentTarget;t.ownerDocument.activeElement!==t&&t.focus({preventScroll:!0})};import{useLayoutEffect as Dn}from"react";var Hn=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"]),On=e=>{for(let t of e.querySelectorAll("*")){let n=t.localName;if(!Hn.has(n)||t.hasAttribute("tabindex")||t.hasAttribute("contenteditable"))return n}return null},H=(e,{testId:t,part:n,host:o})=>{Dn(()=>{let a=On(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 Kn}from"react/jsx-runtime";var P=({fg:e,type:t,face:n,as:o="span",space:a,testId:r,id:s,tabIndex:d,ref:i,children:l})=>(g(),Kn(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:s,tabIndex:d,ref:i,children:l}));var Un=/\s/,Ke=(e,t)=>{if(e===""||Un.test(e))throw new RangeError(`The id of ${t} must be one token without whitespace: "${e}"`);return e},X=(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 Ke(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 zn}from"react/jsx-runtime";var qn={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"}},Ue=({subject:e,children:t})=>{let n=_n(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:s,expanded:d,controls:i,ref:l,dataAttributes:p,busy:u,busyLabel:c})=>{g();let b=Bn(),m=X(r,b),f=u===!0||r!==void 0,h=qn[e],y=E=>{if(ye(E),f){E.preventDefault();return}a?.(E)};return zn("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":u===!0?!0:void 0,"aria-describedby":B(s,m),"aria-expanded":d,"aria-controls":i,onClick:y,ref:l,...w(p),children:O(Ue,{subject:{testId:n,part:"label",host:"button"},children:u===!0?c:t})}),r?.reason===void 0?null:O(P,{fg:"fg-muted",type:"body",id:b,testId:`${n}-reason`,children:r.reason})]})},Gn=({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(Ue,{subject:{testId:n,part:"label",host:"button"},children:t})})),Vn=/^[^\s#]+$/,Wn=({targetId:e,children:t,testId:n,onFollow:o,dataAttributes:a})=>{if(g(),!Vn.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(Ue,{subject:{testId:n,part:"label",host:"link"},children:t})})};import{jsx as $t}from"react/jsx-runtime";var Jn=({gap:e,testId:t,children:n})=>(g(),$t("div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:n})),Be=({gap:e,as:t="div",testId:n,children:o})=>(g(),$t(t,{className:"cui-cluster","data-cui-gap":e,"data-testid":n,children:o}));import{jsx as fe,jsxs as Ft}from"react/jsx-runtime";var Yn=new Set(["sign-in","sign-in-again","sign-in-again-in-new-window"]),Zn=" ",Qn=({view:e,handlers:t,testId:n})=>{let o=Oe(),a=e.actions.map(({action:d,label:i})=>{let l=t[d];if(l===void 0)throw new TypeError(`AccessFailureNotice: no handler for the action ${JSON.stringify(d)}`);return{action:d,label:i,handler:l}}),r=e.politeness==="status"?[e.title,...e.sentences].join(Zn):null,s=jn(null);return Xn(()=>{r===null||s.current===r||(s.current=r,o(r))},[o,r]),Ft("div",{className:"cui-access-failure","data-cui-access-failure":e.kind,"data-testid":n,children:[Ft("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:[fe("p",{className:"cui-access-failure-title","data-cui-measure":"reading","data-testid":`${n}-title`,children:e.title}),e.sentences.map(d=>fe("p",{className:"cui-access-failure-sentence","data-cui-measure":"reading",children:d},d))]}),a.length===0?null:fe(Be,{gap:"space-2",testId:`${n}-actions`,children:a.map(({action:d,label:i,handler:l})=>fe(I,{variant:Yn.has(d)?"primary":"secondary",onClick:l,testId:`${n}-${d}`,children:i},d))})]})};var me=(e,t,n)=>{e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n(t))};import{jsx as ne,jsxs as At}from"react/jsx-runtime";var er=({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 ne("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:[ne("a",{className:"cui-link",href:r.href,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":`${o}-${r.id}`,onClick:s=>me(s,r.href,n),children:r.label}),ne("span",{className:"cui-breadcrumb-separator","aria-hidden":"true","data-cui-fg":"fg-muted",children:"\u203A"})]},r.id)),ne("li",{className:"cui-breadcrumb-item",children:ne("span",{"aria-current":"page","data-cui-fg":"fg","data-testid":`${o}-current`,children:t})})]})})};import{useId as Dt}from"react";import{useCallback as tr}from"react";var nr=229,rr=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),ge=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&rr.has(e.type)&&(e.value!==""||e.validity.badInput),_e=e=>e.nativeEvent.isComposing||e.keyCode===nr,_=(e,t)=>{e.key!=="Escape"||_e(e)||ge(e.target)||(e.stopPropagation(),t())},or=e=>tr(t=>_(t,e),[e]);import{Fragment as sr,jsx as q,jsxs as re}from"react/jsx-runtime";var Ht=e=>e===void 0?void 0:t=>_(t,e),qe=({id:e,title:t,description:n,actions:o,onEscape:a,testId:r,headingRef:s,ref:d,dataAttributes:i,children:l})=>{g();let p=Dt(),u=Ht(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":r,ref:d,onKeyDown:u,...w(i),children:[re("div",{className:"cui-card-header",children:[re("div",{className:"cui-card-heading",children:[q("h2",{className:"cui-card-title",id:p,"data-cui-type":"title","data-testid":`${r}-heading`,ref:s,tabIndex:s===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})]}),l]})},ar={3:"h3",4:"h4"},ir=({id:e,title:t,subtitle:n,level:o=3,region:a=!1,onEscape:r,testId:s,headingRef:d,ref:i,dataAttributes:l,children:p})=>{g();let u=Dt(),c=Ht(r),b=ar[o],m=re(sr,{children:[re("div",{className:"cui-card-section-heading",children:[q(b,{className:"cui-card-section-title",id:u,"data-cui-type":"body","data-testid":`${s}-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":u,"data-testid":s,ref:i,onKeyDown:c,...w(l),children:m}):q("div",{className:"cui-card-section",id:e,"data-testid":s,ref:i,...w(l),children:m})};import{jsx as Ot}from"react/jsx-runtime";var dr=({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 ur}from"react";import{jsx as lr}from"react/jsx-runtime";var j=({ruleKey:e,css:t})=>lr("style",{href:e,precedence:"cui",children:t});import{jsx as L,jsxs as G}from"react/jsx-runtime";var cr=({caption:e,attributes:t,columns:n,attributePx:o,columnMinPx:a,testId:r})=>{g();let s=ur();for(let u of[o,a])if(!(Number.isFinite(u)&&u>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${u}`);if(n.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let u of n)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=o+n.length*a,i=`cui-comparison-a${o}-c${a}-n${n.length}`,l=u=>`[data-cui-comparison="${i}"][data-cui-comparison-layout="${u}"]`,p=`${l("table")}{display:none}@container (min-width:${$(d)}){${l("table")}{display:block}${l("stack")}{display:none}}`;return G("div",{className:"cui-container","data-cui-stack-below-px":d,"data-testid":r,children:[L(j,{ruleKey:i,css:p}),L("div",{className:"cui-comparison-frame","data-cui-comparison":i,"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:$(o)}}),n.map(u=>L("col",{},u.key))]}),L("thead",{children:G("tr",{children:[L("td",{}),n.map(u=>L("th",{scope:"col",children:u.heading},u.key))]})}),L("tbody",{children:t.map(u=>G("tr",{children:[L("th",{scope:"row",children:u.label}),n.map(c=>L("td",{children:c.cells[u.key]("table")},c.key))]},u.key))})]})}),L("div",{className:"cui-comparison-stack","data-cui-comparison":i,"data-cui-comparison-layout":"stack",children:n.map((u,c)=>{let b=`${s}-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:u.heading}),L("dl",{className:"cui-comparison-list",children:t.map(m=>G("div",{children:[L("dt",{children:m.label}),L("dd",{children:u.cells[m.key]("stack")})]},m.key))})]},u.key)})})]})};import{Fragment as gr,useCallback as br,useId as hr,useLayoutEffect as Bt,useRef as ze}from"react";var oe="[data-cui-row-focus]",Ge="[data-cui-row-detail]",pr=e=>e===null?[]:[...e.querySelectorAll(`:scope > ${oe}`)],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(oe)?(o+=1,n.set(a,o)):o>=0&&a.matches(Ge)&&n.set(a,o);return n},Ut=(e,t,n,o)=>{let a=pr(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 yr,useLayoutEffect as Ve,useReducer as fr,useRef as We}from"react";var mr=e=>e+1,ae=e=>{let t=We(e),n=We(null),o=We(!1),[,a]=fr(mr,0),r=yr((s=>()=>{o.current&&s.contains(document.activeElement)&&(n.current=s,a())}),[]);return Ve(()=>(o.current=!0,()=>{o.current=!1,n.current=null}),[]),Ve(()=>{t.current=e}),Ve(()=>{let s=n.current;if(s===null)return;n.current=null;let d=[null,document.body].includes(document.activeElement);s.isConnected||!d||t.current(s)?.focus()}),r};import{jsx as S,jsxs as be}from"react/jsx-runtime";var Rr=new Map,Tr='a[href], audio[controls], button, details, embed, iframe, img[usemap], input:not([type="hidden"]), label, select, textarea, video[controls], [tabindex], [contenteditable]',Er=(e,t,n)=>{Bt(()=>{let o=e.current;if(t!=="row-compact"||o===null)return;let a=[...o.querySelectorAll(Tr)].find(r=>r.parentElement!==o);if(a!==void 0)throw new RangeError(`${n}: a compact row holds no control or focus target (a ${z} px target does not fit its ${pt} px; use row-control), not <${a.localName}>`)})},vr=(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}),wr=(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})})},Pr=({caption:e,captionHidden:t,columns:n,rows:o,rowKey:a,rowTestId:r,rowData:s,rowSize:d,rowDetail:i,empty:l,testId:p,ref:u})=>{g();let c=hr(),b=ze(null);Er(b,d,p);let m=ze(null),f=ze(Rr),h=ae(R=>Ut(R,b.current,m.current,f.current));Bt(()=>{f.current=Kt(b.current,m.current)});let y=br(R=>{m.current=R;let T=h(R);return()=>{m.current=null,T()}},[h]),E=bt(n);return vr(n,p),S("div",{className:"cui-container","data-testid":p,ref:u,children:o.length===0?S(P,{as:"p",fg:"fg-muted",type:"prose",tabIndex:-1,ref:y,testId:`${p}-empty`,children:l}):S("section",{ref:h,className:"cui-table-frame",tabIndex:0,"aria-labelledby":c,"data-testid":`${p}-frame`,children:be("table",{className:"cui-table","data-cui-type":"body","data-cui-row-size":d,style:{"--cui-table-min":$(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:$(R.width.fixedPx)}},R.key))}),S("thead",{children:S("tr",{children:n.map(R=>be("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=>be(gr,{children:[S("tr",{ref:h,tabIndex:-1,"data-cui-row-focus":"","data-testid":r,...w(s?.(R)),children:n.map(T=>T.rowHeader===!0?be("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))}),i===void 0?null:wr(i,R,n.length,r,h)]},a(R)))})]})})})};import{jsx as Je,jsxs as Cr}from"react/jsx-runtime";var Nr=({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 Je("dl",{className:"cui-description-list","data-cui-type":"body","data-testid":t,children:e.map(n=>Cr("div",{className:"cui-description-row","data-testid":`${t}-${n.key}`,children:[Je("dt",{"data-cui-fg":"fg-secondary",children:n.term}),Je("dd",{"data-cui-fg":"fg",children:n.description})]},n.key))})};import{useId as _t,useLayoutEffect as qt,useRef as Xe}from"react";import{jsx as ie,jsxs as Vt}from"react/jsx-runtime";var Gt=e=>{e instanceof HTMLElement&&e.isConnected&&e.focus()},kr=(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},Lr=(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")},Sr=e=>e instanceof HTMLInputElement&&e.type==="search",Mr=({title:e,description:t,open:n,onClose:o,initialFocus:a,testId:r,children:s})=>{let{labels:d}=C(),i=_t(),l=_t(),p=Xe(null),u=Xe(null),c=Xe(!1);return qt(()=>{let y=p.current;if(n&&!y.open){let E=a===void 0?null:kr(y,a.current);u.current=y.ownerDocument.activeElement,y.showModal(),E!==null&&Lr(y,E)}else!n&&y.open&&y.close()},[n,a]),qt(()=>{let y=p.current;return()=>{y.open&&(y.close(),Gt(u.current),u.current=null)}},[]),Vt("dialog",{className:"cui-dialog","aria-labelledby":i,"aria-describedby":t===void 0?void 0:l,"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(u.current),u.current=null,n&&o())},onCancel:y=>{let E=c.current;c.current=!1,(E||ge(y.currentTarget.ownerDocument.activeElement))&&y.preventDefault()},onKeyDownCapture:y=>{let E=_e(y);c.current=E,y.key==="Escape"&&!E&&ge(y.target)&&!Sr(y.target)&&y.preventDefault()},onKeyUpCapture:()=>{c.current=!1},children:[Vt("div",{className:"cui-dialog-header",children:[ie("h2",{className:"cui-dialog-title",id:i,"data-cui-type":"title",children:e}),ie("div",{className:"cui-dialog-actions",children:ie(I,{variant:"secondary",testId:`${r}-close`,onClick:()=>p.current?.close(),children:d.close})})]}),t===void 0?null:ie("div",{id:l,"data-cui-measure":"reading","data-testid":`${r}-description`,children:t}),s,ie("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true",[He]:"","data-testid":`${r}-announcer`})]})};import{useId as Ir,useRef as $r}from"react";import{jsx as je,jsxs as Wt}from"react/jsx-runtime";var Fr=({summary:e,open:t,onOpenChange:n,testId:o,children:a})=>{g();let r=Ir(),s=$r(null);return H(s,{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:[je("span",{className:"cui-disclosure-marker","aria-hidden":"true",children:t?"\u25BE":"\u25B8"}),je("span",{ref:s,children:e})]}),je("div",{className:"cui-disclosure-panel",id:r,hidden:!t,"data-testid":`${o}-panel`,children:a})]})};import{accessFailureKindOfStatus as Dr}from"@aiquants/auth-core";import{Fragment as Hr}from"react";import{jsx as zt}from"react/jsx-runtime";var Ar=({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})),se=({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 Ye=({failure:e,place:t,deniedSentence:n,failed:o,retry:a,testId:r})=>{let{labels:s,accessFailure:d}=C();if(n.trim()==="")throw new RangeError("FailureMessage: deniedSentence must be a non-empty sentence");let i=e.status===null?null:Dr(e.status);return i===null?Jt(se,{occurrence:e.occurrence,testId:r,children:s.failureSentence(e,o)}):Jt(Hr,{children:d({kind:i,place:t,deniedSentence:i==="forbidden"?s.forbiddenBecause(n,e.reason):null,retry:a})},e.occurrence)};import{useId as Y}from"react";import{Fragment as Wr,jsx as x,jsxs as F}from"react/jsx-runtime";var Or=/\s/,Ze=e=>{if(e!==void 0&&(typeof e!="string"||e===""||Or.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},Z=({description:e,error:t,errorId:n})=>{g();let o=Y(),a=Y(),r=Y(),s=n===void 0?r:Ke(n,"a field's error"),d=[e===void 0?null:a,t===void 0?null:s].filter(l=>l!==null).join(" ");return{control:{id:o,"aria-describedby":d===""?void 0:d,"aria-invalid":t===void 0?void 0:!0},descriptionId:a,errorId:s}},Q=({description:e,error:t,descriptionId:n,errorId:o,testId:a})=>F(Wr,{children:[e===void 0?null:x(P,{as:"p",fg:"fg-muted",type:"body",id:n,testId:`${a}-description`,children:e}),t===void 0?null:x(P,{as:"p",fg:"danger-fg",type:"body",id:o,testId:`${a}-error`,children:t})]}),he=({htmlFor:e,hidden:t,children:n})=>x("label",{className:t===!0?"cui-visually-hidden":"cui-field-label",htmlFor:e,"data-cui-type":"body",children:n}),Kr=({label:e,description:t,error:n,errorId:o,testId:a,children:r})=>{let{control:s,descriptionId:d,errorId:i}=Z({label:e,description:t,error:n,errorId:o});return F("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":a,children:[x(he,{htmlFor:s.id,hidden:void 0,children:e}),r(s),x(Q,{description:t,error:n,descriptionId:d,errorId:i,testId:a})]})},jt=({label:e,description:t,error:n,errorId:o,value:a,onValueChange:r,type:s,name:d,maxLength:i,list:l,autoComplete:p,inputMode:u,prefix:c,labelHidden:b,required:m,testId:f,ref:h})=>{let{control:y,descriptionId:E,errorId:R}=Z({label:e,description:t,error:n,errorId:o}),T=Y();if(c!==void 0&&c.trim()==="")throw new RangeError("An input's prefix must not be blank");if(i!==void 0&&s==="datetime-local")throw new RangeError(`A ${s} input takes no maxLength: ${i}`);let v=s==="password",k=x("input",{className:"cui-input",type:s,name:Ze(d),maxLength:Xt(i),value:a,list:l,autoComplete:p,inputMode:u,spellCheck:v?!1:void 0,autoCapitalize:v?"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 F("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${f}-field`,children:[x(he,{htmlFor:y.id,hidden:b,children:e}),c===void 0?k:F("div",{className:"cui-input-group",children:[x("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]}),x(Q,{description:t,error:n,descriptionId:E,errorId:R,testId:f})]})},Ur=e=>x(jt,{...e}),Br=e=>x(jt,{...e,type:"password"}),_r=({label:e,description:t,error:n,errorId:o,value:a,onValueChange:r,name:s,maxLength:d,required:i,testId:l,ref:p})=>{let{control:u,descriptionId:c,errorId:b}=Z({label:e,description:t,error:n,errorId:o});return F("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${l}-field`,children:[x(he,{htmlFor:u.id,hidden:void 0,children:e}),x("textarea",{className:"cui-input cui-textarea",name:Ze(s),maxLength:Xt(d),value:a,required:i,onChange:m=>r(m.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":l,ref:p,...u}),x(Q,{description:t,error:n,descriptionId:c,errorId:b,testId:l})]})},qr=({label:e,description:t,error:n,errorId:o,value:a,options:r,onValueChange:s,name:d,labelHidden:i,unavailable:l,testId:p,ref:u})=>{let{control:c,descriptionId:b,errorId:m}=Z({label:e,description:t,error:n,errorId:o}),f=Y(),h=X(l,f);return F("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${p}-field`,children:[x(he,{htmlFor:c.id,hidden:i,children:e}),x("select",{className:"cui-input",name:Ze(d),value:a,onChange:y=>{l===void 0&&s(y.target.value)},"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":p,ref:u,...c,"aria-disabled":l===void 0?void 0:!0,"aria-describedby":B(c["aria-describedby"],h),children:r.map(y=>x("option",{value:y.value,children:y.label},y.value))}),x(Q,{description:t,error:n,descriptionId:b,errorId:m,testId:p}),l?.reason===void 0?null:x(P,{as:"p",fg:"fg-muted",type:"body",id:f,testId:`${p}-reason`,children:l.reason})]})},Gr=({legend:e,description:t,error:n,errorId:o,value:a,options:r,onValueChange:s,testId:d,ref:i})=>{let l=Y(),{control:p,descriptionId:u,errorId:c}=Z({label:e,description:t,error:n,errorId:o});return F("fieldset",{className:"cui-radio-group","aria-describedby":p["aria-describedby"],"data-invalid":n!==void 0,"data-testid":d,children:[x("legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),r.map((b,m)=>F("label",{className:"cui-radio","data-cui-type":"body",children:[x("input",{type:"radio",name:l,value:b.value,checked:b.value===a,onChange:()=>s(b.value),"aria-invalid":p["aria-invalid"],"data-testid":`${d}-option-${b.value}`,ref:m===0?i:void 0}),x("span",{children:b.label})]},b.value)),x(Q,{description:t,error:n,descriptionId:u,errorId:c,testId:d})]})},Vr=({legend:e,description:t,error:n,errorId:o,values:a,options:r,onValuesChange:s,testId:d,ref:i})=>{let{control:l,descriptionId:p,errorId:u}=Z({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 F("fieldset",{className:"cui-checkbox-group","aria-describedby":l["aria-describedby"],"data-invalid":n!==void 0,"data-testid":d,children:[x("legend",{className:"cui-checkbox-group-legend","data-cui-type":"body",children:e}),r.map((f,h)=>F("label",{className:"cui-checkbox","data-cui-type":"body",children:[x("input",{type:"checkbox",value:f.value,checked:m.has(f.value),onChange:()=>s(c.filter(y=>y===f.value?!m.has(y):m.has(y))),"aria-invalid":l["aria-invalid"],"data-testid":`${d}-option-${f.value}`,ref:h===0?i:void 0}),x("span",{children:f.label})]},f.value)),x(Q,{description:t,error:n,descriptionId:p,errorId:u,testId:d})]})};import{createContext as zr,useContext as Jr,useId as tn,useMemo as Xr}from"react";import{Fragment as an,jsx as N,jsxs as Re}from"react/jsx-runtime";var nn=zr(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"},jr=["normal","high"],Yr=[1,2,3,4],A=M.space["space-2"],Zr="fg",Qr="fg-secondary",on=e=>{let t=Jr(nn);if(t===null)throw new Error(`${e} must be rendered inside Figure`);return t},Qe=(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}`)},eo=e=>{g();let t=tn(),{kind:n,widthPx:o,heightPx:a,testId:r,dataAttributes:s,children:d}=e;Qe(r,"widthPx",o),Qe(r,"heightPx",a);let i=Xr(()=>({kind:n,widthPx:o,heightPx:a,arrowIds:{normal:`${t}-arrow-normal`,high:`${t}-arrow-high`}}),[n,o,a,t]),l=Re(an,{children:[N("defs",{children:jr.map(b=>N("marker",{id:i.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:i,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":$(o),"--cui-figure-block":$(a)},onKeyDown:m===void 0?void 0:f=>_(f,m),"data-testid":r,...w(s),children:l})})}let{viewBox:p,pointer:u,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":u===void 0?void 0:"true","data-cui-cursor":u?.cursor,style:{"--cui-figure-inline":$(o),"--cui-figure-ratio":String(a/o)},"data-testid":r,...w(s),...u?.handlers,children:l})})},en=(e,t)=>{try{return t()}catch(n){throw new RangeError(`${e}: ${n.message}`,{cause:n})}},to=(e,t,n)=>{for(let o of t){let a=wt.light[o.fg],r=n.find(s=>a[s]===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`)}},no=e=>{g();let t=on("FigureNode"),n=tn(),{x:o,y:a,shape:r,tone:s,outline:d,selected:i,name:l,title:p,press:u,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"&&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 f=i?Qt:Zt[s];to(c,m,[Zt[s].face,Qt.face]);let h,y,E;if(r.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 T=en(c,()=>yt({name:l,notes:m.map(k=>k.text)}));if(Qe(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 v=ft(m.length);y=Re("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:v.insetPx,y:v.namePx,fontSize:M.type.body.size,"data-cui-fg":Zr,"data-cui-figure-type":"body","data-testid":`${c}-name`,children:l}),m.map((k,K)=>N("text",{x:v.insetPx,y:v.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(l,r.radiusPx));h={width:2*r.radiusPx,height:2*r.radiusPx,left:o-r.radiusPx,top:a-r.radiusPx},y=Re(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`})}),l===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":Qr,"data-cui-figure-type":"caption","data-testid":`${c}-name`,children:l})]}),E=N("circle",{className:"cui-figure-ring",r:r.radiusPx+U,"data-cui-stroke":"focus","data-testid":`${c}-ring`})}if(u!==void 0){if(h.width<z||h.height<z)throw new RangeError(`${c}: a pressable node must be at least the ${z} px target: ${h.width} \xD7 ${h.height}`);if(h.left<J||h.top<J||h.left+h.width+J>t.widthPx||h.top+h.height+J>t.heightPx)throw new RangeError(`${c}: a pressable node must keep ${J} px to the figure's edge for its focus ring`)}let R=u===void 0?{}:{role:"button",tabIndex:0,"aria-label":u.label,"aria-describedby":u.description===void 0?void 0:n,"aria-expanded":u.expanded,"aria-controls":u.expanded?u.controls:void 0,onClick:T=>{T.currentTarget.focus(),u.onPress()},onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),T.repeat||u.onPress())}};return Re("g",{className:"cui-figure-node",transform:`translate(${o} ${a})`,"data-cui-tone":s,"data-cui-outline":d,"data-selected":String(i),...R,"data-testid":c,...w(b),children:[p===void 0?null:N("title",{children:p}),u?.description===void 0?null:N("desc",{id:n,"data-testid":`${c}-description`,children:u.description}),u===void 0?null:E,y]})},ro=({d:e,emphasis:t,weight:n,arrow:o,title:a,testId:r,dataAttributes:s})=>{g();let d=on("FigureEdge");if(!Yr.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(s),children:a===void 0?null:N("title",{children:a})})};import{jsx as io}from"react/jsx-runtime";var oo={1:"h1",2:"h2",3:"h3"},ao=({level:e,type:t,testId:n,headingRef:o,children:a})=>{g();let r=oo[e];return io(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 uo}from"react/jsx-runtime";var so={removed:"danger-tint",added:"success-tint"},lo=({kind:e,testId:t,children:n})=>{if(g(),n==="")throw new RangeError(`${t}: a changed fragment must hold at least one character`);return uo(e==="removed"?"del":"ins",{className:"cui-change","data-cui-change":e,"data-cui-surface":so[e],"data-cui-fg":"fg","data-testid":t,children:n})};import{jsx as yo}from"react/jsx-runtime";var co={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"}},po={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},et=({tone:e,variant:t,testId:n,dataAttributes:o,children:a})=>{g();let r=t==="tint"?co[e]:{fg:"on-solid",surface:po[e]};return yo("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 fo}from"react";import{jsx as de,jsxs as mo}from"react/jsx-runtime";var tt=({label:e,valueText:t,value:n,max:o,testId:a})=>{g();let r=fo();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 s=o===null?null:{max:o,now:Math.min(n,o)};return mo("div",{className:"cui-progress","data-testid":a,children:[de(P,{as:"p",fg:"fg",type:"body",id:r,children:e}),de("div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":r,"aria-valuetext":t,"aria-valuemin":s===null?void 0:0,"aria-valuemax":s?.max,"aria-valuenow":s?.now,"data-cui-surface":"sunken","data-cui-indeterminate":s===null,"data-testid":`${a}-bar`,children:de("div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:s===null?void 0:{inlineSize:`${s.now/s.max*100}%`},"data-testid":`${a}-fill`})}),de("div",{"aria-hidden":"true",children:de(P,{as:"p",fg:"fg-secondary",type:"body",testId:`${a}-value`,children:t})})]})};import{jsx as Te,jsxs as sn}from"react/jsx-runtime";var go=({title:e,status:t,progress:n,cancel:o,testId:a,children:r})=>sn(qe,{title:e,actions:o===void 0?void 0:Te(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:[Te("span",{className:"cui-visually-hidden",children:`${e} `}),Te(et,{tone:t.tone,variant:"tint",testId:`${a}-status-pill`,children:t.label})]}),n===void 0?null:Te(tt,{...n,testId:`${a}-progress`}),r]});import{createContext as bo,useContext as ho}from"react";import{jsx as le}from"react/jsx-runtime";var nt=bo(null),Ro="space-2",To=e=>{g();let{gap:t,label:n,id:o,hidden:a,testId:r,children:s}=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,i=d!==void 0,l=e.marker==="number"||e.marker==="none"&&e.ordered?"ol":"ul";return le(nt.Provider,{value:e.marker,children:le(l,{className:"cui-list",role:"list","aria-label":n,id:o,hidden:a,"data-cui-gap":i?void 0:t,"data-cui-row-gap":i?t:void 0,"data-cui-column-gap":i?Ro:void 0,"data-cui-marker":i?e.marker:void 0,"data-cui-type":d,"data-testid":r,children:s})})},Eo=({testId:e,dataAttributes:t,children:n})=>{g();let o=ho(nt);if(o===null)throw new Error("ListItem must be rendered inside List, not inside another ListItem");return le("li",{className:"cui-list-item","data-testid":e,...w(t),children:le("div",{className:"cui-list-body","data-cui-measure":o==="none"?void 0:"reading",children:le(nt.Provider,{value:null,children:n})})})};import{useCallback as dn,useLayoutEffect as vo,useRef as Ee}from"react";import{jsx as ve,jsxs as No}from"react/jsx-runtime";var ln=e=>[...e.querySelectorAll(oe)].filter(t=>{let n=t.closest(Ge);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} ${oe} elements for ${e.count} rows`);return n},wo=(e,t)=>{let n=-1;return e.forEach((o,a)=>{t.has(o)&&(n=a)}),e[n+1]},Po=({onLoad:e,busy:t,done:n,failure:o,limit:a,rows:r,testId:s})=>{let{formatLocale:d,labels:i}=C(),l=Ee(null),p=Ee(null),u=Ee(null),c=Ee(!1),b=()=>{let y=r.ref.current;l.current={shown:new Set(y===null?[]:ln(y)),failureOccurrence:o===null?null:o.occurrence,busySeen:!1},e()};vo(()=>{let y=c.current;c.current=!1;let E=l.current;if(E===null)return;let R=xo(r);if(t){E.busySeen=!0,E.shown=new Set(R);return}let T=wo(R,E.shown),v=o!==null&&o.occurrence!==E.failureOccurrence;if(!(E.busySeen||T!==void 0||v||n)||(l.current=null,v||T===void 0))return;let k=[null,document.body].includes(document.activeElement);(u.current!==null&&document.activeElement===u.current||y&&k)&&T.focus()});let m=ae(()=>n?p.current:u.current),f=dn((y=>{u.current=y;let E=m(y);return()=>{u.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?ve("div",{className:"cui-load-more","data-testid":s,children:ve(P,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:h,testId:`${s}-end`,children:i.endOfRecords})}):No("div",{className:"cui-load-more","data-testid":s,children:[ve(I,{variant:"secondary",busy:t,busyLabel:i.loading,onClick:b,ref:f,testId:`${s}-button`,children:i.loadMore(ce(a,d))}),o===null?null:ve(se,{occurrence:o.occurrence,testId:`${s}-failure`,children:i.loadFailed(o.reason)})]})};import{jsx as rt,jsxs as un}from"react/jsx-runtime";var Co=({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:[rt(j,{ruleKey:r.key,css:r.css}),un("div",{className:"cui-master-detail","data-cui-master-detail":r.key,children:[rt("div",{className:"cui-master-detail-pane","data-testid":`${a}-master`,children:e}),rt("div",{className:"cui-master-detail-pane","data-testid":`${a}-detail`,children:t})]})]})};import{jsx as xe}from"react/jsx-runtime";var we=e=>{let{formatLocale:t,labels:n}=C(),{testId:o}=e;if(e.keep===void 0){let{value:s,unit:d}=e;if(d!==void 0&&!D(d))throw new RangeError(`${o}: a unit must hold a readable character: ${JSON.stringify(d)}`);if(s===null)return xe("span",{className:"cui-measured","data-measured":"false","data-testid":o,children:n.unmeasured});let i=ce(s,t);return xe("span",{className:"cui-measured","data-measured":"true","data-testid":o,children:ut(i,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 Pe,jsxs as Lo}from"react/jsx-runtime";var ko=({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 Lo("span",{className:"cui-meter","data-testid":r,children:[Pe("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:Pe("span",{className:"cui-meter-fill","data-cui-accent":"info-accent",style:{inlineSize:`${(t-n)/(o-n)*100}%`},"data-testid":`${r}-fill`})}),Pe("span",{"aria-hidden":"true",children:Pe(P,{fg:"fg",type:"body",testId:`${r}-value`,children:a})})]})};import{useId as So,useRef as Mo}from"react";import{jsx as ot,jsxs as Fo}from"react/jsx-runtime";var Io={ArrowLeft:-1,ArrowRight:1},$o=({label:e,items:t,value:n,onValueChange:o,testId:a,panelDescribedBy:r,children:s})=>{g();let d=So(),i=Mo(new Map);if(t.length===0)throw new RangeError("PanelTabs needs at least one tab");let l=t.map(f=>f.id);if(new Set(l).size!==l.length)throw new RangeError(`Tab keys must be unique: ${l.join(", ")}`);let p=l.indexOf(n);if(p<0)throw new RangeError(`The selected tab "${n}" is not one of the tabs: ${l.join(", ")}`);let u=f=>`${d}-tab-${f}`,c=`${d}-panel`,b=f=>{let h=t[f];h.id!==n&&o(h.id),i.current.get(h.id)?.focus()};return Fo("div",{className:"cui-panel-tabs","data-testid":a,children:[ot("div",{className:"cui-tabs-list",role:"tablist","aria-label":e,onKeyDown:f=>{let h=t.findIndex(T=>i.current.get(T.id)===f.target),y=h<0?p:h,E=Io[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 ot("button",{className:"cui-tab cui-panel-tab",type:"button",role:"tab",id:u(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?i.current.delete(f.id):i.current.set(f.id,E)},onClick:()=>b(h),children:f.label},f.id)})}),ot("div",{role:"tabpanel",id:c,"aria-labelledby":u(p),"aria-describedby":r,"data-testid":`${a}-panel`,children:s})]})};import{accessFailureKindOfStatus as Ao}from"@aiquants/auth-core";import{jsx as at,jsxs as Ho}from"react/jsx-runtime";var Do=({failure:e,onReload:t,deniedSentence:n,failureMessage:o,rescueRef:a,testId:r})=>{let{labels:s}=C(),d=at(Ye,{failure:e,place:"read",deniedSentence:n,failed:o===void 0?s.loadFailed:o,retry:t,testId:`${r}-alert`});return e.status!==null&&Ao(e.status)!==null?at("div",{className:"cui-resource-failed",ref:a,"data-testid":r,children:d},e.occurrence):Ho("div",{className:"cui-resource-failed","data-testid":r,children:[d,at(I,{variant:"secondary",busy:e.retrying,busyLabel:s.loading,onClick:t,ref:a,testId:`${r}-reload`,children:s.reload})]})};import{useId as Oo}from"react";import{jsx as V,jsxs as cn}from"react/jsx-runtime";var Ko=({label:e,options:t,value:n,onValueChange:o,testId:a,density:r="regular"})=>{g();let s=Oo(),d=new Set(t.map(i=>i.value));if(t.length<2||d.size!==t.length)throw new RangeError(`A segmented control needs at least two options with unique values: ${t.map(i=>i.value).join(", ")}`);if(!d.has(n))throw new RangeError(`The pressed value "${n}" is not one of the options: ${[...d].join(", ")}`);if(r!=="regular"&&r!=="compact")throw new RangeError(`A segmented control's density is "regular" or "compact", not ${JSON.stringify(r)}`);return r==="compact"?cn("fieldset",{className:"cui-segmented-group","aria-labelledby":s,"data-cui-density":"compact","data-testid":a,children:[V("span",{className:"cui-segmented-label",id:s,"data-cui-type":"caption",children:e}),V("div",{className:"cui-segmented",children:t.map(i=>{let l=i.value===n;return V("button",{className:"cui-segment",type:"button","aria-pressed":l,"data-testid":`${a}-${i.value}`,onClick:()=>{l||o(i.value)},children:V("span",{className:"cui-segment-face","data-cui-fg":l?"on-solid":"fg","data-cui-surface":l?"info-solid":void 0,"data-cui-type":"caption","data-testid":`${a}-${i.value}-face`,children:i.label})},i.value)})})]}):cn("fieldset",{className:"cui-segmented-group","data-testid":a,children:[V("legend",{className:"cui-segmented-legend","data-cui-type":"body",children:e}),V("div",{className:"cui-segmented",children:t.map(i=>{let l=i.value===n;return V("button",{className:"cui-segment",type:"button","aria-pressed":l,"data-cui-fg":l?"on-solid":"fg","data-cui-surface":l?"info-solid":void 0,"data-cui-type":"body","data-testid":`${a}-${i.value}`,onClick:()=>{l||o(i.value)},children:i.label},i.value)})})]})};import{useCallback as Uo,useRef as Bo}from"react";import{jsx as ee}from"react/jsx-runtime";var pn=({selected:e,controls:t,onSelect:n,testId:o,dataAttributes:a,ref:r,children:s})=>{g();let d=Bo(null);H(d,{testId:o,part:"row",host:"button"});let i=Uo(p=>{if(d.current=p,typeof r=="function")return r(p);r!=null&&(r.current=p)},[r]);return ee("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=>{ye(p),n()},ref:i,...w(a),children:s})},_o=({label:e,items:t,itemKey:n,selectedKey:o,onSelect:a,detailId:r,renderRow:s,rowTestId:d,rowData:i,empty:l,testId:p,ref:u})=>(g(),ee("div",{className:"cui-selectable","data-testid":p,ref:u,children:t.length===0?ee(P,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:l}):ee("ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let b=n(c);return ee("li",{children:ee(pn,{selected:b===o,controls:r,onSelect:()=>a(c),testId:d,dataAttributes:i?.(c),children:s(c)})},b)})})}));import{useId as qo}from"react";import{jsx as Ne,jsxs as yn}from"react/jsx-runtime";var Go=({label:e,value:t,min:n,max:o,step:a,valueText:r,onValueChange:s,testId:d})=>{g();let i=qo();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 l=r(t);return yn("div",{className:"cui-field","data-testid":`${d}-field`,children:[Ne("label",{className:"cui-field-label",htmlFor:i,"data-cui-type":"body",children:e}),yn("div",{className:"cui-slider",children:[Ne("input",{className:"cui-slider-input",id:i,type:"range",min:n,max:o,step:a,value:t,"aria-valuetext":l,"data-testid":d,onChange:p=>s(p.currentTarget.valueAsNumber)}),Ne("span",{className:"cui-slider-value","aria-hidden":"true",children:Ne(P,{fg:"fg",type:"body",testId:`${d}-value`,children:l})})]})]})};import{jsx as it,jsxs as mn}from"react/jsx-runtime";var fn={done:0,current:1,pending:2},Vo={done:{fg:"on-solid",surface:"success-solid"},current:{fg:"on-solid",surface:"info-solid"},pending:{fg:"fg-secondary",surface:void 0}},Wo=({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,s)=>s>0&&fn[r.state]<fn[t[s-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,s)=>{let d=Vo[r.state],i=a[r.state];return mn("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":s+1}),mn("span",{className:"cui-step-label","data-cui-fg":"fg",children:[r.label,i===null?null:it("span",{className:"cui-visually-hidden",children:` (${i})`})]})]},r.id)})})};import{useId as zo,useRef as Jo}from"react";import{jsx as Ce,jsxs as gn}from"react/jsx-runtime";var Xo=({label:e,labelHidden:t,checked:n,onCheckedChange:o,unavailable:a,testId:r,ref:s,dataAttributes:d})=>{g();let i=zo(),l=Jo(null);H(l,{testId:r,part:"label",host:"button"});let p=X(a,i),u=a!==void 0,c=gn("button",{className:"cui-switch",type:"button",role:"switch","aria-checked":n,"aria-disabled":u?!0:void 0,"aria-describedby":B(p),"data-cui-fg":"fg","data-cui-type":"body","data-testid":r,ref:s,onClick:()=>{u||o(!n)},...w(d),children:[Ce("span",{className:"cui-switch-track","aria-hidden":"true","data-cui-surface":n?"info-solid":"sunken","data-testid":`${r}-track`,children:Ce("span",{className:"cui-switch-thumb","data-cui-surface":n?"surface":"neutral-solid","data-testid":`${r}-thumb`})}),Ce("span",{className:t===!0?"cui-visually-hidden":void 0,ref:l,children:e})]});return a?.reason===void 0?c:gn("span",{className:"cui-button-group",children:[c,Ce(P,{fg:"fg-muted",type:"body",id:i,testId:`${r}-reason`,children:a.reason})]})};import{useCallback as jo,useEffect as Yo,useId as Zo,useRef as bn,useState as Qo}from"react";import{jsx as ue,jsxs as hn}from"react/jsx-runtime";var ea=({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 s=new Set(t.map(m=>m.id));if(s.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: ${[...s].join(", ")}`);let[i,l]=Qo(!1),p=bn(null),u=bn(null),c=Zo(),b=jo(m=>{l(!1),m&&p.current?.contains(document.activeElement)&&u.current?.focus()},[]);return Yo(()=>{if(!(r&&i))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,i,b]),hn("nav",{ref:p,className:"cui-tabs","aria-label":e,"data-testid":a,"data-cui-collapsible":r?"":void 0,"data-cui-open":r&&i?"":void 0,onKeyDown:r&&i?m=>_(m,()=>b(!0)):void 0,children:[r?hn("button",{ref:u,type:"button",className:"cui-tabs-summary","aria-expanded":i,"aria-controls":c,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${a}-summary`,onClick:()=>l(m=>!m),children:[ue("span",{className:"cui-tabs-summary-label",children:d.label}),ue("span",{className:"cui-tabs-summary-marker","aria-hidden":"true",children:i?"\u25B4":"\u25BE"})]}):null,ue("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 ue("li",{className:"cui-tabs-item",children:ue("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=>{me(h,m.href,o),h.defaultPrevented&&b(!1)},children:m.label})},m.id)})})]})};import{Children as ta,Fragment as na,isValidElement as ra}from"react";import{jsx as W,jsxs as Tn}from"react/jsx-runtime";var oa={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},aa=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 Tn("div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":o,"data-testid":a,...w(r),children:[W("p",{className:"cui-tile-label","data-cui-type":"caption","data-cui-measure":"reading",children:t}),W("p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption","data-cui-measure":"reading",children:n}),W("p",{className:"cui-tile-value","data-cui-fg":oa[o],"data-cui-type":"heading","data-cui-measure":"reading",children:e.text===void 0?W(we,{value:e.value,unit:e.unit,testId:d}):W(we,{text:e.text,keep:"wrap",testId:d})})]})},Rn=e=>ta.toArray(e).flatMap(t=>{if(!ra(t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===na?Rn(t.props.children):[t]}),ia=({count:e,minInlinePx:t,testId:n,children:o})=>{g();let a=ht(e,t,M.space["space-2"]),r=Rn(o).length;if(r!==e)throw new RangeError(`TileGrid has ${r} tiles but count is ${e}`);return Tn("div",{className:"cui-container","data-testid":n,children:[W(j,{ruleKey:a.key,css:a.css}),W("div",{className:"cui-tile-grid","data-cui-tile-grid":a.key,"data-cui-gap":"space-2",children:o})]})};import{useLayoutEffect as sa,useRef as En}from"react";import{jsx as la}from"react/jsx-runtime";var ke=e=>[...e.querySelectorAll("button")],da=({label:e,testId:t,children:n})=>{g();let o=En(null),a=En(null);sa(()=>{let i=ke(o.current),l=a.current!==null&&i.includes(a.current)?a.current:i[0]??null;a.current=l;for(let p of i)p.tabIndex=p===l?0:-1});let r=i=>{for(let l of ke(o.current))l.tabIndex=l===i?0:-1;a.current=i};return la("div",{className:"cui-toolbar",role:"toolbar","aria-label":e,"aria-orientation":"horizontal","data-testid":t,ref:o,onFocus:i=>{let l=ke(i.currentTarget).find(p=>p.contains(i.target));l!==void 0&&r(l)},onKeyDown:i=>{let l=ke(i.currentTarget),p=l.indexOf(i.target);if(p===-1)return;let u=getComputedStyle(i.currentTarget).direction==="rtl"?"ArrowLeft":"ArrowRight",c=u==="ArrowRight"?"ArrowLeft":"ArrowRight",m={[u]:(p+1)%l.length,[c]:(p-1+l.length)%l.length,Home:0,End:l.length-1}[i.key];if(m===void 0)return;i.preventDefault();let f=l[m];r(f),f.focus()},children:n})};import{useState as ua}from"react";var ca=e=>{let[t,n]=ua({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count};import{useCallback as te,useEffect as fa,useLayoutEffect as xn,useRef as lt}from"react";import{useCallback as Le,useEffect as pa,useLayoutEffect as ya,useRef as st,useState as dt}from"react";var vn=e=>e===null?Ie:$e,Se=(e,t,n,o,a)=>{let[r,s]=dt(()=>({key:e,state:vn(e)})),[d,i]=dt(0),[l,p]=dt(0),u=st(t),c=st(null),b=st(d);ya(()=>{u.current=t}),pa(()=>{if(e===null){s({key:null,state:Ie});return}let R=new AbortController;c.current=e;let T=d===b.current?"revision":"reload";return b.current=d,s(v=>Object.is(v.key,e)?{key:e,state:o(v.state,T)}:{key:e,state:$e}),u.current(R.signal).then(v=>{R.signal.aborted||(c.current=null,s(k=>({key:e,state:a(k.state,v)})))},v=>{R.signal.aborted||s(()=>{throw v})}),()=>{R.abort(),c.current=null}},[e,n,d,l]);let m=Le(()=>i(R=>R+1),[]),f=Le(()=>p(R=>R+1),[]),h=Le((R,T)=>{s(v=>Object.is(v.key,R)?{key:R,state:T(v.state)}:v)},[]),y=Le((R,T)=>{h(R,T),Object.is(c.current,R)&&f()},[h,f]);return{state:Object.is(r.key,e)?r.state:vn(e),reload:m,refresh:f,update:h,write:y}};var ma=(e,t,n)=>{let o=lt(t);xn(()=>{o.current=t});let a=te(y=>o.current.first(y),[]),{state:r,reload:s,refresh:d,update:i,write:l}=Se(e,a,n,Tt,Et),p=lt({key:e,state:r});xn(()=>{p.current={key:e,state:r}});let u=lt(null),c=te(()=>{u.current?.controller.abort(),u.current=null},[]);fa(()=>c,[e,n,c]);let b=te(()=>{c(),s()},[c,s]),m=te(()=>{c(),d()},[c,d]),f=te(()=>{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:[]};u.current=T,i(y,vt),o.current.next(R,T.controller.signal).then(v=>{u.current===T&&(u.current=null,i(y,k=>T.maps.reduce((K,wn)=>Ae(K,wn),xt(k,R,v))))},v=>{u.current===T&&i(y,()=>{throw v})})},[i]),h=te((y,E)=>{let R=u.current;R!==null&&Object.is(R.key,y)&&R.maps.push(E),l(y,T=>Ae(T,E))},[l]);return{state:r,reload:b,refresh:m,loadMore:f,updateList:h}};import{useCallback as ga,useRef as ba,useState as ha}from"react";var Ra=e=>typeof e=="object"&&e!==null&&typeof e.then=="function",Ta=()=>{let[e,t]=ha(null),n=ba(null),o=ga((a,r)=>{let s=r();if(!Ra(s))return;let d=Symbol(a);n.current=d,t(a);let i=()=>{n.current===d&&(n.current=null,t(null))};s.then(i,i)},[]);return{pendingKey:e,press:o}};import{useCallback as Ea}from"react";var va=(e,t,n)=>{let{state:o,reload:a,refresh:r,write:s}=Se(e,t,n,Rt,Fe),d=Ea((i,l)=>s(i,p=>Fe(p,{ok:!0,value:l})),[s]);return{state:o,reload:a,refresh:r,put:d}};import{jsx as wa}from"react/jsx-runtime";var xa=({testId:e,children:t})=>(g(),wa("span",{className:"cui-visually-hidden","data-testid":e,children:t}));export{pe as ANNOUNCE_SETTLE_MS,Qn as AccessFailureNotice,se as AlertMessage,er as Breadcrumb,I as Button,pt as COMPACT_ROW_PX,Fa as CONSOLE_UI_LABEL_CATALOGS,ri as CONTRAST_MINIMUM,wt as CONTRAST_PAIRS,qe as Card,ir as CardSection,Vr as CheckboxGroup,Be as Cluster,dr as CodeBlock,cr as ComparisonGrid,$n as ConsoleUiRoot,Pr as DataTable,Nr as DescriptionList,Mr as Dialog,Fr as Disclosure,J as FIGURE_RING_REACH_PX,qa as FLEXIBLE_COLUMN_MIN_PX,Ye as FailureMessage,Kr as Field,eo as Figure,ro as FigureEdge,no as FigureNode,Wn as FragmentLink,Za as HTTP_FORBIDDEN,ao as Heading,lo as InlineChange,go as JobCard,Me as LATTICE_PX,Gn as Link,To as List,Eo as ListItem,Po as LoadMore,Co as MasterDetail,we as Measured,ko as Meter,aa as MetricTile,Ar as Notice,$o as PanelTabs,Br as PasswordInput,et as Pill,tt as ProgressBar,Da as ROW_WITH_CONTROL_PX,Gr as RadioGroup,Do as ResourceFailed,pn as RowButton,Ko as SegmentedControl,qr as Select,_o as SelectableList,Go as Slider,Jn as Stack,Wo as Stepper,Xo as Switch,z as TARGET_PX,M as TOKENS,di as TONES,ii as TONE_HUES,si as TONE_ROLES,ea as Tabs,P as Text,_r as TextArea,Ur as TextInput,ia as TileGrid,da as Toolbar,xa as VisuallyHidden,ka as ZonedTimeError,vt as beginPage,Tt as beginPagedReload,Rt as beginReload,Ua as ceil8,Aa as ceilToLattice,Ba as cellContentInlinePx,Ga as comparisonAttributePx,ni as contrastRatio,Wa as countSampleText,Ha as cssVar,yt as figureBoxPlan,mt as figureDiscLabelPlan,Ia as fillLabel,_a as fixedColumnPx,ei as flatMapOutcome,Pa as formatByteSize,ce as formatCount,Ma as formatInstant,Xa as goldenSectionPx,ti as hexToSrgb,Va as instantSampleText,D as isReadableText,Fe as keepLastGood,oi as lightDark,Qa as mapOutcome,Ae as mapPagedList,ja as masterDetailPlan,Ka as monoTextWidthEm,ai as placeholderRule,$ as pxToRem,Na as readDecimalText,Ca as readIntegerText,$a as reasonAside,ct as resolveConsoleUiLabels,Et as settleFirstPage,xt as settlePage,Ja as spacedTextWidthEm,Ya as tableFrameMinInlinePx,bt as tableMinInlinePx,Oa as textWidthEm,ht as tileGridPlan,za as tileMinInlinePx,La as toOffsetIso,Sa as toWallTime,Fn as useAccessFailure,Oe as useAnnounce,C as useConsoleUi,or as useEscapeToClose,ca as useFailureOccurrence,ae as useFocusRescue,ma as usePagedResource,Ta as usePendingPress,va as useResource};
|
|
1
|
+
import{$ as wt,A as za,B as Ja,C as Xa,D as ja,E as Ya,F as Za,G as Qa,H as ei,I as bt,J as ht,K as Rt,L as J,M as U,N as ti,O as F,P as ni,Q as Tt,R as Et,S as ri,T as vt,U as oi,V as ai,W as ii,X as $e,Y as Fe,Z as xt,_ as Ae,a as ct,aa as Pt,b as pt,ba as Nt,c as ce,ca as Ct,d as Ca,da as De,e as yt,ea as si,f as ka,fa as di,g as La,ga as li,h as H,ha as ui,i as Sa,ia as ci,j as Ma,k as Ia,l as $a,m as Fa,n as Aa,o as Da,p as ft,q as Ie,r as Ba,s as z,t as _a,u as gt,v as M,w as qa,x as Ga,y as Va,z as Wa}from"./chunk-K46FVHUL.js";import{a as Ha,e as Oa,f as Ka,g as Ua,h as Me,i as mt}from"./chunk-RA33TN5N.js";import{useEffect as Yn,useRef as Zn}from"react";import{useId as qn,useRef as Gn}from"react";import{createContext as Cn,useCallback as kn,useContext as $t,useLayoutEffect as Ln,useMemo as kt,useRef as Lt}from"react";import{jsx as It,jsxs as Hn}from"react/jsx-runtime";var He=Cn(null),Ft=" ",St='[inert], [aria-hidden="true" i]',Oe="data-cui-dialog-announcer",Sn=`:scope > [${Oe}]`,Mn=e=>{if(e.closest(St)!==null)return{hidden:'an ancestor is inert or aria-hidden="true"'};let t=pt(e.ownerDocument);if(t.kind==="none")return{region:e};if(t.kind==="undecidable")return{hidden:"focus is in no open modal dialog and they do not nest, so which one is topmost cannot be told"};let n=t.dialog;if(n.contains(e))return{region:e};let r=n.querySelector(Sn);return r===null?{hidden:"the topmost open modal dialog neither contains the console nor is a Dialog"}:r.closest(St)!==null?{hidden:'the topmost open modal dialog is a Dialog whose live region has an inert or aria-hidden="true" ancestor'}:{region:r}},In=e=>{try{e.querySelectorAll(ct)}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}},pe=150,$n=1e3,Mt=new WeakMap,Fn=(e,t)=>{let n=Mt.get(e)??new Set,r={text:t};Mt.set(e,n.add(r)),setTimeout(()=>n.delete(r),pe);let a=e.ownerDocument.createElement("span");a.textContent=[...n].map(o=>o.text).join(Ft),e.replaceChildren(a)},An=({locale:e,formatLocale:t,timeZone:n,accessFailure:r,contrast:a="standard",testId:o,children:s})=>{if($t(He)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");if(typeof r!="function")throw new TypeError("ConsoleUiRoot: accessFailure must be the host's presenter of access failures (a function)");if(!Me.includes(a))throw new RangeError(`ConsoleUiRoot: contrast must be one of ${Me.join(", ")}: ${String(a)}`);let i=ft(e),[d]=Intl.getCanonicalLocales(t),p=kt(()=>new Intl.DateTimeFormat(d,{timeZone:n}).resolvedOptions().timeZone,[d,n]),u=Lt(null),c=Lt(null);Ln(()=>{In(u.current.ownerDocument)},[]);let b=kn(f=>{if(f.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let h=()=>{let{texts:E,settle:R,deadline:T}=c.current;c.current=null,clearTimeout(R),clearTimeout(T);let v=u.current;if(v===null)return;let k=E.join(Ft),I=Mn(v);if("hidden"in I)throw new Error(`announce: the live region is hidden from assistive technology (${I.hidden}), so this announcement would be lost: ${k}`);Fn(I.region,k)},y=c.current;if(y===null){c.current={texts:[f],settle:setTimeout(h,pe),deadline:setTimeout(h,$n)};return}y.texts.push(f),clearTimeout(y.settle),y.settle=setTimeout(h,pe)},[]),m=kt(()=>({locale:e,formatLocale:d,timeZone:p,labels:i,announce:b,accessFailure:r}),[e,d,p,i,b,r]);return It(He.Provider,{value:m,children:Hn("div",{"data-cui-root":"","data-cui-contrast":a,"data-cui-surface":"surface","data-cui-fg":"fg","data-testid":o,children:[s,It("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${o}-announcer`,ref:u})]})})},C=()=>{let e=$t(He);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},g=()=>{C()},Ke=()=>C().announce,Dn=()=>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 ye=e=>{let t=e.currentTarget;t.ownerDocument.activeElement!==t&&t.focus({preventScroll:!0})};import{useLayoutEffect as On}from"react";var Kn=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"]),Un=e=>{for(let t of e.querySelectorAll("*")){let n=t.localName;if(!Kn.has(n)||t.hasAttribute("tabindex")||t.hasAttribute("contenteditable"))return n}return null},O=(e,{testId:t,part:n,host:r})=>{On(()=>{let a=Un(e.current);if(a!==null)throw new RangeError(`${t}: the ${n} is the content of a ${r} and holds only non-interactive phrasing content, not <${a}>`)})};import{jsx as Bn}from"react/jsx-runtime";var P=({fg:e,type:t,face:n,as:r="span",space:a,testId:o,id:s,tabIndex:l,ref:i,children:d})=>(g(),Bn(r,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":n,"data-cui-space":a,"data-cui-measure":r==="p"?"reading":void 0,"data-testid":o,id:s,tabIndex:l,ref:i,children:d}));var _n=/\s/,Ue=(e,t)=>{if(e===""||_n.test(e))throw new RangeError(`The id of ${t} must be one token without whitespace: "${e}"`);return e},X=(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 Ue(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 K,jsxs as Xn}from"react/jsx-runtime";var Vn={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"}},Be=({subject:e,children:t})=>{let n=Gn(null);return O(n,e),K("span",{ref:n,children:t})},$=({variant:e,children:t,testId:n,type:r="button",onClick:a,unavailable:o,describedBy:s,expanded:l,controls:i,ref:d,dataAttributes:p,busy:u,busyLabel:c})=>{g();let b=qn(),m=X(o,b),f=u===!0||o!==void 0,h=Vn[e],y=E=>{if(ye(E),f){E.preventDefault();return}a?.(E)};return Xn("span",{className:"cui-button-group",children:[K("button",{className:"cui-button",type:r==="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":u===!0?!0:void 0,"aria-describedby":B(s,m),"aria-expanded":l,"aria-controls":i,onClick:y,ref:d,...w(p),children:K(Be,{subject:{testId:n,part:"label",host:"button"},children:u===!0?c:t})}),o?.reason===void 0?null:K(P,{fg:"fg-muted",type:"body",id:b,testId:`${n}-reason`,children:o.reason})]})},Wn=({onNavigate:e,children:t,testId:n,ref:r})=>(g(),K("button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"body","data-testid":n,onClick:e,ref:r,children:K(Be,{subject:{testId:n,part:"label",host:"button"},children:t})})),zn=/^[^\s#]+$/,Jn=({targetId:e,children:t,testId:n,onFollow:r,dataAttributes:a})=>{if(g(),!zn.test(e))throw new RangeError(`A fragment link needs the target's id without "#" or white space: "${e}"`);return K("a",{className:"cui-link",href:`#${e}`,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":n,onClick:r,...w(a),children:K(Be,{subject:{testId:n,part:"label",host:"link"},children:t})})};import{jsx as At}from"react/jsx-runtime";var jn=({gap:e,testId:t,children:n})=>(g(),At("div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:n})),_e=({gap:e,as:t="div",testId:n,children:r})=>(g(),At(t,{className:"cui-cluster","data-cui-gap":e,"data-testid":n,children:r}));import{jsx as fe,jsxs as Dt}from"react/jsx-runtime";var Qn=new Set(["sign-in","sign-in-again","sign-in-again-in-new-window"]),er=" ",tr=({view:e,handlers:t,testId:n})=>{let r=Ke(),a=e.actions.map(({action:l,label:i})=>{let d=t[l];if(d===void 0)throw new TypeError(`AccessFailureNotice: no handler for the action ${JSON.stringify(l)}`);return{action:l,label:i,handler:d}}),o=e.politeness==="status"?[e.title,...e.sentences].join(er):null,s=Zn(null);return Yn(()=>{o===null||s.current===o||(s.current=o,r(o))},[r,o]),Dt("div",{className:"cui-access-failure","data-cui-access-failure":e.kind,"data-testid":n,children:[Dt("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:[fe("p",{className:"cui-access-failure-title","data-cui-measure":"reading","data-testid":`${n}-title`,children:e.title}),e.sentences.map(l=>fe("p",{className:"cui-access-failure-sentence","data-cui-measure":"reading",children:l},l))]}),a.length===0?null:fe(_e,{gap:"space-2",testId:`${n}-actions`,children:a.map(({action:l,label:i,handler:d})=>fe($,{variant:Qn.has(l)?"primary":"secondary",onClick:d,testId:`${n}-${l}`,children:i},l))})]})};var me=(e,t,n)=>{e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n(t))};import{jsx as ne,jsxs as Ht}from"react/jsx-runtime";var nr=({items:e,current:t,onNavigate:n,testId:r})=>{let{labels:a}=C();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 ne("nav",{className:"cui-breadcrumb","aria-label":a.breadcrumb,"data-testid":r,children:Ht("ol",{className:"cui-breadcrumb-list",role:"list","data-cui-type":"body",children:[e.map(o=>Ht("li",{className:"cui-breadcrumb-item",children:[ne("a",{className:"cui-link",href:o.href,"data-cui-fg":"info-fg","data-cui-type":"body","data-testid":`${r}-${o.id}`,onClick:s=>me(s,o.href,n),children:o.label}),ne("span",{className:"cui-breadcrumb-separator","aria-hidden":"true","data-cui-fg":"fg-muted",children:"\u203A"})]},o.id)),ne("li",{className:"cui-breadcrumb-item",children:ne("span",{"aria-current":"page","data-cui-fg":"fg","data-testid":`${r}-current`,children:t})})]})})};import{useId as Ot}from"react";import{useCallback as rr}from"react";var or=229,ar=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),ge=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&ar.has(e.type)&&(e.value!==""||e.validity.badInput),qe=e=>e.nativeEvent.isComposing||e.keyCode===or,_=(e,t)=>{e.key!=="Escape"||qe(e)||ge(e.target)||(e.stopPropagation(),t())},ir=e=>rr(t=>_(t,e),[e]);import{Fragment as lr,jsx as q,jsxs as re}from"react/jsx-runtime";var Kt=e=>e===void 0?void 0:t=>_(t,e),Ge=({id:e,title:t,description:n,actions:r,onEscape:a,testId:o,headingRef:s,ref:l,dataAttributes:i,children:d})=>{g();let p=Ot(),u=Kt(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:l,onKeyDown:u,...w(i),children:[re("div",{className:"cui-card-header",children:[re("div",{className:"cui-card-heading",children:[q("h2",{className:"cui-card-title",id:p,"data-cui-type":"title","data-testid":`${o}-heading`,ref:s,tabIndex:s===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})]}),r===void 0?null:q("div",{className:"cui-card-actions",children:r})]}),d]})},sr={3:"h3",4:"h4"},dr=({id:e,title:t,subtitle:n,level:r=3,region:a=!1,onEscape:o,testId:s,headingRef:l,ref:i,dataAttributes:d,children:p})=>{g();let u=Ot(),c=Kt(o),b=sr[r],m=re(lr,{children:[re("div",{className:"cui-card-section-heading",children:[q(b,{className:"cui-card-section-title",id:u,"data-cui-type":"body","data-testid":`${s}-heading`,ref:l,tabIndex:l===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":u,"data-testid":s,ref:i,onKeyDown:c,...w(d),children:m}):q("div",{className:"cui-card-section",id:e,"data-testid":s,ref:i,...w(d),children:m})};import{jsx as Ut}from"react/jsx-runtime";var ur=({label:e,code:t,testId:n})=>(g(),Ut("section",{className:"cui-code-frame",tabIndex:0,"aria-label":e,"data-cui-surface":"sunken","data-testid":n,children:Ut("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 pr}from"react";import{jsx as cr}from"react/jsx-runtime";var j=({ruleKey:e,css:t})=>cr("style",{href:e,precedence:"cui",children:t});import{jsx as L,jsxs as G}from"react/jsx-runtime";var yr=({caption:e,attributes:t,columns:n,attributePx:r,columnMinPx:a,testId:o})=>{g();let s=pr();for(let u of[r,a])if(!(Number.isFinite(u)&&u>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${u}`);if(n.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let u of n)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 l=r+n.length*a,i=`cui-comparison-a${r}-c${a}-n${n.length}`,d=u=>`[data-cui-comparison="${i}"][data-cui-comparison-layout="${u}"]`,p=`${d("table")}{display:none}@container (min-width:${F(l)}){${d("table")}{display:block}${d("stack")}{display:none}}`;return G("div",{className:"cui-container","data-cui-stack-below-px":l,"data-testid":o,children:[L(j,{ruleKey:i,css:p}),L("div",{className:"cui-comparison-frame","data-cui-comparison":i,"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(r)}}),n.map(u=>L("col",{},u.key))]}),L("thead",{children:G("tr",{children:[L("td",{}),n.map(u=>L("th",{scope:"col",children:u.heading},u.key))]})}),L("tbody",{children:t.map(u=>G("tr",{children:[L("th",{scope:"row",children:u.label}),n.map(c=>L("td",{children:c.cells[u.key]("table")},c.key))]},u.key))})]})}),L("div",{className:"cui-comparison-stack","data-cui-comparison":i,"data-cui-comparison-layout":"stack",children:n.map((u,c)=>{let b=`${s}-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:u.heading}),L("dl",{className:"cui-comparison-list",children:t.map(m=>G("div",{children:[L("dt",{children:m.label}),L("dd",{children:u.cells[m.key]("stack")})]},m.key))})]},u.key)})})]})};import{Fragment as hr,useCallback as Rr,useId as Tr,useLayoutEffect as qt,useRef as Je}from"react";var oe="[data-cui-row-focus]",Ve="[data-cui-row-detail]",fr=e=>e===null?[]:[...e.querySelectorAll(`:scope > ${oe}`)],Bt=(e,t)=>{let n=new Map;t!==null&&n.set(t,0);let r=-1;for(let a of e===null?[]:e.children)a.matches(oe)?(r+=1,n.set(a,r)):r>=0&&a.matches(Ve)&&n.set(a,r);return n},_t=(e,t,n,r)=>{let a=fr(t);if(a.length===0)return n;let o=r.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 mr,useLayoutEffect as We,useReducer as gr,useRef as ze}from"react";var br=e=>e+1,ae=e=>{let t=ze(e),n=ze(null),r=ze(!1),[,a]=gr(br,0),o=mr((s=>()=>{r.current&&s.contains(document.activeElement)&&(n.current=s,a())}),[]);return We(()=>(r.current=!0,()=>{r.current=!1,n.current=null}),[]),We(()=>{t.current=e}),We(()=>{let s=n.current;if(s===null)return;n.current=null;let l=[null,document.body].includes(document.activeElement);s.isConnected||!l||t.current(s)?.focus()}),o};import{jsx as S,jsxs as be}from"react/jsx-runtime";var Er=new Map,vr='a[href], audio[controls], button, details, embed, iframe, img[usemap], input:not([type="hidden"]), label, select, textarea, video[controls], [tabindex], [contenteditable]',xr=(e,t,n)=>{qt(()=>{let r=e.current;if(t!=="row-compact"||r===null)return;let a=[...r.querySelectorAll(vr)].find(o=>o.parentElement!==r);if(a!==void 0)throw new RangeError(`${n}: a compact row holds no control or focus target (a ${z} px target does not fit its ${gt} px; use row-control), not <${a.localName}>`)})},wr=(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 r=e.find(a=>a.rowHeader!==!0&&a.rowHeaderNote!==void 0);if(r!==void 0)throw new RangeError(`${t}: a row header note belongs to the row header column, not to ${r.key}`)},Pr=e=>e==null?null:S("div",{className:"cui-table-header-note",children:e}),Nr=(e,t,n,r,a)=>{let o=e.open(t);return S("tr",{ref:a,hidden:!o,"data-cui-row-detail":o?"open":"closed","data-testid":`${r}-detail`,children:S("td",{colSpan:n,id:e.id(t),children:o?e.render(t):null})})},Cr=({caption:e,captionHidden:t,columns:n,rows:r,rowKey:a,rowTestId:o,rowData:s,rowSize:l,rowDetail:i,empty:d,testId:p,ref:u})=>{g();let c=Tr(),b=Je(null);xr(b,l,p);let m=Je(null),f=Je(Er),h=ae(R=>_t(R,b.current,m.current,f.current));qt(()=>{f.current=Bt(b.current,m.current)});let y=Rr(R=>{m.current=R;let T=h(R);return()=>{m.current=null,T()}},[h]),E=Et(n);return wr(n,p),S("div",{className:"cui-container","data-testid":p,ref:u,children:r.length===0?S(P,{as:"p",fg:"fg-muted",type:"prose",tabIndex:-1,ref:y,testId:`${p}-empty`,children:d}):S("section",{ref:h,className:"cui-table-frame",tabIndex:0,"aria-labelledby":c,"data-testid":`${p}-frame`,children:be("table",{className:"cui-table","data-cui-type":"body","data-cui-row-size":l,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=>be("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:r.map(R=>be(hr,{children:[S("tr",{ref:h,tabIndex:-1,"data-cui-row-focus":"","data-testid":o,...w(s?.(R)),children:n.map(T=>T.rowHeader===!0?be("th",{scope:"row","data-cui-align":T.align,children:[T.cell(R),T.rowHeaderNote===void 0?null:Pr(T.rowHeaderNote(R))]},T.key):S("td",{"data-cui-align":T.align,children:T.cell(R)},T.key))}),i===void 0?null:Nr(i,R,n.length,o,h)]},a(R)))})]})})})};import{jsx as Xe,jsxs as Lr}from"react/jsx-runtime";var kr=({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 Xe("dl",{className:"cui-description-list","data-cui-type":"body","data-testid":t,children:e.map(n=>Lr("div",{className:"cui-description-row","data-testid":`${t}-${n.key}`,children:[Xe("dt",{"data-cui-fg":"fg-secondary",children:n.term}),Xe("dd",{"data-cui-fg":"fg",children:n.description})]},n.key))})};import{useId as Gt,useLayoutEffect as Vt,useRef as je}from"react";import{jsx as ie,jsxs as zt}from"react/jsx-runtime";var Wt=e=>{e instanceof HTMLElement&&e.isConnected&&e.focus()},Sr=(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},Mr=(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")},Ir=e=>e instanceof HTMLInputElement&&e.type==="search",$r=({title:e,description:t,open:n,onClose:r,initialFocus:a,testId:o,children:s})=>{let{labels:l}=C(),i=Gt(),d=Gt(),p=je(null),u=je(null),c=je(!1);return Vt(()=>{let y=p.current;if(n&&!y.open){let E=a===void 0?null:Sr(y,a.current);u.current=y.ownerDocument.activeElement,y.showModal(),E!==null&&Mr(y,E)}else!n&&y.open&&y.close()},[n,a]),Vt(()=>{let y=p.current;return()=>{y.open&&(y.close(),Wt(u.current),u.current=null)}},[]),zt("dialog",{className:"cui-dialog","aria-labelledby":i,"aria-describedby":t===void 0?void 0:d,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":o,ref:p,onClose:y=>{y.currentTarget.open||(Wt(u.current),u.current=null,n&&r())},onCancel:y=>{let E=c.current;c.current=!1,(E||ge(y.currentTarget.ownerDocument.activeElement))&&y.preventDefault()},onKeyDownCapture:y=>{let E=qe(y);c.current=E,y.key==="Escape"&&!E&&ge(y.target)&&!Ir(y.target)&&y.preventDefault()},onKeyUpCapture:()=>{c.current=!1},children:[zt("div",{className:"cui-dialog-header",children:[ie("h2",{className:"cui-dialog-title",id:i,"data-cui-type":"title",children:e}),ie("div",{className:"cui-dialog-actions",children:ie($,{variant:"secondary",testId:`${o}-close`,onClick:()=>p.current?.close(),children:l.close})})]}),t===void 0?null:ie("div",{id:d,"data-cui-measure":"reading","data-testid":`${o}-description`,children:t}),s,ie("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true",[Oe]:"","data-testid":`${o}-announcer`})]})};import{useId as Fr,useRef as Ar}from"react";import{jsx as Ye,jsxs as Jt}from"react/jsx-runtime";var Dr=({summary:e,open:t,onOpenChange:n,testId:r,children:a})=>{g();let o=Fr(),s=Ar(null);return O(s,{testId:r,part:"summary",host:"button"}),Jt("div",{className:"cui-disclosure","data-testid":r,children:[Jt("button",{className:"cui-disclosure-button",type:"button","aria-expanded":t,"aria-controls":o,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${r}-button`,onClick:()=>n(!t),children:[Ye("span",{className:"cui-disclosure-marker","aria-hidden":"true",children:t?"\u25BE":"\u25B8"}),Ye("span",{ref:s,children:e})]}),Ye("div",{className:"cui-disclosure-panel",id:o,hidden:!t,"data-testid":`${r}-panel`,children:a})]})};import{accessFailureKindOfStatus as Or}from"@aiquants/auth-core";import{Fragment as Kr}from"react";import{jsx as Xt}from"react/jsx-runtime";var Hr=({tone:e,testId:t,children:n})=>(g(),Xt("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})),se=({occurrence:e,testId:t,children:n})=>(g(),Xt("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 Ze=({failure:e,place:t,deniedSentence:n,failed:r,retry:a,testId:o})=>{let{labels:s,accessFailure:l}=C();if(n.trim()==="")throw new RangeError("FailureMessage: deniedSentence must be a non-empty sentence");let i=e.status===null?null:Or(e.status);return i===null?jt(se,{occurrence:e.occurrence,testId:o,children:s.failureSentence(e,r)}):jt(Kr,{children:l({kind:i,place:t,deniedSentence:i==="forbidden"?s.forbiddenBecause(n,e.reason):null,retry:a})},e.occurrence)};import{useId as Y}from"react";import{Fragment as Jr,jsx as x,jsxs as A}from"react/jsx-runtime";var Ur=/\s/,Qe=e=>{if(e!==void 0&&(typeof e!="string"||e===""||Ur.test(e)))throw new RangeError(`A control's name must be one token without whitespace: "${e}"`);return e},Yt=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},Z=({description:e,error:t,errorId:n})=>{g();let r=Y(),a=Y(),o=Y(),s=n===void 0?o:Ue(n,"a field's error"),l=[e===void 0?null:a,t===void 0?null:s].filter(d=>d!==null).join(" ");return{control:{id:r,"aria-describedby":l===""?void 0:l,"aria-invalid":t===void 0?void 0:!0},descriptionId:a,errorId:s}},Q=({description:e,error:t,descriptionId:n,errorId:r,testId:a})=>A(Jr,{children:[e===void 0?null:x(P,{as:"p",fg:"fg-muted",type:"body",id:n,testId:`${a}-description`,children:e}),t===void 0?null:x(P,{as:"p",fg:"danger-fg",type:"body",id:r,testId:`${a}-error`,children:t})]}),he=({htmlFor:e,hidden:t,children:n})=>x("label",{className:t===!0?"cui-visually-hidden":"cui-field-label",htmlFor:e,"data-cui-type":"body",children:n}),Br=({label:e,description:t,error:n,errorId:r,testId:a,children:o})=>{let{control:s,descriptionId:l,errorId:i}=Z({label:e,description:t,error:n,errorId:r});return A("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":a,children:[x(he,{htmlFor:s.id,hidden:void 0,children:e}),o(s),x(Q,{description:t,error:n,descriptionId:l,errorId:i,testId:a})]})},Zt=({label:e,description:t,error:n,errorId:r,value:a,onValueChange:o,type:s,name:l,maxLength:i,list:d,autoComplete:p,inputMode:u,prefix:c,labelHidden:b,required:m,testId:f,ref:h})=>{let{control:y,descriptionId:E,errorId:R}=Z({label:e,description:t,error:n,errorId:r}),T=Y();if(c!==void 0&&c.trim()==="")throw new RangeError("An input's prefix must not be blank");if(i!==void 0&&s==="datetime-local")throw new RangeError(`A ${s} input takes no maxLength: ${i}`);let v=s==="password",k=x("input",{className:"cui-input",type:s,name:Qe(l),maxLength:Yt(i),value:a,list:d,autoComplete:p,inputMode:u,spellCheck:v?!1:void 0,autoCapitalize:v?"none":void 0,required:m,onChange:I=>o(I.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 A("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${f}-field`,children:[x(he,{htmlFor:y.id,hidden:b,children:e}),c===void 0?k:A("div",{className:"cui-input-group",children:[x("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]}),x(Q,{description:t,error:n,descriptionId:E,errorId:R,testId:f})]})},_r=e=>x(Zt,{...e}),qr=e=>x(Zt,{...e,type:"password"}),Gr=({label:e,description:t,error:n,errorId:r,value:a,onValueChange:o,name:s,maxLength:l,required:i,testId:d,ref:p})=>{let{control:u,descriptionId:c,errorId:b}=Z({label:e,description:t,error:n,errorId:r});return A("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${d}-field`,children:[x(he,{htmlFor:u.id,hidden:void 0,children:e}),x("textarea",{className:"cui-input cui-textarea",name:Qe(s),maxLength:Yt(l),value:a,required:i,onChange:m=>o(m.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":d,ref:p,...u}),x(Q,{description:t,error:n,descriptionId:c,errorId:b,testId:d})]})},Vr=({label:e,description:t,error:n,errorId:r,value:a,options:o,onValueChange:s,name:l,labelHidden:i,unavailable:d,testId:p,ref:u})=>{let{control:c,descriptionId:b,errorId:m}=Z({label:e,description:t,error:n,errorId:r}),f=Y(),h=X(d,f);return A("div",{className:"cui-field","data-invalid":n!==void 0,"data-testid":`${p}-field`,children:[x(he,{htmlFor:c.id,hidden:i,children:e}),x("select",{className:"cui-input",name:Qe(l),value:a,onChange:y=>{d===void 0&&s(y.target.value)},"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":p,ref:u,...c,"aria-disabled":d===void 0?void 0:!0,"aria-describedby":B(c["aria-describedby"],h),children:o.map(y=>x("option",{value:y.value,children:y.label},y.value))}),x(Q,{description:t,error:n,descriptionId:b,errorId:m,testId:p}),d?.reason===void 0?null:x(P,{as:"p",fg:"fg-muted",type:"body",id:f,testId:`${p}-reason`,children:d.reason})]})},Wr=({legend:e,description:t,error:n,errorId:r,value:a,options:o,onValueChange:s,testId:l,ref:i})=>{let d=Y(),{control:p,descriptionId:u,errorId:c}=Z({label:e,description:t,error:n,errorId:r});return A("fieldset",{className:"cui-radio-group","aria-describedby":p["aria-describedby"],"data-invalid":n!==void 0,"data-testid":l,children:[x("legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),o.map((b,m)=>A("label",{className:"cui-radio","data-cui-type":"body",children:[x("input",{type:"radio",name:d,value:b.value,checked:b.value===a,onChange:()=>s(b.value),"aria-invalid":p["aria-invalid"],"data-testid":`${l}-option-${b.value}`,ref:m===0?i:void 0}),x("span",{children:b.label})]},b.value)),x(Q,{description:t,error:n,descriptionId:u,errorId:c,testId:l})]})},zr=({legend:e,description:t,error:n,errorId:r,values:a,options:o,onValuesChange:s,testId:l,ref:i})=>{let{control:d,descriptionId:p,errorId:u}=Z({label:e,description:t,error:n,errorId:r}),c=o.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 A("fieldset",{className:"cui-checkbox-group","aria-describedby":d["aria-describedby"],"data-invalid":n!==void 0,"data-testid":l,children:[x("legend",{className:"cui-checkbox-group-legend","data-cui-type":"body",children:e}),o.map((f,h)=>A("label",{className:"cui-checkbox","data-cui-type":"body",children:[x("input",{type:"checkbox",value:f.value,checked:m.has(f.value),onChange:()=>s(c.filter(y=>y===f.value?!m.has(y):m.has(y))),"aria-invalid":d["aria-invalid"],"data-testid":`${l}-option-${f.value}`,ref:h===0?i:void 0}),x("span",{children:f.label})]},f.value)),x(Q,{description:t,error:n,descriptionId:p,errorId:u,testId:l})]})};import{createContext as Xr,useContext as jr,useId as rn,useMemo as Yr}from"react";import{Fragment as dn,jsx as N,jsxs as Re}from"react/jsx-runtime";var on=Xr(null),Qt="surface",en={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"}},tn={face:"info-tint",line:"info-accent"},an={normal:"border-control",high:"info-accent"},Zr=["normal","high"],Qr=[1,2,3,4],D=M.space["space-2"],eo="fg",to="fg-secondary",sn=e=>{let t=jr(on);if(t===null)throw new Error(`${e} must be rendered inside Figure`);return t},et=(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}`)},no=e=>{g();let t=rn(),{kind:n,widthPx:r,heightPx:a,testId:o,dataAttributes:s,children:l}=e;et(o,"widthPx",r),et(o,"heightPx",a);let i=Yr(()=>({kind:n,widthPx:r,heightPx:a,arrowIds:{normal:`${t}-arrow-normal`,high:`${t}-arrow-high`}}),[n,r,a,t]),d=Re(dn,{children:[N("defs",{children:Zr.map(b=>N("marker",{id:i.arrowIds[b],viewBox:`0 0 ${D} ${D}`,refX:D,refY:D/2,markerWidth:D,markerHeight:D,markerUnits:"userSpaceOnUse",orient:"auto","data-cui-emphasis":b,children:N("path",{d:`M 0 0 L ${D} ${D/2} L 0 ${D} z`,"data-cui-stroke":an[b],"data-testid":`${o}-arrow-${b}`})},b))}),N(on.Provider,{value:i,children:l})]});if(e.kind==="group"){let{label:b,onEscape:m}=e;if(!H(b))throw new RangeError(`${o}: a group figure's label must hold a readable character: ${JSON.stringify(b)}`);return N("div",{className:"cui-figure-frame","data-testid":`${o}-frame`,children:N("svg",{className:"cui-figure",role:"group","aria-label":b,viewBox:`0 0 ${r} ${a}`,"data-cui-figure":"group","data-cui-surface":Qt,"data-cui-face":"sans",style:{"--cui-figure-inline":F(r),"--cui-figure-block":F(a)},onKeyDown:m===void 0?void 0:f=>_(f,m),"data-testid":o,...w(s),children:d})})}let{viewBox:p,pointer:u,svgRef:c}=e;return N("div",{className:"cui-container","data-testid":`${o}-frame`,children:N("svg",{ref:c,className:"cui-figure","aria-hidden":"true",viewBox:p===void 0?`0 0 ${r} ${a}`:p,"data-cui-figure":"decorative","data-cui-surface":Qt,"data-cui-face":"sans","data-cui-pan":u===void 0?void 0:"true","data-cui-cursor":u?.cursor,style:{"--cui-figure-inline":F(r),"--cui-figure-ratio":String(a/r)},"data-testid":o,...w(s),...u?.handlers,children:d})})},nn=(e,t)=>{try{return t()}catch(n){throw new RangeError(`${e}: ${n.message}`,{cause:n})}},ro=(e,t,n)=>{for(let r of t){let a=mt.light[r.fg],o=n.find(s=>a[s]===void 0);if(o!==void 0)throw new RangeError(`${e}: the note ${JSON.stringify(r.text)} in ${r.fg} is not in the contrast table on ${o}, a face the node takes`)}},oo=e=>{g();let t=sn("FigureNode"),n=rn(),{x:r,y:a,shape:o,tone:s,outline:l,selected:i,name:d,title:p,press:u,testId:c,dataAttributes:b}=e,m=e.notes===void 0?[]:e.notes;if(!(Number.isFinite(r)&&Number.isFinite(a)))throw new RangeError(`${c}: a node's position must be finite: ${r}, ${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&&!H(u.label))throw new RangeError(`${c}: a pressable node's label must hold a readable character: ${JSON.stringify(u.label)}`);let f=i?tn:en[s];ro(c,m,[en[s].face,tn.face]);let h,y,E;if(o.kind==="box"){if(d===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=nn(c,()=>bt({name:d,notes:m.map(k=>k.text)}));if(et(c,"a box's widthPx",o.widthPx),o.widthPx<T.minWidthPx)throw new RangeError(`${c}: a box ${o.widthPx} px wide is narrower than its lines under the widest 1.4.12 spacing (${T.minWidthPx} px)`);h={width:o.widthPx,height:T.heightPx,left:r,top:a};let v=ht(m.length);y=Re("g",{"data-cui-surface":f.face,children:[N("rect",{className:"cui-figure-plate",width:o.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:v.insetPx,y:v.namePx,fontSize:M.type.body.size,"data-cui-fg":eo,"data-cui-figure-type":"body","data-testid":`${c}-name`,children:d}),m.map((k,I)=>N("text",{x:v.insetPx,y:v.notesPx[I],fontSize:M.type.caption.size,"data-cui-fg":k.fg,"data-cui-figure-type":"caption","data-testid":`${c}-note-${I}`,children:k.text},I))]}),E=N("rect",{className:"cui-figure-ring",x:-U,y:-U,width:o.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=nn(c,()=>Rt(d,o.radiusPx));h={width:2*o.radiusPx,height:2*o.radiusPx,left:r-o.radiusPx,top:a-o.radiusPx},y=Re(dn,{children:[N("g",{"data-cui-surface":f.face,children:N("circle",{className:"cui-figure-plate",r:o.radiusPx,"data-cui-fill":f.face,"data-cui-stroke":f.line,"data-testid":`${c}-plate`})}),d===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":to,"data-cui-figure-type":"caption","data-testid":`${c}-name`,children:d})]}),E=N("circle",{className:"cui-figure-ring",r:o.radiusPx+U,"data-cui-stroke":"focus","data-testid":`${c}-ring`})}if(u!==void 0){if(h.width<z||h.height<z)throw new RangeError(`${c}: a pressable node must be at least the ${z} px target: ${h.width} \xD7 ${h.height}`);if(h.left<J||h.top<J||h.left+h.width+J>t.widthPx||h.top+h.height+J>t.heightPx)throw new RangeError(`${c}: a pressable node must keep ${J} px to the figure's edge for its focus ring`)}let R=u===void 0?{}:{role:"button",tabIndex:0,"aria-label":u.label,"aria-describedby":u.description===void 0?void 0:n,"aria-expanded":u.expanded,"aria-controls":u.expanded?u.controls:void 0,onClick:T=>{T.currentTarget.focus(),u.onPress()},onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),T.repeat||u.onPress())}};return Re("g",{className:"cui-figure-node",transform:`translate(${r} ${a})`,"data-cui-tone":s,"data-cui-outline":l,"data-selected":String(i),...R,"data-testid":c,...w(b),children:[p===void 0?null:N("title",{children:p}),u?.description===void 0?null:N("desc",{id:n,"data-testid":`${c}-description`,children:u.description}),u===void 0?null:E,y]})},ao=({d:e,emphasis:t,weight:n,arrow:r,title:a,testId:o,dataAttributes:s})=>{g();let l=sn("FigureEdge");if(!Qr.includes(n))throw new RangeError(`${o}: an edge's weight must be 1, 2, 3 or 4: ${n}`);return N("path",{className:"cui-figure-edge",d:e,markerEnd:r?`url(#${l.arrowIds[t]})`:void 0,"data-cui-stroke":an[t],"data-cui-weight":n,"data-cui-emphasis":t,"data-testid":o,...w(s),children:a===void 0?null:N("title",{children:a})})};import{jsx as lo}from"react/jsx-runtime";var io={1:"h1",2:"h2",3:"h3"},so=({level:e,type:t,testId:n,headingRef:r,children:a})=>{g();let o=io[e];return lo(o,{className:"cui-heading","data-cui-type":t,"data-cui-fg":"fg","data-testid":n,ref:r,tabIndex:r===void 0?void 0:-1,children:a})};import{jsx as po}from"react/jsx-runtime";var uo={removed:"danger-tint",added:"success-tint"},co=({kind:e,testId:t,children:n})=>{if(g(),n==="")throw new RangeError(`${t}: a changed fragment must hold at least one character`);return po(e==="removed"?"del":"ins",{className:"cui-change","data-cui-change":e,"data-cui-surface":uo[e],"data-cui-fg":"fg","data-testid":t,children:n})};import{jsx as mo}from"react/jsx-runtime";var yo={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"}},fo={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},tt=({tone:e,variant:t,testId:n,dataAttributes:r,children:a})=>{g();let o=t==="tint"?yo[e]:{fg:"on-solid",surface:fo[e]};return mo("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":n,...w(r),children:a})};import{useId as go}from"react";import{jsx as de,jsxs as bo}from"react/jsx-runtime";var nt=({label:e,valueText:t,value:n,max:r,testId:a})=>{g();let o=go();if(r!==null){if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Progress maximum must be positive: ${r}`);if(n===null||!(Number.isFinite(n)&&n>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${n}`)}let s=r===null?null:{max:r,now:Math.min(n,r)};return bo("div",{className:"cui-progress","data-testid":a,children:[de(P,{as:"p",fg:"fg",type:"body",id:o,children:e}),de("div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":o,"aria-valuetext":t,"aria-valuemin":s===null?void 0:0,"aria-valuemax":s?.max,"aria-valuenow":s?.now,"data-cui-surface":"sunken","data-cui-indeterminate":s===null,"data-testid":`${a}-bar`,children:de("div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:s===null?void 0:{inlineSize:`${s.now/s.max*100}%`},"data-testid":`${a}-fill`})}),de("div",{"aria-hidden":"true",children:de(P,{as:"p",fg:"fg-secondary",type:"body",testId:`${a}-value`,children:t})})]})};import{jsx as Te,jsxs as ln}from"react/jsx-runtime";var ho=({title:e,status:t,progress:n,cancel:r,testId:a,children:o})=>ln(Ge,{title:e,actions:r===void 0?void 0:Te($,{variant:"secondary",busy:r.busy,busyLabel:r.busyLabel,onClick:r.onCancel,testId:`${a}-cancel`,children:r.label}),testId:a,children:[ln("div",{className:"cui-job-status",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${a}-status`,children:[Te("span",{className:"cui-visually-hidden",children:`${e} `}),Te(tt,{tone:t.tone,variant:"tint",testId:`${a}-status-pill`,children:t.label})]}),n===void 0?null:Te(nt,{...n,testId:`${a}-progress`}),o]});import{createContext as Ro,useContext as To}from"react";import{jsx as le}from"react/jsx-runtime";var rt=Ro(null),Eo="space-2",vo=e=>{g();let{gap:t,label:n,id:r,hidden:a,testId:o,children:s}=e;if(n!==void 0&&!H(n))throw new RangeError(`${o}: a list's label must hold a readable character: ${JSON.stringify(n)}`);let l=e.marker==="none"?void 0:e.type,i=l!==void 0,d=e.marker==="number"||e.marker==="none"&&e.ordered?"ol":"ul";return le(rt.Provider,{value:e.marker,children:le(d,{className:"cui-list",role:"list","aria-label":n,id:r,hidden:a,"data-cui-gap":i?void 0:t,"data-cui-row-gap":i?t:void 0,"data-cui-column-gap":i?Eo:void 0,"data-cui-marker":i?e.marker:void 0,"data-cui-type":l,"data-testid":o,children:s})})},xo=({testId:e,dataAttributes:t,children:n})=>{g();let r=To(rt);if(r===null)throw new Error("ListItem must be rendered inside List, not inside another ListItem");return le("li",{className:"cui-list-item","data-testid":e,...w(t),children:le("div",{className:"cui-list-body","data-cui-measure":r==="none"?void 0:"reading",children:le(rt.Provider,{value:null,children:n})})})};import{useCallback as un,useLayoutEffect as wo,useRef as Ee}from"react";import{jsx as ve,jsxs as ko}from"react/jsx-runtime";var cn=e=>[...e.querySelectorAll(oe)].filter(t=>{let n=t.closest(Ve);return n===null||!e.contains(n)}),Po=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=cn(t);if(n.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${n.length} ${oe} elements for ${e.count} rows`);return n},No=(e,t)=>{let n=-1;return e.forEach((r,a)=>{t.has(r)&&(n=a)}),e[n+1]},Co=({onLoad:e,busy:t,done:n,failure:r,limit:a,rows:o,testId:s})=>{let{formatLocale:l,labels:i}=C(),d=Ee(null),p=Ee(null),u=Ee(null),c=Ee(!1),b=()=>{let y=o.ref.current;d.current={shown:new Set(y===null?[]:cn(y)),failureOccurrence:r===null?null:r.occurrence,busySeen:!1},e()};wo(()=>{let y=c.current;c.current=!1;let E=d.current;if(E===null)return;let R=Po(o);if(t){E.busySeen=!0,E.shown=new Set(R);return}let T=No(R,E.shown),v=r!==null&&r.occurrence!==E.failureOccurrence;if(!(E.busySeen||T!==void 0||v||n)||(d.current=null,v||T===void 0))return;let k=[null,document.body].includes(document.activeElement);(u.current!==null&&document.activeElement===u.current||y&&k)&&T.focus()});let m=ae(()=>n?p.current:u.current),f=un((y=>{u.current=y;let E=m(y);return()=>{u.current=null,c.current=y===document.activeElement,E()}}),[m]),h=un((y=>{p.current=y;let E=m(y);return()=>{p.current=null,E()}}),[m]);return n?ve("div",{className:"cui-load-more","data-testid":s,children:ve(P,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:h,testId:`${s}-end`,children:i.endOfRecords})}):ko("div",{className:"cui-load-more","data-testid":s,children:[ve($,{variant:"secondary",busy:t,busyLabel:i.loading,onClick:b,ref:f,testId:`${s}-button`,children:i.loadMore(ce(a,l))}),r===null?null:ve(se,{occurrence:r.occurrence,testId:`${s}-failure`,children:i.loadFailed(r.reason)})]})};import{jsx as ot,jsxs as pn}from"react/jsx-runtime";var Lo=({master:e,detail:t,masterMinPx:n,detailMinPx:r,testId:a})=>{g();let o=Tt({masterMinPx:n,detailMinPx:r,gapPx:M.space["space-6"]});return pn("div",{className:"cui-container","data-testid":a,children:[ot(j,{ruleKey:o.key,css:o.css}),pn("div",{className:"cui-master-detail","data-cui-master-detail":o.key,children:[ot("div",{className:"cui-master-detail-pane","data-testid":`${a}-master`,children:e}),ot("div",{className:"cui-master-detail-pane","data-testid":`${a}-detail`,children:t})]})]})};import{jsx as xe}from"react/jsx-runtime";var we=e=>{let{formatLocale:t,labels:n}=C(),{testId:r}=e;if(e.keep===void 0){let{value:s,unit:l}=e;if(l!==void 0&&!H(l))throw new RangeError(`${r}: a unit must hold a readable character: ${JSON.stringify(l)}`);if(s===null)return xe("span",{className:"cui-measured","data-measured":"false","data-testid":r,children:n.unmeasured});let i=ce(s,t);return xe("span",{className:"cui-measured","data-measured":"true","data-testid":r,children:yt(i,l)})}let{text:a,keep:o}=e;if(a===null)return xe("span",{className:"cui-measured","data-measured":"false","data-cui-keep":o,"data-testid":r,children:n.unmeasured});if(!H(a))throw new RangeError(`${r}: 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":o,"data-testid":r,children:a})};import{jsx as Pe,jsxs as Mo}from"react/jsx-runtime";var So=({label:e,value:t,min:n,max:r,valueText:a,testId:o})=>{if(g(),!(Number.isFinite(n)&&Number.isFinite(r)&&n<r))throw new RangeError(`Meter needs a finite range with min below max: min ${n}, max ${r}`);if(!(Number.isFinite(t)&&t>=n&&t<=r))throw new RangeError(`Meter value must be a finite number in its range: value ${t}, min ${n}, max ${r}`);return Mo("span",{className:"cui-meter","data-testid":o,children:[Pe("span",{className:"cui-meter-track",role:"meter","aria-label":e,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,"aria-valuetext":a,"data-cui-surface":"sunken","data-testid":`${o}-bar`,children:Pe("span",{className:"cui-meter-fill","data-cui-accent":"info-accent",style:{inlineSize:`${(t-n)/(r-n)*100}%`},"data-testid":`${o}-fill`})}),Pe("span",{"aria-hidden":"true",children:Pe(P,{fg:"fg",type:"body",testId:`${o}-value`,children:a})})]})};import{useId as Io,useRef as $o}from"react";import{jsx as at,jsxs as Do}from"react/jsx-runtime";var Fo={ArrowLeft:-1,ArrowRight:1},Ao=({label:e,items:t,value:n,onValueChange:r,testId:a,panelDescribedBy:o,children:s})=>{g();let l=Io(),i=$o(new Map);if(t.length===0)throw new RangeError("PanelTabs needs at least one tab");let d=t.map(f=>f.id);if(new Set(d).size!==d.length)throw new RangeError(`Tab keys must be unique: ${d.join(", ")}`);let p=d.indexOf(n);if(p<0)throw new RangeError(`The selected tab "${n}" is not one of the tabs: ${d.join(", ")}`);let u=f=>`${l}-tab-${f}`,c=`${l}-panel`,b=f=>{let h=t[f];h.id!==n&&r(h.id),i.current.get(h.id)?.focus()};return Do("div",{className:"cui-panel-tabs","data-testid":a,children:[at("div",{className:"cui-tabs-list",role:"tablist","aria-label":e,onKeyDown:f=>{let h=t.findIndex(T=>i.current.get(T.id)===f.target),y=h<0?p:h,E=Fo[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 at("button",{className:"cui-tab cui-panel-tab",type:"button",role:"tab",id:u(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?i.current.delete(f.id):i.current.set(f.id,E)},onClick:()=>b(h),children:f.label},f.id)})}),at("div",{role:"tabpanel",id:c,"aria-labelledby":u(p),"aria-describedby":o,"data-testid":`${a}-panel`,children:s})]})};import{accessFailureKindOfStatus as Ho}from"@aiquants/auth-core";import{jsx as it,jsxs as Ko}from"react/jsx-runtime";var Oo=({failure:e,onReload:t,deniedSentence:n,failureMessage:r,rescueRef:a,testId:o})=>{let{labels:s}=C(),l=it(Ze,{failure:e,place:"read",deniedSentence:n,failed:r===void 0?s.loadFailed:r,retry:t,testId:`${o}-alert`});return e.status!==null&&Ho(e.status)!==null?it("div",{className:"cui-resource-failed",ref:a,"data-testid":o,children:l},e.occurrence):Ko("div",{className:"cui-resource-failed","data-testid":o,children:[l,it($,{variant:"secondary",busy:e.retrying,busyLabel:s.loading,onClick:t,ref:a,testId:`${o}-reload`,children:s.reload})]})};import{useId as Uo}from"react";import{jsx as V,jsxs as yn}from"react/jsx-runtime";var Bo=({label:e,options:t,value:n,onValueChange:r,testId:a,density:o="regular"})=>{g();let s=Uo(),l=new Set(t.map(i=>i.value));if(t.length<2||l.size!==t.length)throw new RangeError(`A segmented control needs at least two options with unique values: ${t.map(i=>i.value).join(", ")}`);if(!l.has(n))throw new RangeError(`The pressed value "${n}" is not one of the options: ${[...l].join(", ")}`);if(o!=="regular"&&o!=="compact")throw new RangeError(`A segmented control's density is "regular" or "compact", not ${JSON.stringify(o)}`);return o==="compact"?yn("fieldset",{className:"cui-segmented-group","aria-labelledby":s,"data-cui-density":"compact","data-testid":a,children:[V("span",{className:"cui-segmented-label",id:s,"data-cui-type":"caption",children:e}),V("div",{className:"cui-segmented",children:t.map(i=>{let d=i.value===n;return V("button",{className:"cui-segment",type:"button","aria-pressed":d,"data-testid":`${a}-${i.value}`,onClick:()=>{d||r(i.value)},children:V("span",{className:"cui-segment-face","data-cui-fg":d?"on-solid":"fg","data-cui-surface":d?"info-solid":void 0,"data-cui-type":"caption","data-testid":`${a}-${i.value}-face`,children:i.label})},i.value)})})]}):yn("fieldset",{className:"cui-segmented-group","data-testid":a,children:[V("legend",{className:"cui-segmented-legend","data-cui-type":"body",children:e}),V("div",{className:"cui-segmented",children:t.map(i=>{let d=i.value===n;return V("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||r(i.value)},children:i.label},i.value)})})]})};import{useCallback as _o,useRef as qo}from"react";import{jsx as ee}from"react/jsx-runtime";var fn=({selected:e,controls:t,onSelect:n,testId:r,dataAttributes:a,ref:o,children:s})=>{g();let l=qo(null);O(l,{testId:r,part:"row",host:"button"});let i=_o(p=>{if(l.current=p,typeof o=="function")return o(p);o!=null&&(o.current=p)},[o]);return ee("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":r,onClick:p=>{ye(p),n()},ref:i,...w(a),children:s})},Go=({label:e,items:t,itemKey:n,selectedKey:r,onSelect:a,detailId:o,renderRow:s,rowTestId:l,rowData:i,empty:d,testId:p,ref:u})=>(g(),ee("div",{className:"cui-selectable","data-testid":p,ref:u,children:t.length===0?ee(P,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:d}):ee("ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let b=n(c);return ee("li",{children:ee(fn,{selected:b===r,controls:o,onSelect:()=>a(c),testId:l,dataAttributes:i?.(c),children:s(c)})},b)})})}));import{useId as Vo}from"react";import{jsx as Ne,jsxs as mn}from"react/jsx-runtime";var Wo=({label:e,value:t,min:n,max:r,step:a,valueText:o,onValueChange:s,testId:l})=>{g();let i=Vo();if(!([t,n,r,a].every(Number.isFinite)&&n<r&&a>0&&n<=t&&t<=r))throw new RangeError(`Slider needs finite min < max, a positive step and min <= value <= max: value ${t}, min ${n}, max ${r}, step ${a}`);let d=o(t);return mn("div",{className:"cui-field","data-testid":`${l}-field`,children:[Ne("label",{className:"cui-field-label",htmlFor:i,"data-cui-type":"body",children:e}),mn("div",{className:"cui-slider",children:[Ne("input",{className:"cui-slider-input",id:i,type:"range",min:n,max:r,step:a,value:t,"aria-valuetext":d,"data-testid":l,onChange:p=>s(p.currentTarget.valueAsNumber)}),Ne("span",{className:"cui-slider-value","aria-hidden":"true",children:Ne(P,{fg:"fg",type:"body",testId:`${l}-value`,children:d})})]})]})};import{jsx as st,jsxs as bn}from"react/jsx-runtime";var gn={done:0,current:1,pending:2},zo={done:{fg:"on-solid",surface:"success-solid"},current:{fg:"on-solid",surface:"info-solid"},pending:{fg:"fg-secondary",surface:void 0}},Jo=({label:e,steps:t,testId:n})=>{let{labels:r}=C();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,s)=>s>0&&gn[o.state]<gn[t[s-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:r.stepDone,current:null,pending:r.stepPending};return st("ol",{className:"cui-stepper",role:"list","aria-label":e,"data-cui-type":"body","data-testid":n,children:t.map((o,s)=>{let l=zo[o.state],i=a[o.state];return bn("li",{className:"cui-step","aria-current":o.state==="current"?"step":void 0,"data-cui-step":o.state,"data-testid":`${n}-${o.id}`,children:[st("span",{className:"cui-step-marker","aria-hidden":"true","data-cui-fg":l.fg,"data-cui-surface":l.surface,"data-cui-type":"caption",children:o.state==="done"?"\u2713":s+1}),bn("span",{className:"cui-step-label","data-cui-fg":"fg",children:[o.label,i===null?null:st("span",{className:"cui-visually-hidden",children:` (${i})`})]})]},o.id)})})};import{useId as Xo,useRef as jo}from"react";import{jsx as Ce,jsxs as hn}from"react/jsx-runtime";var Yo=({label:e,labelHidden:t,checked:n,onCheckedChange:r,unavailable:a,testId:o,ref:s,dataAttributes:l})=>{g();let i=Xo(),d=jo(null);O(d,{testId:o,part:"label",host:"button"});let p=X(a,i),u=a!==void 0,c=hn("button",{className:"cui-switch",type:"button",role:"switch","aria-checked":n,"aria-disabled":u?!0:void 0,"aria-describedby":B(p),"data-cui-fg":"fg","data-cui-type":"body","data-testid":o,ref:s,onClick:()=>{u||r(!n)},...w(l),children:[Ce("span",{className:"cui-switch-track","aria-hidden":"true","data-cui-surface":n?"info-solid":"sunken","data-testid":`${o}-track`,children:Ce("span",{className:"cui-switch-thumb","data-cui-surface":n?"surface":"neutral-solid","data-testid":`${o}-thumb`})}),Ce("span",{className:t===!0?"cui-visually-hidden":void 0,ref:d,children:e})]});return a?.reason===void 0?c:hn("span",{className:"cui-button-group",children:[c,Ce(P,{fg:"fg-muted",type:"body",id:i,testId:`${o}-reason`,children:a.reason})]})};import{useCallback as Zo,useEffect as Qo,useId as ea,useRef as Rn,useState as ta}from"react";import{jsx as ue,jsxs as Tn}from"react/jsx-runtime";var na=({label:e,items:t,currentId:n,onNavigate:r,testId:a,collapsible:o=!1})=>{if(g(),t.length===0)throw new RangeError("Tabs needs at least one tab");let s=new Set(t.map(m=>m.id));if(s.size!==t.length)throw new RangeError(`Tab keys must be unique: ${t.map(m=>m.id).join(", ")}`);let l=t.find(m=>m.id===n);if(l===void 0)throw new RangeError(`The current tab "${n}" is not one of the tabs: ${[...s].join(", ")}`);let[i,d]=ta(!1),p=Rn(null),u=Rn(null),c=ea(),b=Zo(m=>{d(!1),m&&p.current?.contains(document.activeElement)&&u.current?.focus()},[]);return Qo(()=>{if(!(o&&i))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)}},[o,i,b]),Tn("nav",{ref:p,className:"cui-tabs","aria-label":e,"data-testid":a,"data-cui-collapsible":o?"":void 0,"data-cui-open":o&&i?"":void 0,onKeyDown:o&&i?m=>_(m,()=>b(!0)):void 0,children:[o?Tn("button",{ref:u,type:"button",className:"cui-tabs-summary","aria-expanded":i,"aria-controls":c,"data-cui-fg":"fg","data-cui-type":"body","data-testid":`${a}-summary`,onClick:()=>d(m=>!m),children:[ue("span",{className:"cui-tabs-summary-label",children:l.label}),ue("span",{className:"cui-tabs-summary-marker","aria-hidden":"true",children:i?"\u25B4":"\u25BE"})]}):null,ue("ul",{className:"cui-tabs-list",id:c,role:"list","data-cui-surface":o?"surface":void 0,children:t.map(m=>{let f=m.id===n;return ue("li",{className:"cui-tabs-item",children:ue("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=>{me(h,m.href,r),h.defaultPrevented&&b(!1)},children:m.label})},m.id)})})]})};import{Children as ra,Fragment as oa,isValidElement as aa}from"react";import{jsx as W,jsxs as vn}from"react/jsx-runtime";var ia={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},sa=e=>{g();let{label:t,sublabel:n,tone:r,testId:a,dataAttributes:o}=e;if((e.text===void 0?e.value===null:e.text===null)&&r!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${r}`);let l=`${a}-value`;return vn("div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":r,"data-testid":a,...w(o),children:[W("p",{className:"cui-tile-label","data-cui-type":"caption","data-cui-measure":"reading",children:t}),W("p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption","data-cui-measure":"reading",children:n}),W("p",{className:"cui-tile-value","data-cui-fg":ia[r],"data-cui-type":"heading","data-cui-measure":"reading",children:e.text===void 0?W(we,{value:e.value,unit:e.unit,testId:l}):W(we,{text:e.text,keep:"wrap",testId:l})})]})},En=e=>ra.toArray(e).flatMap(t=>{if(!aa(t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===oa?En(t.props.children):[t]}),da=({count:e,minInlinePx:t,testId:n,children:r})=>{g();let a=vt(e,t,M.space["space-2"]),o=En(r).length;if(o!==e)throw new RangeError(`TileGrid has ${o} tiles but count is ${e}`);return vn("div",{className:"cui-container","data-testid":n,children:[W(j,{ruleKey:a.key,css:a.css}),W("div",{className:"cui-tile-grid","data-cui-tile-grid":a.key,"data-cui-gap":"space-2",children:r})]})};import{useLayoutEffect as la,useRef as xn}from"react";import{jsx as ca}from"react/jsx-runtime";var ke=e=>[...e.querySelectorAll("button")],ua=({label:e,testId:t,children:n})=>{g();let r=xn(null),a=xn(null);la(()=>{let i=ke(r.current),d=a.current!==null&&i.includes(a.current)?a.current:i[0]??null;a.current=d;for(let p of i)p.tabIndex=p===d?0:-1});let o=i=>{for(let d of ke(r.current))d.tabIndex=d===i?0:-1;a.current=i};return ca("div",{className:"cui-toolbar",role:"toolbar","aria-label":e,"aria-orientation":"horizontal","data-testid":t,ref:r,onFocus:i=>{let d=ke(i.currentTarget).find(p=>p.contains(i.target));d!==void 0&&o(d)},onKeyDown:i=>{let d=ke(i.currentTarget),p=d.indexOf(i.target);if(p===-1)return;let u=getComputedStyle(i.currentTarget).direction==="rtl"?"ArrowLeft":"ArrowRight",c=u==="ArrowRight"?"ArrowLeft":"ArrowRight",m={[u]:(p+1)%d.length,[c]:(p-1+d.length)%d.length,Home:0,End:d.length-1}[i.key];if(m===void 0)return;i.preventDefault();let f=d[m];o(f),f.focus()},children:n})};import{useState as pa}from"react";var ya=e=>{let[t,n]=pa({failure:null,count:0});return e!==null&&e!==t.failure?(n({failure:e,count:t.count+1}),t.count+1):t.count};import{useCallback as te,useEffect as ga,useLayoutEffect as Pn,useRef as ut}from"react";import{useCallback as Le,useEffect as fa,useLayoutEffect as ma,useRef as dt,useState as lt}from"react";var wn=e=>e===null?$e:Fe,Se=(e,t,n,r,a)=>{let[o,s]=lt(()=>({key:e,state:wn(e)})),[l,i]=lt(0),[d,p]=lt(0),u=dt(t),c=dt(null),b=dt(l);ma(()=>{u.current=t}),fa(()=>{if(e===null){s({key:null,state:$e});return}let R=new AbortController;c.current=e;let T=l===b.current?"revision":"reload";return b.current=l,s(v=>Object.is(v.key,e)?{key:e,state:r(v.state,T)}:{key:e,state:Fe}),u.current(R.signal).then(v=>{R.signal.aborted||(c.current=null,s(k=>({key:e,state:a(k.state,v)})))},v=>{R.signal.aborted||s(()=>{throw v})}),()=>{R.abort(),c.current=null}},[e,n,l,d]);let m=Le(()=>i(R=>R+1),[]),f=Le(()=>p(R=>R+1),[]),h=Le((R,T)=>{s(v=>Object.is(v.key,R)?{key:R,state:T(v.state)}:v)},[]),y=Le((R,T)=>{h(R,T),Object.is(c.current,R)&&f()},[h,f]);return{state:Object.is(o.key,e)?o.state:wn(e),reload:m,refresh:f,update:h,write:y}};var ba=(e,t,n)=>{let r=ut(t);Pn(()=>{r.current=t});let a=te(y=>r.current.first(y),[]),{state:o,reload:s,refresh:l,update:i,write:d}=Se(e,a,n,wt,Pt),p=ut({key:e,state:o});Pn(()=>{p.current={key:e,state:o}});let u=ut(null),c=te(()=>{u.current?.controller.abort(),u.current=null},[]);ga(()=>c,[e,n,c]);let b=te(()=>{c(),s()},[c,s]),m=te(()=>{c(),l()},[c,l]),f=te(()=>{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:[]};u.current=T,i(y,Nt),r.current.next(R,T.controller.signal).then(v=>{u.current===T&&(u.current=null,i(y,k=>T.maps.reduce((I,Nn)=>De(I,Nn),Ct(k,R,v))))},v=>{u.current===T&&i(y,()=>{throw v})})},[i]),h=te((y,E)=>{let R=u.current;R!==null&&Object.is(R.key,y)&&R.maps.push(E),d(y,T=>De(T,E))},[d]);return{state:o,reload:b,refresh:m,loadMore:f,updateList:h}};import{useCallback as ha,useRef as Ra,useState as Ta}from"react";var Ea=e=>typeof e=="object"&&e!==null&&typeof e.then=="function",va=()=>{let[e,t]=Ta(null),n=Ra(null),r=ha((a,o)=>{let s=o();if(!Ea(s))return;let l=Symbol(a);n.current=l,t(a);let i=()=>{n.current===l&&(n.current=null,t(null))};s.then(i,i)},[]);return{pendingKey:e,press:r}};import{useCallback as xa}from"react";var wa=(e,t,n)=>{let{state:r,reload:a,refresh:o,write:s}=Se(e,t,n,xt,Ae),l=xa((i,d)=>s(i,p=>Ae(p,{ok:!0,value:d})),[s]);return{state:r,reload:a,refresh:o,put:l}};import{jsx as Na}from"react/jsx-runtime";var Pa=({testId:e,children:t})=>(g(),Na("span",{className:"cui-visually-hidden","data-testid":e,children:t}));export{pe as ANNOUNCE_SETTLE_MS,tr as AccessFailureNotice,se as AlertMessage,nr as Breadcrumb,$ as Button,gt as COMPACT_ROW_PX,Da as CONSOLE_UI_LABEL_CATALOGS,Ka as CONTRAST_MINIMUM,mt as CONTRAST_PAIRS,Ge as Card,dr as CardSection,zr as CheckboxGroup,_e as Cluster,ur as CodeBlock,yr as ComparisonGrid,An as ConsoleUiRoot,Cr as DataTable,kr as DescriptionList,$r as Dialog,Dr as Disclosure,J as FIGURE_RING_REACH_PX,Xa as FLEXIBLE_COLUMN_MIN_PX,Ze as FailureMessage,Br as Field,no as Figure,ao as FigureEdge,oo as FigureNode,Jn as FragmentLink,oi as HTTP_FORBIDDEN,so as Heading,co as InlineChange,ho as JobCard,Ie as LATTICE_PX,Wn as Link,vo as List,xo as ListItem,Co as LoadMore,Ua as MORE_CONTRAST_MINIMUM,Lo as MasterDetail,we as Measured,So as Meter,sa as MetricTile,Hr as Notice,Ao as PanelTabs,qr as PasswordInput,tt as Pill,nt as ProgressBar,_a as ROW_WITH_CONTROL_PX,Wr as RadioGroup,Oo as ResourceFailed,fn as RowButton,Bo as SegmentedControl,Vr as Select,Go as SelectableList,Wo as Slider,jn as Stack,Jo as Stepper,Yo as Switch,z as TARGET_PX,M as TOKENS,ci as TONES,li as TONE_HUES,ui as TONE_ROLES,na as Tabs,P as Text,Gr as TextArea,_r as TextInput,da as TileGrid,ua as Toolbar,Pa as VisuallyHidden,Sa as ZonedTimeError,Nt as beginPage,wt as beginPagedReload,xt as beginReload,Wa as ceil8,Ba as ceilToLattice,za as cellContentInlinePx,ja as comparisonAttributePx,Oa as contrastRatio,Za as countSampleText,qa as cssVar,bt as figureBoxPlan,Rt as figureDiscLabelPlan,Fa as fillLabel,Ja as fixedColumnPx,ii as flatMapOutcome,Ca as formatByteSize,ce as formatCount,$a as formatInstant,ti as goldenSectionPx,Ha as hexToSrgb,Ya as instantSampleText,H as isReadableText,Ae as keepLastGood,si as lightDark,ai as mapOutcome,De as mapPagedList,ni as masterDetailPlan,Va as monoTextWidthEm,di as placeholderRule,F as pxToRem,ka as readDecimalText,La as readIntegerText,Aa as reasonAside,ft as resolveConsoleUiLabels,Pt as settleFirstPage,Ct as settlePage,ei as spacedTextWidthEm,ri as tableFrameMinInlinePx,Et as tableMinInlinePx,Ga as textWidthEm,vt as tileGridPlan,Qa as tileMinInlinePx,Ma as toOffsetIso,Ia as toWallTime,pt as topmostModalOf,Dn as useAccessFailure,Ke as useAnnounce,C as useConsoleUi,ir as useEscapeToClose,ya as useFailureOccurrence,ae as useFocusRescue,ba as usePagedResource,va as usePendingPress,wa as useResource};
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
--cui-size-row: 2.75rem;
|
|
19
19
|
--cui-size-row-control: 3.25rem;
|
|
20
20
|
--cui-size-row-compact: 1.75rem;
|
|
21
|
+
--cui-measure-dialog: calc(40ic + 2 * var(--cui-space-6));
|
|
21
22
|
--cui-border-width: 1px;
|
|
22
23
|
--cui-focus-width: 2px;
|
|
23
24
|
--cui-focus-offset: 2px;
|
|
@@ -72,6 +73,35 @@
|
|
|
72
73
|
--cui-motion-2: 180ms;
|
|
73
74
|
--cui-motion-3: 270ms;
|
|
74
75
|
}
|
|
76
|
+
[data-cui-root][data-cui-contrast="more"] {
|
|
77
|
+
--cui-fg: light-dark(#080d1c, #fbfcfd);
|
|
78
|
+
--cui-fg-secondary: light-dark(#1e2939, #f0f3f7);
|
|
79
|
+
--cui-fg-muted: light-dark(#293342, #e3e9f0);
|
|
80
|
+
--cui-danger-fg: light-dark(#660308, #ffe4e3);
|
|
81
|
+
--cui-warning-fg: light-dark(#4f1e02, #fef3c4);
|
|
82
|
+
--cui-success-fg: light-dark(#003b29, #d3fae6);
|
|
83
|
+
--cui-info-fg: light-dark(#0c2478, #deedff);
|
|
84
|
+
--cui-on-solid: light-dark(#ffffff, #080d1c);
|
|
85
|
+
--cui-surface: light-dark(#ffffff, #0f172b);
|
|
86
|
+
--cui-subtle: light-dark(#f8fafc, #1d293d);
|
|
87
|
+
--cui-sunken: light-dark(#f1f5f9, #020618);
|
|
88
|
+
--cui-danger-tint: light-dark(#fef2f2, #460809);
|
|
89
|
+
--cui-warning-tint: light-dark(#fffbeb, #461901);
|
|
90
|
+
--cui-success-tint: light-dark(#ecfdf5, #002c22);
|
|
91
|
+
--cui-info-tint: light-dark(#eff6ff, #162456);
|
|
92
|
+
--cui-neutral-solid: light-dark(#314158, #cad5e2);
|
|
93
|
+
--cui-danger-solid: light-dark(#9f0712, #ffa2a2);
|
|
94
|
+
--cui-success-solid: light-dark(#006045, #5ee9b5);
|
|
95
|
+
--cui-info-solid: light-dark(#193cb8, #8ec5ff);
|
|
96
|
+
--cui-warning-solid: light-dark(#7b3306, #ffd230);
|
|
97
|
+
--cui-danger-accent: light-dark(#8b0004, #ffb3b0);
|
|
98
|
+
--cui-warning-accent: light-dark(#702b00, #fedd9c);
|
|
99
|
+
--cui-success-accent: light-dark(#005638, #a1eac5);
|
|
100
|
+
--cui-info-accent: light-dark(#08369a, #a5cfff);
|
|
101
|
+
--cui-focus: light-dark(#08369a, #a5cfff);
|
|
102
|
+
--cui-border-control: light-dark(#384353, #c2ccd9);
|
|
103
|
+
--cui-border-subtle: light-dark(#6b6e73, #86909f);
|
|
104
|
+
}
|
|
75
105
|
@media (prefers-reduced-motion: reduce) {
|
|
76
106
|
[data-cui-root] {
|
|
77
107
|
--cui-motion-1: 0ms;
|
|
@@ -1666,11 +1696,12 @@
|
|
|
1666
1696
|
overflow-wrap: anywhere;
|
|
1667
1697
|
}
|
|
1668
1698
|
|
|
1669
|
-
/* 対話: 枠 1 と、枠の幅を引いた余白 23 (枠と余白の和 24 が格子に乗る) の容器。幅は 40 字の段落 (WCAG 1.4.8) と両側の 24
|
|
1670
|
-
|
|
1699
|
+
/* 対話: 枠 1 と、枠の幅を引いた余白 23 (枠と余白の和 24 が格子に乗る) の容器。幅は 40 字の段落 (WCAG 1.4.8) と両側の 24 の和
|
|
1700
|
+
(--cui-measure-dialog。ホストが同じ外の幅の箱を作る時も同じ変数を使う) 以下で、表示域から左右 24 ずつを除いた幅を超えない。見出しは
|
|
1701
|
+
カードの見出しの規則を共にする (題の行 28 に閉じるボタン 44 を中央で揃え、上下 −8 で重ねる) */
|
|
1671
1702
|
.cui-dialog {
|
|
1672
1703
|
box-sizing: border-box;
|
|
1673
|
-
inline-size:
|
|
1704
|
+
inline-size: var(--cui-measure-dialog);
|
|
1674
1705
|
max-inline-size: calc(100% - 2 * var(--cui-space-6));
|
|
1675
1706
|
padding: calc(var(--cui-space-6) - var(--cui-border-width));
|
|
1676
1707
|
border: var(--cui-border-width) solid var(--cui-border-subtle);
|
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
|
|
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 _chunkXLOWKWIIcjs = require('./chunk-XLOWKWII.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(_chunkXLOWKWIIcjs.j,e)&&_chunkXLOWKWIIcjs.j[e]==="nonText",F=(e,t)=>{let l=_chunkXLOWKWIIcjs.i.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=_chunkXLOWKWIIcjs.i.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.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as h,j as y}from"./chunk-RA33TN5N.js";var E=new Set,T=new WeakMap,v="[autofocus], a[href], button, input, select, textarea, [tabindex]:not([tabindex='-1'])",_=()=>[...E].filter(e=>e.isConnected&&e.open),A=e=>{let t=e.dispatchEvent(new Event("cancel",{cancelable:!0}));return t&&e.close(),t},C=e=>e.ownerDocument.activeElement.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",code:"Escape",bubbles:!0,cancelable:!0,composed:!0}))&&A(e),I=()=>{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),this.querySelector(v)?.focus()}},close:{configurable:!0,writable:!0,value(){if(!this.open)return;this.removeAttribute("open"),E.delete(this);let e=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(y,e)&&y[e]==="nonText",F=(e,t)=>{let l=h.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=(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=h.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===""||a.closest(q)?.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 ${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}};export{I as installDialogModel,_ as openModals,C as pressEscape,W as scanColourRoles,A as sendCloseRequest};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/console-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Host-agnostic UI foundation for React admin consoles, with a React entry, a React-free core entry, a DOM testing entry and a stylesheet.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"author": "AI Quants",
|
|
61
61
|
"license": "MIT",
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@aiquants/auth-core": "^0.
|
|
63
|
+
"@aiquants/auth-core": "^0.9.0",
|
|
64
64
|
"react": ">=19",
|
|
65
65
|
"react-dom": ">=19"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@aiquants/auth-core": "0.
|
|
68
|
+
"@aiquants/auth-core": "0.9.1",
|
|
69
69
|
"@testing-library/jest-dom": "^6.9.1",
|
|
70
70
|
"@testing-library/react": "^16.3.2",
|
|
71
71
|
"@testing-library/user-event": "^14.6.1",
|
package/dist/chunk-7M4I26BS.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;var i=n=>{let e=u.exec(n);if(e===null)throw new RangeError(`Colour must be #rrggbb: ${n}`);let[,s,r,t]=e;return[Number.parseInt(s,16)/255,Number.parseInt(r,16)/255,Number.parseInt(t,16)/255]},o=n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4,c=n=>{for(let t of n)if(!(t>=0&&t<=1))throw new RangeError(`sRGB channels must be numbers in [0, 1]: ${n.join(", ")}`);let[e,s,r]=n;return .2126*o(e)+.7152*o(s)+.0722*o(r)},f= exports.b =(n,e)=>{let[s,r]=[c(n),c(e)].sort((t,a)=>a-t);return(s+.05)/(r+.05)},g= exports.c ={text:7,largeText:4.5,nonText:3},l= exports.d ={light:{fg:{surface:17.83,subtle:17.04,sunken:16.28,"danger-tint":16.3,"warning-tint":17.19,"success-tint":16.93,"info-tint":16.38},"fg-secondary":{surface:10.36,subtle:9.9,sunken:9.45},"fg-muted":{surface:7.8,subtle:7.46,sunken:7.12,"danger-tint":7.13,"warning-tint":7.52,"info-tint":7.17},"danger-fg":{surface:8.36,subtle:7.99,"danger-tint":7.64},"warning-fg":{surface:9.06,subtle:8.66,"warning-tint":8.73},"success-fg":{surface:7.61,subtle:7.27,"success-tint":7.23},"info-fg":{surface:8.82,"info-tint":8.11,subtle:8.43},"on-solid":{"neutral-solid":10.36,"danger-solid":8.36,"success-solid":7.61,"info-solid":8.82,"warning-solid":9.06},"danger-accent":{surface:4.77,"danger-tint":4.36},"warning-accent":{surface:5.03,"warning-tint":4.85},"success-accent":{surface:3.65,"success-tint":3.47},"info-accent":{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},focus:{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},"border-control":{surface:4.76,subtle:4.55,sunken:4.35}},dark:{fg:{surface:17.04,subtle:13.97,sunken:19.27,"danger-tint":15.45,"warning-tint":14.34,"success-tint":14.51,"info-tint":14.13},"fg-secondary":{surface:14.46,subtle:11.86,sunken:16.35},"fg-muted":{surface:12,subtle:9.83,sunken:13.56,"danger-tint":10.87,"warning-tint":10.09,"info-tint":9.94},"danger-fg":{surface:12.27,subtle:10.06,"danger-tint":11.12},"warning-fg":{surface:14.33,subtle:11.74,"warning-tint":12.05},"success-fg":{surface:13.94,subtle:11.43,"success-tint":11.87},"info-fg":{surface:12.54,"info-tint":10.39,subtle:10.28},"on-solid":{"neutral-solid":12,"danger-solid":9.29,"success-solid":11.72,"info-solid":9.83,"warning-solid":12.32},"danger-accent":{surface:6.17,"danger-tint":5.6},"warning-accent":{surface:10.4,"warning-tint":8.75},"success-accent":{surface:9.2,"success-tint":7.83},"info-accent":{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},focus:{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},"border-control":{surface:6.78,subtle:5.56,sunken:7.66}}},b= exports.e ={fg:"text","fg-secondary":"text","fg-muted":"text","danger-fg":"text","warning-fg":"text","success-fg":"text","info-fg":"text","on-solid":"text","danger-accent":"nonText","warning-accent":"nonText","success-accent":"nonText","info-accent":"nonText",focus:"nonText","border-control":"nonText"};exports.a = i; exports.b = f; exports.c = g; exports.d = l; exports.e = b;
|
package/dist/chunk-FXEGLGL7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var u=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;var i=n=>{let e=u.exec(n);if(e===null)throw new RangeError(`Colour must be #rrggbb: ${n}`);let[,s,r,t]=e;return[Number.parseInt(s,16)/255,Number.parseInt(r,16)/255,Number.parseInt(t,16)/255]},o=n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4,c=n=>{for(let t of n)if(!(t>=0&&t<=1))throw new RangeError(`sRGB channels must be numbers in [0, 1]: ${n.join(", ")}`);let[e,s,r]=n;return .2126*o(e)+.7152*o(s)+.0722*o(r)},f=(n,e)=>{let[s,r]=[c(n),c(e)].sort((t,a)=>a-t);return(s+.05)/(r+.05)},g={text:7,largeText:4.5,nonText:3},l={light:{fg:{surface:17.83,subtle:17.04,sunken:16.28,"danger-tint":16.3,"warning-tint":17.19,"success-tint":16.93,"info-tint":16.38},"fg-secondary":{surface:10.36,subtle:9.9,sunken:9.45},"fg-muted":{surface:7.8,subtle:7.46,sunken:7.12,"danger-tint":7.13,"warning-tint":7.52,"info-tint":7.17},"danger-fg":{surface:8.36,subtle:7.99,"danger-tint":7.64},"warning-fg":{surface:9.06,subtle:8.66,"warning-tint":8.73},"success-fg":{surface:7.61,subtle:7.27,"success-tint":7.23},"info-fg":{surface:8.82,"info-tint":8.11,subtle:8.43},"on-solid":{"neutral-solid":10.36,"danger-solid":8.36,"success-solid":7.61,"info-solid":8.82,"warning-solid":9.06},"danger-accent":{surface:4.77,"danger-tint":4.36},"warning-accent":{surface:5.03,"warning-tint":4.85},"success-accent":{surface:3.65,"success-tint":3.47},"info-accent":{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},focus:{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},"border-control":{surface:4.76,subtle:4.55,sunken:4.35}},dark:{fg:{surface:17.04,subtle:13.97,sunken:19.27,"danger-tint":15.45,"warning-tint":14.34,"success-tint":14.51,"info-tint":14.13},"fg-secondary":{surface:14.46,subtle:11.86,sunken:16.35},"fg-muted":{surface:12,subtle:9.83,sunken:13.56,"danger-tint":10.87,"warning-tint":10.09,"info-tint":9.94},"danger-fg":{surface:12.27,subtle:10.06,"danger-tint":11.12},"warning-fg":{surface:14.33,subtle:11.74,"warning-tint":12.05},"success-fg":{surface:13.94,subtle:11.43,"success-tint":11.87},"info-fg":{surface:12.54,"info-tint":10.39,subtle:10.28},"on-solid":{"neutral-solid":12,"danger-solid":9.29,"success-solid":11.72,"info-solid":9.83,"warning-solid":12.32},"danger-accent":{surface:6.17,"danger-tint":5.6},"warning-accent":{surface:10.4,"warning-tint":8.75},"success-accent":{surface:9.2,"success-tint":7.83},"info-accent":{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},focus:{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},"border-control":{surface:6.78,subtle:5.56,sunken:7.66}}},b={fg:"text","fg-secondary":"text","fg-muted":"text","danger-fg":"text","warning-fg":"text","success-fg":"text","info-fg":"text","on-solid":"text","danger-accent":"nonText","warning-accent":"nonText","success-accent":"nonText","info-accent":"nonText",focus:"nonText","border-control":"nonText"};export{i as a,f as b,g as c,l as d,b as e};
|
package/dist/chunk-H4DAGEIG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ee=[{name:"B",power:0,fractionDigits:0},{name:"KiB",power:1,fractionDigits:1},{name:"MiB",power:2,fractionDigits:1},{name:"GiB",power:3,fractionDigits:2},{name:"TiB",power:4,fractionDigits:2}],j=new Map,K=e=>Number.isSafeInteger(e)&&e>=0,V=(e,t,n)=>{let r=`${n} ${t}`,o=j.get(r);return o===void 0&&(o=new Intl.NumberFormat(t,{minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:!0}),j.set(r,o)),o.format(e===0?0:e)},w=(e,t)=>{if(!K(e))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);return V(e,t,0)},Y=(e,t)=>Number((e/1024**t.power).toFixed(t.fractionDigits)),Se=(e,t)=>{if(!K(e))throw new RangeError(`A byte size must be a non-negative safe integer: ${e}`);let[n,...r]=Ee,o=n,i=Y(e,o);for(let d of r){if(i<1024)break;o=d,i=Y(e,o)}return`${V(i,t,o.fractionDigits)} ${o.name}`},J=(e,t)=>t===void 0?e:`${e} ${t}`;var Ce=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Pe=/[!-~]/g;var _e=/^[^eE]*[1-9]/,q=e=>{let t=e.replace(Pe,r=>String.fromCharCode(r.charCodeAt(0)-65248)).trim();if(!Ce.test(t))return null;let n=Number(t);return Number.isFinite(n)?n===0?_e.test(t)?null:0:n:null},we=e=>{let t=q(e);return t!==null&&Number.isSafeInteger(t)?t:null};var Oe=/[^\p{White_Space}\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/u,f=e=>Oe.test(e);var l=class extends RangeError{reason;constructor(t,n){super(n),this.name="ZonedTimeError",this.reason=t}},Ie=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,Ne=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,Me=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,Z=864e5,I=6e4,E={min:1,max:9999},Q=new Map,ee=new Map,Le=e=>{let t=Q.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Q.set(e,t)),t},te=e=>{let t=new Date(0);return t.setUTCFullYear(e.year,e.month-1,e.day),t.setUTCHours(e.hour,e.minute,e.second,0),t.getUTCFullYear()===e.year&&t.getUTCMonth()===e.month-1&&t.getUTCDate()===e.day&&t.getUTCHours()===e.hour&&t.getUTCMinutes()===e.minute&&t.getUTCSeconds()===e.second?t.getTime():null},N=(e,t)=>{let[n,r,o,i,d,s,R]=t;if(R!==void 0&&/[1-9]/.test(R))throw new l("subsecond",`Fractions of a second cannot be kept: ${e}`);let p={year:Number(n),month:Number(r),day:Number(o),hour:Number(i),minute:Number(d),second:s===void 0?0:Number(s)},X=p.year>=E.min?te(p):null;if(X===null)throw new l("malformed",`Not a calendar date and time: ${e}`);return{fields:p,millis:X}},M=(e,t)=>{let n=new Map(Le(t).formatToParts(new Date(e)).map(o=>[o.type,o.value])),r={year:Number(n.get("year")),month:Number(n.get("month")),day:Number(n.get("day")),hour:Number(n.get("hour")),minute:Number(n.get("minute")),second:Number(n.get("second"))};if(n.get("era")!=="AD"||r.year>E.max)throw new l("malformed",`The wall clock falls outside years ${E.min}-${E.max}: ${new Date(e).toISOString()}`);return r},O=(e,t)=>te(M(e,t))-e,g=e=>String(e).padStart(2,"0"),ne=(e,t)=>{let n=`${String(e.year).padStart(4,"0")}-${g(e.month)}-${g(e.day)}T${g(e.hour)}:${g(e.minute)}`;return t||e.second!==0?`${n}:${g(e.second)}`:n},Fe=e=>{if(e%I!==0)throw new l("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let t=Math.abs(e)/I;return`${e<0?"-":"+"}${g(Math.floor(t/60))}:${g(t%60)}`},$e=(e,t)=>{let n=Ie.exec(e);if(n===null)throw new l("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:r,millis:o}=N(e,n.slice(1)),d=[...new Set([O(o-Z,t),O(o+Z,t)])].filter(s=>O(o-s,t)===s);if(d.length===0)throw new l("nonexistent",`${e} does not exist in ${t}`);if(d.length>1)throw new l("ambiguous",`${e} occurs twice in ${t}`);return`${ne(r,!0)}${Fe(d[0])}`},re=(e,t)=>{let[n,r,o,i]=t;if(n!==void 0)return 0;if(Number(o)>23||Number(i)>59)throw new l("malformed",`Not a valid offset: ${e}`);return(r==="-"?-1:1)*(Number(o)*60+Number(i))*I},Ae=(e,t)=>{let n=Ne.exec(e);if(n===null)throw new l("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:r}=N(e,n.slice(1,8));return ne(M(r-re(e,n.slice(8)),t),!1)},De=(e,t)=>{let n=JSON.stringify([e,t]),r=ee.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),ee.set(n,r)),r},L=(e,t,n)=>{let r=Me.exec(e);if(r===null)throw new l("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=N(e,[...r.slice(1,7),void 0]),i=o-re(e,r.slice(7));return M(i,n),De(t,n).format(i)};function ve(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>Object.hasOwn(t,r)?String(t[r]):n)}import{accessFailureKindOfStatus as Ue}from"@aiquants/auth-core";var T=e=>e===""?"":` (${e})`,oe=(e,t)=>{if(e.status!==null&&Ue(e.status)!==null)throw new RangeError(`failureSentence: a ${e.status} is an access failure, which the root's presenter states (draw it with FailureMessage or ResourceFailed)`);return t(e.reason)},Be=(e,t)=>t===""?e:`${e} Reason: ${t}.`,He=(e,t)=>t===""?e:`${e}${t}\u3002`,S={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load${T(e)}.`,refreshFailed:e=>`Could not refresh${T(e)}.`,forbiddenBecause:Be,failureSentence:oe,loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload",breadcrumb:"Breadcrumb",stepDone:"Done",stepPending:"Not started"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F${T(e)}\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F${T(e)}\u3002`,forbiddenBecause:He,failureSentence:oe,loadMore:e=>`\u3055\u3089\u306B ${e} \u4EF6\u3092\u8868\u793A`,endOfRecords:"\u3053\u308C\u4EE5\u4E0A\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093",close:"\u9589\u3058\u308B",cancel:"\u3084\u3081\u308B",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",breadcrumb:"\u30D1\u30F3\u304F\u305A",stepDone:"\u5B8C\u4E86",stepPending:"\u672A\u7740\u624B"}},We=e=>{if(!Object.hasOwn(S,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(S).join(", ")}`);return S[e]};var ze=4,Ge=[1,2,3,4,6,8,12,16,24],Xe=16,je=5/4,$={caption:-2,body:-1,"body-lg":0,title:0,heading:1,display:2,"display-lg":3},Ye=11,ae=3/2,Ke=7/4,Ve=7/4,Je=120,qe=3/2,Ze=[1,2,3],ie=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`A length must be a finite number of px at or above 0: ${e}`);return Math.ceil(e/4)*4},A=e=>{if(!Number.isInteger(e))throw new RangeError(`A type step must be an integer: ${e}`);return Math.max(Ye,Math.round(Xe*je**e))},D=(e,t)=>ie(e*t),se=D(A($.body),ae),b=se+24,le=b+8,de=se+8,F={weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},stroke:{"border-width":1,"focus-width":2,"focus-offset":2,"marker-width":2}},Qe=()=>Object.fromEntries(Ge.map(e=>[`space-${e}`,e*4])),et=()=>{let e=Object.fromEntries(Object.entries($).map(([n,r])=>{let o=A(r);return[n,{size:o,lineHeight:D(o,n==="title"?Ve:ae)}]})),t=A($.body);return{...e,prose:{size:t,lineHeight:D(t,Ke)}}},tt=()=>Object.fromEntries(Ze.map(e=>[`motion-${e}`,Je*qe**(e-1)])),ce=e=>Object.freeze({space:Object.freeze(Qe()),type:Object.freeze(et()),weight:F.weight,radius:F.radius,size:Object.freeze({"size-target":b,"size-control":b,"size-row":b,"size-row-control":le,"size-row-compact":de}),stroke:F.stroke,motion:Object.freeze(tt()),color:Object.freeze({...e})});var nt={fg:{light:"#0f172b",dark:"#f8fafc"},"fg-secondary":{light:"#314158",dark:"#e2e8f0"},"fg-muted":{light:"#44536a",dark:"#cad5e2"},"danger-fg":{light:"#9f0712",dark:"#ffc9c9"},"warning-fg":{light:"#7b3306",dark:"#fee685"},"success-fg":{light:"#006045",dark:"#a4f4cf"},"info-fg":{light:"#193cb8",dark:"#bedbff"},"on-solid":{light:"#ffffff",dark:"#0f172b"},surface:{light:"#ffffff",dark:"#0f172b"},subtle:{light:"#f8fafc",dark:"#1d293d"},sunken:{light:"#f1f5f9",dark:"#020618"},"danger-tint":{light:"#fef2f2",dark:"#460809"},"warning-tint":{light:"#fffbeb",dark:"#461901"},"success-tint":{light:"#ecfdf5",dark:"#002c22"},"info-tint":{light:"#eff6ff",dark:"#162456"},"neutral-solid":{light:"#314158",dark:"#cad5e2"},"danger-solid":{light:"#9f0712",dark:"#ffa2a2"},"success-solid":{light:"#006045",dark:"#5ee9b5"},"info-solid":{light:"#193cb8",dark:"#8ec5ff"},"warning-solid":{light:"#7b3306",dark:"#ffd230"},"danger-accent":{light:"#e7000b",dark:"#ff6467"},"warning-accent":{light:"#bb4d00",dark:"#fcbb00"},"success-accent":{light:"#009966",dark:"#00d492"},"info-accent":{light:"#155dfc",dark:"#51a2ff"},focus:{light:"#155dfc",dark:"#51a2ff"},"border-control":{light:"#62748e",dark:"#90a1b9"},"border-subtle":{light:"#e2e8f0",dark:"#314158"}},a=ce(nt),rt="--cui-",ot=e=>`var(${rt}${e})`;var at=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,ue=(e,t)=>{let n=0,r=0;for(let o of e)at(o.codePointAt(0))?r+=1:n+=1;return n*1+r*t},h=e=>ue(e,.55),x=e=>ue(e,.6),u=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return Math.max(0,Math.ceil((e-1e-9)/8))*8};var me="caption",B="body",H=2*a.space["space-3"],fe={type:"caption",paddingInlinePx:2*a.space["space-2"]},v={type:"body",paddingInlinePx:2*a.space["space-3"]+2*a.stroke["border-width"],minInlinePx:a.size["size-control"]},ge={type:"body",minInlinePx:a.size["size-target"]},C={trackInlinePx:2*a.type.body.lineHeight+3*a.space["space-1"],labelGapPx:a.space["space-2"],type:"body"},U={captionType:"caption",valueType:"heading",paddingInlinePx:2*a.space["space-3"]},it=10,st="2000-01-01T00:00:00Z",lt=9999999,pe=(e,t,n)=>(t==="mono"?x(e):h(e))*a.type[n].size,dt=(e,t)=>{if(e.length===0)throw new RangeError(`A ${t} needs at least one text to be measured with`);for(let n of e)if(!f(n))throw new RangeError(`A ${t} sample must hold a readable character: ${JSON.stringify(n)}`);return e},c=(e,t,n,r)=>Math.max(...dt(e,t).map(o=>pe(o,n,r))),W=e=>{switch(e.kind){case"text":return c(e.texts,"text",e.face,e.type);case"measured":return c(e.texts,"measured value","sans",B);case"pill":return c(e.labels,"pill","sans",fe.type)+fe.paddingInlinePx;case"button":return Math.max(v.minInlinePx,c(e.labels,"button","sans",v.type)+v.paddingInlinePx);case"link":return Math.max(ge.minInlinePx,c(e.labels,"link","sans",ge.type));case"switch":return e.labelHidden?C.trackInlinePx:C.trackInlinePx+C.labelGapPx+c(e.labels,"switch","sans",C.type);case"cluster":{if(e.items.length===0)throw new RangeError("A cluster needs at least one item to be measured with");return e.items.reduce((t,n)=>t+W(n),0)+(e.items.length-1)*a.space[e.gap]}}},ct=(e,t)=>{let n=c([e.header],"column header","sans",me),r=e.note===void 0?0:c(e.note,"column header note","sans",me);return u(Math.max(n,r,...t.map(W))+H)},ut=u(pe("\u3042".repeat(it),"sans",B)+H),mt=e=>u(c(e,"comparison attribute","sans",B)+H),ft=(e,t)=>L(st,e,t),gt=(e,t)=>{if(t!==void 0&&!f(t))throw new RangeError(`A count sample's unit must hold a readable character: ${JSON.stringify(t)}`);return J(w(lt,e),t)},pt=(e,t)=>u(Math.max(c(e,"tile caption","sans",U.captionType),c(t,"tile value","sans",U.valueType))+U.paddingInlinePx);var yt=.12,Tt=.16,bt=/[\u0020\u00a0\u1361\u{10100}\u{10101}\u{1039f}\u{1091f}]/u,k=a.space["space-3"],P=(e,t)=>{let n=0,r=0;for(let i of e)n+=1,bt.test(i)&&(r+=1);return(t==="mono"?x(e):h(e))+yt*n+Tt*r},ht=e=>{for(let n of[e.name,...e.notes])if(!f(n))throw new RangeError(`A figure node's name and notes must hold a readable character: ${JSON.stringify(n)}`);let t=Math.max(P(e.name,"sans")*a.type.body.size,...e.notes.map(n=>P(n,"sans")*a.type.caption.size));return{minWidthPx:u(t)+2*k,heightPx:2*k+a.type.body.lineHeight+e.notes.length*a.type.caption.lineHeight}},cn=e=>{let t=k+a.type.body.lineHeight;return{insetPx:k,namePx:k+a.type.body.lineHeight/2,notesPx:Array.from({length:e},(n,r)=>t+r*a.type.caption.lineHeight+a.type.caption.lineHeight/2)}},xt=(e,t)=>{if(e!==null&&!f(e))throw new RangeError(`A disc's name must hold a readable character: ${JSON.stringify(e)}`);if(!(Number.isFinite(t)&&t>0))throw new RangeError(`A disc's radius must be a positive finite px value: ${t}`);return e===null?{widthPx:0,extentBelowPx:t+ye}:{widthPx:u(P(e,"sans")*a.type.caption.size),extentBelowPx:t+a.space["space-1"]+a.type.caption.lineHeight}},ye=a.stroke["focus-offset"]+a.stroke["focus-width"],un=a.stroke["focus-offset"]+a.stroke["focus-width"]/2;var _=(1+Math.sqrt(5))/2,kt=(e,t)=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`A length must be a finite number of px at or above 0: ${e}`);if(!(Number.isInteger(t)&&t>=0))throw new RangeError(`A golden section step must be an integer at or above 0: ${t}`);return e/_**t};var Rt=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},m=e=>`${Rt(e)/16}rem`;var Te=({masterMinPx:e,detailMinPx:t,gapPx:n})=>{for(let r of[e,t])if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Pane minimum must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+t},Et=(e,t)=>{let n=Te(t);if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Container width must be a px value >= 0: ${e}`);if(e<n)return{sideBySide:!1,sideBySideFromPx:n,masterInlinePx:e,detailInlinePx:e};let r=(e-t.gapPx)/(1+_),o=Math.min(Math.max(t.masterMinPx,r),e-t.gapPx-t.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-t.gapPx-o}},Tn=e=>{let t=Te(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,r=`[data-cui-master-detail="${n}"]`,o=m(e.gapPx),i=`${r}{grid-template-columns:minmax(0,1fr);gap:${o}}`,d=`clamp(${m(e.masterMinPx)},calc((100% - ${o}) / ${1+_}),calc(100% - ${o} - ${m(e.detailMinPx)}))`,s=`@container (min-width:${m(t)}){${r}{grid-template-columns:${d} minmax(0,1fr)}}`;return{key:n,css:i+s}};var St=2*a.space["space-1"],be=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},he=e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let t=0,n=null;for(let{width:r}of e){if(r.fixedPx!==void 0){t+=be(r.fixedPx);continue}let o=be(r.minPx);if(n!==null&&n!==o)throw new RangeError(`Flexible columns share the remaining width equally, so their minimums must be equal: ${n} and ${o}`);n=o,t+=o}return t},Ct=e=>he(e)+St;var Pt=(e,t,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Tile minimum width must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let r=[];for(let s=1;s<=e;s+=1)e%s===0&&r.push({columns:s,minContainerPx:s*t+(s-1)*n});let o=`cui-tiles-n${e}-m${t}-g${n}`,i=`[data-cui-tile-grid="${o}"]`,d=r.map(({columns:s,minContainerPx:R})=>{let p=`${i}{grid-template-columns:repeat(${s},minmax(0,1fr))}`;return s===1?p:`@container (min-width:${m(R)}){${p}}`});return{key:o,steps:r,css:d.join("")}};var _t=403,wt=(e,t)=>e.ok?{ok:!0,value:t(e.value)}:e,Ot=(e,t)=>e.ok?t(e.value):e,En={kind:"idle"},It={kind:"loading"},z=(e,t)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?t==="reload"?{...e,retrying:!0}:e:It,G=(e,t)=>t.ok?{kind:"ready",value:t.value,refreshing:!1,refreshFailure:null}:e.kind==="failed"&&e.status===403?e.retrying?{...e,retrying:!1}:e:e.kind==="ready"&&t.status!==403?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:t.status,reason:t.reason}}:{kind:"failed",status:t.status,reason:t.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var Nt=(e,t)=>{let n=z(e,t);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},Mt=(e,t)=>G(e,t.ok?{ok:!0,value:{rows:t.value.rows,next:t.value.next,meta:t.value.meta,loadingMore:!1,moreFailure:null}}:t),Lt=e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,Ft=(e,t,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,t)))return e;if(n.ok)return{...e,value:{...e.value,rows:[...e.value.rows,...n.value.rows],next:n.value.next,loadingMore:!1,moreFailure:null}};let r=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:r}}}},$t=(e,t)=>{if(e.kind!=="ready")return e;let{rows:n,meta:r}=t({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:r}}};var At=/^#[0-9a-f]{6}$/i,Dt=/^[a-z][a-z0-9-]*$/,xe=e=>{if(!At.test(e))throw new RangeError(`A palette colour must be #rrggbb: ${e}`);return e},ke=({light:e,dark:t})=>`light-dark(${xe(e)}, ${xe(t)})`,vt=e=>{if(!Dt.test(e))throw new RangeError(`A root attribute must be lowercase letters, digits and hyphens, starting with a letter: ${e}`);return`[${e}] ::placeholder { color: ${ke(a.color["fg-muted"])}; opacity: 1; }`};var Re=["indigo","violet","purple","fuchsia","pink","rose","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue"],Ut=["fg","tint","accent","line","solid","solid-hover"],Bt={indigo:{fg:{light:"#372aac",dark:"#c6d2ff"},tint:{light:"#eff3ff",dark:"#1e1a4d"},accent:{light:"#4f39f6",dark:"#7c86ff"}},violet:{fg:{light:"#5d0ec0",dark:"#ddd6ff"},tint:{light:"#f5f3ff",dark:"#2f0d68"},accent:{light:"#7f22fe",dark:"#a684ff"}},purple:{fg:{light:"#6e11b0",dark:"#e9d4ff"},tint:{light:"#faf5ff",dark:"#3c0366"},accent:{light:"#9810fa",dark:"#c27aff"}},fuchsia:{fg:{light:"#8a0194",dark:"#f6cfff"},tint:{light:"#fdf4ff",dark:"#4b004f"},accent:{light:"#c800de",dark:"#ed6aff"}},pink:{fg:{light:"#a3004c",dark:"#fccee8"},tint:{light:"#fdf2f8",dark:"#510424"},accent:{light:"#e60076",dark:"#fb64b6"}},rose:{fg:{light:"#a50036",dark:"#ffccd3"},tint:{light:"#fff1f2",dark:"#4d0218"},accent:{light:"#ec003f",dark:"#ff637e"}},red:{fg:{light:"#9f0712",dark:"#ffc9c9"},tint:{light:"#fef2f2",dark:"#460809"},accent:{light:"#e7000b",dark:"#ff6467"}},orange:{fg:{light:"#7e2a0c",dark:"#ffd6a7"},tint:{light:"#fff7ed",dark:"#441306"},accent:{light:"#f54900",dark:"#ff8904"}},amber:{fg:{light:"#7b3306",dark:"#fee685"},tint:{light:"#fffbeb",dark:"#461901"},accent:{light:"#bb4d00",dark:"#fcbb00"}},yellow:{fg:{light:"#733e0a",dark:"#fff085"},tint:{light:"#fefce8",dark:"#432004"},accent:{light:"#a65f00",dark:"#fdc700"}},lime:{fg:{light:"#35530e",dark:"#d8f999"},tint:{light:"#f7fee7",dark:"#192e03"},accent:{light:"#497d00",dark:"#9ae600"}},green:{fg:{light:"#0d542b",dark:"#b9f8cf"},tint:{light:"#f0fdf4",dark:"#032e15"},accent:{light:"#008236",dark:"#05df72"}},emerald:{fg:{light:"#004f3b",dark:"#a4f4cf"},tint:{light:"#ecfdf5",dark:"#002c22"},accent:{light:"#009966",dark:"#00d492"}},teal:{fg:{light:"#0b4f4a",dark:"#96f7e4"},tint:{light:"#f0fdfa",dark:"#022f2e"},accent:{light:"#009689",dark:"#00d5be"}},cyan:{fg:{light:"#104e64",dark:"#a2f4fd"},tint:{light:"#ecfeff",dark:"#053345"},accent:{light:"#0092b8",dark:"#00d3f2"}},sky:{fg:{light:"#024a70",dark:"#b8e6fe"},tint:{light:"#f0f9ff",dark:"#052f4a"},accent:{light:"#0084d1",dark:"#00bcff"}},blue:{fg:{light:"#193cb8",dark:"#bedbff"},tint:{light:"#eff6ff",dark:"#162456"},accent:{light:"#155dfc",dark:"#51a2ff"}}},y=({light:e,dark:t})=>Object.freeze({light:e,dark:t}),Ht=({fg:e,tint:t,accent:n})=>Object.freeze({fg:y(e),tint:y(t),accent:y(n),line:y({light:e.dark,dark:e.light}),solid:y(e),"solid-hover":y({light:t.dark,dark:t.light})}),Wt=Object.freeze(Object.fromEntries(Re.map(e=>[e,Ht(Bt[e])])));export{w as a,Se as b,J as c,q as d,we as e,f,l as g,$e as h,Ae as i,L as j,ve as k,T as l,S as m,We as n,ze as o,ie as p,b as q,le as r,de as s,a as t,ot as u,h as v,x as w,u as x,W as y,ct as z,ut as A,mt as B,ft as C,gt as D,pt as E,P as F,ht as G,cn as H,xt as I,ye as J,un as K,kt as L,m as M,Et as N,Tn as O,he as P,Ct as Q,Pt as R,_t as S,wt as T,Ot as U,En as V,It as W,z as X,G as Y,Nt as Z,Mt as _,Lt as $,Ft as aa,$t as ba,ke as ca,vt as da,Re as ea,Ut as fa,Wt as ga};
|