@adia-ai/web-modules 0.8.35 → 0.8.37

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +3 -3
  3. package/agent-admin/admin-roster/admin-roster.js +1 -1
  4. package/agent-admin/admin-settings/admin-settings.js +1 -1
  5. package/agent-admin/agent-admin/agent-admin.js +1 -1
  6. package/billing/billing-overview/billing-overview.a2ui.json +281 -0
  7. package/billing/billing-overview/billing-overview.class.js +838 -0
  8. package/billing/billing-overview/billing-overview.css +223 -0
  9. package/billing/billing-overview/billing-overview.js +16 -0
  10. package/billing/billing-overview/billing-overview.yaml +441 -0
  11. package/billing/index.js +21 -0
  12. package/billing/invoice-detail/invoice-detail.a2ui.json +276 -0
  13. package/billing/invoice-detail/invoice-detail.class.js +711 -0
  14. package/billing/invoice-detail/invoice-detail.css +305 -0
  15. package/billing/invoice-detail/invoice-detail.js +16 -0
  16. package/billing/invoice-detail/invoice-detail.yaml +411 -0
  17. package/billing/invoice-history/invoice-history.a2ui.json +315 -0
  18. package/billing/invoice-history/invoice-history.class.js +672 -0
  19. package/billing/invoice-history/invoice-history.css +130 -0
  20. package/billing/invoice-history/invoice-history.js +16 -0
  21. package/billing/invoice-history/invoice-history.yaml +398 -0
  22. package/billing/payment-method-form/payment-method-form.a2ui.json +310 -0
  23. package/billing/payment-method-form/payment-method-form.class.js +886 -0
  24. package/billing/payment-method-form/payment-method-form.css +149 -0
  25. package/billing/payment-method-form/payment-method-form.js +16 -0
  26. package/billing/payment-method-form/payment-method-form.yaml +430 -0
  27. package/billing/payment-method-list/payment-method-list.a2ui.json +283 -0
  28. package/billing/payment-method-list/payment-method-list.class.js +705 -0
  29. package/billing/payment-method-list/payment-method-list.css +128 -0
  30. package/billing/payment-method-list/payment-method-list.js +16 -0
  31. package/billing/payment-method-list/payment-method-list.yaml +355 -0
  32. package/billing/plan-picker/plan-picker.a2ui.json +349 -0
  33. package/billing/plan-picker/plan-picker.class.js +635 -0
  34. package/billing/plan-picker/plan-picker.css +227 -0
  35. package/billing/plan-picker/plan-picker.js +16 -0
  36. package/billing/plan-picker/plan-picker.yaml +453 -0
  37. package/chat/README.md +1 -1
  38. package/chat/chat-composer/chat-composer.js +2 -2
  39. package/chat/chat-empty/chat-empty.js +2 -2
  40. package/chat/chat-shell/chat-shell.js +4 -4
  41. package/chat/chat-sidebar/chat-sidebar.js +2 -2
  42. package/chat/chat-surfaces/chat-surfaces.js +2 -2
  43. package/chat/chat-thread/chat-thread.js +2 -2
  44. package/dashboard/dashboard-layout/dashboard-layout.a2ui.json +254 -0
  45. package/dashboard/dashboard-layout/dashboard-layout.css +190 -0
  46. package/dashboard/dashboard-layout/dashboard-layout.js +289 -0
  47. package/dashboard/dashboard-layout/dashboard-layout.yaml +374 -0
  48. package/dashboard/date-range-selector/date-range-selector.a2ui.json +236 -0
  49. package/dashboard/date-range-selector/date-range-selector.css +84 -0
  50. package/dashboard/date-range-selector/date-range-selector.js +686 -0
  51. package/dashboard/date-range-selector/date-range-selector.yaml +358 -0
  52. package/dashboard/index.js +14 -0
  53. package/dist/everything.min.js +1 -1
  54. package/editor/editor-canvas/editor-canvas.js +2 -2
  55. package/editor/editor-shell/editor-shell.js +2 -2
  56. package/editor/editor-sidebar/editor-sidebar.js +2 -2
  57. package/editor/editor-toolbar/editor-toolbar.js +2 -2
  58. package/feedback/confirm-dialog/confirm-dialog.a2ui.json +206 -0
  59. package/feedback/confirm-dialog/confirm-dialog.css +157 -0
  60. package/feedback/confirm-dialog/confirm-dialog.js +383 -0
  61. package/feedback/confirm-dialog/confirm-dialog.yaml +297 -0
  62. package/feedback/index.js +10 -0
  63. package/form/form-popover/form-popover.js +1 -1
  64. package/generative/index.d.ts +1 -1
  65. package/generative/index.js +2 -2
  66. package/onboarding/index.js +1 -0
  67. package/onboarding/onboarding-checklist/onboarding-checklist.a2ui.json +263 -0
  68. package/onboarding/onboarding-checklist/onboarding-checklist.css +157 -0
  69. package/onboarding/onboarding-checklist/onboarding-checklist.js +428 -0
  70. package/onboarding/onboarding-checklist/onboarding-checklist.yaml +236 -0
  71. package/package.json +99 -6
  72. package/runtime/a2ui-root/a2ui-root.js +3 -3
  73. package/runtime/gen-root/gen-root.js +5 -5
  74. package/settings/index.js +12 -0
  75. package/settings/integrations-page/integrations-page.a2ui.json +274 -0
  76. package/settings/integrations-page/integrations-page.css +177 -0
  77. package/settings/integrations-page/integrations-page.d.ts +77 -0
  78. package/settings/integrations-page/integrations-page.js +413 -0
  79. package/settings/integrations-page/integrations-page.yaml +317 -0
  80. package/settings/notification-preferences/notification-preferences.a2ui.json +245 -0
  81. package/settings/notification-preferences/notification-preferences.css +204 -0
  82. package/settings/notification-preferences/notification-preferences.js +622 -0
  83. package/settings/notification-preferences/notification-preferences.yaml +358 -0
  84. package/shell/admin-command/admin-command.js +2 -2
  85. package/shell/admin-shell/admin-shell.js +2 -2
  86. package/shell/admin-sidebar/admin-sidebar.js +2 -2
  87. package/shell/embed-shell/embed-shell.js +3 -3
  88. package/simple/simple-shell/simple-shell.js +1 -1
  89. package/theme/theme-panel/theme-panel.js +2 -2
@@ -0,0 +1,358 @@
1
+ # Edit this file; run `npm run build:components` to regenerate a2ui.json.
2
+ $schema: ../../../../scripts/schemas/component.yaml.schema.json
3
+ name: DateRangeSelector
4
+ tag: date-range-selector-ui
5
+ status: experimental
6
+ component: DateRangeSelector
7
+ category: input
8
+ version: 1
9
+ description: |
10
+ Page-level "current time window" chooser for dashboards. A module-tier
11
+ composite that pairs a preset chip-row (Today / 7d / 30d / 90d / QTD /
12
+ YTD / Custom) with an embedded <date-range-picker-ui> and broadcasts
13
+ the active range to every range-aware panel on the page.
14
+
15
+ One chooser, one event bus, every panel follows. The composite owns
16
+ the range value, resolves preset keys to ISO 8601 from/to pairs, and
17
+ emits a `range-change` CustomEvent on the configured broadcast target
18
+ (default `document`). It also writes `data-range-from` /
19
+ `data-range-to` to that target so CSS-only subscribers can match
20
+ attribute selectors.
21
+
22
+ Use for dashboard toolbars (typically <dashboard-layout-ui slot="toolbar">
23
+ or <admin-page-header slot="action">). For card-local per-panel
24
+ comparison overlays, set [broadcast="self"] so the secondary instance
25
+ scopes to its host.
26
+
27
+ Spec: .claude/docs/specs/implementation-ready/SPEC-019-date-range-selector-global.md.
28
+
29
+ # Per ADR-0027 — primitives that programmatically create other primitives
30
+ # in their connected()/render() do NOT auto-import them. Consumer (or
31
+ # demo shell) must explicitly import each composed primitive.
32
+ composes:
33
+ - date-range-picker-ui
34
+ - segmented-ui
35
+ - segment-ui
36
+ - button-ui
37
+ - text-ui
38
+
39
+ props:
40
+ value:
41
+ description: |
42
+ Active preset key. Drives the chip-row selection and re-resolves
43
+ the from/to range on change. `custom` defers to the embedded
44
+ picker's value (consumer-supplied from/to).
45
+ type: string
46
+ default: '7d'
47
+ enum:
48
+ - today
49
+ - 7d
50
+ - 30d
51
+ - 90d
52
+ - qtd
53
+ - ytd
54
+ - custom
55
+ reflect: true
56
+ dynamic: true
57
+
58
+ from:
59
+ description: |
60
+ Start of the resolved range, ISO-8601 date (YYYY-MM-DD). Read-only
61
+ output — set by the composite when value resolves or when the
62
+ embedded picker commits a custom range. Consumers read this after
63
+ `range-change`.
64
+ type: string
65
+ default: ''
66
+ reflect: true
67
+ dynamic: true
68
+
69
+ to:
70
+ description: |
71
+ End of the resolved range, ISO-8601 date. Same read-only output
72
+ semantics as `from`.
73
+ type: string
74
+ default: ''
75
+ reflect: true
76
+ dynamic: true
77
+
78
+ presets:
79
+ description: |
80
+ Override the preset chip list as a comma-separated subset of the
81
+ `value` enum. Order matters. `custom` is optional but recommended
82
+ as the trailing chip. Unknown keys are ignored at runtime.
83
+ type: string
84
+ default: 'today,7d,30d,90d,qtd,ytd,custom'
85
+
86
+ broadcast:
87
+ description: |
88
+ Broadcast scope. `document` fires `range-change` on
89
+ `document.documentElement` AND writes `data-range-from` /
90
+ `data-range-to` there (page-global). `self` fires on the host and
91
+ writes the same attributes to the host (scoped subscribers).
92
+ `none` suppresses broadcast entirely; only the host-level `change`
93
+ event fires.
94
+ type: string
95
+ default: 'document'
96
+ enum:
97
+ - document
98
+ - self
99
+ - none
100
+ reflect: true
101
+
102
+ aria-label:
103
+ description: |
104
+ Accessible name for the toolbar group (role=group). Defaults to
105
+ "Time period"; override when multiple range selectors sit on the
106
+ same page (e.g., "Primary range" / "Comparison range").
107
+ type: string
108
+ default: 'Time period'
109
+ attribute: aria-label
110
+ reflect: true
111
+
112
+ name:
113
+ description: |
114
+ Form field name (UIFormElement convention). When set, the
115
+ composite participates in form submission — the resolved range
116
+ serializes as a colon-pair "{from}:{to}" via ElementInternals.
117
+ Without it, the composite emits events only.
118
+ type: string
119
+ default: ''
120
+ reflect: true
121
+
122
+ disabled:
123
+ description: |
124
+ Non-interactive; chips and the embedded picker dim and suppress
125
+ pointer-events via the CSS scope.
126
+ type: boolean
127
+ default: false
128
+ reflect: true
129
+
130
+ events:
131
+ range-change:
132
+ description: |
133
+ Fired when the resolved range changes — preset clicked, custom
134
+ range applied, or programmatic setRange(). Fires on the broadcast
135
+ target per [broadcast]. Guaranteed once per resolved range; never
136
+ fires for in-progress picker interactions.
137
+ detail:
138
+ value: string
139
+ from: string
140
+ to: string
141
+ preset: string
142
+
143
+ change:
144
+ description: |
145
+ Alias of range-change, fires on the host element only (UIFormElement
146
+ convention). When [name] is set, the form value is the colon-pair
147
+ "{from}:{to}".
148
+ detail:
149
+ value: string
150
+ from: string
151
+ to: string
152
+
153
+ slots:
154
+ default:
155
+ description: |
156
+ The composite stamps its own chip row + picker; children placed in
157
+ the default slot are ignored. Use prefix/suffix slots for label
158
+ text or auxiliary controls.
159
+
160
+ prefix:
161
+ description: |
162
+ Optional leading content (e.g., a "Period:" caption). Renders
163
+ before the chip row.
164
+
165
+ suffix:
166
+ description: |
167
+ Optional trailing content (e.g., a comparison-mode toggle).
168
+ Renders after the picker.
169
+
170
+ states:
171
+ - name: idle
172
+ description: Default — preset chip selected, custom picker closed.
173
+ - name: custom
174
+ description: Custom preset active; embedded picker is exposed for editing.
175
+ attribute: value
176
+ - name: picker-open
177
+ description: Embedded picker popover is open (reflected from <date-range-picker-ui>).
178
+ attribute: picker-open
179
+ - name: disabled
180
+ description: Non-interactive; chips + picker dimmed; pointer-events suppressed.
181
+ attribute: disabled
182
+
183
+ traits: []
184
+
185
+ tokens:
186
+ --date-range-selector-gap:
187
+ description: Inline gap between prefix slot, chip row, picker, readout, and suffix slot.
188
+ default: var(--a-space-3)
189
+ --date-range-selector-readout-size:
190
+ description: Resolved-range readout font size.
191
+ default: var(--a-font-size-sm)
192
+ --date-range-selector-readout-fg:
193
+ description: Resolved-range readout foreground color.
194
+ default: var(--a-fg-muted)
195
+ --date-range-selector-picker-trigger-py:
196
+ description: Vertical padding on the embedded picker trigger (cascades into the inner button-ui).
197
+ default: var(--a-space-2)
198
+
199
+ requiredIcons:
200
+ - calendar
201
+ - caret-down
202
+
203
+ a2ui:
204
+ rules:
205
+ - rule: |
206
+ DateRangeSelector MUST sit inside a toolbar context — typically a
207
+ Row inside DashboardLayout.slot=toolbar, or directly inside
208
+ AdminPageHeader.slot=action. Do NOT place it as a freestanding
209
+ block primitive at page top-level.
210
+ reason: Toolbar-context placement contract.
211
+ - rule: |
212
+ ONLY ONE DateRangeSelector with broadcast="document" per page.
213
+ Secondary instances on the same page MUST use broadcast="self"
214
+ or broadcast="none". Two document-broadcasters race for the
215
+ data-range-* attributes on <html> and produce flicker.
216
+ reason: One-broadcaster-per-page invariant. Violation logs a console warn.
217
+ - rule: |
218
+ `presets` MUST be a comma-separated subset of the documented value
219
+ enum (today, 7d, 30d, 90d, qtd, ytd, custom). Unknown keys are
220
+ ignored at runtime; the chip-row renders only recognized keys.
221
+ reason: Preset-list shape contract.
222
+ - rule: |
223
+ When value="custom", from/to MUST be ISO-8601 dates supplied
224
+ either declaratively (from + to attributes) or imperatively via
225
+ setRange("custom", from, to). Without a custom from/to, the
226
+ composite falls back to the prior resolved range.
227
+ reason: Custom-range contract.
228
+ - rule: |
229
+ For form participation, set [name]. Without [name], the composite
230
+ emits range-change events only and does NOT participate in form
231
+ submission. With [name], FormData carries the value "{from}:{to}".
232
+ reason: Form participation is opt-in.
233
+
234
+ anti_patterns:
235
+ - description: |
236
+ Two document-broadcasters on the same page. The late mounter wins
237
+ silently for the data-range-* attributes on <html>, and CSS-only
238
+ subscribers see flicker as the attributes are rewritten.
239
+ wrong: |
240
+ <date-range-selector-ui broadcast="document"></date-range-selector-ui>
241
+ <date-range-selector-ui broadcast="document"></date-range-selector-ui>
242
+ right: |
243
+ <date-range-selector-ui broadcast="document"></date-range-selector-ui>
244
+ <date-range-selector-ui broadcast="self"></date-range-selector-ui>
245
+ rule: |
246
+ Pick ONE global broadcaster; route secondary instances via
247
+ broadcast="self" so they emit only on the host.
248
+
249
+ - description: |
250
+ Using DateRangeSelector for single-date selection. The composite
251
+ resolves a range; the picker UI exposes two-pane selection. For
252
+ single-date use <input-ui type="date"> or <calendar-picker-ui>.
253
+ wrong: |
254
+ <date-range-selector-ui value="today"></date-range-selector-ui>
255
+ <!-- The selector still resolves a range (from=today, to=today). -->
256
+ right: |
257
+ <input-ui type="date" name="d"></input-ui>
258
+ rule: |
259
+ Range chooser → DateRangeSelector. Single-date chooser → input-ui
260
+ type=date or calendar-picker-ui.
261
+
262
+ - description: |
263
+ Custom selected with no from/to. The composite falls back to the
264
+ previous resolved range, which may be empty on first mount —
265
+ consumers see mystery behavior.
266
+ wrong: |
267
+ <date-range-selector-ui value="custom"></date-range-selector-ui>
268
+ right: |
269
+ <date-range-selector-ui value="custom" from="2026-05-01" to="2026-05-07"></date-range-selector-ui>
270
+ rule: |
271
+ value="custom" requires either declarative from/to or a follow-on
272
+ setRange("custom", from, to) call before the chooser is meaningful.
273
+
274
+ - description: |
275
+ Unknown preset key. The composite resolves to the default ("7d")
276
+ and the consumer sees an unexpected range.
277
+ wrong: |
278
+ <date-range-selector-ui value="lastQuarter"></date-range-selector-ui>
279
+ right: |
280
+ <date-range-selector-ui value="qtd"></date-range-selector-ui>
281
+ rule: |
282
+ Use documented enum keys only — today, 7d, 30d, 90d, qtd, ytd,
283
+ custom. Quarter-to-date is `qtd`.
284
+
285
+ examples:
286
+ - name: dashboard-toolbar-global
287
+ description: Page-global selector in a dashboard toolbar; charts subscribe to range-change on document.
288
+ a2ui: |
289
+ [
290
+ {
291
+ "id": "dr-global",
292
+ "component": "DateRangeSelector",
293
+ "value": "30d",
294
+ "presets": "today,7d,30d,90d,qtd,ytd,custom",
295
+ "broadcast": "document"
296
+ }
297
+ ]
298
+ - name: scoped-self-broadcast
299
+ description: Card-local secondary picker broadcasting only on the host (no document writes).
300
+ a2ui: |
301
+ [
302
+ {
303
+ "id": "dr-overlay",
304
+ "component": "DateRangeSelector",
305
+ "broadcast": "self",
306
+ "presets": "7d,30d,90d"
307
+ }
308
+ ]
309
+ - name: form-participating
310
+ description: Form-participating selector emitting a colon-pair value on submit.
311
+ a2ui: |
312
+ [
313
+ {
314
+ "id": "dr-form",
315
+ "component": "DateRangeSelector",
316
+ "name": "period",
317
+ "value": "ytd"
318
+ }
319
+ ]
320
+
321
+ keywords:
322
+ - date-range-selector
323
+ - date-range
324
+ - range-selector
325
+ - period-selector
326
+ - time-window
327
+ - dashboard-range
328
+ - period
329
+ - global-range
330
+ - range-bus
331
+ - timeframe
332
+
333
+ synonyms:
334
+ range:
335
+ - period
336
+ - timeframe
337
+ - window
338
+ period:
339
+ - range
340
+ - timeframe
341
+ - reporting-period
342
+ selector:
343
+ - chooser
344
+ - picker
345
+ tags:
346
+ - DateRangeSelector
347
+ - RangeSelector
348
+ - PeriodSelector
349
+ - TimeWindow
350
+
351
+ related:
352
+ - DateRangePicker
353
+ - Segmented
354
+ - Segment
355
+ - Button
356
+ - Text
357
+ - DashboardLayout
358
+ - AdminPageHeader
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @adia-ai/web-modules/dashboard — cluster barrel.
3
+ *
4
+ * Composite dashboard surfaces that compose substrate primitives and
5
+ * pre-stamp the canonical dashboard chrome + broadcast bus contracts.
6
+ *
7
+ * SPEC-018 — dashboard-layout-ui (module-tier dashboard body composite
8
+ * with four named regions: toolbar / kpis / charts / table + optional
9
+ * aside; owns parametric density cascade).
10
+ * SPEC-019 — date-range-selector-ui (page-level time-window chooser
11
+ * with a documented broadcast bus on `document`).
12
+ */
13
+ export { UIDashboardLayout } from './dashboard-layout/dashboard-layout.js';
14
+ export { UIDateRangeSelector } from './date-range-selector/date-range-selector.js';
@@ -41,7 +41,7 @@ var dC=Object.defineProperty;var W=(s,t,e)=>()=>{if(e)throw e[0];try{return s&&(
41
41
  `&&(h++,l=u+1);let c=Math.min(e,l+Math.max(0,a-1));return{from:c,to:Math.min(e,c+1)}}let n=Math.max(0,e);return{from:Math.max(0,n-1),to:n}}var E5,C5,$5,iO,Q5,rO=W(()=>{"use strict";si();Ai();k1();hi();B1();ei();E5=D.theme({"&":{fontFamily:"inherit",fontSize:"inherit",color:"inherit",backgroundColor:"transparent"},".cm-content":{caretColor:"inherit"},".cm-focused":{outline:"none"}}),C5=Pi.define([{tag:[O.comment,O.lineComment,O.blockComment,O.docComment],class:"tok-comment"},{tag:[O.keyword,O.controlKeyword,O.modifier,O.operatorKeyword],class:"tok-keyword"},{tag:[O.string,O.character,O.regexp,O.escape,O.special(O.string)],class:"tok-string"},{tag:[O.number,O.integer,O.float],class:"tok-number"},{tag:[O.bool,O.null,O.atom],class:"tok-boolean"},{tag:[O.operator,O.logicOperator,O.arithmeticOperator,O.compareOperator,O.updateOperator,O.definitionOperator],class:"tok-operator"},{tag:[O.punctuation,O.bracket,O.paren,O.brace,O.squareBracket,O.angleBracket,O.separator],class:"tok-punctuation"},{tag:[O.function(O.variableName),O.function(O.propertyName),O.macroName],class:"tok-function"},{tag:[O.variableName,O.local(O.variableName),O.self],class:"tok-variable"},{tag:[O.typeName,O.className,O.namespace],class:"tok-type"},{tag:[O.propertyName,O.labelName,O.definition(O.variableName)],class:"tok-property"},{tag:[O.tagName,O.heading,O.contentSeparator],class:"tok-tag"},{tag:[O.attributeName,O.attributeValue],class:"tok-attribute"},{tag:[O.url,O.link],class:"tok-url"},{tag:[O.invalid,O.deleted],class:"tok-invalid"}]),$5={json:()=>Promise.resolve().then(()=>(xS(),vS)).then(s=>({extension:s.json()})),html:()=>Promise.resolve().then(()=>(Ng(),Jw)).then(s=>({extension:s.html()})),javascript:()=>Promise.resolve().then(()=>(Tg(),Zw)).then(s=>({extension:s.javascript({jsx:!1,typescript:!1})})),css:()=>Promise.resolve().then(()=>(ig(),GS)).then(s=>({extension:s.css()})),markdown:()=>Promise.resolve().then(()=>(WA(),jA)).then(s=>({extension:s.markdown()})),yaml:()=>Promise.resolve().then(()=>(ak(),ok)).then(s=>({extension:s.yaml()}))},iO=1e4;Q5=Gl(s=>{let t=s.state.doc.toString();if(t.trim()==="")return[];try{return JSON.parse(t),[]}catch(e){let i=e instanceof Error?e.message:String(e),{from:r,to:n}=T5(i,t);return[{from:r,to:n,severity:"error",message:i.replace(/^SyntaxError:\s*/,""),source:"json"}]}})});function kd(s){return Bt.get(s)||null}function rE(s,t){Bt.set(s,t)}var Bt,pO=W(()=>{"use strict";Bt=new Map([["Row","row-ui"],["Column","col-ui"],["List","list-ui"],["ListItem","list-item-ui"],["Grid","grid-ui"],["Stack","stack-ui"],["Block","block-ui"],["Text","text-ui"],["Image","image-ui"],["Icon","icon-ui"],["Divider","divider-ui"],["Badge","badge-ui"],["Avatar","avatar-ui"],["AvatarGroup","avatar-group-ui"],["Progress","progress-ui"],["ProgressRow","progress-row-ui"],["DateRangePicker","date-range-picker-ui"],["DatetimePicker","datetime-picker-ui"],["CalendarGrid","calendar-grid-ui"],["CalendarPicker","calendar-picker-ui"],["Combobox","combobox-ui"],["Skeleton","skeleton-ui"],["Stepper","stepper-ui"],["StepperItem","stepper-item-ui"],["Tour","tour-ui"],["TourStep","tour-step-ui"],["IntegrationCard","integration-card-ui"],["Code","code-ui"],["Stat","stat-ui"],["EmptyState","empty-state-ui"],["Input","input-ui"],["TextField","input-ui"],["TextArea","textarea-ui"],["Field","field-ui"],["CheckBox","check-ui"],["Toggle","switch-ui"],["Switch","switch-ui"],["Slider","slider-ui"],["Range","range-ui"],["Rating","rating-ui"],["ChoicePicker","select-ui"],["Select","select-ui"],["Radio","radio-ui"],["RadioGroup","radio-group-ui"],["DateTimeInput","calendar-picker-ui"],["CalendarPicker","calendar-picker-ui"],["ColorPicker","color-picker-ui"],["Upload","upload-ui"],["OtpInput","otp-input-ui"],["Button","button-ui"],["LoadingIndicator","progress-ui"],["ErrorContainer","card-ui"],["Card","card-ui"],["Tabs","tabs-ui"],["Tab","tab-ui"],["Panel","pane-ui"],["Pane","pane-ui"],["Modal","modal-ui"],["Dialog","modal-ui"],["Drawer","drawer-ui"],["Toast","toast-ui"],["AnchorBar","anchor-bar-ui"],["Popover","popover-ui"],["Accordion","accordion-ui"],["AccordionItem","accordion-item-ui"],["Alert","alert-ui"],["Tooltip","tooltip-ui"],["Menu","menu-ui"],["Section","section"],["Header","header"],["Footer","footer"],["Stream","stream-ui"],["Table","table-ui"],["ColDef","col-def"],["Chart","chart-ui"],["Embed","embed-ui"],["Swiper","swiper-ui"],["Slideshow","swiper-ui"],["Carousel","swiper-ui"],["Breadcrumb","breadcrumb-ui"],["Link","link-ui"],["Anchor","link-ui"],["Hyperlink","link-ui"],["NavLink","link-ui"],["Nav","nav-ui"],["NavGroup","nav-group-ui"],["NavItem","nav-item-ui"],["Noodles","noodles-ui"],["Pagination","pagination-ui"],["SegmentedControl","segmented-ui"],["Segment","segment-ui"],["ToggleGroup","toggle-group-ui"],["Command","command-ui"],["Kbd","kbd-ui"],["Toolbar","toolbar-ui"],["ToolbarGroup","toolbar-group-ui"],["Tag","tag-ui"],["Timeline","timeline-ui"],["TimelineItem","timeline-item-ui"],["button-ui","button-ui"],["card-ui","card-ui"],["text-ui","text-ui"],["input-ui","input-ui"],["text-field-ui","input-ui"],["select-ui","select-ui"],["toggle-ui","switch-ui"],["check-ui","check-ui"],["slider-ui","slider-ui"],["badge-ui","badge-ui"],["avatar-ui","avatar-ui"],["icon-ui","icon-ui"],["image-ui","image-ui"],["divider-ui","divider-ui"],["progress-ui","progress-ui"],["skeleton-ui","skeleton-ui"],["tabs-ui","tabs-ui"],["tab-ui","tab-ui"],["modal-ui","modal-ui"],["dialog-ui","modal-ui"],["drawer-ui","drawer-ui"],["toast-ui","toast-ui"],["popover-ui","popover-ui"],["panel-ui","pane-ui"],["accordion-ui","accordion-ui"],["alert-ui","alert-ui"],["tooltip-ui","tooltip-ui"],["menu-ui","menu-ui"],["table-ui","table-ui"],["chart-ui","chart-ui"],["code-ui","code-ui"],["textarea-ui","textarea-ui"],["radio-ui","radio-ui"],["tag-ui","tag-ui"],["search-ui","search-ui"],["upload-ui","upload-ui"],["breadcrumb-ui","breadcrumb-ui"],["link-ui","link-ui"],["nav-ui","nav-ui"],["noodles-ui","noodles-ui"],["pagination-ui","pagination-ui"],["segmented-control-ui","segmented-ui"],["segment-ui","segment-ui"],["command-ui","command-ui"],["calendar-picker-ui","calendar-picker-ui"],["color-picker-ui","color-picker-ui"],["kbd-ui","kbd-ui"],["toolbar-ui","toolbar-ui"],["otp-input-ui","otp-input-ui"],["embed-ui","embed-ui"],["stream-ui","stream-ui"],["row-ui","row-ui"],["col-ui","col-ui"],["grid-ui","grid-ui"],["stack-ui","stack-ui"],["block-ui","block-ui"],["list-ui","list-ui"],["range-ui","range-ui"],["datetime-ui","calendar-picker-ui"],["timeline-ui","timeline-ui"],["timeline-item-ui","timeline-item-ui"],["avatar-group-ui","avatar-group-ui"],["Keyboard","kbd-ui"],["DatePicker","calendar-picker-ui"],["CommandPalette","command-ui"],["FormContainer","form"],["Sidebar","admin-sidebar"],["Segmented","segmented-ui"],["OTP","otp-input-ui"],["Textarea","textarea-ui"],["RichText","richtext-ui"],["Richtext","richtext-ui"],["DescriptionList","description-list-ui"],["ActionItem","action-item-ui"],["ActionList","action-list-ui"],["Inspector","inspector-ui"],["Heatmap","heatmap-ui"],["ChatThread","chat-thread"],["ChatInput","chat-input-ui"],["OptionCard","option-card-ui"],["Option","option-card-ui"],["AdminCommand","admin-command"],["AdminContent","admin-content"],["AdminPage","admin-page"],["AdminPageBody","admin-page-body"],["AdminPageHeader","admin-page-header"],["AdminScroll","admin-scroll"],["AdminShell","admin-shell"],["AdminSidebar","admin-sidebar"],["AdminStatusbar","admin-statusbar"],["AdminTopbar","admin-topbar"],["ChatComposer","chat-composer"],["ChatEmpty","chat-empty"],["ChatHeader","chat-header"],["ChatShell","chat-shell"],["ChatSidebar","chat-sidebar"],["ChatStatus","chat-status"],["EditorCanvas","editor-canvas"],["EditorCanvasEmpty","editor-canvas-empty"],["EditorShell","editor-shell"],["EditorSidebar","editor-sidebar"],["EditorStatusbar","editor-statusbar"],["EditorToolbar","editor-toolbar"],["GenRoot","gen-root"],["SimpleContent","simple-content"],["SimpleHero","simple-hero"],["SimpleShell","simple-shell"],["ThemePanel","theme-panel"],["AdiaMark","adia-mark-ui"],["AdiaWordmark","adia-wordmark-ui"],["AgentArtifact","agent-artifact-ui"],["AgentFeedbackBar","agent-feedback-bar-ui"],["AgentQuestions","agent-questions-ui"],["AgentReasoning","agent-reasoning-ui"],["AgentSuggestions","agent-suggestions-ui"],["AgentTrace","agent-trace-ui"],["Aside","aside-ui"],["Blockquote","blockquote-ui"],["Canvas","canvas-ui"],["ChartLegend","chart-legend-ui"],["ColorInput","color-input-ui"],["ContextMenu","context-menu-ui"],["DemoToggle","demo-toggle-ui"],["DisplayField","display-field-ui"],["Feed","feed-ui"],["FeedItem","feed-item-ui"],["Fields","fields-ui"],["Frame","frame-ui"],["InlineEdit","inline-edit-ui"],["InlineMessage","inline-message-ui"],["ListWindow","list-window-ui"],["LoadingOverlay","loading-overlay-ui"],["Mark","mark-ui"],["MenuDivider","menu-divider-ui"],["MenuItem","menu-item-ui"],["MenuLabel","menu-label-ui"],["NumberFormat","number-format-ui"],["Page","page-ui"],["PasswordStrength","password-strength-ui"],["PipelineStatus","pipeline-status-ui"],["Preview","preview-ui"],["QRCode","qr-code-ui"],["RelativeTime","relative-time-ui"],["Search","search-ui"],["SkipNav","skip-nav-ui"],["Spinner","spinner-ui"],["StepProgress","step-progress-ui"],["Swatch","swatch-ui"],["TableOfContents","toc-ui"],["TableToolbar","table-toolbar-ui"],["TagsInput","tags-input-ui"],["ThemeProvider","theme-provider"],["TimePicker","time-picker-ui"],["ToggleOption","toggle-option-ui"],["ToggleScheme","toggle-scheme-ui"],["Tree","tree-ui"],["TreeItem","tree-item-ui"],["VisuallyHidden","visually-hidden-ui"],["AdminEntityItem","admin-entity-item"],["AdminRoster","admin-roster-ui"],["AdminSettings","admin-settings-ui"],["AgentAdmin","agent-admin-ui"],["AppShell","embed-shell"],["BillingOverview","billing-overview-ui"],["ConfirmDialog","confirm-dialog-ui"],["DashboardLayout","dashboard-layout-ui"],["DateRangeSelector","date-range-selector-ui"],["FormPopover","form-popover-ui"],["IntegrationsPage","integrations-page-ui"],["InvoiceDetail","invoice-detail-ui"],["InvoiceHistory","invoice-history-ui"],["NotificationPreferences","notification-preferences-ui"],["OnboardingChecklist","onboarding-checklist-ui"],["PaymentMethodForm","payment-method-form-ui"],["PaymentMethodList","payment-method-list-ui"],["PlanPicker","plan-picker-ui"],["chat-thread-ui","chat-thread-ui"],["section-ui","section-ui"],["DescriptionTerm","dt"],["DescriptionDetail","dd"]])});function nE(s,t){if(!t||t==="/")return s;let e=t.replace(/^\//,"").split("/"),i=s;for(let r of e){if(i==null)return;i=i[r]}return i}function aD(s,t,e){if(!t||t==="/")return;let i=t.replace(/^\//,"").split("/"),r=s;for(let n=0;n<i.length-1;n++){let o=i[n];r[o]==null&&(r[o]={}),r=r[o]}r[i[i.length-1]]=e}var Ed,ua,mO=W(()=>{"use strict";Ed={provider:0,controller:1,source:2,action:3,lifecycle:4},ua=class{surfaceId;#t=new Map;#e={};#i={};#s=new Map;#r;#n;constructor(t,e,i){this.surfaceId=t,this.#r=e,this.#n=i}get context(){return{surfaceId:this.surfaceId,getElement:t=>this.#n.get(t)||null,getRootElement:()=>this.#r,getModel:t=>t?nE(this.#e,t):this.#e,setModel:(t,e)=>this.#a(t,e),getDockable:(t,e)=>this.#l(t,e),listDockables:t=>this.#h(t),emit:t=>this.#c(t),getParam:t=>this.#i[t],watchModel:(t,e)=>this.#o(t,e)}}dock(t){this.#t.has(t.id)&&this.undock(t.id);let e=t.dock(this.context);this.#t.set(t.id,{dockable:t,cleanup:typeof e=="function"?e:null})}dockAll(t){let e=[...t].sort((i,r)=>(Ed[i.kind]??9)-(Ed[r.kind]??9));for(let i of e)this.dock(i)}undock(t){let e=this.#t.get(t);e&&(e.cleanup?.(),e.dockable.undock(),this.#t.delete(t))}undockAll(){let t=[...this.#t.entries()].sort((e,i)=>(Ed[i[1].dockable.kind]??9)-(Ed[e[1].dockable.kind]??9));for(let[e]of t)this.undock(e)}undockMany(t){for(let e of t)this.undock(e)}setInitialModel(t){Object.assign(this.#e,t)}setParams(t){Object.assign(this.#i,t)}updateElements(t){this.#n=t}#a(t,e){aD(this.#e,t,e);for(let[i,r]of this.#s)if(t===i||t.startsWith(i+"/"))for(let n of r)n(nE(this.#e,i))}#o(t,e){return this.#s.has(t)||this.#s.set(t,new Set),this.#s.get(t).add(e),()=>{let i=this.#s.get(t);i?.delete(e),i?.size===0&&this.#s.delete(t)}}#l(t,e){let i=this.#t.get(e);return i&&i.dockable.kind===t?i.dockable:null}#h(t){let e=[];for(let{dockable:i}of this.#t.values())(!t||i.kind===t)&&e.push(i);return e}#c(t){let e=t.target?this.#n.get(t.target):this.#r;e&&e.dispatchEvent(new CustomEvent(t.event,{bubbles:!0,detail:t}))}}});var ve,tr=W(()=>{"use strict";ve=class{get kind(){throw new Error("Dockable subclass must define kind")}get id(){throw new Error("Dockable subclass must define id")}dock(t){throw new Error("Dockable subclass must implement dock()")}undock(){}}});var da,gO=W(()=>{"use strict";tr();da=class extends ve{kind="controller";id;type;hostId;config;bind;controller=null;#t;constructor(t,e){super(),this.id=t.id,this.type=t.type,this.hostId=t.host,this.config=t.config||{},this.bind=t.bind||null,this.#t=e}async dock(t){let e=t.getElement(this.hostId);if(!e){console.warn(`ControllerDock: host element "${this.hostId}" not found`);return}let i=await this.#t(this.type);if(!i){console.warn(`ControllerDock: unknown controller type "${this.type}"`);return}this.controller=new i(this.config),this.controller.connect(e);let r=[];if(this.bind)for(let[n,o]of Object.entries(this.bind)){if(this.controller.subscribe){let l=this.controller.subscribe(n,h=>{t.setModel(o,h)});l&&r.push(l)}let a=t.getModel(o);a!==void 0&&this.controller.setState&&this.controller.setState(n,a)}return e.controller=this.controller,()=>{e.controller=null,r.forEach(n=>n())}}undock(){this.controller&&(this.controller.disconnect?.(),this.controller=null)}}});var fa,bO=W(()=>{"use strict";tr();fa=class extends ve{kind="source";id;uri;path;refresh;#t;#e=null;constructor(t,e){super(),this.id=t.id,this.uri=t.uri,this.path=t.path,this.refresh=t.refresh||"once",this.#t=e}dock(t){if(this.#e=t,this.#i(t),this.refresh==="on-focus"){let e=()=>this.#i(t);return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)}if(this.refresh.startsWith("interval:")){let e=parseInt(this.refresh.split(":")[1],10);if(e>0){let i=setInterval(()=>this.#i(t),e);return()=>clearInterval(i)}}if(this.refresh==="stream"){let e=this.#s(t);try{let i=new EventSource(e);return i.onmessage=r=>{try{t.setModel(this.path,JSON.parse(r.data))}catch{}},()=>i.close()}catch{console.warn(`DataSourceDock: stream failed for ${e}`)}}}undock(){this.#e=null}refetch(){this.#e&&this.#i(this.#e)}async#i(t){let e=this.#s(t);try{let i=await this.#t(e,t);i!==void 0&&t.setModel(this.path,i)}catch(i){console.warn(`DataSourceDock: fetch failed for ${e}`,i)}}#s(t){return this.uri.replace(/\{(\w+)\}/g,(e,i)=>t.getParam(i)??t.getModel("/"+i)??"")}}});var Cd,pa,OO=W(()=>{"use strict";tr();Cd={press:"click",submit:"submit",input:"input",change:"change",select:"select",toggle:"change",dismiss:"close",navigate:"click",mount:"connectedCallback",unmount:"disconnectedCallback",focus:"focusin",blur:"focusout",drag:"dragstart",drop:"drop"},pa=class extends ve{kind="action";id;event;handler;config;onSuccess;onError;#t;constructor(t,e){super(),this.event=t.event,this.handler=t.handler,this.config=t.config||{},this.onSuccess=t.onSuccess||null,this.onError=t.onError||null,this.#t=e,this.id=`action:${this.event.event}:${this.event.target||"root"}:${this.handler}`}dock(t){let e=this.event.target?t.getElement(this.event.target):t.getRootElement();if(!e){console.warn(`ActionDock: target "${this.event.target}" not found`);return}let i=Cd[this.event.event]||this.event.event,r=this.#t(this.handler);if(!r){console.warn(`ActionDock: unknown handler "${this.handler}"`);return}let n=async o=>{if(this.event.condition){let a=t.getModel(this.event.condition.path);if("equals"in this.event.condition&&a!==this.event.condition.equals||"notEquals"in this.event.condition&&a===this.event.condition.notEquals||"exists"in this.event.condition&&this.event.condition.exists&&a==null)return}try{let a=await r(this.config,t,o);if(this.onSuccess)for(let l of this.onSuccess){let h=this.#t(l.handler);h&&await h(l.config||{},t,a)}}catch(a){if(this.onError)for(let l of this.onError){let h=this.#t(l.handler);h&&await h(l.config||{},t,a)}else console.error(`ActionDock: handler "${this.handler}" failed`,a)}};if(this.event.debounce>0){let o=n,a;n=(...l)=>{clearTimeout(a),a=setTimeout(()=>o(...l),this.event.debounce)}}if(this.event.throttle>0){let o=n,a=0;n=(...l)=>{let h=Date.now();h-a>=this.event.throttle&&(a=h,o(...l))}}return e.addEventListener(i,n),()=>e.removeEventListener(i,n)}undock(){}}});var ma,yO=W(()=>{"use strict";tr();ma=class extends ve{kind="provider";id;hostId;value;constructor(t){super(),this.id=`provider:${t.name}`,this.hostId=t.host||null,this.value=t.value??null}dock(t){let e=this.hostId?t.getElement(this.hostId):t.getRootElement();if(!e){console.warn(`ProviderDock: host "${this.hostId}" not found`);return}let i=document.createElement("a2ui-provider");return i.setAttribute("name",this.id.replace("provider:","")),i.value=this.value,e.parentNode?.insertBefore(i,e),i.appendChild(e),()=>{i.parentNode&&(i.parentNode.insertBefore(e,i),i.remove())}}undock(){}}});var ga,vO=W(()=>{"use strict";tr();ga=class extends ve{kind="lifecycle";id="lifecycle";onMount;onUnmount;onModelChange;#t;#e=null;constructor(t,e){super(),this.onMount=t.onMount||[],this.onUnmount=t.onUnmount||[],this.onModelChange=t.onModelChange||[],this.#t=e}dock(t){this.#e=t;for(let i of this.onMount)this.#i(i,t);let e=this.onModelChange.map(i=>{let r=()=>this.#i(i,t);if(i.debounce>0){let n=r,o;r=()=>{clearTimeout(o),o=setTimeout(n,i.debounce)}}return t.watchModel(i.path,r)});return()=>e.forEach(i=>i())}undock(){if(this.#e){for(let t of this.onUnmount)this.#i(t,this.#e);this.#e=null}}async#i(t,e){let i=this.#t(t.handler);if(i)try{await i(t.config||{},e)}catch(r){console.warn(`LifecycleDock: ${t.handler} failed`,r)}}}});var oE,xe,er=W(()=>{"use strict";oE=new WeakSet,xe=class s{#t=null;#e=new Set;get host(){return this.#t}connect(t){let e=this.constructor;!oE.has(e)&&e!==s&&(oE.add(e),e.schema||console.warn(`AdiaUI: ${e.name} extends BaseController without static schema`),this.getState===s.prototype.getState&&console.error(`AdiaUI: ${e.schema?.name??e.name} must implement getState()`)),this.#t&&this.#t!==t&&console.warn(`AdiaUI: ${e.schema?.name??e.name} already connected to a different host`),this.#t=t,this.onConnect(t),this.reflect()}disconnect(t){let e=t??this.#t;e&&(this.onDisconnect(e),this.#t=null)}subscribe(t){return this.#e.add(t),()=>this.#e.delete(t)}notify(){this.reflect();for(let t of this.#e)t()}onConnect(t){}onDisconnect(t){}reflect(){}getState(){throw new Error(`${this.constructor.schema?.name??this.constructor.name}: getState() not implemented`)}}});var aE={};Gt(aE,{FormController:()=>xO});var xO,lE=W(()=>{"use strict";er();xO=class extends xe{static schema=Object.freeze({name:"form",state:{values:"object",errors:"object",dirty:"boolean",valid:"boolean"},commands:["set","validate","reset","setInitial"],attributes:["data-form-valid","data-form-invalid","data-form-dirty"]});#t={};#e={};#i={};#s={};constructor(t={}){super(),this.#t={...t},this.#e={...t}}onDisconnect(t){t.removeAttribute("data-form-valid"),t.removeAttribute("data-form-invalid"),t.removeAttribute("data-form-dirty")}getState(){let t=Object.keys(this.#e).some(i=>this.#e[i]!==this.#t[i]),e=Object.keys(this.#i).length===0;return{values:{...this.#e},errors:{...this.#i},dirty:t,valid:e}}reflect(){if(!this.host)return;let{dirty:t,valid:e}=this.getState();e?(this.host.setAttribute("data-form-valid",""),this.host.removeAttribute("data-form-invalid")):(this.host.setAttribute("data-form-invalid",""),this.host.removeAttribute("data-form-valid")),t?this.host.setAttribute("data-form-dirty",""):this.host.removeAttribute("data-form-dirty")}#r(t){let e=this.#s[t];if(!e){delete this.#i[t];return}let i=e(this.#e[t]);i===!0||i==null?delete this.#i[t]:this.#i[t]=typeof i=="string"?i:"Invalid"}commands={set:(t,e)=>{this.#e[t]=e,this.#r(t),this.notify()},validate:(t,e)=>{this.#s[t]=e,this.#r(t),this.notify()},reset:()=>{this.#e={...this.#t},this.#i={};for(let t of Object.keys(this.#s))this.#r(t);this.notify()},setInitial:t=>{this.#t={...t}}}}});var hE={};Gt(hE,{DataStreamController:()=>SO});var SO,cE=W(()=>{"use strict";er();SO=class extends xe{static schema=Object.freeze({name:"data-stream",state:{data:"array",status:"string",error:"string"},commands:["push","pushMany","connect","poll","consume","stop","clear"],attributes:["data-stream-status"]});#t=[];#e;#i="idle";#s=null;#r=null;#n=0;#a=1;#o=null;#l=0;constructor({max:t=100,throttle:e=0,sample:i=1,initial:r=[]}={}){super(),this.#e=t,this.#n=e,this.#a=Math.max(1,Math.round(i)),this.#t=r.slice(-t)}getState(){return{data:this.#t,status:this.#i,error:this.#s}}reflect(){this.host&&this.host.setAttribute("data-stream-status",this.#i)}onDisconnect(){this.commands.stop()}#h(t){this.#l++,!(this.#a>1&&this.#l%this.#a!==0)&&(this.#t.push(t),this.#t.length>this.#e&&(this.#t=this.#t.slice(-this.#e)),this.#d())}#c(t){if(this.#a>1){let e=[];for(let i of t)this.#l++,this.#l%this.#a===0&&e.push(i);this.#t.push(...e)}else this.#t.push(...t);this.#t.length>this.#e&&(this.#t=this.#t.slice(-this.#e)),this.#d()}#d(){if(this.#n<=0){this.notify();return}this.#o===null&&(this.#o=setTimeout(()=>{this.#o=null,this.notify()},this.#n))}#u(t,e=null){this.#i=t,this.#s=e,this.notify()}commands={push:t=>{this.#h(t)},pushMany:t=>{this.#c(t)},connect:(t,e)=>{this.commands.stop(),this.#r=new AbortController,t==="sse"?this.#f(e):t==="ws"?this.#p(e):this.#u("error",`Unknown stream type: ${t}`)},poll:(t,e=2e3)=>{this.commands.stop(),this.#r=new AbortController,this.#m(t,e)},consume:t=>{this.commands.stop(),this.#r=new AbortController,this.#g(t)},stop:()=>{this.#r&&(this.#r.abort(),this.#r=null),this.#o!==null&&(clearTimeout(this.#o),this.#o=null),(this.#i==="streaming"||this.#i==="connecting")&&this.#u("stopped")},clear:()=>{this.#t=[],this.notify()}};#f(t){this.#u("connecting");let e=new EventSource(t),i=this.#r.signal;i.addEventListener("abort",()=>e.close()),e.onopen=()=>this.#u("streaming"),e.onmessage=r=>{try{let n=JSON.parse(r.data);this.#h(n)}catch{}},e.onerror=()=>{i.aborted||(this.#u("error","SSE connection lost"),e.close())}}#p(t){this.#u("connecting");let e=new WebSocket(t),i=this.#r.signal;i.addEventListener("abort",()=>e.close()),e.onopen=()=>this.#u("streaming"),e.onmessage=r=>{try{let n=JSON.parse(r.data);Array.isArray(n)?this.#c(n):this.#h(n)}catch{}},e.onerror=()=>{i.aborted||this.#u("error","WebSocket error")},e.onclose=()=>{i.aborted||this.#u("stopped")}}async#m(t,e){this.#u("streaming");let i=this.#r.signal;for(;!i.aborted;){try{let n=await(await fetch(t,{signal:i})).json();Array.isArray(n)?this.#c(n):this.#h(n)}catch(r){if(i.aborted)break;this.#u("error",r.message);break}await new Promise(r=>setTimeout(r,e))}}async#g(t){this.#u("streaming");let e=this.#r.signal;try{for await(let i of t){if(e.aborted)break;Array.isArray(i)?this.#c(i):this.#h(i)}e.aborted||this.#u("idle")}catch(i){e.aborted||this.#u("error",i.message)}}}});var uE={};Gt(uE,{SelectionController:()=>wO});var wO,dE=W(()=>{"use strict";er();wO=class extends xe{static schema=Object.freeze({name:"selection",state:{selected:"Set",multiple:"boolean"},commands:["select","deselect","toggle","clear","selectAll"],attributes:["data-selection-active","data-selection-selected"]});#t=new Set;#e=!1;constructor({multiple:t=!1,initial:e=[]}={}){super(),this.#e=t;for(let i of e)this.#t.add(String(i))}onConnect(t){t.setAttribute("data-selection-active","")}onDisconnect(t){this.#i(t),t.removeAttribute("data-selection-active")}getState(){return{selected:new Set(this.#t),multiple:this.#e}}reflect(){if(!this.host)return;let t=this.host.querySelectorAll("[data-selection-key]");for(let e of t){let i=e.getAttribute("data-selection-key");this.#t.has(i)?e.setAttribute("data-selection-selected",""):e.removeAttribute("data-selection-selected")}}#i(t){let e=t.querySelectorAll("[data-selection-selected]");for(let i of e)i.removeAttribute("data-selection-selected")}commands={select:t=>{t=String(t),this.#e||this.#t.clear(),this.#t.add(t),this.notify()},deselect:t=>{this.#t.delete(String(t)),this.notify()},toggle:t=>{t=String(t),this.#t.has(t)?this.#t.delete(t):(this.#e||this.#t.clear(),this.#t.add(t)),this.notify()},clear:()=>{this.#t.clear(),this.notify()},selectAll:t=>{if(this.#e){for(let e of t)this.#t.add(String(e));this.notify()}}}}});var fE={};Gt(fE,{ToggleController:()=>AO});var AO,pE=W(()=>{"use strict";er();AO=class extends xe{static schema=Object.freeze({name:"toggle",state:{on:"boolean"},commands:["toggle","set"],attributes:["data-toggle-on"]});#t=!1;constructor(t=!1){super(),this.#t=t}getState(){return{on:this.#t}}onDisconnect(t){t.removeAttribute("data-toggle-on")}reflect(){this.host&&(this.#t?this.host.setAttribute("data-toggle-on",""):this.host.removeAttribute("data-toggle-on"))}commands={toggle:()=>{this.#t=!this.#t,this.notify()},set:t=>{this.#t=!!t,this.notify()}}}});var mE={};Gt(mE,{AccordionController:()=>kO});var kO,gE=W(()=>{"use strict";er();kO=class extends xe{static schema=Object.freeze({name:"accordion",state:{expanded:"Set",multiple:"boolean"},commands:["toggle","expand","collapse","collapseAll","expandAll"],attributes:["data-accordion-expanded"]});#t=new Set;#e=!1;constructor({multiple:t=!1,initial:e=[]}={}){super(),this.#e=t;for(let i of e)this.#t.add(String(i))}onDisconnect(t){let e=t.querySelectorAll("[data-accordion-expanded]");for(let i of e)i.removeAttribute("data-accordion-expanded")}getState(){return{expanded:new Set(this.#t),multiple:this.#e}}reflect(){if(!this.host)return;let t=this.host.querySelectorAll("[data-accordion-key]");for(let e of t){let i=e.getAttribute("data-accordion-key");this.#t.has(i)?e.setAttribute("data-accordion-expanded",""):e.removeAttribute("data-accordion-expanded")}}commands={toggle:t=>{t=String(t),this.#t.has(t)?this.#t.delete(t):(this.#e||this.#t.clear(),this.#t.add(t)),this.notify()},expand:t=>{t=String(t),this.#e||this.#t.clear(),this.#t.add(t),this.notify()},collapse:t=>{this.#t.delete(String(t)),this.notify()},collapseAll:()=>{this.#t.clear(),this.notify()},expandAll:t=>{if(this.#e){for(let e of t)this.#t.add(String(e));this.notify()}}}}});var bE={};Gt(bE,{StateMachineController:()=>EO});var EO,OE=W(()=>{"use strict";er();EO=class extends xe{static schema={name:"state-machine",state:{current:"string",history:"string[]"},commands:["send","transition","reset"],attributes:["data-state"],config:{initial:"string",states:"object"}};#t="";#e="";#i={};#s=[];onConnect(t){let e=this.config||{};this.#e=e.initial||t.dataset?.initial||Object.keys(e.states||{})[0]||"",this.#i=this._validateStates(e.states||{}),this.#t=this.#e,this.#s=this.#t?[this.#t]:[],this.#t&&this._emit("stateEntered",{state:this.#t,initial:!0})}getState(){return{current:this.#t,history:[...this.#s]}}reflect(){this.host&&(this.#t?this.host.setAttribute("data-state",this.#t):this.host.removeAttribute("data-state"))}commands={send:t=>{if(!t||!this.#t)return;let i=(this.#i[this.#t]?.on||{})[t];i&&this._moveTo(i,{event:t})},transition:t=>{!t||!(t in this.#i)||this._moveTo(t,{forced:!0})},reset:()=>{this.#e&&this._moveTo(this.#e,{reset:!0})}};_moveTo(t,e){if(t===this.#t)return;let i=this.#t;i&&this._emit("stateExited",{state:i,target:t,...e}),this.#t=t,this.#s.push(t),this.notify(),this._emit("stateEntered",{state:t,from:i,...e})}_emit(t,e){this.host&&this.host.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e}))}_validateStates(t){let e={},i=Object.keys(t);for(let r of i){let n=t[r]||{},o={};for(let[a,l]of Object.entries(n.on||{})){if(typeof l!="string"||!(l in t)){console.warn(`[state-machine] state "${r}" transition "${a}" \u2192 "${l}" \u2014 target not declared`);continue}o[a]=l}e[r]={on:o}}return e}}});function yE(s,t){Xi.controllers.set(s,t)}function vE(s,t){Xi.handlers.set(s,t)}function xE(s,t){Xi.resolvers.set(s,t)}async function $d(s){let t=Xi.controllers.get(s);return t?t():null}function Pd(s){return Xi.handlers.get(s)||null}async function eh(s,t={}){let e=s;for(let[o,a]of Object.entries(t))e=e.replace(`{${o}}`,encodeURIComponent(a));let i=e.indexOf("://");if(i===-1)throw new Error(`Invalid URI: ${s}`);let r=e.slice(0,i),n=Xi.resolvers.get(r);if(!n)throw new Error(`No resolver for scheme "${r}"`);return n(e,t)}async function lD(s){let{action:t,params:e}=s,i=CO(t.body,s),r=t.uri;for(let[c,u]of Object.entries(e))r=r.replace(`{${c}}`,encodeURIComponent(u));let n=r.indexOf("://"),o=n>-1?r.slice(0,n):"api",a=Xi.resolvers.get(o),l=r.replace(/^\w+:\/\//,"/api/"),h=await fetch(l,{method:t.method||"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!h.ok){let c=await h.text().catch(()=>"Request failed");throw new Error(c)}return h.json().catch(()=>({}))}async function hD(s){let{action:t}=s,e=CO(t.value,s);s.updateModel(t.path,e)}async function cD(s){let{action:t,params:e}=s,i=t.navigate||t.path||"";for(let[r,n]of Object.entries(e))i=i.replace(`{${r}}`,encodeURIComponent(n));i==="back"?history.back():i&&(location.hash=i)}async function uD(){history.back()}async function dD(s){let{action:t,controllers:e}=s,i=e[t.controllerId];if(!i?.commands?.[t.command]){console.warn(`Wiring: controller "${t.controllerId}" or command "${t.command}" not found`);return}return i.commands[t.command](t.args)}async function fD(s){let{action:t,source:e}=s,i=CO(t.detail,s);e.dispatchEvent(new CustomEvent(t.eventName||t.event,{bubbles:!0,detail:i}))}async function pD(s){let t=s.action.sourceId;return document.dispatchEvent(new CustomEvent("a2ui-refresh-source",{detail:{sourceId:t}})),{refreshSource:t}}async function mD(s){let{action:t}=s,e=typeof t=="string"?t:t.message||t.notify;document.dispatchEvent(new CustomEvent("a2ui-notify",{bubbles:!0,detail:{message:e,variant:t.variant||"info"}}))}function CO(s,t){if(s){if(typeof s!="object")return s;switch(s.from){case"event-detail":return s.key?t.event?.detail?.[s.key]:t.event?.detail;case"event-target":return s.key?t.source?.[s.key]:t.source?.value;case"model":return gD(t.dataModel,s.path);case"literal":return s.value;case"param":return t.params?.[s.key];default:return s}}}function gD(s,t){if(!t||!s)return;let e=t.split("/").filter(Boolean),i=s;for(let r of e){if(i==null||typeof i!="object")return;i=i[r]}return i}async function bD(s,t){let e=s.replace(/^resource:\/\//,"/api/"),i=await fetch(e);if(!i.ok)throw new Error(`Resource fetch failed: ${i.status}`);return i.json()}async function OD(s,t){let e=s.replace(/^api:\/\//,"https://"),i=await fetch(e);if(!i.ok)throw new Error(`API fetch failed: ${i.status}`);return i.json()}async function yD(s,t){return{_source:s,_mock:!0}}var Xi,$O=W(()=>{"use strict";Xi={controllers:new Map([["FormController",async()=>(await Promise.resolve().then(()=>(lE(),aE))).FormController],["DataStreamController",async()=>(await Promise.resolve().then(()=>(cE(),hE))).DataStreamController],["SelectionController",async()=>(await Promise.resolve().then(()=>(dE(),uE))).SelectionController],["ToggleController",async()=>(await Promise.resolve().then(()=>(pE(),fE))).ToggleController],["AccordionController",async()=>(await Promise.resolve().then(()=>(gE(),mE))).AccordionController],["StateMachineController",async()=>(await Promise.resolve().then(()=>(OE(),bE))).StateMachineController]]),handlers:new Map([["submit-resource",lD],["update-model",hD],["navigate",cD],["navigate-back",uD],["controller-command",dD],["emit-event",fD],["refresh-source",pD],["notify",mD]]),resolvers:new Map([["resource",bD],["api",OD],["mock",yD]])}});function vD(s){return async(t,e,i)=>{let r={action:t,event:i instanceof Event?i:null,source:i instanceof Event?i.target:null,dataModel:e.getModel(),updateModel:(n,o)=>e.setModel(n,o),controllers:Object.fromEntries(e.listDockables("controller").map(n=>[n.id,n.controller])),params:{},resolveData:eh};return s(r)}}function xD(){let s=new Map;return t=>{if(s.has(t))return s.get(t);let e=Pd(t);if(!e)return null;let i=vD(e);return s.set(t,i),i}}function SD(){return async s=>$d(s)}function wD(){return async(s,t)=>eh(s,{})}function Qd(s){let t=[],e=xD(),i=SD(),r=wD();if(s.data?.sources)for(let o of s.data.sources)t.push(new fa(o,r));if(s.state?.controllers)for(let o of s.state.controllers)t.push(new da(o,i));if(s.actions)for(let o of s.actions)t.push(new pa(o,e));if(s.provides){let o=Array.isArray(s.provides)?s.provides:[s.provides];for(let a of o)t.push(new ma(a))}s.lifecycle&&t.push(new ga(s.lifecycle,e));let n=s.state?.model||null;return{dockables:t,initialModel:n}}var PO=W(()=>{"use strict";gO();bO();OO();yO();vO();$O()});var SE={};Gt(SE,{WiringEngine:()=>ih});var ih,QO=W(()=>{"use strict";mO();PO();ih=class{#t=new Map;#e;#i;constructor({updateDataModel:t,getElement:e}){this.#e=t,this.#i=e}async process(t){let{surfaceId:e}=t;if(!e)return;let i=this.#t.get(e);i||(i=this.#s(e),this.#t.set(e,i));try{t.data?.params&&i.setParams(this.#r(t.data.params));let{dockables:r,initialModel:n}=Qd(t);n&&i.setInitialModel(n),t.undock&&i.undockMany(t.undock);for(let o of r)await i.dock(o)}catch(r){console.warn(`Wiring: error processing wireComponents for "${e}":`,r.message)}}teardown(t){let e=this.#t.get(t);e&&(e.undockAll(),this.#t.delete(t))}teardownAll(){for(let t of this.#t.keys())this.teardown(t)}getSurface(t){return this.#t.get(t)||null}getSurfaceState(t){let e=this.#t.get(t);if(!e)return null;let i=e.context.listDockables();return{surfaceId:t,controllerCount:i.filter(r=>r.kind==="controller").length,sourceCount:i.filter(r=>r.kind==="source").length,actionCount:i.filter(r=>r.kind==="action").length,providerCount:i.filter(r=>r.kind==="provider").length,hasLifecycle:i.some(r=>r.kind==="lifecycle"),totalDocked:i.length}}#s(t){let e={get:h=>this.#i(t,h),has:h=>!!this.#i(t,h)},i=this.#i(t,"root")||document.createElement("div"),r=new Proxy(new Map,{get(h,c){return c==="get"?u=>e.get(u):c==="has"?u=>e.has(u):h[c]}}),n=new ua(t,i,r),o=n.context,a=o.setModel,l=this.#e;return Object.defineProperty(n,"context",{get(){return{...o,setModel(c,u){a(c,u),l(t,c,u)}}}}),n}#r(t){let e={};for(let[i,r]of Object.entries(t))switch(r.from){case"route":{let o=location.hash.slice(1).match(new RegExp(`${r.key}/([^/]+)`));o&&(e[i]=o[1]);break}case"query":{let o=new URL(location.href).searchParams.get(r.key);o&&(e[i]=o);break}case"literal":e[i]=r.value;break;default:typeof r=="string"&&(e[i]=r)}return e}}});function ls(s){return ED.has(s.toLowerCase())?s.toLowerCase():s.replace(/([A-Z])/g,"-$1").toLowerCase()}function Td(s,t,e){if(t==="style"&&typeof e=="string"){s.style.cssText=e;return}if(AD.has(t)&&e!=null){if(t==="textContent"&&!kD.has(s.localName)){s.setAttribute("text",String(e));return}let i=e;if(typeof i=="string"&&(i.startsWith("[")||i.startsWith("{")))try{i=JSON.parse(i)}catch{}s[t]=i;return}if(typeof e=="boolean"){e?s.setAttribute(ls(t),""):s.removeAttribute(ls(t));return}e!=null?s.setAttribute(ls(t),String(e)):s.removeAttribute(ls(t))}var AD,kD,ED,TO=W(()=>{"use strict";AD=new Set(["data","columns","options","itemRenderer","textContent"]),kD=new Set(["h1","h2","h3","h4","h5","h6","p","small","span","em","strong","code","text-ui","kbd-ui"]),ED=new Set(["autocomplete","autofocus","autocapitalize","autocorrect","inputmode","enterkeyhint","spellcheck","maxlength","minlength","readonly","novalidate","formnovalidate","formaction","formenctype","formmethod","formtarget","multiple","pattern","placeholder","required","tabindex","accesskey","autoplay","autopictureinpicture","controls","crossorigin","disablepictureinpicture","disableremoteplayback","loop","muted","playsinline","preload","srcset","srcdoc","srclang","sizes","loading","decoding","fetchpriority","ismap","usemap","hreflang","referrerpolicy","download","contenteditable","contextmenu","draggable","dirname","colspan","rowspan","headers","allowfullscreen","allowpaymentrequest","itemid","itemprop","itemref","itemscope","itemtype","nomodule","nonce"])});var hs,wE=W(()=>{"use strict";pO();TO();hs=class s{#t;#e;#i=new Map;#s=new Map;#r=new Map;#n=[];#a=null;#o=!1;constructor(t,e=Bt,{batch:i=!1}={}){this.#t=t,this.#e=e,this.#o=i}process(t){t&&(this.#o?(this.#n.push(t),this.#a===null&&(this.#a=requestAnimationFrame(()=>this.#l()))):this.#h(t))}#l(){this.#a=null;let t=this.#n.splice(0);for(let e of t)this.#h(e)}#h(t){switch(t.type||t.messageType){case"createSurface":this.#u(t);break;case"updateComponents":this.#f(t);break;case"updateDataModel":this.#A(t);break;case"wireComponents":this.#d(t);break;case"deleteSurface":this.#k(t);break;case"updateStyles":this.#C(t);break;case"removeStyles":this.#T(t);break;case"meta":break;default:console.warn("A2UI: unknown message type",t.type)}}#c=null;async#d(t){if(!this.#c){let{WiringEngine:e}=await Promise.resolve().then(()=>(QO(),SE));this.#c=new e({updateDataModel:(i,r,n)=>{this.#A({surfaceId:i,path:r,value:n})},getElement:(i,r)=>this.#i.get(i)?.elements.get(r)||null})}await this.#c.process(t)}async processStream(t){for await(let e of t)this.process(e)}#u({surfaceId:t,catalogId:e,root:i}){if(this.#i.has(t))return;let r=document.createElement("div");r.setAttribute("data-a2ui-surface",t),e&&r.setAttribute("data-catalog",e),this.#t.appendChild(r),this.#i.set(t,{root:r,rootId:typeof i=="string"&&i?i:"root",elements:new Map,dataModel:{},bindings:new Map,adoptedSheets:new Map})}#f({surfaceId:t,components:e}){let i=this.#i.get(t);i||(i={root:this.#t,rootId:"root",elements:new Map,dataModel:{},bindings:new Map,adoptedSheets:new Map},this.#i.set(t,i),this.#t&&typeof this.#t.setAttribute=="function"&&this.#t.setAttribute("data-a2ui-surface",t));for(let l of e)if(!(!l.id&&l.id!==0)){if(l.component==="ContextBindings"){i.contextBindings=l;continue}try{let h=i.elements.get(l.id),c=l.component==="Text"?this.#S(l.variant,l):kd(l.component,this.#e);if(!c){h||(h=document.createElement("div"),h.setAttribute("data-a2ui-id",l.id),h.id=l.id,h.setAttribute("data-a2ui-unknown",l.component),h.textContent=`[unknown: ${l.component}]`,i.elements.set(l.id,h),this.#s.set(l.id,h));continue}if(!h)h=document.createElement(c),h.setAttribute("data-a2ui-id",l.id),h.id=l.id,i.elements.set(l.id,h),this.#s.set(l.id,h);else if(h.localName!==c){let d=document.createElement(c);d.setAttribute("data-a2ui-id",l.id),d.id=l.id,h.replaceWith(d),h=d,i.elements.set(l.id,h),this.#s.set(l.id,h)}l._surfaceId=t,Object.values(l).some(d=>d&&typeof d=="object"&&d.path)&&i.bindings.set(l.id,l),this.#v(h,l)}catch(h){console.warn(`A2UI: component "${l.id}" (${l.component}) failed:`,h.message)}}this.#b(e);let r=new Map;for(let l of e){for(let h of Array.isArray(l.children)?l.children:[])r.set(h,l.id);l.child&&r.set(l.child,l.id)}let n=(l,h)=>{let c=new Set,u=l;for(;u!=null;){if(u===h||c.has(u))return!0;c.add(u),u=r.get(u)}return!1};for(let l of e){let h=i.elements.get(l.id);if(h)try{let c=Array.isArray(l.children)?l.children:[];for(let u of c){if(u===l.id||n(l.id,u))continue;let d=i.elements.get(u);d&&d.parentElement!==h&&h.appendChild(d)}if(l.child&&l.child!==l.id&&!n(l.id,l.child)){let u=i.elements.get(l.child);u&&u.parentElement!==h&&h.appendChild(u)}}catch(c){console.warn(`A2UI: tree build failed for "${l.id}":`,c.message)}}let o=i.rootId??"root";if(e.find(l=>l.id===o)){let l=i.elements.get(o);l&&l.parentElement!==i.root&&i.root.appendChild(l)}}static#p=new Set(["Header","Section","Footer","Img","Image","Video","Picture","Iframe","Aside","Divider"]);static#m=new Set(["Header","Section","Footer"]);static#g=new Set(["header","body","footer"]);#y=new Set;#b(t){let e=new Map;for(let i of t)i.id!=null&&e.set(i.id,i);for(let i of t){let r=i.component==="Card"||i.component==="ErrorContainer",n=i.component==="Drawer";if(!r&&!n)continue;let o=n?s.#m:s.#p,a=n?"<drawer-ui>":"<card-ui>",l=Array.isArray(i.children)?i.children:[];for(let h of l){let c=e.get(h);if(!c||typeof c.slot=="string"&&s.#g.has(c.slot)||o.has(c.component))continue;let u=`${i.id}::${h}::${c.component}`;this.#y.has(u)||(this.#y.add(u),console.warn(`A2UI: ${a} (id="${i.id}") body must wrap "${c.component}" (id="${h}") in <Section>. Direct flow children bypass the canonical body slot and lose --card-inset margin. Canonical children: ${[...o].join(", ")}`+(n?', or slot="header|body|footer".':".")))}}}static#O={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",body:"p",caption:"small"};#S(t,e){return!e?.slot&&s.#O[t]?s.#O[t]:"text-ui"}#v(t,e){let i=new Set(["id","component","children","child","_surfaceId"]);e.component==="Text"&&e.variant&&!e.slot&&s.#O[e.variant]&&i.add("variant");let r=this.#r.get(e.id),n={};for(let[o,a]of Object.entries(e)){if(i.has(o))continue;let l=a&&typeof a=="object"&&a.path,h=this.#x(a,e._surfaceId);n[o]=h,!(r&&Object.is(r[o],h))&&(h==null&&!l||Td(t,o,h))}if(r)for(let o of Object.keys(r))!(o in n)&&!i.has(o)&&t.removeAttribute(ls(o));this.#r.set(e.id,n)}#x(t,e){if(t==null)return null;if(typeof t!="object")return t;if(t.path){let i=e?this.#i.get(e):null;return i?this.#w(i.dataModel,t.path):t.path}return t}#w(t,e){return!e||e==="/"?t:e.split("/").filter(Boolean).reduce((i,r)=>i?.[r],t)}#A({surfaceId:t,path:e,value:i}){let r=this.#i.get(t);if(r){if(!e||e==="/")r.dataModel=i??{};else{let n=e.split("/").filter(Boolean),o=r.dataModel;for(let a=0;a<n.length-1;a++)o[n[a]]==null&&(o[n[a]]={}),o=o[n[a]];o[n[n.length-1]]=i}for(let[n,o]of r.bindings){let a=r.elements.get(n);a&&this.#v(a,o)}}}#k({surfaceId:t}){let e=this.#i.get(t);if(e){this.#c?.teardown(t);for(let[i]of e.elements)this.#s.delete(i);if(e.adoptedSheets&&e.adoptedSheets.size>0){let i=new Set;for(let r of e.adoptedSheets.values())i.add(r.sheet);document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>!i.has(r)),e.adoptedSheets.clear()}e.root.remove(),this.#i.delete(t)}}static#E=new Set(["root","html","body"]);#C({surfaceId:t,styleId:e,css:i}){if(typeof e!="string"||e.length===0){this.#Q(null,"styles-rejected",{surfaceId:t,styleId:e,reason:"invalid-payload: styleId must be a non-empty string"});return}if(typeof i!="string"){this.#Q(null,"styles-rejected",{surfaceId:t,styleId:e,reason:"invalid-payload: css must be a string"});return}let r=this.#i.get(t);if(!r){this.#Q(null,"styles-rejected",{surfaceId:t,styleId:e,reason:"no-such-surface"});return}let n=this.#L(i,t);if(n.rejected){this.#Q(r.root,"styles-rejected",{surfaceId:t,styleId:e,reason:n.reason});return}let o=r.adoptedSheets.get(e);o&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(a=>a!==o.sheet)),document.adoptedStyleSheets=[...document.adoptedStyleSheets,n.sheet],r.adoptedSheets.set(e,{sheet:n.sheet,ruleCount:n.sheet.cssRules.length,appliedAt:typeof performance<"u"?performance.now():Date.now()}),this.#Q(r.root,"styles-applied",{surfaceId:t,styleId:e,ruleCount:n.sheet.cssRules.length,validationWarnings:n.warnings})}#T({surfaceId:t,styleId:e}){let i=this.#i.get(t);if(!i)return;let r=i.adoptedSheets.get(e);r&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(n=>n!==r.sheet),i.adoptedSheets.delete(e),this.#Q(i.root,"styles-removed",{surfaceId:t,styleId:e}))}#L(t,e){let i=[];if(/^\s*@import\b/im.test(t))return{rejected:!0,reason:"forbidden-import"};if(/^\s*@charset\b/im.test(t))return{rejected:!0,reason:"forbidden-charset"};let r=new CSSStyleSheet;try{r.replaceSync(t)}catch(l){return{rejected:!0,reason:"parse-error: "+(l?.message||String(l))}}for(let l of r.cssRules){let h=this.#$(l);if(h)return{rejected:!0,reason:h}}if(/url\s*\(\s*["']?\s*(?:https?:|\/\/)/i.test(t))return{rejected:!0,reason:"external-url"};for(let l of r.cssRules)if(l.constructor?.name==="CSSPropertyRule"||l.cssText?.startsWith("@property")){let h=l.cssText.match(/@property\s+(--[\w-]+)/);h&&i.push({kind:"property-registered-globally",name:h[1]})}let n=this.#M(r,e),o=this.#R(r,e),a=new CSSStyleSheet;try{a.replaceSync(o)}catch(l){return{rejected:!0,reason:"scope-wrap-failed: "+(l?.message||String(l))}}return n.length>0&&i.push({kind:"animations-namespaced",count:n.length}),{rejected:!1,sheet:a,warnings:i}}#$(t){let e=t.cssText||"";if(/^@import\b/i.test(e))return"forbidden-import";if(/^@charset\b/i.test(e))return"forbidden-charset";if(/^@scope\b/i.test(e))return"forbidden-scope-directive";if(t.selectorText){let i=this.#I(t.selectorText);for(let r of i){let n=r.trim().replace(/^:scope\s*/,"");if(n.startsWith(":root"))return"forbidden-root-selector";let o=n.match(/^([a-zA-Z*][\w-]*)/);if(!o)continue;let a=o[1].toLowerCase();if(s.#E.has(a))return`forbidden-${a}-selector`}}return null}#I(t){let e=[],i=0,r=0;for(let n=0;n<t.length;n++){let o=t[n];o==="("?i++:o===")"?i--:o===","&&i===0&&(e.push(t.slice(r,n)),r=n+1)}return e.push(t.slice(r)),e}#M(t,e){let i=[],r=String(e).replace(/[^a-zA-Z0-9_-]/g,"_");for(let o=0;o<t.cssRules.length;o++){let a=t.cssRules[o];if(a.constructor?.name==="CSSKeyframesRule"||a.cssText?.startsWith("@keyframes")){let l=a.name;if(!l)continue;let h=`${r}_${l}`;try{a.name=h}catch{let c=a.cssText.replace(/@keyframes\s+[\w-]+/,`@keyframes ${h}`);t.deleteRule(o),t.insertRule(c,o)}i.push({from:l,to:h})}}if(i.length===0)return i;let n=new Map(i.map(o=>[o.from,o.to]));for(let o of t.cssRules)if(o.style)for(let a of["animation","animation-name"]){let l=o.style.getPropertyValue(a);if(!l)continue;let h=l.replace(/\b([\w-]+)\b/g,c=>n.has(c)?n.get(c):c);h!==l&&o.style.setProperty(a,h)}return i}#R(t,e){let i=[];for(let n of t.cssRules)i.push(n.cssText);return`@scope ([data-a2ui-surface="${String(e).replace(/"/g,'\\"')}"]) {
42
42
  ${i.join(`
43
43
  `)}
44
- }`}#Q(t,e,i){let r=t||this.#t;if(!(!r||typeof CustomEvent>"u"))try{r.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!1}))}catch{}}getSurface(t){return this.#i.get(t)}getElement(t){return this.#s.get(t)}get surfaces(){return[...this.#i.keys()]}getStylesheets(t){return this.#i.get(t)?.adoptedSheets??new Map}reset(){this.#a!==null&&(cancelAnimationFrame(this.#a),this.#a=null),this.#n.length=0;let t=new Set;for(let[,e]of this.#i)if(e.adoptedSheets)for(let i of e.adoptedSheets.values())t.add(i.sheet);t.size>0&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>!t.has(e)));for(let[,e]of this.#i)e.root===this.#t?e.root.innerHTML="":e.root.remove();this.#i.clear(),this.#s.clear(),this.#r.clear()}set batching(t){this.#o=!!t}get batching(){return this.#o}}});function Ld(s,t={}){let e=s;if(t.catalog){let i=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog),r=s.includes("?")?"&":"?";e=`${s}${r}a2ui_catalog=${encodeURIComponent(i.join(","))}`}return{[Symbol.asyncIterator](){let i=new EventSource(e),r=[],n=null,o=!1;return i.onmessage=a=>{try{let l=JSON.parse(a.data);if(n){let h=n;n=null,h({value:l,done:!1})}else r.push(l)}catch{console.warn("A2UI SSE: invalid JSON",a.data)}},i.onerror=()=>{if(o=!0,i.close(),n){let a=n;n=null,a({value:void 0,done:!0})}},t.signal&&t.signal.addEventListener("abort",()=>{if(o=!0,i.close(),n){let a=n;n=null,a({value:void 0,done:!0})}}),{next(){return r.length>0?Promise.resolve({value:r.shift(),done:!1}):o?Promise.resolve({value:void 0,done:!0}):new Promise(a=>{n=a})},return(){return o=!0,i.close(),Promise.resolve({value:void 0,done:!0})}}}}}function Md(s,t={}){return{[Symbol.asyncIterator](){let e=new WebSocket(s),i=[],r=null,n=!1;return e.onopen=()=>{if(t.catalog){let o=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog);e.send(JSON.stringify({type:"a2ui:catalog",supportedTypes:o}))}},e.onmessage=o=>{try{let a=JSON.parse(o.data);if(r){let l=r;r=null,l({value:a,done:!1})}else i.push(a)}catch{console.warn("A2UI WS: invalid JSON",o.data)}},e.onclose=()=>{if(n=!0,r){let o=r;r=null,o({value:void 0,done:!0})}},e.onerror=()=>{n=!0,e.close()},{next(){return i.length>0?Promise.resolve({value:i.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise(o=>{r=o})},return(){return n=!0,e.close(),Promise.resolve({value:void 0,done:!0})}}}}}function EE(s,t=0){return{async*[Symbol.asyncIterator](){for(let e of s)t>0&&await new Promise(i=>setTimeout(i,t)),yield e}}}function Rd(s,t={}){let e=(s.split(":")[0]||"").toLowerCase();return e==="ws"||e==="wss"?CD(s,t):kE(s,t)}function AE(s,t){if(s.result?.content){for(let e of s.result.content)if(e.type==="resource"&&e.resource?.mimeType==="application/json+a2ui")try{let i=JSON.parse(e.resource.text);for(let r of Array.isArray(i)?i:[i])t(r)}catch{}else if(e.type==="text")try{let i=JSON.parse(e.text);i.type&&(i.type.startsWith("create")||i.type.startsWith("update")||i.type.startsWith("delete"))&&t(i)}catch{}}}function CD(s,t){return{async*[Symbol.asyncIterator](){let{signal:e,catalog:i,onAction:r}=t,n=new WebSocket(s);if(await new Promise((c,u)=>{n.onopen=c,n.onerror=u,e&&e.addEventListener("abort",()=>{n.close(),u(new DOMException("Aborted","AbortError"))},{once:!0})}),i){let c=i instanceof Map?[...i.keys()]:Object.keys(i);n.send(JSON.stringify({jsonrpc:"2.0",method:"a2ui/catalog",params:{supportedTypes:c}}))}let o=[],a=null,l=!1,h=c=>{if(a){let u=a;a=null,u({value:c,done:!1})}else o.push(c)};for(n.onmessage=c=>{try{let u=JSON.parse(c.data);AE(u,h),u.method==="a2ui/action"&&r&&r(u.params?.name,u.params?.arguments).then(d=>{n.send(JSON.stringify({jsonrpc:"2.0",id:u.id,result:d}))}).catch(d=>{n.send(JSON.stringify({jsonrpc:"2.0",id:u.id,error:{code:-1,message:d.message}}))})}catch{console.warn("A2UI MCP: invalid message",c.data)}},n.onclose=()=>{if(l=!0,a){let c=a;a=null,c({value:void 0,done:!0})}},n.onerror=()=>{l=!0,n.close()},e&&e.addEventListener("abort",()=>{if(l=!0,n.close(),a){let c=a;a=null,c({value:void 0,done:!0})}});!l||o.length>0;)if(o.length>0)yield o.shift();else{if(l)break;{let c=await new Promise(u=>{a=u});if(c.done)break;yield c.value}}}}}function kE(s,t){return{async*[Symbol.asyncIterator](){let{signal:e,catalog:i,onAction:r}=t,n=[],o=null,a=!1,l=g=>{if(o){let x=o;o=null,x({value:g,done:!1})}else n.push(g)},h=()=>{if(a=!0,o){let g=o;o=null,g({value:void 0,done:!0})}},c={jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-11-25",capabilities:{},clientInfo:{name:"a2ui-runtime",version:"0.0.0"}}},u;try{u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(c),signal:e})}catch(g){console.warn("A2UI MCP HTTP: initialize failed",g);return}if(!u.ok){console.warn(`A2UI MCP HTTP: initialize returned ${u.status}`);return}let d=u.headers.get("mcp-session-id");if(!d){console.warn("A2UI MCP HTTP: server did not return mcp-session-id header");try{await u.text()}catch{}return}try{if((u.headers.get("content-type")||"").includes("text/event-stream")){let x=u.body.getReader(),S=new TextDecoder,w="";for(;;){let{done:A,value:k}=await x.read();if(A||(w+=S.decode(k,{stream:!0}),w.includes(`
44
+ }`}#Q(t,e,i){let r=t||this.#t;if(!(!r||typeof CustomEvent>"u"))try{r.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!1}))}catch{}}getSurface(t){return this.#i.get(t)}getElement(t){return this.#s.get(t)}get surfaces(){return[...this.#i.keys()]}getStylesheets(t){return this.#i.get(t)?.adoptedSheets??new Map}reset(){this.#a!==null&&(cancelAnimationFrame(this.#a),this.#a=null),this.#n.length=0;let t=new Set;for(let[,e]of this.#i)if(e.adoptedSheets)for(let i of e.adoptedSheets.values())t.add(i.sheet);t.size>0&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>!t.has(e)));for(let[,e]of this.#i)e.root===this.#t?e.root.innerHTML="":e.root.remove();this.#i.clear(),this.#s.clear(),this.#r.clear()}set batching(t){this.#o=!!t}get batching(){return this.#o}}});function Ld(s,t={}){let e=s;if(t.catalog){let i=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog),r=s.includes("?")?"&":"?";e=`${s}${r}a2ui_catalog=${encodeURIComponent(i.join(","))}`}return{[Symbol.asyncIterator](){let i=new EventSource(e),r=[],n=null,o=!1;return i.onmessage=a=>{try{let l=JSON.parse(a.data);if(n){let h=n;n=null,h({value:l,done:!1})}else r.push(l)}catch{console.warn("A2UI SSE: invalid JSON",a.data)}},i.onerror=()=>{if(o=!0,i.close(),n){let a=n;n=null,a({value:void 0,done:!0})}},t.signal&&t.signal.addEventListener("abort",()=>{if(o=!0,i.close(),n){let a=n;n=null,a({value:void 0,done:!0})}}),{next(){return r.length>0?Promise.resolve({value:r.shift(),done:!1}):o?Promise.resolve({value:void 0,done:!0}):new Promise(a=>{n=a})},return(){return o=!0,i.close(),Promise.resolve({value:void 0,done:!0})}}}}}function Md(s,t={}){return{[Symbol.asyncIterator](){let e=new WebSocket(s),i=[],r=null,n=!1;return e.onopen=()=>{if(t.catalog){let o=t.catalog instanceof Map?[...t.catalog.keys()]:Object.keys(t.catalog);e.send(JSON.stringify({type:"a2ui:catalog",supportedTypes:o}))}},e.onmessage=o=>{try{let a=JSON.parse(o.data);if(r){let l=r;r=null,l({value:a,done:!1})}else i.push(a)}catch{console.warn("A2UI WS: invalid JSON",o.data)}},e.onclose=()=>{if(n=!0,r){let o=r;r=null,o({value:void 0,done:!0})}},e.onerror=()=>{n=!0,e.close()},{next(){return i.length>0?Promise.resolve({value:i.shift(),done:!1}):n?Promise.resolve({value:void 0,done:!0}):new Promise(o=>{r=o})},return(){return n=!0,e.close(),Promise.resolve({value:void 0,done:!0})}}}}}function EE(s,t=0){return{async*[Symbol.asyncIterator](){for(let e of s)t>0&&await new Promise(i=>setTimeout(i,t)),yield e}}}function Rd(s,t={}){let e=(s.split(":")[0]||"").toLowerCase();return e==="ws"||e==="wss"?CD(s,t):kE(s,t)}function AE(s,t){if(s.result?.content){for(let e of s.result.content)if(e.type==="resource"&&e.resource?.mimeType==="application/json+a2ui")try{let i=JSON.parse(e.resource.text);for(let r of Array.isArray(i)?i:[i])t(r)}catch{}else if(e.type==="text")try{let i=JSON.parse(e.text);i.type&&(i.type.startsWith("create")||i.type.startsWith("update")||i.type.startsWith("delete"))&&t(i)}catch{}}}function CD(s,t){return{async*[Symbol.asyncIterator](){let{signal:e,catalog:i,onAction:r}=t,n=new WebSocket(s);if(await new Promise((c,u)=>{n.onopen=c,n.onerror=u,e&&e.addEventListener("abort",()=>{n.close(),u(new DOMException("Aborted","AbortError"))},{once:!0})}),i){let c=i instanceof Map?[...i.keys()]:Object.keys(i);n.send(JSON.stringify({jsonrpc:"2.0",method:"a2ui/catalog",params:{supportedTypes:c}}))}let o=[],a=null,l=!1,h=c=>{if(a){let u=a;a=null,u({value:c,done:!1})}else o.push(c)};for(n.onmessage=c=>{try{let u=JSON.parse(c.data);AE(u,h),u.method==="a2ui/action"&&r&&r(u.params?.name,u.params?.arguments).then(d=>{n.send(JSON.stringify({jsonrpc:"2.0",id:u.id,result:d}))}).catch(d=>{n.send(JSON.stringify({jsonrpc:"2.0",id:u.id,error:{code:-1,message:d.message}}))})}catch{console.warn("A2UI MCP: invalid message",c.data)}},n.onclose=()=>{if(l=!0,a){let c=a;a=null,c({value:void 0,done:!0})}},n.onerror=()=>{l=!0,n.close()},e&&e.addEventListener("abort",()=>{if(l=!0,n.close(),a){let c=a;a=null,c({value:void 0,done:!0})}});!l||o.length>0;)if(o.length>0)yield o.shift();else{if(l)break;{let c=await new Promise(u=>{a=u});if(c.done)break;yield c.value}}}}}function kE(s,t){return{async*[Symbol.asyncIterator](){let{signal:e,catalog:i,onAction:r}=t,n=[],o=null,a=!1,l=g=>{if(o){let x=o;o=null,x({value:g,done:!1})}else n.push(g)},h=()=>{if(a=!0,o){let g=o;o=null,g({value:void 0,done:!0})}},c={jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-11-25",capabilities:{},clientInfo:{name:"a2ui",version:"0.0.0"}}},u;try{u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:JSON.stringify(c),signal:e})}catch(g){console.warn("A2UI MCP HTTP: initialize failed",g);return}if(!u.ok){console.warn(`A2UI MCP HTTP: initialize returned ${u.status}`);return}let d=u.headers.get("mcp-session-id");if(!d){console.warn("A2UI MCP HTTP: server did not return mcp-session-id header");try{await u.text()}catch{}return}try{if((u.headers.get("content-type")||"").includes("text/event-stream")){let x=u.body.getReader(),S=new TextDecoder,w="";for(;;){let{done:A,value:k}=await x.read();if(A||(w+=S.decode(k,{stream:!0}),w.includes(`
45
45
 
46
46
  `)))break}try{x.cancel()}catch{}}else await u.json().catch(()=>null)}catch{}try{await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":d},body:JSON.stringify({jsonrpc:"2.0",method:"notifications/initialized"}),signal:e}).then(g=>g.text()).catch(()=>null)}catch{}if(i){let g=i instanceof Map?[...i.keys()]:Object.keys(i);try{await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":d},body:JSON.stringify({jsonrpc:"2.0",method:"a2ui/catalog",params:{supportedTypes:g}}),signal:e}).then(x=>x.text()).catch(()=>null)}catch{}}let f=g=>fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","mcp-session-id":d},body:JSON.stringify(g),signal:e}).then(x=>x.text()).catch(()=>null),p=g=>{AE(g,l),g.method==="a2ui/action"&&r&&Promise.resolve().then(()=>r(g.params?.name,g.params?.arguments)).then(x=>f({jsonrpc:"2.0",id:g.id,result:x})).catch(x=>f({jsonrpc:"2.0",id:g.id,error:{code:-1,message:x.message}}))},m;try{m=await fetch(s,{method:"GET",headers:{Accept:"text/event-stream","mcp-session-id":d},signal:e})}catch(g){g?.name!=="AbortError"&&console.warn("A2UI MCP HTTP: GET stream failed",g);return}if(!m.ok||!m.body){console.warn(`A2UI MCP HTTP: GET stream returned ${m.status}`);return}e&&e.addEventListener("abort",h,{once:!0});let b=()=>{try{fetch(s,{method:"DELETE",headers:{"mcp-session-id":d}}).catch(()=>null)}catch{}};for((async()=>{let g=m.body.getReader(),x=new TextDecoder,S="";try{for(;!a;){let{done:w,value:A}=await g.read();if(w)break;S+=x.decode(A,{stream:!0});let k;for(;(k=S.indexOf(`
47
47
 
@@ -31,8 +31,8 @@
31
31
  * compat.
32
32
  */
33
33
 
34
- import { defineIfFree } from '../../../web-components/core/register.js';
35
- import { UIElement } from '../../../web-components/core/element.js';
34
+ import { defineIfFree } from '@adia-ai/web-components/core/register';
35
+ import { UIElement } from '@adia-ai/web-components/core/element';
36
36
 
37
37
  class EditorCanvas extends UIElement {
38
38
  static properties = {
@@ -1,5 +1,5 @@
1
- import { defineIfFree } from '../../../web-components/core/register.js';
2
- import { UIElement } from '../../../web-components/core/element.js';
1
+ import { defineIfFree } from '@adia-ai/web-components/core/register';
2
+ import { UIElement } from '@adia-ai/web-components/core/element';
3
3
 
4
4
  /**
5
5
  * <editor-shell focus-mode?>
@@ -49,8 +49,8 @@
49
49
  * §When NOT to promote for the rationale.
50
50
  */
51
51
 
52
- import { defineIfFree } from '../../../web-components/core/register.js';
53
- import { UIElement } from '../../../web-components/core/element.js';
52
+ import { defineIfFree } from '@adia-ai/web-components/core/register';
53
+ import { UIElement } from '@adia-ai/web-components/core/element';
54
54
 
55
55
  const SNAP_THRESHOLD = 96; // px — below this, sidebar is "collapsed"
56
56
  const STORAGE_PREFIX = 'adia-editor-sidebar-';
@@ -24,8 +24,8 @@
24
24
  * back to legacy positional layout if no named slots are used.
25
25
  */
26
26
 
27
- import { defineIfFree } from '../../../web-components/core/register.js';
28
- import { UIElement } from '../../../web-components/core/element.js';
27
+ import { defineIfFree } from '@adia-ai/web-components/core/register';
28
+ import { UIElement } from '@adia-ai/web-components/core/element';
29
29
 
30
30
  class EditorToolbar extends UIElement {
31
31
  static properties = {