@adia-ai/web-modules 0.8.26 → 0.8.28
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/CHANGELOG.md +20 -0
- package/agent-admin/admin-roster/admin-roster.a2ui.json +2 -1
- package/agent-admin/admin-roster/admin-roster.css +13 -32
- package/agent-admin/admin-roster/admin-roster.js +22 -7
- package/agent-admin/admin-roster/admin-roster.yaml +1 -0
- package/dist/everything.min.js +9 -9
- package/dist/web-modules.min.css +1 -1
- package/dist/web-modules.sheet.js +1 -1
- package/package.json +14 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog — @adia-ai/web-modules
|
|
2
2
|
|
|
3
|
+
## [0.8.28] — 2026-08-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Generated CSS barrel regenerated — the `agent-admin` family was missing since 0.8.26**: `admin-roster`, `admin-settings`, and `agent-admin` shipped unstyled on every page linking `index.css` (gh#632).
|
|
7
|
+
- **`sideEffects` allowlist covered only 6 of 13 self-registering module families** — a consumer's bare side-effect import of `billing`, `dashboard`, `feedback`, `form`, `onboarding`, `settings`, or `simple` (e.g. `import '@adia-ai/web-modules/form/form-popover'`) was tree-shaken from production bundles: the `customElements.define` never shipped while the paired CSS survived, so the element rendered its raw light-DOM fallback in deployed builds only (gh#625, bit adiav2's admin dashboard — Linear ADIA2-7422). All 7 families added; a new repo gate (`check:sideeffects-coverage`) derives the required list from the registration idioms so the next family can't repeat this.
|
|
8
|
+
|
|
9
|
+
### Maintenance
|
|
10
|
+
- **`dist/` bundles rebuilt** in this cut's window (2 file(s)) — regenerated from the source changes described above, not independent edits.
|
|
11
|
+
|
|
12
|
+
## [0.8.27] — 2026-08-05
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- **`admin-roster-ui` migrated off native `<button>` rows** onto the extended `menu-item-ui` — the stamped-native-buttons sanction is removed; the audit is clean with zero exceptions in this package (gh#616, PR #623).
|
|
16
|
+
|
|
17
|
+
### Maintenance
|
|
18
|
+
- agent-admin test family deflaked properly: `settled()`/`vi.waitFor` condition-polling replaces fixed timer ticks across the suite (gh#614, PR #622).
|
|
19
|
+
- **`dist/` bundles rebuilt** in this cut's window (1 file(s)) — regenerated from the source changes described above, not independent edits.
|
|
20
|
+
- **`onboarding/` touched in this release window** (1 file(s), e.g. `onboarding-checklist/onboarding-checklist.test.js`) — carried by the entries above.
|
|
21
|
+
- **`settings/` touched in this release window** (1 file(s), e.g. `integrations-page/integrations-page.test.js`) — carried by the entries above.
|
|
22
|
+
|
|
3
23
|
## [0.8.26] — 2026-08-05
|
|
4
24
|
|
|
5
25
|
### Added
|
|
@@ -50,46 +50,27 @@
|
|
|
50
50
|
gap: var(--admin-roster-row-gap);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/* Rows are <menu-item-ui> (gh#616). Its own @scope wins on proximity, so
|
|
54
|
+
row overrides route through the menu-item token surface; only
|
|
55
|
+
properties menu-item never declares (width, font-weight) are set
|
|
56
|
+
directly. */
|
|
53
57
|
:scope [data-part="row"] {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
--menu-item-px: var(--a-space-3);
|
|
59
|
+
--menu-item-py: var(--a-space-2);
|
|
60
|
+
--menu-item-radius: var(--admin-roster-row-radius);
|
|
61
|
+
--menu-item-fg: var(--admin-roster-fg);
|
|
62
|
+
--menu-item-bg-hover: var(--admin-roster-active-bg);
|
|
58
63
|
width: 100%;
|
|
59
|
-
|
|
60
|
-
border: 1px solid transparent;
|
|
61
|
-
border-radius: var(--admin-roster-row-radius);
|
|
62
|
-
background: transparent;
|
|
63
|
-
color: var(--admin-roster-fg);
|
|
64
|
-
font: inherit;
|
|
65
|
-
text-align: left;
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
:scope [data-part="row"]:hover {
|
|
70
|
-
background: var(--admin-roster-active-bg);
|
|
64
|
+
box-sizing: border-box;
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
:scope [data-part="row"][data-active="true"] {
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
--menu-item-bg: var(--admin-roster-active-bg);
|
|
69
|
+
--menu-item-fg: var(--admin-roster-active-fg);
|
|
70
|
+
--menu-item-fg-hover: var(--admin-roster-active-fg);
|
|
76
71
|
font-weight: var(--a-weight-medium);
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
:scope [data-part="row-label"] {
|
|
80
|
-
flex: 1 1 auto;
|
|
81
|
-
min-width: 0;
|
|
82
|
-
overflow: hidden;
|
|
83
|
-
text-overflow: ellipsis;
|
|
84
|
-
white-space: nowrap;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:scope [data-part="row-category"] {
|
|
88
|
-
flex: 0 0 auto;
|
|
89
|
-
font-size: var(--a-ui-sm);
|
|
90
|
-
color: var(--admin-roster-fg-muted);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
74
|
:scope [data-part="row-check"] {
|
|
94
75
|
flex: 0 0 auto;
|
|
95
76
|
visibility: hidden;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* Per ADR-0027 — composites that programmatically create primitives in
|
|
30
30
|
* render() do NOT auto-import those primitives; a consumer imports
|
|
31
|
-
* <button-ui> + <icon-ui> alongside this module.
|
|
31
|
+
* <button-ui> + <icon-ui> + <menu-item-ui> (menu.js) alongside this module.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
import { UIElement, html } from '../../../web-components/core/element.js';
|
|
@@ -70,11 +70,13 @@ class UIAdminRoster extends UIElement {
|
|
|
70
70
|
catch { this.personas = []; }
|
|
71
71
|
}
|
|
72
72
|
this.addEventListener('click', this.#onClick);
|
|
73
|
+
this.addEventListener('keydown', this.#onKeydown);
|
|
73
74
|
this.addEventListener('change', this.#onImportFileChange);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
disconnected() {
|
|
77
78
|
this.removeEventListener('click', this.#onClick);
|
|
79
|
+
this.removeEventListener('keydown', this.#onKeydown);
|
|
78
80
|
this.removeEventListener('change', this.#onImportFileChange);
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -98,19 +100,21 @@ class UIAdminRoster extends UIElement {
|
|
|
98
100
|
|
|
99
101
|
#renderRow(persona, activeId) {
|
|
100
102
|
const isActive = persona.id === activeId;
|
|
103
|
+
// menu-item-ui with a consumer-owned role (gh#616): the primitive leaves
|
|
104
|
+
// role/tabindex/aria-checked to us — radio semantics stay this module's.
|
|
101
105
|
return html`
|
|
102
|
-
<
|
|
103
|
-
type="button"
|
|
106
|
+
<menu-item-ui
|
|
104
107
|
data-part="row"
|
|
105
108
|
data-persona-id=${persona.id}
|
|
106
109
|
role="menuitemradio"
|
|
110
|
+
tabindex="0"
|
|
107
111
|
aria-checked=${String(isActive)}
|
|
108
112
|
data-active=${isActive}
|
|
113
|
+
text=${persona.label ?? persona.id}
|
|
114
|
+
subtitle=${persona.category ?? ''}
|
|
109
115
|
>
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
<icon-ui data-part="row-check" name="check" aria-hidden="true"></icon-ui>
|
|
113
|
-
</button>
|
|
116
|
+
<icon-ui slot="trailing" data-part="row-check" name="check" aria-hidden="true"></icon-ui>
|
|
117
|
+
</menu-item-ui>
|
|
114
118
|
`;
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -120,6 +124,17 @@ class UIAdminRoster extends UIElement {
|
|
|
120
124
|
|
|
121
125
|
// ── event delegation ────────────────────────────────────────────
|
|
122
126
|
|
|
127
|
+
// The rows were native <button>s before gh#616; menu-item-ui rows need
|
|
128
|
+
// explicit Enter/Space activation to keep keyboard parity.
|
|
129
|
+
#onKeydown = (e) => {
|
|
130
|
+
if (e.key !== 'Enter' && e.key !== ' ') return;
|
|
131
|
+
const row = e.target.closest?.('[data-part="row"]');
|
|
132
|
+
if (row && this.contains(row)) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
row.click();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
123
138
|
#onClick = (e) => {
|
|
124
139
|
const row = e.target.closest?.('[data-part="row"]');
|
|
125
140
|
if (row && this.contains(row)) {
|
package/dist/everything.min.js
CHANGED
|
@@ -229,7 +229,7 @@ Correct shape for <chart-ui x="label" y="value">:
|
|
|
229
229
|
`),r=i.filter(o=>o.trim().length>0).map(o=>o.match(/^[ \t]*/)[0].length),n=r.length?Math.min(...r):0;return n>0?i.map(o=>o.slice(n)).join(`
|
|
230
230
|
`):e}async#d(){if(this.#r||this.#i)return;let t=this.#s,e=tO(this.language);this.#r=!0;try{let i=await Promise.resolve().then(()=>(Jb(),Kb)),r=null;try{r=(await i.importWithTimeout(i.languages[e],`lang-${e}`))?.extension??null}catch(n){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"language",language:e,error:n}}))}if(t!==this.#s||!this.isConnected)return;this.#u(i,r,e)}catch(i){this.dispatchEvent(new CustomEvent("language-load-error",{bubbles:!0,detail:{phase:"core",error:i}})),console.warn("[code-ui] CodeMirror failed to load; staying on static fallback.",i)}finally{this.#r=!1}}#u(t,e,i){let{EditorState:r,EditorView:n,Compartment:o,lineNumbers:a,placeholder:l,syntaxHighlighting:h,history:c,historyKeymap:u,defaultKeymap:d,indentWithTab:f,keymap:p,adiaBaseTheme:m,adiaHighlightStyle:b,lintGutter:g,jsonLinter:x}=t,S=this.querySelector(":scope > pre"),w=S?S.querySelector("code")?.textContent??"":"",k=this.text||w||"";this.#a=k;let A=document.createElement("div");A.setAttribute("data-cm-mount",""),S?S.replaceWith(A):this.appendChild(A);let E=[m,h(b)];this.editable&&E.push(c(),p.of([{key:"Mod-s",run:$=>(this.#O($),!0)},...d,...u,f]),n.updateListener.of($=>{if(!$.docChanged)return;let L=$.state.doc.toString();this.#m(L),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{value:L}}))}),n.domEventHandlers({focus:($,L)=>(this.#n=L.state.doc.toString(),!1),blur:($,L)=>{let T=L.state.doc.toString();return this.#n!==null&&T!==this.#n&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:T}})),this.#n=null,!1}})),this.#o=new o,E.push(this.#o.of(this.#f(n,r))),e&&E.push(e),this.lineNumbers&&E.push(a()),this.placeholder&&E.push(l(this.placeholder)),this.editable&&i==="json"&&E.push(x,g()),this.#i=new n({parent:A,state:r.create({doc:k,extensions:E})}),this.editable&&this.#m(k)}#f(t,e){return this.editable&&!this.disabled&&!this.readonly?[]:[t.editable.of(!1),e.readOnly.of(!0)]}async#p(){if(!this.#i||!this.#o)return;let t=await Promise.resolve().then(()=>(Jb(),Kb));this.#i.dispatch({effects:this.#o.reconfigure(this.#f(t.EditorView,t.EditorState))})}get form(){return this.internals.form}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}checkValidity(){return this.internals.checkValidity()}reportValidity(){return this.internals.reportValidity()}#m(t){this.editable&&(t=t??this.value??"",this.internals.setFormValue(t),this.#g(t))}#g(t){return t=t??"",this.required&&!t.trim()?(this.internals.setValidity({valueMissing:!0},this.getAttribute("data-msg-required")||"This field is required.",this),this.setAttribute("aria-invalid","true"),!1):(this.internals.setValidity({}),this.removeAttribute("aria-invalid"),!0)}formResetCallback(){this.#i?this.#i.dispatch({changes:{from:0,to:this.#i.state.doc.length,insert:this.#a}}):this.text=this.#a}formDisabledCallback(t){this.disabled=t}formStateRestoreCallback(t,e){typeof t=="string"&&(this.#i?this.#i.dispatch({changes:{from:0,to:this.#i.state.doc.length,insert:t}}):this.text=t)}#O(t){this.dispatchEvent(new CustomEvent("save",{bubbles:!0,cancelable:!0,detail:{value:t.state.doc.toString()}}))}get value(){return this.#i?this.#i.state.doc.toString():this.querySelector(":scope > pre > code")?.textContent??this.text??""}set value(t){this.text=String(t??"")}#y(){let t=this.#i?this.#i.state.doc.toString():this.querySelector(":scope > pre > code")?.textContent??"";t&&navigator.clipboard.writeText(t).then(()=>{let e=this.querySelector(':scope > header [slot="copy"]');if(!e)return;let i=e.textContent;e.textContent="Copied!",this.#e!=null&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#e=null,e.textContent=i},1500)})}render(){let t=this.querySelector(':scope > header [slot="label"]');if(t&&this.language&&(t.textContent=this.language),this.#p(),!this.inline&&this.text!=="")if(this.#i){if(this.editable&&this.#i.hasFocus)return;let e=this.#i.state.doc.toString();e!==this.text&&this.#i.dispatch({changes:{from:0,to:e.length,insert:this.text}})}else{let e=this.querySelector(":scope > pre > code");e&&e.textContent!==this.text&&(e.textContent=this.text)}}};C();y("code-ui",go);P();function R1(s){let t=s.replace(/=""(?=[\s/>])/g,"").replace(/="([^"]*"[^"]*)"/g,(o,a)=>{let l=a.replace(/"/g,'"').replace(/&/g,"&");return l.includes("'")?o:`='${l}'`}).replace(/\t/g," ").split(`
|
|
231
231
|
`);for(;t.length&&t[0].trim()==="";)t.shift();for(;t.length&&t[t.length-1].trim()==="";)t.pop();let e=o=>o.match(/^ */)[0].length,i=t.slice(1).filter(o=>o.trim()),r=(i.length?i:t.filter(o=>o.trim())).map(e),n=r.length?Math.min(...r):0;return t.map(o=>o.slice(Math.min(n,e(o)))).join(`
|
|
232
|
-
`)}var bo=class extends v{static properties={layout:{type:String,default:"",reflect:!0},codeFirst:{type:Boolean,default:!1,reflect:!0,attribute:"code-first"},language:{type:String,default:"html",reflect:!0},rows:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e(t,e,i){let r=document.createElement("div");r.setAttribute("data-preview-render",""),r.innerHTML=t;let n=document.createElement("div");n.setAttribute("data-preview-code","");let o=document.createElement("code-ui");return o.setAttribute("language",e),o.textContent=t.replace(/\s+data-chunk(?:-[a-z]+)?="[^"]*"/g,""),n.appendChild(o),i?[n,r]:[r,n]}connected(){if(this.querySelector(":scope > [data-preview-render], :scope > [data-preview-row]"))return;!this.hasAttribute("rows")&&!this.hasAttribute("layout")&&this.setAttribute("layout","split");let t=this.getAttribute("language")||"html",e=this.hasAttribute("code-first");if(this.hasAttribute("rows")){let r=[...this.children],n=[];for(let o of r){let a=o.getAttribute("data-preview-label");a!=null&&o.removeAttribute("data-preview-label");let l=o.hasAttribute("data-preview-unwrap");l&&o.removeAttribute("data-preview-unwrap");let h=R1(l?o.innerHTML:o.outerHTML),c=document.createElement("div");c.setAttribute("data-preview-row","");let u=this.#e(h,t,e);a&&u.find(f=>f.hasAttribute("data-preview-render"))?.setAttribute("data-preview-label",a),c.append(...u),n.push(c)}if(n.length){this.replaceChildren(...n),this.#r();return}}let i=R1(this.innerHTML);this.replaceChildren(...this.#e(i,t,e)),this.#r()}#i=()=>{if(this.hasAttribute("rows"))for(let t of this.querySelectorAll(":scope > [data-preview-row]")){let e=t.querySelector(":scope > [data-preview-render]");e&&e.scrollWidth>e.clientWidth+4&&t.setAttribute("data-stack","")}else if(this.getAttribute("layout")==="split"){let t=this.querySelector(":scope > [data-preview-render]");t&&t.scrollWidth>t.clientWidth+4&&this.setAttribute("layout","stack")}};#s=()=>requestAnimationFrame(this.#i);#r(){this.#s(),typeof ResizeObserver<"u"&&(this.#t=new ResizeObserver(this.#s),this.#t.observe(this))}disconnected(){this.#t?.disconnect()}};C();y("preview-ui",bo);P();var Oo=class extends v{static properties={divider:{type:Boolean,default:!1,reflect:!0},spacing:{type:String,default:"md",reflect:!0},selectable:{type:Boolean,default:!1,reflect:!0},selectedKey:{type:String,default:"",reflect:!0,attribute:"selected-key"}};static template=()=>null;#t=!1;connected(){this.setAttribute("role","list"),this.#t||(this.#t=!0,this.addEventListener("click",this.#r),this.addEventListener("keydown",this.#n))}disconnected(){this.removeEventListener("click",this.#r),this.removeEventListener("keydown",this.#n),this.#t=!1}render(){if(!this.selectable){for(let r of this.#e())r.removeAttribute("aria-selected"),r.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let r of e){let n=this.#i(r),o=n&&n===t;r.setAttribute("aria-selected",o?"true":"false"),r.setAttribute("tabindex",o?"0":"-1"),o&&(i=r)}!i&&e.length&&e[0].setAttribute("tabindex","0")}#e(){return[...this.children].filter(t=>t.tagName==="LIST-ITEM-UI"||t.getAttribute?.("role")==="listitem")}#i(t){return t.id||t.getAttribute("data-key")||""}#s(t,{focus:e=!1}={}){if(!this.selectable||!t)return;let i=this.selectedKey||"";t!==i&&(this.selectedKey=t,this.dispatchEvent(new CustomEvent("selection-change",{detail:{key:t,previousKey:i},bubbles:!0})),e&&[...this.#e()].find(n=>this.#i(n)===t)?.focus?.())}#r=t=>{if(!this.selectable)return;let e=t.target.closest?.('[role="listitem"]');if(!e||e.parentElement!==this)return;let i=this.#i(e);i&&this.#s(i)};#n=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,r=e.indexOf(i);if(r<0)return;let n=r;switch(t.key){case"ArrowDown":n=Math.min(e.length-1,r+1);break;case"ArrowUp":n=Math.max(0,r-1);break;case"Home":n=0;break;case"End":n=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[r]);o&&this.#s(o);return}default:return}n!==r&&(t.preventDefault(),e[n]?.focus?.())}},yo=class extends v{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","listitem"),this.#s()}#t(t){for(let e of this.children)if(e.matches(t))return e;return null}#e(t){return t.dataset.listStamped="1",t}#i(t){return t?.dataset?.listStamped==="1"}#s(){if(!this.#t('[slot="content"]')){if(this.icon){let t=this.#t('[slot="icon"]')||this.#t("icon-ui");t||(t=this.#e(document.createElement("icon-ui")),t.setAttribute("slot","icon"),this.prepend(t)),t.setAttribute("name",this.icon)}if(this.text){let t=this.#t('[slot="text"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","text"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.text)}if(this.description){let t=this.#t('[slot="description"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","description"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.description)}}}render(){let t=this.#t('[slot="icon"]');if(this.icon)if(t)this.#i(t)&&t.setAttribute("name",this.icon);else{let r=this.#e(document.createElement("icon-ui"));r.setAttribute("slot","icon"),r.setAttribute("name",this.icon),this.prepend(r)}else this.#i(t)&&t.remove();let e=this.#t('[slot="text"]');if(this.text)if(e)this.#i(e)&&(e.textContent=this.text);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","text"),r.textContent=this.text,this.appendChild(r)}else this.#i(e)&&e.remove();let i=this.#t('[slot="description"]');if(this.description)if(i)this.#i(i)&&(i.textContent=this.description);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","description"),r.textContent=this.description,this.appendChild(r)}else this.#i(i)&&i.remove()}};C();y("list-ui",Oo),y("list-item-ui",yo);P();var vo=class extends v{static properties={items:{type:Array,default:[],reflect:!1},itemSize:{type:Number,default:0,reflect:!0,attribute:"item-size"},itemSizeRem:{type:Number,default:0,reflect:!0,attribute:"item-size-rem"},estimatedSize:{type:Number,default:48,reflect:!0,attribute:"estimated-size"},overscan:{type:Number,default:3,reflect:!0},direction:{type:String,default:"vertical",reflect:!0},pinBottom:{type:Boolean,default:!1,reflect:!0,attribute:"pin-bottom"},startIndex:{type:Number,default:0,reflect:!1,attribute:"start-index"},loading:{type:Boolean,default:!1,reflect:!0}};static parts={phantom:"<div data-phantom></div>",window:"<div data-window></div>",sentinelTop:'<div data-sentinel="top"></div>',sentinelBottom:'<div data-sentinel="bottom"></div>'};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=(t,e)=>t&&typeof t=="object"&&"id"in t?t.id:e;#a=new Map;#o=new Map;#l=1e5;#h=-1;#c=-1;#d=0;#u=!0;#f=null;#p=null;#m=()=>{this.#C();let t=this.#A();this.#d=t,this.#u=this.#$()};#g=t=>{let e=t.target.closest?.("[data-row]");if(!e||e.parentElement!==this.#e)return;let i=Number(e.dataset.index);if(!Number.isInteger(i)||i<0)return;let r=this.items?.[i];r!=null&&this.dispatchEvent(new CustomEvent("item-click",{detail:{item:r,index:i},bubbles:!0}))};#O=t=>{if(t.target!==this)return;let e=this.#x()||this.estimatedSize||48,i=this.#k(),r=0;switch(t.key){case"ArrowDown":r=+e;break;case"ArrowUp":r=-e;break;case"PageDown":r=+i;break;case"PageUp":r=-i;break;case" ":r=+i;break;case"Home":t.preventDefault(),this.scrollToTop();return;case"End":t.preventDefault(),this.scrollToBottom();return;default:return}t.preventDefault();let n=this.#A();this.#E(n+r)};#y=t=>{for(let e of t){if(!e.isIntersecting)continue;let i=e.target?.dataset?.sentinel;if(i==="top"){let r=this.#h>=0?this.#h:0;this.dispatchEvent(new CustomEvent("scroll-start",{detail:{index:r},bubbles:!0}))}else if(i==="bottom"){let r=this.items||[],n=this.#c>=0?this.#c:r.length-1;this.dispatchEvent(new CustomEvent("scroll-end",{detail:{index:n},bubbles:!0}))}}};#b=t=>{if(this.itemSize>0)return;let e=!1;for(let i of t){let r=i.target;if(!r||r.parentElement!==this.#e)continue;let n=Number(r.dataset.index);if(!Number.isInteger(n))continue;let o=this.direction==="horizontal"?i.contentRect.width:i.contentRect.height,a=Math.max(1,Math.round(o));this.#o.get(n)!==a&&(this.#o.set(n,a),this.dispatchEvent(new CustomEvent("measure",{detail:{index:n,height:a},bubbles:!0})),e=!0)}e&&(this.#N(),this.#R(),this.#C())};connected(){this.setAttribute("role",this.getAttribute("role")||"list"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.#t=this.ensure("phantom"),this.#e=this.ensure("window"),this.#i=this.ensure("sentinelTop"),this.#s=this.ensure("sentinelBottom"),typeof IntersectionObserver<"u"&&(this.#p=new IntersectionObserver(this.#y,{root:this,rootMargin:"0px",threshold:0}),this.#p.observe(this.#i),this.#p.observe(this.#s)),typeof ResizeObserver<"u"&&(this.#f=new ResizeObserver(this.#b)),this.addEventListener("scroll",this.#m,{passive:!0}),this.addEventListener("click",this.#g),this.addEventListener("keydown",this.#O),this.startIndex>0&&queueMicrotask(()=>this.scrollToIndex(this.startIndex))}disconnected(){this.removeEventListener("scroll",this.#m),this.removeEventListener("click",this.#g),this.removeEventListener("keydown",this.#O),this.#p?.disconnect(),this.#p=null,this.#f?.disconnect(),this.#f=null,this.#a.clear()}render(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=this.pinBottom&&(this.#u||this.#$());t.length===0?this.setAttribute("empty",""):this.removeAttribute("empty"),this.setAttribute("aria-rowcount",String(t.length)),this.loading?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy"),this.#R(),this.#C(),e&&this.scrollToBottom(),this.#u=this.#$()}set renderRow(t){this.#r=typeof t=="function"?t:null,this.#a.clear(),this.#C()}get renderRow(){return this.#r}set keyFn(t){this.#n=typeof t=="function"?t:((e,i)=>i),this.#a.clear(),this.#C()}get keyFn(){return this.#n}scrollToIndex(t,{behavior:e="auto",align:i="start"}={}){let r=this.items||[];if(!r.length)return;let n=Math.max(0,Math.min(r.length-1,t|0)),o=this.#S(n),a=this.#k(),l=this.#v(n),h=o;i==="center"?h=o-a/2+l/2:i==="end"&&(h=o-a+l),this.#E(Math.max(0,h),e)}scrollToTop(){this.#E(0)}scrollToBottom(){let t=this.#w();this.#E(Math.max(0,t))}getVisibleRange(){return{startIndex:this.#h,endIndex:this.#c}}invalidateMeasurements(t=0){if(t<=0)this.#o.clear();else for(let e of[...this.#o.keys()])e>=t&&this.#o.delete(e);this.#R(),this.#C()}#x(){if(this.itemSize>0)return this.itemSize;if(this.itemSizeRem>0){let t=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;return this.itemSizeRem*t}return 0}#v(t){let e=this.#x();if(e>0)return e;let i=this.#o.get(t);return i??(this.estimatedSize||48)}#S(t){let e=this.#x();if(e>0)return t*e;let i=0;for(let r=0;r<t;r++)i+=this.#v(r);return i}#w(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return 0;let i=this.#x();if(i>0)return e*i;let r=0,n=this.estimatedSize||48;for(let o=0;o<e;o++)r+=this.#o.get(o)??n;return r}#k(){return this.direction==="horizontal"?this.clientWidth||0:this.clientHeight||0}#A(){return this.direction==="horizontal"?this.scrollLeft:this.scrollTop}#E(t,e="auto"){this.direction==="horizontal"?this.scrollTo({left:t,behavior:e}):this.scrollTo({top:t,behavior:e})}#$(){let t=this.#A(),e=this.#k(),i=this.#w();return t+e>=i-1}#R(){if(!this.#t)return;let t=this.#w();this.direction==="horizontal"?(this.#t.style.width=`${t}px`,this.#t.style.height="1px"):(this.#t.style.height=`${t}px`,this.#t.style.width="1px")}#T(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return{start:0,end:0};let i=this.#k(),r=this.#A(),n=this.#x(),o,a;if(n>0)o=Math.floor(r/n),a=Math.ceil((r+i)/n);else{let h=this.estimatedSize||48,c=0;o=0;for(let d=0;d<e;d++){let f=this.#o.get(d)??h;if(c+f>r){o=d;break}c+=f}a=o;let u=0;for(let d=o;d<e;d++){let f=this.#o.get(d)??h;if(u+=f,a=d+1,u>=i)break}}let l=Math.max(0,this.overscan|0);return o=Math.max(0,o-l),a=Math.min(e,a+l),{start:o,end:a}}#C(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=t.length,{start:i,end:r}=this.#T(),n=this.#S(i);this.direction==="horizontal"?this.#e.style.transform=`translateX(${n}px)`:this.#e.style.transform=`translateY(${n}px)`,this.loading?this.#L(r-i):this.#I(t,i,r),(i!==this.#h||r!==this.#c)&&(this.#h=i,this.#c=r,this.dispatchEvent(new CustomEvent("range-change",{detail:{startIndex:i,endIndex:r,items:t.slice(i,r)},bubbles:!0})))}#I(t,e,i){if(!this.#e)return;let r=new Set,n=this.#r??this.#Q();for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l);r.add(c);let u=this.#a.get(c);u?(u.dataset.index=String(l),u.setAttribute("aria-rowindex",String(l+1))):(u=this.#M(h,l,n),this.#a.set(c,u))}let o=[];for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l),u=this.#a.get(c);u&&o.push(u)}for(let[l,h]of this.#a)r.has(l)||(this.#f?.unobserve(h),h.parentElement===this.#e&&h.remove(),this.#a.delete(l));let a=this.#e.firstChild;for(let l of o)l!==a&&this.#e.insertBefore(l,a),a=l.nextSibling;for(;a;){let l=a.nextSibling;a.remove(),a=l}if(this.itemSize<=0&&this.itemSizeRem<=0&&this.#f)for(let l of o)this.#f.observe(l)}#L(t){if(!this.#e)return;this.#e.replaceChildren(),this.#a.clear();let e=Math.max(1,Math.min(20,t|0||5)),i=this.querySelector(':scope > template[slot="loading"]');for(let r=0;r<e;r++){let n=document.createElement("div");if(n.setAttribute("data-row",""),n.setAttribute("data-skeleton-row",""),n.dataset.index=String(r),i?.content)n.appendChild(i.content.cloneNode(!0));else{let o=document.createElement("skeleton-ui");n.appendChild(o)}this.#e.appendChild(n)}}#M(t,e,i){let r=document.createElement("div");r.setAttribute("data-row",""),r.setAttribute("role","listitem"),r.dataset.index=String(e),r.setAttribute("aria-rowindex",String(e+1));let n=null;if(typeof i=="function")try{n=i(t,e)}catch(o){console.warn("[list-window-ui] render() threw:",o)}if(n instanceof Node)r.appendChild(n);else if(n!=null)r.textContent=String(n);else if(t!=null&&typeof t=="object"&&"text"in t){let o=document.createElement("list-item-ui");o.setAttribute("text",String(t.text)),"description"in t&&o.setAttribute("description",String(t.description)),"icon"in t&&o.setAttribute("icon",String(t.icon)),r.appendChild(o)}else t!=null&&(r.textContent=String(t));return r}#Q(){let t=this.querySelector(":scope > template:not([slot])");if(!t)return null;this.#P==null&&(this.#P=t.innerHTML);let e=this.#P;return(i,r)=>{let n=e.replace(/\$\{item\.([a-zA-Z0-9_]+)\}/g,(a,l)=>{let h=i&&typeof i=="object"?i[l]:"";return h==null?"":C5(String(h))}),o=document.createElement("template");return o.innerHTML=n,o.content.cloneNode(!0)}}#P=null;#N(){if(this.#o.size<=this.#l)return;let t=this.#o.size-this.#l,e=0;for(let i of this.#o.keys())if(this.#o.delete(i),++e>=t)break}};function C5(s){return s.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}C();y("list-window-ui",vo);P();var xo=class extends v{static properties={open:{type:Boolean,default:!1,reflect:!0},placement:{type:String,default:"bottom-start",reflect:!0},gap:{type:Number,default:4,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=null;#r=null;connected(){this.#i||(this.#i=!0,this.addEventListener("click",this.#u),this.addEventListener("keydown",this.#f))}render(){this.open?this.#a():this.#o()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#n(){if(this.#e)return this.#e;let t=document.createElement("div");return t.setAttribute("data-menu-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.addEventListener("toggle",this.#y),t.addEventListener("click",this.#p),t.addEventListener("keydown",this.#m),this.appendChild(t),this.#e=t,t}#a(){let t=this.querySelector('[slot="trigger"]');if(!t)return;let e=this.#n(),i=this.querySelectorAll("menu-item-ui, menu-divider-ui, menu-label-ui");for(let r of i)e.contains(r)||e.appendChild(r);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=dt(t,e,{placement:this.placement,gap:this.gap}),this.#d&&(this.#d=!1,this.#r=requestAnimationFrame(()=>{this.#r=null,this.#h(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#g),document.addEventListener("keydown",this.#O,!0)})}#o(){this.#t?.(),this.#t=null;let t=this.#e;if(t){t.matches(":popover-open")&&t.hidePopover?.();let e=t.querySelectorAll("menu-item-ui, menu-divider-ui, menu-label-ui");for(let i of e)this.insertBefore(i,t)}this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#r!=null&&(cancelAnimationFrame(this.#r),this.#r=null),document.removeEventListener("pointerdown",this.#g),document.removeEventListener("keydown",this.#O,!0)}#l(){return Array.from(this.#e?.querySelectorAll("menu-item-ui")??[]).filter(t=>!t.disabled)}#h(t){let e=this.#l();if(!e.length)return;let i=(t+e.length)%e.length,r=e[i];r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})}#c(){return this.#l().indexOf(document.activeElement)}#d=!1;#u=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.#d=!1,this.open=!this.open)};#f=t=>{let e=this.querySelector('[slot="trigger"]');!e||!(t.target===e||e.contains(t.target))||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#d=!0,this.open=!0)};#p=t=>{let e=t.target.closest("menu-item-ui");!e||e.disabled||(this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{value:e.value,text:e.text}})),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0}))};#m=t=>{let e=this.#l();if(!e.length)return;let i=this.#c();switch(t.key){case"ArrowDown":t.preventDefault(),this.#h(i+1);break;case"ArrowUp":t.preventDefault(),this.#h(i-1);break;case"Home":t.preventDefault(),this.#h(0);break;case"End":t.preventDefault(),this.#h(e.length-1);break;case"Enter":case" ":{t.preventDefault(),(e[i]??e[0])?.click();break}}};#g=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#O=t=>{t.key==="Escape"&&this.open?(t.stopPropagation(),t.preventDefault(),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0})):t.key==="Tab"&&this.open&&(this.open=!1)};#y=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#o(),this.#e&&(this.#e.removeEventListener("toggle",this.#y),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#m)),this.#e=null,this.#i=!1}},So=class extends v{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;connected(){this.closest('[role="menu"], [role="menubar"]')?(this.setAttribute("role","menuitem"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")):(this.removeAttribute("role"),this.removeAttribute("tabindex")),this.#s(),this.#r()}#t(t){return t.dataset.menuItemStamped="1",t}#e(t){return t?.dataset?.menuItemStamped==="1"}#i(t){for(let e of this.children)if(e.matches(t))return e;return null}#s(){if(!this.#i('[slot="text"]')){if(this.icon&&!this.#i('[slot="icon"]')){let t=this.#t(document.createElement("icon-ui"));t.setAttribute("slot","icon"),t.setAttribute("name",this.icon),this.appendChild(t)}if(this.text){let t=this.#t(document.createElement("span"));t.setAttribute("slot","text"),t.textContent=this.text,this.appendChild(t)}}}#r(){this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}render(){let t=this.#i('[slot="icon"]');if(this.icon)if(t)this.#e(t)&&t.setAttribute("name",this.icon);else{let i=this.#t(document.createElement("icon-ui"));i.setAttribute("slot","icon"),i.setAttribute("name",this.icon),this.prepend(i)}else this.#e(t)&&t.remove();let e=this.#i('[slot="text"]');this.#e(e)&&(e.textContent=this.text),this.#r()}},wo=class extends v{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}},Yl=class extends v{static properties={text:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","presentation"),this.#t()}#t(){if(!this.querySelector(':scope > [slot="text"]')&&this.text){let t=document.createElement("span");t.setAttribute("slot","text"),t.dataset.menuLabelStamped="1",t.textContent=this.text,this.appendChild(t)}}render(){let t=this.querySelector(':scope > [slot="text"]');t?.dataset.menuLabelStamped==="1"&&(t.textContent=this.text)}};C();y("menu-ui",xo),y("menu-item-ui",So),y("menu-divider-ui",wo),y("menu-label-ui",Yl);P();var I1=500,ko=class extends v{static properties={for:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},longPressMs:{type:Number,default:I1,reflect:!1,attribute:"long-press-ms"}};static template=()=>null;#t=null;#e=null;#i=null;#s=[];#r=null;#n=null;#a=null;#o=null;connected(){super.connected(),this.#l()}disconnected(){super.disconnected(),this.#h(),this.#x(),this.#t?.remove(),this.#t=null}openAt(t,e,i=null){if(i??=this.#s[0]??null,!!i){if(this.#n=i,t==null||e==null){let r=i.getBoundingClientRect();t=r.left+r.width/2,e=r.top+r.height/2}this.#y(t,e)}}close(t="manual"){this.#b(t)}#l(){this.#s=this.#c();for(let t of this.#s)t.addEventListener("contextmenu",this.#d),t.addEventListener("touchstart",this.#u,{passive:!0}),t.addEventListener("touchend",this.#f),t.addEventListener("touchcancel",this.#f),t.addEventListener("keydown",this.#p)}#h(){for(let t of this.#s)t.removeEventListener("contextmenu",this.#d),t.removeEventListener("touchstart",this.#u),t.removeEventListener("touchend",this.#f),t.removeEventListener("touchcancel",this.#f),t.removeEventListener("keydown",this.#p);this.#s=[]}#c(){if(this.for)try{return[...document.querySelectorAll(this.for)]}catch(t){return console.warn(`[context-menu-ui] invalid [for] selector: ${this.for}`,t),[]}for(let t of this.children){let e=t.tagName.toLowerCase();if(e!=="menu-item-ui"&&e!=="menu-divider-ui")return[t]}return[]}#d=t=>{t.defaultPrevented||this.#m()&&(t.preventDefault(),this.#n=t.currentTarget,this.#y(t.clientX,t.clientY))};#u=t=>{if(!this.#m())return;let e=t.touches[0];e&&(this.#r=setTimeout(()=>{this.#n=t.currentTarget,this.#y(e.clientX,e.clientY)},this.longPressMs??I1))};#f=()=>{this.#r&&clearTimeout(this.#r),this.#r=null};#p=t=>{if(t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"){if(!this.#m())return;t.preventDefault(),this.#n=t.currentTarget,this.openAt(null,null,t.currentTarget)}};#m(){return[...this.children].some(t=>t.tagName.toLowerCase()==="menu-item-ui")}#g(){if(this.#t)return this.#t;let t=document.createElement("div");return t.setAttribute("data-context-menu-surface",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.setAttribute("aria-label",this.getAttribute("aria-label")||"Context menu"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#w),document.body.appendChild(t),this.#t=t,t}#O(t,e){if(!this.#e){let i=document.createElement("div");i.setAttribute("data-context-menu-anchor",""),i.style.cssText="position:fixed;width:1px;height:1px;pointer-events:none;opacity:0;",document.body.appendChild(i),this.#e=i}return this.#e.style.left=`${t}px`,this.#e.style.top=`${e}px`,this.#e}#y(t,e){let i=this.#g();i.replaceChildren();for(let o of[...this.children]){let a=o.tagName.toLowerCase();(a==="menu-item-ui"||a==="menu-divider-ui")&&i.appendChild(o.cloneNode(!0))}try{i.showPopover()}catch{}let r=this.#O(t,e);this.#i?.(),this.#i=dt(r,i,{placement:"bottom-start",gap:0}),this.open=!0,this.#v();let n=i.querySelector("menu-item-ui:not([disabled])");queueMicrotask(()=>n?.focus?.()),this.dispatchEvent(new CustomEvent("context-menu-open",{bubbles:!0,detail:{target:this.#n,x:t,y:e}}))}#b(t="manual"){if(this.open){this.open=!1,this.#x(),this.dispatchEvent(new CustomEvent("context-menu-close",{bubbles:!0,detail:{reason:t}}));try{this.#n?.focus?.()}catch{}}}#x(){this.#S(),this.#i?.(),this.#i=null;try{this.#t?.hidePopover()}catch{}this.#e&&(this.#e.remove(),this.#e=null)}#v(){this.#a=t=>{this.#t?.contains(t.target)||this.#b("outside")},this.#o=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#b("escape"))},requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.#a),document.addEventListener("keydown",this.#o)})}#S(){this.#a&&document.removeEventListener("pointerdown",this.#a),this.#o&&document.removeEventListener("keydown",this.#o),this.#a=null,this.#o=null}#w=t=>{let e=t.target.closest("menu-item-ui");if(!e||e.hasAttribute("disabled"))return;let i=e.getAttribute("value")||"",r=e.getAttribute("text")||e.textContent.trim();this.dispatchEvent(new CustomEvent("context-menu-select",{bubbles:!0,detail:{value:i,text:r}})),this.#b("select")}};C();y("context-menu-ui",ko);P();var Ao=class extends v{static properties={};static template=()=>null};C();y("visually-hidden-ui",Ao);P();var Eo=class extends v{static properties={target:{type:String,default:"#main",reflect:!0},text:{type:String,default:"Skip to main content",reflect:!0}};static template=({target:t,text:e})=>Y`<a href="${t}" data-skip-link>${e}</a>`;connected(){super.connected(),this.addEventListener("click",this.#t)}disconnected(){super.disconnected(),this.removeEventListener("click",this.#t)}#t=t=>{if(!t.target.closest("[data-skip-link]"))return;let i=this.target.replace(/^#/,""),r=document.getElementById(i);r&&queueMicrotask(()=>{r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!1})})}};C();y("skip-nav-ui",Eo);P();var Co=class extends v{static properties={variant:{type:String,default:"warning",reflect:!0}};static template=()=>null;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","mark")}};C();y("mark-ui",Co);var $o=class extends R{static properties={...R.properties,placeholder:{type:String,default:"Click to edit",reflect:!0},editing:{type:Boolean,default:!1,reflect:!0},commit:{type:String,default:"blur",reflect:!0}};static template=()=>null;#t="";#e=!1;#i=!1;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","textbox"),!this.hasAttribute("tabindex")&&!this.disabled&&this.setAttribute("tabindex","0"),this.value&&this.textContent.trim()===""?this.textContent=this.value:!this.value&&this.textContent.trim()&&(this.value=this.textContent.trim(),this.syncValue()),this.#e||(this.#e=!0,this.addEventListener("click",this.#s),this.addEventListener("keydown",this.#r),this.addEventListener("focus",this.#n),this.addEventListener("blur",this.#a))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#r),this.removeEventListener("focus",this.#n),this.removeEventListener("blur",this.#a),this.#e=!1}startEdit(){this.editing||this.disabled||this.readonly||(this.#t=this.value||"",this.editing=!0,this.setAttribute("contenteditable","plaintext-only"),this.dispatchEvent(new CustomEvent("edit-start",{bubbles:!0})),queueMicrotask(()=>{this.focus(),this.#o()}))}commitEdit(){if(!this.editing)return;let t=(this.textContent||"").trim(),e=this.#t;this.editing=!1,this.removeAttribute("contenteditable"),this.textContent!==t&&(this.textContent=t),t!==e&&(this.value=t,this.syncValue(t),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:t,oldValue:e}}))),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!0}}))}cancelEdit(){this.editing&&(this.editing=!1,this.removeAttribute("contenteditable"),this.textContent=this.#t,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0})),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!1}})))}#s=t=>{this.disabled||this.readonly||this.editing||(t.preventDefault(),this.startEdit())};#r=t=>{if(this.editing)t.key==="Enter"?(t.preventDefault(),this.#i=!0,this.commitEdit(),this.blur()):t.key==="Escape"&&(t.preventDefault(),this.#i=!0,this.cancelEdit(),this.blur());else if(t.key==="Enter"||t.key===" "){if(this.disabled||this.readonly)return;t.preventDefault(),this.startEdit()}};#n=()=>{};#a=()=>{if(this.editing){if(this.#i){this.#i=!1;return}this.commit==="blur"?this.commitEdit():this.commit==="enter"&&this.cancelEdit()}};#o(){let t=document.createRange();t.selectNodeContents(this);let e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(t))}};C();y("inline-edit-ui",$o);P();var Po=class extends v{static properties={active:{type:Boolean,default:!1,reflect:!0},step:{type:Number,default:0,reflect:!1},autoStart:{type:Boolean,default:!1,reflect:!0,attribute:"auto-start"},storageKey:{type:String,default:"",reflect:!0,attribute:"storage-key"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=null;connected(){super.connected(),this.autoStart&&!this.#o()&&requestAnimationFrame(()=>{this.isConnected&&this.autoStart&&this.start()})}disconnected(){super.disconnected(),this.#c()}start(){if(!this.active){if(!this.#a.length){console.warn("[tour-ui] start() called with no <tour-step> children \u2014 nothing to render.");return}this.step=0,this.active=!0,this.#h(),this.#d(),this.dispatchEvent(new CustomEvent("tour-start",{bubbles:!0,detail:{step:0}}))}}next(){if(!this.active)return;let t=this.#a.length;if(this.step>=t-1){this.finish();return}let e=this.step;this.step=e+1,this.#d(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:e,to:this.step,totalSteps:t}}))}previous(){if(!this.active||this.step<=0)return;let t=this.step;this.step=t-1,this.#d(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:t,to:this.step,totalSteps:this.#a.length}}))}skip(){if(!this.active)return;let t=this.#a.length,e=this.step;this.#l(),this.active=!1,this.#c(),this.dispatchEvent(new CustomEvent("tour-skip",{bubbles:!0,detail:{step:e,totalSteps:t}}))}finish(){if(!this.active)return;let t=this.#a.length;this.#l(),this.active=!1,this.#c(),this.dispatchEvent(new CustomEvent("tour-finish",{bubbles:!0,detail:{totalSteps:t}}))}get#a(){return[...this.querySelectorAll(":scope > tour-step-ui")]}#o(){if(!this.storageKey)return!1;try{return localStorage.getItem(this.storageKey)==="done"}catch{return!1}}#l(){if(this.storageKey)try{localStorage.setItem(this.storageKey,"done")}catch{}}#h(){if(!this.#t){let t=document.createElement("div");t.setAttribute("data-tour-spotlight",""),t.setAttribute("aria-hidden","true"),document.body.appendChild(t),this.#t=t}if(!this.#e){let t=document.createElement("div");t.setAttribute("data-tour-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#p),document.body.appendChild(t),this.#e=t}this.#s=()=>this.#f(),this.#r=()=>this.#f(),window.addEventListener("resize",this.#s),window.addEventListener("scroll",this.#r,!0),this.#n=t=>{this.active&&(t.key==="Escape"?(t.preventDefault(),this.skip()):t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"&&(t.preventDefault(),this.previous()))},document.addEventListener("keydown",this.#n)}#c(){this.#i?.(),this.#i=null,this.#s&&window.removeEventListener("resize",this.#s),this.#r&&window.removeEventListener("scroll",this.#r,!0),this.#n&&document.removeEventListener("keydown",this.#n),this.#s=this.#r=this.#n=null;try{this.#e?.hidePopover?.()}catch{}this.#e?.removeEventListener("click",this.#p),this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null}#d(){let t=this.#a[this.step];if(!t)return;let e=this.#a.length,i=this.step===e-1,r=this.step===0,n=t.getAttribute("title")||"",o=t.getAttribute("placement")||"bottom",a=t.getAttribute("target")||"",l=a?document.querySelector(a):null;this.#u=l,this.#f();let h=`${this.step+1} of ${e}`,c=t.innerHTML;this.#e.innerHTML=`
|
|
232
|
+
`)}var bo=class extends v{static properties={layout:{type:String,default:"",reflect:!0},codeFirst:{type:Boolean,default:!1,reflect:!0,attribute:"code-first"},language:{type:String,default:"html",reflect:!0},rows:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=null;#e(t,e,i){let r=document.createElement("div");r.setAttribute("data-preview-render",""),r.innerHTML=t;let n=document.createElement("div");n.setAttribute("data-preview-code","");let o=document.createElement("code-ui");return o.setAttribute("language",e),o.textContent=t.replace(/\s+data-chunk(?:-[a-z]+)?="[^"]*"/g,""),n.appendChild(o),i?[n,r]:[r,n]}connected(){if(this.querySelector(":scope > [data-preview-render], :scope > [data-preview-row]"))return;!this.hasAttribute("rows")&&!this.hasAttribute("layout")&&this.setAttribute("layout","split");let t=this.getAttribute("language")||"html",e=this.hasAttribute("code-first");if(this.hasAttribute("rows")){let r=[...this.children],n=[];for(let o of r){let a=o.getAttribute("data-preview-label");a!=null&&o.removeAttribute("data-preview-label");let l=o.hasAttribute("data-preview-unwrap");l&&o.removeAttribute("data-preview-unwrap");let h=R1(l?o.innerHTML:o.outerHTML),c=document.createElement("div");c.setAttribute("data-preview-row","");let u=this.#e(h,t,e);a&&u.find(f=>f.hasAttribute("data-preview-render"))?.setAttribute("data-preview-label",a),c.append(...u),n.push(c)}if(n.length){this.replaceChildren(...n),this.#r();return}}let i=R1(this.innerHTML);this.replaceChildren(...this.#e(i,t,e)),this.#r()}#i=()=>{if(this.hasAttribute("rows"))for(let t of this.querySelectorAll(":scope > [data-preview-row]")){let e=t.querySelector(":scope > [data-preview-render]");e&&e.scrollWidth>e.clientWidth+4&&t.setAttribute("data-stack","")}else if(this.getAttribute("layout")==="split"){let t=this.querySelector(":scope > [data-preview-render]");t&&t.scrollWidth>t.clientWidth+4&&this.setAttribute("layout","stack")}};#s=()=>requestAnimationFrame(this.#i);#r(){this.#s(),typeof ResizeObserver<"u"&&(this.#t=new ResizeObserver(this.#s),this.#t.observe(this))}disconnected(){this.#t?.disconnect()}};C();y("preview-ui",bo);P();var Oo=class extends v{static properties={divider:{type:Boolean,default:!1,reflect:!0},spacing:{type:String,default:"md",reflect:!0},selectable:{type:Boolean,default:!1,reflect:!0},selectedKey:{type:String,default:"",reflect:!0,attribute:"selected-key"}};static template=()=>null;#t=!1;connected(){this.setAttribute("role","list"),this.#t||(this.#t=!0,this.addEventListener("click",this.#r),this.addEventListener("keydown",this.#n))}disconnected(){this.removeEventListener("click",this.#r),this.removeEventListener("keydown",this.#n),this.#t=!1}render(){if(!this.selectable){for(let r of this.#e())r.removeAttribute("aria-selected"),r.removeAttribute("tabindex");return}let t=this.selectedKey||"",e=this.#e(),i=null;for(let r of e){let n=this.#i(r),o=n&&n===t;r.setAttribute("aria-selected",o?"true":"false"),r.setAttribute("tabindex",o?"0":"-1"),o&&(i=r)}!i&&e.length&&e[0].setAttribute("tabindex","0")}#e(){return[...this.children].filter(t=>t.tagName==="LIST-ITEM-UI"||t.getAttribute?.("role")==="listitem")}#i(t){return t.id||t.getAttribute("data-key")||""}#s(t,{focus:e=!1}={}){if(!this.selectable||!t)return;let i=this.selectedKey||"";t!==i&&(this.selectedKey=t,this.dispatchEvent(new CustomEvent("selection-change",{detail:{key:t,previousKey:i},bubbles:!0})),e&&[...this.#e()].find(n=>this.#i(n)===t)?.focus?.())}#r=t=>{if(!this.selectable)return;let e=t.target.closest?.('[role="listitem"]');if(!e||e.parentElement!==this)return;let i=this.#i(e);i&&this.#s(i)};#n=t=>{if(!this.selectable)return;let e=this.#e();if(!e.length)return;let i=document.activeElement,r=e.indexOf(i);if(r<0)return;let n=r;switch(t.key){case"ArrowDown":n=Math.min(e.length-1,r+1);break;case"ArrowUp":n=Math.max(0,r-1);break;case"Home":n=0;break;case"End":n=e.length-1;break;case"Enter":case" ":{t.preventDefault();let o=this.#i(e[r]);o&&this.#s(o);return}default:return}n!==r&&(t.preventDefault(),e[n]?.focus?.())}},yo=class extends v{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},description:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","listitem"),this.#s()}#t(t){for(let e of this.children)if(e.matches(t))return e;return null}#e(t){return t.dataset.listStamped="1",t}#i(t){return t?.dataset?.listStamped==="1"}#s(){if(!this.#t('[slot="content"]')){if(this.icon){let t=this.#t('[slot="icon"]')||this.#t("icon-ui");t||(t=this.#e(document.createElement("icon-ui")),t.setAttribute("slot","icon"),this.prepend(t)),t.setAttribute("name",this.icon)}if(this.text){let t=this.#t('[slot="text"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","text"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.text)}if(this.description){let t=this.#t('[slot="description"]');t||(t=this.#e(document.createElement("span")),t.setAttribute("slot","description"),this.appendChild(t)),this.#i(t)&&(t.textContent=this.description)}}}render(){let t=this.#t('[slot="icon"]');if(this.icon)if(t)this.#i(t)&&t.setAttribute("name",this.icon);else{let r=this.#e(document.createElement("icon-ui"));r.setAttribute("slot","icon"),r.setAttribute("name",this.icon),this.prepend(r)}else this.#i(t)&&t.remove();let e=this.#t('[slot="text"]');if(this.text)if(e)this.#i(e)&&(e.textContent=this.text);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","text"),r.textContent=this.text,this.appendChild(r)}else this.#i(e)&&e.remove();let i=this.#t('[slot="description"]');if(this.description)if(i)this.#i(i)&&(i.textContent=this.description);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","description"),r.textContent=this.description,this.appendChild(r)}else this.#i(i)&&i.remove()}};C();y("list-ui",Oo),y("list-item-ui",yo);P();var vo=class extends v{static properties={items:{type:Array,default:[],reflect:!1},itemSize:{type:Number,default:0,reflect:!0,attribute:"item-size"},itemSizeRem:{type:Number,default:0,reflect:!0,attribute:"item-size-rem"},estimatedSize:{type:Number,default:48,reflect:!0,attribute:"estimated-size"},overscan:{type:Number,default:3,reflect:!0},direction:{type:String,default:"vertical",reflect:!0},pinBottom:{type:Boolean,default:!1,reflect:!0,attribute:"pin-bottom"},startIndex:{type:Number,default:0,reflect:!1,attribute:"start-index"},loading:{type:Boolean,default:!1,reflect:!0}};static parts={phantom:"<div data-phantom></div>",window:"<div data-window></div>",sentinelTop:'<div data-sentinel="top"></div>',sentinelBottom:'<div data-sentinel="bottom"></div>'};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=(t,e)=>t&&typeof t=="object"&&"id"in t?t.id:e;#a=new Map;#o=new Map;#l=1e5;#h=-1;#c=-1;#d=0;#u=!0;#f=null;#p=null;#m=()=>{this.#C();let t=this.#A();this.#d=t,this.#u=this.#$()};#g=t=>{let e=t.target.closest?.("[data-row]");if(!e||e.parentElement!==this.#e)return;let i=Number(e.dataset.index);if(!Number.isInteger(i)||i<0)return;let r=this.items?.[i];r!=null&&this.dispatchEvent(new CustomEvent("item-click",{detail:{item:r,index:i},bubbles:!0}))};#O=t=>{if(t.target!==this)return;let e=this.#x()||this.estimatedSize||48,i=this.#k(),r=0;switch(t.key){case"ArrowDown":r=+e;break;case"ArrowUp":r=-e;break;case"PageDown":r=+i;break;case"PageUp":r=-i;break;case" ":r=+i;break;case"Home":t.preventDefault(),this.scrollToTop();return;case"End":t.preventDefault(),this.scrollToBottom();return;default:return}t.preventDefault();let n=this.#A();this.#E(n+r)};#y=t=>{for(let e of t){if(!e.isIntersecting)continue;let i=e.target?.dataset?.sentinel;if(i==="top"){let r=this.#h>=0?this.#h:0;this.dispatchEvent(new CustomEvent("scroll-start",{detail:{index:r},bubbles:!0}))}else if(i==="bottom"){let r=this.items||[],n=this.#c>=0?this.#c:r.length-1;this.dispatchEvent(new CustomEvent("scroll-end",{detail:{index:n},bubbles:!0}))}}};#b=t=>{if(this.itemSize>0)return;let e=!1;for(let i of t){let r=i.target;if(!r||r.parentElement!==this.#e)continue;let n=Number(r.dataset.index);if(!Number.isInteger(n))continue;let o=this.direction==="horizontal"?i.contentRect.width:i.contentRect.height,a=Math.max(1,Math.round(o));this.#o.get(n)!==a&&(this.#o.set(n,a),this.dispatchEvent(new CustomEvent("measure",{detail:{index:n,height:a},bubbles:!0})),e=!0)}e&&(this.#N(),this.#R(),this.#C())};connected(){this.setAttribute("role",this.getAttribute("role")||"list"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.#t=this.ensure("phantom"),this.#e=this.ensure("window"),this.#i=this.ensure("sentinelTop"),this.#s=this.ensure("sentinelBottom"),typeof IntersectionObserver<"u"&&(this.#p=new IntersectionObserver(this.#y,{root:this,rootMargin:"0px",threshold:0}),this.#p.observe(this.#i),this.#p.observe(this.#s)),typeof ResizeObserver<"u"&&(this.#f=new ResizeObserver(this.#b)),this.addEventListener("scroll",this.#m,{passive:!0}),this.addEventListener("click",this.#g),this.addEventListener("keydown",this.#O),this.startIndex>0&&queueMicrotask(()=>this.scrollToIndex(this.startIndex))}disconnected(){this.removeEventListener("scroll",this.#m),this.removeEventListener("click",this.#g),this.removeEventListener("keydown",this.#O),this.#p?.disconnect(),this.#p=null,this.#f?.disconnect(),this.#f=null,this.#a.clear()}render(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=this.pinBottom&&(this.#u||this.#$());t.length===0?this.setAttribute("empty",""):this.removeAttribute("empty"),this.setAttribute("aria-rowcount",String(t.length)),this.loading?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy"),this.#R(),this.#C(),e&&this.scrollToBottom(),this.#u=this.#$()}set renderRow(t){this.#r=typeof t=="function"?t:null,this.#a.clear(),this.#C()}get renderRow(){return this.#r}set keyFn(t){this.#n=typeof t=="function"?t:((e,i)=>i),this.#a.clear(),this.#C()}get keyFn(){return this.#n}scrollToIndex(t,{behavior:e="auto",align:i="start"}={}){let r=this.items||[];if(!r.length)return;let n=Math.max(0,Math.min(r.length-1,t|0)),o=this.#S(n),a=this.#k(),l=this.#v(n),h=o;i==="center"?h=o-a/2+l/2:i==="end"&&(h=o-a+l),this.#E(Math.max(0,h),e)}scrollToTop(){this.#E(0)}scrollToBottom(){let t=this.#w();this.#E(Math.max(0,t))}getVisibleRange(){return{startIndex:this.#h,endIndex:this.#c}}invalidateMeasurements(t=0){if(t<=0)this.#o.clear();else for(let e of[...this.#o.keys()])e>=t&&this.#o.delete(e);this.#R(),this.#C()}#x(){if(this.itemSize>0)return this.itemSize;if(this.itemSizeRem>0){let t=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;return this.itemSizeRem*t}return 0}#v(t){let e=this.#x();if(e>0)return e;let i=this.#o.get(t);return i??(this.estimatedSize||48)}#S(t){let e=this.#x();if(e>0)return t*e;let i=0;for(let r=0;r<t;r++)i+=this.#v(r);return i}#w(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return 0;let i=this.#x();if(i>0)return e*i;let r=0,n=this.estimatedSize||48;for(let o=0;o<e;o++)r+=this.#o.get(o)??n;return r}#k(){return this.direction==="horizontal"?this.clientWidth||0:this.clientHeight||0}#A(){return this.direction==="horizontal"?this.scrollLeft:this.scrollTop}#E(t,e="auto"){this.direction==="horizontal"?this.scrollTo({left:t,behavior:e}):this.scrollTo({top:t,behavior:e})}#$(){let t=this.#A(),e=this.#k(),i=this.#w();return t+e>=i-1}#R(){if(!this.#t)return;let t=this.#w();this.direction==="horizontal"?(this.#t.style.width=`${t}px`,this.#t.style.height="1px"):(this.#t.style.height=`${t}px`,this.#t.style.width="1px")}#T(){let e=(Array.isArray(this.items)?this.items:[]).length;if(e===0)return{start:0,end:0};let i=this.#k(),r=this.#A(),n=this.#x(),o,a;if(n>0)o=Math.floor(r/n),a=Math.ceil((r+i)/n);else{let h=this.estimatedSize||48,c=0;o=0;for(let d=0;d<e;d++){let f=this.#o.get(d)??h;if(c+f>r){o=d;break}c+=f}a=o;let u=0;for(let d=o;d<e;d++){let f=this.#o.get(d)??h;if(u+=f,a=d+1,u>=i)break}}let l=Math.max(0,this.overscan|0);return o=Math.max(0,o-l),a=Math.min(e,a+l),{start:o,end:a}}#C(){if(!this.#e)return;let t=Array.isArray(this.items)?this.items:[],e=t.length,{start:i,end:r}=this.#T(),n=this.#S(i);this.direction==="horizontal"?this.#e.style.transform=`translateX(${n}px)`:this.#e.style.transform=`translateY(${n}px)`,this.loading?this.#L(r-i):this.#I(t,i,r),(i!==this.#h||r!==this.#c)&&(this.#h=i,this.#c=r,this.dispatchEvent(new CustomEvent("range-change",{detail:{startIndex:i,endIndex:r,items:t.slice(i,r)},bubbles:!0})))}#I(t,e,i){if(!this.#e)return;let r=new Set,n=this.#r??this.#Q();for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l);r.add(c);let u=this.#a.get(c);u?(u.dataset.index=String(l),u.setAttribute("aria-rowindex",String(l+1))):(u=this.#M(h,l,n),this.#a.set(c,u))}let o=[];for(let l=e;l<i;l++){let h=t[l],c=this.#n(h,l),u=this.#a.get(c);u&&o.push(u)}for(let[l,h]of this.#a)r.has(l)||(this.#f?.unobserve(h),h.parentElement===this.#e&&h.remove(),this.#a.delete(l));let a=this.#e.firstChild;for(let l of o)l!==a&&this.#e.insertBefore(l,a),a=l.nextSibling;for(;a;){let l=a.nextSibling;a.remove(),a=l}if(this.itemSize<=0&&this.itemSizeRem<=0&&this.#f)for(let l of o)this.#f.observe(l)}#L(t){if(!this.#e)return;this.#e.replaceChildren(),this.#a.clear();let e=Math.max(1,Math.min(20,t|0||5)),i=this.querySelector(':scope > template[slot="loading"]');for(let r=0;r<e;r++){let n=document.createElement("div");if(n.setAttribute("data-row",""),n.setAttribute("data-skeleton-row",""),n.dataset.index=String(r),i?.content)n.appendChild(i.content.cloneNode(!0));else{let o=document.createElement("skeleton-ui");n.appendChild(o)}this.#e.appendChild(n)}}#M(t,e,i){let r=document.createElement("div");r.setAttribute("data-row",""),r.setAttribute("role","listitem"),r.dataset.index=String(e),r.setAttribute("aria-rowindex",String(e+1));let n=null;if(typeof i=="function")try{n=i(t,e)}catch(o){console.warn("[list-window-ui] render() threw:",o)}if(n instanceof Node)r.appendChild(n);else if(n!=null)r.textContent=String(n);else if(t!=null&&typeof t=="object"&&"text"in t){let o=document.createElement("list-item-ui");o.setAttribute("text",String(t.text)),"description"in t&&o.setAttribute("description",String(t.description)),"icon"in t&&o.setAttribute("icon",String(t.icon)),r.appendChild(o)}else t!=null&&(r.textContent=String(t));return r}#Q(){let t=this.querySelector(":scope > template:not([slot])");if(!t)return null;this.#P==null&&(this.#P=t.innerHTML);let e=this.#P;return(i,r)=>{let n=e.replace(/\$\{item\.([a-zA-Z0-9_]+)\}/g,(a,l)=>{let h=i&&typeof i=="object"?i[l]:"";return h==null?"":C5(String(h))}),o=document.createElement("template");return o.innerHTML=n,o.content.cloneNode(!0)}}#P=null;#N(){if(this.#o.size<=this.#l)return;let t=this.#o.size-this.#l,e=0;for(let i of this.#o.keys())if(this.#o.delete(i),++e>=t)break}};function C5(s){return s.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}C();y("list-window-ui",vo);P();var xo=class extends v{static properties={open:{type:Boolean,default:!1,reflect:!0},placement:{type:String,default:"bottom-start",reflect:!0},gap:{type:Number,default:4,reflect:!0}};static template=()=>null;#t=null;#e=null;#i=!1;#s=null;#r=null;connected(){this.#i||(this.#i=!0,this.addEventListener("click",this.#u),this.addEventListener("keydown",this.#f))}render(){this.open?this.#a():this.#o()}show(){this.open=!0}hide(){this.open=!1}toggle(){this.open=!this.open}#n(){if(this.#e)return this.#e;let t=document.createElement("div");return t.setAttribute("data-menu-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.addEventListener("toggle",this.#y),t.addEventListener("click",this.#p),t.addEventListener("keydown",this.#m),this.appendChild(t),this.#e=t,t}#a(){let t=this.querySelector('[slot="trigger"]');if(!t)return;let e=this.#n(),i=this.querySelectorAll("menu-item-ui, menu-divider-ui, menu-label-ui");for(let r of i)e.contains(r)||e.appendChild(r);e.matches(":popover-open")||e.showPopover?.(),this.#t?.(),this.#t=dt(t,e,{placement:this.placement,gap:this.gap}),this.#d&&(this.#d=!1,this.#r=requestAnimationFrame(()=>{this.#r=null,this.#h(0)})),this.#s=requestAnimationFrame(()=>{this.#s=null,document.addEventListener("pointerdown",this.#g),document.addEventListener("keydown",this.#O,!0)})}#o(){this.#t?.(),this.#t=null;let t=this.#e;if(t){t.matches(":popover-open")&&t.hidePopover?.();let e=t.querySelectorAll("menu-item-ui, menu-divider-ui, menu-label-ui");for(let i of e)this.insertBefore(i,t)}this.#s!=null&&(cancelAnimationFrame(this.#s),this.#s=null),this.#r!=null&&(cancelAnimationFrame(this.#r),this.#r=null),document.removeEventListener("pointerdown",this.#g),document.removeEventListener("keydown",this.#O,!0)}#l(){return Array.from(this.#e?.querySelectorAll("menu-item-ui")??[]).filter(t=>!t.disabled)}#h(t){let e=this.#l();if(!e.length)return;let i=(t+e.length)%e.length,r=e[i];r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0})}#c(){return this.#l().indexOf(document.activeElement)}#d=!1;#u=t=>{let e=this.querySelector('[slot="trigger"]');e&&(t.target===e||e.contains(t.target))&&(this.#d=!1,this.open=!this.open)};#f=t=>{let e=this.querySelector('[slot="trigger"]');!e||!(t.target===e||e.contains(t.target))||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#d=!0,this.open=!0)};#p=t=>{let e=t.target.closest("menu-item-ui");!e||e.disabled||(this.dispatchEvent(new CustomEvent("action",{bubbles:!0,detail:{value:e.value,text:e.text}})),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0}))};#m=t=>{let e=this.#l();if(!e.length)return;let i=this.#c();switch(t.key){case"ArrowDown":t.preventDefault(),this.#h(i+1);break;case"ArrowUp":t.preventDefault(),this.#h(i-1);break;case"Home":t.preventDefault(),this.#h(0);break;case"End":t.preventDefault(),this.#h(e.length-1);break;case"Enter":case" ":{t.preventDefault(),(e[i]??e[0])?.click();break}}};#g=t=>{this.open&&(this.contains(t.target)||(this.open=!1))};#O=t=>{t.key==="Escape"&&this.open?(t.stopPropagation(),t.preventDefault(),this.open=!1,this.querySelector('[slot="trigger"]')?.focus?.({preventScroll:!0})):t.key==="Tab"&&this.open&&(this.open=!1)};#y=t=>{let e=t.newState==="open";e!==this.open&&(this.open=e)};disconnected(){this.#o(),this.#e&&(this.#e.removeEventListener("toggle",this.#y),this.#e.removeEventListener("click",this.#p),this.#e.removeEventListener("keydown",this.#m)),this.#e=null,this.#i=!1}},So=class extends v{static properties={icon:{type:String,default:"",reflect:!0},text:{type:String,default:"",reflect:!0},subtitle:{type:String,default:"",reflect:!0},value:{type:String,default:"",reflect:!0},variant:{type:String,default:"default",reflect:!0},disabled:{type:Boolean,default:!1,reflect:!0}};static template=()=>null;#t=!1;connected(){this.hasAttribute("role")&&!this.#t||(this.closest('[role="menu"], [role="menubar"]')?(this.setAttribute("role","menuitem"),this.#t=!0,this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")):(this.removeAttribute("role"),this.removeAttribute("tabindex"),this.#t=!1)),this.#r(),this.#n()}#e(t){return t.dataset.menuItemStamped="1",t}#i(t){return t?.dataset?.menuItemStamped==="1"}#s(t){for(let e of this.children)if(e.matches(t))return e;return null}#r(){if(!this.#s('[slot="text"]')){if(this.icon&&!this.#s('[slot="icon"]')){let t=this.#e(document.createElement("icon-ui"));t.setAttribute("slot","icon"),t.setAttribute("name",this.icon),this.appendChild(t)}if(this.text){let t=this.#e(document.createElement("span"));t.setAttribute("slot","text"),t.textContent=this.text,this.appendChild(t)}if(this.subtitle&&!this.#s('[slot="subtitle"]')){let t=this.#e(document.createElement("span"));t.setAttribute("slot","subtitle"),t.textContent=this.subtitle,this.appendChild(t)}}}#n(){this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}render(){let t=this.#s('[slot="icon"]');if(this.icon)if(t)this.#i(t)&&t.setAttribute("name",this.icon);else{let r=this.#e(document.createElement("icon-ui"));r.setAttribute("slot","icon"),r.setAttribute("name",this.icon),this.prepend(r)}else this.#i(t)&&t.remove();let e=this.#s('[slot="text"]');this.#i(e)&&(e.textContent=this.text);let i=this.#s('[slot="subtitle"]');if(this.subtitle)if(i)this.#i(i)&&(i.textContent=this.subtitle);else{let r=this.#e(document.createElement("span"));r.setAttribute("slot","subtitle"),r.textContent=this.subtitle,this.appendChild(r)}else this.#i(i)&&i.remove();this.#n()}},wo=class extends v{static properties={};static template=()=>null;connected(){this.setAttribute("role","separator")}},Yl=class extends v{static properties={text:{type:String,default:"",reflect:!0}};static template=()=>null;connected(){this.setAttribute("role","presentation"),this.#t()}#t(){if(!this.querySelector(':scope > [slot="text"]')&&this.text){let t=document.createElement("span");t.setAttribute("slot","text"),t.dataset.menuLabelStamped="1",t.textContent=this.text,this.appendChild(t)}}render(){let t=this.querySelector(':scope > [slot="text"]');t?.dataset.menuLabelStamped==="1"&&(t.textContent=this.text)}};C();y("menu-ui",xo),y("menu-item-ui",So),y("menu-divider-ui",wo),y("menu-label-ui",Yl);P();var I1=500,ko=class extends v{static properties={for:{type:String,default:"",reflect:!0},open:{type:Boolean,default:!1,reflect:!0},longPressMs:{type:Number,default:I1,reflect:!1,attribute:"long-press-ms"}};static template=()=>null;#t=null;#e=null;#i=null;#s=[];#r=null;#n=null;#a=null;#o=null;connected(){super.connected(),this.#l()}disconnected(){super.disconnected(),this.#h(),this.#x(),this.#t?.remove(),this.#t=null}openAt(t,e,i=null){if(i??=this.#s[0]??null,!!i){if(this.#n=i,t==null||e==null){let r=i.getBoundingClientRect();t=r.left+r.width/2,e=r.top+r.height/2}this.#y(t,e)}}close(t="manual"){this.#b(t)}#l(){this.#s=this.#c();for(let t of this.#s)t.addEventListener("contextmenu",this.#d),t.addEventListener("touchstart",this.#u,{passive:!0}),t.addEventListener("touchend",this.#f),t.addEventListener("touchcancel",this.#f),t.addEventListener("keydown",this.#p)}#h(){for(let t of this.#s)t.removeEventListener("contextmenu",this.#d),t.removeEventListener("touchstart",this.#u),t.removeEventListener("touchend",this.#f),t.removeEventListener("touchcancel",this.#f),t.removeEventListener("keydown",this.#p);this.#s=[]}#c(){if(this.for)try{return[...document.querySelectorAll(this.for)]}catch(t){return console.warn(`[context-menu-ui] invalid [for] selector: ${this.for}`,t),[]}for(let t of this.children){let e=t.tagName.toLowerCase();if(e!=="menu-item-ui"&&e!=="menu-divider-ui")return[t]}return[]}#d=t=>{t.defaultPrevented||this.#m()&&(t.preventDefault(),this.#n=t.currentTarget,this.#y(t.clientX,t.clientY))};#u=t=>{if(!this.#m())return;let e=t.touches[0];e&&(this.#r=setTimeout(()=>{this.#n=t.currentTarget,this.#y(e.clientX,e.clientY)},this.longPressMs??I1))};#f=()=>{this.#r&&clearTimeout(this.#r),this.#r=null};#p=t=>{if(t.shiftKey&&t.key==="F10"||t.key==="ContextMenu"){if(!this.#m())return;t.preventDefault(),this.#n=t.currentTarget,this.openAt(null,null,t.currentTarget)}};#m(){return[...this.children].some(t=>t.tagName.toLowerCase()==="menu-item-ui")}#g(){if(this.#t)return this.#t;let t=document.createElement("div");return t.setAttribute("data-context-menu-surface",""),t.setAttribute("popover","manual"),t.setAttribute("role","menu"),t.setAttribute("aria-label",this.getAttribute("aria-label")||"Context menu"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#w),document.body.appendChild(t),this.#t=t,t}#O(t,e){if(!this.#e){let i=document.createElement("div");i.setAttribute("data-context-menu-anchor",""),i.style.cssText="position:fixed;width:1px;height:1px;pointer-events:none;opacity:0;",document.body.appendChild(i),this.#e=i}return this.#e.style.left=`${t}px`,this.#e.style.top=`${e}px`,this.#e}#y(t,e){let i=this.#g();i.replaceChildren();for(let o of[...this.children]){let a=o.tagName.toLowerCase();(a==="menu-item-ui"||a==="menu-divider-ui")&&i.appendChild(o.cloneNode(!0))}try{i.showPopover()}catch{}let r=this.#O(t,e);this.#i?.(),this.#i=dt(r,i,{placement:"bottom-start",gap:0}),this.open=!0,this.#v();let n=i.querySelector("menu-item-ui:not([disabled])");queueMicrotask(()=>n?.focus?.()),this.dispatchEvent(new CustomEvent("context-menu-open",{bubbles:!0,detail:{target:this.#n,x:t,y:e}}))}#b(t="manual"){if(this.open){this.open=!1,this.#x(),this.dispatchEvent(new CustomEvent("context-menu-close",{bubbles:!0,detail:{reason:t}}));try{this.#n?.focus?.()}catch{}}}#x(){this.#S(),this.#i?.(),this.#i=null;try{this.#t?.hidePopover()}catch{}this.#e&&(this.#e.remove(),this.#e=null)}#v(){this.#a=t=>{this.#t?.contains(t.target)||this.#b("outside")},this.#o=t=>{t.key==="Escape"&&(t.stopPropagation(),this.#b("escape"))},requestAnimationFrame(()=>{document.addEventListener("pointerdown",this.#a),document.addEventListener("keydown",this.#o)})}#S(){this.#a&&document.removeEventListener("pointerdown",this.#a),this.#o&&document.removeEventListener("keydown",this.#o),this.#a=null,this.#o=null}#w=t=>{let e=t.target.closest("menu-item-ui");if(!e||e.hasAttribute("disabled"))return;let i=e.getAttribute("value")||"",r=e.getAttribute("text")||e.textContent.trim();this.dispatchEvent(new CustomEvent("context-menu-select",{bubbles:!0,detail:{value:i,text:r}})),this.#b("select")}};C();y("context-menu-ui",ko);P();var Ao=class extends v{static properties={};static template=()=>null};C();y("visually-hidden-ui",Ao);P();var Eo=class extends v{static properties={target:{type:String,default:"#main",reflect:!0},text:{type:String,default:"Skip to main content",reflect:!0}};static template=({target:t,text:e})=>Y`<a href="${t}" data-skip-link>${e}</a>`;connected(){super.connected(),this.addEventListener("click",this.#t)}disconnected(){super.disconnected(),this.removeEventListener("click",this.#t)}#t=t=>{if(!t.target.closest("[data-skip-link]"))return;let i=this.target.replace(/^#/,""),r=document.getElementById(i);r&&queueMicrotask(()=>{r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!1})})}};C();y("skip-nav-ui",Eo);P();var Co=class extends v{static properties={variant:{type:String,default:"warning",reflect:!0}};static template=()=>null;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","mark")}};C();y("mark-ui",Co);var $o=class extends R{static properties={...R.properties,placeholder:{type:String,default:"Click to edit",reflect:!0},editing:{type:Boolean,default:!1,reflect:!0},commit:{type:String,default:"blur",reflect:!0}};static template=()=>null;#t="";#e=!1;#i=!1;connected(){super.connected(),this.hasAttribute("role")||this.setAttribute("role","textbox"),!this.hasAttribute("tabindex")&&!this.disabled&&this.setAttribute("tabindex","0"),this.value&&this.textContent.trim()===""?this.textContent=this.value:!this.value&&this.textContent.trim()&&(this.value=this.textContent.trim(),this.syncValue()),this.#e||(this.#e=!0,this.addEventListener("click",this.#s),this.addEventListener("keydown",this.#r),this.addEventListener("focus",this.#n),this.addEventListener("blur",this.#a))}disconnected(){super.disconnected(),this.removeEventListener("click",this.#s),this.removeEventListener("keydown",this.#r),this.removeEventListener("focus",this.#n),this.removeEventListener("blur",this.#a),this.#e=!1}startEdit(){this.editing||this.disabled||this.readonly||(this.#t=this.value||"",this.editing=!0,this.setAttribute("contenteditable","plaintext-only"),this.dispatchEvent(new CustomEvent("edit-start",{bubbles:!0})),queueMicrotask(()=>{this.focus(),this.#o()}))}commitEdit(){if(!this.editing)return;let t=(this.textContent||"").trim(),e=this.#t;this.editing=!1,this.removeAttribute("contenteditable"),this.textContent!==t&&(this.textContent=t),t!==e&&(this.value=t,this.syncValue(t),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{value:t,oldValue:e}}))),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!0}}))}cancelEdit(){this.editing&&(this.editing=!1,this.removeAttribute("contenteditable"),this.textContent=this.#t,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0})),this.dispatchEvent(new CustomEvent("edit-end",{bubbles:!0,detail:{committed:!1}})))}#s=t=>{this.disabled||this.readonly||this.editing||(t.preventDefault(),this.startEdit())};#r=t=>{if(this.editing)t.key==="Enter"?(t.preventDefault(),this.#i=!0,this.commitEdit(),this.blur()):t.key==="Escape"&&(t.preventDefault(),this.#i=!0,this.cancelEdit(),this.blur());else if(t.key==="Enter"||t.key===" "){if(this.disabled||this.readonly)return;t.preventDefault(),this.startEdit()}};#n=()=>{};#a=()=>{if(this.editing){if(this.#i){this.#i=!1;return}this.commit==="blur"?this.commitEdit():this.commit==="enter"&&this.cancelEdit()}};#o(){let t=document.createRange();t.selectNodeContents(this);let e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(t))}};C();y("inline-edit-ui",$o);P();var Po=class extends v{static properties={active:{type:Boolean,default:!1,reflect:!0},step:{type:Number,default:0,reflect:!1},autoStart:{type:Boolean,default:!1,reflect:!0,attribute:"auto-start"},storageKey:{type:String,default:"",reflect:!0,attribute:"storage-key"}};static template=()=>null;#t=null;#e=null;#i=null;#s=null;#r=null;#n=null;connected(){super.connected(),this.autoStart&&!this.#o()&&requestAnimationFrame(()=>{this.isConnected&&this.autoStart&&this.start()})}disconnected(){super.disconnected(),this.#c()}start(){if(!this.active){if(!this.#a.length){console.warn("[tour-ui] start() called with no <tour-step> children \u2014 nothing to render.");return}this.step=0,this.active=!0,this.#h(),this.#d(),this.dispatchEvent(new CustomEvent("tour-start",{bubbles:!0,detail:{step:0}}))}}next(){if(!this.active)return;let t=this.#a.length;if(this.step>=t-1){this.finish();return}let e=this.step;this.step=e+1,this.#d(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:e,to:this.step,totalSteps:t}}))}previous(){if(!this.active||this.step<=0)return;let t=this.step;this.step=t-1,this.#d(),this.dispatchEvent(new CustomEvent("tour-step-change",{bubbles:!0,detail:{from:t,to:this.step,totalSteps:this.#a.length}}))}skip(){if(!this.active)return;let t=this.#a.length,e=this.step;this.#l(),this.active=!1,this.#c(),this.dispatchEvent(new CustomEvent("tour-skip",{bubbles:!0,detail:{step:e,totalSteps:t}}))}finish(){if(!this.active)return;let t=this.#a.length;this.#l(),this.active=!1,this.#c(),this.dispatchEvent(new CustomEvent("tour-finish",{bubbles:!0,detail:{totalSteps:t}}))}get#a(){return[...this.querySelectorAll(":scope > tour-step-ui")]}#o(){if(!this.storageKey)return!1;try{return localStorage.getItem(this.storageKey)==="done"}catch{return!1}}#l(){if(this.storageKey)try{localStorage.setItem(this.storageKey,"done")}catch{}}#h(){if(!this.#t){let t=document.createElement("div");t.setAttribute("data-tour-spotlight",""),t.setAttribute("aria-hidden","true"),document.body.appendChild(t),this.#t=t}if(!this.#e){let t=document.createElement("div");t.setAttribute("data-tour-popover",""),t.setAttribute("popover","manual"),t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.tabIndex=-1,t.style.outline="none",t.addEventListener("click",this.#p),document.body.appendChild(t),this.#e=t}this.#s=()=>this.#f(),this.#r=()=>this.#f(),window.addEventListener("resize",this.#s),window.addEventListener("scroll",this.#r,!0),this.#n=t=>{this.active&&(t.key==="Escape"?(t.preventDefault(),this.skip()):t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"&&(t.preventDefault(),this.previous()))},document.addEventListener("keydown",this.#n)}#c(){this.#i?.(),this.#i=null,this.#s&&window.removeEventListener("resize",this.#s),this.#r&&window.removeEventListener("scroll",this.#r,!0),this.#n&&document.removeEventListener("keydown",this.#n),this.#s=this.#r=this.#n=null;try{this.#e?.hidePopover?.()}catch{}this.#e?.removeEventListener("click",this.#p),this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null}#d(){let t=this.#a[this.step];if(!t)return;let e=this.#a.length,i=this.step===e-1,r=this.step===0,n=t.getAttribute("title")||"",o=t.getAttribute("placement")||"bottom",a=t.getAttribute("target")||"",l=a?document.querySelector(a):null;this.#u=l,this.#f();let h=`${this.step+1} of ${e}`,c=t.innerHTML;this.#e.innerHTML=`
|
|
233
233
|
<div data-tour-header>
|
|
234
234
|
<span data-tour-indicator>${h}</span>
|
|
235
235
|
<span></span>
|
|
@@ -536,7 +536,7 @@ ${i.content}`).join(`
|
|
|
536
536
|
${e}`)}function FO(s,t={}){let e=zO(s.entries),i=e.filter(l=>l.kind==="prompt-section"),r=e.filter(l=>l.kind!=="prompt-section"),n=[Sh("persona-precedence",iC)];for(let l of i)n.push(Sh(`persona-section-${l.id}`,`## ${l.label}
|
|
537
537
|
${l.content}`));let o=new Map;for(let l of r){let h=o.get(l.kind);h?h.push(l):o.set(l.kind,[l])}for(let[l,h]of o)n.push(dq(l,h));let a={llm:{...s.model??{}},prompt:n};return t.integrations&&t.integrations.length>0&&(a.tools=t.integrations),a}var sC=["A2UI","envelope","JSONL"],fq=/\b[a-z][a-z0-9]*-ui\b/gi;function pq(s,t={}){let e=[...sC,...t.extraTerms??[]],i=[];for(let r of s.entries){let n=`${r.label}
|
|
538
538
|
${r.description??""}
|
|
539
|
-
${r.content}`,o=n.toLowerCase();for(let a of e)o.includes(a.toLowerCase())&&i.push({entryId:r.id,term:a});for(let a of n.matchAll(fq))i.push({entryId:r.id,term:a[0]})}return i}var Bd="persona",UO=1,mq=new Set(["kind","version","id","label","category","seedVersion","entries","model"]);function YO(s){let t={kind:Bd,version:UO,id:s.id,label:s.label,seedVersion:s.seedVersion,entries:s.entries};return s.category!==void 0&&(t.category=s.category),s.model!==void 0&&(t.model=s.model),JSON.stringify(t,null,2)}function gq(s,t){let e=`${s}-imported`,i=2;for(;t.has(e);)e=`${s}-imported-${i}`,i+=1;return e}function HO(s,t){let e;try{e=JSON.parse(s)}catch(c){throw new Error(`importPersona: invalid JSON \u2014 ${c.message}`)}if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("importPersona: expected a JSON object");let i=e,r=Object.keys(i).filter(c=>!mq.has(c));if(r.length>0)throw new Error(`importPersona: unknown key(s): ${r.join(", ")}`);if(i.kind!==Bd)throw new Error(`importPersona: expected kind "${Bd}", got ${JSON.stringify(i.kind)}`);if(i.version!==UO)throw new Error(`importPersona: unsupported version ${JSON.stringify(i.version)}`);if(typeof i.id!="string"||!i.id)throw new Error('importPersona: "id" must be a non-empty string');if(typeof i.label!="string"||!i.label)throw new Error('importPersona: "label" must be a non-empty string');if(typeof i.seedVersion!="number")throw new Error('importPersona: "seedVersion" must be a number');if(!Array.isArray(i.entries))throw new Error('importPersona: "entries" must be an array');let n=new Set(t),a={id:gq(i.id,n),label:`${i.label} (imported)`,seedVersion:i.seedVersion,entries:i.entries.map(c=>({...c,builtin:!1}))},l=i.category;typeof l=="string"&&(a.category=l);let h=i.model;return h&&typeof h=="object"&&!Array.isArray(h)&&(a.model=h),_O(a)}P();var wh=class extends v{static properties={personas:{type:Array,default:[]},"active-id":{type:String,default:"",reflect:!0}};static template=t=>t._renderTemplate();#t=`admin-roster-h-${Math.random().toString(36).slice(2,8)}`;#e=null;attributeChangedCallback(t,e,i){if(t==="personas"){if(i==null)this.personas=[];else try{let r=JSON.parse(i);this.personas=Array.isArray(r)?r:[]}catch{this.personas=[]}return}super.attributeChangedCallback(t,e,i)}connected(){if(this.setAttribute("role","region"),this.setAttribute("aria-labelledby",this.#t),this.hasAttribute("personas")&&!Array.isArray(this.personas))try{this.personas=JSON.parse(this.getAttribute("personas"))}catch{this.personas=[]}this.addEventListener("click",this.#r),this.addEventListener("change",this.#
|
|
539
|
+
${r.content}`,o=n.toLowerCase();for(let a of e)o.includes(a.toLowerCase())&&i.push({entryId:r.id,term:a});for(let a of n.matchAll(fq))i.push({entryId:r.id,term:a[0]})}return i}var Bd="persona",UO=1,mq=new Set(["kind","version","id","label","category","seedVersion","entries","model"]);function YO(s){let t={kind:Bd,version:UO,id:s.id,label:s.label,seedVersion:s.seedVersion,entries:s.entries};return s.category!==void 0&&(t.category=s.category),s.model!==void 0&&(t.model=s.model),JSON.stringify(t,null,2)}function gq(s,t){let e=`${s}-imported`,i=2;for(;t.has(e);)e=`${s}-imported-${i}`,i+=1;return e}function HO(s,t){let e;try{e=JSON.parse(s)}catch(c){throw new Error(`importPersona: invalid JSON \u2014 ${c.message}`)}if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("importPersona: expected a JSON object");let i=e,r=Object.keys(i).filter(c=>!mq.has(c));if(r.length>0)throw new Error(`importPersona: unknown key(s): ${r.join(", ")}`);if(i.kind!==Bd)throw new Error(`importPersona: expected kind "${Bd}", got ${JSON.stringify(i.kind)}`);if(i.version!==UO)throw new Error(`importPersona: unsupported version ${JSON.stringify(i.version)}`);if(typeof i.id!="string"||!i.id)throw new Error('importPersona: "id" must be a non-empty string');if(typeof i.label!="string"||!i.label)throw new Error('importPersona: "label" must be a non-empty string');if(typeof i.seedVersion!="number")throw new Error('importPersona: "seedVersion" must be a number');if(!Array.isArray(i.entries))throw new Error('importPersona: "entries" must be an array');let n=new Set(t),a={id:gq(i.id,n),label:`${i.label} (imported)`,seedVersion:i.seedVersion,entries:i.entries.map(c=>({...c,builtin:!1}))},l=i.category;typeof l=="string"&&(a.category=l);let h=i.model;return h&&typeof h=="object"&&!Array.isArray(h)&&(a.model=h),_O(a)}P();var wh=class extends v{static properties={personas:{type:Array,default:[]},"active-id":{type:String,default:"",reflect:!0}};static template=t=>t._renderTemplate();#t=`admin-roster-h-${Math.random().toString(36).slice(2,8)}`;#e=null;attributeChangedCallback(t,e,i){if(t==="personas"){if(i==null)this.personas=[];else try{let r=JSON.parse(i);this.personas=Array.isArray(r)?r:[]}catch{this.personas=[]}return}super.attributeChangedCallback(t,e,i)}connected(){if(this.setAttribute("role","region"),this.setAttribute("aria-labelledby",this.#t),this.hasAttribute("personas")&&!Array.isArray(this.personas))try{this.personas=JSON.parse(this.getAttribute("personas"))}catch{this.personas=[]}this.addEventListener("click",this.#n),this.addEventListener("keydown",this.#r),this.addEventListener("change",this.#l)}disconnected(){this.removeEventListener("click",this.#n),this.removeEventListener("keydown",this.#r),this.removeEventListener("change",this.#l)}_renderTemplate(){let t=Array.isArray(this.personas)?this.personas:[],e=this["active-id"]||"";return Y`
|
|
540
540
|
<header data-part="header">
|
|
541
541
|
<h2 data-part="title" id=${this.#t}>Personas</h2>
|
|
542
542
|
</header>
|
|
@@ -549,19 +549,19 @@ ${r.content}`,o=n.toLowerCase();for(let a of e)o.includes(a.toLowerCase())&&i.pu
|
|
|
549
549
|
<button-ui data-action="import" text="Import" icon="upload-simple" variant="ghost" size="sm"></button-ui>
|
|
550
550
|
</div>
|
|
551
551
|
`}#i(t,e){let i=t.id===e;return Y`
|
|
552
|
-
<
|
|
553
|
-
type="button"
|
|
552
|
+
<menu-item-ui
|
|
554
553
|
data-part="row"
|
|
555
554
|
data-persona-id=${t.id}
|
|
556
555
|
role="menuitemradio"
|
|
556
|
+
tabindex="0"
|
|
557
557
|
aria-checked=${String(i)}
|
|
558
558
|
data-active=${i}
|
|
559
|
+
text=${t.label??t.id}
|
|
560
|
+
subtitle=${t.category??""}
|
|
559
561
|
>
|
|
560
|
-
<
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
</button>
|
|
564
|
-
`}#s(){return Y`<div data-part="empty" role="status">No personas yet.</div>`}#r=t=>{let e=t.target.closest?.('[data-part="row"]');if(e&&this.contains(e)){let n=e.getAttribute("data-persona-id");n&&n!==this["active-id"]&&(this["active-id"]=n,this.dispatchEvent(new CustomEvent("persona-change",{bubbles:!0,detail:{personaId:n}})));return}let i=t.target.closest?.('[data-action="export"]');if(i&&this.contains(i)){this.#n();return}let r=t.target.closest?.('[data-action="import"]');r&&this.contains(r)&&this.#a()};#n(){let t=this["active-id"],e=(Array.isArray(this.personas)?this.personas:[]).find(a=>a.id===t);if(!e)return;let i=YO(e),r=new Blob([i],{type:"application/json"}),n=URL.createObjectURL(r),o=this.ownerDocument.createElement("a");o.href=n,o.download=`${e.id}.persona.json`,o.click(),URL.revokeObjectURL(n)}#a(){this.#e||(this.#e=this.ownerDocument.createElement("input"),this.#e.type="file",this.#e.accept="application/json",this.#e.setAttribute("data-part","import-file"),this.#e.style.display="none",this.appendChild(this.#e)),this.#e.value="",this.#e.click()}#o=async t=>{let e=t.target;if(!e||e!==this.#e)return;let i=e.files?.[0];if(i)try{let r=await i.text(),n=(Array.isArray(this.personas)?this.personas:[]).map(a=>a.id),o=HO(r,n);this.dispatchEvent(new CustomEvent("persona-import",{bubbles:!0,detail:{persona:o}}))}catch(r){this.dispatchEvent(new CustomEvent("persona-import-error",{bubbles:!0,detail:{error:r instanceof Error?r.message:String(r)}}))}}};customElements.get("admin-roster-ui")||customElements.define("admin-roster-ui",wh);function Xi(s,t){return`entry.${s}.${t}`}function GO(s,t){if(!s||!t)return s;let e=s.entries.map(i=>{let r=t.get(Xi(i.id,"enabled")),n=t.get(Xi(i.id,"order")),o=t.get(Xi(i.id,"content"));return{...i,enabled:typeof r=="boolean"?r:i.enabled,order:typeof n=="number"?n:i.order,content:typeof o=="string"?o:i.content}});return{...s,entries:e}}P();var bq={"prompt-section":"Prompt sections",skill:"Skills",workflow:"Workflows",resource:"Resources",tool:"Tools","pattern-source":"Pattern sources"},kh=class extends v{static properties={_v:{type:Number,default:0}};static template=t=>t._renderTemplate();#t=`admin-settings-h-${Math.random().toString(36).slice(2,8)}`;#e=null;#i=null;#s=new Set;#r=null;connected(){this.setAttribute("role","region"),this.setAttribute("aria-labelledby",this.#t),this.addEventListener("change",this.#c),this.addEventListener("input",this.#d),this.addEventListener("press",this.#u)}disconnected(){this.removeEventListener("change",this.#c),this.removeEventListener("input",this.#d),this.removeEventListener("press",this.#u),this.#r&&(this.#r(),this.#r=null)}get persona(){return this.#e}set persona(t){this.#e=t,this._v++}get store(){return this.#i}set store(t){this.#r&&(this.#r(),this.#r=null),this.#i=t,t?.subscribe&&(this.#r=t.subscribe(()=>{this._v++})),this._v++}_renderTemplate(){this._v;let t=this.#e,e=this.#i;if(!t)return Y`<div data-part="empty" role="status">No persona selected.</div>`;let i=this.#n(t);return Y`
|
|
562
|
+
<icon-ui slot="trailing" data-part="row-check" name="check" aria-hidden="true"></icon-ui>
|
|
563
|
+
</menu-item-ui>
|
|
564
|
+
`}#s(){return Y`<div data-part="empty" role="status">No personas yet.</div>`}#r=t=>{if(t.key!=="Enter"&&t.key!==" ")return;let e=t.target.closest?.('[data-part="row"]');e&&this.contains(e)&&(t.preventDefault(),e.click())};#n=t=>{let e=t.target.closest?.('[data-part="row"]');if(e&&this.contains(e)){let n=e.getAttribute("data-persona-id");n&&n!==this["active-id"]&&(this["active-id"]=n,this.dispatchEvent(new CustomEvent("persona-change",{bubbles:!0,detail:{personaId:n}})));return}let i=t.target.closest?.('[data-action="export"]');if(i&&this.contains(i)){this.#a();return}let r=t.target.closest?.('[data-action="import"]');r&&this.contains(r)&&this.#o()};#a(){let t=this["active-id"],e=(Array.isArray(this.personas)?this.personas:[]).find(a=>a.id===t);if(!e)return;let i=YO(e),r=new Blob([i],{type:"application/json"}),n=URL.createObjectURL(r),o=this.ownerDocument.createElement("a");o.href=n,o.download=`${e.id}.persona.json`,o.click(),URL.revokeObjectURL(n)}#o(){this.#e||(this.#e=this.ownerDocument.createElement("input"),this.#e.type="file",this.#e.accept="application/json",this.#e.setAttribute("data-part","import-file"),this.#e.style.display="none",this.appendChild(this.#e)),this.#e.value="",this.#e.click()}#l=async t=>{let e=t.target;if(!e||e!==this.#e)return;let i=e.files?.[0];if(i)try{let r=await i.text(),n=(Array.isArray(this.personas)?this.personas:[]).map(a=>a.id),o=HO(r,n);this.dispatchEvent(new CustomEvent("persona-import",{bubbles:!0,detail:{persona:o}}))}catch(r){this.dispatchEvent(new CustomEvent("persona-import-error",{bubbles:!0,detail:{error:r instanceof Error?r.message:String(r)}}))}}};customElements.get("admin-roster-ui")||customElements.define("admin-roster-ui",wh);function Xi(s,t){return`entry.${s}.${t}`}function GO(s,t){if(!s||!t)return s;let e=s.entries.map(i=>{let r=t.get(Xi(i.id,"enabled")),n=t.get(Xi(i.id,"order")),o=t.get(Xi(i.id,"content"));return{...i,enabled:typeof r=="boolean"?r:i.enabled,order:typeof n=="number"?n:i.order,content:typeof o=="string"?o:i.content}});return{...s,entries:e}}P();var bq={"prompt-section":"Prompt sections",skill:"Skills",workflow:"Workflows",resource:"Resources",tool:"Tools","pattern-source":"Pattern sources"},kh=class extends v{static properties={_v:{type:Number,default:0}};static template=t=>t._renderTemplate();#t=`admin-settings-h-${Math.random().toString(36).slice(2,8)}`;#e=null;#i=null;#s=new Set;#r=null;connected(){this.setAttribute("role","region"),this.setAttribute("aria-labelledby",this.#t),this.addEventListener("change",this.#c),this.addEventListener("input",this.#d),this.addEventListener("press",this.#u)}disconnected(){this.removeEventListener("change",this.#c),this.removeEventListener("input",this.#d),this.removeEventListener("press",this.#u),this.#r&&(this.#r(),this.#r=null)}get persona(){return this.#e}set persona(t){this.#e=t,this._v++}get store(){return this.#i}set store(t){this.#r&&(this.#r(),this.#r=null),this.#i=t,t?.subscribe&&(this.#r=t.subscribe(()=>{this._v++})),this._v++}_renderTemplate(){this._v;let t=this.#e,e=this.#i;if(!t)return Y`<div data-part="empty" role="status">No persona selected.</div>`;let i=this.#n(t);return Y`
|
|
565
565
|
<header data-part="header">
|
|
566
566
|
<h2 data-part="title" id=${this.#t}>${t.label??t.id} — Settings</h2>
|
|
567
567
|
</header>
|