@aiquants/console-ui 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,8 +27,8 @@ The `/core` exports:
27
27
  - Tokens and contrast: `TOKENS`, `cssVar`, `contrastRatio`, `hexToSrgb`, `CONTRAST_PAIRS`, `CONTRAST_MINIMUM`.
28
28
  - Layout arithmetic: `textWidthEm`, `monoTextWidthEm`, `ceil8`, `tileGridPlan`, `tableMinInlinePx`, `masterDetailPlan`.
29
29
  - Formatting: `formatCount`, `toOffsetIso`, `toWallTime`, `formatInstant`, `ZonedTimeError`.
30
- - Labels: `CONSOLE_UI_LABEL_CATALOGS`, `resolveConsoleUiLabels`.
31
- - The read contract: the types `ResourceOutcome<T>` / `ResourceState<T>` / `ReloadCause`, `keepLastGood`, `beginReload`, `mapOutcome` and `flatMapOutcome`.
30
+ - Labels: `CONSOLE_UI_LABEL_CATALOGS`, `resolveConsoleUiLabels` (a UI language's catalog, whose `loadFailed`, `refreshFailed` and `forbiddenBecause` build the failure sentences and whose `failureSentence` is the one rule that chooses between them), `reasonAside` (a failure's reason as a parenthetical).
31
+ - The read contract: the types `ResourceOutcome<T>` / `ResourceState<T>` / `ReloadCause`, `HTTP_FORBIDDEN` (the status of a refusal), `keepLastGood`, `beginReload`, `mapOutcome` and `flatMapOutcome`.
32
32
  - The command contract: the type `CommandOutcome<T, R>` (a command the host can refuse with a structured body, which the failure carries as `rejection`).
33
33
  - The keyset paging machine: the types `KeysetPage<T, C, M>` / `NextPage<T, C>` / `PagedValue<T, C, M>` / `PagedState<T, C, M>` / `PageFailure` / `PagedContent<T, M>`, `beginPagedReload`, `settleFirstPage`, `beginPage`, `settlePage` and `mapPagedList`.
34
34
 
@@ -169,17 +169,36 @@ Draw it as a non-modal `<dialog>` (opened with `show()`) or a popover placed in
169
169
 
170
170
  ### Reads
171
171
 
172
- - A host read resolves to `ResourceOutcome<T>` (`{ok: true, value}` or `{ok: false, status, reason}`) and takes an `AbortSignal` as its last argument. Adapt a host read to the shape a hook reads with `mapOutcome(outcome, map)`, which maps a success's value and passes a failure through as the same object (its `status` and `reason`, so a 403 stays a 403 for `ResourceFailed`).
172
+ - A host read resolves to `ResourceOutcome<T>` (`{ok: true, value}` or `{ok: false, status, reason}`) and takes an `AbortSignal` as its last argument.
173
+ The status and the `reason`, of a command's outcome as well, carry different facts.
174
+ A refusal is the status's to state (`HTTP_FORBIDDEN`), and every sentence that shows a failure states it through one rule, `labels.failureSentence(failure, refusal, failed)` (`labels` from `useConsoleUi()`, or `resolveConsoleUiLabels(locale)` outside React):
175
+ a 403 is `forbiddenBecause(refusal, reason)`, the caller's own fixed refusal followed by the declared cause, and any other status, or `null` for no response, is `failed(reason)`, the caller's own failed sentence of the reason (the catalog's `loadFailed` and `refreshFailed` fit as `failed`; a screen's own sentence places the reason with `reasonAside`).
176
+ `failed` is never called for a 403, so no sentence shows a refusal without stating it.
177
+ `ResourceFailed` builds its sentence with it from its `forbiddenMessage`, and so does a screen whose own sentence shows a failure (its own re-read, a command):
178
+
179
+ ```ts
180
+ const sentence = labels.failureSentence(outcome, "最新の内容の読み込みは拒まれました。", (reason) => `最新の内容を読み込めませんでした${reasonAside(reason)}。`)
181
+ // 403 and "" → 最新の内容の読み込みは拒まれました。
182
+ // 403 and "閲覧の権限に行のスコープが設定されています" → 最新の内容の読み込みは拒まれました。閲覧の権限に行のスコープが設定されています。
183
+ // 503 and "HTTP 503" → 最新の内容を読み込めませんでした (HTTP 503)。
184
+ ```
185
+
186
+ `reason` is a phrase without a closing full stop, because the sentence that shows it ends it. A 403's `reason` names only the cause the route declared (which permission or scope to fix) and states no refusal, not even as a consequence of the cause (`閲覧の権限に列のスコープが設定されています`, not `…ため、閲覧できません`), and is `""` when the route declared none, since a phrase the host makes up there (the status, "refused") only repeats the status the failure already carries; only a 403's `reason` can be `""`.
187
+ `""` means that no cause was declared, and every sentence built from a `reason` leaves it out, the package's and a screen's alike: `loadFailed("")` is `読み込めませんでした。`, and a screen that places a `reason` in parentheses in its own sentence does so with `reasonAside(reason)` (a space and the reason in parentheses, or `""` for `""`).
188
+ A sentence that does not branch on the status (`loadFailed`, `refreshFailed`) then says only that the read failed. `PageFailure` carries no status, so a host whose later page can be refused routes that 403 to a read that carries it: a re-read of the first page, whose 403 withdraws the shown list (`keepLastGood`, below) for `ResourceFailed` to state as above.
189
+ Adapt a host read to the shape a hook reads with `mapOutcome(outcome, map)`, which maps a success's value and passes a failure through as the same object (its `status` and `reason`, so a 403 stays a 403 for `ResourceFailed`).
173
190
  When a host success is not always a success of that shape (a later page the host answers as not measured, which the list shows as a failed page), use `flatMapOutcome(outcome, map)`: `map` returns an outcome, a success or a failure, and a failure of the host read still passes through as the same object without calling `map`.
174
191
  - A command the host can refuse with a structured body (a code, the current row of a stale command, field errors) resolves to `CommandOutcome<T, R>`: `{ok: true, value}` or `{ok: false, status, reason, rejection}`, where `rejection` is the refusal body the host parsed with its own schema (`R`), and `null` when there was no response or the body was not one the schema reads (a network failure, a status the command does not declare, an unreadable body).
175
192
  The screen derives its sentence and its state change from `rejection` when it is present, narrowing on the rejection's own discriminant (`!outcome.ok && outcome.rejection?.code === "STALE"` narrows to what that code carries, for example the current row it puts in place with `put` or `updateList`), and shows `reason` otherwise. Every failure carries `rejection`, so a failure that leaves it out is a type error, and every `CommandOutcome<T, R>` is a `ResourceOutcome<T>`.
176
193
  - `key` holds every input that selects the target or the list. Encode several inputs injectively with `JSON.stringify([...inputs])` (for a findings list, the run and the cell: `JSON.stringify([runUid, store, scopeKey, itemClass])`): joining free text with a separator is not injective (category `A` with query `x|y` and category `A|x` with query `y` give the same `A|x|y`).
177
194
  The read functions are read through a ref, so changing them alone never re-reads, and a key that leaves out a selecting input, or encodes two inputs to the same key, keeps showing the first target's data without an error.
178
195
  - `useResource(key, load, revision)` is `idle` for a `null` key, starts a new key from `loading`, re-reads the same key on a `revision` change, `refresh()` or `reload()` while keeping the shown value (`beginReload`, `keepLastGood`), aborts the read in flight on every re-read and discards its answer. A failure stays on screen while it is re-read; only a `reload()` marks it `retrying` (its reload button busy), a `revision` or `refresh()` re-read leaves it as it is. A rejection that is not the abort of a superseded read is rethrown to the nearest error boundary.
196
+ A failed re-read keeps the shown value and raises `refreshFailure`, all but a 403: the operator may no longer read the value, so `keepLastGood` withdraws it and the resource is `failed` with `occurrence` 1, exactly as a first read answered 403 is (`ResourceFailed` then states the refusal and its cause, with no reload).
197
+ A 403 failure then stays as it is, its reason and its `occurrence` included, through every later answer that carries no value (another failure such as a 503, a re-read in flight, another 403): none of them says anything about the permission the 403 revoked, so the refusal is announced once and no later failure brings the value back. Only a value read again for the key (a read's success, or `put`) or another key ends it.
179
198
  `reload()` is the operator's re-read (the `Reload` button of `ResourceFailed`); `refresh()` is the screen's own re-read of the same target, the same as a `revision` change, for a re-read a screen starts after a command (a count after a decision) without a prop of its host's.
180
199
  `put(key, value)` shows the value a write's reply carries (the decided detail, or the current detail a 409 returns) as the success of a read, only while `key` is still the shown key (pass the key the command started on); a read of that key in flight is aborted and started again, because its answer may predate the write.
181
200
  - `usePagedResource(key, {first, next}, revision)` reads a keyset-paged list: `first(signal)` resolves to `ResourceOutcome<KeysetPage<T, C, M>>` (`{rows, next, meta}`: `next` is the cursor the next page starts after, `null` when the records are exhausted, and `meta` is the list's own data, such as a total or category choices, which only the first page carries), and `next(cursor, signal)` to `ResourceOutcome<NextPage<T, C>>` (`{rows, next}`; a later page that carries `meta` is a type error).
182
- The first page follows `useResource` (`idle` for a `null` key, `loading` for a new key, `revision`, `refresh()` and `reload()` keep the shown list while re-reading), and a re-read's success replaces the whole list with the new first page, dropping the pages read after it together with any focus inside them. `loadMore()` appends the next page; a failed page keeps every shown row and advances its own `moreFailure.occurrence`.
201
+ The first page follows `useResource` (`idle` for a `null` key, `loading` for a new key, `revision`, `refresh()` and `reload()` keep the shown list while re-reading, and a 403 withdraws it), and a re-read's success replaces the whole list with the new first page, dropping the pages read after it together with any focus inside them. `loadMore()` appends the next page; a failed page keeps every shown row and advances its own `moreFailure.occurrence`.
183
202
  A key change, a `revision` change, `refresh()`, `reload()` and unmounting abort the page in flight, no page starts while the first page is re-read, and a page that settles after the list moved on is discarded, so a stale page is never appended to a new first page. `loadMore()` throws outside a shown list with a next cursor, no page in flight and no re-read in flight.
184
203
  Reflect a command on a row with `updateList(key, map)`, not with `reload()` or `revision`: `map` receives the shown `{rows, meta}` (`PagedContent<T, M>`) and returns them changed together, replacing the row with the reply's row, leaving a deleted row out or adding a registered one, and changing the list's own data with it (a new category choice, a total). It keeps every page read so far, the cursor (a value, still valid when its row goes) and the rows' DOM, so focus on a row past the first page stays.
185
204
  It applies only while `key` is still the shown list's (a reply that comes after the operator changed the filter is dropped); a first-page read of `key` in flight is aborted and started again, because its answer may predate the write, and a page in flight continues, its answer predating the write as well, so every `map` applied while it is in flight is applied again, in order, once its rows are appended (a row the write replaced or removed arrives replaced or removed).
@@ -202,7 +221,9 @@ Draw it as a non-modal `<dialog>` (opened with `show()`) or a popover placed in
202
221
  }))
203
222
  ```
204
223
 
205
- - `ResourceFailed` is the one way to draw a failed read: `loadFailed(reason)` in an `AlertMessage` and a `Reload` button that stays busy while re-reading; a 403 draws the caller's fixed message without reload. The caller's `useFocusRescue` ref (`rescueRef`) is attached to the `Reload` button, so focus on it moves to the section heading both when the reload succeeds (the block goes) and when it comes back 403 (the button goes).
224
+ - `ResourceFailed` is the one way to draw a failed read: `labels.failureSentence(failure, forbiddenMessage, failed)` in an `AlertMessage`, where `failed` is `loadFailed` or the section's own sentence (`failureMessage`), and a `Reload` button that stays busy while re-reading.
225
+ A 403, a first read's or a re-read's that withdrew the shown value, draws no reload, and `labels.forbiddenBecause(forbiddenMessage, reason)`: the caller's fixed message, a complete sentence ending with the UI language's full stop (`。` or `.`), followed by the declared cause as a second sentence (`閲覧する権限がありません。` and `ファイルの閲覧権限に列のスコープが設定されています` give `閲覧する権限がありません。ファイルの閲覧権限に列のスコープが設定されています。`; English adds `Reason: <reason>.`). A 403 never reaches the section's own sentence (`failureMessage`).
226
+ The caller's `useFocusRescue` ref (`rescueRef`) is attached to the `Reload` button, so focus on it moves to the section heading both when the reload succeeds (the block goes) and when it comes back 403 (the button goes).
206
227
 
207
228
  ## Components
208
229
 
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var S=new Map,U= exports.a =(e,r)=>{if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);let n=S.get(r);return n===void 0&&(n=new Intl.NumberFormat(r,{maximumFractionDigits:0,useGrouping:!0}),S.set(r,n)),n.format(e)};var i=class extends RangeError{constructor(r,n){super(n),this.name="ZonedTimeError",this.reason=r}},A=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,H=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,W=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,k=864e5,T=6e4,g={min:1,max:9999},w=new Map,M=new Map,B=e=>{let r=w.get(e);return r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),w.set(e,r)),r},O=e=>{let r=new Date(0);return r.setUTCFullYear(e.year,e.month-1,e.day),r.setUTCHours(e.hour,e.minute,e.second,0),r.getUTCFullYear()===e.year&&r.getUTCMonth()===e.month-1&&r.getUTCDate()===e.day&&r.getUTCHours()===e.hour&&r.getUTCMinutes()===e.minute&&r.getUTCSeconds()===e.second?r.getTime():null},b=(e,r)=>{let[n,t,o,s,l,a,y]=r;if(y!==void 0&&/[1-9]/.test(y))throw new i("subsecond",`Fractions of a second cannot be kept: ${e}`);let c={year:Number(n),month:Number(t),day:Number(o),hour:Number(s),minute:Number(l),second:a===void 0?0:Number(a)},C=c.year>=g.min?O(c):null;if(C===null)throw new i("malformed",`Not a calendar date and time: ${e}`);return{fields:c,millis:C}},x=(e,r)=>{let n=new Map(B(r).formatToParts(new Date(e)).map(o=>[o.type,o.value])),t={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"||t.year>g.max)throw new i("malformed",`The wall clock falls outside years ${g.min}-${g.max}: ${new Date(e).toISOString()}`);return t},p=(e,r)=>O(x(e,r))-e,d=e=>String(e).padStart(2,"0"),$=(e,r)=>{let n=`${String(e.year).padStart(4,"0")}-${d(e.month)}-${d(e.day)}T${d(e.hour)}:${d(e.minute)}`;return r||e.second!==0?`${n}:${d(e.second)}`:n},G=e=>{if(e%T!==0)throw new i("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let r=Math.abs(e)/T;return`${e<0?"-":"+"}${d(Math.floor(r/60))}:${d(r%60)}`},z= exports.c =(e,r)=>{let n=A.exec(e);if(n===null)throw new i("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:t,millis:o}=b(e,n.slice(1)),l=[...new Set([p(o-k,r),p(o+k,r)])].filter(a=>p(o-a,r)===a);if(l.length===0)throw new i("nonexistent",`${e} does not exist in ${r}`);if(l.length>1)throw new i("ambiguous",`${e} occurs twice in ${r}`);return`${$(t,!0)}${G(l[0])}`},N=(e,r)=>{let[n,t,o,s]=r;if(n!==void 0)return 0;if(Number(o)>23||Number(s)>59)throw new i("malformed",`Not a valid offset: ${e}`);return(t==="-"?-1:1)*(Number(o)*60+Number(s))*T},K= exports.d =(e,r)=>{let n=H.exec(e);if(n===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:t}=b(e,n.slice(1,8));return $(x(t-N(e,n.slice(8)),r),!1)},j=(e,r)=>{let n=JSON.stringify([e,r]),t=M.get(n);return t===void 0&&(t=new Intl.DateTimeFormat(e,{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),M.set(n,t)),t},X= exports.e =(e,r,n)=>{let t=W.exec(e);if(t===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=b(e,[...t.slice(1,7),void 0]),s=o-N(e,t.slice(7));return x(s,n),j(r,n).format(s)};var F=403,Y= exports.g =(e,r)=>e.ok?{ok:!0,value:r(e.value)}:e,V= exports.h =(e,r)=>e.ok?r(e.value):e,pe= exports.i ={kind:"idle"},q= exports.j ={kind:"loading"},h= exports.k =(e,r)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?r==="reload"?{...e,retrying:!0}:e:q,R= exports.l =(e,r)=>r.ok?{kind:"ready",value:r.value,refreshing:!1,refreshFailure:null}:e.kind==="failed"&&e.status===403?e.retrying?{...e,retrying:!1}:e:e.kind==="ready"&&r.status!==403?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:r.status,reason:r.reason}}:{kind:"failed",status:r.status,reason:r.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var m=e=>e===""?"":` (${e})`,P=e=>(r,n,t)=>r.status===403?e(n,r.reason):t(r.reason),E=(e,r)=>r===""?e:`${e} Reason: ${r}.`,v=(e,r)=>r===""?e:`${e}${r}\u3002`,f= exports.n ={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load${m(e)}.`,refreshFailed:e=>`Could not refresh${m(e)}.`,forbiddenBecause:E,failureSentence:P(E),loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F${m(e)}\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F${m(e)}\u3002`,forbiddenBecause:v,failureSentence:P(v),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"}},J= exports.o =e=>{if(!Object.hasOwn(f,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(f).join(", ")}`);return f[e]};var Z=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},u= exports.p =e=>`${Z(e)/16}rem`;var _=(1+Math.sqrt(5))/2,D=({masterMinPx:e,detailMinPx:r,gapPx:n})=>{for(let t of[e,r])if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Pane minimum must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+r},Q= exports.q =(e,r)=>{let n=D(r);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 t=(e-r.gapPx)/(1+_),o=Math.min(Math.max(r.masterMinPx,t),e-r.gapPx-r.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-r.gapPx-o}},Re= exports.r =e=>{let r=D(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,t=`[data-cui-master-detail="${n}"]`,o=u(e.gapPx),s=`${t}{grid-template-columns:minmax(0,1fr);gap:${o}}`,l=`clamp(${u(e.masterMinPx)},calc((100% - ${o}) / ${1+_}),calc(100% - ${o} - ${u(e.detailMinPx)}))`,a=`@container (min-width:${u(r)}){${t}{grid-template-columns:${l} minmax(0,1fr)}}`;return{key:n,css:s+a}};var I=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},ee= exports.s =e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let r=0,n=null;for(let{width:t}of e){if(t.fixedPx!==void 0){r+=I(t.fixedPx);continue}let o=I(t.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,r+=o}return r};var re=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,L=(e,r)=>{let n=0,t=0;for(let o of e)re(o.codePointAt(0))?t+=1:n+=1;return n*1+t*r},ne= exports.t =e=>L(e,.55),te= exports.u =e=>L(e,.6),oe= exports.v =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 ae=(e,r,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Tile minimum width must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let t=[];for(let a=1;a<=e;a+=1)e%a===0&&t.push({columns:a,minContainerPx:a*r+(a-1)*n});let o=`cui-tiles-n${e}-m${r}-g${n}`,s=`[data-cui-tile-grid="${o}"]`,l=t.map(({columns:a,minContainerPx:y})=>{let c=`${s}{grid-template-columns:repeat(${a},minmax(0,1fr))}`;return a===1?c:`@container (min-width:${u(y)}){${c}}`});return{key:o,steps:t,css:l.join("")}};var ie=(e,r)=>{let n=h(e,r);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},se= exports.y =(e,r)=>R(e,r.ok?{ok:!0,value:{rows:r.value.rows,next:r.value.next,meta:r.value.meta,loadingMore:!1,moreFailure:null}}:r),le= exports.z =e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,de= exports.A =(e,r,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,r)))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 t=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:t}}}},ue= exports.B =(e,r)=>{if(e.kind!=="ready")return e;let{rows:n,meta:t}=r({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:t}}};var ce={space:{"space-1":4,"space-2":8,"space-3":12,"space-4":16,"space-6":24,"space-8":32,"space-12":48},type:{caption:{size:11,lineHeight:16},body:{size:13,lineHeight:20},prose:{size:13,lineHeight:24},title:{size:16,lineHeight:24},heading:{size:20,lineHeight:28},display:{size:25,lineHeight:32}},weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},size:{"size-control":32,"size-row":32,"size-row-control":40,"size-target":24},stroke:{"border-width":1,"focus-width":2,"focus-offset":2},color:{fg:"#0f172b","fg-secondary":"#314158","fg-muted":"#45556c","danger-fg":"#9f0712","warning-fg":"#7b3306","success-fg":"#006045","info-fg":"#193cb8","on-solid":"#ffffff",surface:"#ffffff",subtle:"#f8fafc",sunken:"#f1f5f9","danger-tint":"#fef2f2","warning-tint":"#fffbeb","success-tint":"#ecfdf5","info-tint":"#eff6ff","neutral-solid":"#314158","danger-solid":"#9f0712","success-solid":"#006045","info-solid":"#193cb8","warning-solid":"#7b3306","danger-accent":"#e7000b","warning-accent":"#bb4d00","success-accent":"#009966","info-accent":"#155dfc",focus:"#155dfc","border-control":"#62748e","border-subtle":"#e2e8f0"}},me="--cui-",ye= exports.D =e=>`var(${me}${e})`;exports.a = U; exports.b = i; exports.c = z; exports.d = K; exports.e = X; exports.f = F; exports.g = Y; exports.h = V; exports.i = pe; exports.j = q; exports.k = h; exports.l = R; exports.m = m; exports.n = f; exports.o = J; exports.p = u; exports.q = Q; exports.r = Re; exports.s = ee; exports.t = ne; exports.u = te; exports.v = oe; exports.w = ae; exports.x = ie; exports.y = se; exports.z = le; exports.A = de; exports.B = ue; exports.C = ce; exports.D = ye;
@@ -0,0 +1 @@
1
+ var S=new Map,U=(e,r)=>{if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);let n=S.get(r);return n===void 0&&(n=new Intl.NumberFormat(r,{maximumFractionDigits:0,useGrouping:!0}),S.set(r,n)),n.format(e)};var i=class extends RangeError{reason;constructor(r,n){super(n),this.name="ZonedTimeError",this.reason=r}},A=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,H=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,W=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,k=864e5,T=6e4,g={min:1,max:9999},w=new Map,M=new Map,B=e=>{let r=w.get(e);return r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),w.set(e,r)),r},O=e=>{let r=new Date(0);return r.setUTCFullYear(e.year,e.month-1,e.day),r.setUTCHours(e.hour,e.minute,e.second,0),r.getUTCFullYear()===e.year&&r.getUTCMonth()===e.month-1&&r.getUTCDate()===e.day&&r.getUTCHours()===e.hour&&r.getUTCMinutes()===e.minute&&r.getUTCSeconds()===e.second?r.getTime():null},b=(e,r)=>{let[n,t,o,s,l,a,y]=r;if(y!==void 0&&/[1-9]/.test(y))throw new i("subsecond",`Fractions of a second cannot be kept: ${e}`);let c={year:Number(n),month:Number(t),day:Number(o),hour:Number(s),minute:Number(l),second:a===void 0?0:Number(a)},C=c.year>=g.min?O(c):null;if(C===null)throw new i("malformed",`Not a calendar date and time: ${e}`);return{fields:c,millis:C}},x=(e,r)=>{let n=new Map(B(r).formatToParts(new Date(e)).map(o=>[o.type,o.value])),t={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"||t.year>g.max)throw new i("malformed",`The wall clock falls outside years ${g.min}-${g.max}: ${new Date(e).toISOString()}`);return t},p=(e,r)=>O(x(e,r))-e,d=e=>String(e).padStart(2,"0"),$=(e,r)=>{let n=`${String(e.year).padStart(4,"0")}-${d(e.month)}-${d(e.day)}T${d(e.hour)}:${d(e.minute)}`;return r||e.second!==0?`${n}:${d(e.second)}`:n},G=e=>{if(e%T!==0)throw new i("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let r=Math.abs(e)/T;return`${e<0?"-":"+"}${d(Math.floor(r/60))}:${d(r%60)}`},z=(e,r)=>{let n=A.exec(e);if(n===null)throw new i("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:t,millis:o}=b(e,n.slice(1)),l=[...new Set([p(o-k,r),p(o+k,r)])].filter(a=>p(o-a,r)===a);if(l.length===0)throw new i("nonexistent",`${e} does not exist in ${r}`);if(l.length>1)throw new i("ambiguous",`${e} occurs twice in ${r}`);return`${$(t,!0)}${G(l[0])}`},N=(e,r)=>{let[n,t,o,s]=r;if(n!==void 0)return 0;if(Number(o)>23||Number(s)>59)throw new i("malformed",`Not a valid offset: ${e}`);return(t==="-"?-1:1)*(Number(o)*60+Number(s))*T},K=(e,r)=>{let n=H.exec(e);if(n===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:t}=b(e,n.slice(1,8));return $(x(t-N(e,n.slice(8)),r),!1)},j=(e,r)=>{let n=JSON.stringify([e,r]),t=M.get(n);return t===void 0&&(t=new Intl.DateTimeFormat(e,{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),M.set(n,t)),t},X=(e,r,n)=>{let t=W.exec(e);if(t===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=b(e,[...t.slice(1,7),void 0]),s=o-N(e,t.slice(7));return x(s,n),j(r,n).format(s)};var F=403,Y=(e,r)=>e.ok?{ok:!0,value:r(e.value)}:e,V=(e,r)=>e.ok?r(e.value):e,pe={kind:"idle"},q={kind:"loading"},h=(e,r)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?r==="reload"?{...e,retrying:!0}:e:q,R=(e,r)=>r.ok?{kind:"ready",value:r.value,refreshing:!1,refreshFailure:null}:e.kind==="failed"&&e.status===403?e.retrying?{...e,retrying:!1}:e:e.kind==="ready"&&r.status!==403?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:r.status,reason:r.reason}}:{kind:"failed",status:r.status,reason:r.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var m=e=>e===""?"":` (${e})`,P=e=>(r,n,t)=>r.status===403?e(n,r.reason):t(r.reason),E=(e,r)=>r===""?e:`${e} Reason: ${r}.`,v=(e,r)=>r===""?e:`${e}${r}\u3002`,f={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load${m(e)}.`,refreshFailed:e=>`Could not refresh${m(e)}.`,forbiddenBecause:E,failureSentence:P(E),loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F${m(e)}\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F${m(e)}\u3002`,forbiddenBecause:v,failureSentence:P(v),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"}},J=e=>{if(!Object.hasOwn(f,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(f).join(", ")}`);return f[e]};var Z=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},u=e=>`${Z(e)/16}rem`;var _=(1+Math.sqrt(5))/2,D=({masterMinPx:e,detailMinPx:r,gapPx:n})=>{for(let t of[e,r])if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Pane minimum must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+r},Q=(e,r)=>{let n=D(r);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 t=(e-r.gapPx)/(1+_),o=Math.min(Math.max(r.masterMinPx,t),e-r.gapPx-r.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-r.gapPx-o}},Re=e=>{let r=D(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,t=`[data-cui-master-detail="${n}"]`,o=u(e.gapPx),s=`${t}{grid-template-columns:minmax(0,1fr);gap:${o}}`,l=`clamp(${u(e.masterMinPx)},calc((100% - ${o}) / ${1+_}),calc(100% - ${o} - ${u(e.detailMinPx)}))`,a=`@container (min-width:${u(r)}){${t}{grid-template-columns:${l} minmax(0,1fr)}}`;return{key:n,css:s+a}};var I=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},ee=e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let r=0,n=null;for(let{width:t}of e){if(t.fixedPx!==void 0){r+=I(t.fixedPx);continue}let o=I(t.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,r+=o}return r};var re=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,L=(e,r)=>{let n=0,t=0;for(let o of e)re(o.codePointAt(0))?t+=1:n+=1;return n*1+t*r},ne=e=>L(e,.55),te=e=>L(e,.6),oe=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 ae=(e,r,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Tile minimum width must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let t=[];for(let a=1;a<=e;a+=1)e%a===0&&t.push({columns:a,minContainerPx:a*r+(a-1)*n});let o=`cui-tiles-n${e}-m${r}-g${n}`,s=`[data-cui-tile-grid="${o}"]`,l=t.map(({columns:a,minContainerPx:y})=>{let c=`${s}{grid-template-columns:repeat(${a},minmax(0,1fr))}`;return a===1?c:`@container (min-width:${u(y)}){${c}}`});return{key:o,steps:t,css:l.join("")}};var ie=(e,r)=>{let n=h(e,r);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},se=(e,r)=>R(e,r.ok?{ok:!0,value:{rows:r.value.rows,next:r.value.next,meta:r.value.meta,loadingMore:!1,moreFailure:null}}:r),le=e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,de=(e,r,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,r)))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 t=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:t}}}},ue=(e,r)=>{if(e.kind!=="ready")return e;let{rows:n,meta:t}=r({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:t}}};var ce={space:{"space-1":4,"space-2":8,"space-3":12,"space-4":16,"space-6":24,"space-8":32,"space-12":48},type:{caption:{size:11,lineHeight:16},body:{size:13,lineHeight:20},prose:{size:13,lineHeight:24},title:{size:16,lineHeight:24},heading:{size:20,lineHeight:28},display:{size:25,lineHeight:32}},weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},size:{"size-control":32,"size-row":32,"size-row-control":40,"size-target":24},stroke:{"border-width":1,"focus-width":2,"focus-offset":2},color:{fg:"#0f172b","fg-secondary":"#314158","fg-muted":"#45556c","danger-fg":"#9f0712","warning-fg":"#7b3306","success-fg":"#006045","info-fg":"#193cb8","on-solid":"#ffffff",surface:"#ffffff",subtle:"#f8fafc",sunken:"#f1f5f9","danger-tint":"#fef2f2","warning-tint":"#fffbeb","success-tint":"#ecfdf5","info-tint":"#eff6ff","neutral-solid":"#314158","danger-solid":"#9f0712","success-solid":"#006045","info-solid":"#193cb8","warning-solid":"#7b3306","danger-accent":"#e7000b","warning-accent":"#bb4d00","success-accent":"#009966","info-accent":"#155dfc",focus:"#155dfc","border-control":"#62748e","border-subtle":"#e2e8f0"}},me="--cui-",ye=e=>`var(${me}${e})`;export{U as a,i as b,z as c,K as d,X as e,F as f,Y as g,V as h,pe as i,q as j,h as k,R as l,m,f as n,J as o,u as p,Q as q,Re as r,ee as s,ne as t,te as u,oe as v,ae as w,ie as x,se as y,le as z,de as A,ue as B,ce as C,ye as D};
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJUHDBYOCcjs = require('./chunk-JUHDBYOC.cjs');var _chunkBEDKWWJCcjs = require('./chunk-BEDKWWJC.cjs');exports.CONSOLE_UI_LABEL_CATALOGS = _chunkJUHDBYOCcjs.f; exports.CONTRAST_MINIMUM = _chunkBEDKWWJCcjs.c; exports.CONTRAST_PAIRS = _chunkBEDKWWJCcjs.d; exports.TOKENS = _chunkJUHDBYOCcjs.A; exports.ZonedTimeError = _chunkJUHDBYOCcjs.b; exports.beginPage = _chunkJUHDBYOCcjs.x; exports.beginPagedReload = _chunkJUHDBYOCcjs.v; exports.beginReload = _chunkJUHDBYOCcjs.t; exports.ceil8 = _chunkJUHDBYOCcjs.n; exports.contrastRatio = _chunkBEDKWWJCcjs.b; exports.cssVar = _chunkJUHDBYOCcjs.B; exports.flatMapOutcome = _chunkJUHDBYOCcjs.q; exports.formatCount = _chunkJUHDBYOCcjs.a; exports.formatInstant = _chunkJUHDBYOCcjs.e; exports.hexToSrgb = _chunkBEDKWWJCcjs.a; exports.keepLastGood = _chunkJUHDBYOCcjs.u; exports.mapOutcome = _chunkJUHDBYOCcjs.p; exports.mapPagedList = _chunkJUHDBYOCcjs.z; exports.masterDetailPlan = _chunkJUHDBYOCcjs.i; exports.monoTextWidthEm = _chunkJUHDBYOCcjs.m; exports.resolveConsoleUiLabels = _chunkJUHDBYOCcjs.g; exports.settleFirstPage = _chunkJUHDBYOCcjs.w; exports.settlePage = _chunkJUHDBYOCcjs.y; exports.tableMinInlinePx = _chunkJUHDBYOCcjs.k; exports.textWidthEm = _chunkJUHDBYOCcjs.l; exports.tileGridPlan = _chunkJUHDBYOCcjs.o; exports.toOffsetIso = _chunkJUHDBYOCcjs.c; exports.toWallTime = _chunkJUHDBYOCcjs.d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHFWVEGN3cjs = require('./chunk-HFWVEGN3.cjs');var _chunkBEDKWWJCcjs = require('./chunk-BEDKWWJC.cjs');exports.CONSOLE_UI_LABEL_CATALOGS = _chunkHFWVEGN3cjs.n; exports.CONTRAST_MINIMUM = _chunkBEDKWWJCcjs.c; exports.CONTRAST_PAIRS = _chunkBEDKWWJCcjs.d; exports.HTTP_FORBIDDEN = _chunkHFWVEGN3cjs.f; exports.TOKENS = _chunkHFWVEGN3cjs.C; exports.ZonedTimeError = _chunkHFWVEGN3cjs.b; exports.beginPage = _chunkHFWVEGN3cjs.z; exports.beginPagedReload = _chunkHFWVEGN3cjs.x; exports.beginReload = _chunkHFWVEGN3cjs.k; exports.ceil8 = _chunkHFWVEGN3cjs.v; exports.contrastRatio = _chunkBEDKWWJCcjs.b; exports.cssVar = _chunkHFWVEGN3cjs.D; exports.flatMapOutcome = _chunkHFWVEGN3cjs.h; exports.formatCount = _chunkHFWVEGN3cjs.a; exports.formatInstant = _chunkHFWVEGN3cjs.e; exports.hexToSrgb = _chunkBEDKWWJCcjs.a; exports.keepLastGood = _chunkHFWVEGN3cjs.l; exports.mapOutcome = _chunkHFWVEGN3cjs.g; exports.mapPagedList = _chunkHFWVEGN3cjs.B; exports.masterDetailPlan = _chunkHFWVEGN3cjs.q; exports.monoTextWidthEm = _chunkHFWVEGN3cjs.u; exports.reasonAside = _chunkHFWVEGN3cjs.m; exports.resolveConsoleUiLabels = _chunkHFWVEGN3cjs.o; exports.settleFirstPage = _chunkHFWVEGN3cjs.y; exports.settlePage = _chunkHFWVEGN3cjs.A; exports.tableMinInlinePx = _chunkHFWVEGN3cjs.s; exports.textWidthEm = _chunkHFWVEGN3cjs.t; exports.tileGridPlan = _chunkHFWVEGN3cjs.w; exports.toOffsetIso = _chunkHFWVEGN3cjs.c; exports.toWallTime = _chunkHFWVEGN3cjs.d;
package/dist/core.d.cts CHANGED
@@ -13,12 +13,18 @@ type ConsoleUiLabels = {
13
13
  readonly loading: string;
14
14
  readonly loadFailed: (reason: string) => string;
15
15
  readonly refreshFailed: (reason: string) => string;
16
+ readonly forbiddenBecause: (message: string, reason: string) => string;
17
+ readonly failureSentence: (failure: {
18
+ readonly status: number | null;
19
+ readonly reason: string;
20
+ }, refusal: string, failed: (reason: string) => string) => string;
16
21
  readonly loadMore: (limit: string) => string;
17
22
  readonly endOfRecords: string;
18
23
  readonly close: string;
19
24
  readonly cancel: string;
20
25
  readonly reload: string;
21
26
  };
27
+ declare const reasonAside: (reason: string) => string;
22
28
  declare const CONSOLE_UI_LABEL_CATALOGS: Readonly<Record<ConsoleUiLocale, ConsoleUiLabels>>;
23
29
  declare const resolveConsoleUiLabels: (locale: string) => ConsoleUiLabels;
24
30
  type MasterDetailOptions = {
@@ -57,6 +63,7 @@ type TileGridPlan = {
57
63
  readonly css: string;
58
64
  };
59
65
  declare const tileGridPlan: (count: number, minInlinePx: number, gapPx: number) => TileGridPlan;
66
+ declare const HTTP_FORBIDDEN = 403;
60
67
  type ResourceOutcome<T> = {
61
68
  readonly ok: true;
62
69
  readonly value: T;
@@ -335,4 +342,4 @@ declare const CONTRAST_PAIRS: {
335
342
  readonly sunken: 4.35;
336
343
  };
337
344
  };
338
- export { type AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, type ColorToken, type ColumnWidth, type ColumnWidthSource, type CommandOutcome, type ConsoleUiLabels, type ConsoleUiLocale, type ConsoleUiTokens, type ContrastRole, type FgRole, type KeysetPage, type MasterDetailOptions, type MasterDetailPlan, type NextPage, type PageFailure, type PagedContent, type PagedState, type PagedValue, type RadiusToken, type ReloadCause, type ResourceFailure, type ResourceOutcome, type ResourceState, type SizeToken, type SpaceToken, type Srgb, type StrokeToken, type SurfaceRole, TOKENS, type TileGridPlan, type TileGridStep, type TokenName, type TypeToken, type WeightToken, ZonedTimeError, type ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime };
345
+ export { type AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, type ColorToken, type ColumnWidth, type ColumnWidthSource, type CommandOutcome, type ConsoleUiLabels, type ConsoleUiLocale, type ConsoleUiTokens, type ContrastRole, type FgRole, HTTP_FORBIDDEN, type KeysetPage, type MasterDetailOptions, type MasterDetailPlan, type NextPage, type PageFailure, type PagedContent, type PagedState, type PagedValue, type RadiusToken, type ReloadCause, type ResourceFailure, type ResourceOutcome, type ResourceState, type SizeToken, type SpaceToken, type Srgb, type StrokeToken, type SurfaceRole, TOKENS, type TileGridPlan, type TileGridStep, type TokenName, type TypeToken, type WeightToken, ZonedTimeError, type ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, reasonAside, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime };
package/dist/core.d.ts CHANGED
@@ -13,12 +13,18 @@ type ConsoleUiLabels = {
13
13
  readonly loading: string;
14
14
  readonly loadFailed: (reason: string) => string;
15
15
  readonly refreshFailed: (reason: string) => string;
16
+ readonly forbiddenBecause: (message: string, reason: string) => string;
17
+ readonly failureSentence: (failure: {
18
+ readonly status: number | null;
19
+ readonly reason: string;
20
+ }, refusal: string, failed: (reason: string) => string) => string;
16
21
  readonly loadMore: (limit: string) => string;
17
22
  readonly endOfRecords: string;
18
23
  readonly close: string;
19
24
  readonly cancel: string;
20
25
  readonly reload: string;
21
26
  };
27
+ declare const reasonAside: (reason: string) => string;
22
28
  declare const CONSOLE_UI_LABEL_CATALOGS: Readonly<Record<ConsoleUiLocale, ConsoleUiLabels>>;
23
29
  declare const resolveConsoleUiLabels: (locale: string) => ConsoleUiLabels;
24
30
  type MasterDetailOptions = {
@@ -57,6 +63,7 @@ type TileGridPlan = {
57
63
  readonly css: string;
58
64
  };
59
65
  declare const tileGridPlan: (count: number, minInlinePx: number, gapPx: number) => TileGridPlan;
66
+ declare const HTTP_FORBIDDEN = 403;
60
67
  type ResourceOutcome<T> = {
61
68
  readonly ok: true;
62
69
  readonly value: T;
@@ -335,4 +342,4 @@ declare const CONTRAST_PAIRS: {
335
342
  readonly sunken: 4.35;
336
343
  };
337
344
  };
338
- export { type AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, type ColorToken, type ColumnWidth, type ColumnWidthSource, type CommandOutcome, type ConsoleUiLabels, type ConsoleUiLocale, type ConsoleUiTokens, type ContrastRole, type FgRole, type KeysetPage, type MasterDetailOptions, type MasterDetailPlan, type NextPage, type PageFailure, type PagedContent, type PagedState, type PagedValue, type RadiusToken, type ReloadCause, type ResourceFailure, type ResourceOutcome, type ResourceState, type SizeToken, type SpaceToken, type Srgb, type StrokeToken, type SurfaceRole, TOKENS, type TileGridPlan, type TileGridStep, type TokenName, type TypeToken, type WeightToken, ZonedTimeError, type ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime };
345
+ export { type AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, type ColorToken, type ColumnWidth, type ColumnWidthSource, type CommandOutcome, type ConsoleUiLabels, type ConsoleUiLocale, type ConsoleUiTokens, type ContrastRole, type FgRole, HTTP_FORBIDDEN, type KeysetPage, type MasterDetailOptions, type MasterDetailPlan, type NextPage, type PageFailure, type PagedContent, type PagedState, type PagedValue, type RadiusToken, type ReloadCause, type ResourceFailure, type ResourceOutcome, type ResourceState, type SizeToken, type SpaceToken, type Srgb, type StrokeToken, type SurfaceRole, TOKENS, type TileGridPlan, type TileGridStep, type TokenName, type TypeToken, type WeightToken, ZonedTimeError, type ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, reasonAside, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime };
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- import{A,B,a,b,c,d,e,f,g,i as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,t as p,u as q,v as r,w as s,x as t,y as u,z as v}from"./chunk-4F6Q2VL5.js";import{a as w,b as x,c as y,d as z}from"./chunk-MYMCHY7C.js";export{f as CONSOLE_UI_LABEL_CATALOGS,y as CONTRAST_MINIMUM,z as CONTRAST_PAIRS,A as TOKENS,b as ZonedTimeError,t as beginPage,r as beginPagedReload,p as beginReload,l as ceil8,x as contrastRatio,B as cssVar,o as flatMapOutcome,a as formatCount,e as formatInstant,w as hexToSrgb,q as keepLastGood,n as mapOutcome,v as mapPagedList,h as masterDetailPlan,k as monoTextWidthEm,g as resolveConsoleUiLabels,s as settleFirstPage,u as settlePage,i as tableMinInlinePx,j as textWidthEm,m as tileGridPlan,c as toOffsetIso,d as toWallTime};
1
+ import{A as w,B as x,C,D,a,b,c,d,e,f,g,h,k as i,l as j,m as k,n as l,o as m,q as n,s as o,t as p,u as q,v as r,w as s,x as t,y as u,z as v}from"./chunk-YUUKR7HN.js";import{a as y,b as z,c as A,d as B}from"./chunk-MYMCHY7C.js";export{l as CONSOLE_UI_LABEL_CATALOGS,A as CONTRAST_MINIMUM,B as CONTRAST_PAIRS,f as HTTP_FORBIDDEN,C as TOKENS,b as ZonedTimeError,v as beginPage,t as beginPagedReload,i as beginReload,r as ceil8,z as contrastRatio,D as cssVar,h as flatMapOutcome,a as formatCount,e as formatInstant,y as hexToSrgb,j as keepLastGood,g as mapOutcome,x as mapPagedList,n as masterDetailPlan,q as monoTextWidthEm,k as reasonAside,m as resolveConsoleUiLabels,u as settleFirstPage,w as settlePage,o as tableMinInlinePx,p as textWidthEm,s as tileGridPlan,c as toOffsetIso,d as toWallTime};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkJUHDBYOCcjs = require('./chunk-JUHDBYOC.cjs');var _chunkBEDKWWJCcjs = require('./chunk-BEDKWWJC.cjs');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var oe=_react.createContext.call(void 0, null),Ve=" ",We='[inert], [aria-hidden="true" i]',Pe="dialog:modal",Ze=e=>{if(e.closest(We)!==null)return'an ancestor is inert or aria-hidden="true"';let t=e.ownerDocument,o=[...t.querySelectorAll(Pe)],r=t.activeElement,n=o.filter(l=>l.contains(r)),a=n.length>0?n:o,s=a.filter(l=>l.contains(e)).length;return s===a.length?null:s===0?"the topmost open modal dialog does not contain the console":"open modal dialogs both contain and do not contain the console, and focus does not tell which one is topmost"},ze=e=>{try{e.querySelectorAll(Pe)}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}},re= exports.ANNOUNCE_SETTLE_MS =150,Ye=1e3,Xe= exports.ConsoleUiRoot =({locale:e,formatLocale:t,timeZone:o,testId:r,children:n})=>{if(_react.useContext.call(void 0, oe)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");let s=_chunkJUHDBYOCcjs.g.call(void 0, e),[l]=Intl.getCanonicalLocales(t),d=_react.useMemo.call(void 0, ()=>new Intl.DateTimeFormat(l,{timeZone:o}).resolvedOptions().timeZone,[l,o]),u=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null);_react.useLayoutEffect.call(void 0, ()=>{ze(u.current.ownerDocument)},[]);let i=_react.useCallback.call(void 0, y=>{if(y.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let R=()=>{let{texts:N,settle:g,deadline:b}=p.current;p.current=null,clearTimeout(g),clearTimeout(b);let f=u.current;if(f===null)return;let T=N.join(Ve),h=Ze(f);if(h!==null)throw new Error(`announce: the live region is hidden from assistive technology (${h}), so this announcement would be lost: ${T}`);let L=f.ownerDocument.createElement("span");L.textContent=T,f.replaceChildren(L)},P=p.current;if(P===null){p.current={texts:[y],settle:setTimeout(R,re),deadline:setTimeout(R,Ye)};return}P.texts.push(y),clearTimeout(P.settle),P.settle=setTimeout(R,re)},[]),c=_react.useMemo.call(void 0, ()=>({locale:e,formatLocale:l,timeZone:d,labels:s,announce:i}),[e,l,d,s,i]);return _jsxruntime.jsx.call(void 0, oe.Provider,{value:c,children:_jsxruntime.jsxs.call(void 0, "div",{"data-cui-root":"","data-cui-surface":"surface","data-cui-fg":"fg","data-testid":r,children:[n,_jsxruntime.jsx.call(void 0, "div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${r}-announcer`,ref:u})]})})},w= exports.useConsoleUi =()=>{let e=_react.useContext.call(void 0, oe);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},m=()=>{w()},Je= exports.useAnnounce =()=>w().announce;var E=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 x=({fg:e,type:t,face:o,as:r="span",testId:n,id:a,tabIndex:s,ref:l,children:d})=>(m(),_jsxruntime.jsx.call(void 0, r,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":o,"data-testid":n,id:a,tabIndex:s,ref:l,children:d}));var tt={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:"prose"}},Ee=({children:e})=>_jsxruntime.jsx.call(void 0, "span",{children:e}),O= exports.Button =({variant:e,children:t,testId:o,type:r="button",onClick:n,unavailable:a,expanded:s,controls:l,ref:d,dataAttributes:u,busy:p,busyLabel:i})=>{m();let c=_react.useId.call(void 0, ),y=p===!0||a!==void 0,R=tt[e],P=N=>{if(y){N.preventDefault();return}_optionalChain([n, 'optionalCall', _2 => _2(N)])};return _jsxruntime.jsxs.call(void 0, "span",{className:"cui-button-group",children:[_jsxruntime.jsx.call(void 0, "button",{className:"cui-button",type:r==="submit"?"submit":"button","data-cui-variant":e,"data-cui-fg":R.fg,"data-cui-surface":R.surface,"data-cui-type":R.type,"data-testid":o,"aria-disabled":y?!0:void 0,"aria-busy":p===!0?!0:void 0,"aria-describedby":a===void 0?void 0:c,"aria-expanded":s,"aria-controls":l,onClick:P,ref:d,...E(u),children:_jsxruntime.jsx.call(void 0, Ee,{children:p===!0?i:t})}),a===void 0?null:_jsxruntime.jsx.call(void 0, x,{fg:"fg-muted",type:"body",id:c,testId:`${o}-reason`,children:a.reason})]})},ot= exports.Link =({onNavigate:e,children:t,testId:o,ref:r})=>(m(),_jsxruntime.jsx.call(void 0, "button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"prose","data-testid":o,onClick:e,ref:r,children:_jsxruntime.jsx.call(void 0, Ee,{children:t})}));var at=({id:e,title:t,description:o,actions:r,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=_react.useId.call(void 0, );return _jsxruntime.jsxs.call(void 0, "section",{className:"cui-card",id:e,"aria-labelledby":u,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":n,ref:s,...E(l),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"cui-card-header",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"cui-card-heading",children:[_jsxruntime.jsx.call(void 0, "h2",{className:"cui-card-title",id:u,"data-cui-type":"title",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-description","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),r===void 0?null:_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-actions",children:r})]}),d]})},nt= exports.CardSection =({id:e,title:t,subtitle:o,region:r=!1,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=_react.useId.call(void 0, ),p=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"cui-card-section-heading",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"cui-card-section-title",id:u,"data-cui-type":"body",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-section-subtitle","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),d]});return r?_jsxruntime.jsx.call(void 0, "section",{className:"cui-card-section",id:e,"aria-labelledby":u,"data-testid":n,ref:s,...E(l),children:p}):_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-section",id:e,"data-testid":n,ref:s,...E(l),children:p})};var D=({ruleKey:e,css:t})=>_jsxruntime.jsx.call(void 0, "style",{href:e,precedence:"cui",children:t});var dt=({caption:e,attributes:t,columns:o,attributePx:r,columnMinPx:n,testId:a})=>{m();let s=_react.useId.call(void 0, );for(let i of[r,n])if(!(Number.isFinite(i)&&i>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${i}`);if(o.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let i of o)for(let c of t)if(!Object.hasOwn(i.cells,c.key))throw new RangeError(`Column "${i.key}" has no value for attribute "${c.key}"`);let l=r+o.length*n,d=`cui-comparison-a${r}-c${n}-n${o.length}`,u=i=>`[data-cui-comparison="${d}"][data-cui-comparison-layout="${i}"]`,p=`${u("table")}{display:none}@container (min-width:${_chunkJUHDBYOCcjs.h.call(void 0, l)}){${u("table")}{display:block}${u("stack")}{display:none}}`;return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-container","data-cui-stack-below-px":l,"data-testid":a,children:[_jsxruntime.jsx.call(void 0, D,{ruleKey:d,css:p}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-comparison-frame","data-cui-comparison":d,"data-cui-comparison-layout":"table",children:_jsxruntime.jsxs.call(void 0, "table",{className:"cui-comparison-table","data-cui-type":"prose",children:[_jsxruntime.jsx.call(void 0, "caption",{className:"cui-visually-hidden",children:e}),_jsxruntime.jsxs.call(void 0, "colgroup",{children:[_jsxruntime.jsx.call(void 0, "col",{style:{width:_chunkJUHDBYOCcjs.h.call(void 0, r)}}),o.map(i=>_jsxruntime.jsx.call(void 0, "col",{},i.key))]}),_jsxruntime.jsx.call(void 0, "thead",{children:_jsxruntime.jsxs.call(void 0, "tr",{children:[_jsxruntime.jsx.call(void 0, "td",{}),o.map(i=>_jsxruntime.jsx.call(void 0, "th",{scope:"col",children:i.heading},i.key))]})}),_jsxruntime.jsx.call(void 0, "tbody",{children:t.map(i=>_jsxruntime.jsxs.call(void 0, "tr",{children:[_jsxruntime.jsx.call(void 0, "th",{scope:"row",children:i.label}),o.map(c=>_jsxruntime.jsx.call(void 0, "td",{children:c.cells[i.key]("table")},c.key))]},i.key))})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-comparison-stack","data-cui-comparison":d,"data-cui-comparison-layout":"stack",children:o.map((i,c)=>{let y=`${s}-column-${c}`;return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-comparison-column",role:"group","aria-labelledby":y,"data-cui-type":"prose",children:[_jsxruntime.jsx.call(void 0, "p",{className:"cui-comparison-heading",id:y,children:i.heading}),_jsxruntime.jsx.call(void 0, "dl",{className:"cui-comparison-list",children:t.map(R=>_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "dt",{children:R.label}),_jsxruntime.jsx.call(void 0, "dd",{children:i.cells[R.key]("stack")})]},R.key))})]},i.key)})})]})};var ut=({caption:e,captionHidden:t,columns:o,rows:r,rowKey:n,rowTestId:a,rowData:s,rowSize:l,empty:d,testId:u,ref:p})=>{m();let i=_react.useId.call(void 0, ),c=_chunkJUHDBYOCcjs.k.call(void 0, o);return _jsxruntime.jsx.call(void 0, "div",{className:"cui-container","data-testid":u,ref:p,children:r.length===0?_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"prose",testId:`${u}-empty`,children:d}):_jsxruntime.jsx.call(void 0, "section",{className:"cui-table-frame",tabIndex:0,"aria-labelledby":i,"data-testid":`${u}-frame`,children:_jsxruntime.jsxs.call(void 0, "table",{className:"cui-table","data-cui-type":"prose","data-cui-row-size":l,style:{"--cui-table-min":_chunkJUHDBYOCcjs.h.call(void 0, c)},children:[_jsxruntime.jsx.call(void 0, "caption",{className:t?"cui-visually-hidden":"cui-table-caption",id:i,children:e}),_jsxruntime.jsx.call(void 0, "colgroup",{children:o.map(y=>_jsxruntime.jsx.call(void 0, "col",{style:y.width.fixedPx===void 0?void 0:{width:_chunkJUHDBYOCcjs.h.call(void 0, y.width.fixedPx)}},y.key))}),_jsxruntime.jsx.call(void 0, "thead",{children:_jsxruntime.jsx.call(void 0, "tr",{children:o.map(y=>_jsxruntime.jsx.call(void 0, "th",{scope:"col","data-cui-align":y.align,"data-cui-surface":"subtle","data-cui-type":"caption",children:y.header},y.key))})}),_jsxruntime.jsx.call(void 0, "tbody",{children:r.map(y=>_jsxruntime.jsx.call(void 0, "tr",{tabIndex:-1,"data-cui-row-focus":"","data-testid":a,...E(_optionalChain([s, 'optionalCall', _3 => _3(y)])),children:o.map(R=>_jsxruntime.jsx.call(void 0, "td",{"data-cui-align":R.align,children:R.cell(y)},R.key))},n(y)))})]})})})};var B=({description:e,error:t})=>{m();let o=_react.useId.call(void 0, ),r=_react.useId.call(void 0, ),n=_react.useId.call(void 0, ),a=[e===void 0?null:r,t===void 0?null:n].filter(l=>l!==null).join(" ");return{control:{id:o,"aria-describedby":a===""?void 0:a,"aria-invalid":t===void 0?void 0:!0},descriptionId:r,errorId:n}},q=({description:e,error:t,descriptionId:o,errorId:r,testId:n})=>_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e===void 0?null:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"body",id:o,testId:`${n}-description`,children:e}),t===void 0?null:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"danger-fg",type:"body",id:r,testId:`${n}-error`,children:t})]}),yt= exports.Field =({label:e,description:t,error:o,testId:r,children:n})=>{let{control:a,descriptionId:s,errorId:l}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":r,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:a.id,"data-cui-type":"body",children:e}),n(a),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:s,errorId:l,testId:r})]})},mt= exports.TextInput =({label:e,description:t,error:o,value:r,onValueChange:n,type:a,list:s,required:l,testId:d,ref:u})=>{let{control:p,descriptionId:i,errorId:c}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${d}-field`,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:p.id,"data-cui-type":"body",children:e}),_jsxruntime.jsx.call(void 0, "input",{className:"cui-input",type:a,value:r,list:s,required:l,onChange:y=>n(y.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":d,ref:u,...p}),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:i,errorId:c,testId:d})]})},ft= exports.TextArea =({label:e,description:t,error:o,value:r,onValueChange:n,required:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),_jsxruntime.jsx.call(void 0, "textarea",{className:"cui-input cui-textarea",value:r,required:a,onChange:i=>n(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":s,ref:l,...d}),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},gt= exports.Select =({label:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),_jsxruntime.jsx.call(void 0, "select",{className:"cui-input",value:r,onChange:i=>a(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":s,ref:l,...d,children:n.map(i=>_jsxruntime.jsx.call(void 0, "option",{value:i.value,children:i.label},i.value))}),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},Rt= exports.RadioGroup =({legend:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let d=_react.useId.call(void 0, ),{control:u,descriptionId:p,errorId:i}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "fieldset",{className:"cui-radio-group","aria-describedby":u["aria-describedby"],"data-invalid":o!==void 0,"data-testid":s,children:[_jsxruntime.jsx.call(void 0, "legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),n.map((c,y)=>_jsxruntime.jsxs.call(void 0, "label",{className:"cui-radio","data-cui-type":"body",children:[_jsxruntime.jsx.call(void 0, "input",{type:"radio",name:d,value:c.value,checked:c.value===r,onChange:()=>a(c.value),"aria-invalid":u["aria-invalid"],"data-testid":`${s}-option-${c.value}`,ref:y===0?l:void 0}),_jsxruntime.jsx.call(void 0, "span",{children:c.label})]},c.value)),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:p,errorId:i,testId:s})]})};var Tt=({tone:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "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-testid":t,children:o})),_= exports.AlertMessage =({occurrence:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-alert",role:"alert","data-cui-surface":"danger-tint","data-cui-fg":"danger-fg","data-cui-type":"prose","data-cui-occurrence":e,"data-testid":t,children:o},e));var Ct=e=>e+1,ae= exports.useFocusRescue =e=>{let t=_react.useRef.call(void 0, e),o=_react.useRef.call(void 0, null),[,r]=_react.useReducer.call(void 0, Ct,0),n=_react.useCallback.call(void 0, (a=>()=>{a.contains(document.activeElement)&&(o.current=a,r())}),[]);return _react.useLayoutEffect.call(void 0, ()=>{t.current=e}),_react.useLayoutEffect.call(void 0, ()=>{let a=o.current;if(a===null)return;o.current=null;let s=[null,document.body].includes(document.activeElement);a.isConnected||!s||_optionalChain([t, 'access', _4 => _4.current, 'call', _5 => _5(), 'optionalAccess', _6 => _6.focus, 'call', _7 => _7()])}),n};var ne="[data-cui-row-focus]",Pt=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 o=[...t.querySelectorAll(ne)];if(o.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${o.length} ${ne} elements for ${e.count} rows`);return o},Et=(e,t)=>{let o=-1;return e.forEach((r,n)=>{t.has(r)&&(o=n)}),e[o+1]},Nt= exports.LoadMore =({onLoad:e,busy:t,done:o,failure:r,limit:n,rows:a,testId:s})=>{let{formatLocale:l,labels:d}=w(),u=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),i=_react.useRef.call(void 0, null),c=_react.useRef.call(void 0, !1),y=()=>{let g=a.ref.current;u.current={shown:new Set(g===null?[]:g.querySelectorAll(ne)),failureOccurrence:r===null?null:r.occurrence,busySeen:!1},e()};_react.useLayoutEffect.call(void 0, ()=>{let g=c.current;c.current=!1;let b=u.current;if(b===null)return;let f=Pt(a);if(t){b.busySeen=!0,b.shown=new Set(f);return}let T=Et(f,b.shown),h=r!==null&&r.occurrence!==b.failureOccurrence;if(!(b.busySeen||T!==void 0||h||o)||(u.current=null,h||T===void 0))return;let L=[null,document.body].includes(document.activeElement);(i.current!==null&&document.activeElement===i.current||g&&L)&&T.focus()});let R=ae(()=>o?p.current:i.current),P=_react.useCallback.call(void 0, (g=>{i.current=g;let b=R(g);return()=>{i.current=null,c.current=g===document.activeElement,b()}}),[R]),N=_react.useCallback.call(void 0, (g=>{p.current=g;let b=R(g);return()=>{p.current=null,b()}}),[R]);return o?_jsxruntime.jsx.call(void 0, "div",{className:"cui-load-more","data-testid":s,children:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:N,testId:`${s}-end`,children:d.endOfRecords})}):_jsxruntime.jsxs.call(void 0, "div",{className:"cui-load-more","data-testid":s,children:[_jsxruntime.jsx.call(void 0, O,{variant:"secondary",busy:t,busyLabel:d.loading,onClick:y,ref:P,testId:`${s}-button`,children:d.loadMore(_chunkJUHDBYOCcjs.a.call(void 0, n,l))}),r===null?null:_jsxruntime.jsx.call(void 0, _,{occurrence:r.occurrence,testId:`${s}-failure`,children:d.loadFailed(r.reason)})]})};var wt=({master:e,detail:t,masterMinPx:o,detailMinPx:r,testId:n})=>{m();let a=_chunkJUHDBYOCcjs.j.call(void 0, {masterMinPx:o,detailMinPx:r,gapPx:_chunkJUHDBYOCcjs.A.space["space-6"]});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-container","data-testid":n,children:[_jsxruntime.jsx.call(void 0, D,{ruleKey:a.key,css:a.css}),_jsxruntime.jsxs.call(void 0, "div",{className:"cui-master-detail","data-cui-master-detail":a.key,children:[_jsxruntime.jsx.call(void 0, "div",{className:"cui-master-detail-pane","data-testid":`${n}-master`,children:e}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-master-detail-pane","data-testid":`${n}-detail`,children:t})]})]})};var ie=({value:e,unit:t,testId:o})=>{let{formatLocale:r,labels:n}=w();if(e===null)return _jsxruntime.jsx.call(void 0, "span",{className:"cui-measured","data-measured":"false","data-testid":o,children:n.unmeasured});let a=_chunkJUHDBYOCcjs.a.call(void 0, e,r);return _jsxruntime.jsx.call(void 0, "span",{className:"cui-measured","data-measured":"true","data-testid":o,children:t===void 0?a:`${a} ${t}`})};var Lt={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"}},kt={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},St= exports.Pill =({tone:e,variant:t,testId:o,dataAttributes:r,children:n})=>{m();let a=t==="tint"?Lt[e]:{fg:"on-solid",surface:kt[e]};return _jsxruntime.jsx.call(void 0, "span",{className:"cui-pill","data-cui-tone":e,"data-cui-variant":t,"data-cui-fg":a.fg,"data-cui-surface":a.surface,"data-cui-type":"caption","data-testid":o,...E(r),children:n})};var Ft=({label:e,valueText:t,value:o,max:r,testId:n})=>{m();let a=_react.useId.call(void 0, );if(r!==null){if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Progress maximum must be positive: ${r}`);if(o===null||!(Number.isFinite(o)&&o>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${o}`)}let s=r===null?null:{max:r,now:Math.min(o,r)};return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-progress","data-testid":n,children:[_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg",type:"body",id:a,children:e}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":a,"aria-valuetext":t,"aria-valuemin":s===null?void 0:0,"aria-valuemax":_optionalChain([s, 'optionalAccess', _8 => _8.max]),"aria-valuenow":_optionalChain([s, 'optionalAccess', _9 => _9.now]),"data-cui-surface":"sunken","data-cui-indeterminate":s===null,"data-testid":`${n}-bar`,children:_jsxruntime.jsx.call(void 0, "div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:s===null?void 0:{inlineSize:`${s.now/s.max*100}%`},"data-testid":`${n}-fill`})}),_jsxruntime.jsx.call(void 0, "div",{"aria-hidden":"true",children:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-secondary",type:"body",testId:`${n}-value`,children:t})})]})};var Ut=403,Ht= exports.ResourceFailed =({failure:e,onReload:t,forbiddenMessage:o,failureMessage:r,rescueRef:n,testId:a})=>{let{labels:s}=w(),l=e.status===Ut,d=r===void 0?s.loadFailed:r;return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-resource-failed","data-testid":a,children:[_jsxruntime.jsx.call(void 0, _,{occurrence:e.occurrence,testId:`${a}-alert`,children:l?o:d(e.reason)}),l?null:_jsxruntime.jsx.call(void 0, O,{variant:"secondary",busy:e.retrying,busyLabel:s.loading,onClick:t,ref:n,testId:`${a}-reload`,children:s.reload})]})};var Fe=({selected:e,controls:t,onSelect:o,testId:r,dataAttributes:n,ref:a,children:s})=>(m(),_jsxruntime.jsx.call(void 0, "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":"prose","data-testid":r,onClick:o,ref:a,...E(n),children:s})),Ot= exports.SelectableList =({label:e,items:t,itemKey:o,selectedKey:r,onSelect:n,detailId:a,renderRow:s,rowTestId:l,rowData:d,empty:u,testId:p,ref:i})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-selectable","data-testid":p,ref:i,children:t.length===0?_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:u}):_jsxruntime.jsx.call(void 0, "ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let y=o(c);return _jsxruntime.jsx.call(void 0, "li",{children:_jsxruntime.jsx.call(void 0, Fe,{selected:y===r,controls:a,onSelect:()=>n(c),testId:l,dataAttributes:_optionalChain([d, 'optionalCall', _10 => _10(c)]),children:s(c)})},y)})})}));var $t=({gap:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:o})),Bt= exports.Cluster =({gap:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-cluster","data-cui-gap":e,"data-testid":t,children:o}));var Vt={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},Wt= exports.MetricTile =({label:e,sublabel:t,value:o,tone:r,testId:n,dataAttributes:a})=>{if(m(),o===null&&r!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${r}`);return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":r,"data-testid":n,...E(a),children:[_jsxruntime.jsx.call(void 0, "p",{className:"cui-tile-label","data-cui-type":"caption",children:e}),_jsxruntime.jsx.call(void 0, "p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption",children:t}),_jsxruntime.jsx.call(void 0, "p",{className:"cui-tile-value","data-cui-fg":Vt[r],"data-cui-type":"heading",children:_jsxruntime.jsx.call(void 0, ie,{value:o,testId:`${n}-value`})})]})},Ue=e=>_react.Children.toArray(e).flatMap(t=>{if(!_react.isValidElement.call(void 0, t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===_react.Fragment?Ue(t.props.children):[t]}),Zt= exports.TileGrid =({count:e,minInlinePx:t,testId:o,children:r})=>{m();let n=_chunkJUHDBYOCcjs.o.call(void 0, e,t,_chunkJUHDBYOCcjs.A.space["space-2"]),a=Ue(r).length;if(a!==e)throw new RangeError(`TileGrid has ${a} tiles but count is ${e}`);return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-container","data-testid":o,children:[_jsxruntime.jsx.call(void 0, D,{ruleKey:n.key,css:n.css}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-tile-grid","data-cui-tile-grid":n.key,"data-cui-gap":"space-2",children:r})]})};var Yt=229,Xt=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),Jt=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&Xt.has(e.type)&&(e.value!==""||e.validity.badInput),Qt= exports.useEscapeToClose =e=>_react.useCallback.call(void 0, t=>{t.key!=="Escape"||t.nativeEvent.isComposing||t.keyCode===Yt||Jt(t.target)||(t.stopPropagation(),e())},[e]);var Ke=e=>e===null?_chunkJUHDBYOCcjs.r:_chunkJUHDBYOCcjs.s,J=(e,t,o,r,n)=>{let[a,s]=_react.useState.call(void 0, ()=>({key:e,state:Ke(e)})),[l,d]=_react.useState.call(void 0, 0),[u,p]=_react.useState.call(void 0, 0),i=_react.useRef.call(void 0, t),c=_react.useRef.call(void 0, null),y=_react.useRef.call(void 0, l);_react.useLayoutEffect.call(void 0, ()=>{i.current=t}),_react.useEffect.call(void 0, ()=>{if(e===null){s({key:null,state:_chunkJUHDBYOCcjs.r});return}let f=new AbortController;c.current=e;let T=l===y.current?"revision":"reload";return y.current=l,s(h=>Object.is(h.key,e)?{key:e,state:r(h.state,T)}:{key:e,state:_chunkJUHDBYOCcjs.s}),i.current(f.signal).then(h=>{f.signal.aborted||(c.current=null,s(L=>({key:e,state:n(L.state,h)})))},h=>{f.signal.aborted||s(()=>{throw h})}),()=>{f.abort(),c.current=null}},[e,o,l,u]);let R=_react.useCallback.call(void 0, ()=>d(f=>f+1),[]),P=_react.useCallback.call(void 0, ()=>p(f=>f+1),[]),N=_react.useCallback.call(void 0, (f,T)=>{s(h=>Object.is(h.key,f)?{key:f,state:T(h.state)}:h)},[]),g=_react.useCallback.call(void 0, (f,T)=>{N(f,T),Object.is(c.current,f)&&P()},[N,P]);return{state:Object.is(a.key,e)?a.state:Ke(e),reload:R,refresh:P,update:N,write:g}};var oo=(e,t,o)=>{let r=_react.useRef.call(void 0, t);_react.useLayoutEffect.call(void 0, ()=>{r.current=t});let n=_react.useCallback.call(void 0, g=>r.current.first(g),[]),{state:a,reload:s,refresh:l,update:d,write:u}=J(e,n,o,_chunkJUHDBYOCcjs.v,_chunkJUHDBYOCcjs.w),p=_react.useRef.call(void 0, {key:e,state:a});_react.useLayoutEffect.call(void 0, ()=>{p.current={key:e,state:a}});let i=_react.useRef.call(void 0, null),c=_react.useCallback.call(void 0, ()=>{_optionalChain([i, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.controller, 'access', _13 => _13.abort, 'call', _14 => _14()]),i.current=null},[]);_react.useEffect.call(void 0, ()=>c,[e,o,c]);let y=_react.useCallback.call(void 0, ()=>{c(),s()},[c,s]),R=_react.useCallback.call(void 0, ()=>{c(),l()},[c,l]),P=_react.useCallback.call(void 0, ()=>{let{key:g,state:b}=p.current;if(g===null||b.kind!=="ready"||b.refreshing||b.value.next===null||b.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 f=b.value.next,T={key:g,controller:new AbortController,maps:[]};i.current=T,d(g,_chunkJUHDBYOCcjs.x),r.current.next(f,T.controller.signal).then(h=>{i.current===T&&(i.current=null,d(g,L=>T.maps.reduce(($e,Be)=>_chunkJUHDBYOCcjs.z.call(void 0, $e,Be),_chunkJUHDBYOCcjs.y.call(void 0, L,f,h))))},h=>{i.current===T&&d(g,()=>{throw h})})},[d]),N=_react.useCallback.call(void 0, (g,b)=>{let f=i.current;f!==null&&Object.is(f.key,g)&&f.maps.push(b),u(g,T=>_chunkJUHDBYOCcjs.z.call(void 0, T,b))},[u]);return{state:a,reload:y,refresh:R,loadMore:P,updateList:N}};var ao=(e,t,o)=>{let{state:r,reload:n,refresh:a,write:s}=J(e,t,o,_chunkJUHDBYOCcjs.t,_chunkJUHDBYOCcjs.u),l=_react.useCallback.call(void 0, (d,u)=>s(d,p=>_chunkJUHDBYOCcjs.u.call(void 0, p,{ok:!0,value:u})),[s]);return{state:r,reload:n,refresh:a,put:l}};var no=({testId:e,children:t})=>(m(),_jsxruntime.jsx.call(void 0, "span",{className:"cui-visually-hidden","data-testid":e,children:t}));exports.ANNOUNCE_SETTLE_MS = re; exports.AlertMessage = _; exports.Button = O; exports.CONSOLE_UI_LABEL_CATALOGS = _chunkJUHDBYOCcjs.f; exports.CONTRAST_MINIMUM = _chunkBEDKWWJCcjs.c; exports.CONTRAST_PAIRS = _chunkBEDKWWJCcjs.d; exports.Card = at; exports.CardSection = nt; exports.Cluster = Bt; exports.ComparisonGrid = dt; exports.ConsoleUiRoot = Xe; exports.DataTable = ut; exports.Field = yt; exports.Link = ot; exports.LoadMore = Nt; exports.MasterDetail = wt; exports.Measured = ie; exports.MetricTile = Wt; exports.Notice = Tt; exports.Pill = St; exports.ProgressBar = Ft; exports.RadioGroup = Rt; exports.ResourceFailed = Ht; exports.RowButton = Fe; exports.Select = gt; exports.SelectableList = Ot; exports.Stack = $t; exports.TOKENS = _chunkJUHDBYOCcjs.A; exports.Text = x; exports.TextArea = ft; exports.TextInput = mt; exports.TileGrid = Zt; exports.VisuallyHidden = no; exports.ZonedTimeError = _chunkJUHDBYOCcjs.b; exports.beginPage = _chunkJUHDBYOCcjs.x; exports.beginPagedReload = _chunkJUHDBYOCcjs.v; exports.beginReload = _chunkJUHDBYOCcjs.t; exports.ceil8 = _chunkJUHDBYOCcjs.n; exports.contrastRatio = _chunkBEDKWWJCcjs.b; exports.cssVar = _chunkJUHDBYOCcjs.B; exports.flatMapOutcome = _chunkJUHDBYOCcjs.q; exports.formatCount = _chunkJUHDBYOCcjs.a; exports.formatInstant = _chunkJUHDBYOCcjs.e; exports.hexToSrgb = _chunkBEDKWWJCcjs.a; exports.keepLastGood = _chunkJUHDBYOCcjs.u; exports.mapOutcome = _chunkJUHDBYOCcjs.p; exports.mapPagedList = _chunkJUHDBYOCcjs.z; exports.masterDetailPlan = _chunkJUHDBYOCcjs.i; exports.monoTextWidthEm = _chunkJUHDBYOCcjs.m; exports.resolveConsoleUiLabels = _chunkJUHDBYOCcjs.g; exports.settleFirstPage = _chunkJUHDBYOCcjs.w; exports.settlePage = _chunkJUHDBYOCcjs.y; exports.tableMinInlinePx = _chunkJUHDBYOCcjs.k; exports.textWidthEm = _chunkJUHDBYOCcjs.l; exports.tileGridPlan = _chunkJUHDBYOCcjs.o; exports.toOffsetIso = _chunkJUHDBYOCcjs.c; exports.toWallTime = _chunkJUHDBYOCcjs.d; exports.useAnnounce = Je; exports.useConsoleUi = w; exports.useEscapeToClose = Qt; exports.useFocusRescue = ae; exports.usePagedResource = oo; exports.useResource = ao;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkHFWVEGN3cjs = require('./chunk-HFWVEGN3.cjs');var _chunkBEDKWWJCcjs = require('./chunk-BEDKWWJC.cjs');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var oe=_react.createContext.call(void 0, null),We=" ",Ze='[inert], [aria-hidden="true" i]',Pe="dialog:modal",ze=e=>{if(e.closest(Ze)!==null)return'an ancestor is inert or aria-hidden="true"';let t=e.ownerDocument,o=[...t.querySelectorAll(Pe)],r=t.activeElement,n=o.filter(l=>l.contains(r)),a=n.length>0?n:o,s=a.filter(l=>l.contains(e)).length;return s===a.length?null:s===0?"the topmost open modal dialog does not contain the console":"open modal dialogs both contain and do not contain the console, and focus does not tell which one is topmost"},Ye=e=>{try{e.querySelectorAll(Pe)}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}},re= exports.ANNOUNCE_SETTLE_MS =150,Xe=1e3,Je= exports.ConsoleUiRoot =({locale:e,formatLocale:t,timeZone:o,testId:r,children:n})=>{if(_react.useContext.call(void 0, oe)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");let s=_chunkHFWVEGN3cjs.o.call(void 0, e),[l]=Intl.getCanonicalLocales(t),d=_react.useMemo.call(void 0, ()=>new Intl.DateTimeFormat(l,{timeZone:o}).resolvedOptions().timeZone,[l,o]),u=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null);_react.useLayoutEffect.call(void 0, ()=>{Ye(u.current.ownerDocument)},[]);let i=_react.useCallback.call(void 0, y=>{if(y.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let R=()=>{let{texts:N,settle:g,deadline:b}=p.current;p.current=null,clearTimeout(g),clearTimeout(b);let f=u.current;if(f===null)return;let T=N.join(We),h=ze(f);if(h!==null)throw new Error(`announce: the live region is hidden from assistive technology (${h}), so this announcement would be lost: ${T}`);let L=f.ownerDocument.createElement("span");L.textContent=T,f.replaceChildren(L)},P=p.current;if(P===null){p.current={texts:[y],settle:setTimeout(R,re),deadline:setTimeout(R,Xe)};return}P.texts.push(y),clearTimeout(P.settle),P.settle=setTimeout(R,re)},[]),c=_react.useMemo.call(void 0, ()=>({locale:e,formatLocale:l,timeZone:d,labels:s,announce:i}),[e,l,d,s,i]);return _jsxruntime.jsx.call(void 0, oe.Provider,{value:c,children:_jsxruntime.jsxs.call(void 0, "div",{"data-cui-root":"","data-cui-surface":"surface","data-cui-fg":"fg","data-testid":r,children:[n,_jsxruntime.jsx.call(void 0, "div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${r}-announcer`,ref:u})]})})},w= exports.useConsoleUi =()=>{let e=_react.useContext.call(void 0, oe);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},m=()=>{w()},Qe= exports.useAnnounce =()=>w().announce;var E=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 x=({fg:e,type:t,face:o,as:r="span",testId:n,id:a,tabIndex:s,ref:l,children:d})=>(m(),_jsxruntime.jsx.call(void 0, r,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":o,"data-testid":n,id:a,tabIndex:s,ref:l,children:d}));var ot={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:"prose"}},Ee=({children:e})=>_jsxruntime.jsx.call(void 0, "span",{children:e}),O= exports.Button =({variant:e,children:t,testId:o,type:r="button",onClick:n,unavailable:a,expanded:s,controls:l,ref:d,dataAttributes:u,busy:p,busyLabel:i})=>{m();let c=_react.useId.call(void 0, ),y=p===!0||a!==void 0,R=ot[e],P=N=>{if(y){N.preventDefault();return}_optionalChain([n, 'optionalCall', _2 => _2(N)])};return _jsxruntime.jsxs.call(void 0, "span",{className:"cui-button-group",children:[_jsxruntime.jsx.call(void 0, "button",{className:"cui-button",type:r==="submit"?"submit":"button","data-cui-variant":e,"data-cui-fg":R.fg,"data-cui-surface":R.surface,"data-cui-type":R.type,"data-testid":o,"aria-disabled":y?!0:void 0,"aria-busy":p===!0?!0:void 0,"aria-describedby":a===void 0?void 0:c,"aria-expanded":s,"aria-controls":l,onClick:P,ref:d,...E(u),children:_jsxruntime.jsx.call(void 0, Ee,{children:p===!0?i:t})}),a===void 0?null:_jsxruntime.jsx.call(void 0, x,{fg:"fg-muted",type:"body",id:c,testId:`${o}-reason`,children:a.reason})]})},rt= exports.Link =({onNavigate:e,children:t,testId:o,ref:r})=>(m(),_jsxruntime.jsx.call(void 0, "button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"prose","data-testid":o,onClick:e,ref:r,children:_jsxruntime.jsx.call(void 0, Ee,{children:t})}));var nt=({id:e,title:t,description:o,actions:r,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=_react.useId.call(void 0, );return _jsxruntime.jsxs.call(void 0, "section",{className:"cui-card",id:e,"aria-labelledby":u,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":n,ref:s,...E(l),children:[_jsxruntime.jsxs.call(void 0, "div",{className:"cui-card-header",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"cui-card-heading",children:[_jsxruntime.jsx.call(void 0, "h2",{className:"cui-card-title",id:u,"data-cui-type":"title",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-description","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),r===void 0?null:_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-actions",children:r})]}),d]})},st= exports.CardSection =({id:e,title:t,subtitle:o,region:r=!1,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=_react.useId.call(void 0, ),p=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsxs.call(void 0, "div",{className:"cui-card-section-heading",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"cui-card-section-title",id:u,"data-cui-type":"body",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-section-subtitle","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),d]});return r?_jsxruntime.jsx.call(void 0, "section",{className:"cui-card-section",id:e,"aria-labelledby":u,"data-testid":n,ref:s,...E(l),children:p}):_jsxruntime.jsx.call(void 0, "div",{className:"cui-card-section",id:e,"data-testid":n,ref:s,...E(l),children:p})};var D=({ruleKey:e,css:t})=>_jsxruntime.jsx.call(void 0, "style",{href:e,precedence:"cui",children:t});var ct=({caption:e,attributes:t,columns:o,attributePx:r,columnMinPx:n,testId:a})=>{m();let s=_react.useId.call(void 0, );for(let i of[r,n])if(!(Number.isFinite(i)&&i>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${i}`);if(o.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let i of o)for(let c of t)if(!Object.hasOwn(i.cells,c.key))throw new RangeError(`Column "${i.key}" has no value for attribute "${c.key}"`);let l=r+o.length*n,d=`cui-comparison-a${r}-c${n}-n${o.length}`,u=i=>`[data-cui-comparison="${d}"][data-cui-comparison-layout="${i}"]`,p=`${u("table")}{display:none}@container (min-width:${_chunkHFWVEGN3cjs.p.call(void 0, l)}){${u("table")}{display:block}${u("stack")}{display:none}}`;return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-container","data-cui-stack-below-px":l,"data-testid":a,children:[_jsxruntime.jsx.call(void 0, D,{ruleKey:d,css:p}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-comparison-frame","data-cui-comparison":d,"data-cui-comparison-layout":"table",children:_jsxruntime.jsxs.call(void 0, "table",{className:"cui-comparison-table","data-cui-type":"prose",children:[_jsxruntime.jsx.call(void 0, "caption",{className:"cui-visually-hidden",children:e}),_jsxruntime.jsxs.call(void 0, "colgroup",{children:[_jsxruntime.jsx.call(void 0, "col",{style:{width:_chunkHFWVEGN3cjs.p.call(void 0, r)}}),o.map(i=>_jsxruntime.jsx.call(void 0, "col",{},i.key))]}),_jsxruntime.jsx.call(void 0, "thead",{children:_jsxruntime.jsxs.call(void 0, "tr",{children:[_jsxruntime.jsx.call(void 0, "td",{}),o.map(i=>_jsxruntime.jsx.call(void 0, "th",{scope:"col",children:i.heading},i.key))]})}),_jsxruntime.jsx.call(void 0, "tbody",{children:t.map(i=>_jsxruntime.jsxs.call(void 0, "tr",{children:[_jsxruntime.jsx.call(void 0, "th",{scope:"row",children:i.label}),o.map(c=>_jsxruntime.jsx.call(void 0, "td",{children:c.cells[i.key]("table")},c.key))]},i.key))})]})}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-comparison-stack","data-cui-comparison":d,"data-cui-comparison-layout":"stack",children:o.map((i,c)=>{let y=`${s}-column-${c}`;return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-comparison-column",role:"group","aria-labelledby":y,"data-cui-type":"prose",children:[_jsxruntime.jsx.call(void 0, "p",{className:"cui-comparison-heading",id:y,children:i.heading}),_jsxruntime.jsx.call(void 0, "dl",{className:"cui-comparison-list",children:t.map(R=>_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "dt",{children:R.label}),_jsxruntime.jsx.call(void 0, "dd",{children:i.cells[R.key]("stack")})]},R.key))})]},i.key)})})]})};var pt=({caption:e,captionHidden:t,columns:o,rows:r,rowKey:n,rowTestId:a,rowData:s,rowSize:l,empty:d,testId:u,ref:p})=>{m();let i=_react.useId.call(void 0, ),c=_chunkHFWVEGN3cjs.s.call(void 0, o);return _jsxruntime.jsx.call(void 0, "div",{className:"cui-container","data-testid":u,ref:p,children:r.length===0?_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"prose",testId:`${u}-empty`,children:d}):_jsxruntime.jsx.call(void 0, "section",{className:"cui-table-frame",tabIndex:0,"aria-labelledby":i,"data-testid":`${u}-frame`,children:_jsxruntime.jsxs.call(void 0, "table",{className:"cui-table","data-cui-type":"prose","data-cui-row-size":l,style:{"--cui-table-min":_chunkHFWVEGN3cjs.p.call(void 0, c)},children:[_jsxruntime.jsx.call(void 0, "caption",{className:t?"cui-visually-hidden":"cui-table-caption",id:i,children:e}),_jsxruntime.jsx.call(void 0, "colgroup",{children:o.map(y=>_jsxruntime.jsx.call(void 0, "col",{style:y.width.fixedPx===void 0?void 0:{width:_chunkHFWVEGN3cjs.p.call(void 0, y.width.fixedPx)}},y.key))}),_jsxruntime.jsx.call(void 0, "thead",{children:_jsxruntime.jsx.call(void 0, "tr",{children:o.map(y=>_jsxruntime.jsx.call(void 0, "th",{scope:"col","data-cui-align":y.align,"data-cui-surface":"subtle","data-cui-type":"caption",children:y.header},y.key))})}),_jsxruntime.jsx.call(void 0, "tbody",{children:r.map(y=>_jsxruntime.jsx.call(void 0, "tr",{tabIndex:-1,"data-cui-row-focus":"","data-testid":a,...E(_optionalChain([s, 'optionalCall', _3 => _3(y)])),children:o.map(R=>_jsxruntime.jsx.call(void 0, "td",{"data-cui-align":R.align,children:R.cell(y)},R.key))},n(y)))})]})})})};var B=({description:e,error:t})=>{m();let o=_react.useId.call(void 0, ),r=_react.useId.call(void 0, ),n=_react.useId.call(void 0, ),a=[e===void 0?null:r,t===void 0?null:n].filter(l=>l!==null).join(" ");return{control:{id:o,"aria-describedby":a===""?void 0:a,"aria-invalid":t===void 0?void 0:!0},descriptionId:r,errorId:n}},q=({description:e,error:t,descriptionId:o,errorId:r,testId:n})=>_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[e===void 0?null:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"body",id:o,testId:`${n}-description`,children:e}),t===void 0?null:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"danger-fg",type:"body",id:r,testId:`${n}-error`,children:t})]}),mt= exports.Field =({label:e,description:t,error:o,testId:r,children:n})=>{let{control:a,descriptionId:s,errorId:l}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":r,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:a.id,"data-cui-type":"body",children:e}),n(a),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:s,errorId:l,testId:r})]})},ft= exports.TextInput =({label:e,description:t,error:o,value:r,onValueChange:n,type:a,list:s,required:l,testId:d,ref:u})=>{let{control:p,descriptionId:i,errorId:c}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${d}-field`,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:p.id,"data-cui-type":"body",children:e}),_jsxruntime.jsx.call(void 0, "input",{className:"cui-input",type:a,value:r,list:s,required:l,onChange:y=>n(y.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":d,ref:u,...p}),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:i,errorId:c,testId:d})]})},gt= exports.TextArea =({label:e,description:t,error:o,value:r,onValueChange:n,required:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),_jsxruntime.jsx.call(void 0, "textarea",{className:"cui-input cui-textarea",value:r,required:a,onChange:i=>n(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":s,ref:l,...d}),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},Rt= exports.Select =({label:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[_jsxruntime.jsx.call(void 0, "label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),_jsxruntime.jsx.call(void 0, "select",{className:"cui-input",value:r,onChange:i=>a(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":s,ref:l,...d,children:n.map(i=>_jsxruntime.jsx.call(void 0, "option",{value:i.value,children:i.label},i.value))}),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},bt= exports.RadioGroup =({legend:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let d=_react.useId.call(void 0, ),{control:u,descriptionId:p,errorId:i}=B({label:e,description:t,error:o});return _jsxruntime.jsxs.call(void 0, "fieldset",{className:"cui-radio-group","aria-describedby":u["aria-describedby"],"data-invalid":o!==void 0,"data-testid":s,children:[_jsxruntime.jsx.call(void 0, "legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),n.map((c,y)=>_jsxruntime.jsxs.call(void 0, "label",{className:"cui-radio","data-cui-type":"body",children:[_jsxruntime.jsx.call(void 0, "input",{type:"radio",name:d,value:c.value,checked:c.value===r,onChange:()=>a(c.value),"aria-invalid":u["aria-invalid"],"data-testid":`${s}-option-${c.value}`,ref:y===0?l:void 0}),_jsxruntime.jsx.call(void 0, "span",{children:c.label})]},c.value)),_jsxruntime.jsx.call(void 0, q,{description:t,error:o,descriptionId:p,errorId:i,testId:s})]})};var ht=({tone:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "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-testid":t,children:o})),_= exports.AlertMessage =({occurrence:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-alert",role:"alert","data-cui-surface":"danger-tint","data-cui-fg":"danger-fg","data-cui-type":"prose","data-cui-occurrence":e,"data-testid":t,children:o},e));var xt=e=>e+1,ae= exports.useFocusRescue =e=>{let t=_react.useRef.call(void 0, e),o=_react.useRef.call(void 0, null),[,r]=_react.useReducer.call(void 0, xt,0),n=_react.useCallback.call(void 0, (a=>()=>{a.contains(document.activeElement)&&(o.current=a,r())}),[]);return _react.useLayoutEffect.call(void 0, ()=>{t.current=e}),_react.useLayoutEffect.call(void 0, ()=>{let a=o.current;if(a===null)return;o.current=null;let s=[null,document.body].includes(document.activeElement);a.isConnected||!s||_optionalChain([t, 'access', _4 => _4.current, 'call', _5 => _5(), 'optionalAccess', _6 => _6.focus, 'call', _7 => _7()])}),n};var ne="[data-cui-row-focus]",Et=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 o=[...t.querySelectorAll(ne)];if(o.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${o.length} ${ne} elements for ${e.count} rows`);return o},Nt=(e,t)=>{let o=-1;return e.forEach((r,n)=>{t.has(r)&&(o=n)}),e[o+1]},Mt= exports.LoadMore =({onLoad:e,busy:t,done:o,failure:r,limit:n,rows:a,testId:s})=>{let{formatLocale:l,labels:d}=w(),u=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),i=_react.useRef.call(void 0, null),c=_react.useRef.call(void 0, !1),y=()=>{let g=a.ref.current;u.current={shown:new Set(g===null?[]:g.querySelectorAll(ne)),failureOccurrence:r===null?null:r.occurrence,busySeen:!1},e()};_react.useLayoutEffect.call(void 0, ()=>{let g=c.current;c.current=!1;let b=u.current;if(b===null)return;let f=Et(a);if(t){b.busySeen=!0,b.shown=new Set(f);return}let T=Nt(f,b.shown),h=r!==null&&r.occurrence!==b.failureOccurrence;if(!(b.busySeen||T!==void 0||h||o)||(u.current=null,h||T===void 0))return;let L=[null,document.body].includes(document.activeElement);(i.current!==null&&document.activeElement===i.current||g&&L)&&T.focus()});let R=ae(()=>o?p.current:i.current),P=_react.useCallback.call(void 0, (g=>{i.current=g;let b=R(g);return()=>{i.current=null,c.current=g===document.activeElement,b()}}),[R]),N=_react.useCallback.call(void 0, (g=>{p.current=g;let b=R(g);return()=>{p.current=null,b()}}),[R]);return o?_jsxruntime.jsx.call(void 0, "div",{className:"cui-load-more","data-testid":s,children:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:N,testId:`${s}-end`,children:d.endOfRecords})}):_jsxruntime.jsxs.call(void 0, "div",{className:"cui-load-more","data-testid":s,children:[_jsxruntime.jsx.call(void 0, O,{variant:"secondary",busy:t,busyLabel:d.loading,onClick:y,ref:P,testId:`${s}-button`,children:d.loadMore(_chunkHFWVEGN3cjs.a.call(void 0, n,l))}),r===null?null:_jsxruntime.jsx.call(void 0, _,{occurrence:r.occurrence,testId:`${s}-failure`,children:d.loadFailed(r.reason)})]})};var Lt=({master:e,detail:t,masterMinPx:o,detailMinPx:r,testId:n})=>{m();let a=_chunkHFWVEGN3cjs.r.call(void 0, {masterMinPx:o,detailMinPx:r,gapPx:_chunkHFWVEGN3cjs.C.space["space-6"]});return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-container","data-testid":n,children:[_jsxruntime.jsx.call(void 0, D,{ruleKey:a.key,css:a.css}),_jsxruntime.jsxs.call(void 0, "div",{className:"cui-master-detail","data-cui-master-detail":a.key,children:[_jsxruntime.jsx.call(void 0, "div",{className:"cui-master-detail-pane","data-testid":`${n}-master`,children:e}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-master-detail-pane","data-testid":`${n}-detail`,children:t})]})]})};var ie=({value:e,unit:t,testId:o})=>{let{formatLocale:r,labels:n}=w();if(e===null)return _jsxruntime.jsx.call(void 0, "span",{className:"cui-measured","data-measured":"false","data-testid":o,children:n.unmeasured});let a=_chunkHFWVEGN3cjs.a.call(void 0, e,r);return _jsxruntime.jsx.call(void 0, "span",{className:"cui-measured","data-measured":"true","data-testid":o,children:t===void 0?a:`${a} ${t}`})};var kt={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"}},St={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},It= exports.Pill =({tone:e,variant:t,testId:o,dataAttributes:r,children:n})=>{m();let a=t==="tint"?kt[e]:{fg:"on-solid",surface:St[e]};return _jsxruntime.jsx.call(void 0, "span",{className:"cui-pill","data-cui-tone":e,"data-cui-variant":t,"data-cui-fg":a.fg,"data-cui-surface":a.surface,"data-cui-type":"caption","data-testid":o,...E(r),children:n})};var Dt=({label:e,valueText:t,value:o,max:r,testId:n})=>{m();let a=_react.useId.call(void 0, );if(r!==null){if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Progress maximum must be positive: ${r}`);if(o===null||!(Number.isFinite(o)&&o>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${o}`)}let s=r===null?null:{max:r,now:Math.min(o,r)};return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-progress","data-testid":n,children:[_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg",type:"body",id:a,children:e}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":a,"aria-valuetext":t,"aria-valuemin":s===null?void 0:0,"aria-valuemax":_optionalChain([s, 'optionalAccess', _8 => _8.max]),"aria-valuenow":_optionalChain([s, 'optionalAccess', _9 => _9.now]),"data-cui-surface":"sunken","data-cui-indeterminate":s===null,"data-testid":`${n}-bar`,children:_jsxruntime.jsx.call(void 0, "div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:s===null?void 0:{inlineSize:`${s.now/s.max*100}%`},"data-testid":`${n}-fill`})}),_jsxruntime.jsx.call(void 0, "div",{"aria-hidden":"true",children:_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-secondary",type:"body",testId:`${n}-value`,children:t})})]})};var Ht=({failure:e,onReload:t,forbiddenMessage:o,failureMessage:r,rescueRef:n,testId:a})=>{let{labels:s}=w();return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-resource-failed","data-testid":a,children:[_jsxruntime.jsx.call(void 0, _,{occurrence:e.occurrence,testId:`${a}-alert`,children:s.failureSentence(e,o,r===void 0?s.loadFailed:r)}),e.status===403?null:_jsxruntime.jsx.call(void 0, O,{variant:"secondary",busy:e.retrying,busyLabel:s.loading,onClick:t,ref:n,testId:`${a}-reload`,children:s.reload})]})};var Fe=({selected:e,controls:t,onSelect:o,testId:r,dataAttributes:n,ref:a,children:s})=>(m(),_jsxruntime.jsx.call(void 0, "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":"prose","data-testid":r,onClick:o,ref:a,...E(n),children:s})),Ot= exports.SelectableList =({label:e,items:t,itemKey:o,selectedKey:r,onSelect:n,detailId:a,renderRow:s,rowTestId:l,rowData:d,empty:u,testId:p,ref:i})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-selectable","data-testid":p,ref:i,children:t.length===0?_jsxruntime.jsx.call(void 0, x,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:u}):_jsxruntime.jsx.call(void 0, "ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let y=o(c);return _jsxruntime.jsx.call(void 0, "li",{children:_jsxruntime.jsx.call(void 0, Fe,{selected:y===r,controls:a,onSelect:()=>n(c),testId:l,dataAttributes:_optionalChain([d, 'optionalCall', _10 => _10(c)]),children:s(c)})},y)})})}));var $t=({gap:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:o})),Bt= exports.Cluster =({gap:e,testId:t,children:o})=>(m(),_jsxruntime.jsx.call(void 0, "div",{className:"cui-cluster","data-cui-gap":e,"data-testid":t,children:o}));var Vt={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},Wt= exports.MetricTile =({label:e,sublabel:t,value:o,tone:r,testId:n,dataAttributes:a})=>{if(m(),o===null&&r!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${r}`);return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":r,"data-testid":n,...E(a),children:[_jsxruntime.jsx.call(void 0, "p",{className:"cui-tile-label","data-cui-type":"caption",children:e}),_jsxruntime.jsx.call(void 0, "p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption",children:t}),_jsxruntime.jsx.call(void 0, "p",{className:"cui-tile-value","data-cui-fg":Vt[r],"data-cui-type":"heading",children:_jsxruntime.jsx.call(void 0, ie,{value:o,testId:`${n}-value`})})]})},Ue=e=>_react.Children.toArray(e).flatMap(t=>{if(!_react.isValidElement.call(void 0, t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===_react.Fragment?Ue(t.props.children):[t]}),Zt= exports.TileGrid =({count:e,minInlinePx:t,testId:o,children:r})=>{m();let n=_chunkHFWVEGN3cjs.w.call(void 0, e,t,_chunkHFWVEGN3cjs.C.space["space-2"]),a=Ue(r).length;if(a!==e)throw new RangeError(`TileGrid has ${a} tiles but count is ${e}`);return _jsxruntime.jsxs.call(void 0, "div",{className:"cui-container","data-testid":o,children:[_jsxruntime.jsx.call(void 0, D,{ruleKey:n.key,css:n.css}),_jsxruntime.jsx.call(void 0, "div",{className:"cui-tile-grid","data-cui-tile-grid":n.key,"data-cui-gap":"space-2",children:r})]})};var Yt=229,Xt=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),Jt=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&Xt.has(e.type)&&(e.value!==""||e.validity.badInput),Qt= exports.useEscapeToClose =e=>_react.useCallback.call(void 0, t=>{t.key!=="Escape"||t.nativeEvent.isComposing||t.keyCode===Yt||Jt(t.target)||(t.stopPropagation(),e())},[e]);var Ke=e=>e===null?_chunkHFWVEGN3cjs.i:_chunkHFWVEGN3cjs.j,J=(e,t,o,r,n)=>{let[a,s]=_react.useState.call(void 0, ()=>({key:e,state:Ke(e)})),[l,d]=_react.useState.call(void 0, 0),[u,p]=_react.useState.call(void 0, 0),i=_react.useRef.call(void 0, t),c=_react.useRef.call(void 0, null),y=_react.useRef.call(void 0, l);_react.useLayoutEffect.call(void 0, ()=>{i.current=t}),_react.useEffect.call(void 0, ()=>{if(e===null){s({key:null,state:_chunkHFWVEGN3cjs.i});return}let f=new AbortController;c.current=e;let T=l===y.current?"revision":"reload";return y.current=l,s(h=>Object.is(h.key,e)?{key:e,state:r(h.state,T)}:{key:e,state:_chunkHFWVEGN3cjs.j}),i.current(f.signal).then(h=>{f.signal.aborted||(c.current=null,s(L=>({key:e,state:n(L.state,h)})))},h=>{f.signal.aborted||s(()=>{throw h})}),()=>{f.abort(),c.current=null}},[e,o,l,u]);let R=_react.useCallback.call(void 0, ()=>d(f=>f+1),[]),P=_react.useCallback.call(void 0, ()=>p(f=>f+1),[]),N=_react.useCallback.call(void 0, (f,T)=>{s(h=>Object.is(h.key,f)?{key:f,state:T(h.state)}:h)},[]),g=_react.useCallback.call(void 0, (f,T)=>{N(f,T),Object.is(c.current,f)&&P()},[N,P]);return{state:Object.is(a.key,e)?a.state:Ke(e),reload:R,refresh:P,update:N,write:g}};var oo=(e,t,o)=>{let r=_react.useRef.call(void 0, t);_react.useLayoutEffect.call(void 0, ()=>{r.current=t});let n=_react.useCallback.call(void 0, g=>r.current.first(g),[]),{state:a,reload:s,refresh:l,update:d,write:u}=J(e,n,o,_chunkHFWVEGN3cjs.x,_chunkHFWVEGN3cjs.y),p=_react.useRef.call(void 0, {key:e,state:a});_react.useLayoutEffect.call(void 0, ()=>{p.current={key:e,state:a}});let i=_react.useRef.call(void 0, null),c=_react.useCallback.call(void 0, ()=>{_optionalChain([i, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.controller, 'access', _13 => _13.abort, 'call', _14 => _14()]),i.current=null},[]);_react.useEffect.call(void 0, ()=>c,[e,o,c]);let y=_react.useCallback.call(void 0, ()=>{c(),s()},[c,s]),R=_react.useCallback.call(void 0, ()=>{c(),l()},[c,l]),P=_react.useCallback.call(void 0, ()=>{let{key:g,state:b}=p.current;if(g===null||b.kind!=="ready"||b.refreshing||b.value.next===null||b.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 f=b.value.next,T={key:g,controller:new AbortController,maps:[]};i.current=T,d(g,_chunkHFWVEGN3cjs.z),r.current.next(f,T.controller.signal).then(h=>{i.current===T&&(i.current=null,d(g,L=>T.maps.reduce(($e,Be)=>_chunkHFWVEGN3cjs.B.call(void 0, $e,Be),_chunkHFWVEGN3cjs.A.call(void 0, L,f,h))))},h=>{i.current===T&&d(g,()=>{throw h})})},[d]),N=_react.useCallback.call(void 0, (g,b)=>{let f=i.current;f!==null&&Object.is(f.key,g)&&f.maps.push(b),u(g,T=>_chunkHFWVEGN3cjs.B.call(void 0, T,b))},[u]);return{state:a,reload:y,refresh:R,loadMore:P,updateList:N}};var ao=(e,t,o)=>{let{state:r,reload:n,refresh:a,write:s}=J(e,t,o,_chunkHFWVEGN3cjs.k,_chunkHFWVEGN3cjs.l),l=_react.useCallback.call(void 0, (d,u)=>s(d,p=>_chunkHFWVEGN3cjs.l.call(void 0, p,{ok:!0,value:u})),[s]);return{state:r,reload:n,refresh:a,put:l}};var no=({testId:e,children:t})=>(m(),_jsxruntime.jsx.call(void 0, "span",{className:"cui-visually-hidden","data-testid":e,children:t}));exports.ANNOUNCE_SETTLE_MS = re; exports.AlertMessage = _; exports.Button = O; exports.CONSOLE_UI_LABEL_CATALOGS = _chunkHFWVEGN3cjs.n; exports.CONTRAST_MINIMUM = _chunkBEDKWWJCcjs.c; exports.CONTRAST_PAIRS = _chunkBEDKWWJCcjs.d; exports.Card = nt; exports.CardSection = st; exports.Cluster = Bt; exports.ComparisonGrid = ct; exports.ConsoleUiRoot = Je; exports.DataTable = pt; exports.Field = mt; exports.HTTP_FORBIDDEN = _chunkHFWVEGN3cjs.f; exports.Link = rt; exports.LoadMore = Mt; exports.MasterDetail = Lt; exports.Measured = ie; exports.MetricTile = Wt; exports.Notice = ht; exports.Pill = It; exports.ProgressBar = Dt; exports.RadioGroup = bt; exports.ResourceFailed = Ht; exports.RowButton = Fe; exports.Select = Rt; exports.SelectableList = Ot; exports.Stack = $t; exports.TOKENS = _chunkHFWVEGN3cjs.C; exports.Text = x; exports.TextArea = gt; exports.TextInput = ft; exports.TileGrid = Zt; exports.VisuallyHidden = no; exports.ZonedTimeError = _chunkHFWVEGN3cjs.b; exports.beginPage = _chunkHFWVEGN3cjs.z; exports.beginPagedReload = _chunkHFWVEGN3cjs.x; exports.beginReload = _chunkHFWVEGN3cjs.k; exports.ceil8 = _chunkHFWVEGN3cjs.v; exports.contrastRatio = _chunkBEDKWWJCcjs.b; exports.cssVar = _chunkHFWVEGN3cjs.D; exports.flatMapOutcome = _chunkHFWVEGN3cjs.h; exports.formatCount = _chunkHFWVEGN3cjs.a; exports.formatInstant = _chunkHFWVEGN3cjs.e; exports.hexToSrgb = _chunkBEDKWWJCcjs.a; exports.keepLastGood = _chunkHFWVEGN3cjs.l; exports.mapOutcome = _chunkHFWVEGN3cjs.g; exports.mapPagedList = _chunkHFWVEGN3cjs.B; exports.masterDetailPlan = _chunkHFWVEGN3cjs.q; exports.monoTextWidthEm = _chunkHFWVEGN3cjs.u; exports.reasonAside = _chunkHFWVEGN3cjs.m; exports.resolveConsoleUiLabels = _chunkHFWVEGN3cjs.o; exports.settleFirstPage = _chunkHFWVEGN3cjs.y; exports.settlePage = _chunkHFWVEGN3cjs.A; exports.tableMinInlinePx = _chunkHFWVEGN3cjs.s; exports.textWidthEm = _chunkHFWVEGN3cjs.t; exports.tileGridPlan = _chunkHFWVEGN3cjs.w; exports.toOffsetIso = _chunkHFWVEGN3cjs.c; exports.toWallTime = _chunkHFWVEGN3cjs.d; exports.useAnnounce = Qe; exports.useConsoleUi = w; exports.useEscapeToClose = Qt; exports.useFocusRescue = ae; exports.usePagedResource = oo; exports.useResource = ao;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConsoleUiLocale, ConsoleUiLabels, ColumnWidth, ResourceFailure, SpaceToken, FgRole, TypeToken, ResourceOutcome, KeysetPage, NextPage, PagedState, PagedContent, ResourceState } from "./core.cjs";
2
- export { AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, ColorToken, ColumnWidthSource, CommandOutcome, ConsoleUiTokens, ContrastRole, MasterDetailOptions, MasterDetailPlan, PageFailure, PagedValue, RadiusToken, ReloadCause, SizeToken, Srgb, StrokeToken, SurfaceRole, TOKENS, TileGridPlan, TileGridStep, TokenName, WeightToken, ZonedTimeError, ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime } from "./core.cjs";
2
+ export { AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, ColorToken, ColumnWidthSource, CommandOutcome, ConsoleUiTokens, ContrastRole, HTTP_FORBIDDEN, MasterDetailOptions, MasterDetailPlan, PageFailure, PagedValue, RadiusToken, ReloadCause, SizeToken, Srgb, StrokeToken, SurfaceRole, TOKENS, TileGridPlan, TileGridStep, TokenName, WeightToken, ZonedTimeError, ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, reasonAside, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime } from "./core.cjs";
3
3
  import * as react from "react";
4
4
  import { ReactNode, MouseEvent, Ref, RefObject, RefCallback, KeyboardEvent } from "react";
5
5
  type DataAttributes = Readonly<Record<`data-${string}`, string | number | boolean>>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConsoleUiLocale, ConsoleUiLabels, ColumnWidth, ResourceFailure, SpaceToken, FgRole, TypeToken, ResourceOutcome, KeysetPage, NextPage, PagedState, PagedContent, ResourceState } from "./core.js";
2
- export { AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, ColorToken, ColumnWidthSource, CommandOutcome, ConsoleUiTokens, ContrastRole, MasterDetailOptions, MasterDetailPlan, PageFailure, PagedValue, RadiusToken, ReloadCause, SizeToken, Srgb, StrokeToken, SurfaceRole, TOKENS, TileGridPlan, TileGridStep, TokenName, WeightToken, ZonedTimeError, ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime } from "./core.js";
2
+ export { AccentRole, CONSOLE_UI_LABEL_CATALOGS, CONTRAST_MINIMUM, CONTRAST_PAIRS, ColorToken, ColumnWidthSource, CommandOutcome, ConsoleUiTokens, ContrastRole, HTTP_FORBIDDEN, MasterDetailOptions, MasterDetailPlan, PageFailure, PagedValue, RadiusToken, ReloadCause, SizeToken, Srgb, StrokeToken, SurfaceRole, TOKENS, TileGridPlan, TileGridStep, TokenName, WeightToken, ZonedTimeError, ZonedTimeErrorReason, beginPage, beginPagedReload, beginReload, ceil8, contrastRatio, cssVar, flatMapOutcome, formatCount, formatInstant, hexToSrgb, keepLastGood, mapOutcome, mapPagedList, masterDetailPlan, monoTextWidthEm, reasonAside, resolveConsoleUiLabels, settleFirstPage, settlePage, tableMinInlinePx, textWidthEm, tileGridPlan, toOffsetIso, toWallTime } from "./core.js";
3
3
  import * as react from "react";
4
4
  import { ReactNode, MouseEvent, Ref, RefObject, RefCallback, KeyboardEvent } from "react";
5
5
  type DataAttributes = Readonly<Record<`data-${string}`, string | number | boolean>>;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A as W,B as xo,a as V,b as io,c as lo,d as co,e as uo,f as po,g as ue,h as A,i as yo,j as pe,k as ye,l as mo,m as fo,n as go,o as me,p as Ro,q as bo,r as Q,s as j,t as fe,u as ee,v as ge,w as Re,x as be,y as Te,z as te}from"./chunk-4F6Q2VL5.js";import{a as To,b as ho,c as vo,d as Co}from"./chunk-MYMCHY7C.js";import{useId as et}from"react";import{createContext as qe,useCallback as _e,useContext as xe,useLayoutEffect as Ge,useMemo as he,useRef as ve}from"react";import{jsx as Ce,jsxs as Qe}from"react/jsx-runtime";var oe=qe(null),Ve=" ",We='[inert], [aria-hidden="true" i]',Pe="dialog:modal",Ze=e=>{if(e.closest(We)!==null)return'an ancestor is inert or aria-hidden="true"';let t=e.ownerDocument,o=[...t.querySelectorAll(Pe)],r=t.activeElement,n=o.filter(l=>l.contains(r)),a=n.length>0?n:o,s=a.filter(l=>l.contains(e)).length;return s===a.length?null:s===0?"the topmost open modal dialog does not contain the console":"open modal dialogs both contain and do not contain the console, and focus does not tell which one is topmost"},ze=e=>{try{e.querySelectorAll(Pe)}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}},re=150,Ye=1e3,Xe=({locale:e,formatLocale:t,timeZone:o,testId:r,children:n})=>{if(xe(oe)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");let s=ue(e),[l]=Intl.getCanonicalLocales(t),d=he(()=>new Intl.DateTimeFormat(l,{timeZone:o}).resolvedOptions().timeZone,[l,o]),u=ve(null),p=ve(null);Ge(()=>{ze(u.current.ownerDocument)},[]);let i=_e(y=>{if(y.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let R=()=>{let{texts:N,settle:g,deadline:b}=p.current;p.current=null,clearTimeout(g),clearTimeout(b);let f=u.current;if(f===null)return;let T=N.join(Ve),h=Ze(f);if(h!==null)throw new Error(`announce: the live region is hidden from assistive technology (${h}), so this announcement would be lost: ${T}`);let L=f.ownerDocument.createElement("span");L.textContent=T,f.replaceChildren(L)},P=p.current;if(P===null){p.current={texts:[y],settle:setTimeout(R,re),deadline:setTimeout(R,Ye)};return}P.texts.push(y),clearTimeout(P.settle),P.settle=setTimeout(R,re)},[]),c=he(()=>({locale:e,formatLocale:l,timeZone:d,labels:s,announce:i}),[e,l,d,s,i]);return Ce(oe.Provider,{value:c,children:Qe("div",{"data-cui-root":"","data-cui-surface":"surface","data-cui-fg":"fg","data-testid":r,children:[n,Ce("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${r}-announcer`,ref:u})]})})},w=()=>{let e=xe(oe);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},m=()=>{w()},Je=()=>w().announce;var E=e=>{if(e===void 0)return{};for(let t of Object.keys(e))if(!t.startsWith("data-")||t.startsWith("data-cui-")||t==="data-testid")throw new RangeError(`Caller attributes must be data-* and must not override data-cui-* or data-testid: ${t}`);return e};import{jsx as je}from"react/jsx-runtime";var x=({fg:e,type:t,face:o,as:r="span",testId:n,id:a,tabIndex:s,ref:l,children:d})=>(m(),je(r,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":o,"data-testid":n,id:a,tabIndex:s,ref:l,children:d}));import{jsx as F,jsxs as rt}from"react/jsx-runtime";var tt={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:"prose"}},Ee=({children:e})=>F("span",{children:e}),O=({variant:e,children:t,testId:o,type:r="button",onClick:n,unavailable:a,expanded:s,controls:l,ref:d,dataAttributes:u,busy:p,busyLabel:i})=>{m();let c=et(),y=p===!0||a!==void 0,R=tt[e],P=N=>{if(y){N.preventDefault();return}n?.(N)};return rt("span",{className:"cui-button-group",children:[F("button",{className:"cui-button",type:r==="submit"?"submit":"button","data-cui-variant":e,"data-cui-fg":R.fg,"data-cui-surface":R.surface,"data-cui-type":R.type,"data-testid":o,"aria-disabled":y?!0:void 0,"aria-busy":p===!0?!0:void 0,"aria-describedby":a===void 0?void 0:c,"aria-expanded":s,"aria-controls":l,onClick:P,ref:d,...E(u),children:F(Ee,{children:p===!0?i:t})}),a===void 0?null:F(x,{fg:"fg-muted",type:"body",id:c,testId:`${o}-reason`,children:a.reason})]})},ot=({onNavigate:e,children:t,testId:o,ref:r})=>(m(),F("button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"prose","data-testid":o,onClick:e,ref:r,children:F(Ee,{children:t})}));import{useId as Ne}from"react";import{Fragment as st,jsx as k,jsxs as $}from"react/jsx-runtime";var at=({id:e,title:t,description:o,actions:r,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=Ne();return $("section",{className:"cui-card",id:e,"aria-labelledby":u,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":n,ref:s,...E(l),children:[$("div",{className:"cui-card-header",children:[$("div",{className:"cui-card-heading",children:[k("h2",{className:"cui-card-title",id:u,"data-cui-type":"title",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:k("div",{className:"cui-card-description","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),r===void 0?null:k("div",{className:"cui-card-actions",children:r})]}),d]})},nt=({id:e,title:t,subtitle:o,region:r=!1,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=Ne(),p=$(st,{children:[$("div",{className:"cui-card-section-heading",children:[k("h3",{className:"cui-card-section-title",id:u,"data-cui-type":"body",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:k("div",{className:"cui-card-section-subtitle","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),d]});return r?k("section",{className:"cui-card-section",id:e,"aria-labelledby":u,"data-testid":n,ref:s,...E(l),children:p}):k("div",{className:"cui-card-section",id:e,"data-testid":n,ref:s,...E(l),children:p})};import{useId as lt}from"react";import{jsx as it}from"react/jsx-runtime";var D=({ruleKey:e,css:t})=>it("style",{href:e,precedence:"cui",children:t});import{jsx as C,jsxs as S}from"react/jsx-runtime";var dt=({caption:e,attributes:t,columns:o,attributePx:r,columnMinPx:n,testId:a})=>{m();let s=lt();for(let i of[r,n])if(!(Number.isFinite(i)&&i>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${i}`);if(o.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let i of o)for(let c of t)if(!Object.hasOwn(i.cells,c.key))throw new RangeError(`Column "${i.key}" has no value for attribute "${c.key}"`);let l=r+o.length*n,d=`cui-comparison-a${r}-c${n}-n${o.length}`,u=i=>`[data-cui-comparison="${d}"][data-cui-comparison-layout="${i}"]`,p=`${u("table")}{display:none}@container (min-width:${A(l)}){${u("table")}{display:block}${u("stack")}{display:none}}`;return S("div",{className:"cui-container","data-cui-stack-below-px":l,"data-testid":a,children:[C(D,{ruleKey:d,css:p}),C("div",{className:"cui-comparison-frame","data-cui-comparison":d,"data-cui-comparison-layout":"table",children:S("table",{className:"cui-comparison-table","data-cui-type":"prose",children:[C("caption",{className:"cui-visually-hidden",children:e}),S("colgroup",{children:[C("col",{style:{width:A(r)}}),o.map(i=>C("col",{},i.key))]}),C("thead",{children:S("tr",{children:[C("td",{}),o.map(i=>C("th",{scope:"col",children:i.heading},i.key))]})}),C("tbody",{children:t.map(i=>S("tr",{children:[C("th",{scope:"row",children:i.label}),o.map(c=>C("td",{children:c.cells[i.key]("table")},c.key))]},i.key))})]})}),C("div",{className:"cui-comparison-stack","data-cui-comparison":d,"data-cui-comparison-layout":"stack",children:o.map((i,c)=>{let y=`${s}-column-${c}`;return S("div",{className:"cui-comparison-column",role:"group","aria-labelledby":y,"data-cui-type":"prose",children:[C("p",{className:"cui-comparison-heading",id:y,children:i.heading}),C("dl",{className:"cui-comparison-list",children:t.map(R=>S("div",{children:[C("dt",{children:R.label}),C("dd",{children:i.cells[R.key]("stack")})]},R.key))})]},i.key)})})]})};import{useId as ct}from"react";import{jsx as M,jsxs as pt}from"react/jsx-runtime";var ut=({caption:e,captionHidden:t,columns:o,rows:r,rowKey:n,rowTestId:a,rowData:s,rowSize:l,empty:d,testId:u,ref:p})=>{m();let i=ct(),c=ye(o);return M("div",{className:"cui-container","data-testid":u,ref:p,children:r.length===0?M(x,{as:"p",fg:"fg-muted",type:"prose",testId:`${u}-empty`,children:d}):M("section",{className:"cui-table-frame",tabIndex:0,"aria-labelledby":i,"data-testid":`${u}-frame`,children:pt("table",{className:"cui-table","data-cui-type":"prose","data-cui-row-size":l,style:{"--cui-table-min":A(c)},children:[M("caption",{className:t?"cui-visually-hidden":"cui-table-caption",id:i,children:e}),M("colgroup",{children:o.map(y=>M("col",{style:y.width.fixedPx===void 0?void 0:{width:A(y.width.fixedPx)}},y.key))}),M("thead",{children:M("tr",{children:o.map(y=>M("th",{scope:"col","data-cui-align":y.align,"data-cui-surface":"subtle","data-cui-type":"caption",children:y.header},y.key))})}),M("tbody",{children:r.map(y=>M("tr",{tabIndex:-1,"data-cui-row-focus":"","data-testid":a,...E(s?.(y)),children:o.map(R=>M("td",{"data-cui-align":R.align,children:R.cell(y)},R.key))},n(y)))})]})})})};import{useId as Z}from"react";import{Fragment as bt,jsx as v,jsxs as I}from"react/jsx-runtime";var B=({description:e,error:t})=>{m();let o=Z(),r=Z(),n=Z(),a=[e===void 0?null:r,t===void 0?null:n].filter(l=>l!==null).join(" ");return{control:{id:o,"aria-describedby":a===""?void 0:a,"aria-invalid":t===void 0?void 0:!0},descriptionId:r,errorId:n}},q=({description:e,error:t,descriptionId:o,errorId:r,testId:n})=>I(bt,{children:[e===void 0?null:v(x,{as:"p",fg:"fg-muted",type:"body",id:o,testId:`${n}-description`,children:e}),t===void 0?null:v(x,{as:"p",fg:"danger-fg",type:"body",id:r,testId:`${n}-error`,children:t})]}),yt=({label:e,description:t,error:o,testId:r,children:n})=>{let{control:a,descriptionId:s,errorId:l}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":r,children:[v("label",{className:"cui-field-label",htmlFor:a.id,"data-cui-type":"body",children:e}),n(a),v(q,{description:t,error:o,descriptionId:s,errorId:l,testId:r})]})},mt=({label:e,description:t,error:o,value:r,onValueChange:n,type:a,list:s,required:l,testId:d,ref:u})=>{let{control:p,descriptionId:i,errorId:c}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${d}-field`,children:[v("label",{className:"cui-field-label",htmlFor:p.id,"data-cui-type":"body",children:e}),v("input",{className:"cui-input",type:a,value:r,list:s,required:l,onChange:y=>n(y.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":d,ref:u,...p}),v(q,{description:t,error:o,descriptionId:i,errorId:c,testId:d})]})},ft=({label:e,description:t,error:o,value:r,onValueChange:n,required:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[v("label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),v("textarea",{className:"cui-input cui-textarea",value:r,required:a,onChange:i=>n(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":s,ref:l,...d}),v(q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},gt=({label:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[v("label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),v("select",{className:"cui-input",value:r,onChange:i=>a(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":s,ref:l,...d,children:n.map(i=>v("option",{value:i.value,children:i.label},i.value))}),v(q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},Rt=({legend:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let d=Z(),{control:u,descriptionId:p,errorId:i}=B({label:e,description:t,error:o});return I("fieldset",{className:"cui-radio-group","aria-describedby":u["aria-describedby"],"data-invalid":o!==void 0,"data-testid":s,children:[v("legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),n.map((c,y)=>I("label",{className:"cui-radio","data-cui-type":"body",children:[v("input",{type:"radio",name:d,value:c.value,checked:c.value===r,onChange:()=>a(c.value),"aria-invalid":u["aria-invalid"],"data-testid":`${s}-option-${c.value}`,ref:y===0?l:void 0}),v("span",{children:c.label})]},c.value)),v(q,{description:t,error:o,descriptionId:p,errorId:i,testId:s})]})};import{useCallback as ke,useLayoutEffect as xt,useRef as z}from"react";import{jsx as Me}from"react/jsx-runtime";var Tt=({tone:e,testId:t,children:o})=>(m(),Me("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-testid":t,children:o})),_=({occurrence:e,testId:t,children:o})=>(m(),Me("div",{className:"cui-alert",role:"alert","data-cui-surface":"danger-tint","data-cui-fg":"danger-fg","data-cui-type":"prose","data-cui-occurrence":e,"data-testid":t,children:o},e));import{useCallback as ht,useLayoutEffect as we,useReducer as vt,useRef as Le}from"react";var Ct=e=>e+1,ae=e=>{let t=Le(e),o=Le(null),[,r]=vt(Ct,0),n=ht((a=>()=>{a.contains(document.activeElement)&&(o.current=a,r())}),[]);return we(()=>{t.current=e}),we(()=>{let a=o.current;if(a===null)return;o.current=null;let s=[null,document.body].includes(document.activeElement);a.isConnected||!s||t.current()?.focus()}),n};import{jsx as Y,jsxs as Mt}from"react/jsx-runtime";var ne="[data-cui-row-focus]",Pt=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 o=[...t.querySelectorAll(ne)];if(o.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${o.length} ${ne} elements for ${e.count} rows`);return o},Et=(e,t)=>{let o=-1;return e.forEach((r,n)=>{t.has(r)&&(o=n)}),e[o+1]},Nt=({onLoad:e,busy:t,done:o,failure:r,limit:n,rows:a,testId:s})=>{let{formatLocale:l,labels:d}=w(),u=z(null),p=z(null),i=z(null),c=z(!1),y=()=>{let g=a.ref.current;u.current={shown:new Set(g===null?[]:g.querySelectorAll(ne)),failureOccurrence:r===null?null:r.occurrence,busySeen:!1},e()};xt(()=>{let g=c.current;c.current=!1;let b=u.current;if(b===null)return;let f=Pt(a);if(t){b.busySeen=!0,b.shown=new Set(f);return}let T=Et(f,b.shown),h=r!==null&&r.occurrence!==b.failureOccurrence;if(!(b.busySeen||T!==void 0||h||o)||(u.current=null,h||T===void 0))return;let L=[null,document.body].includes(document.activeElement);(i.current!==null&&document.activeElement===i.current||g&&L)&&T.focus()});let R=ae(()=>o?p.current:i.current),P=ke((g=>{i.current=g;let b=R(g);return()=>{i.current=null,c.current=g===document.activeElement,b()}}),[R]),N=ke((g=>{p.current=g;let b=R(g);return()=>{p.current=null,b()}}),[R]);return o?Y("div",{className:"cui-load-more","data-testid":s,children:Y(x,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:N,testId:`${s}-end`,children:d.endOfRecords})}):Mt("div",{className:"cui-load-more","data-testid":s,children:[Y(O,{variant:"secondary",busy:t,busyLabel:d.loading,onClick:y,ref:P,testId:`${s}-button`,children:d.loadMore(V(n,l))}),r===null?null:Y(_,{occurrence:r.occurrence,testId:`${s}-failure`,children:d.loadFailed(r.reason)})]})};import{jsx as se,jsxs as Se}from"react/jsx-runtime";var wt=({master:e,detail:t,masterMinPx:o,detailMinPx:r,testId:n})=>{m();let a=pe({masterMinPx:o,detailMinPx:r,gapPx:W.space["space-6"]});return Se("div",{className:"cui-container","data-testid":n,children:[se(D,{ruleKey:a.key,css:a.css}),Se("div",{className:"cui-master-detail","data-cui-master-detail":a.key,children:[se("div",{className:"cui-master-detail-pane","data-testid":`${n}-master`,children:e}),se("div",{className:"cui-master-detail-pane","data-testid":`${n}-detail`,children:t})]})]})};import{jsx as Ie}from"react/jsx-runtime";var ie=({value:e,unit:t,testId:o})=>{let{formatLocale:r,labels:n}=w();if(e===null)return Ie("span",{className:"cui-measured","data-measured":"false","data-testid":o,children:n.unmeasured});let a=V(e,r);return Ie("span",{className:"cui-measured","data-measured":"true","data-testid":o,children:t===void 0?a:`${a} ${t}`})};import{jsx as It}from"react/jsx-runtime";var Lt={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"}},kt={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},St=({tone:e,variant:t,testId:o,dataAttributes:r,children:n})=>{m();let a=t==="tint"?Lt[e]:{fg:"on-solid",surface:kt[e]};return It("span",{className:"cui-pill","data-cui-tone":e,"data-cui-variant":t,"data-cui-fg":a.fg,"data-cui-surface":a.surface,"data-cui-type":"caption","data-testid":o,...E(r),children:n})};import{useId as At}from"react";import{jsx as G,jsxs as Dt}from"react/jsx-runtime";var Ft=({label:e,valueText:t,value:o,max:r,testId:n})=>{m();let a=At();if(r!==null){if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Progress maximum must be positive: ${r}`);if(o===null||!(Number.isFinite(o)&&o>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${o}`)}let s=r===null?null:{max:r,now:Math.min(o,r)};return Dt("div",{className:"cui-progress","data-testid":n,children:[G(x,{as:"p",fg:"fg",type:"body",id:a,children:e}),G("div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":a,"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":`${n}-bar`,children:G("div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:s===null?void 0:{inlineSize:`${s.now/s.max*100}%`},"data-testid":`${n}-fill`})}),G("div",{"aria-hidden":"true",children:G(x,{as:"p",fg:"fg-secondary",type:"body",testId:`${n}-value`,children:t})})]})};import{jsx as Ae,jsxs as Kt}from"react/jsx-runtime";var Ut=403,Ht=({failure:e,onReload:t,forbiddenMessage:o,failureMessage:r,rescueRef:n,testId:a})=>{let{labels:s}=w(),l=e.status===Ut,d=r===void 0?s.loadFailed:r;return Kt("div",{className:"cui-resource-failed","data-testid":a,children:[Ae(_,{occurrence:e.occurrence,testId:`${a}-alert`,children:l?o:d(e.reason)}),l?null:Ae(O,{variant:"secondary",busy:e.retrying,busyLabel:s.loading,onClick:t,ref:n,testId:`${a}-reload`,children:s.reload})]})};import{jsx as U}from"react/jsx-runtime";var Fe=({selected:e,controls:t,onSelect:o,testId:r,dataAttributes:n,ref:a,children:s})=>(m(),U("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":"prose","data-testid":r,onClick:o,ref:a,...E(n),children:s})),Ot=({label:e,items:t,itemKey:o,selectedKey:r,onSelect:n,detailId:a,renderRow:s,rowTestId:l,rowData:d,empty:u,testId:p,ref:i})=>(m(),U("div",{className:"cui-selectable","data-testid":p,ref:i,children:t.length===0?U(x,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:u}):U("ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let y=o(c);return U("li",{children:U(Fe,{selected:y===r,controls:a,onSelect:()=>n(c),testId:l,dataAttributes:d?.(c),children:s(c)})},y)})})}));import{jsx as De}from"react/jsx-runtime";var $t=({gap:e,testId:t,children:o})=>(m(),De("div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:o})),Bt=({gap:e,testId:t,children:o})=>(m(),De("div",{className:"cui-cluster","data-cui-gap":e,"data-testid":t,children:o}));import{Children as qt,Fragment as _t,isValidElement as Gt}from"react";import{jsx as H,jsxs as He}from"react/jsx-runtime";var Vt={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},Wt=({label:e,sublabel:t,value:o,tone:r,testId:n,dataAttributes:a})=>{if(m(),o===null&&r!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${r}`);return He("div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":r,"data-testid":n,...E(a),children:[H("p",{className:"cui-tile-label","data-cui-type":"caption",children:e}),H("p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption",children:t}),H("p",{className:"cui-tile-value","data-cui-fg":Vt[r],"data-cui-type":"heading",children:H(ie,{value:o,testId:`${n}-value`})})]})},Ue=e=>qt.toArray(e).flatMap(t=>{if(!Gt(t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===_t?Ue(t.props.children):[t]}),Zt=({count:e,minInlinePx:t,testId:o,children:r})=>{m();let n=me(e,t,W.space["space-2"]),a=Ue(r).length;if(a!==e)throw new RangeError(`TileGrid has ${a} tiles but count is ${e}`);return He("div",{className:"cui-container","data-testid":o,children:[H(D,{ruleKey:n.key,css:n.css}),H("div",{className:"cui-tile-grid","data-cui-tile-grid":n.key,"data-cui-gap":"space-2",children:r})]})};import{useCallback as zt}from"react";var Yt=229,Xt=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),Jt=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&Xt.has(e.type)&&(e.value!==""||e.validity.badInput),Qt=e=>zt(t=>{t.key!=="Escape"||t.nativeEvent.isComposing||t.keyCode===Yt||Jt(t.target)||(t.stopPropagation(),e())},[e]);import{useCallback as K,useEffect as to,useLayoutEffect as Oe,useRef as ce}from"react";import{useCallback as X,useEffect as jt,useLayoutEffect as eo,useRef as le,useState as de}from"react";var Ke=e=>e===null?Q:j,J=(e,t,o,r,n)=>{let[a,s]=de(()=>({key:e,state:Ke(e)})),[l,d]=de(0),[u,p]=de(0),i=le(t),c=le(null),y=le(l);eo(()=>{i.current=t}),jt(()=>{if(e===null){s({key:null,state:Q});return}let f=new AbortController;c.current=e;let T=l===y.current?"revision":"reload";return y.current=l,s(h=>Object.is(h.key,e)?{key:e,state:r(h.state,T)}:{key:e,state:j}),i.current(f.signal).then(h=>{f.signal.aborted||(c.current=null,s(L=>({key:e,state:n(L.state,h)})))},h=>{f.signal.aborted||s(()=>{throw h})}),()=>{f.abort(),c.current=null}},[e,o,l,u]);let R=X(()=>d(f=>f+1),[]),P=X(()=>p(f=>f+1),[]),N=X((f,T)=>{s(h=>Object.is(h.key,f)?{key:f,state:T(h.state)}:h)},[]),g=X((f,T)=>{N(f,T),Object.is(c.current,f)&&P()},[N,P]);return{state:Object.is(a.key,e)?a.state:Ke(e),reload:R,refresh:P,update:N,write:g}};var oo=(e,t,o)=>{let r=ce(t);Oe(()=>{r.current=t});let n=K(g=>r.current.first(g),[]),{state:a,reload:s,refresh:l,update:d,write:u}=J(e,n,o,ge,Re),p=ce({key:e,state:a});Oe(()=>{p.current={key:e,state:a}});let i=ce(null),c=K(()=>{i.current?.controller.abort(),i.current=null},[]);to(()=>c,[e,o,c]);let y=K(()=>{c(),s()},[c,s]),R=K(()=>{c(),l()},[c,l]),P=K(()=>{let{key:g,state:b}=p.current;if(g===null||b.kind!=="ready"||b.refreshing||b.value.next===null||b.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 f=b.value.next,T={key:g,controller:new AbortController,maps:[]};i.current=T,d(g,be),r.current.next(f,T.controller.signal).then(h=>{i.current===T&&(i.current=null,d(g,L=>T.maps.reduce(($e,Be)=>te($e,Be),Te(L,f,h))))},h=>{i.current===T&&d(g,()=>{throw h})})},[d]),N=K((g,b)=>{let f=i.current;f!==null&&Object.is(f.key,g)&&f.maps.push(b),u(g,T=>te(T,b))},[u]);return{state:a,reload:y,refresh:R,loadMore:P,updateList:N}};import{useCallback as ro}from"react";var ao=(e,t,o)=>{let{state:r,reload:n,refresh:a,write:s}=J(e,t,o,fe,ee),l=ro((d,u)=>s(d,p=>ee(p,{ok:!0,value:u})),[s]);return{state:r,reload:n,refresh:a,put:l}};import{jsx as so}from"react/jsx-runtime";var no=({testId:e,children:t})=>(m(),so("span",{className:"cui-visually-hidden","data-testid":e,children:t}));export{re as ANNOUNCE_SETTLE_MS,_ as AlertMessage,O as Button,po as CONSOLE_UI_LABEL_CATALOGS,vo as CONTRAST_MINIMUM,Co as CONTRAST_PAIRS,at as Card,nt as CardSection,Bt as Cluster,dt as ComparisonGrid,Xe as ConsoleUiRoot,ut as DataTable,yt as Field,ot as Link,Nt as LoadMore,wt as MasterDetail,ie as Measured,Wt as MetricTile,Tt as Notice,St as Pill,Ft as ProgressBar,Rt as RadioGroup,Ht as ResourceFailed,Fe as RowButton,gt as Select,Ot as SelectableList,$t as Stack,W as TOKENS,x as Text,ft as TextArea,mt as TextInput,Zt as TileGrid,no as VisuallyHidden,io as ZonedTimeError,be as beginPage,ge as beginPagedReload,fe as beginReload,go as ceil8,ho as contrastRatio,xo as cssVar,bo as flatMapOutcome,V as formatCount,uo as formatInstant,To as hexToSrgb,ee as keepLastGood,Ro as mapOutcome,te as mapPagedList,yo as masterDetailPlan,fo as monoTextWidthEm,ue as resolveConsoleUiLabels,Re as settleFirstPage,Te as settlePage,ye as tableMinInlinePx,mo as textWidthEm,me as tileGridPlan,lo as toOffsetIso,co as toWallTime,Je as useAnnounce,w as useConsoleUi,Qt as useEscapeToClose,ae as useFocusRescue,oo as usePagedResource,ao as useResource};
1
+ import{A as Te,B as te,C as W,D as Po,a as V,b as io,c as lo,d as co,e as uo,f as qe,g as po,h as yo,i as Q,j,k as ue,l as ee,m as mo,n as fo,o as pe,p as A,q as go,r as ye,s as me,t as Ro,u as bo,v as To,w as fe,x as ge,y as Re,z as be}from"./chunk-YUUKR7HN.js";import{a as ho,b as vo,c as Co,d as xo}from"./chunk-MYMCHY7C.js";import{useId as tt}from"react";import{createContext as _e,useCallback as Ge,useContext as xe,useLayoutEffect as Ve,useMemo as he,useRef as ve}from"react";import{jsx as Ce,jsxs as je}from"react/jsx-runtime";var oe=_e(null),We=" ",Ze='[inert], [aria-hidden="true" i]',Pe="dialog:modal",ze=e=>{if(e.closest(Ze)!==null)return'an ancestor is inert or aria-hidden="true"';let t=e.ownerDocument,o=[...t.querySelectorAll(Pe)],r=t.activeElement,n=o.filter(l=>l.contains(r)),a=n.length>0?n:o,s=a.filter(l=>l.contains(e)).length;return s===a.length?null:s===0?"the topmost open modal dialog does not contain the console":"open modal dialogs both contain and do not contain the console, and focus does not tell which one is topmost"},Ye=e=>{try{e.querySelectorAll(Pe)}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}},re=150,Xe=1e3,Je=({locale:e,formatLocale:t,timeZone:o,testId:r,children:n})=>{if(xe(oe)!==null)throw new Error("ConsoleUiRoot must not be rendered inside another ConsoleUiRoot (a console has exactly one root)");let s=pe(e),[l]=Intl.getCanonicalLocales(t),d=he(()=>new Intl.DateTimeFormat(l,{timeZone:o}).resolvedOptions().timeZone,[l,o]),u=ve(null),p=ve(null);Ve(()=>{Ye(u.current.ownerDocument)},[]);let i=Ge(y=>{if(y.trim()==="")throw new RangeError("announce: text must be a non-empty sentence");let R=()=>{let{texts:N,settle:g,deadline:b}=p.current;p.current=null,clearTimeout(g),clearTimeout(b);let f=u.current;if(f===null)return;let T=N.join(We),h=ze(f);if(h!==null)throw new Error(`announce: the live region is hidden from assistive technology (${h}), so this announcement would be lost: ${T}`);let L=f.ownerDocument.createElement("span");L.textContent=T,f.replaceChildren(L)},P=p.current;if(P===null){p.current={texts:[y],settle:setTimeout(R,re),deadline:setTimeout(R,Xe)};return}P.texts.push(y),clearTimeout(P.settle),P.settle=setTimeout(R,re)},[]),c=he(()=>({locale:e,formatLocale:l,timeZone:d,labels:s,announce:i}),[e,l,d,s,i]);return Ce(oe.Provider,{value:c,children:je("div",{"data-cui-root":"","data-cui-surface":"surface","data-cui-fg":"fg","data-testid":r,children:[n,Ce("div",{className:"cui-visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":`${r}-announcer`,ref:u})]})})},w=()=>{let e=xe(oe);if(e===null)throw new Error("useConsoleUi must be called inside ConsoleUiRoot");return e},m=()=>{w()},Qe=()=>w().announce;var E=e=>{if(e===void 0)return{};for(let t of Object.keys(e))if(!t.startsWith("data-")||t.startsWith("data-cui-")||t==="data-testid")throw new RangeError(`Caller attributes must be data-* and must not override data-cui-* or data-testid: ${t}`);return e};import{jsx as et}from"react/jsx-runtime";var x=({fg:e,type:t,face:o,as:r="span",testId:n,id:a,tabIndex:s,ref:l,children:d})=>(m(),et(r,{className:"cui-text","data-cui-fg":e,"data-cui-type":t,"data-cui-face":o,"data-testid":n,id:a,tabIndex:s,ref:l,children:d}));import{jsx as F,jsxs as at}from"react/jsx-runtime";var ot={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:"prose"}},Ee=({children:e})=>F("span",{children:e}),O=({variant:e,children:t,testId:o,type:r="button",onClick:n,unavailable:a,expanded:s,controls:l,ref:d,dataAttributes:u,busy:p,busyLabel:i})=>{m();let c=tt(),y=p===!0||a!==void 0,R=ot[e],P=N=>{if(y){N.preventDefault();return}n?.(N)};return at("span",{className:"cui-button-group",children:[F("button",{className:"cui-button",type:r==="submit"?"submit":"button","data-cui-variant":e,"data-cui-fg":R.fg,"data-cui-surface":R.surface,"data-cui-type":R.type,"data-testid":o,"aria-disabled":y?!0:void 0,"aria-busy":p===!0?!0:void 0,"aria-describedby":a===void 0?void 0:c,"aria-expanded":s,"aria-controls":l,onClick:P,ref:d,...E(u),children:F(Ee,{children:p===!0?i:t})}),a===void 0?null:F(x,{fg:"fg-muted",type:"body",id:c,testId:`${o}-reason`,children:a.reason})]})},rt=({onNavigate:e,children:t,testId:o,ref:r})=>(m(),F("button",{className:"cui-link",type:"button","data-cui-fg":"info-fg","data-cui-type":"prose","data-testid":o,onClick:e,ref:r,children:F(Ee,{children:t})}));import{useId as Ne}from"react";import{Fragment as it,jsx as k,jsxs as $}from"react/jsx-runtime";var nt=({id:e,title:t,description:o,actions:r,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=Ne();return $("section",{className:"cui-card",id:e,"aria-labelledby":u,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans","data-testid":n,ref:s,...E(l),children:[$("div",{className:"cui-card-header",children:[$("div",{className:"cui-card-heading",children:[k("h2",{className:"cui-card-title",id:u,"data-cui-type":"title",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:k("div",{className:"cui-card-description","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),r===void 0?null:k("div",{className:"cui-card-actions",children:r})]}),d]})},st=({id:e,title:t,subtitle:o,region:r=!1,testId:n,headingRef:a,ref:s,dataAttributes:l,children:d})=>{m();let u=Ne(),p=$(it,{children:[$("div",{className:"cui-card-section-heading",children:[k("h3",{className:"cui-card-section-title",id:u,"data-cui-type":"body",ref:a,tabIndex:a===void 0?void 0:-1,children:t}),o===void 0?null:k("div",{className:"cui-card-section-subtitle","data-cui-fg":"fg-muted","data-cui-type":"body",children:o})]}),d]});return r?k("section",{className:"cui-card-section",id:e,"aria-labelledby":u,"data-testid":n,ref:s,...E(l),children:p}):k("div",{className:"cui-card-section",id:e,"data-testid":n,ref:s,...E(l),children:p})};import{useId as dt}from"react";import{jsx as lt}from"react/jsx-runtime";var D=({ruleKey:e,css:t})=>lt("style",{href:e,precedence:"cui",children:t});import{jsx as C,jsxs as S}from"react/jsx-runtime";var ct=({caption:e,attributes:t,columns:o,attributePx:r,columnMinPx:n,testId:a})=>{m();let s=dt();for(let i of[r,n])if(!(Number.isFinite(i)&&i>0))throw new RangeError(`ComparisonGrid widths must be positive px values: ${i}`);if(o.length===0)throw new RangeError("ComparisonGrid needs at least one column");for(let i of o)for(let c of t)if(!Object.hasOwn(i.cells,c.key))throw new RangeError(`Column "${i.key}" has no value for attribute "${c.key}"`);let l=r+o.length*n,d=`cui-comparison-a${r}-c${n}-n${o.length}`,u=i=>`[data-cui-comparison="${d}"][data-cui-comparison-layout="${i}"]`,p=`${u("table")}{display:none}@container (min-width:${A(l)}){${u("table")}{display:block}${u("stack")}{display:none}}`;return S("div",{className:"cui-container","data-cui-stack-below-px":l,"data-testid":a,children:[C(D,{ruleKey:d,css:p}),C("div",{className:"cui-comparison-frame","data-cui-comparison":d,"data-cui-comparison-layout":"table",children:S("table",{className:"cui-comparison-table","data-cui-type":"prose",children:[C("caption",{className:"cui-visually-hidden",children:e}),S("colgroup",{children:[C("col",{style:{width:A(r)}}),o.map(i=>C("col",{},i.key))]}),C("thead",{children:S("tr",{children:[C("td",{}),o.map(i=>C("th",{scope:"col",children:i.heading},i.key))]})}),C("tbody",{children:t.map(i=>S("tr",{children:[C("th",{scope:"row",children:i.label}),o.map(c=>C("td",{children:c.cells[i.key]("table")},c.key))]},i.key))})]})}),C("div",{className:"cui-comparison-stack","data-cui-comparison":d,"data-cui-comparison-layout":"stack",children:o.map((i,c)=>{let y=`${s}-column-${c}`;return S("div",{className:"cui-comparison-column",role:"group","aria-labelledby":y,"data-cui-type":"prose",children:[C("p",{className:"cui-comparison-heading",id:y,children:i.heading}),C("dl",{className:"cui-comparison-list",children:t.map(R=>S("div",{children:[C("dt",{children:R.label}),C("dd",{children:i.cells[R.key]("stack")})]},R.key))})]},i.key)})})]})};import{useId as ut}from"react";import{jsx as M,jsxs as yt}from"react/jsx-runtime";var pt=({caption:e,captionHidden:t,columns:o,rows:r,rowKey:n,rowTestId:a,rowData:s,rowSize:l,empty:d,testId:u,ref:p})=>{m();let i=ut(),c=me(o);return M("div",{className:"cui-container","data-testid":u,ref:p,children:r.length===0?M(x,{as:"p",fg:"fg-muted",type:"prose",testId:`${u}-empty`,children:d}):M("section",{className:"cui-table-frame",tabIndex:0,"aria-labelledby":i,"data-testid":`${u}-frame`,children:yt("table",{className:"cui-table","data-cui-type":"prose","data-cui-row-size":l,style:{"--cui-table-min":A(c)},children:[M("caption",{className:t?"cui-visually-hidden":"cui-table-caption",id:i,children:e}),M("colgroup",{children:o.map(y=>M("col",{style:y.width.fixedPx===void 0?void 0:{width:A(y.width.fixedPx)}},y.key))}),M("thead",{children:M("tr",{children:o.map(y=>M("th",{scope:"col","data-cui-align":y.align,"data-cui-surface":"subtle","data-cui-type":"caption",children:y.header},y.key))})}),M("tbody",{children:r.map(y=>M("tr",{tabIndex:-1,"data-cui-row-focus":"","data-testid":a,...E(s?.(y)),children:o.map(R=>M("td",{"data-cui-align":R.align,children:R.cell(y)},R.key))},n(y)))})]})})})};import{useId as Z}from"react";import{Fragment as Tt,jsx as v,jsxs as I}from"react/jsx-runtime";var B=({description:e,error:t})=>{m();let o=Z(),r=Z(),n=Z(),a=[e===void 0?null:r,t===void 0?null:n].filter(l=>l!==null).join(" ");return{control:{id:o,"aria-describedby":a===""?void 0:a,"aria-invalid":t===void 0?void 0:!0},descriptionId:r,errorId:n}},q=({description:e,error:t,descriptionId:o,errorId:r,testId:n})=>I(Tt,{children:[e===void 0?null:v(x,{as:"p",fg:"fg-muted",type:"body",id:o,testId:`${n}-description`,children:e}),t===void 0?null:v(x,{as:"p",fg:"danger-fg",type:"body",id:r,testId:`${n}-error`,children:t})]}),mt=({label:e,description:t,error:o,testId:r,children:n})=>{let{control:a,descriptionId:s,errorId:l}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":r,children:[v("label",{className:"cui-field-label",htmlFor:a.id,"data-cui-type":"body",children:e}),n(a),v(q,{description:t,error:o,descriptionId:s,errorId:l,testId:r})]})},ft=({label:e,description:t,error:o,value:r,onValueChange:n,type:a,list:s,required:l,testId:d,ref:u})=>{let{control:p,descriptionId:i,errorId:c}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${d}-field`,children:[v("label",{className:"cui-field-label",htmlFor:p.id,"data-cui-type":"body",children:e}),v("input",{className:"cui-input",type:a,value:r,list:s,required:l,onChange:y=>n(y.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":d,ref:u,...p}),v(q,{description:t,error:o,descriptionId:i,errorId:c,testId:d})]})},gt=({label:e,description:t,error:o,value:r,onValueChange:n,required:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[v("label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),v("textarea",{className:"cui-input cui-textarea",value:r,required:a,onChange:i=>n(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"prose","data-testid":s,ref:l,...d}),v(q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},Rt=({label:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let{control:d,descriptionId:u,errorId:p}=B({label:e,description:t,error:o});return I("div",{className:"cui-field","data-invalid":o!==void 0,"data-testid":`${s}-field`,children:[v("label",{className:"cui-field-label",htmlFor:d.id,"data-cui-type":"body",children:e}),v("select",{className:"cui-input",value:r,onChange:i=>a(i.target.value),"data-cui-fg":"fg","data-cui-surface":"surface","data-cui-type":"body","data-testid":s,ref:l,...d,children:n.map(i=>v("option",{value:i.value,children:i.label},i.value))}),v(q,{description:t,error:o,descriptionId:u,errorId:p,testId:s})]})},bt=({legend:e,description:t,error:o,value:r,options:n,onValueChange:a,testId:s,ref:l})=>{let d=Z(),{control:u,descriptionId:p,errorId:i}=B({label:e,description:t,error:o});return I("fieldset",{className:"cui-radio-group","aria-describedby":u["aria-describedby"],"data-invalid":o!==void 0,"data-testid":s,children:[v("legend",{className:"cui-radio-group-legend","data-cui-type":"body",children:e}),n.map((c,y)=>I("label",{className:"cui-radio","data-cui-type":"body",children:[v("input",{type:"radio",name:d,value:c.value,checked:c.value===r,onChange:()=>a(c.value),"aria-invalid":u["aria-invalid"],"data-testid":`${s}-option-${c.value}`,ref:y===0?l:void 0}),v("span",{children:c.label})]},c.value)),v(q,{description:t,error:o,descriptionId:p,errorId:i,testId:s})]})};import{useCallback as ke,useLayoutEffect as Pt,useRef as z}from"react";import{jsx as Me}from"react/jsx-runtime";var ht=({tone:e,testId:t,children:o})=>(m(),Me("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-testid":t,children:o})),_=({occurrence:e,testId:t,children:o})=>(m(),Me("div",{className:"cui-alert",role:"alert","data-cui-surface":"danger-tint","data-cui-fg":"danger-fg","data-cui-type":"prose","data-cui-occurrence":e,"data-testid":t,children:o},e));import{useCallback as vt,useLayoutEffect as we,useReducer as Ct,useRef as Le}from"react";var xt=e=>e+1,ae=e=>{let t=Le(e),o=Le(null),[,r]=Ct(xt,0),n=vt((a=>()=>{a.contains(document.activeElement)&&(o.current=a,r())}),[]);return we(()=>{t.current=e}),we(()=>{let a=o.current;if(a===null)return;o.current=null;let s=[null,document.body].includes(document.activeElement);a.isConnected||!s||t.current()?.focus()}),n};import{jsx as Y,jsxs as wt}from"react/jsx-runtime";var ne="[data-cui-row-focus]",Et=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 o=[...t.querySelectorAll(ne)];if(o.length!==e.count)throw new Error(`LoadMore: rows.ref holds ${o.length} ${ne} elements for ${e.count} rows`);return o},Nt=(e,t)=>{let o=-1;return e.forEach((r,n)=>{t.has(r)&&(o=n)}),e[o+1]},Mt=({onLoad:e,busy:t,done:o,failure:r,limit:n,rows:a,testId:s})=>{let{formatLocale:l,labels:d}=w(),u=z(null),p=z(null),i=z(null),c=z(!1),y=()=>{let g=a.ref.current;u.current={shown:new Set(g===null?[]:g.querySelectorAll(ne)),failureOccurrence:r===null?null:r.occurrence,busySeen:!1},e()};Pt(()=>{let g=c.current;c.current=!1;let b=u.current;if(b===null)return;let f=Et(a);if(t){b.busySeen=!0,b.shown=new Set(f);return}let T=Nt(f,b.shown),h=r!==null&&r.occurrence!==b.failureOccurrence;if(!(b.busySeen||T!==void 0||h||o)||(u.current=null,h||T===void 0))return;let L=[null,document.body].includes(document.activeElement);(i.current!==null&&document.activeElement===i.current||g&&L)&&T.focus()});let R=ae(()=>o?p.current:i.current),P=ke((g=>{i.current=g;let b=R(g);return()=>{i.current=null,c.current=g===document.activeElement,b()}}),[R]),N=ke((g=>{p.current=g;let b=R(g);return()=>{p.current=null,b()}}),[R]);return o?Y("div",{className:"cui-load-more","data-testid":s,children:Y(x,{as:"p",fg:"fg-muted",type:"body",tabIndex:-1,ref:N,testId:`${s}-end`,children:d.endOfRecords})}):wt("div",{className:"cui-load-more","data-testid":s,children:[Y(O,{variant:"secondary",busy:t,busyLabel:d.loading,onClick:y,ref:P,testId:`${s}-button`,children:d.loadMore(V(n,l))}),r===null?null:Y(_,{occurrence:r.occurrence,testId:`${s}-failure`,children:d.loadFailed(r.reason)})]})};import{jsx as se,jsxs as Se}from"react/jsx-runtime";var Lt=({master:e,detail:t,masterMinPx:o,detailMinPx:r,testId:n})=>{m();let a=ye({masterMinPx:o,detailMinPx:r,gapPx:W.space["space-6"]});return Se("div",{className:"cui-container","data-testid":n,children:[se(D,{ruleKey:a.key,css:a.css}),Se("div",{className:"cui-master-detail","data-cui-master-detail":a.key,children:[se("div",{className:"cui-master-detail-pane","data-testid":`${n}-master`,children:e}),se("div",{className:"cui-master-detail-pane","data-testid":`${n}-detail`,children:t})]})]})};import{jsx as Ie}from"react/jsx-runtime";var ie=({value:e,unit:t,testId:o})=>{let{formatLocale:r,labels:n}=w();if(e===null)return Ie("span",{className:"cui-measured","data-measured":"false","data-testid":o,children:n.unmeasured});let a=V(e,r);return Ie("span",{className:"cui-measured","data-measured":"true","data-testid":o,children:t===void 0?a:`${a} ${t}`})};import{jsx as At}from"react/jsx-runtime";var kt={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"}},St={neutral:"neutral-solid",info:"info-solid",success:"success-solid",warning:"warning-solid",danger:"danger-solid"},It=({tone:e,variant:t,testId:o,dataAttributes:r,children:n})=>{m();let a=t==="tint"?kt[e]:{fg:"on-solid",surface:St[e]};return At("span",{className:"cui-pill","data-cui-tone":e,"data-cui-variant":t,"data-cui-fg":a.fg,"data-cui-surface":a.surface,"data-cui-type":"caption","data-testid":o,...E(r),children:n})};import{useId as Ft}from"react";import{jsx as G,jsxs as Ut}from"react/jsx-runtime";var Dt=({label:e,valueText:t,value:o,max:r,testId:n})=>{m();let a=Ft();if(r!==null){if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Progress maximum must be positive: ${r}`);if(o===null||!(Number.isFinite(o)&&o>=0))throw new RangeError(`A determinate progress value must be a number >= 0: ${o}`)}let s=r===null?null:{max:r,now:Math.min(o,r)};return Ut("div",{className:"cui-progress","data-testid":n,children:[G(x,{as:"p",fg:"fg",type:"body",id:a,children:e}),G("div",{className:"cui-progress-track",role:"progressbar","aria-labelledby":a,"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":`${n}-bar`,children:G("div",{className:"cui-progress-fill","data-cui-accent":"info-accent",style:s===null?void 0:{inlineSize:`${s.now/s.max*100}%`},"data-testid":`${n}-fill`})}),G("div",{"aria-hidden":"true",children:G(x,{as:"p",fg:"fg-secondary",type:"body",testId:`${n}-value`,children:t})})]})};import{jsx as Ae,jsxs as Kt}from"react/jsx-runtime";var Ht=({failure:e,onReload:t,forbiddenMessage:o,failureMessage:r,rescueRef:n,testId:a})=>{let{labels:s}=w();return Kt("div",{className:"cui-resource-failed","data-testid":a,children:[Ae(_,{occurrence:e.occurrence,testId:`${a}-alert`,children:s.failureSentence(e,o,r===void 0?s.loadFailed:r)}),e.status===403?null:Ae(O,{variant:"secondary",busy:e.retrying,busyLabel:s.loading,onClick:t,ref:n,testId:`${a}-reload`,children:s.reload})]})};import{jsx as U}from"react/jsx-runtime";var Fe=({selected:e,controls:t,onSelect:o,testId:r,dataAttributes:n,ref:a,children:s})=>(m(),U("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":"prose","data-testid":r,onClick:o,ref:a,...E(n),children:s})),Ot=({label:e,items:t,itemKey:o,selectedKey:r,onSelect:n,detailId:a,renderRow:s,rowTestId:l,rowData:d,empty:u,testId:p,ref:i})=>(m(),U("div",{className:"cui-selectable","data-testid":p,ref:i,children:t.length===0?U(x,{as:"p",fg:"fg-muted",type:"prose",testId:`${p}-empty`,children:u}):U("ul",{className:"cui-selectable-list",role:"list","aria-label":e,children:t.map(c=>{let y=o(c);return U("li",{children:U(Fe,{selected:y===r,controls:a,onSelect:()=>n(c),testId:l,dataAttributes:d?.(c),children:s(c)})},y)})})}));import{jsx as De}from"react/jsx-runtime";var $t=({gap:e,testId:t,children:o})=>(m(),De("div",{className:"cui-stack","data-cui-gap":e,"data-testid":t,children:o})),Bt=({gap:e,testId:t,children:o})=>(m(),De("div",{className:"cui-cluster","data-cui-gap":e,"data-testid":t,children:o}));import{Children as qt,Fragment as _t,isValidElement as Gt}from"react";import{jsx as H,jsxs as He}from"react/jsx-runtime";var Vt={neutral:"fg",danger:"danger-fg",warning:"warning-fg",success:"success-fg"},Wt=({label:e,sublabel:t,value:o,tone:r,testId:n,dataAttributes:a})=>{if(m(),o===null&&r!=="neutral")throw new RangeError(`An unmeasured tile value carries no tone: ${r}`);return He("div",{className:"cui-tile","data-cui-surface":"subtle","data-cui-fg":"fg","data-cui-tone":r,"data-testid":n,...E(a),children:[H("p",{className:"cui-tile-label","data-cui-type":"caption",children:e}),H("p",{className:"cui-tile-sublabel","data-cui-fg":"fg-muted","data-cui-type":"caption",children:t}),H("p",{className:"cui-tile-value","data-cui-fg":Vt[r],"data-cui-type":"heading",children:H(ie,{value:o,testId:`${n}-value`})})]})},Ue=e=>qt.toArray(e).flatMap(t=>{if(!Gt(t))throw new RangeError(`TileGrid children must be tile elements, not text: ${String(t)}`);return t.type===_t?Ue(t.props.children):[t]}),Zt=({count:e,minInlinePx:t,testId:o,children:r})=>{m();let n=fe(e,t,W.space["space-2"]),a=Ue(r).length;if(a!==e)throw new RangeError(`TileGrid has ${a} tiles but count is ${e}`);return He("div",{className:"cui-container","data-testid":o,children:[H(D,{ruleKey:n.key,css:n.css}),H("div",{className:"cui-tile-grid","data-cui-tile-grid":n.key,"data-cui-gap":"space-2",children:r})]})};import{useCallback as zt}from"react";var Yt=229,Xt=new Set(["text","search","email","url","tel","password","number","date","datetime-local","month","time","week"]),Jt=e=>e instanceof HTMLTextAreaElement?e.value!=="":e instanceof HTMLInputElement&&Xt.has(e.type)&&(e.value!==""||e.validity.badInput),Qt=e=>zt(t=>{t.key!=="Escape"||t.nativeEvent.isComposing||t.keyCode===Yt||Jt(t.target)||(t.stopPropagation(),e())},[e]);import{useCallback as K,useEffect as to,useLayoutEffect as Oe,useRef as ce}from"react";import{useCallback as X,useEffect as jt,useLayoutEffect as eo,useRef as le,useState as de}from"react";var Ke=e=>e===null?Q:j,J=(e,t,o,r,n)=>{let[a,s]=de(()=>({key:e,state:Ke(e)})),[l,d]=de(0),[u,p]=de(0),i=le(t),c=le(null),y=le(l);eo(()=>{i.current=t}),jt(()=>{if(e===null){s({key:null,state:Q});return}let f=new AbortController;c.current=e;let T=l===y.current?"revision":"reload";return y.current=l,s(h=>Object.is(h.key,e)?{key:e,state:r(h.state,T)}:{key:e,state:j}),i.current(f.signal).then(h=>{f.signal.aborted||(c.current=null,s(L=>({key:e,state:n(L.state,h)})))},h=>{f.signal.aborted||s(()=>{throw h})}),()=>{f.abort(),c.current=null}},[e,o,l,u]);let R=X(()=>d(f=>f+1),[]),P=X(()=>p(f=>f+1),[]),N=X((f,T)=>{s(h=>Object.is(h.key,f)?{key:f,state:T(h.state)}:h)},[]),g=X((f,T)=>{N(f,T),Object.is(c.current,f)&&P()},[N,P]);return{state:Object.is(a.key,e)?a.state:Ke(e),reload:R,refresh:P,update:N,write:g}};var oo=(e,t,o)=>{let r=ce(t);Oe(()=>{r.current=t});let n=K(g=>r.current.first(g),[]),{state:a,reload:s,refresh:l,update:d,write:u}=J(e,n,o,ge,Re),p=ce({key:e,state:a});Oe(()=>{p.current={key:e,state:a}});let i=ce(null),c=K(()=>{i.current?.controller.abort(),i.current=null},[]);to(()=>c,[e,o,c]);let y=K(()=>{c(),s()},[c,s]),R=K(()=>{c(),l()},[c,l]),P=K(()=>{let{key:g,state:b}=p.current;if(g===null||b.kind!=="ready"||b.refreshing||b.value.next===null||b.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 f=b.value.next,T={key:g,controller:new AbortController,maps:[]};i.current=T,d(g,be),r.current.next(f,T.controller.signal).then(h=>{i.current===T&&(i.current=null,d(g,L=>T.maps.reduce(($e,Be)=>te($e,Be),Te(L,f,h))))},h=>{i.current===T&&d(g,()=>{throw h})})},[d]),N=K((g,b)=>{let f=i.current;f!==null&&Object.is(f.key,g)&&f.maps.push(b),u(g,T=>te(T,b))},[u]);return{state:a,reload:y,refresh:R,loadMore:P,updateList:N}};import{useCallback as ro}from"react";var ao=(e,t,o)=>{let{state:r,reload:n,refresh:a,write:s}=J(e,t,o,ue,ee),l=ro((d,u)=>s(d,p=>ee(p,{ok:!0,value:u})),[s]);return{state:r,reload:n,refresh:a,put:l}};import{jsx as so}from"react/jsx-runtime";var no=({testId:e,children:t})=>(m(),so("span",{className:"cui-visually-hidden","data-testid":e,children:t}));export{re as ANNOUNCE_SETTLE_MS,_ as AlertMessage,O as Button,fo as CONSOLE_UI_LABEL_CATALOGS,Co as CONTRAST_MINIMUM,xo as CONTRAST_PAIRS,nt as Card,st as CardSection,Bt as Cluster,ct as ComparisonGrid,Je as ConsoleUiRoot,pt as DataTable,mt as Field,qe as HTTP_FORBIDDEN,rt as Link,Mt as LoadMore,Lt as MasterDetail,ie as Measured,Wt as MetricTile,ht as Notice,It as Pill,Dt as ProgressBar,bt as RadioGroup,Ht as ResourceFailed,Fe as RowButton,Rt as Select,Ot as SelectableList,$t as Stack,W as TOKENS,x as Text,gt as TextArea,ft as TextInput,Zt as TileGrid,no as VisuallyHidden,io as ZonedTimeError,be as beginPage,ge as beginPagedReload,ue as beginReload,To as ceil8,vo as contrastRatio,Po as cssVar,yo as flatMapOutcome,V as formatCount,uo as formatInstant,ho as hexToSrgb,ee as keepLastGood,po as mapOutcome,te as mapPagedList,go as masterDetailPlan,bo as monoTextWidthEm,mo as reasonAside,pe as resolveConsoleUiLabels,Re as settleFirstPage,Te as settlePage,me as tableMinInlinePx,Ro as textWidthEm,fe as tileGridPlan,lo as toOffsetIso,co as toWallTime,Qe as useAnnounce,w as useConsoleUi,Qt as useEscapeToClose,ae as useFocusRescue,oo as usePagedResource,ao as useResource};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiquants/console-ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
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"
@@ -91,9 +91,9 @@
91
91
  "build": "tsup && node ../../.config/scripts/strip-dts-comments.mjs dist",
92
92
  "build:watch": "tsup --watch",
93
93
  "dev": "tsup --watch",
94
- "publish:patch": "pnpm run typecheck && pnpm run --if-present test && pnpm version patch --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
95
- "publish:minor": "pnpm run typecheck && pnpm run --if-present test && pnpm version minor --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
96
- "publish:major": "pnpm run typecheck && pnpm run --if-present test && pnpm version major --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
94
+ "publish:patch": "pnpm run typecheck && pnpm run --if-present test && pnpm run build && node ../../.config/scripts/check-publish-leaks.mjs && pnpm version patch --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
95
+ "publish:minor": "pnpm run typecheck && pnpm run --if-present test && pnpm run build && node ../../.config/scripts/check-publish-leaks.mjs && pnpm version minor --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
96
+ "publish:major": "pnpm run typecheck && pnpm run --if-present test && pnpm run build && node ../../.config/scripts/check-publish-leaks.mjs && pnpm version major --no-git-tag-version --no-git-checks && pnpm publish --no-git-checks",
97
97
  "typecheck": "tsc --noEmit",
98
98
  "clean": "rimraf dist",
99
99
  "lint": "biome lint src/",
@@ -1 +0,0 @@
1
- var C=new Map,v=(e,r)=>{if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);let n=C.get(r);return n===void 0&&(n=new Intl.NumberFormat(r,{maximumFractionDigits:0,useGrouping:!0}),C.set(r,n)),n.format(e)};var i=class extends RangeError{reason;constructor(r,n){super(n),this.name="ZonedTimeError",this.reason=r}},_=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,I=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,D=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,k=864e5,p=6e4,y={min:1,max:9999},w=new Map,S=new Map,L=e=>{let r=w.get(e);return r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),w.set(e,r)),r},M=e=>{let r=new Date(0);return r.setUTCFullYear(e.year,e.month-1,e.day),r.setUTCHours(e.hour,e.minute,e.second,0),r.getUTCFullYear()===e.year&&r.getUTCMonth()===e.month-1&&r.getUTCDate()===e.day&&r.getUTCHours()===e.hour&&r.getUTCMinutes()===e.minute&&r.getUTCSeconds()===e.second?r.getTime():null},T=(e,r)=>{let[n,t,o,s,l,a,m]=r;if(m!==void 0&&/[1-9]/.test(m))throw new i("subsecond",`Fractions of a second cannot be kept: ${e}`);let c={year:Number(n),month:Number(t),day:Number(o),hour:Number(s),minute:Number(l),second:a===void 0?0:Number(a)},R=c.year>=y.min?M(c):null;if(R===null)throw new i("malformed",`Not a calendar date and time: ${e}`);return{fields:c,millis:R}},b=(e,r)=>{let n=new Map(L(r).formatToParts(new Date(e)).map(o=>[o.type,o.value])),t={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"||t.year>y.max)throw new i("malformed",`The wall clock falls outside years ${y.min}-${y.max}: ${new Date(e).toISOString()}`);return t},f=(e,r)=>M(b(e,r))-e,d=e=>String(e).padStart(2,"0"),O=(e,r)=>{let n=`${String(e.year).padStart(4,"0")}-${d(e.month)}-${d(e.day)}T${d(e.hour)}:${d(e.minute)}`;return r||e.second!==0?`${n}:${d(e.second)}`:n},U=e=>{if(e%p!==0)throw new i("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let r=Math.abs(e)/p;return`${e<0?"-":"+"}${d(Math.floor(r/60))}:${d(r%60)}`},A=(e,r)=>{let n=_.exec(e);if(n===null)throw new i("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:t,millis:o}=T(e,n.slice(1)),l=[...new Set([f(o-k,r),f(o+k,r)])].filter(a=>f(o-a,r)===a);if(l.length===0)throw new i("nonexistent",`${e} does not exist in ${r}`);if(l.length>1)throw new i("ambiguous",`${e} occurs twice in ${r}`);return`${O(t,!0)}${U(l[0])}`},$=(e,r)=>{let[n,t,o,s]=r;if(n!==void 0)return 0;if(Number(o)>23||Number(s)>59)throw new i("malformed",`Not a valid offset: ${e}`);return(t==="-"?-1:1)*(Number(o)*60+Number(s))*p},W=(e,r)=>{let n=I.exec(e);if(n===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:t}=T(e,n.slice(1,8));return O(b(t-$(e,n.slice(8)),r),!1)},G=(e,r)=>{let n=JSON.stringify([e,r]),t=S.get(n);return t===void 0&&(t=new Intl.DateTimeFormat(e,{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),S.set(n,t)),t},H=(e,r,n)=>{let t=D.exec(e);if(t===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=T(e,[...t.slice(1,7),void 0]),s=o-$(e,t.slice(7));return b(s,n),G(r,n).format(s)};var g={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load (${e}).`,refreshFailed:e=>`Could not refresh (${e}).`,loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F (${e})\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${e})\u3002`,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"}},z=e=>{if(!Object.hasOwn(g,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(g).join(", ")}`);return g[e]};var K=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},u=e=>`${K(e)/16}rem`;var N=(1+Math.sqrt(5))/2,F=({masterMinPx:e,detailMinPx:r,gapPx:n})=>{for(let t of[e,r])if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Pane minimum must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+r},B=(e,r)=>{let n=F(r);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 t=(e-r.gapPx)/(1+N),o=Math.min(Math.max(r.masterMinPx,t),e-r.gapPx-r.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-r.gapPx-o}},ge=e=>{let r=F(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,t=`[data-cui-master-detail="${n}"]`,o=u(e.gapPx),s=`${t}{grid-template-columns:minmax(0,1fr);gap:${o}}`,l=`clamp(${u(e.masterMinPx)},calc((100% - ${o}) / ${1+N}),calc(100% - ${o} - ${u(e.detailMinPx)}))`,a=`@container (min-width:${u(r)}){${t}{grid-template-columns:${l} minmax(0,1fr)}}`;return{key:n,css:s+a}};var P=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},j=e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let r=0,n=null;for(let{width:t}of e){if(t.fixedPx!==void 0){r+=P(t.fixedPx);continue}let o=P(t.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,r+=o}return r};var X=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,E=(e,r)=>{let n=0,t=0;for(let o of e)X(o.codePointAt(0))?t+=1:n+=1;return n*1+t*r},Y=e=>E(e,.55),V=e=>E(e,.6),q=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 J=(e,r,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Tile minimum width must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let t=[];for(let a=1;a<=e;a+=1)e%a===0&&t.push({columns:a,minContainerPx:a*r+(a-1)*n});let o=`cui-tiles-n${e}-m${r}-g${n}`,s=`[data-cui-tile-grid="${o}"]`,l=t.map(({columns:a,minContainerPx:m})=>{let c=`${s}{grid-template-columns:repeat(${a},minmax(0,1fr))}`;return a===1?c:`@container (min-width:${u(m)}){${c}}`});return{key:o,steps:t,css:l.join("")}};var Z=(e,r)=>e.ok?{ok:!0,value:r(e.value)}:e,Q=(e,r)=>e.ok?r(e.value):e,he={kind:"idle"},ee={kind:"loading"},x=(e,r)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?r==="reload"?{...e,retrying:!0}:e:ee,h=(e,r)=>r.ok?{kind:"ready",value:r.value,refreshing:!1,refreshFailure:null}:e.kind==="ready"?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:r.status,reason:r.reason}}:{kind:"failed",status:r.status,reason:r.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var re=(e,r)=>{let n=x(e,r);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},ne=(e,r)=>h(e,r.ok?{ok:!0,value:{rows:r.value.rows,next:r.value.next,meta:r.value.meta,loadingMore:!1,moreFailure:null}}:r),te=e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,oe=(e,r,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,r)))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 t=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:t}}}},ae=(e,r)=>{if(e.kind!=="ready")return e;let{rows:n,meta:t}=r({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:t}}};var ie={space:{"space-1":4,"space-2":8,"space-3":12,"space-4":16,"space-6":24,"space-8":32,"space-12":48},type:{caption:{size:11,lineHeight:16},body:{size:13,lineHeight:20},prose:{size:13,lineHeight:24},title:{size:16,lineHeight:24},heading:{size:20,lineHeight:28},display:{size:25,lineHeight:32}},weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},size:{"size-control":32,"size-row":32,"size-row-control":40,"size-target":24},stroke:{"border-width":1,"focus-width":2,"focus-offset":2},color:{fg:"#0f172b","fg-secondary":"#314158","fg-muted":"#45556c","danger-fg":"#9f0712","warning-fg":"#7b3306","success-fg":"#006045","info-fg":"#193cb8","on-solid":"#ffffff",surface:"#ffffff",subtle:"#f8fafc",sunken:"#f1f5f9","danger-tint":"#fef2f2","warning-tint":"#fffbeb","success-tint":"#ecfdf5","info-tint":"#eff6ff","neutral-solid":"#314158","danger-solid":"#9f0712","success-solid":"#006045","info-solid":"#193cb8","warning-solid":"#7b3306","danger-accent":"#e7000b","warning-accent":"#bb4d00","success-accent":"#009966","info-accent":"#155dfc",focus:"#155dfc","border-control":"#62748e","border-subtle":"#e2e8f0"}},se="--cui-",le=e=>`var(${se}${e})`;export{v as a,i as b,A as c,W as d,H as e,g as f,z as g,u as h,B as i,ge as j,j as k,Y as l,V as m,q as n,J as o,Z as p,Q as q,he as r,ee as s,x as t,h as u,re as v,ne as w,te as x,oe as y,ae as z,ie as A,le as B};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var C=new Map,v= exports.a =(e,r)=>{if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);let n=C.get(r);return n===void 0&&(n=new Intl.NumberFormat(r,{maximumFractionDigits:0,useGrouping:!0}),C.set(r,n)),n.format(e)};var i=class extends RangeError{constructor(r,n){super(n),this.name="ZonedTimeError",this.reason=r}},_=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,I=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,D=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,k=864e5,p=6e4,y={min:1,max:9999},w=new Map,S=new Map,L=e=>{let r=w.get(e);return r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),w.set(e,r)),r},M=e=>{let r=new Date(0);return r.setUTCFullYear(e.year,e.month-1,e.day),r.setUTCHours(e.hour,e.minute,e.second,0),r.getUTCFullYear()===e.year&&r.getUTCMonth()===e.month-1&&r.getUTCDate()===e.day&&r.getUTCHours()===e.hour&&r.getUTCMinutes()===e.minute&&r.getUTCSeconds()===e.second?r.getTime():null},T=(e,r)=>{let[n,t,o,s,l,a,m]=r;if(m!==void 0&&/[1-9]/.test(m))throw new i("subsecond",`Fractions of a second cannot be kept: ${e}`);let c={year:Number(n),month:Number(t),day:Number(o),hour:Number(s),minute:Number(l),second:a===void 0?0:Number(a)},R=c.year>=y.min?M(c):null;if(R===null)throw new i("malformed",`Not a calendar date and time: ${e}`);return{fields:c,millis:R}},b=(e,r)=>{let n=new Map(L(r).formatToParts(new Date(e)).map(o=>[o.type,o.value])),t={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"||t.year>y.max)throw new i("malformed",`The wall clock falls outside years ${y.min}-${y.max}: ${new Date(e).toISOString()}`);return t},f=(e,r)=>M(b(e,r))-e,d=e=>String(e).padStart(2,"0"),O=(e,r)=>{let n=`${String(e.year).padStart(4,"0")}-${d(e.month)}-${d(e.day)}T${d(e.hour)}:${d(e.minute)}`;return r||e.second!==0?`${n}:${d(e.second)}`:n},U=e=>{if(e%p!==0)throw new i("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let r=Math.abs(e)/p;return`${e<0?"-":"+"}${d(Math.floor(r/60))}:${d(r%60)}`},A= exports.c =(e,r)=>{let n=_.exec(e);if(n===null)throw new i("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:t,millis:o}=T(e,n.slice(1)),l=[...new Set([f(o-k,r),f(o+k,r)])].filter(a=>f(o-a,r)===a);if(l.length===0)throw new i("nonexistent",`${e} does not exist in ${r}`);if(l.length>1)throw new i("ambiguous",`${e} occurs twice in ${r}`);return`${O(t,!0)}${U(l[0])}`},$=(e,r)=>{let[n,t,o,s]=r;if(n!==void 0)return 0;if(Number(o)>23||Number(s)>59)throw new i("malformed",`Not a valid offset: ${e}`);return(t==="-"?-1:1)*(Number(o)*60+Number(s))*p},W= exports.d =(e,r)=>{let n=I.exec(e);if(n===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:t}=T(e,n.slice(1,8));return O(b(t-$(e,n.slice(8)),r),!1)},G=(e,r)=>{let n=JSON.stringify([e,r]),t=S.get(n);return t===void 0&&(t=new Intl.DateTimeFormat(e,{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),S.set(n,t)),t},H= exports.e =(e,r,n)=>{let t=D.exec(e);if(t===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=T(e,[...t.slice(1,7),void 0]),s=o-$(e,t.slice(7));return b(s,n),G(r,n).format(s)};var g={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load (${e}).`,refreshFailed:e=>`Could not refresh (${e}).`,loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F (${e})\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${e})\u3002`,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"}},z= exports.g =e=>{if(!Object.hasOwn(g,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(g).join(", ")}`);return g[e]};var K=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},u= exports.h =e=>`${K(e)/16}rem`;var N=(1+Math.sqrt(5))/2,F=({masterMinPx:e,detailMinPx:r,gapPx:n})=>{for(let t of[e,r])if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Pane minimum must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+r},B= exports.i =(e,r)=>{let n=F(r);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 t=(e-r.gapPx)/(1+N),o=Math.min(Math.max(r.masterMinPx,t),e-r.gapPx-r.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-r.gapPx-o}},ge= exports.j =e=>{let r=F(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,t=`[data-cui-master-detail="${n}"]`,o=u(e.gapPx),s=`${t}{grid-template-columns:minmax(0,1fr);gap:${o}}`,l=`clamp(${u(e.masterMinPx)},calc((100% - ${o}) / ${1+N}),calc(100% - ${o} - ${u(e.detailMinPx)}))`,a=`@container (min-width:${u(r)}){${t}{grid-template-columns:${l} minmax(0,1fr)}}`;return{key:n,css:s+a}};var P=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},j= exports.k =e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let r=0,n=null;for(let{width:t}of e){if(t.fixedPx!==void 0){r+=P(t.fixedPx);continue}let o=P(t.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,r+=o}return r};var X=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,E=(e,r)=>{let n=0,t=0;for(let o of e)X(o.codePointAt(0))?t+=1:n+=1;return n*1+t*r},Y= exports.l =e=>E(e,.55),V= exports.m =e=>E(e,.6),q= exports.n =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 J=(e,r,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Tile minimum width must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let t=[];for(let a=1;a<=e;a+=1)e%a===0&&t.push({columns:a,minContainerPx:a*r+(a-1)*n});let o=`cui-tiles-n${e}-m${r}-g${n}`,s=`[data-cui-tile-grid="${o}"]`,l=t.map(({columns:a,minContainerPx:m})=>{let c=`${s}{grid-template-columns:repeat(${a},minmax(0,1fr))}`;return a===1?c:`@container (min-width:${u(m)}){${c}}`});return{key:o,steps:t,css:l.join("")}};var Z=(e,r)=>e.ok?{ok:!0,value:r(e.value)}:e,Q= exports.q =(e,r)=>e.ok?r(e.value):e,he= exports.r ={kind:"idle"},ee= exports.s ={kind:"loading"},x= exports.t =(e,r)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?r==="reload"?{...e,retrying:!0}:e:ee,h= exports.u =(e,r)=>r.ok?{kind:"ready",value:r.value,refreshing:!1,refreshFailure:null}:e.kind==="ready"?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:r.status,reason:r.reason}}:{kind:"failed",status:r.status,reason:r.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var re=(e,r)=>{let n=x(e,r);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},ne= exports.w =(e,r)=>h(e,r.ok?{ok:!0,value:{rows:r.value.rows,next:r.value.next,meta:r.value.meta,loadingMore:!1,moreFailure:null}}:r),te= exports.x =e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,oe= exports.y =(e,r,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,r)))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 t=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:t}}}},ae= exports.z =(e,r)=>{if(e.kind!=="ready")return e;let{rows:n,meta:t}=r({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:t}}};var ie={space:{"space-1":4,"space-2":8,"space-3":12,"space-4":16,"space-6":24,"space-8":32,"space-12":48},type:{caption:{size:11,lineHeight:16},body:{size:13,lineHeight:20},prose:{size:13,lineHeight:24},title:{size:16,lineHeight:24},heading:{size:20,lineHeight:28},display:{size:25,lineHeight:32}},weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},size:{"size-control":32,"size-row":32,"size-row-control":40,"size-target":24},stroke:{"border-width":1,"focus-width":2,"focus-offset":2},color:{fg:"#0f172b","fg-secondary":"#314158","fg-muted":"#45556c","danger-fg":"#9f0712","warning-fg":"#7b3306","success-fg":"#006045","info-fg":"#193cb8","on-solid":"#ffffff",surface:"#ffffff",subtle:"#f8fafc",sunken:"#f1f5f9","danger-tint":"#fef2f2","warning-tint":"#fffbeb","success-tint":"#ecfdf5","info-tint":"#eff6ff","neutral-solid":"#314158","danger-solid":"#9f0712","success-solid":"#006045","info-solid":"#193cb8","warning-solid":"#7b3306","danger-accent":"#e7000b","warning-accent":"#bb4d00","success-accent":"#009966","info-accent":"#155dfc",focus:"#155dfc","border-control":"#62748e","border-subtle":"#e2e8f0"}},se="--cui-",le= exports.B =e=>`var(${se}${e})`;exports.a = v; exports.b = i; exports.c = A; exports.d = W; exports.e = H; exports.f = g; exports.g = z; exports.h = u; exports.i = B; exports.j = ge; exports.k = j; exports.l = Y; exports.m = V; exports.n = q; exports.o = J; exports.p = Z; exports.q = Q; exports.r = he; exports.s = ee; exports.t = x; exports.u = h; exports.v = re; exports.w = ne; exports.x = te; exports.y = oe; exports.z = ae; exports.A = ie; exports.B = le;