@stacksjs/components 0.2.957 → 0.2.958

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.
@@ -0,0 +1,208 @@
1
+ <script server>
2
+ export const open = $bool($props.open)
3
+ export const initialQuery = $props.query || ''
4
+ export const className = $props.className || ''
5
+
6
+ const baseClasses = 'fixed inset-0 z-50 overflow-y-auto p-4 sm:p-6 md:p-20'
7
+ export const paletteClasses = `${baseClasses} ${className}`.trim()
8
+ export const paletteInstanceId = $uid
9
+ </script>
10
+
11
+ <script client>
12
+ const emit = defineEmits()
13
+ const paletteInstanceId = {{ paletteInstanceId }}
14
+ const isOpen = state({{ open }})
15
+ const query = state({{ initialQuery }})
16
+
17
+ function close() {
18
+ if (!isOpen()) return
19
+ isOpen.set(false)
20
+ setActive(null)
21
+ emit('close')
22
+ }
23
+
24
+ function show() {
25
+ if (isOpen()) return
26
+ isOpen.set(true)
27
+ }
28
+
29
+ function onQueryInput(event) {
30
+ query.set(event.target.value)
31
+ emit('query', event.target.value)
32
+ }
33
+
34
+ function onItemSelect(event) {
35
+ event.stopPropagation()
36
+ emit('select', event.detail)
37
+ close()
38
+ }
39
+
40
+ function panelEl() {
41
+ return document.querySelector(`[data-palette-id="${paletteInstanceId}"] [data-stx-command-palette-panel]`)
42
+ }
43
+
44
+ /*
45
+ * The keyboard, as a combobox (stacksjs/stx#2231). Focus stays in the search
46
+ * field so the user can keep typing; the command arrowed to is the ACTIVE
47
+ * option, named by aria-activedescendant on the field and marked
48
+ * aria-selected, and Enter clicks it, so it is selected exactly as a pointer
49
+ * selects it. The items used to be plain divs with only a click handler, so a
50
+ * keyboard could open the palette and close it and do nothing in between.
51
+ *
52
+ * Held as the element rather than an index: the page filters the results as
53
+ * the query changes, and an index would then point at a different command.
54
+ */
55
+ let activeItem = null
56
+
57
+ function listEl() {
58
+ return panelEl()?.querySelector('[data-stx-command-palette-list]') ?? null
59
+ }
60
+
61
+ /** The commands showing now: an item the page hid with :show or hidden is skipped. */
62
+ function itemElements() {
63
+ const list = listEl()
64
+ if (!list) return []
65
+ return Array.prototype.filter.call(list.querySelectorAll('[data-stx-command-item]'), (item) => {
66
+ for (let node = item; node && node !== list; node = node.parentElement) {
67
+ if (node.hidden || (node.style && node.style.display === 'none')) return false
68
+ }
69
+ return true
70
+ })
71
+ }
72
+
73
+ function setActive(item) {
74
+ activeItem = item
75
+ const items = itemElements()
76
+ const doc = panelEl()?.ownerDocument || document
77
+ items.forEach((option, index) => {
78
+ // aria-activedescendant needs an id that is unique on the page.
79
+ if (!option.id || doc.querySelectorAll('[id="' + option.id + '"]').length !== 1)
80
+ option.id = 'stx-command-option-' + paletteInstanceId + '-' + index
81
+ option.setAttribute('aria-selected', option === item ? 'true' : 'false')
82
+ })
83
+ const input = panelEl()?.querySelector('[data-stx-command-palette-input]')
84
+ if (!input) return
85
+ if (item) input.setAttribute('aria-activedescendant', item.id)
86
+ else input.removeAttribute('aria-activedescendant')
87
+ }
88
+
89
+ function moveActive(delta) {
90
+ const items = itemElements()
91
+ if (!items.length) return
92
+ const from = items.indexOf(activeItem)
93
+ const next = from < 0
94
+ ? (delta > 0 ? 0 : items.length - 1)
95
+ : (from + delta + items.length) % items.length
96
+ setActive(items[next])
97
+ // The list scrolls, and nothing moves focus there to bring the option in.
98
+ if (items[next].scrollIntoView) items[next].scrollIntoView({ block: 'nearest' })
99
+ }
100
+
101
+ function onPaletteKey(event) {
102
+ const key = event.key
103
+ if (key === 'ArrowDown' || key === 'ArrowUp') {
104
+ event.preventDefault()
105
+ moveActive(key === 'ArrowDown' ? 1 : -1)
106
+ }
107
+ else if (key === 'Home' || key === 'End') {
108
+ event.preventDefault()
109
+ activeItem = null
110
+ moveActive(key === 'Home' ? 1 : -1)
111
+ }
112
+ else if (key === 'Enter' && activeItem && itemElements().includes(activeItem)) {
113
+ event.preventDefault()
114
+ activeItem.click()
115
+ }
116
+ }
117
+
118
+ /*
119
+ * The results changed under the active command: keep it while it still
120
+ * shows, and point at nothing once it is gone rather than at a stale id.
121
+ */
122
+ let resultsObserver = null
123
+ onMount(() => {
124
+ const list = listEl()
125
+ if (!list || typeof MutationObserver === 'undefined') return
126
+ resultsObserver = new MutationObserver(() => {
127
+ if (activeItem && !itemElements().includes(activeItem)) setActive(null)
128
+ })
129
+ resultsObserver.observe(list, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'hidden'] })
130
+ })
131
+
132
+ /*
133
+ * The palette takes over the page, so it is a modal layer on the page's
134
+ * overlay stack (window.stx.overlays): the page held still behind it, focus
135
+ * straight into the search field and back to whatever opened it, Tab kept
136
+ * inside, and Escape for whichever overlay is on top. It used to listen for
137
+ * Escape on the document and do none of the rest, so focus stayed behind it
138
+ * and a palette opened from a dialog closed the dialog too (stacksjs/stx#2057).
139
+ */
140
+ effect(() => {
141
+ if (isOpen()) {
142
+ window.stx.overlays.open(paletteInstanceId, {
143
+ panel: panelEl,
144
+ onEscape: close,
145
+ initialFocus: () => panelEl()?.querySelector('input'),
146
+ })
147
+ }
148
+ else {
149
+ window.stx.overlays.close(paletteInstanceId)
150
+ }
151
+ })
152
+
153
+ onDestroy(() => {
154
+ window.stx.overlays.close(paletteInstanceId)
155
+ resultsObserver?.disconnect()
156
+ })
157
+
158
+ defineExpose({ isOpen, query, show, close })
159
+ </script>
160
+
161
+ <div
162
+ :show="isOpen()"
163
+ class="{{ paletteClasses }}"
164
+ data-stx-command-palette
165
+ data-palette-id="{{ paletteInstanceId }}"
166
+ @stx:command-select="onItemSelect($event)"
167
+ >
168
+ <div class="fixed inset-0 bg-neutral-500/25 dark:bg-neutral-500/50 transition-opacity" aria-hidden="true" @click="close()"></div>
169
+
170
+ <div
171
+ data-stx-command-palette-panel
172
+ role="dialog"
173
+ aria-modal="true"
174
+ aria-label="Command palette"
175
+ tabindex="-1"
176
+ class="mx-auto max-w-xl transform divide-y divide-line overflow-hidden rounded-xl bg-panel shadow-2xl ring-1 ring-line transition-all relative"
177
+ >
178
+ <div class="relative">
179
+ <svg class="pointer-events-none absolute top-3.5 left-4 h-5 w-5 text-fg-soft" viewBox="0 0 20 20" fill="currentColor">
180
+ <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
181
+ </svg>
182
+ <input
183
+ type="text"
184
+ role="combobox"
185
+ aria-expanded="true"
186
+ aria-autocomplete="list"
187
+ aria-controls="stx-command-palette-list-{{ paletteInstanceId }}"
188
+ data-stx-command-palette-input
189
+ class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-fg placeholder-fg-soft focus:ring-0 sm:text-sm"
190
+ placeholder="Search..."
191
+ aria-label="Search commands"
192
+ :value="query()"
193
+ @input="onQueryInput($event)"
194
+ @keydown="onPaletteKey($event)"
195
+ />
196
+ </div>
197
+
198
+ <div
199
+ id="stx-command-palette-list-{{ paletteInstanceId }}"
200
+ role="listbox"
201
+ aria-label="Commands"
202
+ data-stx-command-palette-list
203
+ class="max-h-96 overflow-y-auto py-2"
204
+ >
205
+ <slot />
206
+ </div>
207
+ </div>
208
+ </div>
@@ -3,7 +3,8 @@ export const className = $props.className || ''
3
3
  export const value = $props.value
4
4
  export const valueJson = JSON.stringify(value === undefined ? null : value)
5
5
 
6
- const baseClasses = 'flex cursor-pointer select-none items-center px-4 py-2 text-fg hover:bg-accent-solid hover:text-accent-ink'
6
+ // aria-selected marks the command the keyboard is on (CommandPalette's onPaletteKey).
7
+ const baseClasses = 'flex cursor-pointer select-none items-center px-4 py-2 text-fg hover:bg-accent-solid hover:text-accent-ink aria-selected:bg-accent-solid aria-selected:text-accent-ink'
7
8
  export const itemClasses = `${baseClasses} ${className}`.trim()
8
9
  </script>
9
10
 
@@ -33,6 +34,8 @@ function onClick(event) {
33
34
 
34
35
  <div
35
36
  class="{{ itemClasses }}"
37
+ role="option"
38
+ aria-selected="false"
36
39
  data-stx-command-item
37
40
  @click="onClick($event)"
38
41
  >
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var Ya={__stx:!0,src:"./components/CodeBlock.stx"};var Xa={__stx:!0,src:"./compo
8
8
  Documentation: ${s.docsUrl}`;else if(e)a+=`
9
9
  Documentation: https://stacksjs.com/components/${e.toLowerCase()}`;return a}toJSON(){return{name:this.name,message:this.message,component:this.component,context:this.context,stack:this.stack}}}var xe={invalidProp(e,t,s,a){return new X(e,`Invalid prop value for "${t}"`,{prop:t,received:s,expected:a,details:Array.isArray(a)?`The "${t}" prop must be one of the allowed values`:`The "${t}" prop does not match the expected type`})},requiredProp(e,t){return new X(e,`Required prop "${t}" is missing`,{prop:t,details:`The "${t}" prop is required for ${e} to function correctly`})},invalidType(e,t,s,a){return new X(e,`Invalid type for prop "${t}"`,{prop:t,received:typeof s,expected:a,details:`Expected "${t}" to be of type ${a}, but received ${typeof s}`})},componentNotFound(e){return new X("ComponentLoader",`Component "${e}" not found`,{component:e,details:"Make sure the component is properly imported and registered"})},invalidChildren(e,t,s){return new X(e,"Invalid children",{received:typeof t,expected:s,details:`${e} expects ${s} as children`})},stateUpdate(e,t,s){return new X(e,`Failed to update state "${t}"`,{details:s.message})},eventHandler(e,t,s){return new X(e,`Error in "${t}" event handler`,{details:s.message})},render(e,t){return new X(e,"Failed to render component",{details:t.message})}},Ve=null;function Qu(e){Ve=e}function ef(){Ve=null}function je(e,t={}){let{throwError:s=!0,logError:a=!0}=t;if(a){if(console.error("Component Error:",e),e instanceof X)console.group("Error Details"),console.log("Component:",e.component),console.log("Context:",e.context),console.groupEnd()}if(Ve)try{Ve(e)}catch(n){console.error("Error in error handler:",n)}if(s)throw e}function os(e,t,s){return(...a)=>{try{let n=e(...a);if(n instanceof Promise)return n.catch((o)=>{let i=xe.eventHandler(t,s,o);throw je(i,{throwError:!1}),i});return n}catch(n){let o=xe.eventHandler(t,s,n);throw je(o,{throwError:!1}),o}}}function Gn(e,t){if(!e)throw t}function Un(e,t,s={}){let a=X.formatMessage(e,t,s);console.warn(`\u26A0\uFE0F ${a}`)}function tf(e,t){Gn(e,t)}function sf(e){let t=typeof process<"u"&&process.env.DEBUG==="true";return{log(...s){if(t)console.log(`[${e}]`,...s)},warn(s,a){Un(e,s,a)},error(s,a){let n=new X(e,s,a);je(n,{throwError:!1})}}}function af(e,t,s){try{return t()}catch(a){let n=xe.render(e,a);return je(n,{throwError:!1}),s}}class _{validate;message;isRequired;constructor(e,t,s=!1){this.validate=e;this.message=t;this.isRequired=s}get required(){return new _(this.validate,this.message,!0)}}var f={string:new _((e)=>typeof e==="string",(e,t,s)=>`Invalid prop \`${t}\` of type \`${typeof e}\` supplied to \`${s}\`, expected \`string\`.`),number:new _((e)=>typeof e==="number"&&!Number.isNaN(e),(e,t,s)=>`Invalid prop \`${t}\` of type \`${typeof e}\` supplied to \`${s}\`, expected \`number\`.`),boolean:new _((e)=>typeof e==="boolean",(e,t,s)=>`Invalid prop \`${t}\` of type \`${typeof e}\` supplied to \`${s}\`, expected \`boolean\`.`),func:new _((e)=>typeof e==="function",(e,t,s)=>`Invalid prop \`${t}\` of type \`${typeof e}\` supplied to \`${s}\`, expected \`function\`.`),object:new _((e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),(e,t,s)=>`Invalid prop \`${t}\` of type \`${typeof e}\` supplied to \`${s}\`, expected \`object\`.`),array:new _((e)=>Array.isArray(e),(e,t,s)=>`Invalid prop \`${t}\` of type \`${typeof e}\` supplied to \`${s}\`, expected \`array\`.`),any:new _(()=>!0,()=>""),oneOf(e){return new _((t)=>e.includes(t),(t,s,a)=>`Invalid prop \`${s}\` of value \`${t}\` supplied to \`${a}\`, expected one of [${e.map((n)=>JSON.stringify(n)).join(", ")}].`)},oneOfType(e){return new _((t,s,a)=>e.some((n)=>n.validate(t,s,a)),(t,s,a)=>`Invalid prop \`${s}\` supplied to \`${a}\`, expected one of the specified types.`)},arrayOf(e){return new _((t,s,a)=>{if(!Array.isArray(t))return!1;return t.every((n,o)=>e.validate(n,`${s}[${o}]`,a))},(t,s,a)=>`Invalid prop \`${s}\` supplied to \`${a}\`, expected array of specified type.`)},shape(e){return new _((t,s,a)=>{if(typeof t!=="object"||t===null||Array.isArray(t))return!1;for(let[n,o]of Object.entries(e)){if(o.isRequired&&!(n in t))return!1;if(n in t&&!o.validate(t[n],`${s}.${n}`,a))return!1}return!0},(t,s,a)=>`Invalid prop \`${s}\` supplied to \`${a}\`, expected object matching specified shape.`)},instanceOf(e){return new _((t)=>t instanceof e,(t,s,a)=>`Invalid prop \`${s}\` supplied to \`${a}\`, expected instance of \`${e.name}\`.`)},custom(e,t){return new _(e,typeof t==="string"?()=>t:t)},min(e){return new _((t)=>typeof t==="number"&&t>=e,(t,s,a)=>`Invalid prop \`${s}\` of value \`${t}\` supplied to \`${a}\`, expected value >= ${e}.`)},max(e){return new _((t)=>typeof t==="number"&&t<=e,(t,s,a)=>`Invalid prop \`${s}\` of value \`${t}\` supplied to \`${a}\`, expected value <= ${e}.`)},range(e,t){return new _((s)=>typeof s==="number"&&s>=e&&s<=t,(s,a,n)=>`Invalid prop \`${a}\` of value \`${s}\` supplied to \`${n}\`, expected value between ${e} and ${t}.`)},pattern(e){return new _((t)=>typeof t==="string"&&e.test(t),(t,s,a)=>`Invalid prop \`${s}\` of value \`${t}\` supplied to \`${a}\`, expected value matching pattern ${e}.`)},email:new _((e)=>typeof e==="string"&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),(e,t,s)=>`Invalid prop \`${t}\` of value \`${e}\` supplied to \`${s}\`, expected valid email address.`),url:new _((e)=>{if(typeof e!=="string")return!1;try{let t=new URL(e);return!0}catch{return!1}},(e,t,s)=>`Invalid prop \`${t}\` of value \`${e}\` supplied to \`${s}\`, expected valid URL.`)};function Jn(e,t,s,a={}){let{throwOnError:n=!1,logWarnings:o=!0}=a,i=[];for(let[r,c]of Object.entries(s)){let l=t[r],d=l===void 0;if(c.isRequired&&d){let h=`Required prop \`${r}\` was not specified in \`${e}\`.`;i.push(h);continue}if(d)continue;if(!c.validate(l,r,e)){let h=c.message(l,r,e);i.push(h)}}if(i.length>0){if(o)console.group(`\u26A0\uFE0F Prop validation failed for \`${e}\``),i.forEach((r)=>console.warn(r)),console.groupEnd();if(n)throw Error(`Prop validation failed for \`${e}\`:
10
10
  ${i.join(`
11
- `)}`)}return{valid:i.length===0,errors:i}}function ae(e,t,s){return(a)=>Jn(e,a,t,s)}function of(e,t,s="value"){if(!t.validate(e,s,"assertion"))throw Error(t.message(e,s,"assertion"))}function rf(e,t,s="value"){if(!t.validate(e,s,"warning"))console.warn(t.message(e,s,"warning"))}var Xn="./Button-ghdfqwg0.stx";var Zn={variant:f.oneOf(["primary","secondary","outline","ghost","danger"]),appearance:f.oneOf(["mac"]),size:f.oneOf(["xs","sm","md","lg","xl"]),disabled:f.boolean,loading:f.boolean,type:f.oneOf(["button","submit","reset"]),fullWidth:f.boolean,label:f.string,text:f.string,leftIcon:f.string,rightIcon:f.string,className:f.string,onClick:f.func},hf=ae("Button",Zn);function uf(e){return os(e,"Button","onClick")}function ff(e){if(e&&!["primary","secondary","outline","ghost","danger"].includes(e))throw xe.invalidProp("Button","variant",e,["primary","secondary","outline","ghost","danger"])}function mf(e){if(e&&!["xs","sm","md","lg","xl"].includes(e))throw xe.invalidProp("Button","size",e,["xs","sm","md","lg","xl"])}var eo="./Calendar-p30eah6g.stx";var so="./DateRangePicker-4zmf34e4.stx";var no="./DateTimePicker-pz9p8jw4.stx";var Be=new Map;function is(e){let t=Be.get(e);if(!t){if(t=new Intl.DateTimeFormat("en-CA",{timeZone:e,calendar:"iso8601",numberingSystem:"latn",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),Be.size>=64)Be.clear();Be.set(e,t)}return t}function rs(e){if(typeof e!=="string"||!e)return!1;try{return is(e),!0}catch{return!1}}function St(e){if(e==null||e==="")return null;if(typeof e!=="string"&&!(e instanceof Date))return null;if(typeof e==="string"){let s=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/i.exec(e);if(!s||_e(s[1],s[2])==null)return null}let t=new Date(e instanceof Date?e.getTime():e);return Number.isFinite(t.getTime())?t.toISOString():null}function kt(e,t){let s=St(e);if(!s)return null;try{let a=Object.fromEntries(is(t).formatToParts(new Date(s)).map((n)=>[n.type,n.value]));return{date:`${a.year.padStart(4,"0")}-${a.month}-${a.day}`,time:`${a.hour}:${a.minute}`}}catch{return null}}function _e(e,t){let s=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e),a=/^(\d{2}):(\d{2})$/.exec(t);if(!s||!a)return null;let[n,o,i,r,c]=[+s[1],+s[2],+s[3],+a[1],+a[2]];if(n<100||o<1||o>12||i<1||r>23||c>59)return null;let l=Date.UTC(n,o-1,i,r,c),d=new Date(l);return d.getUTCFullYear()===n&&d.getUTCMonth()===o-1&&d.getUTCDate()===i?l:null}function oo(e,t,s,a="earlier"){let n=_e(e,t);if(n==null||!rs(s))return null;let o=new Set;for(let r of[-2,-1,0,1,2]){let c=n+r*86400000,l=kt(new Date(c),s);if(!l)continue;let d=_e(l.date,l.time);if(d!=null)o.add(d-c)}let i=[];for(let r of o){let c=n-r,l=kt(new Date(c),s);if(l?.date===e&&l.time===t)i.push(c)}if(!i.length)return null;return new Date(a==="later"?Math.max(...i):Math.min(...i)).toISOString()}function Tf(e,t,s="en-US"){let a=St(e);if(!a)return null;try{return new Intl.DateTimeFormat(s,{timeZone:t,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(new Date(a))}catch{return null}}function $f(e,t,s=new Date,a=null){if(!rs(t)||!Number.isFinite(s.getTime()))return null;if(e==="hour")return new Date(s.getTime()+3600000).toISOString();if(e==="suggested")return St(a);let n=kt(s,t);if(!n)return null;let o=_e(n.date,"00:00");if(o==null)return null;let i=new Date(o+86400000).toISOString().slice(0,10);return oo(i,"09:00",t)}var ro="./EmptyState-snj7gbsn.stx";var co="./ErrorState-qb7af5zb.stx";var ho="./ThemeToggle-4wm9zare.stx";var fo="./Card-r55zpjqh.stx";var go="./Checkbox-355qsbwd.stx";var bo="./ChoiceChips-8dcf172n.stx";var wo="./CodeEditor-kaywcb83.stx";var ko="./ColorSwatches-ecfxphjy.stx";var Co="./Combobox-9n04ec5w.stx";var $o="./ComboboxButton-4r6a45s1.stx";var Io="./ComboboxInput-1gyfpnca.stx";var Po="./ComboboxOption-wkw70js7.stx";var Ro="./ComboboxOptions-zhr9b6rx.stx";var Lo="./CommandPalette-qqjdbcyg.stx";var Oo="./CommandPaletteItem-7290ce1z.stx";var Ho="./ContextMenu-43g3w5tp.stx";function Ct(e,t=[]){let s=[];if(!Array.isArray(e))return s;for(let a of e){if(!a||typeof a!=="object")continue;if(a.separator){if(s.length>0&&!s[s.length-1].separator)s.push({separator:!0,id:"",path:[]});continue}s.push({...a,id:a.id==null?"":String(a.id),path:[]})}while(s.length>0&&s[s.length-1].separator)s.pop();return s.forEach((a,n)=>{if(a.path=[...t,n],a.separator||a.id==="")a.id=a.path.join(".");if(!a.separator&&Array.isArray(a.children))a.children=Ct(a.children,a.path)}),s}function ls(e){return Boolean(e)&&!e.separator}function cs(e){return Boolean(e)&&!e.separator&&!e.disabled}function be(e){return Boolean(e)&&!e.separator&&Array.isArray(e.children)&&e.children.length>0}function $e(e,t,s){let a=e.length;if(a===0)return-1;let n=t;for(let o=0;o<a;o++)if(n=n<0?s===1?0:a-1:(n+s+a)%a,ls(e[n]))return n;return-1}function Ee(e){return $e(e,-1,1)}function ds(e){return $e(e,-1,-1)}function ps(e,t,s){let a=s.toLowerCase();if(a===""||e.length===0)return-1;let n=a.length>1&&a.split("").every((r)=>r===a.charAt(0)),o=n?a.charAt(0):a,i=a.length===1||n?t+1:Math.max(t,0);for(let r=0;r<e.length;r++){let c=(i+r+e.length)%e.length,l=e[c];if(ls(l)&&(l.label||"").toLowerCase().startsWith(o))return c}return-1}function Fo(e,t){for(let s of e){if(s.separator)continue;if(s.id===t)return s;if(s.children){let a=Fo(s.children,t);if(a)return a}}return null}function hs(e,t,s,a=8){let n=(o,i,r)=>{if(o+i<=r-a)return o;if(o-i>=a)return o-i;return Math.max(a,r-a-i)};return{x:n(e.x,t.width,s.width),y:n(e.y,t.height,s.height)}}function us(e,t,s,a=8,n=4){let o=e.left;if(o+t.width>s.width-a)o=Math.max(a,Math.min(e.right-t.width,s.width-a-t.width));let i=e.bottom+n;if(i+t.height>s.height-a){let r=e.top-n-t.height;i=r>=a?r:Math.max(a,s.height-a-t.height)}return{x:Math.max(a,o),y:i}}function fs(e,t,s,a=8,n=4){let o="right",i=e.right-n;if(i+t.width>s.width-a){let c=e.left+n-t.width;if(c>=a)i=c,o="left";else i=Math.max(a,s.width-a-t.width)}let r=Math.max(a,Math.min(e.top-n,s.height-a-t.height));return{x:i,y:r,side:o}}var Vo={mod:"\u2318",meta:"\u2318",cmd:"\u2318",command:"\u2318",ctrl:"\u2303",control:"\u2303",alt:"\u2325",option:"\u2325",shift:"\u21E7"},jo={mod:"Ctrl",meta:"Win",cmd:"Ctrl",command:"Ctrl",ctrl:"Ctrl",control:"Ctrl",alt:"Alt",option:"Alt",shift:"Shift"},Bo={enter:"\u21A9",backspace:"\u232B",delete:"\u2326",escape:"\u238B",esc:"\u238B",tab:"\u21E5",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",space:"Space"},_o={escape:"Esc",esc:"Esc",delete:"Del",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",space:"Space"},Ko=["ctrl","control","alt","option","shift","mod","meta","cmd","command"],qo=["mod","ctrl","control","cmd","command","meta","alt","option","shift"];function ms(e){let s=(e.endsWith("++")?[...e.slice(0,-2).split("+"),"+"]:e.split("+")).map((n)=>n.trim()).filter((n)=>n!==""),a=s.pop()||"";return{modifiers:s.map((n)=>n.toLowerCase()),key:a}}function Ke(e){return e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}function gs(e,t){if(!e)return"";let{modifiers:s,key:a}=ms(e),n=t?Ko:qo,i=[...s].sort((c,l)=>n.indexOf(c)-n.indexOf(l)).map((c)=>(t?Vo:jo)[c]??Ke(c)),r=(t?Bo:_o)[a.toLowerCase()]??Ke(a);return t?i.join("")+r:[...new Set(i),r].join("+")}function xs(e,t){if(!e)return"";let{modifiers:s,key:a}=ms(e),n={mod:t?"Meta":"Control",meta:"Meta",cmd:"Meta",command:"Meta",ctrl:"Control",control:"Control",alt:"Alt",option:"Alt",shift:"Shift"};return[...new Set(s.map((o)=>n[o]??Ke(o))),Ke(a)].join("+")}var Wo=160,Go=600;function Uo(){let e=typeof navigator>"u"?"":navigator.platform||navigator.userAgent||"";return/mac|iphone|ipad/i.test(e)}var Jo=0;class Yo{root;callbacks;items;label;disabled;apple;layer;uid=`stx-menu-${++Jo}`;stack=[];target=null;returnFocus=null;hoverTimer=null;typed="";typedAt=0;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;if(this.items=t.items??null,this.label=t.label||"Context menu",this.disabled=Boolean(t.disabled),this.apple=t.apple??Uo(),this.layer=document.createElement("div"),this.layer.className="stx-menu-layer",this.layer.setAttribute("data-menu-layer",""),this.layer.__stx_inert_content=!0,"popover"in HTMLElement.prototype)this.layer.setAttribute("popover","manual");else this.layer.hidden=!0;this.root.appendChild(this.layer),this.listen(this.root,"contextmenu",(a)=>this.onContextMenu(a)),this.listen(this.root,"keydown",(a)=>this.onHostKeyDown(a)),this.listen(this.layer,"keydown",(a)=>this.onMenuKeyDown(a)),this.listen(this.layer,"click",(a)=>this.onMenuClick(a)),this.listen(this.layer,"pointermove",(a)=>this.onMenuPointerMove(a)),this.listen(this.layer,"contextmenu",(a)=>a.preventDefault()),this.root.setAttribute("data-menu-ready","")}get isOpen(){return this.stack.length>0}setItems(e){this.items=e??null}setDisabled(e){if(this.disabled=e,e)this.close("api")}setLabel(e){this.label=e||"Context menu"}open(e,t,s={}){this.close("api",!1);let a=e instanceof Element?e:null,n=s.target??a??null,o=t??(typeof this.items==="function"?this.items(n):this.items),i=Ct(o);if(i.length===0)return!1;this.target=n;let r=document.activeElement;this.returnFocus=r instanceof HTMLElement&&r!==document.body?r:null,this.showLayer();let c=this.buildMenu(i,null),l=c.element.getBoundingClientRect(),d={width:window.innerWidth,height:window.innerHeight},h=a?us(bs(a),l,d):hs(e,l,d);if(this.position(c.element,h),this.listenWhileOpen(),s.keyboard||a)this.focusItem(c,Ee(c.items));else c.element.focus({preventScroll:!0});return this.callbacks.onOpen?.({x:h.x,y:h.y,target:n,keyboard:Boolean(s.keyboard)}),!0}close(e="api",t=!0){if(!this.isOpen)return;this.clearHover();for(let a of this.stack)a.element.remove();this.stack=[],this.hideLayer(),this.stopListeningWhileOpen();let s=this.returnFocus;if(this.returnFocus=null,this.target=null,t&&e!=="outside"&&e!=="blur"&&s&&s.isConnected)s.focus({preventScroll:!0});this.callbacks.onClose?.({reason:e})}destroy(){this.close("api",!1);for(let e of this.disposers)e();this.layer.remove(),this.root.removeAttribute("data-menu-ready")}listen(e,t,s,a){e.addEventListener(t,s,a);let n=()=>e.removeEventListener(t,s,a);return this.disposers.push(n),n}whileOpen=[];listenWhileOpen(){let e=(s,a,n,o)=>{s.addEventListener(a,n,o),this.whileOpen.push(()=>s.removeEventListener(a,n,o))},t=(s)=>{if(!(s.target instanceof Node)||!this.layer.contains(s.target))this.close("outside")};e(document,"pointerdown",t,{capture:!0}),e(document,"scroll",t,{capture:!0,passive:!0}),e(window,"resize",()=>this.close("blur")),e(window,"blur",()=>this.close("blur"))}stopListeningWhileOpen(){for(let e of this.whileOpen)e();this.whileOpen=[]}showLayer(){if(this.layer.hasAttribute("popover"))try{this.layer.showPopover()}catch{}else this.layer.hidden=!1}hideLayer(){if(this.layer.hasAttribute("popover"))try{this.layer.hidePopover()}catch{}else this.layer.hidden=!0}position(e,t){e.style.left=`${Math.round(t.x)}px`,e.style.top=`${Math.round(t.y)}px`}buildMenu(e,t){let s=document.createElement("div");if(s.className="stx-menu",s.setAttribute("role","menu"),s.setAttribute("tabindex","-1"),s.setAttribute("data-menu-depth",String(this.stack.length)),t)s.setAttribute("aria-labelledby",t.id);else s.setAttribute("aria-label",this.label);e.forEach((n,o)=>{if(n.separator){let l=document.createElement("div");l.className="stx-menu-separator",l.setAttribute("role","separator"),s.appendChild(l);return}let i=document.createElement("div");if(i.className="stx-menu-item",i.id=`${this.uid}-${n.path.join("-")}`,i.setAttribute("role",typeof n.checked==="boolean"?"menuitemcheckbox":"menuitem"),i.setAttribute("tabindex","-1"),i.setAttribute("data-menu-index",String(o)),i.setAttribute("data-menu-id",n.id),typeof n.checked==="boolean")i.setAttribute("aria-checked",String(n.checked));if(n.disabled)i.setAttribute("aria-disabled","true");if(n.danger)i.setAttribute("data-danger","");let r=document.createElement("span");r.className="stx-menu-check",r.setAttribute("aria-hidden","true"),r.textContent=n.checked===!0?"\u2713":"",i.appendChild(r);let c=document.createElement("span");if(c.className="stx-menu-label",c.textContent=n.label||"",i.appendChild(c),be(n)){i.setAttribute("aria-haspopup","menu"),i.setAttribute("aria-expanded","false");let l=document.createElement("span");l.className="stx-menu-arrow",l.setAttribute("aria-hidden","true"),l.textContent="\u203A",i.appendChild(l)}else if(n.shortcut){i.setAttribute("aria-keyshortcuts",xs(n.shortcut,this.apple));let l=document.createElement("span");l.className="stx-menu-shortcut",l.setAttribute("aria-hidden","true"),l.textContent=gs(n.shortcut,this.apple),i.appendChild(l)}s.appendChild(i)}),this.layer.appendChild(s);let a={element:s,items:e,opener:t};return this.stack.push(a),a}menuOf(e){if(!(e instanceof Element))return null;let t=e.closest(".stx-menu");return this.stack.find((s)=>s.element===t)??null}rowAt(e,t){return t<0?null:e.element.querySelector(`:scope > [data-menu-index="${t}"]`)}activeIndex(e){let t=document.activeElement;if(!(t instanceof HTMLElement)||t.parentElement!==e.element)return-1;let s=Number(t.getAttribute("data-menu-index"));return Number.isInteger(s)?s:-1}focusItem(e,t){let s=this.rowAt(e,t);if(s)s.focus({preventScroll:!1});else e.element.focus({preventScroll:!0})}closeBelow(e){let t=this.stack.indexOf(e);for(let s of this.stack.splice(t+1))s.opener?.setAttribute("aria-expanded","false"),s.element.remove()}openSubmenu(e,t,s){let a=e.items[t],n=this.rowAt(e,t);if(!n||!be(a)||a.disabled)return;let o=this.stack[this.stack.indexOf(e)+1];if(o&&o.opener===n){if(s)this.focusItem(o,Ee(o.items));return}this.closeBelow(e),n.setAttribute("aria-expanded","true");let i=this.buildMenu(a.children,n),r=fs(bs(n),i.element.getBoundingClientRect(),{width:window.innerWidth,height:window.innerHeight});if(i.element.setAttribute("data-side",r.side),this.position(i.element,r),s)this.focusItem(i,Ee(i.items))}choose(e,t){let s=e.items[t];if(!cs(s))return;if(be(s)){this.openSubmenu(e,t,!0);return}let{children:a,path:n,id:o,...i}=s,r={item:{...i,id:o},id:o,path:[...n],target:this.target};this.close("select"),this.callbacks.onSelect?.(r)}clearHover(){if(this.hoverTimer)clearTimeout(this.hoverTimer);this.hoverTimer=null}onContextMenu(e){if(this.disabled||this.layer.contains(e.target))return;let t=e.target instanceof Element?e.target:null;if(e.button!==2&&e.detail===0&&e.clientX===0&&e.clientY===0&&t?this.open(t,null,{keyboard:!0,target:t}):this.open({x:e.clientX,y:e.clientY},null,{target:t}))e.preventDefault()}onHostKeyDown(e){if(this.disabled||this.isOpen||this.layer.contains(e.target))return;if(e.key!=="ContextMenu"&&!(e.key==="F10"&&e.shiftKey))return;let t=e.target instanceof Element?e.target:null;if(t&&this.open(t,null,{keyboard:!0,target:t}))e.preventDefault()}onMenuClick(e){let t=this.menuOf(e.target),s=e.target instanceof Element?e.target.closest(".stx-menu-item"):null;if(!t||!s)return;this.choose(t,Number(s.getAttribute("data-menu-index")))}onMenuPointerMove(e){let t=this.menuOf(e.target),s=e.target instanceof Element?e.target.closest(".stx-menu-item"):null;if(!t||!s||document.activeElement===s)return;let a=Number(s.getAttribute("data-menu-index"));s.focus({preventScroll:!0}),this.clearHover(),this.hoverTimer=setTimeout(()=>{if(document.activeElement!==s)return;if(be(t.items[a]))this.openSubmenu(t,a,!1);else this.closeBelow(t)},Wo)}onMenuKeyDown(e){let t=this.menuOf(e.target)??this.stack[this.stack.length-1];if(!t)return;let s=this.activeIndex(t),a=this.stack.indexOf(t),n=!0;switch(e.key){case"ArrowDown":this.focusItem(t,$e(t.items,s,1));break;case"ArrowUp":this.focusItem(t,$e(t.items,s,-1));break;case"Home":case"PageUp":this.focusItem(t,Ee(t.items));break;case"End":case"PageDown":this.focusItem(t,ds(t.items));break;case"ArrowRight":if(be(t.items[s]))this.openSubmenu(t,s,!0);break;case"ArrowLeft":if(a>0)this.closeSubmenu(t);break;case"Escape":if(a>0)this.closeSubmenu(t);else this.close("escape");break;case"Enter":case" ":if(s>=0)this.choose(t,s);break;case"Tab":this.close("tab"),n=!1;break;default:n=this.typeAhead(t,s,e)}if(n)e.preventDefault(),e.stopPropagation()}closeSubmenu(e){let t=e.opener,s=this.stack[this.stack.indexOf(e)-1];if(s)this.closeBelow(s);t?.focus({preventScroll:!0})}typeAhead(e,t,s){if(s.key.length!==1||s.metaKey||s.ctrlKey||s.altKey)return!1;let a=Date.now();this.typed=a-this.typedAt>Go?s.key:this.typed+s.key,this.typedAt=a;let n=ps(e.items,t,this.typed);if(n>=0)this.focusItem(e,n);return!0}}function bs(e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}var Tm=48,$m=2000,Em=420,Im=160,Xo=/^-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,Zo=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;function Ae(e,t){let s=new WeakSet,a=JSON.stringify(e,(n,o)=>{if(typeof o==="bigint")return o.toString();if(typeof o==="object"&&o!==null){if(s.has(o))return"[Circular]";s.add(o)}return o},t);return a===void 0?"null":a}function ne(e,t){if(t.accessor)return t.accessor(e);return e==null?void 0:e[t.key]}function Qo(e){let t=0,s=0,a=0,n=0,o=0;for(let i of e){if(i===null||i===void 0||i==="")continue;if(t++,typeof i==="number"||typeof i==="bigint")s++;else if(typeof i==="boolean")n++;else if(i instanceof Date)a++;else if(typeof i==="object")o++;else if(typeof i==="string"){let r=i.trim();if(Xo.test(r))s++;else if(Zo.test(r)&&!Number.isNaN(Date.parse(r)))a++}}if(t===0)return"string";if(s===t)return"number";if(a===t)return"date";if(n===t)return"boolean";if(o===t)return"json";return"string"}function ei(e,t=200){let s=[],a=new Set,n=Math.min(e.length,t);for(let o=0;o<n;o++){let i=e[o];if(i===null||typeof i!=="object")continue;if(Array.isArray(i)){for(let r=0;r<i.length;r++){let c=String(r);if(!a.has(c))a.add(c),s.push(c)}continue}for(let r in i)if(!a.has(r))a.add(r),s.push(r)}if(s.length>0&&s.every((o)=>/^\d+$/.test(o)))s.sort((o,i)=>Number(o)-Number(i));return s.map((o)=>({key:o}))}function ys(e){if(e===null)return"null";return e===void 0?"undefined":"value"}function Ie(e,t="string"){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean"||typeof e==="bigint")return String(e);if(e instanceof Date)return Number.isNaN(e.getTime())?"Invalid Date":e.toISOString();if(typeof e==="object"||t==="json"){let s=Ae(e);return s.length>160?`${s.slice(0,160)}...`:s}return String(e)}function ks(e){return Ae(e)}function Ss(e,t){let s={};for(let a of t){let n=ne(e,a);s[a.key]=n===void 0?null:n}return s}function Cs(e,t){return Ae(Ss(e,t),2)}function ti(e,t){return Ae(e.map((s)=>Ss(s,t)),2)}function vs(e){if(e===null||e===void 0)return"";let t;if(typeof e==="string")t=e;else if(e instanceof Date)t=Number.isNaN(e.getTime())?"":e.toISOString();else if(typeof e==="object")t=Ae(e);else t=String(e);if(/[",\r\n]/.test(t)||t!==t.trim())return`"${t.replace(/"/g,'""')}"`;return t}function si(e,t){let s=Array.from({length:e.length+1});s[0]=t.map((n)=>vs(n.label??n.key)).join(",");let a=t.length;for(let n=0;n<e.length;n++){let o=e[n],i="";for(let r=0;r<a;r++){if(r>0)i+=",";i+=vs(ne(o,t[r]))}s[n+1]=i}return`${s.join(`\r
11
+ `)}`)}return{valid:i.length===0,errors:i}}function ae(e,t,s){return(a)=>Jn(e,a,t,s)}function of(e,t,s="value"){if(!t.validate(e,s,"assertion"))throw Error(t.message(e,s,"assertion"))}function rf(e,t,s="value"){if(!t.validate(e,s,"warning"))console.warn(t.message(e,s,"warning"))}var Xn="./Button-ghdfqwg0.stx";var Zn={variant:f.oneOf(["primary","secondary","outline","ghost","danger"]),appearance:f.oneOf(["mac"]),size:f.oneOf(["xs","sm","md","lg","xl"]),disabled:f.boolean,loading:f.boolean,type:f.oneOf(["button","submit","reset"]),fullWidth:f.boolean,label:f.string,text:f.string,leftIcon:f.string,rightIcon:f.string,className:f.string,onClick:f.func},hf=ae("Button",Zn);function uf(e){return os(e,"Button","onClick")}function ff(e){if(e&&!["primary","secondary","outline","ghost","danger"].includes(e))throw xe.invalidProp("Button","variant",e,["primary","secondary","outline","ghost","danger"])}function mf(e){if(e&&!["xs","sm","md","lg","xl"].includes(e))throw xe.invalidProp("Button","size",e,["xs","sm","md","lg","xl"])}var eo="./Calendar-p30eah6g.stx";var so="./DateRangePicker-4zmf34e4.stx";var no="./DateTimePicker-pz9p8jw4.stx";var Be=new Map;function is(e){let t=Be.get(e);if(!t){if(t=new Intl.DateTimeFormat("en-CA",{timeZone:e,calendar:"iso8601",numberingSystem:"latn",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),Be.size>=64)Be.clear();Be.set(e,t)}return t}function rs(e){if(typeof e!=="string"||!e)return!1;try{return is(e),!0}catch{return!1}}function St(e){if(e==null||e==="")return null;if(typeof e!=="string"&&!(e instanceof Date))return null;if(typeof e==="string"){let s=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/i.exec(e);if(!s||_e(s[1],s[2])==null)return null}let t=new Date(e instanceof Date?e.getTime():e);return Number.isFinite(t.getTime())?t.toISOString():null}function kt(e,t){let s=St(e);if(!s)return null;try{let a=Object.fromEntries(is(t).formatToParts(new Date(s)).map((n)=>[n.type,n.value]));return{date:`${a.year.padStart(4,"0")}-${a.month}-${a.day}`,time:`${a.hour}:${a.minute}`}}catch{return null}}function _e(e,t){let s=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e),a=/^(\d{2}):(\d{2})$/.exec(t);if(!s||!a)return null;let[n,o,i,r,c]=[+s[1],+s[2],+s[3],+a[1],+a[2]];if(n<100||o<1||o>12||i<1||r>23||c>59)return null;let l=Date.UTC(n,o-1,i,r,c),d=new Date(l);return d.getUTCFullYear()===n&&d.getUTCMonth()===o-1&&d.getUTCDate()===i?l:null}function oo(e,t,s,a="earlier"){let n=_e(e,t);if(n==null||!rs(s))return null;let o=new Set;for(let r of[-2,-1,0,1,2]){let c=n+r*86400000,l=kt(new Date(c),s);if(!l)continue;let d=_e(l.date,l.time);if(d!=null)o.add(d-c)}let i=[];for(let r of o){let c=n-r,l=kt(new Date(c),s);if(l?.date===e&&l.time===t)i.push(c)}if(!i.length)return null;return new Date(a==="later"?Math.max(...i):Math.min(...i)).toISOString()}function Tf(e,t,s="en-US"){let a=St(e);if(!a)return null;try{return new Intl.DateTimeFormat(s,{timeZone:t,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(new Date(a))}catch{return null}}function $f(e,t,s=new Date,a=null){if(!rs(t)||!Number.isFinite(s.getTime()))return null;if(e==="hour")return new Date(s.getTime()+3600000).toISOString();if(e==="suggested")return St(a);let n=kt(s,t);if(!n)return null;let o=_e(n.date,"00:00");if(o==null)return null;let i=new Date(o+86400000).toISOString().slice(0,10);return oo(i,"09:00",t)}var ro="./EmptyState-snj7gbsn.stx";var co="./ErrorState-qb7af5zb.stx";var ho="./ThemeToggle-4wm9zare.stx";var fo="./Card-r55zpjqh.stx";var go="./Checkbox-355qsbwd.stx";var bo="./ChoiceChips-8dcf172n.stx";var wo="./CodeEditor-kaywcb83.stx";var ko="./ColorSwatches-ecfxphjy.stx";var Co="./Combobox-9n04ec5w.stx";var $o="./ComboboxButton-4r6a45s1.stx";var Io="./ComboboxInput-1gyfpnca.stx";var Po="./ComboboxOption-wkw70js7.stx";var Ro="./ComboboxOptions-zhr9b6rx.stx";var Lo="./CommandPalette-cj6pe5ph.stx";var Oo="./CommandPaletteItem-bzvp48j8.stx";var Ho="./ContextMenu-43g3w5tp.stx";function Ct(e,t=[]){let s=[];if(!Array.isArray(e))return s;for(let a of e){if(!a||typeof a!=="object")continue;if(a.separator){if(s.length>0&&!s[s.length-1].separator)s.push({separator:!0,id:"",path:[]});continue}s.push({...a,id:a.id==null?"":String(a.id),path:[]})}while(s.length>0&&s[s.length-1].separator)s.pop();return s.forEach((a,n)=>{if(a.path=[...t,n],a.separator||a.id==="")a.id=a.path.join(".");if(!a.separator&&Array.isArray(a.children))a.children=Ct(a.children,a.path)}),s}function ls(e){return Boolean(e)&&!e.separator}function cs(e){return Boolean(e)&&!e.separator&&!e.disabled}function be(e){return Boolean(e)&&!e.separator&&Array.isArray(e.children)&&e.children.length>0}function $e(e,t,s){let a=e.length;if(a===0)return-1;let n=t;for(let o=0;o<a;o++)if(n=n<0?s===1?0:a-1:(n+s+a)%a,ls(e[n]))return n;return-1}function Ee(e){return $e(e,-1,1)}function ds(e){return $e(e,-1,-1)}function ps(e,t,s){let a=s.toLowerCase();if(a===""||e.length===0)return-1;let n=a.length>1&&a.split("").every((r)=>r===a.charAt(0)),o=n?a.charAt(0):a,i=a.length===1||n?t+1:Math.max(t,0);for(let r=0;r<e.length;r++){let c=(i+r+e.length)%e.length,l=e[c];if(ls(l)&&(l.label||"").toLowerCase().startsWith(o))return c}return-1}function Fo(e,t){for(let s of e){if(s.separator)continue;if(s.id===t)return s;if(s.children){let a=Fo(s.children,t);if(a)return a}}return null}function hs(e,t,s,a=8){let n=(o,i,r)=>{if(o+i<=r-a)return o;if(o-i>=a)return o-i;return Math.max(a,r-a-i)};return{x:n(e.x,t.width,s.width),y:n(e.y,t.height,s.height)}}function us(e,t,s,a=8,n=4){let o=e.left;if(o+t.width>s.width-a)o=Math.max(a,Math.min(e.right-t.width,s.width-a-t.width));let i=e.bottom+n;if(i+t.height>s.height-a){let r=e.top-n-t.height;i=r>=a?r:Math.max(a,s.height-a-t.height)}return{x:Math.max(a,o),y:i}}function fs(e,t,s,a=8,n=4){let o="right",i=e.right-n;if(i+t.width>s.width-a){let c=e.left+n-t.width;if(c>=a)i=c,o="left";else i=Math.max(a,s.width-a-t.width)}let r=Math.max(a,Math.min(e.top-n,s.height-a-t.height));return{x:i,y:r,side:o}}var Vo={mod:"\u2318",meta:"\u2318",cmd:"\u2318",command:"\u2318",ctrl:"\u2303",control:"\u2303",alt:"\u2325",option:"\u2325",shift:"\u21E7"},jo={mod:"Ctrl",meta:"Win",cmd:"Ctrl",command:"Ctrl",ctrl:"Ctrl",control:"Ctrl",alt:"Alt",option:"Alt",shift:"Shift"},Bo={enter:"\u21A9",backspace:"\u232B",delete:"\u2326",escape:"\u238B",esc:"\u238B",tab:"\u21E5",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",space:"Space"},_o={escape:"Esc",esc:"Esc",delete:"Del",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",space:"Space"},Ko=["ctrl","control","alt","option","shift","mod","meta","cmd","command"],qo=["mod","ctrl","control","cmd","command","meta","alt","option","shift"];function ms(e){let s=(e.endsWith("++")?[...e.slice(0,-2).split("+"),"+"]:e.split("+")).map((n)=>n.trim()).filter((n)=>n!==""),a=s.pop()||"";return{modifiers:s.map((n)=>n.toLowerCase()),key:a}}function Ke(e){return e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}function gs(e,t){if(!e)return"";let{modifiers:s,key:a}=ms(e),n=t?Ko:qo,i=[...s].sort((c,l)=>n.indexOf(c)-n.indexOf(l)).map((c)=>(t?Vo:jo)[c]??Ke(c)),r=(t?Bo:_o)[a.toLowerCase()]??Ke(a);return t?i.join("")+r:[...new Set(i),r].join("+")}function xs(e,t){if(!e)return"";let{modifiers:s,key:a}=ms(e),n={mod:t?"Meta":"Control",meta:"Meta",cmd:"Meta",command:"Meta",ctrl:"Control",control:"Control",alt:"Alt",option:"Alt",shift:"Shift"};return[...new Set(s.map((o)=>n[o]??Ke(o))),Ke(a)].join("+")}var Wo=160,Go=600;function Uo(){let e=typeof navigator>"u"?"":navigator.platform||navigator.userAgent||"";return/mac|iphone|ipad/i.test(e)}var Jo=0;class Yo{root;callbacks;items;label;disabled;apple;layer;uid=`stx-menu-${++Jo}`;stack=[];target=null;returnFocus=null;hoverTimer=null;typed="";typedAt=0;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;if(this.items=t.items??null,this.label=t.label||"Context menu",this.disabled=Boolean(t.disabled),this.apple=t.apple??Uo(),this.layer=document.createElement("div"),this.layer.className="stx-menu-layer",this.layer.setAttribute("data-menu-layer",""),this.layer.__stx_inert_content=!0,"popover"in HTMLElement.prototype)this.layer.setAttribute("popover","manual");else this.layer.hidden=!0;this.root.appendChild(this.layer),this.listen(this.root,"contextmenu",(a)=>this.onContextMenu(a)),this.listen(this.root,"keydown",(a)=>this.onHostKeyDown(a)),this.listen(this.layer,"keydown",(a)=>this.onMenuKeyDown(a)),this.listen(this.layer,"click",(a)=>this.onMenuClick(a)),this.listen(this.layer,"pointermove",(a)=>this.onMenuPointerMove(a)),this.listen(this.layer,"contextmenu",(a)=>a.preventDefault()),this.root.setAttribute("data-menu-ready","")}get isOpen(){return this.stack.length>0}setItems(e){this.items=e??null}setDisabled(e){if(this.disabled=e,e)this.close("api")}setLabel(e){this.label=e||"Context menu"}open(e,t,s={}){this.close("api",!1);let a=e instanceof Element?e:null,n=s.target??a??null,o=t??(typeof this.items==="function"?this.items(n):this.items),i=Ct(o);if(i.length===0)return!1;this.target=n;let r=document.activeElement;this.returnFocus=r instanceof HTMLElement&&r!==document.body?r:null,this.showLayer();let c=this.buildMenu(i,null),l=c.element.getBoundingClientRect(),d={width:window.innerWidth,height:window.innerHeight},h=a?us(bs(a),l,d):hs(e,l,d);if(this.position(c.element,h),this.listenWhileOpen(),s.keyboard||a)this.focusItem(c,Ee(c.items));else c.element.focus({preventScroll:!0});return this.callbacks.onOpen?.({x:h.x,y:h.y,target:n,keyboard:Boolean(s.keyboard)}),!0}close(e="api",t=!0){if(!this.isOpen)return;this.clearHover();for(let a of this.stack)a.element.remove();this.stack=[],this.hideLayer(),this.stopListeningWhileOpen();let s=this.returnFocus;if(this.returnFocus=null,this.target=null,t&&e!=="outside"&&e!=="blur"&&s&&s.isConnected)s.focus({preventScroll:!0});this.callbacks.onClose?.({reason:e})}destroy(){this.close("api",!1);for(let e of this.disposers)e();this.layer.remove(),this.root.removeAttribute("data-menu-ready")}listen(e,t,s,a){e.addEventListener(t,s,a);let n=()=>e.removeEventListener(t,s,a);return this.disposers.push(n),n}whileOpen=[];listenWhileOpen(){let e=(s,a,n,o)=>{s.addEventListener(a,n,o),this.whileOpen.push(()=>s.removeEventListener(a,n,o))},t=(s)=>{if(!(s.target instanceof Node)||!this.layer.contains(s.target))this.close("outside")};e(document,"pointerdown",t,{capture:!0}),e(document,"scroll",t,{capture:!0,passive:!0}),e(window,"resize",()=>this.close("blur")),e(window,"blur",()=>this.close("blur"))}stopListeningWhileOpen(){for(let e of this.whileOpen)e();this.whileOpen=[]}showLayer(){if(this.layer.hasAttribute("popover"))try{this.layer.showPopover()}catch{}else this.layer.hidden=!1}hideLayer(){if(this.layer.hasAttribute("popover"))try{this.layer.hidePopover()}catch{}else this.layer.hidden=!0}position(e,t){e.style.left=`${Math.round(t.x)}px`,e.style.top=`${Math.round(t.y)}px`}buildMenu(e,t){let s=document.createElement("div");if(s.className="stx-menu",s.setAttribute("role","menu"),s.setAttribute("tabindex","-1"),s.setAttribute("data-menu-depth",String(this.stack.length)),t)s.setAttribute("aria-labelledby",t.id);else s.setAttribute("aria-label",this.label);e.forEach((n,o)=>{if(n.separator){let l=document.createElement("div");l.className="stx-menu-separator",l.setAttribute("role","separator"),s.appendChild(l);return}let i=document.createElement("div");if(i.className="stx-menu-item",i.id=`${this.uid}-${n.path.join("-")}`,i.setAttribute("role",typeof n.checked==="boolean"?"menuitemcheckbox":"menuitem"),i.setAttribute("tabindex","-1"),i.setAttribute("data-menu-index",String(o)),i.setAttribute("data-menu-id",n.id),typeof n.checked==="boolean")i.setAttribute("aria-checked",String(n.checked));if(n.disabled)i.setAttribute("aria-disabled","true");if(n.danger)i.setAttribute("data-danger","");let r=document.createElement("span");r.className="stx-menu-check",r.setAttribute("aria-hidden","true"),r.textContent=n.checked===!0?"\u2713":"",i.appendChild(r);let c=document.createElement("span");if(c.className="stx-menu-label",c.textContent=n.label||"",i.appendChild(c),be(n)){i.setAttribute("aria-haspopup","menu"),i.setAttribute("aria-expanded","false");let l=document.createElement("span");l.className="stx-menu-arrow",l.setAttribute("aria-hidden","true"),l.textContent="\u203A",i.appendChild(l)}else if(n.shortcut){i.setAttribute("aria-keyshortcuts",xs(n.shortcut,this.apple));let l=document.createElement("span");l.className="stx-menu-shortcut",l.setAttribute("aria-hidden","true"),l.textContent=gs(n.shortcut,this.apple),i.appendChild(l)}s.appendChild(i)}),this.layer.appendChild(s);let a={element:s,items:e,opener:t};return this.stack.push(a),a}menuOf(e){if(!(e instanceof Element))return null;let t=e.closest(".stx-menu");return this.stack.find((s)=>s.element===t)??null}rowAt(e,t){return t<0?null:e.element.querySelector(`:scope > [data-menu-index="${t}"]`)}activeIndex(e){let t=document.activeElement;if(!(t instanceof HTMLElement)||t.parentElement!==e.element)return-1;let s=Number(t.getAttribute("data-menu-index"));return Number.isInteger(s)?s:-1}focusItem(e,t){let s=this.rowAt(e,t);if(s)s.focus({preventScroll:!1});else e.element.focus({preventScroll:!0})}closeBelow(e){let t=this.stack.indexOf(e);for(let s of this.stack.splice(t+1))s.opener?.setAttribute("aria-expanded","false"),s.element.remove()}openSubmenu(e,t,s){let a=e.items[t],n=this.rowAt(e,t);if(!n||!be(a)||a.disabled)return;let o=this.stack[this.stack.indexOf(e)+1];if(o&&o.opener===n){if(s)this.focusItem(o,Ee(o.items));return}this.closeBelow(e),n.setAttribute("aria-expanded","true");let i=this.buildMenu(a.children,n),r=fs(bs(n),i.element.getBoundingClientRect(),{width:window.innerWidth,height:window.innerHeight});if(i.element.setAttribute("data-side",r.side),this.position(i.element,r),s)this.focusItem(i,Ee(i.items))}choose(e,t){let s=e.items[t];if(!cs(s))return;if(be(s)){this.openSubmenu(e,t,!0);return}let{children:a,path:n,id:o,...i}=s,r={item:{...i,id:o},id:o,path:[...n],target:this.target};this.close("select"),this.callbacks.onSelect?.(r)}clearHover(){if(this.hoverTimer)clearTimeout(this.hoverTimer);this.hoverTimer=null}onContextMenu(e){if(this.disabled||this.layer.contains(e.target))return;let t=e.target instanceof Element?e.target:null;if(e.button!==2&&e.detail===0&&e.clientX===0&&e.clientY===0&&t?this.open(t,null,{keyboard:!0,target:t}):this.open({x:e.clientX,y:e.clientY},null,{target:t}))e.preventDefault()}onHostKeyDown(e){if(this.disabled||this.isOpen||this.layer.contains(e.target))return;if(e.key!=="ContextMenu"&&!(e.key==="F10"&&e.shiftKey))return;let t=e.target instanceof Element?e.target:null;if(t&&this.open(t,null,{keyboard:!0,target:t}))e.preventDefault()}onMenuClick(e){let t=this.menuOf(e.target),s=e.target instanceof Element?e.target.closest(".stx-menu-item"):null;if(!t||!s)return;this.choose(t,Number(s.getAttribute("data-menu-index")))}onMenuPointerMove(e){let t=this.menuOf(e.target),s=e.target instanceof Element?e.target.closest(".stx-menu-item"):null;if(!t||!s||document.activeElement===s)return;let a=Number(s.getAttribute("data-menu-index"));s.focus({preventScroll:!0}),this.clearHover(),this.hoverTimer=setTimeout(()=>{if(document.activeElement!==s)return;if(be(t.items[a]))this.openSubmenu(t,a,!1);else this.closeBelow(t)},Wo)}onMenuKeyDown(e){let t=this.menuOf(e.target)??this.stack[this.stack.length-1];if(!t)return;let s=this.activeIndex(t),a=this.stack.indexOf(t),n=!0;switch(e.key){case"ArrowDown":this.focusItem(t,$e(t.items,s,1));break;case"ArrowUp":this.focusItem(t,$e(t.items,s,-1));break;case"Home":case"PageUp":this.focusItem(t,Ee(t.items));break;case"End":case"PageDown":this.focusItem(t,ds(t.items));break;case"ArrowRight":if(be(t.items[s]))this.openSubmenu(t,s,!0);break;case"ArrowLeft":if(a>0)this.closeSubmenu(t);break;case"Escape":if(a>0)this.closeSubmenu(t);else this.close("escape");break;case"Enter":case" ":if(s>=0)this.choose(t,s);break;case"Tab":this.close("tab"),n=!1;break;default:n=this.typeAhead(t,s,e)}if(n)e.preventDefault(),e.stopPropagation()}closeSubmenu(e){let t=e.opener,s=this.stack[this.stack.indexOf(e)-1];if(s)this.closeBelow(s);t?.focus({preventScroll:!0})}typeAhead(e,t,s){if(s.key.length!==1||s.metaKey||s.ctrlKey||s.altKey)return!1;let a=Date.now();this.typed=a-this.typedAt>Go?s.key:this.typed+s.key,this.typedAt=a;let n=ps(e.items,t,this.typed);if(n>=0)this.focusItem(e,n);return!0}}function bs(e){let t=e.getBoundingClientRect();return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}var Tm=48,$m=2000,Em=420,Im=160,Xo=/^-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i,Zo=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;function Ae(e,t){let s=new WeakSet,a=JSON.stringify(e,(n,o)=>{if(typeof o==="bigint")return o.toString();if(typeof o==="object"&&o!==null){if(s.has(o))return"[Circular]";s.add(o)}return o},t);return a===void 0?"null":a}function ne(e,t){if(t.accessor)return t.accessor(e);return e==null?void 0:e[t.key]}function Qo(e){let t=0,s=0,a=0,n=0,o=0;for(let i of e){if(i===null||i===void 0||i==="")continue;if(t++,typeof i==="number"||typeof i==="bigint")s++;else if(typeof i==="boolean")n++;else if(i instanceof Date)a++;else if(typeof i==="object")o++;else if(typeof i==="string"){let r=i.trim();if(Xo.test(r))s++;else if(Zo.test(r)&&!Number.isNaN(Date.parse(r)))a++}}if(t===0)return"string";if(s===t)return"number";if(a===t)return"date";if(n===t)return"boolean";if(o===t)return"json";return"string"}function ei(e,t=200){let s=[],a=new Set,n=Math.min(e.length,t);for(let o=0;o<n;o++){let i=e[o];if(i===null||typeof i!=="object")continue;if(Array.isArray(i)){for(let r=0;r<i.length;r++){let c=String(r);if(!a.has(c))a.add(c),s.push(c)}continue}for(let r in i)if(!a.has(r))a.add(r),s.push(r)}if(s.length>0&&s.every((o)=>/^\d+$/.test(o)))s.sort((o,i)=>Number(o)-Number(i));return s.map((o)=>({key:o}))}function ys(e){if(e===null)return"null";return e===void 0?"undefined":"value"}function Ie(e,t="string"){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean"||typeof e==="bigint")return String(e);if(e instanceof Date)return Number.isNaN(e.getTime())?"Invalid Date":e.toISOString();if(typeof e==="object"||t==="json"){let s=Ae(e);return s.length>160?`${s.slice(0,160)}...`:s}return String(e)}function ks(e){return Ae(e)}function Ss(e,t){let s={};for(let a of t){let n=ne(e,a);s[a.key]=n===void 0?null:n}return s}function Cs(e,t){return Ae(Ss(e,t),2)}function ti(e,t){return Ae(e.map((s)=>Ss(s,t)),2)}function vs(e){if(e===null||e===void 0)return"";let t;if(typeof e==="string")t=e;else if(e instanceof Date)t=Number.isNaN(e.getTime())?"":e.toISOString();else if(typeof e==="object")t=Ae(e);else t=String(e);if(/[",\r\n]/.test(t)||t!==t.trim())return`"${t.replace(/"/g,'""')}"`;return t}function si(e,t){let s=Array.from({length:e.length+1});s[0]=t.map((n)=>vs(n.label??n.key)).join(",");let a=t.length;for(let n=0;n<e.length;n++){let o=e[n],i="";for(let r=0;r<a;r++){if(r>0)i+=",";i+=vs(ne(o,t[r]))}s[n+1]=i}return`${s.join(`\r
12
12
  `)}\r
13
13
  `}function Ts(e,t,s,a,n=0){if(a<=0||s<=0)return{start:0,end:0};let o=Math.floor(Math.max(0,e)/s),i=Math.ceil((Math.max(0,e)+Math.max(0,t))/s),r=Math.min(a,Math.max(0,o-n));return{start:r,end:Math.max(r,Math.min(a,i+n))}}function $s(e,t,s){let a=s.rows-1,n=Math.max(0,s.columns-1),o=Math.max(1,s.page),{row:i,column:r}=e;switch(t){case"ArrowUp":i=Math.max(-1,i-1);break;case"ArrowDown":i=Math.min(a,i+1);break;case"ArrowLeft":r-=1;break;case"ArrowRight":r+=1;break;case"PageUp":i=i<=0?i:Math.max(0,i-o);break;case"PageDown":i=Math.min(a,Math.max(0,i)+(i<0?0:o));break;case"Home":if(r=0,s.mod)i=Math.min(0,a);break;case"End":if(r=n,s.mod)i=a;break;default:return e}return{row:Math.max(-1,Math.min(a,i)),column:Math.max(0,Math.min(n,r))}}function ai(e,t,s=!1){let a=e.find((o)=>o.key===t),n=!a?{key:t,direction:"asc"}:a.direction==="asc"?{key:t,direction:"desc"}:null;if(!s)return n?[n]:[];if(!a)return[...e,n];return n?e.map((o)=>o.key===t?n:o):e.filter((o)=>o.key!==t)}var ws=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});class Tt{rows=[];columns=[];view=new Uint32Array(0);sort=[];filter="";selected=new Set;given=null;filtered=new Uint32Array(0);searchText=null;sortKeys=new Map;offsets=new Float64Array(1);anchor=-1;charWidth;cellPadding;constructor(e=[],t=null,s={}){this.charWidth=s.charWidth??7.25,this.cellPadding=s.cellPadding??24,this.given=t&&t.length>0?[...t]:null,this.setRows(e)}get count(){return this.view.length}get totalWidth(){return this.offsets[this.columns.length]}setRows(e){this.rows=Array.isArray(e)?e:[],this.selected.clear(),this.anchor=-1,this.forget(),this.resolveColumns(),this.refilter()}setColumns(e){this.given=e&&e.length>0?[...e]:null,this.forget(),this.resolveColumns(),this.sort=this.sort.filter((t)=>this.columns.some((s)=>s.key===t.key)),this.refilter()}setFilter(e){return this.filter=e==null?"":String(e),this.refilter(),this.count}setSort(e){this.sort=(e??[]).filter((t)=>t&&(t.direction==="asc"||t.direction==="desc")&&this.columns.some((s)=>s.key===t.key)),this.resort()}toggleSort(e,t=!1){let s=this.columns.find((a)=>a.key===e);if(!s||!s.sortable)return this.sort;return this.sort=ai(this.sort,e,t),this.resort(),this.sort}sortOf(e){let t=this.sort.findIndex((s)=>s.key===e);return t<0?null:{direction:this.sort[t].direction,priority:t+1}}rowAt(e){return e>=0&&e<this.view.length?this.rows[this.view[e]]:void 0}valueAt(e,t){let s=this.columns[t],a=this.rowAt(e);return s&&a!==void 0?ne(a,s):void 0}viewRows(){let e=Array.from({length:this.view.length});for(let t=0;t<e.length;t++)e[t]=this.rows[this.view[t]];return e}toCsv(){return si(this.viewRows(),this.columns)}toJson(){return ti(this.viewRows(),this.columns)}select(e,t="replace"){if(e<0||e>=this.view.length)return;let s=this.view[e];if(t==="range"&&this.anchor>=0){let a=Math.min(this.anchor,e),n=Math.max(this.anchor,e);this.selected.clear();for(let o=a;o<=n&&o<this.view.length;o++)this.selected.add(this.view[o]);return}if(t==="toggle")if(this.selected.has(s))this.selected.delete(s);else this.selected.add(s);else this.selected.clear(),this.selected.add(s);this.anchor=e}selectAll(){this.selected.clear();for(let e=0;e<this.view.length;e++)this.selected.add(this.view[e])}clearSelection(){this.selected.clear(),this.anchor=-1}isSelected(e){return e>=0&&e<this.view.length&&this.selected.has(this.view[e])}selectedIndices(){return[...this.selected].sort((e,t)=>e-t)}selectedRows(){return this.selectedIndices().map((e)=>this.rows[e])}offsetOf(e){return this.offsets[Math.max(0,Math.min(this.columns.length,e))]}columnAt(e){let t=this.columns.length;if(t===0)return-1;let s=0,a=t-1;while(s<a){let n=s+a+1>>1;if(this.offsets[n]<=e)s=n;else a=n-1}return s}columnRange(e,t,s=0){let a=this.columns.length;if(a===0)return{start:0,end:0};let n=this.columnAt(Math.max(0,e)),o=this.columnAt(Math.max(0,e)+Math.max(0,t));return{start:Math.max(0,n-s),end:Math.min(a,o+1+s)}}resizeColumn(e,t){let s=this.columns[e];if(!s)return 0;return s.width=Math.round(Math.max(s.minWidth,Math.min(s.maxWidth,t))),this.measure(),s.width}autoWidth(e,t=200){let s=this.columns[e];if(!s)return 0;let a=s.label.length+3,n=Math.min(this.view.length,t);for(let i=0;i<n;i++){let r=Ie(ne(this.rows[this.view[i]],s),s.type).length;if(r>a)a=r}let o=Math.ceil(a*this.charWidth+this.cellPadding);return Math.max(s.minWidth,Math.min(s.maxWidth,420,o))}forget(){this.searchText=null,this.sortKeys.clear()}resolveColumns(){let e=this.given??ei(this.rows),t=Math.min(this.rows.length,200),s=this.view;this.view=new Uint32Array(t);for(let a=0;a<t;a++)this.view[a]=a;this.columns=e.map((a)=>{let n=a.type;if(!n){let o=[];for(let i=0;i<t;i++)o.push(ne(this.rows[i],a));n=Qo(o)}return{...a,label:a.label??a.key,type:n,width:a.width??0,minWidth:a.minWidth??48,maxWidth:a.maxWidth??2000,align:a.align??(n==="number"?"right":"left"),sortable:a.sortable!==!1}}),this.columns.forEach((a,n)=>{if(!a.width)a.width=this.autoWidth(n);a.width=Math.max(a.minWidth,Math.min(a.maxWidth,a.width))}),this.view=s,this.measure()}measure(){let e=new Float64Array(this.columns.length+1);for(let t=0;t<this.columns.length;t++)e[t+1]=e[t]+this.columns[t].width;this.offsets=e}searchable(){if(this.searchText)return this.searchText;let e=this.rows,t=this.columns,s=Array.from({length:e.length});for(let a=0;a<e.length;a++){let n=e[a],o="";for(let i=0;i<t.length;i++){let r=ne(n,t[i]);if(r===null||r===void 0)continue;o+=typeof r==="string"?r:Ie(r,t[i].type),o+="\x01"}s[a]=o.toLowerCase()}return this.searchText=s,s}refilter(){let e=this.rows.length,t=this.filter.toLowerCase().split(/\s+/).filter(Boolean);if(t.length===0){let s=new Uint32Array(e);for(let a=0;a<e;a++)s[a]=a;this.filtered=s}else{let s=this.searchable(),a=new Uint32Array(e),n=0,o=t.length===1?t[0]:null;for(let i=0;i<e;i++){let r=s[i];if(o!==null){if(r.includes(o))a[n++]=i;continue}let c=!0;for(let l=0;l<t.length;l++)if(!r.includes(t[l])){c=!1;break}if(c)a[n++]=i}this.filtered=a.slice(0,n)}this.anchor=-1,this.resort()}keysFor(e){let t=this.sortKeys.get(e.key);if(t)return t;let s=this.rows,a=new Float64Array(s.length);if(e.type==="number"||e.type==="date"||e.type==="boolean")for(let n=0;n<s.length;n++){let o=ne(s[n],e),i=Number.NaN;if(o===null||o===void 0||o==="")i=Number.NaN;else if(typeof o==="number")i=o;else if(typeof o==="boolean")i=o?1:0;else if(o instanceof Date)i=o.getTime();else if(e.type==="date")i=Date.parse(String(o));else if(e.type==="boolean")i=String(o).toLowerCase()==="true"?1:0;else i=Number(o);a[n]=i}else{let n=Array.from({length:s.length}),o=new Map;for(let c=0;c<s.length;c++){let l=ne(s[c],e);if(l===null||l===void 0){n[c]=null;continue}let d=typeof l==="string"?l:Ie(l,e.type);if(n[c]=d,!o.has(d))o.set(d,0)}let i=[...o.keys()].sort(ws.compare),r=0;for(let c=0;c<i.length;c++){if(c>0&&ws.compare(i[c-1],i[c])!==0)r++;o.set(i[c],r)}for(let c=0;c<s.length;c++){let l=n[c];a[c]=l===null?Number.NaN:o.get(l)}}return this.sortKeys.set(e.key,a),a}resort(){let e=[];for(let s of this.sort){let a=this.columns.find((n)=>n.key===s.key);if(a)e.push({keys:this.keysFor(a),sign:s.direction==="desc"?-1:1})}let t=this.filtered.slice();if(e.length===1){let{keys:s,sign:a}=e[0];t.sort((n,o)=>{let i=s[n],r=s[o];if(i<r)return-a;if(i>r)return a;if(i===r)return n-o;let c=i!==i;return c===(r!==r)?n-o:c?1:-1})}else if(e.length>1)t.sort((s,a)=>{for(let n=0;n<e.length;n++){let o=e[n].keys[s],i=e[n].keys[a];if(o<i)return-e[n].sign;if(o>i)return e[n].sign;if(o===i)continue;let r=o!==o;if(r!==(i!==i))return r?1:-1}return s-a});this.view=t}}var oi="./DataGrid-7rt7v865.stx";var ii=120,qe=new Intl.NumberFormat("en-US");function re(e,t){return e.querySelector(`[data-dg="${t}"]`)}function ri(e){let t=()=>{let s=document.createElement("textarea");s.value=e,s.setAttribute("aria-hidden","true"),s.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.appendChild(s);let a=document.activeElement;s.select();try{document.execCommand("copy")}catch{}s.remove(),a?.focus({preventScroll:!0})};if(typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText==="function")navigator.clipboard.writeText(e).catch(t);else t()}class li{root;callbacks;model;scroller;content;header;body;status;filterInput;prefix;rowHeight;headerHeight;overscan;columnOverscan;selectable;resizeStep;fileName;contextMenu;slots=new Map;pool=[];headerCells=[];rows={start:0,end:0};cols={start:0,end:0};stale=!0;active={row:0,column:0};activeEl=null;filterTimer=null;resize=null;observer=null;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;let a=re(e,"scroller"),n=re(e,"content"),o=re(e,"header"),i=re(e,"body");if(!a||!n||!o||!i)throw Error("DataGridView: the root is missing its scroller, content, header or body");if(this.scroller=a,this.content=n,this.header=o,this.body=i,this.status=re(e,"status"),this.filterInput=re(e,"filter"),this.prefix=a.id||`data-grid-${Math.random().toString(36).slice(2,8)}`,this.rowHeight=Math.max(8,t.rowHeight??28),this.headerHeight=Math.max(8,t.headerHeight??32),this.overscan=t.overscan??6,this.columnOverscan=t.columnOverscan??2,this.selectable=t.selectable!==!1,this.resizeStep=t.resizeStep??16,this.fileName=t.fileName||"data",this.contextMenu=Boolean(t.contextMenu),this.header.__stx_inert_content=!0,this.body.__stx_inert_content=!0,e.style.setProperty("--stx-grid-row-height",`${this.rowHeight}px`),e.style.setProperty("--stx-grid-header-height",`${this.headerHeight}px`),this.model=new Tt(t.rows??[],t.columns??null),t.filter){if(this.model.setFilter(t.filter),this.filterInput)this.filterInput.value=t.filter}if(this.listen(this.scroller,"scroll",()=>this.render()),this.listen(this.scroller,"keydown",(l)=>this.onKeyDown(l)),this.listen(this.body,"click",(l)=>this.onBodyClick(l)),this.listen(this.body,"dblclick",(l)=>this.onBodyDoubleClick(l)),this.listen(this.body,"contextmenu",(l)=>this.onContextMenu(l)),this.listen(this.header,"click",(l)=>this.onHeaderClick(l)),this.listen(this.header,"dblclick",(l)=>this.onHeaderDoubleClick(l)),this.listen(this.header,"pointerdown",(l)=>this.onResizeStart(l)),this.listen(this.header,"pointermove",(l)=>this.onResizeMove(l)),this.listen(this.header,"pointerup",(l)=>this.onResizeEnd(l)),this.listen(this.header,"pointercancel",(l)=>this.onResizeEnd(l)),this.filterInput)this.listen(this.filterInput,"input",()=>this.onFilterInput());let r=re(e,"export-csv"),c=re(e,"export-json");if(r)this.listen(r,"click",()=>this.download("csv"));if(c)this.listen(c,"click",()=>this.download("json"));if(typeof ResizeObserver<"u")this.observer=new ResizeObserver(()=>this.render()),this.observer.observe(this.scroller);this.refresh(),e.setAttribute("data-dg-ready","")}setRows(e){this.model.setRows(e),this.active={row:Math.min(0,this.model.count-1),column:Math.min(this.active.column,Math.max(0,this.model.columns.length-1))},this.scroller.scrollTop=0,this.refresh()}setColumns(e){this.model.setColumns(e),this.active={row:this.active.row,column:Math.min(this.active.column,Math.max(0,this.model.columns.length-1))},this.refresh()}setFilter(e){let t=e==null?"":String(e);if(this.filterInput&&this.filterInput.value!==t)this.filterInput.value=t;this.applyFilter(t)}setSort(e){this.model.setSort(e),this.refresh()}setFileName(e){this.fileName=e||"data"}getView(){return this.model.viewRows()}getSelection(){let e=this.model.selectedIndices();return{rows:e.map((t)=>this.model.rows[t]),indices:e}}clearSelection(){this.model.clearSelection(),this.paintSelection(),this.reportSelection()}exportCsv(){return this.model.toCsv()}exportJson(){return this.model.toJson()}download(e){let t=e==="json"?this.model.toJson():this.model.toCsv(),s=new Blob([t],{type:e==="json"?"application/json":"text/csv;charset=utf-8"}),a=URL.createObjectURL(s),n=document.createElement("a");return n.href=a,n.download=`${this.fileName}.${e}`,n.style.display="none",this.root.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(a),1000),this.callbacks.onExport?.({format:e,text:t,rows:this.model.count}),t}scrollToRow(e){let t=Math.max(0,Math.min(this.model.count-1,e));this.revealRow(t),this.render()}focus(){this.scroller.focus({preventScroll:!0})}getActiveCell(){return{...this.active}}setActiveCell(e,t){this.moveTo({row:e,column:t},!1)}destroy(){if(this.observer?.disconnect(),this.filterTimer)clearTimeout(this.filterTimer);for(let e of this.disposers)e();this.header.replaceChildren(),this.body.replaceChildren(),this.slots.clear(),this.pool.length=0,this.root.removeAttribute("data-dg-ready")}refresh(){let e=this.model;this.content.style.width=`${e.totalWidth}px`,this.content.style.height=`${this.headerHeight+e.count*this.rowHeight}px`,this.header.style.width=`${e.totalWidth}px`,this.body.style.height=`${e.count*this.rowHeight}px`,this.scroller.setAttribute("aria-rowcount",String(e.count+1)),this.scroller.setAttribute("aria-colcount",String(e.columns.length)),this.root.toggleAttribute("data-empty",e.count===0),this.stale=!0,this.render(),this.paintStatus()}render(){let e=this.model,t=this.scroller,s=Ts(t.scrollTop,Math.max(0,t.clientHeight-this.headerHeight),this.rowHeight,e.count,this.overscan),a=e.columnRange(t.scrollLeft,t.clientWidth,this.columnOverscan),n=this.stale||a.start!==this.cols.start||a.end!==this.cols.end;if(!n&&s.start===this.rows.start&&s.end===this.rows.end)return;if(this.rows=s,this.cols=a,n)this.renderHeader();for(let[o,i]of this.slots)if(o<s.start||o>=s.end)this.slots.delete(o),i.index=-1,i.el.style.display="none",this.pool.push(i);for(let o=s.start;o<s.end;o++){let i=this.slots.get(o);if(i){if(n)this.fill(i);continue}i=this.pool.pop()??this.createSlot(),i.index=o,i.el.style.display="",this.slots.set(o,i),this.fill(i)}this.stale=!1,this.paintActive()}createSlot(){let e=document.createElement("div");return e.className="stx-dg-row",e.setAttribute("role","row"),this.body.appendChild(e),{el:e,index:-1,cells:[]}}fill(e){let t=this.model,s=e.index,a=t.rowAt(s),n=this.selectable&&t.isSelected(s),o=e.el;if(o.__dgRow=s,o.style.transform=`translateY(${s*this.rowHeight}px)`,o.setAttribute("aria-rowindex",String(s+2)),this.selectable)o.setAttribute("aria-selected",n?"true":"false");let i=this.cols.end-this.cols.start;while(e.cells.length<i){let r=document.createElement("div");r.className="stx-dg-cell",r.setAttribute("role","gridcell"),r.appendChild(document.createTextNode("")),o.appendChild(r),e.cells.push(r)}while(e.cells.length>i)e.cells.pop().remove();for(let r=0;r<i;r++){let c=this.cols.start+r,l=t.columns[c],d=e.cells[r],h=a===void 0?void 0:ne(a,l),p=ys(h);if(d.__dgColumn=c,d.id=`${this.prefix}-r${s}-c${c}`,d.style.left=`${t.offsetOf(c)}px`,d.style.width=`${l.width}px`,d.setAttribute("aria-colindex",String(c+1)),d.setAttribute("data-type",l.type),d.setAttribute("data-align",l.align),p==="value")d.removeAttribute("data-empty");else d.setAttribute("data-empty",p);if(this.selectable)d.setAttribute("aria-selected",n?"true":"false");d.firstChild.data=typeof h==="string"?h:Ie(h,l.type)}}renderHeader(){let e=this.model,t=this.cols.end-this.cols.start;while(this.headerCells.length<t){let s=document.createElement("div");s.className="stx-dg-head",s.setAttribute("role","columnheader");let a=document.createElement("span");a.className="stx-dg-head-label",a.appendChild(document.createTextNode(""));let n=document.createElement("span");n.className="stx-dg-sort",n.setAttribute("aria-hidden","true"),n.appendChild(document.createTextNode(""));let o=document.createElement("span");o.className="stx-dg-resize",o.setAttribute("aria-hidden","true"),s.append(a,n,o),this.header.appendChild(s),this.headerCells.push(s)}while(this.headerCells.length>t)this.headerCells.pop().remove();for(let s=0;s<t;s++){let a=this.cols.start+s,n=e.columns[a],o=this.headerCells[s],i=e.sortOf(n.key);if(o.__dgColumn=a,o.id=`${this.prefix}-h-c${a}`,o.style.left=`${e.offsetOf(a)}px`,o.style.width=`${n.width}px`,o.setAttribute("aria-colindex",String(a+1)),o.setAttribute("data-align",n.align),o.toggleAttribute("data-sortable",n.sortable),n.sortable)o.setAttribute("aria-sort",i?i.direction==="asc"?"ascending":"descending":"none");else o.removeAttribute("aria-sort");o.children[0].firstChild.data=n.label,o.children[1].firstChild.data=i?`${i.direction==="asc"?"\u25B2":"\u25BC"}${e.sort.length>1?i.priority:""}`:""}}cellElement(e){if(e.column<this.cols.start||e.column>=this.cols.end)return null;let t=e.column-this.cols.start;if(e.row<0)return this.headerCells[t]??null;return this.slots.get(e.row)?.cells[t]??null}paintActive(){let e=this.cellElement(this.active);if(this.activeEl&&this.activeEl!==e)this.activeEl.removeAttribute("data-active");if(this.activeEl=e,e)e.setAttribute("data-active",""),this.scroller.setAttribute("aria-activedescendant",e.id);else this.scroller.removeAttribute("aria-activedescendant")}paintSelection(){if(!this.selectable)return;for(let[e,t]of this.slots){let s=this.model.isSelected(e)?"true":"false";t.el.setAttribute("aria-selected",s);for(let a of t.cells)a.setAttribute("aria-selected",s)}this.paintStatus()}paintStatus(){if(!this.status)return;let e=this.model,t=e.rows.length,s=e.count===t?`${qe.format(t)} ${t===1?"row":"rows"}`:`${qe.format(e.count)} of ${qe.format(t)} rows`;if(e.selected.size>0)s+=`, ${qe.format(e.selected.size)} selected`;if(this.status.textContent!==s)this.status.textContent=s}revealRow(e){let t=this.scroller,s=e*this.rowHeight,a=t.clientHeight-this.headerHeight;if(s<t.scrollTop)t.scrollTop=s;else if(s+this.rowHeight>t.scrollTop+a)t.scrollTop=s+this.rowHeight-a}revealColumn(e){let t=this.scroller,s=this.model.offsetOf(e),a=this.model.offsetOf(e+1);if(s<t.scrollLeft)t.scrollLeft=s;else if(a>t.scrollLeft+t.clientWidth)t.scrollLeft=Math.min(s,a-t.clientWidth)}detail(e){return{row:this.model.rowAt(e.row),rowIndex:e.row,column:this.model.columns[e.column],value:e.row<0?void 0:this.model.valueAt(e.row,e.column)}}moveTo(e,t=!0){let s=this.model,a={row:Math.max(-1,Math.min(s.count-1,e.row)),column:Math.max(0,Math.min(s.columns.length-1,e.column))};if(this.active=a,a.row>=0)this.revealRow(a.row);if(this.revealColumn(a.column),this.render(),this.paintActive(),t)this.callbacks.onCell?.(this.detail(a))}reportSelection(){this.callbacks.onSelect?.(this.getSelection())}applyFilter(e){let t=this.model.setFilter(e);this.active={row:Math.min(0,t-1),column:this.active.column},this.scroller.scrollTop=0,this.refresh(),this.callbacks.onFilter?.({text:e,count:t})}sortBy(e,t){let s=this.model.columns[e];if(!s||!s.sortable)return;let a=this.model.toggleSort(s.key,t);this.refresh(),this.callbacks.onSort?.([...a])}setColumnWidth(e,t){this.model.resizeColumn(e,t),this.content.style.width=`${this.model.totalWidth}px`,this.header.style.width=`${this.model.totalWidth}px`,this.stale=!0,this.render()}copy(e){if(this.active.row<0)return;let t=this.model.rowAt(this.active.row);if(t===void 0)return;let s=e==="row"?Cs(t,this.model.columns):ks(this.model.valueAt(this.active.row,this.active.column));ri(s),this.callbacks.onCopy?.({what:e,text:s})}listen(e,t,s){e.addEventListener(t,s),this.disposers.push(()=>e.removeEventListener(t,s))}cellFrom(e){let s=e.target?.closest(".stx-dg-cell"),a=s?.parentElement;if(!s||!a||s.__dgColumn===void 0||a.__dgRow===void 0)return null;return{row:a.__dgRow,column:s.__dgColumn}}headFrom(e){let t=e.target,s=t?.closest(".stx-dg-head");if(!s||s.__dgColumn===void 0)return null;let a=t.closest(".stx-dg-resize");return{column:s.__dgColumn,onHandle:Boolean(a),handle:a}}onBodyClick(e){let t=this.cellFrom(e);if(!t)return;if(this.selectable)this.model.select(t.row,e.shiftKey?"range":e.metaKey||e.ctrlKey?"toggle":"replace"),this.paintSelection(),this.reportSelection();this.moveTo(t)}onBodyDoubleClick(e){let t=this.cellFrom(e),s=t?this.model.rowAt(t.row):void 0;if(t&&s!==void 0)this.callbacks.onActivate?.({row:s,rowIndex:t.row})}onContextMenu(e){let t=this.cellFrom(e);if(!t)return;if(this.contextMenu)e.preventDefault();this.moveTo(t,!1),this.callbacks.onContext?.({...this.detail(t),x:e.clientX,y:e.clientY})}onHeaderClick(e){let t=this.headFrom(e);if(!t||t.onHandle)return;this.active={row:-1,column:t.column},this.sortBy(t.column,e.shiftKey)}onHeaderDoubleClick(e){let t=this.headFrom(e);if(t&&t.onHandle)this.setColumnWidth(t.column,this.model.autoWidth(t.column))}onResizeStart(e){let t=this.headFrom(e);if(!t||!t.onHandle||!t.handle||e.button!==0)return;e.preventDefault();try{t.handle.setPointerCapture(e.pointerId)}catch{}this.resize={column:t.column,start:e.clientX,width:this.model.columns[t.column].width,pointer:e.pointerId,handle:t.handle},this.root.setAttribute("data-resizing","")}onResizeMove(e){let t=this.resize;if(!t||e.pointerId!==t.pointer)return;this.setColumnWidth(t.column,t.width+e.clientX-t.start)}onResizeEnd(e){let t=this.resize;if(!t||e.pointerId!==t.pointer)return;this.resize=null,this.root.removeAttribute("data-resizing");try{t.handle.releasePointerCapture(e.pointerId)}catch{}}onFilterInput(){if(this.filterTimer)clearTimeout(this.filterTimer);this.filterTimer=setTimeout(()=>{this.filterTimer=null,this.applyFilter(this.filterInput?this.filterInput.value:"")},ii)}onKeyDown(e){if(e.target!==this.scroller)return;let t=this.model,s=e.metaKey||e.ctrlKey,a=this.active.row<0,n=e.key;if(s&&(n==="a"||n==="A")){if(!this.selectable)return;e.preventDefault(),t.selectAll(),this.paintSelection(),this.reportSelection();return}if(s&&(n==="c"||n==="C")){if(a)return;e.preventDefault(),this.copy(e.shiftKey?"row":"cell");return}if(a&&e.altKey&&(n==="ArrowLeft"||n==="ArrowRight")){e.preventDefault();let r=t.columns[this.active.column];if(r)this.setColumnWidth(this.active.column,r.width+(n==="ArrowRight"?this.resizeStep:-this.resizeStep));this.paintActive();return}if(n==="Enter"||n===" "){if(e.preventDefault(),a){this.sortBy(this.active.column,e.shiftKey);return}if(n===" "){if(!this.selectable)return;t.select(this.active.row,"toggle"),this.paintSelection(),this.reportSelection();return}let r=t.rowAt(this.active.row);if(r!==void 0)this.callbacks.onActivate?.({row:r,rowIndex:this.active.row});return}if(n==="Escape"&&this.selectable&&t.selected.size>0){e.preventDefault(),this.clearSelection();return}let o=Math.max(1,Math.floor((this.scroller.clientHeight-this.headerHeight)/this.rowHeight)-1),i=$s(this.active,n,{rows:t.count,columns:t.columns.length,page:o,mod:s});if(i===this.active)return;if(e.preventDefault(),i.row===this.active.row&&i.column===this.active.column)return;if(e.shiftKey&&this.selectable&&i.row>=0&&i.row!==this.active.row){if(t.selected.size===0&&this.active.row>=0)t.select(this.active.row,"replace");t.select(i.row,"range"),this.paintSelection(),this.reportSelection()}this.moveTo(i)}}var di="./Dialog-wm7zjqnb.stx";var hi="./DialogBackdrop-de5m5m4w.stx";var fi="./DialogDescription-yd2jgt2m.stx";var gi="./DialogPanel-v972ztcc.stx";var bi="./DialogTitle-nw0pw114.stx";var wi="./Drawer-d78cdr6d.stx";var ki="./Dropdown-hb8ks69x.stx";var Ci="./DropdownButton-wxc25hsy.stx";var $i="./DropdownItem-af0vzc8a.stx";var Ii="./DropdownItems-bkz7jkyz.stx";var Pi="./Form-cybgg9ym.stx";var Mi={action:f.string,method:f.oneOf(["GET","POST","PUT","DELETE","PATCH"]),validationSchema:f.object,initialValues:f.object,validateOnChange:f.boolean,validateOnBlur:f.boolean,onSubmit:f.func,onError:f.func,className:f.string},lg=ae("Form",Mi);var Ni="./FileDrop-p9wqdx75.stx";var Es=(e)=>Math.round(e*100)/100,Q=(e)=>`${Es(e.x)} ${Es(e.y)}`;function Is(e,t,s){let a=s.x-e.x,n=s.y-e.y;if(a===0&&n===0)return{x:e.x,y:e.y};let o=a===0?Number.POSITIVE_INFINITY:t.width/2/Math.abs(a),i=n===0?Number.POSITIVE_INFINITY:t.height/2/Math.abs(n),r=Math.min(o,i);return{x:e.x+a*r,y:e.y+n*r}}function As(e,t,s){let a=e.x-t.x,n=e.y-t.y,o=Math.sqrt(a*a+n*n);if(s<=0||o<=s)return e;return{x:e.x-a/o*s,y:e.y-n/o*s}}function Li(e,t,s=0){let a=26+Math.abs(s),n={x:e.x+t.width/4,y:e.y-t.height/2},o={x:e.x+t.width/2,y:e.y-t.height/4},i={x:n.x,y:n.y-a},r={x:o.x+a,y:o.y};return{d:`M ${Q(n)} C ${Q(i)}, ${Q(r)}, ${Q(o)}`,start:n,end:o,label:Ps(n,i,r,o,0.5),angle:Math.atan2(o.y-r.y,o.x-r.x)}}function Ps(e,t,s,a,n){let o=1-n;return{x:o*o*o*e.x+3*o*o*n*t.x+3*o*n*n*s.x+n*n*n*a.x,y:o*o*o*e.y+3*o*o*n*t.y+3*o*n*n*s.y+n*n*n*a.y}}function Ms(e,t={}){let{source:s,sourceSize:a,target:n,targetSize:o}=e,i=t.offset??0,r=t.inset??0;if(s.x===n.x&&s.y===n.y)return Li(s,a,i);if(t.curve==="bezier"){let w=t.direction!=="TB",y=(w?n.x-s.x:n.y-s.y)>=0?1:-1,v=w?{x:s.x+y*a.width/2,y:s.y}:{x:s.x,y:s.y+y*a.height/2},b=w?{x:n.x-y*o.width/2,y:n.y}:{x:n.x,y:n.y-y*o.height/2},C=Math.abs(w?b.x-v.x:b.y-v.y),P=Math.max(C/2,24)*y,T=w?{x:b.x-y*r,y:b.y}:{x:b.x,y:b.y-y*r},F=w?{x:v.x+P,y:v.y+i}:{x:v.x+i,y:v.y+P},V=w?{x:T.x-P,y:T.y+i}:{x:T.x+i,y:T.y-P};return{d:`M ${Q(v)} C ${Q(F)}, ${Q(V)}, ${Q(T)}`,start:v,end:T,label:Ps(v,F,V,T,0.5),angle:Math.atan2(T.y-V.y,T.x-V.x)}}let c=Is(s,a,n),l=Is(n,o,s);if(i===0){let w=As(l,c,r);return{d:`M ${Q(c)} L ${Q(w)}`,start:c,end:w,label:{x:(c.x+w.x)/2,y:(c.y+w.y)/2},angle:Math.atan2(w.y-c.y,w.x-c.x)}}let d=s.x<n.x||s.x===n.x&&s.y<n.y?1:-1,h=(n.x-s.x)*d,p=(n.y-s.y)*d,u=Math.sqrt(h*h+p*p)||1,g={x:(c.x+l.x)/2+-p/u*i*2,y:(c.y+l.y)/2+h/u*i*2},m=As(l,g,r);return{d:`M ${Q(c)} Q ${Q(g)}, ${Q(m)}`,start:c,end:m,label:{x:0.25*c.x+0.5*g.x+0.25*m.x,y:0.25*c.y+0.5*g.y+0.25*m.y},angle:Math.atan2(m.y-g.y,m.x-g.x)}}function Rs(e,t=14){let s=new Map;for(let n of e){let o=n.source<n.target?`${n.source}\x00${n.target}`:`${n.target}\x00${n.source}`,i=s.get(o);if(i)i.push(n);else s.set(o,[n])}let a=new Map;for(let n of s.values()){if(n.length<2)continue;n.forEach((o,i)=>{let r=(i-(n.length-1)/2)*t;a.set(o.id,o.source===o.target?i*t:r)})}return a}var $t={charWidth:7,paddingX:12,minWidth:48,maxWidth:220,height:32,detailHeight:14};function oe(e){return e.label==null||e.label===""?e.id:String(e.label)}function Ns(e){return e.id!=null&&e.id!==""?String(e.id):`${e.source}->${e.target}${e.label?`:${e.label}`:""}`}function Ls(e,t=$t){let s=Math.max(oe(e).length,e.detail?e.detail.length*0.85:0),a=e.expandable===!0?t.charWidth+4:0;return{width:Math.min(t.maxWidth,Math.max(t.minWidth,Math.ceil(s*t.charWidth)+t.paddingX*2+a)),height:t.height+(e.detail?t.detailHeight:0)}}function Ds(e=$t){return Math.floor((e.maxWidth-e.paddingX*2)/e.charWidth)}function We(e,t){return e.length<=t?e:`${e.slice(0,Math.max(1,t-1))}\u2026`}class Ge{metrics;nodeMap=new Map;edgeMap=new Map;incident=new Map;sizes=new Map;constructor(e=[],t=[],s=$t){this.metrics=s;this.merge(e,t)}get nodes(){return[...this.nodeMap.values()]}get edges(){return[...this.edgeMap.values()]}get nodeCount(){return this.nodeMap.size}get edgeCount(){return this.edgeMap.size}has(e){return this.nodeMap.has(e)}node(e){return this.nodeMap.get(e)}edge(e){return this.edgeMap.get(e)}addNode(e){if(!e||e.id==null||e.id==="")return!1;let t=String(e.id);if(this.nodeMap.has(t))return!1;let s={...e,id:t};return this.nodeMap.set(t,s),this.incident.set(t,new Set),this.sizes.set(t,Ls(s,this.metrics)),!0}addEdge(e){if(!e)return!1;let t=String(e.source),s=String(e.target);if(!this.nodeMap.has(t)||!this.nodeMap.has(s))return!1;let a=Ns({...e,source:t,target:s});if(this.edgeMap.has(a))return!1;return this.edgeMap.set(a,{...e,id:a,source:t,target:s}),this.incident.get(t).add(a),this.incident.get(s).add(a),!0}updateNode(e,t){let s=this.nodeMap.get(e);if(!s)return!1;let a={...s,...t,id:e};return this.nodeMap.set(e,a),this.sizes.set(e,Ls(a,this.metrics)),!0}removeNode(e){if(!this.nodeMap.has(e))return!1;for(let t of[...this.incident.get(e)])this.removeEdge(t);return this.nodeMap.delete(e),this.incident.delete(e),this.sizes.delete(e),!0}removeEdge(e){let t=this.edgeMap.get(e);if(!t)return!1;return this.edgeMap.delete(e),this.incident.get(t.source)?.delete(e),this.incident.get(t.target)?.delete(e),!0}merge(e=[],t=[]){let s={nodes:[],edges:[]};for(let a of e)if(this.addNode(a))s.nodes.push(String(a.id));for(let a of t)if(this.addEdge(a))s.edges.push(Ns({...a,source:String(a.source),target:String(a.target)}));return s}edgesOf(e){let t=this.incident.get(e);return t?[...t].map((s)=>this.edgeMap.get(s)):[]}neighbours(e){let t=new Set;for(let s of this.edgesOf(e)){let a=s.source===e?s.target:s.source;if(a!==e)t.add(a)}return[...t]}degree(e){return this.neighbours(e).length}size(e){return this.sizes.get(e)??{width:this.metrics.minWidth,height:this.metrics.height}}bounds(e){let{POSITIVE_INFINITY:t,POSITIVE_INFINITY:s,NEGATIVE_INFINITY:a,NEGATIVE_INFINITY:n}=Number;for(let[o,i]of e){if(!this.nodeMap.has(o))continue;let r=this.size(o);t=Math.min(t,i.x-r.width/2),a=Math.max(a,i.x+r.width/2),s=Math.min(s,i.y-r.height/2),n=Math.max(n,i.y+r.height/2)}return Number.isFinite(t)?{x:t,y:s,width:a-t,height:n-s}:null}}function Os(e){let t=e>>>0||1;return()=>{t=t+1831565813>>>0;let s=t;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Di=0.15,zs=0.06;function Hs(e,t={}){let s=e.nodes,a=s.length,n=new Map;if(a===0)return n;let o=t.linkDistance??90,i=t.padding??16,r=Os(t.seed??1),c=t.positions??null,l=new Set(t.pinned??[]),d=new Map(s.map((R,N)=>[R.id,N])),h=new Float64Array(a),p=new Float64Array(a),u=new Float64Array(a),g=new Float64Array(a),m=new Uint8Array(a),w=new Uint8Array(a),y=new Float64Array(a).fill(1),v=0;s.forEach((R,N)=>{let E=e.size(R.id);u[N]=E.width/2,g[N]=E.height/2;let M=c?.get(R.id);if(M&&Number.isFinite(M.x)&&Number.isFinite(M.y))h[N]=M.x,p[N]=M.y,w[N]=1,m[N]=l.has(R.id)?1:0,y[N]=0,v++});let b=o*Math.sqrt(a)*0.6;s.forEach((R,N)=>{if(w[N])return;let E=e.neighbours(R.id).map((k)=>d.get(k)).find((k)=>w[k]),M=r()*Math.PI*2;if(E!==void 0)h[N]=h[E]+Math.cos(M)*o*0.5,p[N]=p[E]+Math.sin(M)*o*0.5;else{let k=Math.sqrt(r())*b;h[N]=Math.cos(M)*k,p[N]=Math.sin(M)*k}});let C=Uint8Array.from(w),P=v>0,T=Math.max(0,t.iterations??(P?80:300)),F=[],V=new Set;for(let R of e.edges){let N=d.get(R.source),E=d.get(R.target);if(N===E)continue;let M=N<E?N*a+E:E*a+N;if(!V.has(M))V.add(M),F.push(N,E)}let j=new Float64Array(a),x=new Float64Array(a),S=o,L=P?S*0.5:S*1.5;for(let R=0;R<T;R++){let N=L*(1-R/T);j.fill(0),x.fill(0);for(let E=0;E<a;E++)for(let M=E+1;M<a;M++){if(C[E]&&C[M])continue;let k=h[E]-h[M],O=p[E]-p[M],D=Math.sqrt(k*k+O*O);if(D<0.01){let K=(E*31+M*17)%360*Math.PI/180;k=Math.cos(K)*0.01,O=Math.sin(K)*0.01,D=0.01}let Y=Math.max(1,D-(u[E]+u[M])*0.5),H=S*S*Di/Y/D;j[E]+=k*H,x[E]+=O*H,j[M]-=k*H,x[M]-=O*H}for(let E=0;E<F.length;E+=2){let M=F[E],k=F[E+1];if(C[M]&&C[k])continue;let O=h[M]-h[k],D=p[M]-p[k],Y=Math.sqrt(O*O+D*D)||0.01,H=(u[M]+u[k])*0.5,K=Math.max(0,Y-H),te=K*K/S/Y;j[M]-=O*te,x[M]-=D*te,j[k]+=O*te,x[k]+=D*te}for(let E=0;E<a;E++){if(m[E])continue;if(!C[E])j[E]-=h[E]*zs,x[E]-=p[E]*zs;let M=Math.sqrt(j[E]*j[E]+x[E]*x[E]);if(M>0){let k=Math.min(M,N)/M*y[E];h[E]+=j[E]*k,p[E]+=x[E]*k}}}return Oi(h,p,u,g,m,i),s.forEach((R,N)=>{n.set(R.id,{x:Math.round(h[N]*100)/100,y:Math.round(p[N]*100)/100})}),n}function Oi(e,t,s,a,n,o){let i=e.length;for(let r=0;r<40;r++){let c=!1;for(let l=0;l<i;l++)for(let d=l+1;d<i;d++){let h=s[l]+s[d]+o-Math.abs(e[l]-e[d]);if(h<=0)continue;let p=a[l]+a[d]+o-Math.abs(t[l]-t[d]);if(p<=0)continue;if(n[l]&&n[d])continue;c=!0;let u=n[l]?0:n[d]?1:0.5,g=1-u;if(h<p){let m=e[l]<e[d]||e[l]===e[d]&&l<d?-1:1;e[l]+=m*h*u,e[d]-=m*h*g}else{let m=t[l]<t[d]||t[l]===t[d]&&l<d?-1:1;t[l]+=m*p*u,t[d]-=m*p*g}}if(!c)break}}function zi(e){let t=new Set,s=[];for(let n of e.nodes){if(t.has(n.id))continue;let o=[],i=[n.id];t.add(n.id);while(i.length){let r=i.shift();o.push(r);for(let c of e.neighbours(r))if(!t.has(c))t.add(c),i.push(c)}s.push(o)}let a=new Map(e.nodes.map((n,o)=>[n.id,o]));for(let n of s)n.sort((o,i)=>a.get(o)-a.get(i));return s}function Hi(e){let t=new Map;for(let n of e.nodes)t.set(n.id,[]);for(let n of e.edges)if(n.source!==n.target)t.get(n.source).push({id:n.id,to:n.target});let s=new Set,a=new Map;for(let n of e.nodes){if(a.has(n.id))continue;let o=[{id:n.id,next:0}];a.set(n.id,1);while(o.length){let i=o[o.length-1],r=t.get(i.id);if(i.next>=r.length){a.set(i.id,2),o.pop();continue}let c=r[i.next++],l=a.get(c.to);if(l===1)s.add(c.id);else if(l===void 0)a.set(c.to,1),o.push({id:c.to,next:0})}}return s}function Fs(e,t){let s=e.map((n)=>[t.get(n.from),t.get(n.to)]).sort((n,o)=>n[0]-o[0]||n[1]-o[1]),a=0;for(let n=0;n<s.length;n++)for(let o=n+1;o<s.length;o++)if(s[n][0]<s[o][0]&&s[n][1]>s[o][1])a++;return a}function Vs(e,t={}){let s=t.direction==="TB"?"TB":"LR",a=t.nodeGap??24,n=t.layerGap??80,o=t.componentGap??48,i=t.sweeps??4,r=s==="LR",c=Hi(e),l=[],d=new Set;for(let b of e.edges){if(b.source===b.target)continue;let C=c.has(b.id)?b.target:b.source,P=c.has(b.id)?b.source:b.target,T=`${C}\x00${P}`;if(!d.has(T))d.add(T),l.push({from:C,to:P})}let h=new Map,p=new Map;for(let b of e.nodes)h.set(b.id,[]),p.set(b.id,[]);for(let b of l)h.get(b.from).push(b.to),p.get(b.to).push(b.from);let u=new Map,g=new Map,m=[];for(let b of e.nodes)if(g.set(b.id,p.get(b.id).length),p.get(b.id).length===0)m.push(b.id),u.set(b.id,0);for(let b=0;b<m.length;b++){let C=m[b];for(let P of h.get(C)){u.set(P,Math.max(u.get(P)??0,u.get(C)+1));let T=g.get(P)-1;if(g.set(P,T),T===0)m.push(P)}}let w=new Map,y=[],v=0;for(let b of zi(e)){let C=[];for(let k of b){let O=u.get(k)??0;while(C.length<=O)C.push([]);C[O].push(k)}let P=new Set(b),T=l.filter((k)=>P.has(k.from)&&u.get(k.to)-u.get(k.from)===1),F=new Map,V=()=>{for(let k of C)k.forEach((O,D)=>F.set(O,k.length>1?D/(k.length-1):0.5))},j=(k,O)=>{let D=new Map;k.forEach((H,K)=>{let te=O.get(H),De=k.length>1?K/(k.length-1):0.5;D.set(H,te.length?te.reduce((mt,Oe)=>mt+F.get(Oe),0)/te.length:De)});let Y=new Map(k.map((H,K)=>[H,K]));k.sort((H,K)=>D.get(H)-D.get(K)||Y.get(H)-Y.get(K)),k.forEach((H,K)=>F.set(H,k.length>1?K/(k.length-1):0.5))};V();let x=C.map((k)=>[...k]),S=Fs(T,F);for(let k=0;k<i&&S>0;k++){for(let D=1;D<C.length;D++)j(C[D],p);for(let D=C.length-2;D>=0;D--)j(C[D],h);let O=Fs(T,F);if(O<S)S=O,x=C.map((D)=>[...D])}let L=(k)=>r?e.size(k).width:e.size(k).height,R=(k)=>r?e.size(k).height:e.size(k).width,N=x.map((k)=>k.reduce((O,D)=>O+R(D),0)+a*Math.max(0,k.length-1)),E=Math.max(0,...N),M=0;x.forEach((k,O)=>{let D=Math.max(0,...k.map(L)),Y=v+(E-N[O])/2;for(let H of k){let K=Y+R(H)/2;w.set(H,r?{x:M+D/2,y:K}:{x:K,y:M+D/2}),Y+=R(H)+a}M+=D+n}),y.push(x),v+=E+o}return{positions:w,layerOf:u,reversed:c,components:y,bounds:e.bounds(w)}}var Fi={x:0,y:0,k:1};function js(e,t,s){return Math.min(Math.max(e,t),s)}function vg(e,t){return{x:t.x*e.k+e.x,y:t.y*e.k+e.y}}function Et(e,t){return{x:(t.x-e.x)/e.k,y:(t.y-e.y)/e.k}}function Ue(e,t,s){return{x:e.x+t,y:e.y+s,k:e.k}}function Bs(e,t,s,a=0.1,n=4){let o=js(e.k*s,a,n),i=o/e.k;return{x:t.x-(t.x-e.x)*i,y:t.y-(t.y-e.y)*i,k:o}}function _s(e,t,s=24,a=0.1,n=1){if(!e||t.width<=0||t.height<=0)return{...Fi};let o=Math.max(1,t.width-s*2),i=Math.max(1,t.height-s*2),r=js(Math.min(o/Math.max(1,e.width),i/Math.max(1,e.height)),a,n);return{x:t.width/2-(e.x+e.width/2)*r,y:t.height/2-(e.y+e.height/2)*r,k:r}}function Ks(e,t,s){return{x:s.width/2-t.x*e.k,y:s.height/2-t.y*e.k,k:e.k}}function qs(e,t,s,a=16){let n=t.x*e.k+e.x,o=t.y*e.k+e.y,i=n+t.width*e.k,r=o+t.height*e.k,c=0,l=0;if(n<a)c=a-n;else if(i>s.width-a)c=s.width-a-i;if(o<a)l=a-o;else if(r>s.height-a)l=s.height-a-r;return c===0&&l===0?e:Ue(e,c,l)}function Ws(e,t,s){let a=e.get(t);if(!a)return null;let n=s==="left"?-1:s==="right"?1:0,o=s==="up"?-1:s==="down"?1:0,i=null,r=Number.POSITIVE_INFINITY;for(let[c,l]of e){if(c===t)continue;let d=l.x-a.x,h=l.y-a.y,p=d*n+h*o;if(p<=0.5)continue;let u=Math.abs(d*o)+Math.abs(h*n);if(u>p*2)continue;let g=p+u*2;if(g<r)r=g,i=c}return i}function Gs(e,t){let s=null,a=Number.POSITIVE_INFINITY;for(let[n,o]of e){let i=(o.x-t.x)**2+(o.y-t.y)**2;if(i<a)a=i,s=n}return s}function wg(e,t,s){let a=null;for(let[n,o]of t){let i=e.size(n);if(Math.abs(s.x-o.x)<=i.width/2&&Math.abs(s.y-o.y)<=i.height/2)a=n}return a}var ji="./GraphView-0t3t9mec.stx";var Bi="http://www.w3.org/2000/svg",Us=3,Js=350,_i=240,Ki=6.2;function q(e,t={}){let s=document.createElementNS(Bi,e);for(let a in t)s.setAttribute(a,String(t[a]));return s}var qi=0;class Wi{root;callbacks;timings={layout:0,render:0};model=new Ge;positions=new Map;shown=new Map;pinned=new Set;view={x:0,y:0,k:1};size={width:0,height:0};layoutName;direction;selected=null;autoFit=!0;animate;minZoom;maxZoom;contextMenu;prefix;surface;status;svg;stage;edgeLayer;nodeLayer;labelLayer;nodeEls=new Map;edgeEls=new Map;idOf=new WeakMap;offsets=new Map;serial=0;gesture=null;pinch=null;lastClick={id:"",at:0};lastExpand=0;frame=0;observer=null;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;if(this.prefix=`${e.id||"graph"}-${++qi}`,this.layoutName=t.layout==="force"?"force":"layered",this.direction=t.direction==="TB"?"TB":"LR",this.minZoom=t.minZoom??0.1,this.maxZoom=t.maxZoom??4,this.contextMenu=Boolean(t.contextMenu),this.animate=t.animate!==!1,this.surface=e.querySelector('[data-gv="surface"]')??e,this.status=e.querySelector('[data-gv="status"]'),t.label)this.surface.setAttribute("aria-label",t.label);this.svg=q("svg",{class:"stx-gv-svg","aria-hidden":"false",focusable:"false"}),this.svg.__stx_inert_content=!0;let a=q("defs");for(let n of["arrow","arrow-active"]){let o=q("marker",{id:`${this.prefix}-${n}`,viewBox:"0 0 10 10",refX:9,refY:5,markerWidth:7,markerHeight:7,orient:"auto-start-reverse",class:`stx-gv-${n}`});o.append(q("path",{d:"M 0 0 L 10 5 L 0 10 z"})),a.append(o)}if(this.stage=q("g",{class:"stx-gv-stage"}),this.edgeLayer=q("g",{class:"stx-gv-edges"}),this.nodeLayer=q("g",{class:"stx-gv-nodes"}),this.labelLayer=q("g",{class:"stx-gv-edge-labels"}),this.stage.append(this.edgeLayer,this.nodeLayer,this.labelLayer),this.svg.append(a,this.stage),this.surface.append(this.svg),this.listen(),this.measure(),this.setGraph(t.nodes??[],t.edges??[]),t.selected)this.select(t.selected,{silent:!0});if(typeof ResizeObserver<"u")this.observer=new ResizeObserver(()=>{if(this.measure(),this.autoFit)this.fit()}),this.observer.observe(this.surface);e.setAttribute("data-gv-ready","")}graph(){return this.model}getViewport(){return{...this.view}}getLayout(){return this.layoutName}getSelected(){return this.selected}getPositions(){return Object.fromEntries([...this.positions].map(([e,t])=>[e,{...t}]))}setGraph(e,t){if(this.stop(),this.model=new Ge(e??[],t??[]),this.positions=new Map,this.pinned.clear(),this.selected&&!this.model.has(this.selected))this.selected=null;this.layout(!1),this.shown=new Map(this.positions),this.render(),this.autoFit=!0,this.fit(),this.mark()}addNeighbours(e,t,s){let a=this.model.merge(t??[],s??[]);if(a.nodes.length===0&&a.edges.length===0)return a;let n=this.shown.get(e)??this.positions.get(e)??Et(this.view,{x:this.size.width/2,y:this.size.height/2});for(let o of a.nodes)this.shown.set(o,{...n});if(this.layout(!0),this.sync(),this.moveToPlace(),this.mark(),a.nodes.length)this.announce(`${a.nodes.length} ${a.nodes.length===1?"node":"nodes"} added${this.model.has(e)?` to ${oe(this.model.node(e))}`:""}`);return a}updateNode(e,t){if(!this.model.updateNode(e,t))return;let s=this.nodeEls.get(e);if(s)s.remove(),this.nodeEls.delete(e);this.sync(),this.draw(),this.mark()}setLayout(e){let t=e==="force"?"force":"layered";if(t===this.layoutName)return;this.layoutName=t,this.relayout(),this.callbacks.onLayout?.({layout:t})}setDirection(e){let t=e==="TB"?"TB":"LR";if(t===this.direction)return;if(this.direction=t,this.layoutName==="layered")this.relayout()}select(e,t={}){let s=e!=null&&this.model.has(e)?e:null;if(s===this.selected)return;if(this.selected=s,this.mark(),s)this.describe(s);if(!t.silent)this.callbacks.onSelect?.(this.selection())}focusNode(e){if(!this.model.has(e))return;this.select(e);let t=this.positions.get(e);if(t)this.autoFit=!1,this.setView(Ks(this.view,t,this.size))}fit(){this.measure(),this.setView(_s(this.model.bounds(this.positions),this.size,32,this.minZoom,Math.min(1,this.maxZoom))),this.autoFit=!0}zoomIn(){this.zoomBy(1.25)}zoomOut(){this.zoomBy(0.8)}zoomBy(e,t){this.autoFit=!1,this.setView(Bs(this.view,t??{x:this.size.width/2,y:this.size.height/2},e,this.minZoom,this.maxZoom))}panBy(e,t){this.autoFit=!1,this.setView(Ue(this.view,e,t))}setZoomLimits(e,t){this.minZoom=e,this.maxZoom=t}destroy(){this.stop(),this.observer?.disconnect();for(let e of this.disposers)e();this.svg.remove(),this.root.removeAttribute("data-gv-ready")}selection(){let e=this.selected?this.model.node(this.selected)??null:null;return{node:e,neighbours:e?this.model.neighbours(e.id).map((t)=>this.model.node(t)):[]}}measure(){let e=this.surface.getBoundingClientRect();this.size={width:e.width,height:e.height}}layout(e){let t=performance.now();if(this.layoutName==="layered")this.positions=Vs(this.model,{direction:this.direction}).positions;else this.positions=Hs(this.model,{positions:e&&this.positions.size?this.positions:null,pinned:e?this.pinned:null});this.timings.layout=performance.now()-t}relayout(){if(this.pinned.clear(),this.layout(!1),this.sync(),this.moveToPlace(),this.autoFit)this.fit()}render(){let e=performance.now();this.sync(),this.draw(),this.timings.render=performance.now()-e}sync(){let e=Ds(this.model.metrics);for(let[t,s]of this.nodeEls)if(!this.model.has(t))s.remove(),this.nodeEls.delete(t);for(let t of this.model.nodes){let s=this.nodeEls.get(t.id);if(!s)s=this.buildNode(t,e),this.nodeEls.set(t.id,s),this.idOf.set(s,t.id),this.nodeLayer.append(s);let a=this.model.degree(t.id);s.setAttribute("aria-label",`${oe(t)}, ${a} ${a===1?"connection":"connections"}`)}for(let[t,s]of this.edgeEls)if(!this.model.edge(t))s.group.remove(),s.label?.remove(),this.edgeEls.delete(t);for(let t of this.model.edges)if(!this.edgeEls.has(t.id))this.edgeEls.set(t.id,this.buildEdge(t));this.offsets=Rs(this.model.edges)}buildNode(e,t){let s=this.model.size(e.id),a=q("g",{class:"stx-gv-node",id:`${this.prefix}-node-${this.serial++}`,role:"group","data-node":e.id});if(e.kind)a.setAttribute("data-kind",e.kind);if(e.expandable===!0)a.setAttribute("data-expandable","");let n=q("title");n.textContent=e.detail?`${oe(e)}: ${e.detail}`:oe(e);let o=q("rect",{x:-s.width/2,y:-s.height/2,width:s.width,height:s.height,rx:6,ry:6}),i=e.expandable===!0?(this.model.metrics.charWidth+4)/2:0,r=q("text",{class:"stx-gv-node-label",x:-i,y:e.detail?-6:0,"text-anchor":"middle","dominant-baseline":"central"});if(r.textContent=We(oe(e),t),a.append(n,o,r),e.detail){let c=q("text",{class:"stx-gv-node-detail",x:-i,y:9,"text-anchor":"middle","dominant-baseline":"central"});c.textContent=We(e.detail,Math.floor(t/0.85)),a.append(c)}if(e.expandable===!0){let c=q("text",{class:"stx-gv-node-mark",x:s.width/2-10,y:0,"text-anchor":"middle","dominant-baseline":"central","aria-hidden":"true"});c.textContent="+",a.append(c)}return a}buildEdge(e){let t=q("g",{class:"stx-gv-edge","data-edge":e.id}),s=q("path",{fill:"none"});if(e.directed!==!1)s.setAttribute("marker-end",`url(#${this.prefix}-arrow)`);t.append(s),this.edgeLayer.append(t);let a=null;if(e.label){let n=We(String(e.label),32),o=Math.ceil(n.length*Ki)+8;a=q("g",{class:"stx-gv-edge-label","data-edge":e.id});let i=q("rect",{x:-o/2,y:-8,width:o,height:16,rx:3,ry:3}),r=q("text",{"text-anchor":"middle","dominant-baseline":"central"});r.textContent=n,a.append(i,r),this.labelLayer.append(a)}return{group:t,path:s,label:a}}draw(){for(let[e,t]of this.nodeEls){let s=this.shown.get(e)??this.positions.get(e);if(s)t.setAttribute("transform",`translate(${s.x} ${s.y})`)}for(let e of this.model.edges)this.drawEdge(e)}shape(e){let t=this.shown.get(e.source)??this.positions.get(e.source),s=this.shown.get(e.target)??this.positions.get(e.target);if(!t||!s)return null;return Ms({source:t,sourceSize:this.model.size(e.source),target:s,targetSize:this.model.size(e.target)},{curve:this.layoutName==="layered"?"bezier":"straight",direction:this.direction,offset:this.offsets.get(e.id)??0,inset:e.directed!==!1?1:0})}drawEdge(e){let t=this.edgeEls.get(e.id),s=t&&this.shape(e);if(!t||!s)return;t.path.setAttribute("d",s.d),t.label?.setAttribute("transform",`translate(${Math.round(s.label.x*10)/10} ${Math.round(s.label.y*10)/10})`)}moveToPlace(){this.stop();let e=typeof matchMedia==="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;if(!this.animate||e||typeof requestAnimationFrame!=="function"){this.shown=new Map(this.positions),this.draw();return}let t=new Map;for(let[n,o]of this.positions)t.set(n,this.shown.get(n)??o);let s=performance.now(),a=(n)=>{let o=Math.min(1,(n-s)/_i),i=1-(1-o)**3;for(let[r,c]of this.positions){let l=t.get(r);this.shown.set(r,{x:l.x+(c.x-l.x)*i,y:l.y+(c.y-l.y)*i})}if(this.draw(),this.frame=o<1?requestAnimationFrame(a):0,o>=1)this.shown=new Map(this.positions)};this.frame=requestAnimationFrame(a)}stop(){if(this.frame)cancelAnimationFrame(this.frame);this.frame=0}setView(e){this.view=e,this.stage.setAttribute("transform",`translate(${e.x} ${e.y}) scale(${e.k})`),this.callbacks.onViewport?.({...e})}mark(){let e=this.selected,t=new Set(e?this.model.neighbours(e):[]);this.root.toggleAttribute("data-has-selection",Boolean(e));for(let[a,n]of this.nodeEls)if(n.toggleAttribute("data-selected",a===e),n.toggleAttribute("data-neighbour",t.has(a)),a===e)n.setAttribute("aria-current","true");else n.removeAttribute("aria-current");for(let a of this.model.edges){let n=this.edgeEls.get(a.id);if(!n)continue;let o=e!=null&&(a.source===e||a.target===e);if(n.group.toggleAttribute("data-active",o),n.label?.toggleAttribute("data-active",o),a.directed!==!1)n.path.setAttribute("marker-end",`url(#${this.prefix}-${o?"arrow-active":"arrow"})`)}let s=e?this.nodeEls.get(e):null;if(s)this.surface.setAttribute("aria-activedescendant",s.id);else this.surface.removeAttribute("aria-activedescendant")}describe(e){let t=this.model.node(e);if(!t)return;let s=this.model.neighbours(e).map((o)=>oe(this.model.node(o))),a=s.slice(0,5).join(", "),n=s.length>5?` and ${s.length-5} more`:"";this.announce(s.length===0?`${oe(t)}, no connections`:`${oe(t)}, ${s.length} ${s.length===1?"connection":"connections"}: ${a}${n}`)}announce(e){if(this.status)this.status.textContent=e}expand(e,t=!1){let s=this.model.node(e);if(!s)return;if(this.lastExpand=performance.now(),t||s.expandable===!1)this.callbacks.onOpen?.({node:s});else this.callbacks.onExpand?.({node:s})}nodeUnder(e){let t=e instanceof Element?e.closest(".stx-gv-node"):null;return t?this.idOf.get(t)??null:null}local(e){let t=this.surface.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}listen(){let e=(s,a,n)=>{this.surface.addEventListener(s,a,n),this.disposers.push(()=>this.surface.removeEventListener(s,a,n))};e("pointerdown",(s)=>this.onPointerDown(s)),e("pointermove",(s)=>this.onPointerMove(s)),e("pointerup",(s)=>this.onPointerUp(s)),e("pointercancel",()=>this.endGesture()),e("dblclick",(s)=>{let a=this.nodeUnder(s.target);if(a&&performance.now()-this.lastExpand>Js)this.expand(a,s.metaKey||s.ctrlKey)}),e("wheel",(s)=>this.onWheel(s),{passive:!1}),e("keydown",(s)=>this.onKeyDown(s)),e("contextmenu",(s)=>{if(this.contextMenu)s.preventDefault();let a=this.nodeUnder(s.target);if(a)this.select(a);this.callbacks.onContext?.({node:a?this.model.node(a):null,x:s.clientX,y:s.clientY})});let t=(s,a)=>{this.surface.addEventListener(s,a),this.disposers.push(()=>this.surface.removeEventListener(s,a))};t("gesturestart",(s)=>{s.preventDefault();let a=this.local(s);this.pinch={k:this.view.k,x:a.x,y:a.y}}),t("gesturechange",(s)=>{if(!this.pinch)return;s.preventDefault(),this.zoomBy(this.pinch.k*s.scale/this.view.k,{x:this.pinch.x,y:this.pinch.y})}),t("gestureend",()=>{this.pinch=null})}onPointerDown(e){if(e.button!==0)return;let t=this.nodeUnder(e.target);this.surface.focus({preventScroll:!0});try{this.surface.setPointerCapture(e.pointerId)}catch{}this.gesture={pointer:e.pointerId,node:t,startX:e.clientX,startY:e.clientY,origin:t?{...this.positions.get(t)??{x:0,y:0}}:{x:0,y:0},view:{...this.view},moved:!1}}onPointerMove(e){let t=this.gesture;if(!t||e.pointerId!==t.pointer)return;let s=e.clientX-t.startX,a=e.clientY-t.startY;if(!t.moved){if(Math.abs(s)<Us&&Math.abs(a)<Us)return;t.moved=!0,this.stop(),this.shown=new Map(this.positions),this.root.setAttribute("data-dragging",t.node?"node":"pan")}if(t.node){let n={x:t.origin.x+s/this.view.k,y:t.origin.y+a/this.view.k};this.positions.set(t.node,n),this.shown.set(t.node,n),this.nodeEls.get(t.node)?.setAttribute("transform",`translate(${n.x} ${n.y})`);for(let o of this.model.edgesOf(t.node))this.drawEdge(o)}else this.autoFit=!1,this.setView(Ue(t.view,s,a))}onPointerUp(e){let t=this.gesture;if(!t||e.pointerId!==t.pointer)return;if(this.endGesture(),t.moved){if(t.node){this.pinned.add(t.node),this.autoFit=!1;let n=this.positions.get(t.node);this.callbacks.onMove?.({node:this.model.node(t.node),x:n.x,y:n.y})}return}if(!t.node){this.select(null);return}let s=performance.now(),a=this.lastClick.id===t.node&&s-this.lastClick.at<Js;if(this.lastClick=a?{id:"",at:0}:{id:t.node,at:s},this.select(t.node),a)this.expand(t.node,e.metaKey||e.ctrlKey)}endGesture(){let e=this.gesture;if(this.gesture=null,this.root.removeAttribute("data-dragging"),e)try{this.surface.releasePointerCapture(e.pointer)}catch{}}onWheel(e){if(e.preventDefault(),e.ctrlKey||e.metaKey){this.zoomBy(Math.exp(-e.deltaY*(e.deltaMode===1?0.05:0.01)),this.local(e));return}let t=e.deltaMode===1?16:1;this.panBy(-e.deltaX*t,-e.deltaY*t)}onKeyDown(e){let s={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"}[e.key];if(s){e.preventDefault();let n=this.selected?Ws(this.positions,this.selected,s):Gs(this.positions,Et(this.view,{x:this.size.width/2,y:this.size.height/2}));if(n)this.select(n),this.bringIntoView(n);return}let a=e.metaKey||e.ctrlKey;if(e.key==="Enter"||e.key===" "){if(!this.selected)return;e.preventDefault(),this.expand(this.selected,a)}else if(a||e.altKey);else if(e.key==="+"||e.key==="=")e.preventDefault(),this.zoomIn();else if(e.key==="-"||e.key==="_")e.preventDefault(),this.zoomOut();else if(e.key==="0")e.preventDefault(),this.fit();else if(e.key==="f"||e.key==="F"){if(!this.selected)return;e.preventDefault(),this.focusNode(this.selected)}else if(e.key==="o"||e.key==="O"){if(!this.selected)return;e.preventDefault(),this.expand(this.selected,!0)}else if(e.key==="Escape"&&this.selected)e.preventDefault(),this.select(null)}bringIntoView(e){let t=this.positions.get(e);if(!t)return;let s=this.model.size(e),a=qs(this.view,{x:t.x-s.width/2,y:t.y-s.height/2,width:s.width,height:s.height},this.size);if(a!==this.view)this.autoFit=!1,this.setView(a)}}var Ui="./GroupedList-j3sxv5pb.stx";var Yi="./GroupedListRow-dnqc6j85.stx";var Zi="./Image-6x38ddd7.stx";var er="./EmailInput-sf9jfrgz.stx";var sr="./NumberInput-e2afxyh3.stx";var nr="./PasswordInput-d78bk8r0.stx";var ir="./SearchInput-w15r5t95.stx";var lr="./TextInput-fge1b7tk.stx";var cr={value:f.string,onChange:f.func,placeholder:f.string,disabled:f.boolean,readonly:f.boolean,size:f.oneOf(["sm","md","lg"]),error:f.boolean,label:f.string,helperText:f.string,required:f.boolean,className:f.string,inputClassName:f.string},dr={value:f.string,onChange:f.func,placeholder:f.string,disabled:f.boolean,readonly:f.boolean,size:f.oneOf(["sm","md","lg"]),error:f.boolean,label:f.string,helperText:f.string,required:f.boolean,className:f.string,inputClassName:f.string,leftIcon:f.string,rightIcon:f.string,clearable:f.boolean,maxLength:f.number,showCount:f.boolean,type:f.oneOf(["text","date","time","datetime-local","month","week","url","tel","color","search","email","number","password"]),pattern:f.string,list:f.string,minLength:f.number,htmlSize:f.number,autofocus:f.boolean},pr={value:f.string,onChange:f.func,placeholder:f.string,disabled:f.boolean,readonly:f.boolean,size:f.oneOf(["sm","md","lg"]),error:f.boolean,label:f.string,helperText:f.string,required:f.boolean,className:f.string,inputClassName:f.string,min:f.number,max:f.number,step:f.number,showControls:f.boolean},hr={value:f.string,onChange:f.func,placeholder:f.string,disabled:f.boolean,readonly:f.boolean,size:f.oneOf(["sm","md","lg"]),error:f.boolean,label:f.string,helperText:f.string,required:f.boolean,className:f.string,inputClassName:f.string,showStrength:f.boolean},ur={value:f.string,onChange:f.func,placeholder:f.string,disabled:f.boolean,readonly:f.boolean,size:f.oneOf(["sm","md","lg"]),error:f.boolean,label:f.string,helperText:f.string,required:f.boolean,className:f.string,inputClassName:f.string,onSearch:f.func,loading:f.boolean},_g=ae("TextInput",dr),Kg=ae("EmailInput",cr),qg=ae("PasswordInput",hr),Wg=ae("NumberInput",pr),Gg=ae("SearchInput",ur);var fr=new Set(["array","set"]),mr=/^[A-Z_$][\w$]*$/i;function Pt(e){return fr.has(e.kind)}function It(e){return e.ref===void 0&&(e.children!==void 0&&e.children.length>0||(e.more??0)>0)}function Mt(e,t="$"){let s=t;for(let a of e)if(typeof a==="number")s+=`[${a}]`;else if(mr.test(a))s+=`.${a}`;else s+=`[${JSON.stringify(a)}]`;return s}function At(e){if(e.ref!==void 0)return"[Circular]";if(e.children){if(Pt(e))return e.children.map((s)=>At(s));let t={};return e.children.forEach((s,a)=>{t[s.key!==void 0?String(s.key):s.label??String(a)]=At(s)}),t}if("value"in e){let t=e.value;if(typeof t==="bigint")return t.toString();if(typeof t==="number"&&!Number.isFinite(t))return String(t);if(typeof t==="function"||typeof t==="symbol")return e.preview??String(t);return t}return e.preview??null}function Xs(e,t=2){let s=At(e);return s===void 0?"undefined":JSON.stringify(s,null,t)}var Ys=80;function Rt(e){if(e.preview!==void 0)return e.preview;if(e.ref!==void 0)return"[Circular]";if(e.children||e.more){let t=(e.children?.length??0)+(e.more??0);if(Pt(e))return`${e.kind==="set"?"Set":"Array"}(${t})`;return t===0?"{}":`{${t}}`}if("value"in e){let t=e.value;if(typeof t==="string")return JSON.stringify(t.length>Ys?`${t.slice(0,Ys)}\u2026`:t);if(typeof t==="bigint")return`${t}n`;return String(t)}return e.kind}function ex(e,t,s={}){let a=s.maxItems??1000,n=s.maxDepth??32,o=new Map,i=1,r=(l,d)=>{if(d!==void 0)l.label=d;return l},c=(l,d,h)=>{if(l===null)return r({kind:"null",value:null,preview:"null"},d);switch(typeof l){case"undefined":return r({kind:"undefined",value:void 0,preview:"undefined"},d);case"string":case"number":case"boolean":case"bigint":return r({kind:typeof l,value:l},d);case"symbol":return r({kind:"symbol",preview:l.toString()},d);case"function":return r({kind:"function",preview:`\u0192 ${l.name||"(anonymous)"}()`},d)}let p=l,u=o.get(p);if(u!==void 0)return r({kind:"ref",ref:u},d);if(p instanceof Date)return r({kind:"date",value:Number.isNaN(p.getTime())?null:p.toISOString(),preview:Number.isNaN(p.getTime())?"Invalid Date":p.toISOString()},d);if(p instanceof RegExp)return r({kind:"regexp",value:p.toString(),preview:p.toString()},d);let g=`v${i++}`;o.set(p,g);let m=Array.isArray(p),w=p instanceof Set,y=p instanceof Map,v=r({id:g,kind:m?"array":w?"set":y?"map":"object",children:[]},d);if(h>=n)return v.preview=m?"Array":"Object",delete v.children,v;let b=v.children,C=0;if(m||w)for(let P of p){if(C<a)b.push(c(P,String(C),h+1));C++}else if(y)for(let[P,T]of p){if(C<a)b.push(c(T,typeof P==="string"?P:Rt(c(P,void 0,n)),h+1));C++}else{for(let T of Object.keys(p)){if(C<a)b.push(c(p[T],T,h+1));C++}let P=p.constructor?.name;if(P&&P!=="Object")v.preview=`${P} {${C}}`}if(C>b.length)v.more=C-b.length;if(y)v.preview=`Map(${C})`;return v};return c(e,t,0)}class Nt{rows=[];version=0;roots=[];depth;opened=new Set;closed=new Set;index=null;constructor(e,t={}){this.depth=t.depth??1,this.setValue(e)}setValue(e){this.roots=e==null?[]:Array.isArray(e)?e:[e],this.opened.clear(),this.closed.clear(),this.flatten()}setDepth(e){this.depth=e,this.opened.clear(),this.closed.clear(),this.flatten()}getRoots(){return this.roots}indexOf(e){if(!this.index){this.index=new Map;for(let t=0;t<this.rows.length;t++)this.index.set(this.rows[t].id,t)}return this.index.get(e)??-1}pathOf(e){let t=[];for(let s=e;s>=0;s=this.rows[s].parent){let a=this.rows[s];if(a.isMore)continue;if(a.parent!==-1||this.roots.length>1)t.push(a.key)}return t.reverse()}isExpanded(e,t){return this.opened.has(e)||t<this.depth&&!this.closed.has(e)}expand(e){return this.set(e,!0)}collapse(e){return this.set(e,!1)}toggle(e){let t=this.indexOf(e);if(t===-1)return!1;return this.set(e,!this.rows[t].expanded)}expandAll(e){let t=(s,a,n)=>{if(!It(s))return;if(n>=this.depth)this.opened.add(a);this.closed.delete(a),s.children?.forEach((o,i)=>t(o,o.id??`${a}.${i}`,n+1))};if(e===void 0)this.roots.forEach((s,a)=>t(s,s.id??String(a),0));else{let s=this.find(e);if(!s)return;t(s.node,e,s.ancestors.length)}this.flatten()}collapseAll(){this.opened.clear(),this.closed.clear();let e=(t,s,a)=>{if(a>=this.depth||!It(t))return;this.closed.add(s),t.children?.forEach((n,o)=>e(n,n.id??`${s}.${o}`,a+1))};this.roots.forEach((t,s)=>e(t,t.id??String(s),0)),this.flatten()}reveal(e){let t=this.find(e);if(!t)return-1;return t.ancestors.forEach((s,a)=>{if(this.closed.delete(s),a>=this.depth)this.opened.add(s)}),this.flatten(),this.indexOf(e)}appendChildren(e,t,s=0){let a=this.find(e);if(!a)return!1;let n=a.node;if(n.children=[...n.children??[],...t],s>0)n.more=s;else delete n.more;return this.flatten(),!0}move(e,t,s=10){let a=this.rows.length-1;if(a<0)return{index:-1,changed:!1};let n=Math.min(Math.max(e,0),a),o=this.rows[n],i=(r)=>({index:Math.min(Math.max(r,0),a),changed:!1});switch(t){case"ArrowDown":return i(e<0?0:n+1);case"ArrowUp":return i(n-1);case"Home":return i(0);case"End":return i(a);case"PageDown":return i(n+s);case"PageUp":return i(n-s);case"ArrowRight":if(!o.expandable||o.isMore)return i(n);if(!o.expanded)return{index:n,changed:this.expand(o.id)};return i(n+1);case"ArrowLeft":if(o.expanded&&!o.isMore)return{index:n,changed:this.collapse(o.id)};return i(o.parent===-1?n:o.parent);case"*":{let r=!1,c=o.parent,l=this.rows.filter((d)=>d.parent===c&&d.depth===o.depth&&d.expandable&&!d.expanded&&!d.isMore);for(let d of l)this.mark(d.id,d.depth,!0),r=!0;if(r)this.flatten();return{index:this.indexOf(o.id),changed:r}}}return i(n)}typeahead(e,t){let s=t.toLowerCase(),a=this.rows.length;if(s===""||a===0)return-1;let n=s.length===1?e+1:Math.max(e,0);for(let o=0;o<a;o++){let i=(n+o+a)%a,r=this.rows[i];if(!r.isMore&&(r.node.label??"").toLowerCase().startsWith(s))return i}return-1}set(e,t){let s=this.indexOf(e);if(s===-1)return!1;let a=this.rows[s];if(!a.expandable||a.isMore||a.expanded===t)return!1;return this.mark(e,a.depth,t),this.flatten(),!0}mark(e,t,s){if(s){if(this.closed.delete(e),t>=this.depth)this.opened.add(e)}else if(this.opened.delete(e),t<this.depth)this.closed.add(e)}find(e){let t=[];for(let s=this.roots.length-1;s>=0;s--)t.push({node:this.roots[s],id:this.roots[s].id??String(s),ancestors:[]});while(t.length>0){let s=t.pop();if(s.id===e)return{node:s.node,ancestors:s.ancestors};let a=s.node.children;if(!a||s.node.ref!==void 0)continue;let n=[...s.ancestors,s.id];for(let o=a.length-1;o>=0;o--)t.push({node:a[o],id:a[o].id??`${s.id}.${o}`,ancestors:n})}return null}flatten(){let e=[],t=(s,a,n,o,i,r,c)=>{let l=It(s),d=l&&this.isExpanded(a,n),h=e.length;if(e.push({id:a,node:s,depth:n,key:i,parent:o,expandable:l,expanded:d,posInSet:r,setSize:c,isMore:!1}),!d)return;let p=s.children??[],u=s.more??0,g=Pt(s),m=p.length+(u>0?1:0);for(let w=0;w<p.length;w++){let y=p[w];t(y,y.id??`${a}.${w}`,n+1,h,y.key??(g?w:y.label??w),w+1,m)}if(u>0)e.push({id:`${a}.+`,node:s,depth:n+1,key:"",parent:h,expandable:!1,expanded:!1,posInSet:m,setSize:m,isMore:!0})};this.roots.forEach((s,a)=>t(s,s.id??String(a),0,-1,s.key??a,a+1,this.roots.length)),this.rows=e,this.index=null,this.version++}}var xr="./JsonTree-satc4010.stx";var ea=new Set(["array","object","map","set","model","error"]);function br(e){return e.t==="object"||e.t==="model"}function Zs(e){return e.length>0&&e.slice(0,20).every(br)}function Qs(e){return e.some((t)=>ea.has(t.t))}function Lt(e,t){let s=e.length>120?`${e.slice(0,120)}\u2026`:e;return t?`${JSON.stringify(s)} (${t} more characters)`:JSON.stringify(s)}function vr(e){if(!e.file)return"";return[e.file,e.line,e.column].filter((t)=>t!==void 0).join(":")}function ax(e,t,s={}){let a=s.idPrefix??"t",n=(l)=>`${a}${l}`,o=(l,d)=>{if(d!==void 0)l.label=d;return l},i=(l)=>c(l,void 0).preview??l.t,r=(l,d)=>{if(d.length>0)l.openable=d.length===1?d[0]:d;return l};function c(l,d){switch(l.t){case"undefined":return o({kind:"undefined",value:void 0,preview:"undefined"},d);case"null":return o({kind:"null",value:null,preview:"null"},d);case"boolean":return o({kind:"boolean",value:l.v,preview:String(l.v)},d);case"number":{let h=typeof l.v==="number"?l.v:l.v==="-0"?-0:Number(l.v);return o({kind:"number",value:h,preview:String(l.v)},d)}case"bigint":return o({kind:"bigint",value:l.v,preview:`${l.v}n`},d);case"string":return o({kind:"string",value:l.v,preview:Lt(l.v,l.truncated)},d);case"symbol":return o({kind:"symbol",preview:`Symbol(${l.v})`},d);case"function":{let h=l.kind==="class"?`class ${l.name}`:`${l.kind==="async"?"async ":""}\u0192${l.kind==="generator"?"*":""} ${l.name}()`;return o({kind:"function",preview:h},d)}case"date":return o({kind:"date",value:l.v,preview:l.v??"Invalid Date"},d);case"regexp":return o({kind:"regexp",value:l.v,preview:l.v},d);case"url":return o({kind:"url",value:l.v,preview:l.v},d);case"promise":return o({kind:"promise",preview:"Promise"},d);case"bytes":{let h=l.length*2>l.hex.length;return o({kind:"bytes",value:l.hex,preview:`${l.ctor}(${l.length}) <${l.hex}${h?"\u2026":""}>`},d)}case"ref":return o({kind:"ref",ref:n(l.id),preview:"[Circular]"},d);case"cut":return o({kind:"cut",preview:`${l.ctor??"Object"} \u2026 (${l.reason==="depth"?"too deep to show":"result too large to show"})`},d);case"array":{let h={id:n(l.id),kind:"array",preview:`${l.ctor??"Array"}(${l.length})`,children:l.items.map((p,u)=>c(p,String(u)))};if(l.more)h.more=l.more;return o(r(h,Zs(l.items)?["table"]:[]),d)}case"set":{let h={id:n(l.id),kind:"set",preview:`Set(${l.size})`,children:l.items.map((p,u)=>c(p,String(u)))};if(l.more)h.more=l.more;return o(r(h,Zs(l.items)?["table"]:[]),d)}case"object":{let h=l.entries.slice(0,5).map(([m])=>m).join(", "),p=l.entries.length+(l.more??0),u=p===0?"{}":`{${h}${p>5?", \u2026":""}}`,g={id:n(l.id),kind:"object",preview:l.ctor&&l.ctor!=="Object"?`${l.ctor} ${u}`:u,children:l.entries.map(([m,w])=>c(w,m))};if(l.more)g.more=l.more;return o(r(g,Qs(l.entries.map((m)=>m[1]))?["graph"]:[]),d)}case"map":{let h={id:n(l.id),kind:"map",preview:`Map(${l.size})`,children:l.entries.map(([p,u],g)=>{if(!ea.has(p.t)){let m=c(u,i(p));return m.key=p.t==="string"?p.v:i(p),m}return{kind:"entry",label:String(g),key:g,preview:`${i(p)} => ${i(u)}`,children:[c(p,"key"),c(u,"value")]}})};if(l.more)h.more=l.more;return o(r(h,Qs(l.entries.map((p)=>p[1]))?["graph"]:[]),d)}case"model":{let h=l.attributes.map(([g,m])=>c(m,g));for(let[g,m]of l.loaded??[]){let w=c(m,g);w.meta=w.meta??{relation:!0},h.push(w)}if(l.hidden?.length)h.push({kind:"hidden",label:"[hidden]",key:"[hidden]",preview:l.hidden.join(", "),children:l.hidden.map((g,m)=>({kind:"hidden",label:String(m),value:g,preview:g}))});if(l.relations?.length)h.push({kind:"relations",label:"[relations]",key:"[relations]",preview:`${l.relations.length} declared`,children:l.relations.map((g)=>({kind:"relation",label:g.name??g.model,value:g,preview:`${g.kind} ${g.model}`}))});let p={model:l.model,hidden:l.hidden??[],relations:l.relations??[]};if(l.table)p.table=l.table;if(l.primaryKey)p.primaryKey=l.primaryKey;let u={id:n(l.id),kind:"model",preview:l.key?`${l.model} #${i(l.key).replace(/^"|"$/g,"")}`:l.model,children:h,meta:p};if(l.more)u.more=l.more;return o(r(u,["graph"]),d)}case"html":{let h={kind:l.kind};if(l.title)h.title=l.title;if(l.text)h.text=l.text;if(l.truncated)h.truncated=l.truncated;let p=l.truncated?`, ${l.truncated} more cut`:"",u=l.title?`: ${l.title}`:"";return o(r({kind:"html",value:l.html,preview:`${l.kind}${u} (${l.html.length} characters${p})`,meta:h},["preview"]),d)}case"error":{let h=[{kind:"string",label:"message",value:l.message,preview:Lt(l.message)}];if(l.frames?.length)h.push({kind:"stack",label:"stack",preview:`${l.frames.length} frames`,value:l.stack,children:l.frames.map((p,u)=>({kind:"frame",label:String(u),value:p,preview:[p.function,vr(p)].filter(Boolean).join(" at ")||"(unknown)",meta:p}))});else if(l.stack)h.push({kind:"string",label:"stack",value:l.stack,preview:Lt(l.stack)});if(l.cause)h.push(c(l.cause,"cause"));for(let[p,u]of l.entries??[])h.push(c(u,p));return o({kind:"error",preview:l.message?`${l.name}: ${l.message}`:l.name,children:h},d)}}return o({kind:"unknown",preview:String(l.t??"unknown")},d)}return c(e,t)}var wr=600,ta=400,sa={table:"Table",graph:"Graph",preview:"Preview"};function aa(e){return e.length>ta?`${e.slice(0,ta)}\u2026`:e}function na(e){if(e==null||e==="")return[];return Array.isArray(e)?e:[e]}class yr{root;callbacks;model;scroller;content;rowsEl;status;prefix;rowHeight;overscan;openable;contextMenu;pool=[];parts=new WeakMap;active=-1;activeId="";typed="";typedAt=0;observer=null;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;let a=(o)=>e.querySelector(`[data-jt="${o}"]`);this.scroller=a("scroller")??e,this.content=a("content")??this.scroller,this.rowsEl=a("rows")??this.content,this.status=a("status"),this.prefix=`${e.id||`json-tree-${Math.random().toString(36).slice(2,8)}`}-row-`,this.rowHeight=t.rowHeight&&t.rowHeight>0?t.rowHeight:22,this.overscan=t.overscan??6,this.openable=t.openable??null,this.contextMenu=Boolean(t.contextMenu),this.model=new Nt(t.value,{depth:t.depth??1}),this.rowsEl.__stx_inert_content=!0,e.style.setProperty("--stx-tree-row-height",`${this.rowHeight}px`);let n=(o,i,r,c)=>{o.addEventListener(i,r,c),this.disposers.push(()=>o.removeEventListener(i,r,c))};if(n(this.scroller,"scroll",()=>this.render(),{passive:!0}),n(this.scroller,"keydown",(o)=>this.onKeyDown(o)),n(this.scroller,"focus",()=>{if(this.active===-1&&this.model.rows.length>0)this.setActive(0,!1)}),n(this.rowsEl,"mousedown",(o)=>{if(o.target.closest("[data-jt-action]"))o.preventDefault()}),n(this.rowsEl,"click",(o)=>this.onClick(o)),n(this.rowsEl,"dblclick",(o)=>this.onDoubleClick(o)),n(this.rowsEl,"contextmenu",(o)=>this.onContextMenu(o)),typeof ResizeObserver<"u")this.observer=new ResizeObserver(()=>this.render()),this.observer.observe(this.scroller);this.render(),e.setAttribute("data-jt-ready","")}setValue(e){this.model.setValue(e),this.active=-1,this.activeId="",this.scroller.scrollTop=0,this.render()}setDepth(e){this.model.setDepth(e),this.afterChange()}setOpenable(e){this.openable=e??null,this.model.version++,this.render()}setContextMenu(e){this.contextMenu=e}expandAll(e){this.model.expandAll(e),this.afterChange()}collapseAll(){this.model.collapseAll(),this.afterChange()}expand(e){let t=this.model.expand(e);if(t)this.afterChange();return t}collapse(e){let t=this.model.collapse(e);if(t)this.afterChange();return t}reveal(e){let t=this.model.reveal(e);if(t===-1)return this.afterChange(),!1;return this.active=t,this.activeId=e,this.scrollToRow(t),this.render(),this.emitSelect(),!0}appendChildren(e,t,s=0){let a=this.model.appendChildren(e,t,s);if(a)this.afterChange();return a}getSelected(){return this.active===-1?null:this.detail(this.active)}select(e){let t=this.model.indexOf(e);if(t===-1)return!1;return this.setActive(t,!0),!0}focus(){this.scroller.focus()}get drawn(){return this.pool.filter((e)=>e.style.display!=="none").length}destroy(){this.observer?.disconnect();for(let e of this.disposers)e();this.rowsEl.textContent="",this.pool=[],this.root.removeAttribute("data-jt-ready")}afterChange(){if(this.activeId){let e=this.model.indexOf(this.activeId);if(this.active=e,e===-1)this.activeId=""}this.render()}detail(e){let t=this.model.rows[e],s=this.model.pathOf(e);return{id:t.id,node:t.node,path:s,pathText:Mt(s)}}emitSelect(){if(this.active!==-1)this.callbacks.onSelect?.(this.detail(this.active))}setActive(e,t){if(e<0||e>=this.model.rows.length)return;let s=e!==this.active;if(this.active=e,this.activeId=this.model.rows[e].id,t)this.scrollToRow(e);if(this.render(),s)this.emitSelect()}scrollToRow(e){let t=e*this.rowHeight,s=this.scroller.clientHeight;if(t<this.scroller.scrollTop)this.scroller.scrollTop=t;else if(t+this.rowHeight>this.scroller.scrollTop+s)this.scroller.scrollTop=t+this.rowHeight-s}pageSize(){return Math.max(1,Math.floor(this.scroller.clientHeight/this.rowHeight)-1)}createRow(){let e=document.createElement("div");e.setAttribute("role","treeitem"),e.className="stx-jt-row";let t=(a,n)=>{let o=document.createElement("span");if(o.className=a,n)o.setAttribute("aria-hidden","true");return e.appendChild(o),o},s={twisty:t("stx-jt-twisty",!0),label:t("stx-jt-label",!1),separator:t("stx-jt-separator",!0),preview:t("stx-jt-preview",!1),actions:t("stx-jt-actions",!1)};return s.separator.textContent=": ",this.parts.set(e,s),this.rowsEl.appendChild(e),e}button(e,t,s,a){let n=document.createElement("button");if(n.type="button",n.tabIndex=-1,n.className="stx-jt-action",n.setAttribute("data-jt-action",e),a)n.setAttribute("data-jt-as",a);return n.setAttribute("aria-label",s),n.textContent=t,n}opensOf(e,t){if(e.isMore)return[];if(this.openable){let s=this.openable(e.node,this.model.pathOf(t));if(s!==void 0)return na(s)}return na(e.node.openable)}render(){let e=this.model.rows,t=e.length,s=this.scroller.clientHeight;this.content.style.height=`${t*this.rowHeight}px`;let a=Math.max(0,Math.min(this.scroller.scrollTop,t*this.rowHeight-s)),n=Math.max(0,Math.floor(a/this.rowHeight)-this.overscan),o=Math.min(t,Math.ceil((a+s)/this.rowHeight)+this.overscan),i=Math.max(0,o-n);while(this.pool.length<i)this.pool.push(this.createRow());let r=this.pool.length,c=new Uint8Array(r);for(let d=n;d<o;d++){let h=d%r;c[h]=1,this.paint(this.pool[h],e[d],d)}for(let d=0;d<r;d++)if(!c[d]&&this.pool[d].style.display!=="none")this.pool[d].style.display="none",this.pool[d].__jt=void 0,this.pool[d].removeAttribute("id");if(this.active>=n&&this.active<o)this.scroller.setAttribute("aria-activedescendant",this.prefix+this.active);else this.scroller.removeAttribute("aria-activedescendant")}paint(e,t,s){let a=this.model.version,n=s===this.active,o=e.__jt;if(!o||o.index!==s||o.version!==a){let i=this.parts.get(e),r=t.node;if(e.style.display="",e.style.transform=`translateY(${s*this.rowHeight}px)`,e.style.setProperty("--stx-tree-depth",String(t.depth)),e.id=this.prefix+s,e.setAttribute("data-jt-index",String(s)),e.setAttribute("aria-level",String(t.depth+1)),e.setAttribute("aria-posinset",String(t.posInSet)),e.setAttribute("aria-setsize",String(t.setSize)),t.expandable)e.setAttribute("aria-expanded",t.expanded?"true":"false");else e.removeAttribute("aria-expanded");if(t.isMore)e.setAttribute("data-kind","more"),i.twisty.textContent="",i.label.textContent="",i.separator.style.display="none",i.preview.textContent=`\u2026 ${r.more} more`,i.preview.setAttribute("data-kind","more");else{e.setAttribute("data-kind",r.kind),i.twisty.textContent=t.expandable?t.expanded?"\u25BE":"\u25B8":"";let d=r.label??(typeof t.key==="number"&&t.parent!==-1?String(t.key):"");i.label.textContent=aa(d),i.separator.style.display=d===""?"none":"",i.preview.textContent=aa(Rt(r)),i.preview.setAttribute("data-kind",r.kind)}let c=this.opensOf(t,s),l=t.isMore?"+":c.join("|");if(!o||o.opens!==l)if(i.actions.textContent="",t.isMore)i.actions.appendChild(this.button("more","Load","Load more"));else{for(let d of c)i.actions.appendChild(this.button("open",sa[d]??d,`Open as ${sa[d]?.toLowerCase()??d}`,d));i.actions.appendChild(this.button("copy-value","Copy","Copy value")),i.actions.appendChild(this.button("copy-path","Path","Copy path"))}e.__jt={index:s,version:a,opens:l}}if(n)e.setAttribute("aria-selected","true"),e.setAttribute("data-active","");else e.setAttribute("aria-selected","false"),e.removeAttribute("data-active")}rowIndexOf(e){let t=e instanceof Element?e.closest("[data-jt-index]"):null;if(!t||t.style.display==="none")return-1;return Number(t.getAttribute("data-jt-index"))}say(e){if(this.status)this.status.textContent=e}toggleRow(e){let t=this.model.rows[e];if(!t)return;if(t.isMore){this.loadMore(e);return}if(t.node.ref!==void 0){this.follow(e);return}if(!t.expandable)return;let s=t.id;this.model.toggle(s),this.afterChange();let a=this.model.indexOf(s);if(a!==-1)this.callbacks.onToggle?.({...this.detail(a),expanded:this.model.rows[a].expanded})}follow(e){let t=this.model.rows[e].node.ref;if(t===void 0)return;if(!this.reveal(t))this.say("The value this points back to is not part of what was sent.")}loadMore(e){let s=this.model.rows[e].parent;if(s===-1)return;this.callbacks.onLoadMore?.(this.detail(s))}copy(e,t){let s=this.model.rows[e];if(!s)return;let a=s.isMore?s.parent:e,n=this.model.pathOf(a),o=this.model.rows[a].node,i=t==="path"?Mt(n):Xs(o);try{navigator.clipboard?.writeText(i)?.catch(()=>{})}catch{}this.say(t==="path"?`Copied path ${i}`:"Copied value"),this.callbacks.onCopy?.({what:t,text:i,path:n,node:o})}open(e,t){let s=this.model.rows[e];if(!s||s.isMore)return;let a=t??this.opensOf(s,e)[0];if(a===void 0)return;this.callbacks.onOpen?.({...this.detail(e),as:a})}onClick(e){let t=this.rowIndexOf(e.target);if(t===-1)return;let s=e.target instanceof Element?e.target.closest("[data-jt-action]"):null;if(this.setActive(t,!1),s){let n=s.getAttribute("data-jt-action");if(n==="copy-value")this.copy(t,"value");else if(n==="copy-path")this.copy(t,"path");else if(n==="open")this.open(t,s.getAttribute("data-jt-as")??void 0);else if(n==="more")this.loadMore(t);return}let a=this.model.rows[t];if(a.expandable||a.isMore||a.node.ref!==void 0)this.toggleRow(t)}onDoubleClick(e){let t=this.rowIndexOf(e.target);if(t===-1||e.target instanceof Element&&e.target.closest("[data-jt-action]"))return;let s=this.model.rows[t];if(!s.expandable&&!s.isMore&&s.node.ref===void 0)this.open(t)}onContextMenu(e){let t=this.rowIndexOf(e.target);if(t===-1)return;if(this.setActive(t,!1),this.contextMenu)e.preventDefault();this.callbacks.onContext?.({...this.detail(t),x:e.clientX,y:e.clientY})}onKeyDown(e){let t=this.model.rows;if(t.length===0)return;let s=e.metaKey||e.ctrlKey,a=e.key;if(s&&(a==="c"||a==="C")){if(this.active===-1)return;e.preventDefault(),this.copy(this.active,e.shiftKey?"path":"value");return}if(s||e.altKey)return;if(a==="Enter"&&e.shiftKey){if(e.preventDefault(),this.active!==-1)this.open(this.active);return}let n=this.typed!==""&&Date.now()-this.typedAt<=wr;if(a==="Enter"||a===" "&&!n){if(e.preventDefault(),this.active!==-1)this.toggleRow(this.active);return}if(a==="ArrowDown"||a==="ArrowUp"||a==="ArrowLeft"||a==="ArrowRight"||a==="Home"||a==="End"||a==="PageDown"||a==="PageUp"||a==="*"){e.preventDefault(),this.typed="";let o=this.active===-1?null:t[this.active],i=o?.expanded,r=this.model.move(this.active,a,this.pageSize());if(r.changed){if(this.active=r.index,this.activeId=this.model.rows[r.index]?.id??"",this.scrollToRow(r.index),this.render(),o&&a!=="*"){let c=this.model.indexOf(o.id);if(c!==-1&&this.model.rows[c].expanded!==i)this.callbacks.onToggle?.({...this.detail(c),expanded:this.model.rows[c].expanded})}}else this.setActive(r.index,!0);return}if(a.length===1){let o=Date.now();if(!n)this.typed="";this.typedAt=o,this.typed+=a;let i=this.model.typeahead(this.active,this.typed);if(i!==-1)e.preventDefault(),this.setActive(i,!0)}}}var Sr="./List-5ey6k813.stx";var Tr="./SwipeRow-wje3yj6c.stx";var Er="./Listbox-83j2q4x6.stx";var Ar="./ListboxButton-gan8e3nw.stx";var Mr="./ListboxLabel-ka0hfm7b.stx";var Nr="./ListboxOption-gpaqvk3s.stx";var Dr="./ListboxOptions-2928864k.stx";var zr="./FilterChip-bynt5maa.stx";var Fr="./FilterChips-xg7pgkk2.stx";var jr="./ListRow-1qvkjt4v.stx";var _r="./NavBar-ky8tedjb.stx";var qr="./SectionCard-8b5fyrjd.stx";var Gr="./TabBar-6m1ajm1d.stx";var Jr="./TabBarItem-kddfnhk3.stx";var Xr="./Navigator-1yk1c3pp.stx";var Qr="./Notification-b3cz24f0.stx";var tl="./Pager-w4eb64na.stx";var al="./PagerDots-076w890y.stx";var ol="./Pagination-8bhbkpcp.stx";var rl="./Checkout-crbegxyv.stx";var cl="./DefaultPaymentMethod-ss3x61tr.stx";var pl="./PaymentMethods-z4hhr0kv.stx";var ul="./SubscriptionCheckout-rdcv32n1.stx";var ml="./Popover-jjt7p7sn.stx";var xl="./PopoverButton-ks3cttd9.stx";var vl="./PopoverPanel-ddgj4gz3.stx";var yl="./Portal-m73vz879.stx";var ia=[{name:"phone",label:"Phone",width:390,height:844},{name:"tablet",label:"Tablet",width:820,height:1180},{name:"desktop",label:"Desktop",width:1280,height:800}];function oa(e){let t=typeof e==="string"?Number.parseFloat(e):e;return typeof t==="number"&&Number.isFinite(t)&&t>0?Math.round(t):null}function Dt(e,t={}){let s=oa(t.width),a=oa(t.height),n=Boolean(t.landscape);if(s&&a)return{name:"custom",size:{width:s,height:a},landscape:!1};let o=ia.find((r)=>r.name===e);if(!o)return{name:"fill",size:null,landscape:!1};let i=n&&o.height>o.width;return{name:o.name,size:i?{width:o.height,height:o.width}:{width:o.width,height:o.height},landscape:i}}function ra(e,t,s=0){let a=t.width-s*2,n=t.height-s*2;if(a<=0||n<=0||e.width<=0||e.height<=0)return 1;return Math.min(1,a/e.width,n/e.height)}function la(e,t=1){if(!e.size)return"Fills the frame";let s=`${e.size.width} \xD7 ${e.size.height}`;return t<0.995?`${s} at ${Math.round(t*100)}%`:s}function Ot(e){return e==="light"||e==="dark"?e:"auto"}var kl=["allow-same-origin","allow-top-navigation","allow-top-navigation-by-user-activation","allow-top-navigation-to-custom-protocols","allow-popups","allow-popups-to-escape-sandbox","allow-modals","allow-downloads","allow-pointer-lock","allow-presentation","allow-storage-access-by-user-activation"];function ca(e={}){let t=[];if(e.scripts)t.push("allow-scripts");if(e.forms)t.push("allow-forms");return t.join(" ")}function kb(e){return!e.toLowerCase().split(/\s+/).filter(Boolean).some((s)=>kl.includes(s))}var Sl=/<!doctype\s|<html[\s>]/i,Je=/<head(?:\s[^>]*)?>/i,Ye=/<html(?:\s[^>]*)?>/i,Cl=/<base[\s>]/i,Tl=/<meta[^>]+name\s*=\s*["']?color-scheme/i,$l=/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,El=/(<(style|script)\b[^>]*>)([\s\S]*?)(<\/\2\s*>)/gi,Il=/(\smedia\s*=\s*)("[^"]*"|'[^']*')/gi,Al="(min-width: 0px)",Pl="(max-width: 0px)";function Ml(e,t){let s=(o)=>o.replace($l,(i,r)=>r.toLowerCase()===t?Al:Pl),a=e.replace(El,(o,i,r,c,l)=>i+s(c)+l).replace(Il,(o,i,r)=>i+s(r)),n=`<style data-stx-preview-scheme>:root{color-scheme:${t} !important}</style>`;if(Je.test(a))return a.replace(Je,(o)=>o+n);if(Ye.test(a))return a.replace(Ye,(o)=>`${o}<head>${n}</head>`);return n+a}function Rl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function da(e,t={}){let s=Nl(e,t);return t.forceScheme?Ml(s,t.forceScheme):s}function Nl(e,t){let s=e==null?"":String(e),a='<base target="_blank">';if(!Sl.test(s))return`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="color-scheme" content="light dark"><base target="_blank">${t.title?`<title>${Rl(t.title)}</title>`:""}</head><body>${s}</body></html>`;if(Cl.test(s))return s;if(Je.test(s))return s.replace(Je,(n)=>n+'<base target="_blank">');if(Ye.test(s))return s.replace(Ye,(n)=>`${n}<head><base target="_blank"></head>`);return'<base target="_blank">'+s}function Sb(e){return Tl.test(e)}function pa(e,t){let s=["fill",...ia.map((n)=>n.name)],a=s.indexOf(e);return s[((a<0?0:a)+t+s.length)%s.length]}var Dl="./PreviewFrame-erbgvzj8.stx";var Ol=16,ha="(prefers-color-scheme: dark)",Pe;function zl(){if(Pe!==void 0)return Pe;try{if(typeof matchMedia!=="function"||!document.body)return!0;let e=matchMedia(ha).matches,t=document.createElement("iframe");t.setAttribute("aria-hidden","true"),t.tabIndex=-1,t.style.cssText=`position:absolute;width:1px;height:1px;border:0;opacity:0;pointer-events:none;color-scheme:${e?"light":"dark"}`,document.body.appendChild(t),t.offsetWidth;let s=t.contentWindow?.matchMedia?.(ha).matches;t.remove(),Pe=typeof s==="boolean"?s!==e:!0}catch{Pe=!0}return Pe}class Hl{root;callbacks;html;viewportName;frameWidth;frameHeight;landscape;scheme;scripts;forms;title;viewport;scale=1;frame=null;written;stage;device;observer=null;pending=0;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;this.html=t.html??"",this.viewportName=t.viewport||"fill",this.frameWidth=t.frameWidth??null,this.frameHeight=t.frameHeight??null,this.landscape=Boolean(t.landscape),this.scheme=Ot(t.scheme),this.scripts=Boolean(t.scripts),this.forms=Boolean(t.forms),this.title=t.title||"Preview",this.viewport=this.resolve(),this.stage=this.part("stage"),this.device=this.part("device");let a=(o)=>this.onToolbarClick(o),n=(o)=>this.onToolbarKey(o);if(this.root.addEventListener("click",a),this.root.addEventListener("keydown",n),this.disposers.push(()=>this.root.removeEventListener("click",a),()=>this.root.removeEventListener("keydown",n)),typeof ResizeObserver<"u")this.observer=new ResizeObserver(()=>{cancelAnimationFrame(this.pending),this.pending=requestAnimationFrame(()=>this.layout())}),this.observer.observe(this.stage);this.load(),this.reflect(),this.root.setAttribute("data-preview-ready","")}getState(){return{viewport:this.viewport.name,width:this.viewport.size?.width??null,height:this.viewport.size?.height??null,landscape:this.viewport.landscape,scale:this.scale,scheme:this.scheme,effectiveScheme:this.effectiveScheme()}}setHtml(e){let t=e==null?"":String(e);if(t===this.html)return;this.html=t,this.load()}setViewport(e,t={}){if(this.viewportName=e||"fill","landscape"in t)this.landscape=Boolean(t.landscape);if("width"in t)this.frameWidth=t.width??null;if("height"in t)this.frameHeight=t.height??null;let s=JSON.stringify(this.viewport);if(this.viewport=this.resolve(),this.layout(),this.reflect(),JSON.stringify(this.viewport)!==s)this.callbacks.onViewport?.(this.getState())}setScheme(e){let t=Ot(e);if(t===this.scheme)return;if(this.scheme=t,this.schemeToWrite()!==this.written)this.load();else this.applyScheme();this.reflect(),this.callbacks.onScheme?.(this.getState())}setPermissions(e){let t=e.scripts??this.scripts,s=e.forms??this.forms;if(t===this.scripts&&s===this.forms)return;this.scripts=t,this.forms=s,this.load()}reload(){this.load(),this.callbacks.onReload?.(this.getState())}destroy(){this.observer?.disconnect(),cancelAnimationFrame(this.pending);for(let e of this.disposers)e();this.frame?.remove(),this.frame=null,this.root.removeAttribute("data-preview-ready")}part(e){let t=this.root.querySelector(`[data-pf="${e}"]`);if(!t)throw Error(`PreviewFrame: the template has no ${e} part`);return t}resolve(){return Dt(this.viewportName,{width:this.frameWidth,height:this.frameHeight,landscape:this.landscape})}effectiveScheme(){if(this.scheme!=="auto")return this.scheme;if(this.root.closest(".dark"))return"dark";if(this.root.closest(".light"))return"light";return typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}schemeToWrite(){if(zl())return;if(this.scheme==="auto"&&!this.root.closest(".dark, .light"))return;return this.effectiveScheme()}load(){let e=document.createElement("iframe");e.setAttribute("sandbox",ca({scripts:this.scripts,forms:this.forms})),e.setAttribute("referrerpolicy","no-referrer"),e.setAttribute("title",this.title),e.setAttribute("data-pf","frame"),e.className="stx-preview-frame",e.addEventListener("load",()=>{if(e===this.frame)this.callbacks.onLoad?.(this.getState())}),this.written=this.schemeToWrite(),e.srcdoc=da(this.html,{title:this.title,forceScheme:this.written}),this.frame?.remove(),this.frame=e,this.applyScheme(),this.device.appendChild(e),this.layout()}applyScheme(){let e=this.effectiveScheme();if(this.root.setAttribute("data-scheme",e),this.frame)this.frame.style.colorScheme=e}layout(){let e=this.frame;if(!e)return;let t=this.viewport.size;if(this.root.setAttribute("data-viewport",this.viewport.name),!t)this.scale=1,this.device.style.width="",this.device.style.height="",e.style.width="",e.style.height="",e.style.transform="";else{let a=this.stage.getBoundingClientRect();this.scale=ra(t,{width:a.width,height:a.height},Ol),this.device.style.width=`${t.width*this.scale}px`,this.device.style.height=`${t.height*this.scale}px`,e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,e.style.transform=this.scale===1?"":`scale(${this.scale})`}let s=this.root.querySelector('[data-pf="size"]');if(s)s.textContent=la(this.viewport,this.scale)}reflect(){for(let a of this.root.querySelectorAll("[data-pf-viewport]")){let n=a.getAttribute("data-pf-viewport")===this.viewport.name;a.setAttribute("aria-checked",String(n)),a.tabIndex=n?0:-1}if(!this.root.querySelector('[data-pf-viewport][tabindex="0"]'))this.root.querySelector("[data-pf-viewport]")?.setAttribute("tabindex","0");let e=this.effectiveScheme()==="dark",t=this.root.querySelector('[data-pf-action="scheme"]');if(t){t.setAttribute("aria-pressed",String(e));let a=t.querySelector('[data-pf="scheme-text"]');if(a)a.textContent=e?"Dark":"Light"}let s=this.root.querySelector('[data-pf-action="rotate"]');if(s){let a=Dt(this.viewportName,{width:this.frameWidth,height:this.frameHeight}).size;s.disabled=!a||this.viewport.name==="custom"||a.height<=a.width,s.setAttribute("aria-pressed",String(this.viewport.landscape))}}onToolbarClick(e){let t=e.target instanceof Element?e.target.closest("[data-pf-viewport], [data-pf-action]"):null;if(!t||!this.root.contains(t))return;let s=t.getAttribute("data-pf-viewport");if(s){this.setViewport(s,{width:null,height:null});return}switch(t.getAttribute("data-pf-action")){case"scheme":this.setScheme(this.effectiveScheme()==="dark"?"light":"dark");break;case"rotate":this.setViewport(this.viewportName,{landscape:!this.landscape});break;case"reload":this.reload();break}}onToolbarKey(e){let t=e.target instanceof Element?e.target.closest("[data-pf-viewport]"):null;if(!t)return;let s=e.key==="ArrowRight"||e.key==="ArrowDown"?1:e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:0;if(s===0)return;e.preventDefault();let a=t.getAttribute("data-pf-viewport")||"fill",n=pa(a,s);this.setViewport(n,{width:null,height:null}),this.root.querySelector(`[data-pf-viewport="${n}"]`)?.focus()}}var Vl="./Progress-2qzb77kc.stx";var Bl="./Radio-8153x74w.stx";var Kl="./RadioGroup-ps9kn22f.stx";var Wl="./RadioGroupDescription-z34r9avr.stx";var Ul="./RadioGroupLabel-ka0hfm7b.stx";var Yl="./RadioGroupOption-6hyy1bvb.stx";var Zl="./RenderSurface-z9zr4d75.stx";var Ql=8192,ve=globalThis;function ec(){return ve.__stxRenderSurfaces??=new Map,ve.__stxRenderSurfaces}function ua(e,t){return Object.assign(Error(t),{code:e})}function fa(){return Boolean(ve.stx?._host?.isNative)}function tc(){if(fa())return typeof ve.craft?.renderSurface?.present==="function"&&ve.craft?.capabilities?.renderSurface===!0?"native":"none";if(typeof document>"u")return"none";return"canvas"}function sc(e,t,s,a){if(typeof e!=="string"||!e)throw TypeError("presentFrame needs the surface's name");if(!(t instanceof Uint32Array))throw TypeError("presentFrame takes a Uint32Array of 0xAARRGGBB words");for(let[n,o]of[["width",s],["height",a]])if(!Number.isInteger(o)||o<1||o>8192)throw TypeError(`presentFrame's ${n} must be a whole number from 1 to 8192, not ${o}`);if(t.length!==s*a)throw TypeError(`presentFrame was given ${t.length} words for a ${s} x ${a} frame (${s*a})`)}function ma(e,t,s,a){if(fa()){let o=ve.craft?.renderSurface;if(!o||typeof o.present!=="function")throw ua("UNAVAILABLE","This device cannot draw a RenderSurface");return o.present(e,t,s,a)}sc(e,t,s,a);let n=ec().get(e);if(!n)throw ua("NOT_FOUND",`No RenderSurface named "${e}" is on the page`);return ac(n,t,s,a),!0}function ac(e,t,s,a){let{canvas:n,context:o,opaque:i}=e;if(n.width!==s)n.width=s;if(n.height!==a)n.height=a;if(!e.image||e.image.width!==s||e.image.height!==a)e.image=o.createImageData(s,a);let r=e.image.data;for(let c=0,l=0;c<t.length;c++,l+=4){let d=t[c],h=d>>>24,p=d>>>16&255,u=d>>>8&255,g=d&255;if(i)h=255;else if(h>0&&h<255)p=Math.min(255,Math.round(p*255/h)),u=Math.min(255,Math.round(u*255/h)),g=Math.min(255,Math.round(g*255/h));r[l]=p,r[l+1]=u,r[l+2]=g,r[l+3]=h}o.putImageData(e.image,0,0)}function nc(e,t,s={}){let a=typeof requestAnimationFrame==="function"?requestAnimationFrame:(r)=>setTimeout(()=>r(Date.now()),16),n=!1,o=!1,i=(r)=>{if(n)return;if(!o)try{let c=t(r);if(c&&!ma(e,c.pixels,c.width,c.height))o=!0}catch(c){if(n=!0,c?.code==="NOT_FOUND")return;if(s.onError)s.onError(c);else throw c;return}a(i)};return a(i),{stop:()=>{n=!0},wake:()=>{o=!1},get waiting(){return o},get ended(){return n}}}var ic="./SegmentedControl-b93n9n2v.stx";var lc="./Select-p8mgxthn.stx";var Z={NONE:0,KEYWORD:1,SUBSTRING:2,WORD_PREFIX:3,PREFIX:4},nv=700,Xe=1600;function we(e){return`stx:settings:${e}`}function U(e,t){if(!t)return null;return e.find((s)=>s.id===t)??null}function cc(e){return(e.find((s)=>!s.parent)??e[0])?.id??""}function Ze(e,...t){for(let s of t)if(U(e,s))return s;return cc(e)}function Qe(e,t){let s=new Set,a=U(e,t);while(a&&a.parent&&!s.has(a.id)){s.add(a.id);let n=U(e,a.parent);if(!n)break;a=n}return a?.id??""}function he(e,t){let s=U(e,t);if(!s?.parent||s.parent===t)return"";return U(e,s.parent)?s.parent:""}function et(){return{trail:[],cursor:-1}}function ue(e){return e.trail[e.cursor]??""}function Me(e,t){if(!t||ue(e)===t)return e;let s=[...e.trail.slice(0,e.cursor+1),t];return{trail:s,cursor:s.length-1}}function Re(e){return e.cursor<e.trail.length-1}function tt(e,t=[]){if(e.cursor>0)return!0;return e.cursor===0&&he(t,ue(e))!==""}function st(e,t=[]){if(e.cursor>0)return{trail:e.trail,cursor:e.cursor-1};if(e.cursor===0){let s=he(t,ue(e));if(s)return{trail:[s,...e.trail],cursor:0}}return e}function at(e){return Re(e)?{trail:e.trail,cursor:e.cursor+1}:e}function pe(e){return String(e??"").normalize("NFD").replace(/[\u0300-\u036F]/g,"").toLowerCase().replace(/\s+/g," ").trim()}function ga(e,t){let s=e.indexOf(t);while(s!==-1){if(s===0||!/[\p{L}\p{N}]/u.test(e.charAt(s-1)))return!0;s=e.indexOf(t,s+1)}return!1}function xa(e,t,s){if(t.startsWith(e))return Z.PREFIX;if(ga(t,e))return Z.WORD_PREFIX;if(t.includes(e))return Z.SUBSTRING;if(ga(s,e))return Z.KEYWORD;return Z.NONE}function ba(e,t,s=""){let a=pe(e);if(a==="")return Z.NONE;let n=pe(t),o=pe(s),i=xa(a,n,o),r=a.split(" ");if(i!==Z.NONE||r.length===1)return i;let c=Z.PREFIX;for(let l of r){let d=xa(l,n,o);if(d===Z.NONE)return Z.NONE;c=Math.min(c,d===Z.PREFIX&&l!==r[0]?Z.WORD_PREFIX:d)}return c}function nt(e,t){let s=pe(e);if(s==="")return{query:"",panes:[],settings:[]};let a=[];for(let o of t.items){let i=U(t.panes,o.id),r=`${o.keywords??""} ${i?.keywords??""} ${i&&i.title!==o.label?i.title:""}`;if(ba(s,o.label,r)!==Z.NONE)a.push(o.id)}let n=[];return t.rows.forEach((o,i)=>{if(!o.label)return;let c=U(t.panes,o.pane)?.title??"",l=ba(s,o.label,`${o.keywords??""} ${c}`);if(l!==Z.NONE)n.push({id:o.id,label:o.label,pane:o.pane,paneTitle:c,row:i,rank:l})}),n.sort((o,i)=>i.rank-o.rank||o.row-i.row),{query:s,panes:a,settings:n}}function va(e){if(e<=0)return"No results";return e===1?"1 result":`${e} results`}function zt(e,t,s){if(s<=0)return-1;if(e==="ArrowDown")return Math.min(s-1,t+1);if(e==="ArrowUp")return t<0?s-1:Math.max(0,t-1);if(e==="Home")return 0;if(e==="End")return s-1;return-1}function wa(e,t,s,a=700){return{buffer:(!e||s-e.at>a?"":e.buffer)+pe(t),at:s}}function ya(e,t,s){let a=e.length,n=pe(t);if(a===0||n==="")return-1;let o=n.split("").every((c)=>c===n.charAt(0)),i=o?n.charAt(0):n,r=o?s+1:Math.max(0,s);for(let c=0;c<a;c++){let l=((r+c)%a+a)%a;if(pe(e[l]).startsWith(i))return l}return-1}var pc="./SettingsGroup-g1hnxp1p.stx";var uc="./SettingsPane-9svk1w3e.stx";var mc="./SettingsPaneHeader-am42srhp.stx";var xc="./SettingsRow-kgda3nv1.stx";var vc="./SettingsSidebarGroup-4ag5qjpw.stx";var yc="./SettingsSidebarItem-ga2jxq53.stx";var Sc="./SettingsUpdateRow-ajpnqx8a.stx";var Tc="./SettingsWindow-v7jepxem.stx";var $c="data-stx-settings",ye="data-settings-item",ke="data-settings-pane",Ec="data-settings-row";class Ic{tree;root;options;callbacks;history=et();current="";query="";hits=[];highlighted=null;highlightTimer=null;pressed=new Map;visible=new Map;disposers=[];destroyed=!1;constructor(e,t,s={},a={}){this.tree=e;this.root=t;this.options=s;this.callbacks=a;this.hear(),this.disposers.push(e.observeChildren(t,()=>{if(this.destroyed)return;this.hear(),this.show(!1),this.applySearch(!1)}));let n=this.panes(),o=this.paneNodes().find((i)=>this.tree.getAttribute(i,"data-active")!=null);this.history=Me(this.history,Ze(n,this.stored(),s.pane,o?this.attribute(o,ke):"")),this.show(!0),this.applySearch(!1)}getPane(){return this.current}showPane(e){if(!U(this.panes(),e))return!1;return this.open(e),!0}revealSetting(e){if(!e)return!1;let t=this.rowNodes().find((a)=>this.attribute(a,"data-setting")===e),s=t?this.paneOf(t):"";if(!t||!s)return!1;return this.open(s),this.reveal(t),!0}back(){this.travel(st(this.history,this.panes()))}forward(){this.travel(at(this.history))}search(e){this.query=String(e??""),this.applySearch(!0)}chooseResult(e){let t=this.hits[e];if(!t||this.tree.parent(t.row)===null)return;this.open(t.hit.pane),this.reveal(t.row)}destroy(){this.destroyed=!0;for(let e of this.disposers)e();this.disposers.length=0;for(let e of this.pressed.values())e();this.pressed.clear(),this.visible.clear(),this.clearHighlight()}attribute(e,t){return this.tree.getAttribute(e,t)??""}toggle(e,t){let s=this.attribute(e,"class").split(/\s+/).filter(Boolean),a=this.visible.has(e)?this.visible.get(e):!s.includes("hidden");if(this.visible.set(e,t),a===t)return;let n=s.filter((o)=>o!=="hidden");this.tree.setAttribute(e,"class",(t?n:[...n,"hidden"]).join(" "))}has(e,t){return this.tree.getAttribute(e,t)!=null}closest(e,t){for(let s=e;s;s=this.tree.parent(s))if(this.has(s,t))return s;return null}all(e,t=this.root){return this.tree.descendants(t).filter((s)=>this.has(s,e)&&this.closest(this.tree.parent(s),$c)===this.root)}paneNodes(){return this.all(ke)}panes(){return this.paneNodes().map((e)=>{let t=this.attribute(e,ke);return{id:t,title:this.attribute(e,"data-title")||t,keywords:this.attribute(e,"data-keywords"),parent:this.attribute(e,"data-parent")}})}itemNodes(){return this.all(ye)}items(){return this.itemNodes().map((e)=>({id:this.attribute(e,ye),label:this.attribute(e,"data-label").trim(),keywords:this.attribute(e,"data-keywords")}))}rowNodes(){return this.all(Ec).filter((e)=>this.paneOf(e)!=="")}paneOf(e){let t=this.closest(e,ke);return t?this.attribute(t,ke):""}stored(){if(!this.options.storageKey||!this.options.storage)return"";try{return this.options.storage.get(we(this.options.storageKey))||""}catch{return""}}store(){if(!this.options.storageKey||!this.options.storage||!this.current)return;try{this.options.storage.set(we(this.options.storageKey),this.current)}catch{}}hear(){let e=new Set;for(let t of this.itemNodes())if(e.add(t),!this.pressed.has(t))this.pressed.set(t,this.tree.listen(t,"click",()=>this.open(this.attribute(t,ye))));for(let t of this.rowNodes()){if(!this.has(t,"data-navigate"))continue;if(e.add(t),!this.pressed.has(t))this.pressed.set(t,this.tree.listen(t,"click",()=>this.navigate(t)))}for(let[t,s]of this.pressed){if(e.has(t))continue;s(),this.pressed.delete(t)}}navigate(e){if(this.attribute(e,"aria-disabled")==="true")return;let t=this.attribute(e,"data-navigate");if(!U(this.panes(),t))return;let s=this.current;this.open(t),this.callbacks.onNavigate?.({id:t,from:s,setting:this.attribute(e,"data-setting")})}open(e){if(!e)return;this.history=Me(this.history,e),this.show(!0)}travel(e){if(e===this.history)return;this.history=e,this.show(!0)}show(e){let t=this.panes(),s=ue(this.history),a=U(t,s);if(!a)return;for(let i of this.paneNodes())this.toggle(i,this.attribute(i,ke)===s);let n=Qe(t,s);for(let i of this.itemNodes()){let r=this.attribute(i,ye)===n;for(let c of[i,...this.tree.descendants(i)])this.tree.setAttribute(c,"aria-selected",r?"true":"false")}let o=this.current!==s;if(this.current=s,this.report(),o){if(this.store(),e)this.callbacks.onPane?.({id:s,title:a.title,parent:he(t,s)})}}report(){let e=this.panes(),t=U(e,this.current),s=this.query.trim()!=="";this.callbacks.onState?.({pane:this.current,title:t?.title??"",canGoBack:tt(this.history,e),canGoForward:Re(this.history),query:this.query,searching:s,results:this.hits.map(({hit:a},n)=>({position:n,label:a.label,pane:a.paneTitle})),empty:s&&this.shownItems===0&&this.hits.length===0})}shownItems=0;applySearch(e){let t=this.rowNodes(),s=t.map((r)=>({id:this.attribute(r,"data-setting"),label:this.attribute(r,"data-label").trim(),keywords:this.attribute(r,"data-keywords"),pane:this.paneOf(r)})),a=nt(this.query,{panes:this.panes(),items:this.items(),rows:s}),n=a.query!=="",o=new Set;for(let r of this.itemNodes()){let c=!n||a.panes.includes(this.attribute(r,ye));if(c)o.add(r);this.toggle(r,c)}this.shownItems=n?a.panes.length:o.size;let i=!0;for(let r of this.all("data-settings-group")){let c=this.all(ye,r).some((l)=>o.has(l));this.toggle(r,c);for(let l of this.all("data-settings-group-gap",r))this.toggle(l,c&&!i);if(c)i=!1}for(let r of this.all("data-settings-account"))this.toggle(r,!n);if(this.hits=a.settings.map((r)=>({hit:r,row:t[r.row]})),this.report(),e)this.callbacks.onSearch?.({query:this.query.trim(),panes:a.panes,settings:a.settings.map((r)=>({id:r.id,label:r.label,pane:r.pane}))})}reveal(e){this.clearHighlight(),this.tree.setAttribute(e,"data-highlight","");let t=this.options.wash?.();if(t)this.tree.setStyle(e,{backgroundColor:t});this.highlighted=e,this.highlightTimer=setTimeout(()=>this.clearHighlight(),Xe)}clearHighlight(){if(this.highlightTimer)clearTimeout(this.highlightTimer);if(this.highlightTimer=null,this.highlighted)this.tree.removeAttribute(this.highlighted,"data-highlight"),this.tree.setStyle(this.highlighted,{backgroundColor:"transparent"});this.highlighted=null}}var gv={grey:"bg-[#8e8e93] dark:bg-[#8e8e93]",blue:"bg-[#007aff] dark:bg-[#0a84ff]",red:"bg-[#ff3b30] dark:bg-[#ff453a]",orange:"bg-[#ff9500] dark:bg-[#ff9f0a]",yellow:"bg-[#ffcc00] dark:bg-[#ffd60a]",green:"bg-[#34c759] dark:bg-[#30d158]",indigo:"bg-[#5856d6] dark:bg-[#5e5ce6]",purple:"bg-[#af52de] dark:bg-[#bf5af2]",pink:"bg-[#ff2d55] dark:bg-[#ff375f]",ink:"bg-[#1d1d1f] dark:bg-[#dcdce0]"};function xv(e){return e==="ink"?"text-[#ffffff] dark:text-[#1d1d1f]":"text-[#ffffff]"}var le="text-[#000000]/85 dark:text-[#ffffff]/85",ee="text-[#000000]/50 dark:text-[#ffffff]/55",ka="text-[#000000]/26 dark:text-[#ffffff]/25",Ht="text-[#ff3b30] dark:text-[#ff453a]",Ac="text-[#007aff] dark:text-[#0a84ff]",Pc="aria-selected:bg-[#007aff] dark:aria-selected:bg-[#0a84ff]",Sa="aria-selected:text-[#ffffff] dark:aria-selected:text-[#ffffff]",Mc="bg-[#000000]/10 dark:bg-[#ffffff]/10",Ca="bg-[#000000]/4 dark:bg-[#ffffff]/5",bv={shell:"flex-1 flex-row",sidebar:"flex-col bg-[#f2f1f0] dark:bg-[#2a2a2a]",sidebarWidth:226,sidebarMaterial:"sidebar",sidebarTop:"pt-[38px] px-[9px] pb-[6px]",search:"h-[28px] text-[13px]",nav:"flex-1 flex-col px-[9px] pb-[12px]",account:"mt-[7px]",list:"flex-col pt-[7px]",results:"flex-col gap-[2px] pt-[7px]",result:"flex-col justify-center min-h-[38px] px-[8px] py-[4px] rounded-[8px] hover:bg-[#000000]/5 dark:hover:bg-[#ffffff]/6",resultLabel:`text-[13px] ${le}`,resultPane:`text-[11px] ${ee}`,empty:`py-[24px] px-[8px] text-[13px] text-center ${ee}`,group:"flex-col gap-[2px]",groupGap:"h-[11px]",groupLabel:`px-[8px] pb-[3px] text-[11px] font-semibold ${ee}`,item:`flex-row items-center gap-[8px] h-[30px] px-[8px] rounded-[8px] ${Pc}`,itemTile:"h-[20px] w-[20px] rounded-[5.5px] items-center justify-center",itemGlyph:"h-[13px] w-[13px]",itemLabel:`flex-1 text-[13px] ${le} ${Sa}`,itemBadge:`text-[11px] ${ee} ${Sa}`,detail:"flex-1 flex-col bg-[#ffffff] dark:bg-[#1e1e1e]",toolbar:"flex-row items-center gap-[12px] h-[52px] pl-[8px] pr-[16px]",history:"flex-row items-center",historyButton:`text-[15px] ${ee}`,title:`flex-1 text-[20px] font-semibold ${le}`,body:"flex-1 flex-col",pane:"flex-1",paneContent:"flex-col px-[20px] pt-[11px] pb-[20px]",hero:`flex-col items-center mb-[10px] p-[22px] rounded-[12px] ${Ca}`,heroTile:"h-[48px] w-[48px] rounded-[12px] items-center justify-center",heroGlyph:"h-[30px] w-[30px]",heroTitle:`mt-[10px] text-[17px] font-semibold text-center ${le}`,heroDescription:`mt-[4px] text-[13px] text-center ${ee}`,heroExtra:"mt-[8px] flex-col items-center",section:"flex-col mb-[10px]",sectionHeader:`pt-[18px] px-[10px] pb-[8px] text-[13px] font-bold ${le}`,card:`flex-col rounded-[12px] ${Ca}`,sectionFooter:`pt-[6px] px-[10px] text-[11px] ${ee}`,rowRule:`mx-[10px] h-[0.5px] ${Mc}`,row:"flex-row items-center gap-[10px] min-h-[38px] px-[10px]",rowTall:"min-h-[44px]",rowMultiline:"items-start",rowStacked:"flex-col items-stretch gap-[4px] min-h-[38px] px-[10px]",rowPressed:"active:bg-[#000000]/5 dark:active:bg-[#ffffff]/6",rowWash:{light:"#007aff33",dark:"#0a84ff33"},rowTile:"h-[24px] w-[24px] rounded-[6px] items-center justify-center",rowTileMultiline:"mt-[10px]",rowGlyph:"h-[15px] w-[15px]",rowText:"flex-1 flex-col justify-center py-[7px]",rowTextMultiline:"flex-1 flex-col py-[10px]",rowTextStacked:"flex-col pt-[10px]",rowLabel:`text-[13px] ${le}`,rowLabelDestructive:`text-[13px] ${Ht}`,rowDescription:`mt-[1px] text-[11px] ${ee}`,rowControl:"flex-row items-center justify-end gap-[8px]",rowControlMultiline:"flex-row items-center justify-end gap-[8px] py-[10px]",rowControlStacked:"flex-col items-stretch pb-[7px]",rowValue:`text-[13px] ${ee}`,rowChevron:`h-[11px] w-[11px] ${ka}`,rowDisabled:"opacity-50",appearance:"flex-row gap-[14px]",appearanceOption:"flex-col items-center gap-[5px]",appearanceFrame:"p-[3px] rounded-[9px] border-2 border-transparent aria-checked:border-[#007aff] dark:aria-checked:border-[#0a84ff]",appearanceThumb:"h-[44px] w-[67px] flex-row rounded-[6px] overflow-hidden",appearanceLight:"flex-1 bg-[#e9e9eb]",appearanceDark:"flex-1 bg-[#2c2c2e]",appearanceCaption:`text-[11px] ${le}`,updateStatus:`mt-[1px] text-[11px] ${ee}`,updateError:`mt-[1px] text-[11px] ${Ht}`,updateProgress:`text-[11px] ${ee}`,ink:le,inkSecondary:ee,inkTertiary:ka,danger:Ht,accentText:Ac},vv={back:"chevron.left",forward:"chevron.right",disclosure:"chevron.right"};var Rc={check:"Check Now",install:"Download and Install",relaunch:"Restart to Update"};function Nc(e){let t=Number(e);if(!Number.isFinite(t))return"";return`${Math.round(Math.min(1,Math.max(0,t))*100)}%`}function yv(e,t=""){let s=String(t||"").trim(),a=String(e?.currentVersion||"").trim(),n=[s,a].filter(Boolean).join(" "),o=(h,p,u={})=>({title:n,sentence:h,action:p,actionLabel:p?Rc[p]:"",busy:!1,progress:"",failed:!1,...u});if(!e||typeof e.state!=="string")return o("",null);let i=s||"This app",r=String(e.version||"").trim(),c=r?`Version ${r}`:"An update",l=e.selfUpdating!==!1,d=String(e.reason||"").trim();switch(e.state){case"unavailable":return o(d||`${i} cannot update itself.`,null);case"idle":return o("Check for a newer version.","check");case"checking":return o("Checking for updates...","check",{busy:!0});case"current":return o(`${i} is up to date.`,"check");case"available":return l?o(`${c} is available.`,"install"):o(`${c} is available. ${d||`${i} cannot update itself.`}`,"check");case"downloading":return o(`Downloading ${r?`version ${r}`:"the update"}...`,"install",{busy:!0,progress:Nc(e.progress)});case"installing":return o(`Installing ${r?`version ${r}`:"the update"}...`,"install",{busy:!0});case"installed":return o(`${c} is installed. Restart ${i} to finish updating.`,"relaunch");case"error":return o(String(e.error||"").trim()||"The update could not be completed.","check",{failed:!0});default:return o("",null)}}var Ft="[data-stx-settings]",ot="[data-settings-item]",Ta="[data-settings-pane]",Lc="[data-settings-row]",Vt="[data-settings-result]",Dc='button, a[href], input, select, textarea, label, [role="switch"], [role="checkbox"], [role="radio"], [role="slider"], [role="button"], [contenteditable]';function $a(e){return e.replace(/[^\w-]+/g,"-")}class Oc{root;callbacks;history=et();current="";query="";storageKey;storage;typed=null;hits=[];highlighted=null;highlightTimer=null;disposers=[];list;account;input;field;results;empty;live;backButton;forwardButton;title;body;constructor(e,t={},s={}){this.root=e;this.callbacks=s;if(this.storageKey=t.storageKey||"",this.storage=t.storage??null,!e.id)e.id=`settings-${Math.random().toString(36).slice(2,8)}`;this.list=this.own("[data-settings-list]"),this.account=this.own("[data-settings-account]"),this.input=this.own("[data-settings-search-input]"),this.field=this.own("[data-settings-search]"),this.results=this.own("[data-settings-results]"),this.empty=this.own("[data-settings-empty]"),this.live=this.own("[data-settings-live]"),this.backButton=this.own("[data-settings-back]"),this.forwardButton=this.own("[data-settings-forward]"),this.title=this.own("[data-settings-title]"),this.body=this.own("[data-settings-body]");for(let o of[this.results,this.live,this.title])if(o)o.__stx_inert_content=!0;if(this.listen(e,"click",(o)=>this.onClick(o)),this.listen(t.globalKeys?document:e,"keydown",(o)=>this.onKeyDown(o)),this.input)this.listen(this.input,"input",()=>this.search(this.input.value));if(this.body)this.listen(this.body,"scroll",()=>this.syncScrolled(),{passive:!0});this.listen(window,"focus",()=>e.setAttribute("data-stx-window-active","true")),this.listen(window,"blur",()=>e.setAttribute("data-stx-window-active","false")),this.describe();let a=this.panes(),n=this.paneElements().find((o)=>!o.hidden)?.getAttribute("data-settings-pane");this.open(Ze(a,this.stored(),t.pane,n)),e.setAttribute("data-settings-ready","")}getPane(){return this.current}showPane(e){if(!U(this.panes(),e))return!1;return this.open(e),!0}revealSetting(e){if(!e)return!1;let t=this.rowElements().find((a)=>a.getAttribute("data-setting")===e),s=t?this.paneOf(t):"";if(!t||!s)return!1;return this.open(s),this.reveal(t),!0}back(){this.travel(st(this.history,this.panes()))}forward(){this.travel(at(this.history))}focusSearch(){if(!this.input)return;this.input.focus(),this.input.select()}search(e){if(this.query=e,this.input&&this.input.value!==e)this.input.value=e;this.applySearch(!0)}destroy(){for(let e of this.disposers)e();this.disposers.length=0,this.clearHighlight(),this.root.removeAttribute("data-settings-ready")}own(e){return this.all(e)[0]??null}all(e,t=this.root){return Array.from(t.querySelectorAll(e)).filter((s)=>s.closest(Ft)===this.root)}listen(e,t,s,a){e.addEventListener(t,s,a),this.disposers.push(()=>e.removeEventListener(t,s,a))}paneElements(){return this.all(Ta)}paneElement(e){return this.paneElements().find((t)=>t.getAttribute("data-settings-pane")===e)??null}panes(){return this.paneElements().map((e)=>({id:e.getAttribute("data-settings-pane")||"",title:e.getAttribute("data-title")||e.getAttribute("data-settings-pane")||"",keywords:e.getAttribute("data-keywords")||"",parent:e.getAttribute("data-parent")||""})).filter((e)=>e.id!=="")}itemElements(){return this.list?this.all(ot,this.list):[]}visibleItems(){return this.itemElements().filter((e)=>!e.hidden&&!e.disabled)}labelOf(e){return(e.querySelector(".stx-settings-item-label")?.textContent||e.getAttribute("aria-label")||e.textContent||"").trim()}items(){return this.itemElements().map((e)=>({id:e.getAttribute("data-settings-item")||"",label:this.labelOf(e),keywords:e.getAttribute("data-keywords")||""}))}rowElements(){return this.all(Lc).filter((e)=>this.paneOf(e)!=="")}paneOf(e){return e.closest(Ta)?.getAttribute("data-settings-pane")||""}stored(){if(!this.storageKey)return"";try{let e=we(this.storageKey);return(this.storage?this.storage.get(e):localStorage.getItem(e))||""}catch{return""}}store(){if(!this.storageKey||!this.current)return;try{let e=we(this.storageKey);if(this.storage)this.storage.set(e,this.current);else localStorage.setItem(e,this.current)}catch{}}describe(){let e=this.root.id,t=new Map;for(let s of this.itemElements()){let a=s.getAttribute("data-settings-item")||"";if(!s.id)s.id=`${e}-item-${$a(a)}`;s.setAttribute("role","tab"),t.set(a,s);for(let n=s.parentElement;n&&n!==this.list;n=n.parentElement)if(!n.hasAttribute("role"))n.setAttribute("role","presentation")}for(let s of this.paneElements()){let a=s.getAttribute("data-settings-pane")||"";if(!s.id)s.id=`${e}-pane-${$a(a)}`;let n=t.get(a);if(n)n.setAttribute("aria-controls",s.id),s.setAttribute("role","tabpanel"),s.setAttribute("aria-labelledby",n.id),s.removeAttribute("aria-label");else if(this.title?.id){if(s.setAttribute("role","region"),!s.hasAttribute("aria-label"))s.setAttribute("aria-label",s.getAttribute("data-title")||a)}}}open(e){if(!e)return;this.history=Me(this.history,e),this.show()}travel(e){if(e===this.history)return;this.history=e,this.show()}show(){this.describe();let e=this.panes(),t=ue(this.history),s=U(e,t),a=this.paneElement(t);if(!s||!a)return;let n=document.activeElement,o=n instanceof HTMLElement&&this.paneElements().some((c)=>c!==a&&c.contains(n));for(let c of this.paneElements())c.hidden=c!==a,c.toggleAttribute("data-active",c===a);let i=Qe(e,t);for(let c of this.itemElements()){let l=c.getAttribute("data-settings-item")===i;c.setAttribute("aria-selected",l?"true":"false"),c.toggleAttribute("data-active",l)}if(this.syncTabStops(),this.title)this.title.textContent=s.title;this.root.setAttribute("data-pane",t),this.root.toggleAttribute("data-subpane",he(e,t)!==""),this.syncHistoryButtons(e);let r=t!==this.current;if(this.current=t,r){if(this.clearHighlight(),this.body)this.body.scrollTop=0;if(this.syncScrolled(),o){if(!a.hasAttribute("tabindex"))a.setAttribute("tabindex","-1");a.focus({preventScroll:!0})}this.store(),this.callbacks.onPane?.({id:t,title:s.title,parent:he(e,t)})}}syncTabStops(){let e=this.visibleItems(),t=e.find((s)=>s.getAttribute("aria-selected")==="true")??e[0];for(let s of this.itemElements())s.setAttribute("tabindex",s===t?"0":"-1")}syncHistoryButtons(e){let t=(n,o,i)=>{if(!n)return;let r=document.activeElement===n;if(n.disabled=!o,r&&!o&&i&&!i.disabled)i.focus()},s=tt(this.history,e),a=Re(this.history);if(s)t(this.backButton,!0,null),t(this.forwardButton,a,this.backButton);else t(this.forwardButton,a,null),t(this.backButton,!1,this.forwardButton)}syncScrolled(){this.root.toggleAttribute("data-scrolled",Boolean(this.body&&this.body.scrollTop>0))}applySearch(e){let t=this.rowElements(),s=t.map((i)=>({id:i.getAttribute("data-setting")||"",label:(i.getAttribute("data-label")||"").trim(),keywords:i.getAttribute("data-keywords")||"",pane:this.paneOf(i)})),a=nt(this.query,{panes:this.panes(),items:this.items(),rows:s}),n=a.query!=="";this.root.toggleAttribute("data-searching",n),this.field?.toggleAttribute("data-filled",this.query!=="");for(let i of this.itemElements())i.hidden=n&&!a.panes.includes(i.getAttribute("data-settings-item")||"");if(this.list){for(let i of this.all("[data-settings-group]",this.list))i.hidden=n&&this.all(ot,i).every((r)=>r.hidden);this.list.hidden=n&&a.panes.length===0}if(this.account)this.account.hidden=n;this.hits=a.settings.map((i)=>({hit:i,row:t[i.row]})),this.drawResults();let o=a.panes.length+a.settings.length;if(this.empty)this.empty.hidden=!n||o>0;if(this.live)this.live.textContent=n?va(o):"";if(this.syncTabStops(),e)this.callbacks.onSearch?.({query:this.query.trim(),panes:a.panes,settings:a.settings.map((i)=>({id:i.id,label:i.label,pane:i.pane}))})}drawResults(){let e=this.results;if(!e)return;e.replaceChildren(),e.hidden=this.hits.length===0,this.hits.forEach(({hit:t},s)=>{let a=document.createElement("button");a.type="button",a.className="stx-settings-result",a.setAttribute("data-settings-result",String(s)),a.setAttribute("tabindex","-1");let n=document.createElement("span");n.className="stx-settings-result-label",n.textContent=t.label;let o=document.createElement("span");o.className="stx-settings-result-pane",o.textContent=t.paneTitle,a.append(n,o),e.append(a)})}chooseResult(e){let t=this.hits[e];if(!t||!t.row.isConnected)return;this.open(t.hit.pane),this.reveal(t.row)}clearSearch(){if(this.query===""&&(!this.input||this.input.value===""))return;this.search("")}reveal(e){if(this.body){let t=this.body.getBoundingClientRect(),s=e.getBoundingClientRect();this.body.scrollTop+=s.top-t.top-(t.height-s.height)/2,this.syncScrolled()}this.clearHighlight(),e.setAttribute("data-highlight",""),this.highlighted=e,this.highlightTimer=setTimeout(()=>this.clearHighlight(),Xe)}clearHighlight(){if(this.highlightTimer)clearTimeout(this.highlightTimer);this.highlightTimer=null,this.highlighted?.removeAttribute("data-highlight"),this.highlighted=null}inside(e){return e instanceof Element&&e.closest(Ft)===this.root}navigationRow(e){let t=e.closest("[data-navigate]");if(!t||t.closest(Ft)!==this.root||t.getAttribute("aria-disabled")==="true")return null;let s=e.closest(Dc);if(s&&s!==t&&t.contains(s))return null;return t}navigate(e){let t=e.getAttribute("data-navigate")||"";if(!U(this.panes(),t))return;let s=this.current;this.open(t),this.callbacks.onNavigate?.({id:t,from:s,setting:e.getAttribute("data-setting")||""})}onClick(e){let t=e.target;if(!this.inside(t))return;let s=t.closest(ot);if(s&&this.list?.contains(s)){this.open(s.getAttribute("data-settings-item")||"");return}let a=t.closest(Vt);if(a){this.chooseResult(Number(a.getAttribute("data-settings-result")));return}if(t.closest("[data-settings-back]")){this.back();return}if(t.closest("[data-settings-forward]")){this.forward();return}if(t.closest("[data-settings-search-clear]")){this.clearSearch(),this.input?.focus();return}let n=this.navigationRow(t);if(n)this.navigate(n)}onKeyDown(e){if(e.defaultPrevented)return;let t=(e.metaKey||e.ctrlKey)&&!e.altKey;if(t&&!e.shiftKey){let o=e.key.toLowerCase();if(o==="f"&&this.input){e.preventDefault(),this.focusSearch();return}if(o==="["){e.preventDefault(),this.back();return}if(o==="]"){e.preventDefault(),this.forward();return}}let s=e.target;if(!this.inside(s))return;if(e.key==="Escape"&&this.query!==""){e.preventDefault(),this.clearSearch(),this.visibleItems().find((o)=>o.getAttribute("tabindex")==="0")?.focus();return}if(s===this.input){this.onSearchKey(e);return}let a=s.closest(Vt);if(a){this.onResultKey(e,a);return}let n=s.closest(ot);if(n&&this.list?.contains(n)){this.onItemKey(e,n);return}if((e.key==="Enter"||e.key===" ")&&!t&&!e.altKey){let o=s.closest("[data-navigate]");if(o&&o===s&&this.navigationRow(s))e.preventDefault(),this.navigate(o)}}resultButtons(){return this.results?Array.from(this.results.querySelectorAll(Vt)):[]}onSearchKey(e){if(e.key==="ArrowDown"){let t=this.visibleItems()[0]??this.resultButtons()[0];if(t)e.preventDefault(),t.focus()}else if(e.key==="Enter"&&this.query.trim()!==""){e.preventDefault();let t=this.visibleItems()[0];if(t)this.open(t.getAttribute("data-settings-item")||"");else this.chooseResult(0)}}onResultKey(e,t){let s=this.resultButtons(),a=s.indexOf(t);if(e.key==="ArrowUp"&&a===0){let o=this.visibleItems(),i=o[o.length-1]??this.input;if(i)e.preventDefault(),i.focus();return}let n=zt(e.key,a,s.length);if(n===-1)return;e.preventDefault(),s[n].focus()}onItemKey(e,t){if(e.metaKey||e.ctrlKey||e.altKey)return;let s=this.visibleItems(),a=s.indexOf(t);if(e.key==="ArrowDown"&&a===s.length-1){let o=this.resultButtons()[0];if(o){e.preventDefault(),o.focus();return}}let n=zt(e.key,a,s.length);if(n===-1&&e.key.length===1&&(e.key!==" "||this.typed!==null)){let o=wa(this.typed,e.key,Date.now());if(e.key===" "&&o.buffer.trim()===""){this.typed=null;return}if(this.typed=o,n=ya(s.map((i)=>this.labelOf(i)),o.buffer,a),n===-1){e.preventDefault();return}}if(n===-1)return;e.preventDefault(),s[n].focus(),this.open(s[n].getAttribute("data-settings-item")||"")}}var Hc="./Sidebar-7rya9gcp.stx";var Vc="./SidebarFooter-s7skj92y.stx";var Bc="./SidebarHeader-x7jdhmyr.stx";var Kc="./SidebarItem-64sjb2fe.stx";var Wc="./SidebarPinned-48kyk193.stx";var Uc="./SidebarSection-vx5bahsk.stx";var Yc="./SidebarSpace-aac0byam.stx";var Zc="./SidebarSpaces-mdtrynr2.stx";var ed="./SidebarSpaceSwitcher-1mycft2g.stx";var it={blue:"#0088ff",red:"#ff383c",pink:"#ff2d55",orange:"#ff8d28",yellow:"#ffcc00",green:"#34c759",teal:"#00c3d0",cyan:"#00c0e8",indigo:"#6155f5",purple:"#cb30e0",brown:"#ac7f5e",gray:"#8e8e93"},fe={pane:["bg-[#f2f2f4]/90 dark:bg-[#1c1c1e]/88","backdrop-blur-[50px] backdrop-saturate-[180%]","text-black dark:text-white","select-none"].join(" "),selection:"accent",layers:{shimmerRim:!0},scrollArea:"flex-1 overflow-y-auto overflow-x-hidden px-[10px] pb-[10px]",sectionHeader:["group/section flex w-full items-center","pl-[8px] pr-[6px] pt-[16px] pb-[5px]","text-[11px] font-semibold leading-[13px]","text-[#3c3c43]/75 dark:text-[#ebebf5]/60"].join(" "),sectionChevron:["i-f7-chevron-down h-[11px] w-[11px] ml-auto","text-[#3c3c43]/60 dark:text-[#ebebf5]/45","opacity-0 group-hover/section:opacity-100 transition-opacity duration-150","transition-transform duration-200"].join(" "),sectionGroup:"flex flex-col",item:{base:["flex w-full items-center","h-[32px] rounded-[8px] pl-[4px] pr-[8px]","text-[13px] leading-[16px] font-normal","text-black dark:text-white","transition-colors duration-150 ease-out"].join(" "),hover:"hover:bg-black/4 dark:hover:bg-white/6",active:"",pressed:"active:bg-black/10 dark:active:bg-white/18",disabled:"opacity-40 pointer-events-none",disclosure:"flex h-[16px] w-[18px] shrink-0 items-center justify-center",chevron:["i-f7-chevron-right h-[11px] w-[11px]","text-[#3c3c43]/60 dark:text-[#ebebf5]/55","transition-transform duration-200 ease-out"].join(" "),iconSlot:"flex h-[20px] w-[22px] shrink-0 items-center justify-center mr-[7px]",icon:"h-[17px] w-[17px]",image:"h-[20px] w-[20px] rounded-[4px] object-cover shadow-sm",label:"flex-1 truncate text-left",count:["ml-[8px] shrink-0 tabular-nums","text-[13px] leading-[16px]","text-[#3c3c43]/75 dark:text-[#ebebf5]/60"].join(" "),indentPerLevel:16}},td={selection:"classes",pane:"bg-[#f4f4f3] dark:bg-neutral-950 text-zinc-950 dark:text-white select-none",layers:{},scrollArea:"flex-1 overflow-y-auto overflow-x-hidden px-5 py-5",sectionHeader:"group/section flex w-full items-center gap-2.5 px-4 pb-2 pt-5 text-[13px] font-semibold uppercase tracking-[0.12em] text-zinc-400 dark:text-zinc-500",sectionChevron:"i-f7-chevron-down h-3 w-3 ml-auto opacity-0 group-hover/section:opacity-100 transition-opacity duration-150 transition-transform duration-200",sectionGroup:"flex flex-col space-y-1",item:{base:"flex w-full items-center gap-3 rounded-[16px] px-3.5 py-2 text-[14px] leading-tight transition-colors duration-150",hover:"hover:bg-[#ececea] hover:text-zinc-950 dark:hover:bg-white/10",active:"bg-[#e7e7e5] text-zinc-950 dark:bg-white/12 dark:text-white",pressed:"active:bg-[#e2e2e0] dark:active:bg-white/15",disabled:"opacity-50 pointer-events-none",disclosure:"flex h-4 w-4 shrink-0 items-center justify-center",chevron:"i-f7-chevron-right h-3 w-3 opacity-50 transition-transform duration-200",iconSlot:"flex h-5 w-5 shrink-0 items-center justify-center",icon:"h-[18px] w-[18px] text-zinc-500 dark:text-zinc-500",image:"h-5 w-5 rounded object-cover",label:"flex-1 truncate text-left text-zinc-700 dark:text-zinc-300",count:"ml-auto grid h-5 min-w-5 place-items-center rounded-full bg-white/70 px-1.5 text-[11px] font-medium text-zinc-500 shadow-sm dark:bg-white/10 dark:text-zinc-400",indentPerLevel:12}},sd={selection:"classes",pane:"bg-[#f3f3f1]/48 dark:bg-neutral-950/32 backdrop-blur-3xl backdrop-saturate-150 text-zinc-950 dark:text-white select-none",layers:{tint:"bg-[linear-gradient(112deg,rgba(255,255,255,0.20)_0%,rgba(255,255,255,0.04)_45%,rgba(226,226,222,0.16)_100%)] dark:bg-[linear-gradient(112deg,rgba(255,255,255,0.08)_0%,rgba(255,255,255,0.02)_46%,rgba(255,255,255,0.06)_100%)]"},scrollArea:"flex-1 overflow-y-auto overflow-x-hidden px-5 py-2",sectionHeader:"group/section flex w-full items-center gap-2.5 px-3 pb-1.5 pt-3 rounded-[14px] text-[12px] font-semibold uppercase tracking-[0.10em] text-zinc-500/80 dark:text-zinc-400/80",sectionChevron:"i-f7-chevron-down h-3 w-3 ml-auto opacity-0 group-hover/section:opacity-100 transition-opacity duration-150 transition-transform duration-200",sectionGroup:"flex flex-col space-y-1",item:{base:"flex w-full items-center gap-3 rounded-[14px] px-3 py-1.5 text-[13.5px] leading-tight transition-colors duration-150",hover:"hover:bg-white/38 hover:text-zinc-950 dark:hover:bg-white/10",active:"bg-[#e8e8e6]/90 text-zinc-950 dark:bg-white/12 dark:text-white",pressed:"active:bg-white/50 dark:active:bg-white/15",disabled:"opacity-50 pointer-events-none",disclosure:"flex h-4 w-4 shrink-0 items-center justify-center",chevron:"i-f7-chevron-right h-3 w-3 opacity-50 transition-transform duration-200",iconSlot:"flex h-5 w-5 shrink-0 items-center justify-center",icon:"h-[18px] w-[18px] text-zinc-600 dark:text-zinc-400",image:"h-5 w-5 rounded object-cover",label:"flex-1 truncate text-left text-zinc-700 dark:text-zinc-300",count:"ml-auto grid h-5 min-w-5 place-items-center rounded-full bg-white/72 px-1.5 text-[11px] font-medium text-zinc-500 shadow-sm dark:bg-white/10 dark:text-zinc-400",indentPerLevel:12}},ad={selection:"classes",pane:["bg-[#f7f5f1]/92 dark:bg-[#1a1a1c]/92","backdrop-blur-[40px] backdrop-saturate-[160%]","text-[#2c2a28] dark:text-[#ededf0]","select-none"].join(" "),layers:{tint:["bg-[linear-gradient(180deg,var(--stx-sidebar-tint,rgba(255,251,242,0.55))_0%,rgba(255,255,255,0)_38%)]","dark:bg-[linear-gradient(180deg,var(--stx-sidebar-tint,rgba(255,255,255,0.05))_0%,rgba(255,255,255,0)_42%)]"].join(" ")},scrollArea:"flex-1 overflow-y-auto overflow-x-hidden px-[16px] pb-[8px]",sectionHeader:["group/section flex w-full items-center","px-[8px] pt-[14px] pb-[4px]","text-[11px] font-medium leading-[13px]","opacity-55"].join(" "),sectionChevron:["i-f7-chevron-down h-[10px] w-[10px] ml-auto","opacity-0 group-hover/section:opacity-100 transition-opacity duration-150","transition-transform duration-200"].join(" "),sectionGroup:"flex flex-col space-y-[2px]",item:{base:["flex w-full items-center","h-[30px] rounded-[8px] pl-[6px] pr-[8px]","text-[13px] leading-[16px] font-normal","text-current","transition-[background-color,box-shadow,color] duration-150 ease-out"].join(" "),hover:"hover:bg-white/55 dark:hover:bg-white/8",active:["bg-white dark:bg-white/14","font-medium","shadow-[0_1px_2px_rgba(0,0,0,0.08)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]","ring-1 ring-black/5 dark:ring-white/8"].join(" "),pressed:"active:bg-white/80 dark:active:bg-white/18",disabled:"opacity-40 pointer-events-none",disclosure:"flex h-[16px] w-[16px] shrink-0 items-center justify-center",chevron:["i-f7-chevron-right h-[10px] w-[10px] opacity-45","transition-transform duration-200 ease-out"].join(" "),iconSlot:"flex h-[18px] w-[18px] shrink-0 items-center justify-center mr-[8px]",icon:"h-[16px] w-[16px]",image:"h-[18px] w-[18px] rounded-[5px] object-cover shadow-sm",label:"flex-1 truncate text-left",count:["ml-[8px] shrink-0 tabular-nums","text-[12px] leading-[16px] opacity-45"].join(" "),indentPerLevel:14}},nd={...fe,pane:"bg-stone-100 dark:bg-neutral-900 text-black dark:text-white select-none",layers:{}},od={...fe,pane:"bg-transparent text-black dark:text-white select-none",layers:{}},id={...fe,pane:"bg-white/50 dark:bg-black/40 backdrop-blur-3xl backdrop-saturate-200 text-black dark:text-white select-none",layers:{}},Ea={macos:fe,tahoe:fe,"macos-tahoe":fe,"macos-latest":fe,arc:ad,workspace:td,desktop:sd,solid:nd,transparent:od,vibrancy:id};function Uv(e){return Ea[e||"macos"]||Ea.macos}function Jv(e){if(!e)return;return it[e]||e}var rd=it.gray;function ce(e,t,s){return`color-mix(in oklab, ${e} ${t}%, ${s})`}function Ia(e){return{light:{from:ce(e,35,"#ffffff"),to:ce(e,12.5,"#ffffff"),ink:ce(e,22,"#17171b"),accent:ce(e,88,"#2a2a30")},dark:{from:ce(e,27,"#101014"),to:ce(e,10,"#08080b"),ink:ce(e,12,"#f4f4f7"),accent:ce(e,74,"#ffffff")}}}function Zv(e,t){return`linear-gradient(180deg, ${e} 0%, ${t} 100%)`}function ld(e){if(!e)return Ia(rd);if(typeof e!=="string")return e;return Ia(it[e]||e)}function cd(e){return[`--stx-space-light-from: ${e.light.from}`,`--stx-space-light-to: ${e.light.to}`,`--stx-space-light-ink: ${e.light.ink}`,`--stx-space-light-accent: ${e.light.accent}`,`--stx-space-dark-from: ${e.dark.from}`,`--stx-space-dark-to: ${e.dark.to}`,`--stx-space-dark-ink: ${e.dark.ink}`,`--stx-space-dark-accent: ${e.dark.accent}`].join("; ")}function Aa(e,t,s,a){if(!e||!e.label)return null;return{id:e.id||`${t}-${s}`,label:e.label,icon:e.icon||a}}function dd(e){let t=ld(e.tint);return{id:e.id,label:e.label||"",icon:e.icon||"",pinned:e.pinned||[],sections:e.sections||[],action:Aa(e.action,e.id,"action","i-f7-plus"),clear:Aa(e.clear,e.id,"clear","i-f7-arrow-down"),tint:t,style:cd(t),deferred:e.deferred===!0,showTitle:e.showTitle??!0}}function Qv(e){return(e||[]).map(dd)}function ew(e,t){if(!t)return 0;let s=e.findIndex((a)=>a.id===t);return s===-1?0:s}function tw(e){return e.map((t)=>t.tint)}var hd="./Skeleton-m4p66zcs.stx";var vw=101;function Se(e,t){let s=typeof e==="number"?e:Number.parseFloat(String(e));return Number.isFinite(s)?s:t}function ww(e,t,s){let a=Se(e,0),n=Se(t,100),o=Se(s,1);return{min:Math.min(a,n),max:Math.max(a,n),step:o>0?o:0}}function Pa(e){if(!Number.isFinite(e))return 0;let t=String(e).toLowerCase(),s=t.indexOf("e-");if(s!==-1)return Number.parseInt(t.slice(s+2),10)+Math.max(0,t.slice(0,s).split(".")[1]?.length??0);return t.split(".")[1]?.length??0}function me(e,t){let{min:s,max:a,step:n}=t,o=Math.min(a,Math.max(s,Se(e,s)));if(n<=0)return o;let i=Math.round((o-s)/n),r=Math.floor((a-s)/n+0.0000001);if(i>r)i=r;let c=Math.max(Pa(n),Pa(s));return Number((s+i*n).toFixed(Math.min(c,20)))}function yw(e,t){let s=t.max-t.min;if(s<=0)return 0;return(Math.min(t.max,Math.max(t.min,Se(e,t.min)))-t.min)/s}function kw(e,t){let s=Math.min(1,Math.max(0,Number.isFinite(e)?e:0));return me(t.min+s*(t.max-t.min),t)}function Sw(e,t){let s=t.max-t.min;if(s<=0||e===!1||e==null||e===""||e==="false")return[];if(e===!0||e==="true"){if(t.step<=0)return[];let n=Math.floor(s/t.step+0.0000001)+1;if(n<2||n>101)return[];return Array.from({length:n},(o,i)=>Math.min(1,i*t.step/s))}let a=Math.floor(Se(e,0));if(a<2||a>101)return[];return Array.from({length:a},(n,o)=>o/(a-1))}function Cw(e,t,s,a=10){let n=s.step>0?s.step:(s.max-s.min)/100;if(e==="ArrowRight"||e==="ArrowUp")return me(t+n,s);if(e==="ArrowLeft"||e==="ArrowDown")return me(t-n,s);if(e==="PageUp")return me(t+n*a,s);if(e==="PageDown")return me(t-n*a,s);if(e==="Home")return me(s.min,s);if(e==="End")return me(s.max,s);return null}var fd="./Slider-j59dgw1c.stx";var gd="./Spinner-vhnc3y03.stx";function xd(e){return Array.from({length:e},()=>1/e)}function rt(e,t){if(t<=0)return[];if(!e||e.length!==t||e.some((a)=>typeof a!=="number"||!Number.isFinite(a)||a<=0))return xd(t);let s=e.reduce((a,n)=>a+n,0);return e.map((a)=>a/s)}function Ma(e){let t=e;if(typeof e==="string"){let a=e.trim();if(a==="")return null;if(a.charAt(0)==="[")try{t=JSON.parse(a)}catch{return null}else t=a.split(/[\s,]+/).map((n)=>Number.parseFloat(n))}if(!Array.isArray(t)||t.length===0)return null;let s=t.map((a)=>typeof a==="string"?Number.parseFloat(a):a);return s.every((a)=>typeof a==="number"&&Number.isFinite(a)&&a>0)?s:null}function jt(e,t){if(typeof e==="number")return Number.isFinite(e)&&e>=0?e:t;if(typeof e!=="string"||e.trim()==="")return t;let s=Number.parseFloat(e);return Number.isFinite(s)&&s>=0?s:t}function Ra(e,t,s){let a=e.length;if(a===0||t<=0)return[...e];let n=s.map((c)=>Math.max(0,c.min)),o=n.reduce((c,l)=>c+l,0);if(o>=t)return o===0?[...e]:n.map((c)=>c/o);let i=e.map((c)=>c*t);for(let c=0;c<=a;c++){let l=0;for(let p=0;p<a;p++){let u=Math.min(Math.max(i[p],n[p]),s[p].max);l+=i[p]-u,i[p]=u}if(Math.abs(l)<0.000000001)break;let d=i.map((p,u)=>l>0?s[u].max-p:p-n[u]),h=d.reduce((p,u)=>p+(Number.isFinite(u)?u:t),0);if(h<0.000000001)break;for(let p=0;p<a;p++){let u=(Number.isFinite(d[p])?d[p]:t)/h;i[p]+=l*u}}let r=i.reduce((c,l)=>c+l,0);return i.map((c)=>c/r)}function Bt(e,t,s,a,n){let o=e.length;if(t<0||t>=o-1||a<=0||s===0)return[...e];let i=e.map((p)=>p*a),r=s>0,c=r?t:t+1,l=r?1:-1,d=Math.min(Math.abs(s),n[c].max-i[c]);if(d<=0)return[...e];let h=0;for(let p=r?t+1:t;p>=0&&p<o&&d>0.000000001;p+=l){let u=Math.min(d,Math.max(0,i[p]-Math.max(0,n[p].min)));i[p]-=u,h+=u,d-=u}return i[c]+=h,i.map((p)=>p/a)}function lt(e,t,s,a){let n=e.map((i)=>i*s),o=(i,r)=>{let c=0;for(let l=i;l<=r;l++)c+=Math.max(0,n[l]-Math.max(0,a[l].min));return c};return{back:Math.min(o(0,t),a[t+1].max-n[t+1]),forward:Math.min(o(t+1,e.length-1),a[t].max-n[t])}}function Na(e,t,s,a){let n=lt(e,t,s,a),o=e[t]*100,i=s>0?100/s:0;return{now:Math.round(o),min:Math.round(o-n.back*i),max:Math.round(o+n.forward*i)}}function _t(e){return`stx:split-pane:${e}`}function La(e){return JSON.stringify(e.map((t)=>Math.round(t*1e4)/1e4))}var vd="./SplitPane-7sqfdwqa.stx";var Da="data-split-separator";class wd{root;callbacks;direction;panes=[];separators=[];sizes=[];initial=[];limits=[];minSize;step;label;storageKey;observer=null;drag=null;disposers=[];constructor(e,t={},s={}){this.root=e;this.callbacks=s;if(this.direction=t.direction==="vertical"?"vertical":"horizontal",this.minSize=t.minSize??48,this.step=t.step??16,this.label=t.label||"Resize panes",this.storageKey=t.storageKey||"",this.collect(),this.initial=this.startingSizes(t.sizes),this.sizes=rt(this.stored()??this.initial,this.panes.length),this.build(),this.apply(!1),typeof ResizeObserver<"u")this.observer=new ResizeObserver(()=>this.apply(!1)),this.observer.observe(this.root);this.root.setAttribute("data-split-ready","")}getSizes(){return[...this.sizes]}setSizes(e){if(!e||e.length!==this.panes.length)return;this.sizes=rt(e,this.panes.length),this.apply(!0),this.report(-1,"api",!0)}reset(e=-1){this.sizes=[...this.initial],this.apply(!0),this.report(e,"reset",!0)}setDirection(e){let t=e==="vertical"?"vertical":"horizontal";if(t===this.direction)return;this.direction=t,this.root.setAttribute("data-direction",t);for(let s of this.separators)s.setAttribute("aria-orientation",t==="horizontal"?"vertical":"horizontal");this.apply(!1)}destroy(){this.observer?.disconnect();for(let e of this.disposers)e();for(let e of this.separators)e.remove();for(let e of this.panes)e.style.removeProperty("flex"),e.removeAttribute("data-split-pane");this.root.removeAttribute("data-split-ready")}available(){let e=this.root.getBoundingClientRect(),t=this.direction==="horizontal"?e.width:e.height,s=0;for(let a of this.separators){let n=a.getBoundingClientRect();s+=this.direction==="horizontal"?n.width:n.height}return Math.max(0,t-s)}collect(){this.panes=Array.from(this.root.children).filter((e)=>e instanceof HTMLElement&&!e.hasAttribute(Da)),this.limits=this.panes.map((e)=>({min:jt(e.getAttribute("data-min-size"),this.minSize),max:jt(e.getAttribute("data-max-size"),Number.POSITIVE_INFINITY)}))}startingSizes(e){let t=this.panes.map((a)=>Number.parseFloat(a.getAttribute("data-size")||"")),s=t.every((a)=>Number.isFinite(a)&&a>0)?t:null;return rt(e&&e.length===this.panes.length?e:s,this.panes.length)}stored(){if(!this.storageKey)return null;try{let e=Ma(localStorage.getItem(_t(this.storageKey)));return e&&e.length===this.panes.length?e:null}catch{return null}}store(){if(!this.storageKey)return;try{localStorage.setItem(_t(this.storageKey),La(this.sizes))}catch{}}build(){let e=this.root.id||`split-${Math.random().toString(36).slice(2,8)}`;this.panes.forEach((t,s)=>{if(t.setAttribute("data-split-pane",""),!t.id)t.id=`${e}-pane-${s}`;if(s===this.panes.length-1)return;let a=document.createElement("div");a.setAttribute(Da,""),a.setAttribute("role","separator"),a.setAttribute("tabindex","0"),a.setAttribute("aria-orientation",this.direction==="horizontal"?"vertical":"horizontal"),a.setAttribute("aria-controls",t.id),a.setAttribute("aria-label",this.panes.length>2?`${this.label} ${s+1} and ${s+2}`:this.label),a.className="stx-split-separator",t.after(a),this.separators.push(a);let n=(o,i)=>{a.addEventListener(o,i),this.disposers.push(()=>a.removeEventListener(o,i))};n("pointerdown",(o)=>this.onPointerDown(o,s)),n("pointermove",(o)=>this.onPointerMove(o)),n("pointerup",(o)=>this.onPointerEnd(o)),n("pointercancel",(o)=>this.onPointerEnd(o)),n("dblclick",()=>this.reset(s)),n("keydown",(o)=>this.onKeyDown(o,s))})}apply(e){let t=this.available();if(t>0)this.sizes=Ra(this.sizes,t,this.limits);if(this.panes.forEach((s,a)=>{s.style.flex=`${(this.sizes[a]*1000).toFixed(3)} 1 0px`}),this.separators.forEach((s,a)=>{let n=Na(this.sizes,a,t,this.limits);s.setAttribute("aria-valuenow",String(n.now)),s.setAttribute("aria-valuemin",String(n.min)),s.setAttribute("aria-valuemax",String(n.max))}),e)this.store()}report(e,t,s){let a=this.available(),n={sizes:[...this.sizes],pixels:this.sizes.map((o)=>Math.round(o*a)),index:e,source:t};if(this.callbacks.onResize?.(n),s)this.callbacks.onResizeEnd?.(n)}position(e){return this.direction==="horizontal"?e.clientX:e.clientY}onPointerDown(e,t){if(e.button!==0)return;e.preventDefault();let s=this.separators[t];try{s.setPointerCapture(e.pointerId)}catch{}this.drag={index:t,start:this.position(e),sizes:[...this.sizes],pointer:e.pointerId},this.root.setAttribute("data-dragging",""),s.setAttribute("data-active","")}onPointerMove(e){let t=this.drag;if(!t||e.pointerId!==t.pointer)return;this.sizes=Bt(t.sizes,t.index,this.position(e)-t.start,this.available(),this.limits),this.apply(!1),this.report(t.index,"pointer",!1)}onPointerEnd(e){let t=this.drag;if(!t||e.pointerId!==t.pointer)return;this.drag=null,this.root.removeAttribute("data-dragging"),this.separators[t.index].removeAttribute("data-active");try{this.separators[t.index].releasePointerCapture(e.pointerId)}catch{}this.store(),this.report(t.index,"pointer",!0)}onKeyDown(e,t){let s=this.direction==="horizontal",a=this.available(),n=this.step*(e.shiftKey?5:1),o=0;if(e.key===(s?"ArrowLeft":"ArrowUp"))o=-n;else if(e.key===(s?"ArrowRight":"ArrowDown"))o=n;else if(e.key==="Home")o=-lt(this.sizes,t,a,this.limits).back;else if(e.key==="End")o=lt(this.sizes,t,a,this.limits).forward;else if(e.key==="Enter"){e.preventDefault(),this.reset(t);return}else return;e.preventDefault(),this.sizes=Bt(this.sizes,t,o,a,this.limits),this.apply(!0),this.report(t,"keyboard",!0)}}var kd="./Stepper-68gxcmej.stx";var Cd="./StepperStep-zf4pq1s0.stx";class ct{storage;namespace;watchers=new Map;encryptionKey="stx-storage-key";constructor(e="local",t=""){if(this.storage=e==="local"?globalThis.localStorage:globalThis.sessionStorage,this.namespace=t,typeof window<"u")window.addEventListener("storage",this.handleStorageEvent.bind(this))}handleStorageEvent(e){if(!e.key)return;let t=this.namespace&&e.key.startsWith(`${this.namespace}:`)?e.key.slice(this.namespace.length+1):e.key,s=this.watchers.get(t);if(s){let a=e.oldValue?JSON.parse(e.oldValue).value:null,n=e.newValue?JSON.parse(e.newValue).value:null;s.forEach((o)=>o(n,a,t))}}encrypt(e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e.charCodeAt(s)^this.encryptionKey.charCodeAt(s%this.encryptionKey.length));return btoa(t)}decrypt(e){try{let t=atob(e),s="";for(let a=0;a<t.length;a++)s+=String.fromCharCode(t.charCodeAt(a)^this.encryptionKey.charCodeAt(a%this.encryptionKey.length));return s}catch{return e}}compress(e){if(e.length<100)return e;let t={},s=256,a=[],n="";for(let o=0;o<e.length;o++){let i=e.charAt(o),r=n+i;if(t[r]!==void 0)n=r;else a.push(n.length>1?t[n]:n.charCodeAt(0)),t[r]=s++,n=i}if(n!=="")a.push(n.length>1?t[n]:n.charCodeAt(0));return JSON.stringify(a)}decompress(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return e;let s={},a=256,n=String.fromCharCode(t[0]),o=n;for(let i=1;i<t.length;i++){let r=t[i],c;if(s[r]!==void 0)c=s[r];else if(r===a)c=n+n.charAt(0);else return e;o+=c,s[a++]=n+c.charAt(0),n=c}return o}catch{return e}}getKey(e){return this.namespace?`${this.namespace}:${e}`:e}set(e,t,s){let a=this.getKey(e),n=this.get(e),o={value:t,timestamp:Date.now(),expire:s?.expire,encrypted:s?.encrypt||!1,compressed:s?.compress||!1};try{let i=JSON.stringify(o);if(s?.compress)i=this.compress(i);if(s?.encrypt)i=this.encrypt(i);this.storage.setItem(a,i),this.notifyWatchers(e,t,n)}catch(i){console.error("Storage set error:",i)}}get(e){let t=this.getKey(e);try{let s=this.storage.getItem(t);if(!s)return null;if(s.match(/^[A-Z0-9+/]+=*$/i))try{s=this.decrypt(s)}catch{}if(s.startsWith("["))try{s=this.decompress(s)}catch{}let a=JSON.parse(s);if(a.expire&&Date.now()-a.timestamp>a.expire)return this.remove(e),null;return a.value}catch(s){return console.error("Storage get error:",s),null}}watch(e,t){if(!this.watchers.has(e))this.watchers.set(e,new Set);return this.watchers.get(e).add(t),()=>{let s=this.watchers.get(e);if(s){if(s.delete(t),s.size===0)this.watchers.delete(e)}}}notifyWatchers(e,t,s){let a=this.watchers.get(e);if(a)a.forEach((n)=>n(t,s,e))}remove(e){let t=this.getKey(e),s=this.get(e);this.storage.removeItem(t),this.notifyWatchers(e,null,s)}clear(){if(this.namespace)this.keys().forEach((t)=>this.remove(t));else this.storage.clear()}has(e){return this.get(e)!==null}keys(){let e=Object.keys(this.storage);if(this.namespace){let t=`${this.namespace}:`;return e.filter((s)=>s.startsWith(t)).map((s)=>s.slice(t.length))}return e}size(){return this.keys().length}getQuota(){if("storage"in navigator&&"estimate"in navigator.storage)return null;try{let e=0;for(let s=0;s<this.storage.length;s++){let a=this.storage.key(s);if(a){let n=this.storage.getItem(a)||"";e+=a.length+n.length}}let t=5242880;return{usage:e*2,quota:t,percentage:e*2/t*100}}catch{return null}}setMany(e,t){Object.entries(e).forEach(([s,a])=>{this.set(s,a,t)})}getMany(e){let t={};return e.forEach((s)=>{t[s]=this.get(s)}),t}removeMany(e){e.forEach((t)=>this.remove(t))}}var Ww={local:new ct("local"),session:new ct("session")};function Gw(e="local",t){return new ct(e,t)}var $d="./Switch-vd8k23sr.stx";var Id="./Table-0a4y46vd.stx";var Pd="./TableBody-y49bqb1p.stx";var Rd="./TableCell-jhvsxw8b.stx";var Ld="./TableHead-e9xvjx2j.stx";var Od="./TableHeader-krzcx4sv.stx";var Hd="./TableRow-dt8e11aj.stx";var Vd="./Tab-j9f4t166.stx";var Bd="./TabList-r1pc87xs.stx";var Kd="./TabPanel-5htevsq6.stx";var Wd="./Tabs-psm5wj7c.stx";var Ud="./Teleport-vqs75x36.stx";var Yd="./Textarea-bb63fsz0.stx";var Zd="./AiTextarea-bg6xq5wc.stx";var ep="./Tooltip-e3g8qntr.stx";var sp="./Transition-7m0mk45s.stx";var np="./Video-bqsx3wr8.stx";var ip="./VirtualList-fa7v5a3h.stx";var lp="./VirtualTable-kp7b3wyv.stx";var cp=0;function Oa(e="a11y"){return`${e}-${++cp}-${Date.now()}`}function _y(e,t,s={}){let{visible:a=!1,id:n=Oa("label")}=s,o=document.createElement(a?"label":"span");if(o.id=n,o.textContent=e,!a)Object.assign(o.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"});if(t)if(t.setAttribute("aria-labelledby",n),t.parentElement)t.parentElement.insertBefore(o,t);else document.body.appendChild(o);return n}function Ky(e,t){let s=Oa("desc"),a=document.createElement("span");if(a.id=s,a.textContent=e,Object.assign(a.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),t)if(t.setAttribute("aria-describedby",s),t.parentElement)t.parentElement.insertBefore(a,t);else document.body.appendChild(a);return s}function qy(e,t="polite"){let s=document.createElement("div");s.setAttribute("role","status"),s.setAttribute("aria-live",t),s.setAttribute("aria-atomic","true"),Object.assign(s.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),document.body.appendChild(s),setTimeout(()=>{s.textContent=e},100),setTimeout(()=>{s.parentNode?.removeChild(s)},1000)}function Kt(e){let t=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter((s)=>s.offsetParent!==null)}function Wy(e,t={}){let{initialFocus:s,returnFocus:a,escapeDeactivates:n=!0,clickOutsideDeactivates:o=!0,allowOutsideClick:i=!1,onActivate:r,onDeactivate:c}=t,l=!1,d=!1,h=null,p=(v)=>{if(d)return;if(n&&v.key==="Escape"){v.preventDefault(),m();return}if(v.key==="Tab"){let b=Kt(e);if(b.length===0){v.preventDefault();return}let C=b[0],P=b[b.length-1];if(v.shiftKey){if(document.activeElement===C)v.preventDefault(),P.focus()}else if(document.activeElement===P)v.preventDefault(),C.focus()}},u=(v)=>{if(d)return;if(!e.contains(v.target)){if(typeof i==="function"){if(!i(v)&&o)m()}else if(!i&&o)m()}};function g(){if(l)return;l=!0,h=document.activeElement;let v=s||Kt(e)[0];if(v&&typeof v.focus==="function")v.focus();document.addEventListener("keydown",p),document.addEventListener("click",u),r?.()}function m(){if(!l)return;l=!1;let v=a||h;if(v&&typeof v.focus==="function")v.focus();document.removeEventListener("keydown",p),document.removeEventListener("click",u),c?.()}function w(){d=!0}function y(){d=!1}return{activate:g,deactivate:m,pause:w,unpause:y}}function Gy(e,t={}){let{selector:s='[role="option"], [role="menuitem"], [role="tab"], button',initialIndex:a=0,orientation:n="both",loop:o=!0,onFocusChange:i}=t,r=a,c=()=>Array.from(e.querySelectorAll(s)),l=(h)=>{let p=c();if(h<0||h>=p.length)return;p.forEach((u,g)=>{if(g===h){if(u.setAttribute("tabindex","0"),typeof u.focus==="function")u.focus()}else u.setAttribute("tabindex","-1")}),r=h,i?.(h,p[h])},d=(h)=>{let u=c().length-1,g=!1,m=r;switch(h.key){case"ArrowRight":if(n==="horizontal"||n==="both"){if(m=r+1,m>u)m=o?0:u;g=!0}break;case"ArrowLeft":if(n==="horizontal"||n==="both"){if(m=r-1,m<0)m=o?u:0;g=!0}break;case"ArrowDown":if(n==="vertical"||n==="both"){if(m=r+1,m>u)m=o?0:u;g=!0}break;case"ArrowUp":if(n==="vertical"||n==="both"){if(m=r-1,m<0)m=o?u:0;g=!0}break;case"Home":m=0,g=!0;break;case"End":m=u,g=!0;break}if(g)h.preventDefault(),l(m)};return l(a),e.addEventListener("keydown",d),()=>{e.removeEventListener("keydown",d)}}var Uy={Enter:"Enter",Space:" ",Escape:"Escape",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",Tab:"Tab",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown"};function Jy(e){return document.activeElement===e}function Yy(e,t){let s=t||document.activeElement,a=Kt(document.body),n=a.indexOf(s);if(n===-1)return;let o=e==="next"?n+1:n-1,i=a[o];if(i)i.focus()}function Xy(e){if(e.getAttribute("aria-hidden")==="true")return!1;let t=window.getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden")return!1;return!0}var Zy={setExpanded(e,t){e.setAttribute("aria-expanded",String(t))},setSelected(e,t){e.setAttribute("aria-selected",String(t))},setChecked(e,t){e.setAttribute("aria-checked",String(t))},setDisabled(e,t){if(e.setAttribute("aria-disabled",String(t)),t)e.setAttribute("tabindex","-1");else e.removeAttribute("tabindex")},setHidden(e,t){if(t)e.setAttribute("aria-hidden","true");else e.removeAttribute("aria-hidden")},setPressed(e,t){e.setAttribute("aria-pressed",String(t))},setInvalid(e,t){e.setAttribute("aria-invalid",String(t))},setRequired(e,t){e.setAttribute("aria-required",String(t))},setLive(e,t){e.setAttribute("aria-live",t)},setBusy(e,t){e.setAttribute("aria-busy",String(t))}};function Qy(e){let t=document.createElement("span");return t.textContent=e,t.className="sr-only",Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),t}function e0(){if(typeof window.matchMedia==="function")return window.matchMedia("(prefers-reduced-motion: reduce)").matches;return!1}function t0(){if(typeof window.matchMedia==="function")return window.matchMedia("(prefers-contrast: high)").matches;return!1}function s0(){if(typeof window.matchMedia==="function"){if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light"}return null}function a0(e,t="Skip to main content"){let s=document.createElement("a");return s.href=`#${e}`,s.textContent=t,s.className="skip-link",Object.assign(s.style,{position:"absolute",top:"-40px",left:"0",background:"#000",color:"#fff",padding:"8px",textDecoration:"none",zIndex:"100"}),s.addEventListener("focus",()=>{s.style.top="0"}),s.addEventListener("blur",()=>{s.style.top="-40px"}),s}function n0(e){let t=[],s=(a)=>{let n=e.getAttribute(a);if(n){let o=n.split(" ");for(let i of o)if(!document.getElementById(i))t.push(`${a} references non-existent ID: ${i}`)}};return s("aria-labelledby"),s("aria-describedby"),s("aria-controls"),s("aria-owns"),s("aria-activedescendant"),t}var dp=(e,t,s,a)=>s*e/a+t,pp=(e,t,s,a)=>(e/=a,s*e*e+t),hp=(e,t,s,a)=>(e/=a,-s*e*(e-2)+t),up=(e,t,s,a)=>{if(e/=a/2,e<1)return s/2*e*e+t;return e--,-s/2*(e*(e-2)-1)+t},fp=(e,t,s,a)=>(e/=a,s*e*e*e+t),mp=(e,t,s,a)=>(e/=a,e--,s*(e*e*e+1)+t),gp=(e,t,s,a)=>{if(e/=a/2,e<1)return s/2*e*e*e+t;return e-=2,s/2*(e*e*e+2)+t},xp=(e,t,s,a)=>(e/=a,s*e*e*e*e+t),bp=(e,t,s,a)=>(e/=a,e--,-s*(e*e*e*e-1)+t),vp=(e,t,s,a)=>{if(e/=a/2,e<1)return s/2*e*e*e*e+t;return e-=2,-s/2*(e*e*e*e-2)+t},wp=(e,t,s,a)=>(e/=a,s*e*e*e*e*e+t),yp=(e,t,s,a)=>(e/=a,e--,s*(e*e*e*e*e+1)+t),kp=(e,t,s,a)=>{if(e/=a/2,e<1)return s/2*e*e*e*e*e+t;return e-=2,s/2*(e*e*e*e*e+2)+t},Sp=(e,t,s,a)=>-s*Math.cos(e/a*(Math.PI/2))+s+t,Cp=(e,t,s,a)=>s*Math.sin(e/a*(Math.PI/2))+t,Tp=(e,t,s,a)=>-s/2*(Math.cos(Math.PI*e/a)-1)+t,$p=(e,t,s,a)=>e===0?t:s*2**(10*(e/a-1))+t,Ep=(e,t,s,a)=>e===a?t+s:s*(-(2**(-10*e/a))+1)+t,Ip=(e,t,s,a)=>{if(e===0)return t;if(e===a)return t+s;if(e/=a/2,e<1)return s/2*2**(10*(e-1))+t;return e--,s/2*(-(2**(-10*e))+2)+t},Ap=(e,t,s,a)=>(e/=a,-s*(Math.sqrt(1-e*e)-1)+t),Pp=(e,t,s,a)=>(e/=a,e--,s*Math.sqrt(1-e*e)+t),Mp=(e,t,s,a)=>{if(e/=a/2,e<1)return-s/2*(Math.sqrt(1-e*e)-1)+t;return e-=2,s/2*(Math.sqrt(1-e*e)+1)+t},Rp=(e,t,s,a)=>{let n=1.70158,o=0,i=s;if(e===0)return t;if(e/=a,e===1)return t+s;if(!o)o=a*0.3;if(i<Math.abs(s))i=s,n=o/4;else n=o/(2*Math.PI)*Math.asin(s/i);return e-=1,-(i*2**(10*e)*Math.sin((e*a-n)*(2*Math.PI)/o))+t},Np=(e,t,s,a)=>{let n=1.70158,o=0,i=s;if(e===0)return t;if(e/=a,e===1)return t+s;if(!o)o=a*0.3;if(i<Math.abs(s))i=s,n=o/4;else n=o/(2*Math.PI)*Math.asin(s/i);return i*2**(-10*e)*Math.sin((e*a-n)*(2*Math.PI)/o)+s+t},Lp=(e,t,s,a)=>{let n=1.70158,o=0,i=s;if(e===0)return t;if(e/=a/2,e===2)return t+s;if(!o)o=a*0.44999999999999996;if(i<Math.abs(s))i=s,n=o/4;else n=o/(2*Math.PI)*Math.asin(s/i);if(e<1)return e-=1,-0.5*(i*2**(10*e)*Math.sin((e*a-n)*(2*Math.PI)/o))+t;return e-=1,i*2**(-10*e)*Math.sin((e*a-n)*(2*Math.PI)/o)*0.5+s+t},Dp=(e,t,s,a)=>(e/=a,s*e*e*(2.70158*e-1.70158)+t),Op=(e,t,s,a)=>(e/=a,e--,s*(e*e*(2.70158*e+1.70158)+1)+t),zp=(e,t,s,a)=>{let n=1.70158;if(e/=a/2,e<1)return n*=1.525,s/2*(e*e*((n+1)*e-n))+t;return e-=2,n*=1.525,s/2*(e*e*((n+1)*e+n)+2)+t},qt=(e,t,s,a)=>{if(e/=a,e<0.36363636363636365)return s*(7.5625*e*e)+t;else if(e<0.7272727272727273)return e-=0.5454545454545454,s*(7.5625*e*e+0.75)+t;else if(e<0.9090909090909091)return e-=0.8181818181818182,s*(7.5625*e*e+0.9375)+t;else return e-=0.9545454545454546,s*(7.5625*e*e+0.984375)+t},za=(e,t,s,a)=>s-qt(a-e,0,s,a)+t,Hp=(e,t,s,a)=>{if(e<a/2)return za(e*2,0,s,a)*0.5+t;return qt(e*2-a,0,s,a)*0.5+s*0.5+t},i0={linear:dp,easeInQuad:pp,easeOutQuad:hp,easeInOutQuad:up,easeInCubic:fp,easeOutCubic:mp,easeInOutCubic:gp,easeInQuart:xp,easeOutQuart:bp,easeInOutQuart:vp,easeInQuint:wp,easeOutQuint:yp,easeInOutQuint:kp,easeInSine:Sp,easeOutSine:Cp,easeInOutSine:Tp,easeInExpo:$p,easeOutExpo:Ep,easeInOutExpo:Ip,easeInCirc:Ap,easeOutCirc:Pp,easeInOutCirc:Mp,easeInElastic:Rp,easeOutElastic:Np,easeInOutElastic:Lp,easeInBack:Dp,easeOutBack:Op,easeInOutBack:zp,easeInBounce:za,easeOutBounce:qt,easeInOutBounce:Hp};function Fp(e,t={}){let{duration:s="1s",timing:a="ease",delay:n="0s",iteration:o="1",direction:i="normal",fill:r="both",playState:c="running"}=t;return`${e} ${s} ${a} ${n} ${o} ${i} ${r} ${c}`}function Ha(e,t,s={}){e.style.animation=Fp(t,s)}function l0(e){e.style.animation=""}function Vp(e){return new Promise((t)=>{let s=()=>{e.removeEventListener("animationend",s),t()};e.addEventListener("animationend",s)})}function c0(e,t,s={}){let{stagger:a=100,...n}=s;e.forEach((o,i)=>{let r=`${i*a}ms`;Ha(o,t,{...n,delay:r})})}async function d0(e,t){for(let s of t)Ha(e,s.name,s.options),await Vp(e)}var p0={fadeIn:"animate-fade-in",fadeOut:"animate-fade-out",slideInUp:"animate-slide-in-up",slideInDown:"animate-slide-in-down",slideInLeft:"animate-slide-in-left",slideInRight:"animate-slide-in-right",zoomIn:"animate-zoom-in",zoomOut:"animate-zoom-out",bounce:"animate-bounce",spin:"animate-spin",ping:"animate-ping",pulse:"animate-pulse"};function h0(e,t,s=1000){return new Promise((a)=>{e.classList.add(t),setTimeout(()=>{e.classList.remove(t),a()},s)})}function u0(e,t){let s=`
14
14
  @keyframes ${e} {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.957",
4
+ "version": "0.2.958",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -144,8 +144,8 @@
144
144
  "dependencies": {
145
145
  "@iconify-json/f7": "^1.2.2",
146
146
  "@stacksjs/ts-css": "^0.3.11",
147
- "@stacksjs/stx": "0.2.957",
148
- "bun-plugin-stx": "0.2.957",
147
+ "@stacksjs/stx": "0.2.958",
148
+ "bun-plugin-stx": "0.2.958",
149
149
  "ts-syntax-highlighter": "^0.2.20",
150
150
  "ts-video-player": "^0.1.11"
151
151
  },
@@ -17,6 +17,7 @@ const query = state({{ initialQuery }})
17
17
  function close() {
18
18
  if (!isOpen()) return
19
19
  isOpen.set(false)
20
+ setActive(null)
20
21
  emit('close')
21
22
  }
22
23
 
@@ -40,6 +41,94 @@ function panelEl() {
40
41
  return document.querySelector(`[data-palette-id="${paletteInstanceId}"] [data-stx-command-palette-panel]`)
41
42
  }
42
43
 
44
+ /*
45
+ * The keyboard, as a combobox (stacksjs/stx#2231). Focus stays in the search
46
+ * field so the user can keep typing; the command arrowed to is the ACTIVE
47
+ * option, named by aria-activedescendant on the field and marked
48
+ * aria-selected, and Enter clicks it, so it is selected exactly as a pointer
49
+ * selects it. The items used to be plain divs with only a click handler, so a
50
+ * keyboard could open the palette and close it and do nothing in between.
51
+ *
52
+ * Held as the element rather than an index: the page filters the results as
53
+ * the query changes, and an index would then point at a different command.
54
+ */
55
+ let activeItem = null
56
+
57
+ function listEl() {
58
+ return panelEl()?.querySelector('[data-stx-command-palette-list]') ?? null
59
+ }
60
+
61
+ /** The commands showing now: an item the page hid with :show or hidden is skipped. */
62
+ function itemElements() {
63
+ const list = listEl()
64
+ if (!list) return []
65
+ return Array.prototype.filter.call(list.querySelectorAll('[data-stx-command-item]'), (item) => {
66
+ for (let node = item; node && node !== list; node = node.parentElement) {
67
+ if (node.hidden || (node.style && node.style.display === 'none')) return false
68
+ }
69
+ return true
70
+ })
71
+ }
72
+
73
+ function setActive(item) {
74
+ activeItem = item
75
+ const items = itemElements()
76
+ const doc = panelEl()?.ownerDocument || document
77
+ items.forEach((option, index) => {
78
+ // aria-activedescendant needs an id that is unique on the page.
79
+ if (!option.id || doc.querySelectorAll('[id="' + option.id + '"]').length !== 1)
80
+ option.id = 'stx-command-option-' + paletteInstanceId + '-' + index
81
+ option.setAttribute('aria-selected', option === item ? 'true' : 'false')
82
+ })
83
+ const input = panelEl()?.querySelector('[data-stx-command-palette-input]')
84
+ if (!input) return
85
+ if (item) input.setAttribute('aria-activedescendant', item.id)
86
+ else input.removeAttribute('aria-activedescendant')
87
+ }
88
+
89
+ function moveActive(delta) {
90
+ const items = itemElements()
91
+ if (!items.length) return
92
+ const from = items.indexOf(activeItem)
93
+ const next = from < 0
94
+ ? (delta > 0 ? 0 : items.length - 1)
95
+ : (from + delta + items.length) % items.length
96
+ setActive(items[next])
97
+ // The list scrolls, and nothing moves focus there to bring the option in.
98
+ if (items[next].scrollIntoView) items[next].scrollIntoView({ block: 'nearest' })
99
+ }
100
+
101
+ function onPaletteKey(event) {
102
+ const key = event.key
103
+ if (key === 'ArrowDown' || key === 'ArrowUp') {
104
+ event.preventDefault()
105
+ moveActive(key === 'ArrowDown' ? 1 : -1)
106
+ }
107
+ else if (key === 'Home' || key === 'End') {
108
+ event.preventDefault()
109
+ activeItem = null
110
+ moveActive(key === 'Home' ? 1 : -1)
111
+ }
112
+ else if (key === 'Enter' && activeItem && itemElements().includes(activeItem)) {
113
+ event.preventDefault()
114
+ activeItem.click()
115
+ }
116
+ }
117
+
118
+ /*
119
+ * The results changed under the active command: keep it while it still
120
+ * shows, and point at nothing once it is gone rather than at a stale id.
121
+ */
122
+ let resultsObserver = null
123
+ onMount(() => {
124
+ const list = listEl()
125
+ if (!list || typeof MutationObserver === 'undefined') return
126
+ resultsObserver = new MutationObserver(() => {
127
+ if (activeItem && !itemElements().includes(activeItem)) setActive(null)
128
+ })
129
+ resultsObserver.observe(list, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'hidden'] })
130
+ })
131
+
43
132
  /*
44
133
  * The palette takes over the page, so it is a modal layer on the page's
45
134
  * overlay stack (window.stx.overlays): the page held still behind it, focus
@@ -63,6 +152,7 @@ effect(() => {
63
152
 
64
153
  onDestroy(() => {
65
154
  window.stx.overlays.close(paletteInstanceId)
155
+ resultsObserver?.disconnect()
66
156
  })
67
157
 
68
158
  defineExpose({ isOpen, query, show, close })
@@ -91,15 +181,27 @@ defineExpose({ isOpen, query, show, close })
91
181
  </svg>
92
182
  <input
93
183
  type="text"
184
+ role="combobox"
185
+ aria-expanded="true"
186
+ aria-autocomplete="list"
187
+ aria-controls="stx-command-palette-list-{{ paletteInstanceId }}"
188
+ data-stx-command-palette-input
94
189
  class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-fg placeholder-fg-soft focus:ring-0 sm:text-sm"
95
190
  placeholder="Search..."
96
191
  aria-label="Search commands"
97
192
  :value="query()"
98
193
  @input="onQueryInput($event)"
194
+ @keydown="onPaletteKey($event)"
99
195
  />
100
196
  </div>
101
197
 
102
- <div class="max-h-96 overflow-y-auto py-2">
198
+ <div
199
+ id="stx-command-palette-list-{{ paletteInstanceId }}"
200
+ role="listbox"
201
+ aria-label="Commands"
202
+ data-stx-command-palette-list
203
+ class="max-h-96 overflow-y-auto py-2"
204
+ >
103
205
  <slot />
104
206
  </div>
105
207
  </div>
@@ -3,7 +3,8 @@ export const className = $props.className || ''
3
3
  export const value = $props.value
4
4
  export const valueJson = JSON.stringify(value === undefined ? null : value)
5
5
 
6
- const baseClasses = 'flex cursor-pointer select-none items-center px-4 py-2 text-fg hover:bg-accent-solid hover:text-accent-ink'
6
+ // aria-selected marks the command the keyboard is on (CommandPalette's onPaletteKey).
7
+ const baseClasses = 'flex cursor-pointer select-none items-center px-4 py-2 text-fg hover:bg-accent-solid hover:text-accent-ink aria-selected:bg-accent-solid aria-selected:text-accent-ink'
7
8
  export const itemClasses = `${baseClasses} ${className}`.trim()
8
9
  </script>
9
10
 
@@ -33,6 +34,8 @@ function onClick(event) {
33
34
 
34
35
  <div
35
36
  class="{{ itemClasses }}"
37
+ role="option"
38
+ aria-selected="false"
36
39
  data-stx-command-item
37
40
  @click="onClick($event)"
38
41
  >
@@ -1,106 +0,0 @@
1
- <script server>
2
- export const open = $bool($props.open)
3
- export const initialQuery = $props.query || ''
4
- export const className = $props.className || ''
5
-
6
- const baseClasses = 'fixed inset-0 z-50 overflow-y-auto p-4 sm:p-6 md:p-20'
7
- export const paletteClasses = `${baseClasses} ${className}`.trim()
8
- export const paletteInstanceId = $uid
9
- </script>
10
-
11
- <script client>
12
- const emit = defineEmits()
13
- const paletteInstanceId = {{ paletteInstanceId }}
14
- const isOpen = state({{ open }})
15
- const query = state({{ initialQuery }})
16
-
17
- function close() {
18
- if (!isOpen()) return
19
- isOpen.set(false)
20
- emit('close')
21
- }
22
-
23
- function show() {
24
- if (isOpen()) return
25
- isOpen.set(true)
26
- }
27
-
28
- function onQueryInput(event) {
29
- query.set(event.target.value)
30
- emit('query', event.target.value)
31
- }
32
-
33
- function onItemSelect(event) {
34
- event.stopPropagation()
35
- emit('select', event.detail)
36
- close()
37
- }
38
-
39
- function panelEl() {
40
- return document.querySelector(`[data-palette-id="${paletteInstanceId}"] [data-stx-command-palette-panel]`)
41
- }
42
-
43
- /*
44
- * The palette takes over the page, so it is a modal layer on the page's
45
- * overlay stack (window.stx.overlays): the page held still behind it, focus
46
- * straight into the search field and back to whatever opened it, Tab kept
47
- * inside, and Escape for whichever overlay is on top. It used to listen for
48
- * Escape on the document and do none of the rest, so focus stayed behind it
49
- * and a palette opened from a dialog closed the dialog too (stacksjs/stx#2057).
50
- */
51
- effect(() => {
52
- if (isOpen()) {
53
- window.stx.overlays.open(paletteInstanceId, {
54
- panel: panelEl,
55
- onEscape: close,
56
- initialFocus: () => panelEl()?.querySelector('input'),
57
- })
58
- }
59
- else {
60
- window.stx.overlays.close(paletteInstanceId)
61
- }
62
- })
63
-
64
- onDestroy(() => {
65
- window.stx.overlays.close(paletteInstanceId)
66
- })
67
-
68
- defineExpose({ isOpen, query, show, close })
69
- </script>
70
-
71
- <div
72
- :show="isOpen()"
73
- class="{{ paletteClasses }}"
74
- data-stx-command-palette
75
- data-palette-id="{{ paletteInstanceId }}"
76
- @stx:command-select="onItemSelect($event)"
77
- >
78
- <div class="fixed inset-0 bg-neutral-500/25 dark:bg-neutral-500/50 transition-opacity" aria-hidden="true" @click="close()"></div>
79
-
80
- <div
81
- data-stx-command-palette-panel
82
- role="dialog"
83
- aria-modal="true"
84
- aria-label="Command palette"
85
- tabindex="-1"
86
- class="mx-auto max-w-xl transform divide-y divide-line overflow-hidden rounded-xl bg-panel shadow-2xl ring-1 ring-line transition-all relative"
87
- >
88
- <div class="relative">
89
- <svg class="pointer-events-none absolute top-3.5 left-4 h-5 w-5 text-fg-soft" viewBox="0 0 20 20" fill="currentColor">
90
- <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
91
- </svg>
92
- <input
93
- type="text"
94
- class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-fg placeholder-fg-soft focus:ring-0 sm:text-sm"
95
- placeholder="Search..."
96
- aria-label="Search commands"
97
- :value="query()"
98
- @input="onQueryInput($event)"
99
- />
100
- </div>
101
-
102
- <div class="max-h-96 overflow-y-auto py-2">
103
- <slot />
104
- </div>
105
- </div>
106
- </div>