@vireo-ai/trellis-ui 0.1.59 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/packages/client/types/components/file-upload/index.d.ts +3 -2
- package/packages/client/types/components/image/contract.d.ts +1 -1
- package/packages/client/types/components/select/index.d.ts +3 -2
- package/packages/client/types/runtime/item-template.d.ts +13 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis-a1130be0a833.css +14030 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.min-d053936d467f.css +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/bridge-COxhbtRZ.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/bridge.js +1 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/build-metadata.json +155 -143
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion-B0MINJTL.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion-B0MINJTL.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable-Ctqx_OoS.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable-Ctqx_OoS.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/shortcut-D2NgvMgw.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/shortcut-D2NgvMgw.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/shortcut.js +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable-DQ4eUO2l.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable-DQ4eUO2l.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-B986Ob4f.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-B986Ob4f.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-ChoqPigj.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-ChoqPigj.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CqtsPVJy.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-CqtsPVJy.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DQtFqG0K.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DQtFqG0K.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/item-template-DSfME41Q.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/item-template-DSfME41Q.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/accordion-CKh9jOQc.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/accordion.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/button-Dnf0aKac.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/button.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/checkbox-BpFFtrfY.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/checkbox.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/data-grid-DHqf4lhn.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/data-grid.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/date-picker-DhNrvLv7.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/date-picker.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/direct-upload-DaT6-YFL.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/direct-upload.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/dropdown-CDPdgATy.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/dropdown.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/field-CtQbyblj.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/field.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/file-upload-DARtpJDT.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/file-upload.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/formset-CPO4XZkB.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/formset.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/import-mapper-C-3lKsKm.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/import-mapper.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index-DzOKmgfj.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index-DzOKmgfj.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/input-BKEbDkKa.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/input.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/keybinding-RIi2q1IT.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/keybinding.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/modal-1D2WtmlK.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/modal.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/panels-BXtMr9cv.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/panels.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/radio-DrGFMWGq.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/radio.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/scroll-area-CyUCAbgG.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/scroll-area.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/select-B_b2uwfv.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/select.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/sidebar-D8y44c-J.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/sidebar.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/slider-OztnTlqr.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/slider.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/switch-CZ7aiASg.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/switch.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/table-G3G5d2Eo.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/table.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tabs-CBjcV5_z.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tabs.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/toast-DSduFsxK.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/toast.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tooltip-B3vA5YAi.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tooltip.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/virtualizer-CkRX2qVO.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/virtualizer.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/core-CRIj89v5.js +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/core.js +2 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index-CL7BWKcd.js +2 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index-CL7BWKcd.js.map +1 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js +2 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/logical-entry-manifest.json +52 -47
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis-acc1b62a38b1.js +11 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.js +4 -4
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min-acc1b62a38b1.js +11 -0
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min.js +4 -4
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/shortcut.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-18lXAVBg.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-18lXAVBg.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bp3Npe3t.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Bp3Npe3t.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Ce_fpT15.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-Ce_fpT15.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DDJEGHq-.js +0 -2
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DDJEGHq-.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js.map +0 -1
- package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion-B0MINJTL.js","names":[],"sources":["../../../../../../../../client/src/capabilities/motion.entry.generated.ts"],"sourcesContent":["// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport {registerMotionCapability} from './motion';\n\nexport default registerMotionCapability;\nexport * from './motion';\n"],"mappings":"oHAIA,IAAA,EAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from "./motion-B0MINJTL.js";
|
|
2
|
+
export {default} from "./motion-B0MINJTL.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizable-Ctqx_OoS.js","names":[],"sources":["../../../../../../../../client/src/capabilities/resizable.entry.generated.ts"],"sourcesContent":["// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport {registerResizableCapability} from './resizable';\n\nexport default registerResizableCapability;\nexport * from './resizable';\n"],"mappings":"iEAIA,IAAA,EAAe"}
|
package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/resizable.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from "./resizable-Ctqx_OoS.js";
|
|
2
|
+
export {default} from "./resizable-Ctqx_OoS.js";
|
package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/shortcut-D2NgvMgw.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"../chunks/capability-shortcut-DZUQHJ3A.js";var o=r;export{a as createShortcutMatcher,o as default,n as formatShortcut,i as formatShortcutKeys,t as observePressedShortcutKeys,e as parseShortcut,r as registerShortcutCapability};
|
|
2
|
+
//# sourceMappingURL=shortcut-D2NgvMgw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcut-D2NgvMgw.js","names":[],"sources":["../../../../../../../../client/src/capabilities/shortcut.entry.generated.ts"],"sourcesContent":["// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport {registerShortcutCapability} from './shortcut';\n\nexport default registerShortcutCapability;\nexport * from './shortcut';\n"],"mappings":"4FAIA,IAAA,EAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from "./shortcut-D2NgvMgw.js";
|
|
2
|
+
export {default} from "./shortcut-D2NgvMgw.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortable-DQ4eUO2l.js","names":[],"sources":["../../../../../../../../client/src/capabilities/sortable.entry.generated.ts"],"sourcesContent":["// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport {registerSortableCapability} from './sortable';\n\nexport default registerSortableCapability;\nexport * from './sortable';\n"],"mappings":"4EAIA,IAAA,EAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export * from "./sortable-DQ4eUO2l.js";
|
|
2
|
+
export {default} from "./sortable-DQ4eUO2l.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,r as t,s as n,t as r}from"./dom-DiTFTWeR.js";import{t as i}from"./capability-motion-D_BJBnwB.js";import{n as a}from"./morph-Cq3V_23_.js";import{c as o,f as s,l as c,n as l,s as u,u as d}from"./codecs-CQ7olTJL.js";import{i as f,t as ee}from"./alpine-machine-CE2UN4Qu.js";import{t as p}from"./focus-pk_lz9sg.js";import{n as m,t as te}from"./alpine-data-Dvc_bXq6.js";import{t as ne}from"./anchored-popover-BwQbt4V2.js";import{n as h,t as g}from"./styles-CX2j92ex.js";import{t as re}from"./merge-bindings-BtqW3UgP.js";import{t as _}from"./machine-CNnHDbyo.js";import{n as ie,t as v}from"./props-change-2xfsIAEN.js";import{t as ae}from"./dismissable-layer-BROE-Ln2.js";import{i as oe,n as se,r as ce,t as le}from"./form-control-DL1Hkox3.js";import{i as ue}from"./focus-scope-BrYxsrhc.js";import{t as de}from"./semantic-observer-CIoriWtV.js";import{t as y}from"./scroll-lock-C5dQtr4Y.js";import{I as b,L as fe,M as pe,N as me,P as he,_ as x,a as S,c as ge,d as C,f as _e,h as w,i as ve,j as T,m as E,n as D,o as O,p as k,r as A,t as ye,z as j}from"./common-CBK89mIt.js";import{a as be}from"./styles-CQDZhwd_.js";import{n as xe,t as Se}from"./item-template-DSfME41Q.js";var Ce=e=>e.trim().toLowerCase(),we=e=>{if(e)try{return JSON.parse(e)}catch{return}},Te=(e,t)=>{if(t&&e!=null)return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)},M=[`soft`,`surface`,`outline`,`solid`],Ee=[`neutral`,`accent`,`success`,`warning`,`danger`],De=O,N=[`span`,`button`],P=D,F=x,I=A;c(M,`soft`),c(Ee,`neutral`),c(De,`sm`),c(I,`sm`),c(N,`span`),c(P,`button`),c(F,`mini`),c(P,`button`),s.default(`close`),c(F,`mini`),c(De,`sm`),s.default(`Remove`);var Oe=[`listbox`,`combobox`,`pillbox`,`native`],ke=ge,L=O,R=A,Ae=fe,z=ye,B=x,V=[`stay`,`close`],je=[`check`,`checkbox`,`none`],Me=j,Ne=C,Pe={name:s,optionsId:s,value:s,values:u.array([]),placeholder:s,mode:c(Oe,`listbox`),multiple:l,searchable:l,searchMinItems:o.min(0).default(5),virtualized:l,optionsFetchUrl:s,optionsTotalItems:o.min(0).default(0),optionItemSize:o.min(2**-52).default(36),optionBufferSize:o.min(1).default(50),optionOverscan:o.min(0).default(0),optionSearchParam:s.default(`q`),optionSearchDebounce:o.min(0).default(150),selectedLabelMap:u.object({}),creatable:l,filter:l.default(!0),clearable:l,clear:c(V,`stay`),suffix:s.default(`selected`),mark:c(je,`check`),open:l,disabled:l,readonly:l,required:l,invalid:l,autoHighlight:l.default(!0),loop:l.default(!0),path:s,size:c(L,`lg`),variant:c(ke,`outline`),radius:c(R,`md`),surface:c(Me,`+2`),elevation:c(Ne,`3`),side:c(Ae,`bottom`),align:c(z,`start`),offset:o.clamp(-100,100).default(0),gap:o.clamp(0,50).default(4),empty:s.default(`No results found.`),icon:s,iconTrailing:s.default(`chevron__down`),iconVariant:c(B,`outline`),buttonClass:s,inputClass:s,listboxClass:s,optionClass:s,chipVariant:c(M,`soft`),chipColor:c(Ee,`neutral`),chipClass:s,class:s};c(B,`outline`),o.clamp(0,100).default(0);var Fe=[f({name:`opening`,state:`disclosure.opening`,project:()=>({}),onDone:`OPENING_DONE`,onError:`OPENING_ERROR`,sends:{close:()=>({type:`CLOSE`})}}),f({name:`closing`,state:`disclosure.closing`,project:()=>({}),onDone:`CLOSING_DONE`,onError:`CLOSING_ERROR`,sends:{open:()=>({type:`OPEN`})}}),f({name:`searching`,state:`feature.searching`,project:e=>({query:e.context.search.query,optionsId:e.context.search.optionsId}),onDone:`SEARCHING_DONE`,onError:`SEARCHING_ERROR`,sends:{search:e=>({type:`SEARCH`,query:e}),close:()=>({type:`CLOSE`})}}),f({name:`creating`,state:`feature.creating`,project:e=>({query:e.context.search.query,value:e.context.creation.value}),onDone:`CREATING_DONE`,onError:`CREATING_ERROR`,sends:{close:()=>({type:`CLOSE`})}})],H=e=>ie(e)?.props??null,Ie=e=>e.disabled||e.readonly,Le=({event:e})=>{let t=H(e);return!t||Ie(t)||!t.open?!1:v(e,`open`,`disabled`,`readonly`)},U=({event:e})=>{let t=H(e);return t?v(e,`open`)&&!t.open||v(e,`disabled`)&&t.disabled||v(e,`readonly`)&&t.readonly:!1},Re=({event:e})=>{let t=H(e);return!!(t&&(v(e,`disabled`)&&t.disabled||v(e,`readonly`)&&t.readonly||v(e,`searchable`)&&!t.searchable))},ze=e=>!Array.isArray(e.selection)||!e.selection.every(e=>typeof e==`object`&&!!e&&typeof e.value==`string`&&typeof e.label==`string`)?null:e.selection.map(({value:e,label:t})=>({value:e,label:t})),Be=({props:e,context:t,effects:n})=>_({type:`parallel`,on:{DOM_INVALIDATED:{effects:`syncDom`}},states:{disclosure:{initial:`closed`,states:{closed:{tags:[`closed`],on:{OPEN:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},TOGGLE:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},SEARCH:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},PROPS_CHANGED:{target:`opening`,guard:Le,effects:`prepareOpen`}}},opening:{tags:[`visible`,`expanded`,`interactive`,`transitioning`],on:{OPENING_DONE:{target:`open`,effects:`finishOpen`},OPENING_ERROR:{target:`open`,effects:`finishOpen`},CLOSE:{target:`closing`,effects:`prepareClose`},TOGGLE:{target:`closing`,effects:`prepareClose`},CREATE:{target:`closing`,effects:`prepareClose`},SELECT:{target:`closing`,guard:`single`,effects:`prepareClose`},CLEAR:{target:`closing`,guard:`clearCloses`,effects:`prepareClose`},PROPS_CHANGED:{target:`closing`,guard:U,effects:`prepareClose`}}},open:{tags:[`visible`,`expanded`,`interactive`,`open`],on:{CLOSE:{target:`closing`,effects:`prepareClose`},TOGGLE:{target:`closing`,effects:`prepareClose`},CREATE:{target:`closing`,effects:`prepareClose`},SELECT:{target:`closing`,guard:`single`,effects:`prepareClose`},CLEAR:{target:`closing`,guard:`clearCloses`,effects:`prepareClose`},PROPS_CHANGED:{target:`closing`,guard:U,effects:`prepareClose`}}},closing:{tags:[`visible`,`transitioning`],on:{CLOSING_DONE:{target:`closed`,effects:`finishClose`},CLOSING_ERROR:{target:`closed`,effects:`finishClose`},OPEN:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},TOGGLE:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},SEARCH:{target:`opening`,guard:`canOpen`,effects:`prepareOpen`},PROPS_CHANGED:{target:`opening`,guard:Le,effects:`prepareOpen`}}}}},feature:{initial:`idle`,on:{SELECT:{reduce:`replaceSelection`,effects:`commitSelection`},DESELECT:{reduce:`replaceSelection`,effects:`commitSelection`},SELECT_ALL:{reduce:`replaceSelection`,effects:`commitSelection`},RECONCILE_SELECTION:{reduce:`replaceSelection`,effects:`syncActive`},CLEAR:{reduce:`clear`,effects:`commitSelection`},ACTIVE:{reduce:`setActive`,effects:`syncActive`},OPTIONS_CHANGED:{effects:`syncOptions`},CLOSING_DONE:{reduce:`resetTransient`,effects:`syncActive`},CLOSING_ERROR:{reduce:`resetTransient`,effects:`syncActive`}},states:{idle:{on:{CLOSE:{},SEARCH:{target:`searching`,reduce:`setSearch`,effects:`commitSearch`},CREATE:{target:`creating`,reduce:`setCreation`,effects:`prepareCreate`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}}},searching:{tags:[`searching`],on:{SEARCH:{target:`searching`,reduce:`setSearch`,effects:`commitSearch`},CREATE:{target:`creating`,reduce:`setCreation`,effects:`prepareCreate`},CLOSE:{target:`idle`},SEARCHING_DONE:`idle`,SEARCHING_ERROR:`idle`,PROPS_CHANGED:[{target:`idle`,guard:Re,reduce:`replaceProps`,effects:`syncProps`},{reduce:`replaceProps`,effects:`syncProps`}]}},creating:{tags:[`creating`],on:{SEARCH:{target:`searching`,reduce:`setSearch`,effects:`commitSearch`},CREATE:{target:`creating`,reduce:`setCreation`,effects:`prepareCreate`},CLOSE:{target:`idle`},CREATING_DONE:{target:`idle`},CREATING_ERROR:{target:`idle`},PROPS_CHANGED:[{target:`idle`,guard:Re,reduce:`replaceProps`,effects:`syncProps`},{reduce:`replaceProps`,effects:`syncProps`}]}}}}}},{context:t,props:e,reducers:{replaceProps:({event:e})=>{let t=H(e);return t?{props:t}:void 0},replaceSelection:({context:e,event:t})=>{let n=ze(t);if(n)return{context:{...e,selection:n}}},clear:({context:e})=>({context:{...e,selection:[],search:{...e.search,query:``},navigation:{activeValue:``}}}),setSearch:({context:e,event:t})=>({context:{...e,search:{query:typeof t.query==`string`?t.query:``,optionsId:typeof t.optionsId==`string`?t.optionsId:e.search.optionsId},navigation:{activeValue:typeof t.activeValue==`string`?t.activeValue:e.navigation.activeValue}}}),setActive:({context:e,event:t})=>({context:{...e,navigation:{activeValue:typeof t.value==`string`?t.value:``}}}),setCreation:({context:e,event:t})=>({context:{...e,creation:{value:typeof t.value==`string`?t.value:e.search.query}}}),resetTransient:({context:e})=>({context:{...e,search:{...e.search,query:``},navigation:{activeValue:``},creation:{value:``}}})},guards:{canOpen:({props:e})=>!Ie(e),single:({props:e})=>!e.multiple,clearCloses:({props:e})=>e.clear===`close`},effects:{prepareOpen:n.prepareOpen,finishOpen:n.finishOpen,prepareClose:n.prepareClose,finishClose:n.finishClose,commitSelection:n.commitSelection,commitSearch:n.commitSearch,prepareCreate:n.prepareCreate,syncProps:n.syncProps,syncOptions:n.syncOptions,syncActive:n.syncActive,syncDom:n.syncDom}}),Ve=640,He=256,Ue=520,We=.72,Ge=12,Ke=16,W=720,qe=720,Je=({viewportWidth:e,viewportHeight:t,layoutViewportHeight:n,referenceTop:r,referenceBottom:i,touch:a})=>{if(e<=Ve)return`fullscreen`;let o=t<Ue||t<n*We;if(a&&o)return`fullscreen`;if(a)return`dialog`;let s=Math.max(0,r),c=Math.max(0,t-i);return Math.max(s,c)<He?`dialog`:`anchored`},Ye=()=>{let e=window.visualViewport;return e?{width:e.width,height:e.height,offsetTop:e.offsetTop,offsetLeft:e.offsetLeft}:{width:window.innerWidth,height:window.innerHeight,offsetTop:0,offsetLeft:0}},Xe=()=>window.matchMedia?.(`(any-pointer: coarse)`).matches===!0||navigator.maxTouchPoints>0,Ze=e=>{let t=ne(e),n=!1,r=`anchored`,i=null,a=null,o=()=>e.floating(),s=e=>{e?i??=y(o().ownerDocument):(i?.(),i=null)},c=e=>{e.style.removeProperty(`border-radius`),e.style.removeProperty(`height`),e.style.removeProperty(`inset`),e.style.removeProperty(`max-height`),e.style.removeProperty(`max-width`),e.style.removeProperty(`position`),e.style.removeProperty(`transform-origin`),e.style.removeProperty(`width`)},l=(e,t)=>{let n=Ye(),r=t===`dialog`?Ke:Ge,i=t===`dialog`?W:1/0,a=t===`dialog`?qe:1/0,o=Math.min(i,Math.max(0,n.width-r*2)),s=Math.min(a,Math.max(0,n.height-r*2)),c=n.offsetLeft+(n.width-o)/2,l=n.offsetTop+(n.height-s)/2;Object.assign(e.style,{borderRadius:`var(--radius-overlay-md)`,position:`fixed`,inset:`${l}px auto auto ${c}px`,width:`${o}px`,height:`${s}px`,maxWidth:`none`,maxHeight:`none`,transformOrigin:`center`})},u=()=>{let t=Ye(),n=e.reference().getBoundingClientRect();return Je({viewportWidth:t.width,viewportHeight:t.height,layoutViewportHeight:window.innerHeight,referenceTop:n.top-t.offsetTop,referenceBottom:n.bottom-t.offsetTop,touch:Xe()})},d=()=>{if(!n)return;let i=o(),a=u();r=a,i.dataset.presentation=a;let d=i.querySelector(`[data-ui-select-sheet-heading]`);if(d&&(d.style.display=a===`anchored`?`none`:`flex`),a===`anchored`){i.removeAttribute(`aria-modal`),i.removeAttribute(`aria-labelledby`),i.removeAttribute(`role`),s(!1),c(i),t.mount();return}t.unmount(),i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-modal`,`true`),i.setAttribute(`aria-labelledby`,e.labelId()),s(!0),l(i,a)},f=()=>{let e=()=>d(),t=window.visualViewport,n=window.matchMedia?.(`(any-pointer: coarse)`);return window.addEventListener(`resize`,e),window.addEventListener(`orientationchange`,e),t?.addEventListener(`resize`,e),t?.addEventListener(`scroll`,e),n?.addEventListener(`change`,e),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`orientationchange`,e),t?.removeEventListener(`resize`,e),t?.removeEventListener(`scroll`,e),n?.removeEventListener(`change`,e)}},ee=()=>{if(!n){n=!0;try{o().showPopover()}catch{}d(),a=f()}},p=()=>{if(n){n=!1,a?.(),a=null,t.unmount(),s(!1);try{o().hidePopover()}catch{}}};return{opened:()=>n,open:ee,close:p,sync:d,destroy:p,presentation:()=>r}},G=g({definition:{component:`ui.select`,parts:{root:{base:`relative inline-grid w-full min-w-0`},control:{base:w,variants:{size:ve,radius:S,variant:{outline:``,filled:``,plain:``},mode:{listbox:``,combobox:``,pillbox:`flex-wrap gap-1 py-0.5`,native:``},empty:{true:``,false:``}},compounds:[{when:{mode:`pillbox`,empty:!1},class:`!pl-1.5`}],defaults:{size:`lg`,variant:`outline`,radius:`md`,mode:`listbox`,empty:!1}},button:{base:[`flex min-w-0 flex-1 items-center gap-2 border-0 bg-transparent p-0 text-left text-inherit outline-none`]},pillboxTrigger:{base:`min-w-16 self-stretch`},value:{base:`min-w-0 flex-1 truncate`},placeholder:{base:`min-w-0 flex-1 truncate text-surface-ink-muted`},input:{base:[`w-full min-w-16 flex-1`,k]},search:{base:[`flex min-h-control-xlg shrink-0 items-center gap-2 px-3`,`text-sm`]},searchInput:{base:[`min-w-0 flex-1 text-sm`,k]},sheetHeader:{base:``},sheetHeading:{base:`min-w-0 items-center gap-3 px-4 pt-4`},sheetTitle:{base:`min-w-0 flex-1 truncate text-base font-medium`},sheetClose:{base:[`inline-flex size-control-md shrink-0 items-center justify-center rounded-control-sm border-0 bg-transparent`,`text-surface-ink-muted outline-none focus-visible:ui-focus-ring`]},chips:{base:`flex min-w-0 flex-wrap items-center gap-1`},chip:{base:[`max-w-64`]},chipLabel:{base:`flex min-w-0 flex-1 items-center`},chipPlainLabel:{base:`block min-w-0 flex-1 truncate`},chipRemove:{base:``},icon:{base:`size-icon shrink-0 fill-current text-surface-ink-muted`,variants:{position:{leading:``,trailing:``}},defaults:{position:`leading`}},action:{base:_e},popover:{base:[b,`overflow-hidden rounded-overlay-sm`]},listbox:{base:`min-h-0 min-w-0 max-w-full overflow-hidden outline-none`},viewport:{base:`min-h-0 min-w-0 max-w-full`},options:{base:`grid w-full min-w-0 max-w-full auto-rows-min content-start gap-1 p-popover-padding`},virtualOptions:{base:`grid w-full min-w-0 max-w-full auto-rows-min content-start gap-1 px-popover-padding`},create:{base:`shrink-0 p-popover-padding`},option:{base:[me,`min-w-0 max-w-full overflow-hidden`,`[&:has([data-ui-select-option-label]>*+*)]:h-auto`,`[&:has([data-ui-select-option-label]>*+*)]:items-start`,`[&:has([data-ui-select-option-label]>*+*)]:py-2`]},optionLabel:{base:`min-w-0 flex-1 truncate`},optionMeta:{base:he},optionIcon:{base:T,variants:{position:{leading:``,trailing:`ml-auto`}},defaults:{position:`leading`}},optionIndicator:{base:pe},group:{base:`grid auto-rows-min content-start gap-1`},label:{base:`px-menu-item-padding-inline py-1`},empty:{base:`px-menu-item-padding-inline py-2 text-sm text-surface-ink-muted`},separatorRoot:{base:`-mx-popover my-popover h-[var(--border-width-edge-separator)]`},separatorRule:{base:`h-[var(--border-width-edge-separator)] w-full border-0`},nativeWrapper:{base:`relative w-full min-w-0`},native:{base:[E,`appearance-none pe-10`],variants:{size:ve,radius:S},defaults:{size:`lg`,radius:`md`}},nativeIcon:{base:`pointer-events-none absolute right-3 top-1/2 size-icon -translate-y-1/2 fill-current text-icon`}}}}),Qe=class{ordinaryCount;filter;records;projections=new Map;constructor({root:t,listboxId:n,props:r,resolveLabel:i,rememberLabel:a}){this.filter=r.filter,this.records=Array.from(t.querySelectorAll(K)).map((t,a)=>{let o=i(t,r),s=t.dataset.value||o,c=t.hasAttribute(`data-ui-select-option-create`);return{el:t,id:t.id||`${n}-option-${a}`,value:s,label:o,selectedLabel:t.dataset.selectedLabel||o,disabled:e({value:t.dataset.disabled}),create:c,minLength:Number(t.dataset.minLength??`0`),suffix:t.dataset.suffix??``}});let o=new Set;this.records.forEach(e=>{e.create||o.has(e.value)||(o.add(e.value),a(e.value,e.selectedLabel))}),this.ordinaryCount=this.records.filter(e=>!e.create).length}project(e,t){let n=t.map(({value:e})=>e),r=JSON.stringify([e,n]),i=this.projections.get(r);if(i)return i;let a=Ce(e),o=a!==``&&this.records.some(e=>!e.create&&Ce(e.label)===a),s=this.records.map(t=>{let r=!a||Ce(`${t.label} ${t.suffix}`).includes(a);return{...t,value:t.create?t.el.dataset.value||e:t.value,selected:n.includes(t.value),visible:t.create?!o&&e.length>=t.minLength:!this.filter||a===``||r}}),c=new Map,l=new Map;s.forEach(e=>{c.has(e.value)||c.set(e.value,e),l.set(e.el,e)});let u={options:s,enabled:s.filter(e=>e.visible&&!e.disabled&&!e.create),firstByValue:c,byElement:l};return this.projections.set(r,u),u}},K=`[data-ui-select-option], [data-ui-select-option-create]`,q=`template[data-ui-select-option-selected-template]`,$e=new Set([`A`,`AREA`,`BUTTON`,`DETAILS`,`EMBED`,`IFRAME`,`INPUT`,`OBJECT`,`OPTION`,`SELECT`,`SUMMARY`,`TEXTAREA`]),J=new Set([`SCRIPT`,`STYLE`]),et=new Set([`autofocus`,`contenteditable`,`controls`,`download`,`draggable`,`form`,`formaction`,`formenctype`,`formmethod`,`formnovalidate`,`formtarget`,`href`,`id`,`name`,`popover`,`popovertarget`,`popovertargetaction`,`role`,`tabindex`,`target`]),Y=e=>et.has(e)||e.startsWith(`aria-`)&&e!==`aria-hidden`||e.startsWith(`data-ui-select`)||e===`data-ui-interactive`||e.startsWith(`data-ui-action`)||e.startsWith(`data-selected`)||e.startsWith(`data-highlighted`)||e.startsWith(`data-disabled`)||e.startsWith(`x-`)||e.startsWith(`hx-`)||e.startsWith(`v-`)||e.startsWith(`wire:`)||e.startsWith(`@`)||e.startsWith(`:`)||e.startsWith(`on`),X=e=>{if(!(e instanceof Element))return e;let t=e.localName.toUpperCase();if(J.has(t))return null;let n=e;return($e.has(t)||e.hasAttribute(`contenteditable`))&&(n=document.createElement(`span`),Array.from(e.attributes).forEach(e=>{Y(e.name)||n.setAttribute(e.name,e.value)}),n.append(...Array.from(e.childNodes))),Array.from(n.attributes).forEach(e=>{Y(e.name)&&n.removeAttribute(e.name)}),Array.from(n.childNodes).forEach(e=>{let t=X(e);t?t!==e&&e.replaceWith(t):e.remove()}),n.setAttribute(`x-ignore`,`true`),n},tt=e=>{let t=document.createDocumentFragment();return Array.from(e).forEach(e=>{if(e instanceof HTMLTemplateElement&&e.matches(q))return;let n=X(e.cloneNode(!0));n&&t.append(n)}),t},nt=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Z=i=>{let o=null,s=!1,c=``,l=``,u=``,f=``,m=null,ne=null,g=null,_,ie=``,v=new Map,y=!1,b=!1,fe=null,pe=``,me=0,he=0,x=0,S=0,ge=null,C=null,_e=new Map,w=()=>{if(!o)throw Error(`Select has not been initialized.`);return o},ve=()=>{let e=w().querySelector(`[data-ui-select-control]`);if(!e)throw Error(`Select requires a control element.`);return e},T=()=>{let e=w().querySelector(`[data-ui-select-trigger], [data-ui-select-button], [data-ui-select-input]`);if(!e)throw Error(`Select requires a trigger element.`);return e},E=()=>w().querySelector(`[data-ui-select-input]`),D=()=>w().querySelector(`[data-ui-select-search-input]`),O=()=>{let e=w().querySelector(`[data-ui-select-sheet-title]`);if(!e)throw Error(`Select requires an adaptive picker title.`);return e},k=()=>{let e=w().querySelector(`[data-ui-select-popover]`);if(!e)throw Error(`Select requires a popover element.`);return e},A=()=>{let e=w().querySelector(`[data-ui-select-listbox]`);if(!e)throw Error(`Select requires a listbox element.`);return e},ye=()=>{let e=w().querySelector(`[data-ui-select-options]`);if(!e)throw Error(`Select requires an options element.`);return e},j=()=>w().querySelector(`[data-ui-select-virtualizer]`),M=()=>j()?._x_dataStack?.find(e=>typeof e.setUrl==`function`&&typeof e.setTotalItems==`function`)??null,Ee=()=>w().querySelector(`[data-ui-select-chips]`),De=()=>w().querySelector(`[data-ui-select-hidden-inputs]`),N=()=>Y.getCommittedSnapshot().props,P=()=>Y.getCommittedSnapshot().context,F=()=>Y.hasTag(`expanded`),I=()=>Y.hasTag(`visible`),Oe=(e,t)=>{let n=e.dataset.label||e.getAttribute(`aria-label`)||``;if(n)return n;if(e.dataset.textValue)return e.dataset.textValue;let r=Te(we(e.dataset.item),t.path);return r==null?(e.querySelector(`[data-ui-select-option-label]`)?.textContent??e.textContent??``).trim():String(r)},ke=(e=N())=>new Qe({root:w(),listboxId:u,props:e,resolveLabel:Oe,rememberLabel:(e,t)=>_e.set(e,t)}),L=(e,t)=>{if(C)return e(C);C=ke(t);try{return e(C)}finally{C=null}},R=(e=P().selection)=>e.map(({value:e})=>e),Ae=(e=P().selection)=>e.map(({label:e})=>e),z=(e,t=P().search.query,n=P().selection)=>e.project(t,n),B=e=>{let t=N();if(!D())return!1;if(t.mode===`combobox`)return!0;let n=e.ordinaryCount;return(t.virtualized?Math.max(n,t.optionsTotalItems,S):n)>=t.searchMinItems},V=(e,t,n=N())=>{let r=Array.from(new Set(e.filter(Boolean))),i=n.multiple?r:r.slice(0,1),a=t.project(``,[]);return i.map(e=>({value:e,label:a.firstByValue.get(e)?.selectedLabel??_e.get(e)??(typeof n.selectedLabelMap[e]==`string`?n.selectedLabelMap[e]:void 0)??e}))},je=e=>e.multiple?Array.from(new Set([...e.values,...e.value?[e.value]:[]])):e.value?[e.value]:e.values.slice(0,1),Me=t=>L(n=>{let r=je(t),i=n.project(``,[]).options.filter(t=>e({value:t.el.dataset.selected})).map(e=>e.value);return{selection:V(r.length>0?r:i,n,t),search:{query:``,optionsId:``},navigation:{activeValue:``},creation:{value:``}}},t),Ne=()=>{let{selection:e}=P(),t=N();return e.length===0||t.mode===`pillbox`&&t.multiple?``:t.multiple&&e.length>1?`${e.length} ${t.suffix}`:e[0]?.label??e[0]?.value??``},H=e=>{let t=e.el.querySelector(q);return t?tt(t.content.childNodes):null},Ie=e=>{let t=H(e);if(t)return t;let n=e.el.querySelector(`[data-ui-select-option-selected-content]`)??e.el.querySelector(`[data-ui-select-option-label]`);if(n)return tt(n.childNodes);let r=document.createDocumentFragment();return r.append(document.createTextNode(e.selectedLabel)),r},Le=()=>{let e=N();if(s){let t=R();(F()||!e.open||!e.disabled&&!e.readonly)&&d({el:w(),schema:Pe,key:`open`,value:F()}),d({el:w(),schema:Pe,key:`value`,value:e.multiple?``:t[0]??``}),d({el:w(),schema:Pe,key:`values`,value:e.multiple?[...t]:[]})}w().dataset.state=F()?`open`:`closed`,w().dataset.mark=e.mark,se({el:w(),state:{disabled:e.disabled,required:e.required,invalid:e.invalid},value:`true`})},U=()=>N().mode===`pillbox`&&N().multiple,Re=()=>{let e=N(),t=U()&&P().selection.length===0,r=ve();r.className=h({part:G.parts.control,props:{...e,mode:U()?`pillbox`:e.mode===`combobox`?`combobox`:`listbox`,empty:t}}),r.dataset.state=F()?`open`:`closed`,r.dataset.mode=U()?`pillbox`:e.mode,n({el:r,attr:`data-ui-select-pillbox-control`,present:U(),value:``}),n({el:r,attr:`data-empty`,present:t,value:`true`}),se({el:r,state:{disabled:e.disabled,invalid:e.invalid},value:`true`})},ze=e=>{let t=N(),r=T();r.id||=c,r.dataset.state=F()?`open`:`closed`,r.setAttribute(`aria-haspopup`,`listbox`),r.setAttribute(`aria-expanded`,F()?`true`:`false`),r.setAttribute(`aria-controls`,u),n({el:r,attr:`aria-invalid`,present:t.invalid,value:`true`}),r instanceof HTMLButtonElement&&(r.disabled=t.disabled);let i=Ne(),a=w().querySelector(`[data-ui-select-button-value]`),o=w().querySelector(`[data-ui-select-button-placeholder]`);if(a){a.replaceChildren();let t=P().selection.length===1&&i?e.project(``,P().selection).firstByValue.get(P().selection[0]?.value??``):void 0;t?a.append(Ie(t)):a.textContent=i,a.hidden=i===``}o&&(o.hidden=U()?P().selection.length>0:i!==``),w().querySelectorAll(`[data-ui-select-clear], [data-ui-select-button-clear]`).forEach(e=>{e.hidden=t.disabled||!t.clearable||P().selection.length===0,e instanceof HTMLButtonElement&&(e.disabled=t.disabled)}),w().querySelectorAll(`[data-ui-select-search-clear]`).forEach(e=>{e.hidden=t.disabled||!P().search.query,e instanceof HTMLButtonElement&&(e.disabled=t.disabled)})},Ve=e=>{let t=N(),n=P(),r=E();r&&(r.id||=l,r.className=h({part:G.parts.input,className:t.inputClass}),r.value=U()||F()&&y?n.search.query:Ne(),r.placeholder=U()&&n.selection.length>0?``:t.placeholder,r.setAttribute(`role`,`combobox`),r.setAttribute(`autocomplete`,`off`),r.setAttribute(`aria-autocomplete`,`list`),r.setAttribute(`aria-expanded`,F()?`true`:`false`),r.setAttribute(`aria-controls`,u),ce({input:r,state:{disabled:t.disabled,readonly:t.readonly,required:t.required,nativeRequired:!1,invalid:t.invalid,ariaRequired:t.required}}));let i=D();if(i){let r=i.closest(`[data-ui-select-search]`);r&&(r.hidden=!B(e)),i.value=n.search.query,i.disabled=t.disabled,i.readOnly=t.readonly}let a=z(e).firstByValue.get(n.navigation.activeValue);[T(),r,i,A()].forEach(e=>{a?.id?e?.setAttribute(`aria-activedescendant`,a.id):e?.removeAttribute(`aria-activedescendant`)})},He=()=>{let e=N(),t=k(),r=A();t.id=`${u}-popover`,t.className=h({part:G.parts.popover,props:e,className:e.listboxClass}),t.dataset.uiSurface=e.surface,t.dataset.uiElevation=e.elevation,t.setAttribute(`popover`,`manual`),t.dataset.state=F()?`open`:`closed`,t.hidden=!I(),r.id=u,r.setAttribute(`role`,`listbox`),r.tabIndex=-1,r.setAttribute(`aria-labelledby`,T().id),n({el:r,attr:`aria-multiselectable`,present:e.multiple,value:`true`})},Ue=e=>{let t=N(),r=P();w().querySelectorAll(`[data-ui-select-create-query]`).forEach(e=>{e.textContent=r.search.query});let i=z(e).options;i.forEach(e=>{e.el.id=e.id,e.el.hidden=!e.visible,e.el.setAttribute(`role`,`option`),e.el.setAttribute(`aria-selected`,e.selected?`true`:`false`),e.create||(e.el.dataset.value=e.value),e.create||(e.el.dataset.label=e.label),n({el:e.el,attr:`data-selected`,present:e.selected,value:`true`}),n({el:e.el,attr:`data-highlighted`,present:e.value===r.navigation.activeValue,value:`true`}),n({el:e.el,attr:`data-disabled`,present:e.disabled,value:`true`}),n({el:e.el,attr:`aria-disabled`,present:e.disabled,value:`true`}),e.el.querySelectorAll(`[data-ui-select-option-indicator]`).forEach(t=>{n({el:t,attr:`data-selected`,present:e.selected,value:`true`})})});let a=w().querySelector(`[data-ui-select-option-empty]`);a&&(a.hidden=t.virtualized&&t.optionsFetchUrl?x!==0:i.some(e=>e.visible&&!e.create))},We=()=>JSON.stringify(Array.from(w().querySelectorAll(K)).map(e=>({create:e.hasAttribute(`data-ui-select-option-create`),value:e.dataset.value??``,label:e.hasAttribute(`data-ui-select-option-create`)?e.textContent?.trim()??``:e.dataset.label??e.textContent?.trim()??``,disabled:e.dataset.disabled??``,selected:e.dataset.selected??``,selectedContent:e.querySelector(q)?.innerHTML??null}))),Ge=e=>{let t=Ee();if(!t)return;let n=N(),r=P(),a=e.project(``,r.selection),o=r.selection.map(({value:e,label:t})=>({value:e,label:t,disabled:a.firstByValue.get(e)?.disabled??!1,option:a.firstByValue.get(e)})),s=n.size===`xs`||n.size===`sm`?`xs`:`sm`,c=xe(w(),`x-ui-select:chip`);t.hidden=!U()||o.length===0;let l=new Set(t.hidden?[]:o.map(({value:e})=>e));if(v.forEach(({instance:e},n)=>{(!l.has(n)||e.template!==c||e.element.parentElement!==t)&&(e.destroy(),v.delete(n))}),t.hidden)return;if(!c)throw Error(`A pillbox select requires a chip template.`);let u={chip:h({part:be.parts.root,props:{variant:n.chipVariant,color:n.chipColor,size:s,radius:`sm`},className:h({part:G.parts.chip,className:n.chipClass})}),label:h({part:G.parts.chipLabel}),plainLabel:h({part:G.parts.chipPlainLabel}),remove:h({part:be.parts.close,props:{size:s},className:h({part:G.parts.chipRemove})})};o.forEach((e,r)=>{let a=e.option?.el.querySelector(q),o=a?.innerHTML??``,l={$chip:{value:e.value,label:e.label||e.value,disabled:n.disabled||n.readonly||e.disabled,hasSelectedContent:!!a},$styles:u,$chipAppearance:{variant:n.chipVariant,color:n.chipColor,size:s}},d=v.get(e.value);if(d)d.instance.update(l);else{let t=Se(i,c,l);t.element.dataset.uiSelectChip=``,t.element.dataset.value=e.value,d={instance:t,content:``},v.set(e.value,d)}if(d.content!==o){let t=d.instance.element.querySelector(`[data-ui-select-chip-selected-content]`);t&&t.replaceChildren(...e.option?[H(e.option)??``]:[]),d.content=o}let f=d.instance.element,ee=t.children[r]??null;f!==ee&&d.instance.mount(t,ee)})},Ke=()=>{let e=De();if(!e)return;let t=N();ie=oe({container:e,state:{name:t.name,required:t.required,values:t.disabled?[]:R(),form:w().dataset.form??``,marker:`data-ui-select-hidden-input`},currentKey:ie})},W=()=>L(e=>{Le(),Re(),ze(e),Ve(e),He(),Ue(e),Ge(e),Ke()}),qe=()=>{o&&L(e=>{if(!Y.hasTag(`interactive`))return;let t=N(),n=e=>{let t=e!==null&&e.ownerDocument.activeElement===e&&e.matches(`:focus-visible`);p(e,{showIndicator:t})};m?.presentation()===`anchored`?t.mode===`combobox`?n(E()):B(e)?n(D()):n(T()):n((B(e)?D():null)??w().querySelector(`[data-ui-select-sheet-close]`)??A())})},Je=()=>L(e=>{if(P().navigation.activeValue)return;let t=z(e).enabled,n=R().map(e=>t.find(t=>t.value===e)).find(e=>e!==void 0);n&&Q(n.value)}),Ye=()=>L(e=>{let t=P(),n=V(R(t.selection),e);nt(Ae(n),Ae(t.selection))||Y.send({type:`RECONCILE_SELECTION`,selection:n});let r=z(e).enabled;t.navigation.activeValue&&!r.some(e=>e.value===t.navigation.activeValue)&&Y.send({type:`ACTIVE`,value:N().autoHighlight?r[0]?.value??``:``}),W()}),Xe=e=>L(t=>{let n=(Array.isArray(e.changes)?e.changes:[]).flatMap(e=>e&&typeof e==`object`&&`key`in e?[String(e.key)]:[]);if(n.some(e=>e===`value`||e===`values`||e===`multiple`||e===`selectedLabelMap`)){let e=V(je(N()),t);Y.send({type:`RECONCILE_SELECTION`,selection:e})}n.includes(`optionsTotalItems`)&&(x=N().optionsTotalItems,S=x,M()?.setTotalItems(x)),n.includes(`optionsFetchUrl`)&&(J(),queueMicrotask(J)),W()}),$e=e=>{let t=N(),n=new URL(t.optionsFetchUrl,document.baseURI);return e?n.searchParams.set(t.optionSearchParam,e):n.searchParams.delete(t.optionSearchParam),/^[a-z][a-z\d+.-]*:/i.test(t.optionsFetchUrl)||t.optionsFetchUrl.startsWith(`//`)?n.href:`${n.pathname}${n.search}${n.hash}`},J=()=>{if(!o)return;let e=N();if(!e.virtualized)return;let t=e.optionsFetchUrl?$e(P().search.query):``,n=j();if(!n)return;if(n.dataset.fetchUrl===t){ge=t;return}if(ge===t)return;let r=M();r&&(ge=t,r.setUrl(t,{reset:!0}))},et=()=>{window.clearTimeout(he);let e=N();e.virtualized&&e.optionsFetchUrl&&(e.searchable||e.mode===`combobox`)&&(he=window.setTimeout(()=>{J();let t=M();t&&x===0&&e.optionsTotalItems>0&&(x=e.optionsTotalItems,t.setTotalItems(x))},e.optionSearchDebounce))},Y=ee({schema:Pe,hooks:Fe,createMachine:({props:e})=>Be({props:e,context:Me(e),effects:{prepareOpen:()=>L(()=>{b=!1,m?.open(),Je(),W(),queueMicrotask(qe)}),finishOpen:()=>{W(),t({el:w(),name:`ui:open`})},prepareClose:({event:e})=>{y=!1,b=e.restoreFocus===!0||e.type===`SELECT`||e.type===`CREATE`,b&&p(T(),{showIndicator:!1}),W()},finishClose:()=>{m?.close(),W(),b&&p(T(),{showIndicator:!1}),b=!1,t({el:w(),name:`ui:close`})},commitSelection:({event:e})=>{W(),a(w(),`data-value`,`data-values`),le({container:De(),fallback:w(),marker:`data-ui-select-hidden-input`});let{selection:n}=P();e.type===`CLEAR`&&t({el:w(),name:`ui:clear`}),t({el:w(),name:`ui:change`,detail:{value:n[0]?.value??``,values:R(n),label:n[0]?.label??``,labels:Ae(n),option:fe}}),fe=null},commitSearch:()=>{W(),t({el:w(),name:`ui:search`,detail:{search:P().search.query}}),et()},prepareCreate:({event:e})=>{W(),t({el:w(),name:`ui:create`,detail:{search:P().search.query,value:P().creation.value,modal:typeof e.modal==`string`?e.modal:``}})},syncProps:({event:e})=>Xe(e),syncOptions:Ye,syncActive:W,syncDom:W}})}),X=(e,t)=>Y.send({type:e,selection:t}),Z=(e,t,n)=>{n?.preventDefault();let r=N();if(r.disabled||r.readonly||e.disabled)return;if(e.create){Y.send({type:`CREATE`,value:e.value||P().search.query,modal:e.el.dataset.modal??``});return}fe=e.el,y=!1;let i=R(),a=r.multiple?i.includes(e.value)?i.filter(t=>t!==e.value):[...i,e.value]:[e.value];X(`SELECT`,V(a,t))},Q=e=>L(n=>{if(e===P().navigation.activeValue)return;Y.send({type:`ACTIVE`,value:e});let r=z(n).firstByValue.get(e);t({el:w(),name:`ui:highlight`,detail:{value:e,option:r?.el??null}})}),rt=e=>L(t=>{let n=z(t).enabled;if(n.length===0)return;let r=n.findIndex(e=>e.value===P().navigation.activeValue),i=r<0?e>0?0:n.length-1:r+e;i>=n.length&&(i=N().loop?0:n.length-1),i<0&&(i=N().loop?n.length-1:0),Q(n[i]?.value??``)}),it=e=>L(t=>{let n=N();if(n.disabled||n.readonly)return;y=!0;let r=n.autoHighlight?z(t,e).enabled[0]?.value??``:``;Y.send({type:`SEARCH`,query:e,optionsId:f,activeValue:r})}),at=e=>L(t=>{if(e.key===`Tab`&&m?.presentation()!==`anchored`){ue(e,k());return}let n=e.target instanceof HTMLInputElement;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),F()||Y.send({type:`OPEN`}),rt(e.key===`ArrowDown`?1:-1);return}if(!n&&F()&&(e.key===`Home`||e.key===`End`)){e.preventDefault();let n=z(t).enabled;Q(e.key===`Home`?n[0]?.value??``:n.at(-1)?.value??``);return}if(F()&&(e.key===`Enter`||!n&&e.key===` `)){let n=z(t).firstByValue.get(P().navigation.activeValue);n&&Z(n,t,e);return}if((e.key===`Backspace`||e.key===`Delete`)&&U()&&!P().search.query){let n=E();if(n&&(n.selectionStart!==0||n.selectionEnd!==0))return;let r=t.project(``,P().selection),i=[...R()].reverse().find(e=>!r.firstByValue.get(e)?.disabled);i&&(e.preventDefault(),$.deselect(i,e));return}if(e.key===`Escape`&&I()){e.preventDefault(),e.stopPropagation(),Y.send({type:`CLOSE`,restoreFocus:!0});return}if(!n&&!B(t)&&e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){pe+=e.key.toLowerCase(),window.clearTimeout(me),me=window.setTimeout(()=>{pe=``},500);let n=z(t).enabled.find(e=>Ce(e.label).startsWith(pe));n&&Q(n.value)}}),ot=()=>{let e=w(),t=(e,t)=>t.closest(`[data-ui-select-trigger], [data-ui-select-icon="trailing"], [data-ui-select-control]`)?(e.preventDefault(),e instanceof PointerEvent||e instanceof MouseEvent&&e.detail>0?p(T(),{showIndicator:!1}):p(T()),T()instanceof HTMLInputElement?F()||Y.send({type:`OPEN`}):$.toggle(e),!0):!1;r({target:e,event:`click`,cleanup:_,handler:e=>{let n=e.target;if(!(n instanceof Element))return;if(n.closest(`[data-ui-select-sheet-close]`)){$.close(e);return}if(n.closest(`[data-ui-select-search-clear]`)){e.preventDefault(),it(``);return}if(n.closest(`[data-ui-select-clear], [data-ui-select-button-clear]`)){$.clear(e);return}let r=n.closest(`[data-ui-select-chip-remove]`);if(r){$.deselect(r.dataset.value??``,e);return}let i=n.closest(K);if(i){L(t=>{let n=z(t).byElement.get(i);n&&Z(n,t,e)});return}(!(e instanceof MouseEvent)||e.detail===0)&&t(e,n)}}),r({target:e,event:`input`,cleanup:_,handler:e=>{let t=e.target;t instanceof HTMLInputElement&&t.matches(`[data-ui-select-input], [data-ui-select-search-input]`)&&it(t.value)}}),r({target:e,event:`keydown`,cleanup:_,handler:e=>{e instanceof KeyboardEvent&&at(e)}}),r({target:e,event:`pointerdown`,cleanup:_,handler:e=>{let n=e.target;if(n instanceof Element){if(n.closest(K)||n.closest(`[data-ui-select-search-clear]`)||n.closest(`[data-ui-select-clear], [data-ui-select-button-clear], [data-ui-select-chip-remove]`)){e.preventDefault();return}t(e,n)}}}),r({target:e,event:`pointerover`,cleanup:_,handler:e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(K);n&&L(e=>{let t=z(e).byElement.get(n);t&&t.visible&&!t.disabled&&Q(t.value)})}}),r({target:e,event:`focusout`,cleanup:_,handler:t=>{if(!(t instanceof FocusEvent))return;let n=t.relatedTarget;n instanceof Node&&e.contains(n)||I()&&Y.send({type:`CLOSE`})}}),r({target:e,event:`ui:virtualizer-total-change`,cleanup:_,handler:e=>{if(!(e instanceof CustomEvent)||!j()?.contains(e.target))return;let t=Number(e.detail?.totalItems);Number.isFinite(t)&&t>=0&&(x=Math.floor(t),S=Math.max(S,x)),Y.send({type:`OPTIONS_CHANGED`})}}),r({target:e,event:`ui:virtualizer-load`,cleanup:_,handler:e=>{j()?.contains(e.target)&&Y.send({type:`OPTIONS_CHANGED`})}}),r({target:k(),event:`toggle`,cleanup:_,handler:e=>{`newState`in e&&e.newState===`closed`&&I()&&Y.send({type:`CLOSE`})}}),_.add(ae({isEnabled:()=>Y.hasTag(`interactive`),roots:()=>[w(),k()],onDismiss:()=>Y.send({type:`CLOSE`})}));let n=()=>{g?.();let e=Array.from(w().querySelectorAll(q)).map(e=>{let t=new MutationObserver(()=>{Y.send({type:`OPTIONS_CHANGED`})});return t.observe(e.content,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),t});g=()=>e.forEach(e=>e.disconnect())};ne=de({targets:A(),read:We,onChange:()=>{n(),Y.send({type:`OPTIONS_CHANGED`})},observer:{attributes:!0,attributeFilter:[`data-disabled`,`data-item`,`data-label`,`data-selected`,`data-selected-label`,`data-text-value`,`data-ui-select-option-selected-template`,`data-value`],characterData:!0,childList:!0,subtree:!0}}),n()},$;return $={...Y,get isOpen(){return this.snapshot.current?.tags.includes(`expanded`)??!1},get isSearching(){return this.snapshot.current?.tags.includes(`searching`)??!1},get value(){return this.snapshot.current?.context.selection[0]?.value??``},get values(){return this.snapshot.current?.context.selection.map(({value:e})=>e)??[]},get selectedLabels(){return this.snapshot.current?.context.selection.map(({label:e})=>e)??[]},get search(){return this.snapshot.current?.context.search.query??``},get activeValue(){return this.snapshot.current?.context.navigation.activeValue??``},init(){_=te(this),o=this.$el,c=this.$id(`select-button`),l=this.$id(`select-input`),u=this.$id(`select-listbox`),f=ye().id||w().dataset.optionsId||this.$id(`select-options`),ye().id=f,Y.connect(this.$el,this.snapshot),x=N().optionsTotalItems,S=x,O().id||=`${u}-title`,m=Ze({reference:ve,floating:k,labelId:()=>O().id,position:()=>N().side,align:()=>N().align,gap:()=>N().gap,offset:()=>N().offset,matchReferenceWidth:!0}),ot(),W(),queueMicrotask(J),s=!0,N().open&&!N().disabled&&!N().readonly&&queueMicrotask(()=>Y.send({type:`OPEN`}))},destroy(){v.forEach(({instance:e})=>e.destroy()),v.clear(),window.clearTimeout(me),window.clearTimeout(he),ne?.(),ne=null,g?.(),g=null,m?.destroy(),m=null,Y.disconnect(),o=null},get root(){let e=this.snapshot.current?.props??N();return re({inputs:[h({part:G.parts.root,props:e,className:e.class}),{"data-ui-select":``,":data-state":()=>Y.hasTag(`expanded`)?`open`:`closed`}]})},open(e){e?.preventDefault(),!(N().disabled||N().readonly)&&Y.send({type:`OPEN`})},close(e){e?.preventDefault(),Y.send({type:`CLOSE`,restoreFocus:e instanceof KeyboardEvent})},toggle(e){e?.preventDefault(),!(N().disabled||N().readonly)&&Y.send({type:`TOGGLE`})},select(e,t){L(n=>{let r=n.project(``,P().selection).firstByValue.get(e);r&&!r.create&&Z(r,n,t)})},deselect(e,t){L(n=>{t?.preventDefault(),!(N().disabled||N().readonly)&&(n.project(``,P().selection).firstByValue.get(e)?.disabled||X(`DESELECT`,V(R().filter(t=>t!==e),n)))})},selectAll(e){L(t=>{if(e?.preventDefault(),!N().multiple||N().disabled||N().readonly)return;let n=z(t).enabled;X(`SELECT_ALL`,n.map(e=>({value:e.value,label:e.selectedLabel})))})},clear(e){if(e?.preventDefault(),e?.stopPropagation(),N().disabled||N().readonly)return;y=!1;let t=P().search.query!==``;Y.send({type:`CLEAR`}),t&&et()},setSearch:it},$},Q=e=>{e.directive(`ui-select`,()=>{}),m(`UiSelect`,()=>Z(e))(e)},rt=new WeakSet,it=e=>{rt.has(e)||(rt.add(e),i(e),Q(e))};export{Z as n,it as t};
|
|
2
|
+
//# sourceMappingURL=entry.generated-B986Ob4f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.generated-B986Ob4f.js","names":[],"sources":["../../../../../../../../client/src/runtime/option-data.ts","../../../../../../../../client/src/components/badge/contract.ts","../../../../../../../../client/src/components/select/contract.ts","../../../../../../../../client/src/components/select/machine.ts","../../../../../../../../client/src/components/select/presentation.ts","../../../../../../../../client/src/components/select/styles.ts","../../../../../../../../client/src/components/select/index.ts","../../../../../../../../client/src/components/select/entry.generated.ts"],"sourcesContent":["const normalizeOptionText = (value: string): string => value.trim().toLowerCase();\n\nconst splitControlValues = (value: string): string[] => value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n\nconst parseItemData = (raw: string | undefined): unknown => {\n if (!raw) return undefined;\n\n try {\n return JSON.parse(raw);\n } catch {\n return undefined;\n }\n};\n\nconst getPathValue = (item: unknown, path: string): unknown => {\n if (!path || item === null || item === undefined) return undefined;\n\n return path.split('.').reduce<unknown>((value, key) => {\n if (value === null || value === undefined || typeof value !== 'object') return undefined;\n return (value as Record<string, unknown>)[key];\n }, item);\n};\n\nexport {getPathValue, normalizeOptionText, parseItemData, splitControlValues};\n","import {bool, oneOf, string, type SchemaToProps} from '../../runtime';\nimport {\n BUTTON_TYPES,\n COMPONENT_RADII,\n CONTROL_SIZES,\n ICON_VARIANTS,\n type CommonButtonType,\n type ComponentRadius,\n type ControlSize,\n type IconVariant,\n} from '../common';\n\nconst BADGE_VARIANTS = ['soft', 'surface', 'outline', 'solid'] as const;\nconst BADGE_COLORS = ['neutral', 'accent', 'success', 'warning', 'danger'] as const;\nconst BADGE_SIZES = CONTROL_SIZES;\nconst BADGE_AS_VALUES = ['span', 'button'] as const;\nconst BADGE_TYPES = BUTTON_TYPES;\nconst BADGE_ICON_VARIANTS = ICON_VARIANTS;\nconst BADGE_RADII = COMPONENT_RADII;\n\nconst badgeSchema = {\n variant: oneOf(BADGE_VARIANTS, 'soft'),\n color: oneOf(BADGE_COLORS, 'neutral'),\n size: oneOf(BADGE_SIZES, 'sm'),\n radius: oneOf(BADGE_RADII, 'sm'),\n href: string,\n as: oneOf(BADGE_AS_VALUES, 'span'),\n type: oneOf(BADGE_TYPES, 'button'),\n disabled: bool,\n icon: string,\n iconTrailing: string,\n iconVariant: oneOf(BADGE_ICON_VARIANTS, 'mini'),\n inset: string,\n class: string,\n};\n\nconst badgeCloseSchema = {\n type: oneOf(BADGE_TYPES, 'button'),\n disabled: bool,\n icon: string.default('close'),\n iconVariant: oneOf(BADGE_ICON_VARIANTS, 'mini'),\n size: oneOf(BADGE_SIZES, 'sm'),\n label: string.default('Remove'),\n class: string,\n};\n\ntype BadgeVariant = typeof BADGE_VARIANTS[number];\ntype BadgeColor = typeof BADGE_COLORS[number];\ntype BadgeSize = ControlSize;\ntype BadgeRadius = ComponentRadius;\ntype BadgeAs = typeof BADGE_AS_VALUES[number];\ntype BadgeType = CommonButtonType;\ntype BadgeIconVariant = IconVariant;\ntype BadgeProps = SchemaToProps<typeof badgeSchema>;\ntype BadgeCloseProps = SchemaToProps<typeof badgeCloseSchema>;\n\nexport {\n BADGE_AS_VALUES,\n BADGE_COLORS,\n BADGE_ICON_VARIANTS,\n BADGE_RADII,\n BADGE_SIZES,\n BADGE_TYPES,\n BADGE_VARIANTS,\n badgeCloseSchema,\n badgeSchema,\n};\nexport type {\n BadgeAs,\n BadgeCloseProps,\n BadgeColor,\n BadgeIconVariant,\n BadgeProps,\n BadgeRadius,\n BadgeSize,\n BadgeType,\n BadgeVariant,\n};\n","import {bool, json, number, oneOf, string, type SchemaToProps} from '../../runtime';\nimport {\n ALIGNMENTS,\n COMPONENT_RADII,\n CONTROL_SIZES,\n CONTROL_VARIANTS,\n ELEVATION_REFERENCES,\n ICON_VARIANTS,\n POSITIONS,\n SURFACE_REFERENCES,\n type Alignment,\n type ComponentRadius,\n type ControlSize,\n type ControlVariant,\n type ElevationReference,\n type IconVariant,\n type Position,\n type SurfaceReference,\n} from '../common';\nimport {\n BADGE_COLORS,\n BADGE_VARIANTS,\n type BadgeColor,\n type BadgeVariant,\n} from '../badge/contract';\n\nconst SELECT_MODES = ['listbox', 'combobox', 'pillbox', 'native'] as const;\nconst SELECT_VARIANTS = CONTROL_VARIANTS;\nconst SELECT_SIZES = CONTROL_SIZES;\nconst SELECT_RADII = COMPONENT_RADII;\nconst SELECT_SIDES = POSITIONS;\nconst SELECT_ALIGNS = ALIGNMENTS;\nconst SELECT_ICON_VARIANTS = ICON_VARIANTS;\nconst SELECT_CLEARS = ['stay', 'close'] as const;\nconst SELECT_MARKS = ['check', 'checkbox', 'none'] as const;\nconst SELECT_SURFACES = SURFACE_REFERENCES;\nconst SELECT_ELEVATIONS = ELEVATION_REFERENCES;\n\ntype SelectMode = typeof SELECT_MODES[number];\ntype SelectVariant = ControlVariant;\ntype SelectSize = ControlSize;\ntype SelectRadius = ComponentRadius;\ntype SelectSide = Position;\ntype SelectAlign = Alignment;\ntype SelectIconVariant = IconVariant;\ntype SelectClear = typeof SELECT_CLEARS[number];\ntype SelectMark = typeof SELECT_MARKS[number];\ntype SelectSurface = SurfaceReference;\ntype SelectElevation = ElevationReference;\ntype SelectChipVariant = BadgeVariant;\ntype SelectChipColor = BadgeColor;\n\nconst selectSchema = {\n name: string,\n optionsId: string,\n value: string,\n values: json.array<string>([]),\n placeholder: string,\n mode: oneOf(SELECT_MODES, 'listbox' as SelectMode),\n multiple: bool,\n searchable: bool,\n searchMinItems: number.min(0).default(5),\n virtualized: bool,\n optionsFetchUrl: string,\n optionsTotalItems: number.min(0).default(0),\n optionItemSize: number.min(Number.EPSILON).default(36),\n optionBufferSize: number.min(1).default(50),\n optionOverscan: number.min(0).default(0),\n optionSearchParam: string.default('q'),\n optionSearchDebounce: number.min(0).default(150),\n selectedLabelMap: json.object<Record<string, string>>({}),\n creatable: bool,\n filter: bool.default(true),\n clearable: bool,\n clear: oneOf(SELECT_CLEARS, 'stay' as SelectClear),\n suffix: string.default('selected'),\n mark: oneOf(SELECT_MARKS, 'check' as SelectMark),\n open: bool,\n disabled: bool,\n readonly: bool,\n required: bool,\n invalid: bool,\n autoHighlight: bool.default(true),\n loop: bool.default(true),\n path: string,\n size: oneOf(SELECT_SIZES, 'lg' as SelectSize),\n variant: oneOf(SELECT_VARIANTS, 'outline' as SelectVariant),\n radius: oneOf(SELECT_RADII, 'md' as SelectRadius),\n surface: oneOf(SELECT_SURFACES, '+2' as SelectSurface),\n elevation: oneOf(SELECT_ELEVATIONS, '3' as SelectElevation),\n side: oneOf(SELECT_SIDES, 'bottom' as SelectSide),\n align: oneOf(SELECT_ALIGNS, 'start' as SelectAlign),\n offset: number.clamp(-100, 100).default(0),\n gap: number.clamp(0, 50).default(4),\n empty: string.default('No results found.'),\n icon: string,\n iconTrailing: string.default('chevron__down'),\n iconVariant: oneOf(SELECT_ICON_VARIANTS, 'outline' as SelectIconVariant),\n buttonClass: string,\n inputClass: string,\n listboxClass: string,\n optionClass: string,\n chipVariant: oneOf(BADGE_VARIANTS, 'soft' as SelectChipVariant),\n chipColor: oneOf(BADGE_COLORS, 'neutral' as SelectChipColor),\n chipClass: string,\n class: string,\n};\n\nconst selectOptionSchema = {\n value: string,\n label: string,\n selectedLabel: string,\n textValue: string,\n disabled: bool,\n selected: bool,\n item: string,\n icon: string,\n iconTrailing: string,\n iconVariant: oneOf(SELECT_ICON_VARIANTS, 'outline' as SelectIconVariant),\n suffix: string,\n class: string,\n};\n\nconst selectCreateOptionSchema = {\n minLength: number.clamp(0, 100).default(0),\n modal: string,\n disabled: bool,\n value: string,\n class: string,\n};\n\ntype SelectProps = SchemaToProps<typeof selectSchema>;\ntype SelectOptionProps = SchemaToProps<typeof selectOptionSchema>;\ntype SelectCreateOptionProps = SchemaToProps<typeof selectCreateOptionSchema>;\n\nexport {\n SELECT_ALIGNS,\n SELECT_CLEARS,\n SELECT_ELEVATIONS,\n BADGE_COLORS as SELECT_CHIP_COLORS,\n BADGE_VARIANTS as SELECT_CHIP_VARIANTS,\n SELECT_ICON_VARIANTS,\n SELECT_MARKS,\n SELECT_MODES,\n SELECT_RADII,\n SELECT_SIDES,\n SELECT_SIZES,\n SELECT_SURFACES,\n SELECT_VARIANTS,\n selectCreateOptionSchema,\n selectOptionSchema,\n selectSchema,\n};\nexport type {\n SelectAlign,\n SelectClear,\n SelectChipColor,\n SelectChipVariant,\n SelectCreateOptionProps,\n SelectElevation,\n SelectIconVariant,\n SelectMark,\n SelectOptionProps,\n SelectSide,\n SelectProps,\n SelectRadius,\n SelectSize,\n SelectSurface,\n SelectMode,\n SelectVariant,\n};\n","import {\n createMachine,\n propsChanged,\n propsChangedEvent,\n type Machine,\n type MachineEventObject,\n type MachineScope,\n} from '../../runtime/state-machine';\nimport {defineHook, type TransitionHookDefinition} from '../../runtime/transition-coordinator';\nimport type {SelectProps} from './contract';\n\ntype SelectedOption = {\n value: string;\n label: string;\n};\n\ntype SelectContext = {\n selection: SelectedOption[];\n search: {query: string; optionsId: string};\n navigation: {activeValue: string};\n creation: {value: string};\n};\n\ntype SelectMachineEffects = {\n prepareOpen(scope: MachineScope<SelectContext, SelectProps>): void;\n finishOpen(scope: MachineScope<SelectContext, SelectProps>): void;\n prepareClose(scope: MachineScope<SelectContext, SelectProps>): void;\n finishClose(scope: MachineScope<SelectContext, SelectProps>): void;\n commitSelection(scope: MachineScope<SelectContext, SelectProps>): void;\n commitSearch(scope: MachineScope<SelectContext, SelectProps>): void;\n prepareCreate(scope: MachineScope<SelectContext, SelectProps>): void;\n syncProps(scope: MachineScope<SelectContext, SelectProps>): void;\n syncOptions(scope: MachineScope<SelectContext, SelectProps>): void;\n syncActive(scope: MachineScope<SelectContext, SelectProps>): void;\n syncDom(scope: MachineScope<SelectContext, SelectProps>): void;\n};\n\ntype CreateSelectMachineOptions = {\n props: SelectProps;\n context: SelectContext;\n effects: SelectMachineEffects;\n};\n\nconst openingHook = defineHook({\n name: 'opening',\n state: 'disclosure.opening',\n project: () => ({}),\n onDone: 'OPENING_DONE',\n onError: 'OPENING_ERROR',\n sends: {\n close: () => ({type: 'CLOSE'}),\n },\n} satisfies TransitionHookDefinition<SelectContext, SelectProps, Record<string, never>, 'opening'>);\n\nconst closingHook = defineHook({\n name: 'closing',\n state: 'disclosure.closing',\n project: () => ({}),\n onDone: 'CLOSING_DONE',\n onError: 'CLOSING_ERROR',\n sends: {\n open: () => ({type: 'OPEN'}),\n },\n} satisfies TransitionHookDefinition<SelectContext, SelectProps, Record<string, never>, 'closing'>);\n\nconst searchingHook = defineHook({\n name: 'searching',\n state: 'feature.searching',\n project: (snapshot) => ({\n query: snapshot.context.search.query,\n optionsId: snapshot.context.search.optionsId,\n }),\n onDone: 'SEARCHING_DONE',\n onError: 'SEARCHING_ERROR',\n sends: {\n search: (query: string) => ({type: 'SEARCH', query}),\n close: () => ({type: 'CLOSE'}),\n },\n} satisfies TransitionHookDefinition<\n SelectContext,\n SelectProps,\n {query: string; optionsId: string},\n 'searching'\n>);\n\nconst creatingHook = defineHook({\n name: 'creating',\n state: 'feature.creating',\n project: (snapshot) => ({\n query: snapshot.context.search.query,\n value: snapshot.context.creation.value,\n }),\n onDone: 'CREATING_DONE',\n onError: 'CREATING_ERROR',\n sends: {\n close: () => ({type: 'CLOSE'}),\n },\n} satisfies TransitionHookDefinition<\n SelectContext,\n SelectProps,\n {query: string; value: string},\n 'creating'\n>);\n\nconst selectHooks = [openingHook, closingHook, searchingHook, creatingHook] as const;\n\nconst nextProps = (event: MachineEventObject): SelectProps | null => propsChangedEvent<SelectProps>(event)?.props ?? null;\nconst blocked = (props: SelectProps): boolean => props.disabled || props.readonly;\n\nconst shouldOpenFromProps = ({event}: MachineScope<SelectContext, SelectProps>): boolean => {\n const props = nextProps(event);\n if (!props || blocked(props) || !props.open) return false;\n return propsChanged<SelectProps>(event, 'open', 'disabled', 'readonly');\n};\n\nconst shouldCloseFromProps = ({event}: MachineScope<SelectContext, SelectProps>): boolean => {\n const props = nextProps(event);\n if (!props) return false;\n return (propsChanged<SelectProps>(event, 'open') && !props.open)\n || (propsChanged<SelectProps>(event, 'disabled') && props.disabled)\n || (propsChanged<SelectProps>(event, 'readonly') && props.readonly);\n};\n\nconst shouldStopFeatureFromProps = ({event}: MachineScope<SelectContext, SelectProps>): boolean => {\n const props = nextProps(event);\n return Boolean(props && (\n (propsChanged<SelectProps>(event, 'disabled') && props.disabled)\n || (propsChanged<SelectProps>(event, 'readonly') && props.readonly)\n || (propsChanged<SelectProps>(event, 'searchable') && !props.searchable)\n ));\n};\n\nconst nextSelection = (event: MachineEventObject): SelectContext['selection'] | null => {\n if (!Array.isArray(event.selection)) return null;\n if (!event.selection.every((option): option is SelectedOption => (\n typeof option === 'object'\n && option !== null\n && typeof option.value === 'string'\n && typeof option.label === 'string'\n ))) return null;\n return event.selection.map(({value, label}) => ({value, label}));\n};\n\nconst createSelectMachine = ({\n props,\n context,\n effects,\n}: CreateSelectMachineOptions): Machine<SelectContext, SelectProps> => createMachine<SelectContext, SelectProps>({\n type: 'parallel',\n on: {\n DOM_INVALIDATED: {effects: 'syncDom'},\n },\n states: {\n disclosure: {\n initial: 'closed',\n states: {\n closed: {\n tags: ['closed'],\n on: {\n OPEN: {target: 'opening', guard: 'canOpen', effects: 'prepareOpen'},\n TOGGLE: {target: 'opening', guard: 'canOpen', effects: 'prepareOpen'},\n SEARCH: {target: 'opening', guard: 'canOpen', effects: 'prepareOpen'},\n PROPS_CHANGED: {target: 'opening', guard: shouldOpenFromProps, effects: 'prepareOpen'},\n },\n },\n opening: {\n tags: ['visible', 'expanded', 'interactive', 'transitioning'],\n on: {\n OPENING_DONE: {target: 'open', effects: 'finishOpen'},\n OPENING_ERROR: {target: 'open', effects: 'finishOpen'},\n CLOSE: {target: 'closing', effects: 'prepareClose'},\n TOGGLE: {target: 'closing', effects: 'prepareClose'},\n CREATE: {target: 'closing', effects: 'prepareClose'},\n SELECT: {target: 'closing', guard: 'single', effects: 'prepareClose'},\n CLEAR: {target: 'closing', guard: 'clearCloses', effects: 'prepareClose'},\n PROPS_CHANGED: {target: 'closing', guard: shouldCloseFromProps, effects: 'prepareClose'},\n },\n },\n open: {\n tags: ['visible', 'expanded', 'interactive', 'open'],\n on: {\n CLOSE: {target: 'closing', effects: 'prepareClose'},\n TOGGLE: {target: 'closing', effects: 'prepareClose'},\n CREATE: {target: 'closing', effects: 'prepareClose'},\n SELECT: {target: 'closing', guard: 'single', effects: 'prepareClose'},\n CLEAR: {target: 'closing', guard: 'clearCloses', effects: 'prepareClose'},\n PROPS_CHANGED: {target: 'closing', guard: shouldCloseFromProps, effects: 'prepareClose'},\n },\n },\n closing: {\n tags: ['visible', 'transitioning'],\n on: {\n CLOSING_DONE: {target: 'closed', effects: 'finishClose'},\n CLOSING_ERROR: {target: 'closed', effects: 'finishClose'},\n OPEN: {target: 'opening', guard: 'canOpen', effects: 'prepareOpen'},\n TOGGLE: {target: 'opening', guard: 'canOpen', effects: 'prepareOpen'},\n SEARCH: {target: 'opening', guard: 'canOpen', effects: 'prepareOpen'},\n PROPS_CHANGED: {target: 'opening', guard: shouldOpenFromProps, effects: 'prepareOpen'},\n },\n },\n },\n },\n feature: {\n initial: 'idle',\n on: {\n SELECT: {reduce: 'replaceSelection', effects: 'commitSelection'},\n DESELECT: {reduce: 'replaceSelection', effects: 'commitSelection'},\n SELECT_ALL: {reduce: 'replaceSelection', effects: 'commitSelection'},\n RECONCILE_SELECTION: {reduce: 'replaceSelection', effects: 'syncActive'},\n CLEAR: {reduce: 'clear', effects: 'commitSelection'},\n ACTIVE: {reduce: 'setActive', effects: 'syncActive'},\n OPTIONS_CHANGED: {effects: 'syncOptions'},\n CLOSING_DONE: {reduce: 'resetTransient', effects: 'syncActive'},\n CLOSING_ERROR: {reduce: 'resetTransient', effects: 'syncActive'},\n },\n states: {\n idle: {\n on: {\n CLOSE: {},\n SEARCH: {target: 'searching', reduce: 'setSearch', effects: 'commitSearch'},\n CREATE: {target: 'creating', reduce: 'setCreation', effects: 'prepareCreate'},\n PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'},\n },\n },\n searching: {\n tags: ['searching'],\n on: {\n SEARCH: {target: 'searching', reduce: 'setSearch', effects: 'commitSearch'},\n CREATE: {target: 'creating', reduce: 'setCreation', effects: 'prepareCreate'},\n CLOSE: {target: 'idle'},\n SEARCHING_DONE: 'idle',\n SEARCHING_ERROR: 'idle',\n PROPS_CHANGED: [\n {target: 'idle', guard: shouldStopFeatureFromProps, reduce: 'replaceProps', effects: 'syncProps'},\n {reduce: 'replaceProps', effects: 'syncProps'},\n ],\n },\n },\n creating: {\n tags: ['creating'],\n on: {\n SEARCH: {target: 'searching', reduce: 'setSearch', effects: 'commitSearch'},\n CREATE: {target: 'creating', reduce: 'setCreation', effects: 'prepareCreate'},\n CLOSE: {target: 'idle'},\n CREATING_DONE: {target: 'idle'},\n CREATING_ERROR: {target: 'idle'},\n PROPS_CHANGED: [\n {target: 'idle', guard: shouldStopFeatureFromProps, reduce: 'replaceProps', effects: 'syncProps'},\n {reduce: 'replaceProps', effects: 'syncProps'},\n ],\n },\n },\n },\n },\n },\n}, {\n context,\n props,\n reducers: {\n replaceProps: ({event}) => {\n const next = nextProps(event);\n return next ? {props: next} : undefined;\n },\n replaceSelection: ({context: current, event}) => {\n const selection = nextSelection(event);\n if (!selection) return undefined;\n return {context: {\n ...current,\n selection,\n }};\n },\n clear: ({context: current}) => ({context: {\n ...current,\n selection: [],\n search: {...current.search, query: ''},\n navigation: {activeValue: ''},\n }}),\n setSearch: ({context: current, event}) => ({context: {\n ...current,\n search: {\n query: typeof event.query === 'string' ? event.query : '',\n optionsId: typeof event.optionsId === 'string' ? event.optionsId : current.search.optionsId,\n },\n navigation: {\n activeValue: typeof event.activeValue === 'string'\n ? event.activeValue\n : current.navigation.activeValue,\n },\n }}),\n setActive: ({context: current, event}) => ({context: {\n ...current,\n navigation: {activeValue: typeof event.value === 'string' ? event.value : ''},\n }}),\n setCreation: ({context: current, event}) => ({context: {\n ...current,\n creation: {value: typeof event.value === 'string' ? event.value : current.search.query},\n }}),\n resetTransient: ({context: current}) => ({context: {\n ...current,\n search: {...current.search, query: ''},\n navigation: {activeValue: ''},\n creation: {value: ''},\n }}),\n },\n guards: {\n canOpen: ({props: current}) => !blocked(current),\n single: ({props: current}) => !current.multiple,\n clearCloses: ({props: current}) => current.clear === 'close',\n },\n effects: {\n prepareOpen: effects.prepareOpen,\n finishOpen: effects.finishOpen,\n prepareClose: effects.prepareClose,\n finishClose: effects.finishClose,\n commitSelection: effects.commitSelection,\n commitSearch: effects.commitSearch,\n prepareCreate: effects.prepareCreate,\n syncProps: effects.syncProps,\n syncOptions: effects.syncOptions,\n syncActive: effects.syncActive,\n syncDom: effects.syncDom,\n },\n});\n\nexport {createSelectMachine, selectHooks};\nexport type {\n CreateSelectMachineOptions,\n SelectedOption,\n SelectContext,\n SelectMachineEffects,\n};\n","import {\n createAnchoredPopover,\n type AnchoredPopoverOptions,\n} from '@client/runtime/anchored-popover';\nimport {acquireDocumentScrollLock} from '@client/runtime/scroll-lock';\n\ntype SelectPresentation = 'anchored' | 'dialog' | 'fullscreen';\n\ntype SelectPresentationMetrics = {\n viewportWidth: number;\n viewportHeight: number;\n layoutViewportHeight: number;\n referenceTop: number;\n referenceBottom: number;\n touch: boolean;\n};\n\ntype SelectSurfaceOptions = AnchoredPopoverOptions & {\n labelId: () => string;\n};\n\ntype SelectSurface = {\n opened(): boolean;\n open(): void;\n close(): void;\n sync(): void;\n destroy(): void;\n presentation(): SelectPresentation;\n};\n\ntype PopoverElement = HTMLElement & {\n showPopover(): void;\n hidePopover(): void;\n};\n\nconst PHONE_MAX_WIDTH = 640;\nconst MIN_ANCHORED_RESULTS_HEIGHT = 256;\nconst TABLET_KEYBOARD_HEIGHT = 520;\nconst KEYBOARD_VIEWPORT_RATIO = 0.72;\nconst FULLSCREEN_DIALOG_MARGIN = 12;\nconst DIALOG_MARGIN = 16;\nconst DIALOG_MAX_WIDTH = 720;\nconst DIALOG_MAX_HEIGHT = 720;\n\nconst resolveSelectPresentation = ({\n viewportWidth,\n viewportHeight,\n layoutViewportHeight,\n referenceTop,\n referenceBottom,\n touch,\n}: SelectPresentationMetrics): SelectPresentation => {\n if (viewportWidth <= PHONE_MAX_WIDTH) return 'fullscreen';\n\n const keyboardConstrained = viewportHeight < TABLET_KEYBOARD_HEIGHT\n || viewportHeight < layoutViewportHeight * KEYBOARD_VIEWPORT_RATIO;\n if (touch && keyboardConstrained) return 'fullscreen';\n if (touch) return 'dialog';\n\n const spaceAbove = Math.max(0, referenceTop);\n const spaceBelow = Math.max(0, viewportHeight - referenceBottom);\n return Math.max(spaceAbove, spaceBelow) < MIN_ANCHORED_RESULTS_HEIGHT ? 'dialog' : 'anchored';\n};\n\nconst viewportMetrics = (): {\n width: number;\n height: number;\n offsetTop: number;\n offsetLeft: number;\n} => {\n const viewport = window.visualViewport;\n return viewport\n ? {\n width: viewport.width,\n height: viewport.height,\n offsetTop: viewport.offsetTop,\n offsetLeft: viewport.offsetLeft,\n }\n : {width: window.innerWidth, height: window.innerHeight, offsetTop: 0, offsetLeft: 0};\n};\n\nconst hasTouchPointer = (): boolean => (\n window.matchMedia?.('(any-pointer: coarse)').matches === true\n || navigator.maxTouchPoints > 0\n);\n\nconst createSelectSurface = (options: SelectSurfaceOptions): SelectSurface => {\n const anchored = createAnchoredPopover(options);\n let open = false;\n let currentPresentation: SelectPresentation = 'anchored';\n let releaseScrollLock: (() => void) | null = null;\n let stopViewportListeners: (() => void) | null = null;\n\n const surface = (): PopoverElement => options.floating() as PopoverElement;\n\n const setScrollLock = (locked: boolean): void => {\n if (locked) releaseScrollLock ??= acquireDocumentScrollLock(surface().ownerDocument);\n else {\n releaseScrollLock?.();\n releaseScrollLock = null;\n }\n };\n\n const clearModalGeometry = (element: HTMLElement): void => {\n element.style.removeProperty('border-radius');\n element.style.removeProperty('height');\n element.style.removeProperty('inset');\n element.style.removeProperty('max-height');\n element.style.removeProperty('max-width');\n element.style.removeProperty('position');\n element.style.removeProperty('transform-origin');\n element.style.removeProperty('width');\n };\n\n const applyDialogGeometry = (\n element: HTMLElement,\n presentation: Exclude<SelectPresentation, 'anchored'>,\n ): void => {\n const viewport = viewportMetrics();\n const margin = presentation === 'dialog'\n ? DIALOG_MARGIN\n : FULLSCREEN_DIALOG_MARGIN;\n const maxWidth = presentation === 'dialog' ? DIALOG_MAX_WIDTH : Number.POSITIVE_INFINITY;\n const maxHeight = presentation === 'dialog' ? DIALOG_MAX_HEIGHT : Number.POSITIVE_INFINITY;\n const width = Math.min(maxWidth, Math.max(0, viewport.width - margin * 2));\n const height = Math.min(maxHeight, Math.max(0, viewport.height - margin * 2));\n const left = viewport.offsetLeft + (viewport.width - width) / 2;\n const top = viewport.offsetTop + (viewport.height - height) / 2;\n\n Object.assign(element.style, {\n borderRadius: 'var(--radius-overlay-md)',\n position: 'fixed',\n inset: `${top}px auto auto ${left}px`,\n width: `${width}px`,\n height: `${height}px`,\n maxWidth: 'none',\n maxHeight: 'none',\n transformOrigin: 'center',\n });\n };\n\n const resolveCurrentPresentation = (): SelectPresentation => {\n const viewport = viewportMetrics();\n const reference = options.reference().getBoundingClientRect();\n return resolveSelectPresentation({\n viewportWidth: viewport.width,\n viewportHeight: viewport.height,\n layoutViewportHeight: window.innerHeight,\n referenceTop: reference.top - viewport.offsetTop,\n referenceBottom: reference.bottom - viewport.offsetTop,\n touch: hasTouchPointer(),\n });\n };\n\n const applyPresentation = (): void => {\n if (!open) return;\n const element = surface();\n const next = resolveCurrentPresentation();\n currentPresentation = next;\n element.dataset.presentation = next;\n const heading = element.querySelector<HTMLElement>('[data-ui-select-sheet-heading]');\n if (heading) heading.style.display = next === 'anchored' ? 'none' : 'flex';\n\n if (next === 'anchored') {\n element.removeAttribute('aria-modal');\n element.removeAttribute('aria-labelledby');\n element.removeAttribute('role');\n setScrollLock(false);\n clearModalGeometry(element);\n anchored.mount();\n return;\n }\n\n anchored.unmount();\n element.setAttribute('role', 'dialog');\n element.setAttribute('aria-modal', 'true');\n element.setAttribute('aria-labelledby', options.labelId());\n setScrollLock(true);\n applyDialogGeometry(element, next);\n };\n\n const listenToViewport = (): (() => void) => {\n const update = (): void => applyPresentation();\n const viewport = window.visualViewport;\n const pointer = window.matchMedia?.('(any-pointer: coarse)');\n window.addEventListener('resize', update);\n window.addEventListener('orientationchange', update);\n viewport?.addEventListener('resize', update);\n viewport?.addEventListener('scroll', update);\n pointer?.addEventListener('change', update);\n return () => {\n window.removeEventListener('resize', update);\n window.removeEventListener('orientationchange', update);\n viewport?.removeEventListener('resize', update);\n viewport?.removeEventListener('scroll', update);\n pointer?.removeEventListener('change', update);\n };\n };\n\n const show = (): void => {\n if (open) return;\n open = true;\n try {\n surface().showPopover();\n } catch {\n // Reversal may find the native surface already in the top layer.\n }\n applyPresentation();\n stopViewportListeners = listenToViewport();\n };\n\n const hide = (): void => {\n if (!open) return;\n open = false;\n stopViewportListeners?.();\n stopViewportListeners = null;\n anchored.unmount();\n setScrollLock(false);\n try {\n surface().hidePopover();\n } catch {\n // Native teardown may already have removed the surface from the top layer.\n }\n };\n\n return {\n opened: () => open,\n open: show,\n close: hide,\n sync: applyPresentation,\n destroy: hide,\n presentation: () => currentPresentation,\n };\n};\n\nexport {createSelectSurface, resolveSelectPresentation};\nexport type {SelectPresentation, SelectPresentationMetrics, SelectSurface};\n","import {defineStyles} from '../../runtime';\nimport {\n CONTROL_MIN_SIZE_CLASSES,\n CONTROL_RADIUS_CLASSES,\n FIELD_CONTROL_ACTION_CLASSES,\n FIELD_CONTROL_INPUT_CLASSES,\n FIELD_CONTROL_NATIVE_CLASSES,\n FIELD_CONTROL_ROOT_CLASSES,\n OPTION_ICON_CLASSES,\n OPTION_INDICATOR_CLASSES,\n OPTION_ITEM_CLASSES,\n OPTION_META_CLASSES,\n POPOVER_GEOMETRY_CLASSES,\n} from '../common';\n\nconst selectStyles = defineStyles({definition: {\n component: 'ui.select',\n parts: {\n root: {\n base: 'relative inline-grid w-full min-w-0',\n },\n control: {\n base: FIELD_CONTROL_ROOT_CLASSES,\n variants: {\n size: CONTROL_MIN_SIZE_CLASSES,\n radius: CONTROL_RADIUS_CLASSES,\n variant: {\n outline: '',\n filled: '',\n plain: '',\n },\n mode: {\n listbox: '',\n combobox: '',\n pillbox: 'flex-wrap gap-1 py-0.5',\n native: '',\n },\n empty: {\n true: '',\n false: '',\n },\n },\n compounds: [\n {when: {mode: 'pillbox', empty: false}, class: '!pl-1.5'},\n ],\n defaults: {\n size: 'lg',\n variant: 'outline',\n radius: 'md',\n mode: 'listbox',\n empty: false,\n },\n },\n button: {\n base: [\n 'flex min-w-0 flex-1 items-center gap-2 border-0 bg-transparent p-0 text-left text-inherit outline-none',\n ],\n },\n pillboxTrigger: {\n base: 'min-w-16 self-stretch',\n },\n value: {\n base: 'min-w-0 flex-1 truncate',\n },\n placeholder: {\n base: 'min-w-0 flex-1 truncate text-surface-ink-muted',\n },\n input: {\n base: [\n 'w-full min-w-16 flex-1',\n FIELD_CONTROL_INPUT_CLASSES,\n ],\n },\n search: {\n base: [\n 'flex min-h-control-xlg shrink-0 items-center gap-2 px-3',\n 'text-sm',\n ],\n },\n searchInput: {\n base: [\n 'min-w-0 flex-1 text-sm',\n FIELD_CONTROL_INPUT_CLASSES,\n ],\n },\n sheetHeader: {\n base: '',\n },\n sheetHeading: {\n base: 'min-w-0 items-center gap-3 px-4 pt-4',\n },\n sheetTitle: {\n base: 'min-w-0 flex-1 truncate text-base font-medium',\n },\n sheetClose: {\n base: [\n 'inline-flex size-control-md shrink-0 items-center justify-center rounded-control-sm border-0 bg-transparent',\n 'text-surface-ink-muted outline-none focus-visible:ui-focus-ring',\n ],\n },\n chips: {\n base: 'flex min-w-0 flex-wrap items-center gap-1',\n },\n chip: {\n base: [\n 'max-w-64',\n ],\n },\n chipLabel: {\n base: 'flex min-w-0 flex-1 items-center',\n },\n chipPlainLabel: {\n base: 'block min-w-0 flex-1 truncate',\n },\n chipRemove: {\n base: '',\n },\n icon: {\n base: 'size-icon shrink-0 fill-current text-surface-ink-muted',\n variants: {\n position: {\n leading: '',\n trailing: '',\n },\n },\n defaults: {\n position: 'leading',\n },\n },\n action: {\n base: FIELD_CONTROL_ACTION_CLASSES,\n },\n popover: {\n base: [\n POPOVER_GEOMETRY_CLASSES,\n 'overflow-hidden rounded-overlay-sm',\n ],\n },\n listbox: {\n base: 'min-h-0 min-w-0 max-w-full overflow-hidden outline-none',\n },\n viewport: {\n base: 'min-h-0 min-w-0 max-w-full',\n },\n options: {\n base: 'grid w-full min-w-0 max-w-full auto-rows-min content-start gap-1 p-popover-padding',\n },\n virtualOptions: {\n base: 'grid w-full min-w-0 max-w-full auto-rows-min content-start gap-1 px-popover-padding',\n },\n create: {\n base: 'shrink-0 p-popover-padding',\n },\n option: {\n base: [\n OPTION_ITEM_CLASSES,\n 'min-w-0 max-w-full overflow-hidden',\n '[&:has([data-ui-select-option-label]>*+*)]:h-auto',\n '[&:has([data-ui-select-option-label]>*+*)]:items-start',\n '[&:has([data-ui-select-option-label]>*+*)]:py-2',\n ],\n },\n optionLabel: {\n base: 'min-w-0 flex-1 truncate',\n },\n optionMeta: {\n base: OPTION_META_CLASSES,\n },\n optionIcon: {\n base: OPTION_ICON_CLASSES,\n variants: {\n position: {\n leading: '',\n trailing: 'ml-auto',\n },\n },\n defaults: {\n position: 'leading',\n },\n },\n optionIndicator: {\n base: OPTION_INDICATOR_CLASSES,\n },\n group: {\n base: 'grid auto-rows-min content-start gap-1',\n },\n label: {\n base: 'px-menu-item-padding-inline py-1',\n },\n empty: {\n base: 'px-menu-item-padding-inline py-2 text-sm text-surface-ink-muted',\n },\n separatorRoot: {\n base: '-mx-popover my-popover h-[var(--border-width-edge-separator)]',\n },\n separatorRule: {\n base: 'h-[var(--border-width-edge-separator)] w-full border-0',\n },\n nativeWrapper: {\n base: 'relative w-full min-w-0',\n },\n native: {\n base: [\n FIELD_CONTROL_NATIVE_CLASSES,\n 'appearance-none pe-10',\n ],\n variants: {\n size: CONTROL_MIN_SIZE_CLASSES,\n radius: CONTROL_RADIUS_CLASSES,\n },\n defaults: {\n size: 'lg',\n radius: 'md',\n },\n },\n nativeIcon: {\n base: 'pointer-events-none absolute right-3 top-1/2 size-icon -translate-y-1/2 fill-current text-icon',\n },\n },\n}});\n\nexport {selectStyles};\n","import type Alpine from 'alpinejs';\n\nimport {badgeStyles} from '@client/components/badge/styles';\nimport {\n type AlpineMachine,\n createAlpineMachine,\n defineAlpineData,\n type MachineSnapshot,\n reflectSchemaProp,\n type TransitionForHook,\n type TrellisAlpineComponent,\n} from '@client/runtime';\nimport {cleanupManagerFor} from '@client/runtime/alpine-data';\nimport type {CleanupManager} from '@client/runtime/cleanup-manager';\nimport {addDismissableLayer} from '@client/runtime/dismissable-layer';\nimport {trapFocus} from '@client/runtime/focus-scope';\nimport {focusElement} from '@client/runtime/focus';\nimport {\n dispatchNativeControlChange,\n syncControlPresence,\n syncNativeControl,\n syncRepeatedHiddenInputs,\n} from '@client/runtime/form-control';\nimport {mergeBindings, type BindingObject} from '@client/runtime/merge-bindings';\nimport {declareMorphAttributes} from '@client/runtime/morph';\nimport {getPathValue, normalizeOptionText, parseItemData} from '@client/runtime/option-data';\nimport {observeSemanticChanges} from '@client/runtime/semantic-observer';\nimport {resolveStyle} from '@client/runtime/styles';\nimport {createTemplateInstance, findItemTemplate, type TemplateInstance} from '@client/runtime/item-template';\nimport {addListener, asBool, dispatch, setPresence} from '@client/utils';\nimport {selectSchema, type SelectProps} from './contract';\nimport {\n createSelectMachine,\n type SelectContext,\n type SelectedOption,\n selectHooks,\n} from './machine';\nimport {createSelectSurface, type SelectSurface} from './presentation';\nimport {selectStyles} from './styles';\n\ntype SelectTransitionName = (typeof selectHooks)[number]['name'];\ntype SelectTransition<TName extends SelectTransitionName = SelectTransitionName> = TransitionForHook<\n Extract<(typeof selectHooks)[number], {name: TName}>,\n HTMLElement\n>;\n\ntype PopoverElement = HTMLElement & {\n showPopover(): void;\n hidePopover(): void;\n};\n\ntype SelectOption = {\n el: HTMLElement;\n id: string;\n value: string;\n label: string;\n selectedLabel: string;\n disabled: boolean;\n selected: boolean;\n visible: boolean;\n create: boolean;\n};\n\ntype CatalogOption = Omit<SelectOption, 'selected' | 'visible'> & {\n minLength: number;\n suffix: string;\n};\n\ntype OptionProjection = {\n options: SelectOption[];\n enabled: SelectOption[];\n firstByValue: ReadonlyMap<string, SelectOption>;\n byElement: ReadonlyMap<HTMLElement, SelectOption>;\n};\n\nclass OptionCatalog {\n readonly ordinaryCount: number;\n\n private readonly filter: boolean;\n private readonly records: CatalogOption[];\n private readonly projections = new Map<string, OptionProjection>();\n\n constructor({\n root,\n listboxId,\n props,\n resolveLabel,\n rememberLabel,\n }: {\n root: HTMLElement;\n listboxId: string;\n props: Readonly<SelectProps>;\n resolveLabel(el: HTMLElement, props: Readonly<SelectProps>): string;\n rememberLabel(value: string, label: string): void;\n }) {\n this.filter = props.filter;\n this.records = Array.from(root.querySelectorAll<HTMLElement>(optionSelector)).map((el, index) => {\n const label = resolveLabel(el, props);\n const value = el.dataset.value || label;\n const create = el.hasAttribute('data-ui-select-option-create');\n const record = {\n el,\n id: el.id || `${listboxId}-option-${index}`,\n value,\n label,\n selectedLabel: el.dataset.selectedLabel || label,\n disabled: asBool({value: el.dataset.disabled}),\n create,\n minLength: Number(el.dataset.minLength ?? '0'),\n suffix: el.dataset.suffix ?? '',\n };\n return record;\n });\n const remembered = new Set<string>();\n this.records.forEach((option) => {\n if (option.create || remembered.has(option.value)) return;\n remembered.add(option.value);\n rememberLabel(option.value, option.selectedLabel);\n });\n this.ordinaryCount = this.records.filter((option) => !option.create).length;\n }\n\n project(query: string, selection: readonly SelectedOption[]): OptionProjection {\n const selectedValues = selection.map(({value}) => value);\n const key = JSON.stringify([query, selectedValues]);\n const cached = this.projections.get(key);\n if (cached) return cached;\n\n const normalizedQuery = normalizeOptionText(query);\n const exact = normalizedQuery !== '' && this.records.some((option) => (\n !option.create && normalizeOptionText(option.label) === normalizedQuery\n ));\n const options = this.records.map((option) => {\n const matches = !normalizedQuery\n || normalizeOptionText(`${option.label} ${option.suffix}`).includes(normalizedQuery);\n return {\n ...option,\n value: option.create ? option.el.dataset.value || query : option.value,\n selected: selectedValues.includes(option.value),\n visible: option.create\n ? !exact && query.length >= option.minLength\n : !this.filter || normalizedQuery === '' || matches,\n };\n });\n const firstByValue = new Map<string, SelectOption>();\n const byElement = new Map<HTMLElement, SelectOption>();\n options.forEach((option) => {\n if (!firstByValue.has(option.value)) firstByValue.set(option.value, option);\n byElement.set(option.el, option);\n });\n const projection = {\n options,\n enabled: options.filter((option) => option.visible && !option.disabled && !option.create),\n firstByValue,\n byElement,\n };\n this.projections.set(key, projection);\n return projection;\n }\n}\n\ntype NestedVirtualizerApi = {\n setUrl(url: string, options?: {reset?: boolean}): void;\n setTotalItems(count: number): void;\n};\n\ntype NestedVirtualizerElement = HTMLElement & {\n _x_dataStack?: Array<Partial<NestedVirtualizerApi>>;\n};\n\n/**\n * Public Alpine API for `ui.select`.\n *\n * @public\n */\ninterface UiSelectApi {\n /** Whether the select is opening or fully open. */\n readonly isOpen: boolean;\n\n /** Whether a searching transition hook is pending. */\n readonly isSearching: boolean;\n\n /** First selected value, or an empty string. */\n readonly value: string;\n\n /** Selected values in committed order. */\n readonly values: readonly string[];\n\n /** Display labels corresponding to the selected values. */\n readonly selectedLabels: readonly string[];\n\n /** Current search query. */\n readonly search: string;\n\n /** Value of the currently highlighted option. */\n readonly activeValue: string;\n\n /** Opens the listbox unless the select is disabled or readonly. */\n open(event?: Event): void;\n\n /** Closes the listbox. Keyboard dismissal restores focus to the trigger. */\n close(event?: Event): void;\n\n /** Reverses the current disclosure lifecycle. */\n toggle(event?: Event): void;\n\n /** Selects the rendered option with this value. */\n select(value: string, event?: Event): void;\n\n /** Removes a selected value. */\n deselect(value: string, event?: Event): void;\n\n /** Selects every rendered, visible, enabled option in multiple mode. */\n selectAll(event?: Event): void;\n\n /** Clears search, selection, highlight, and submitted values. */\n clear(event?: Event): void;\n\n /** Sets the query and enters the searching feature state. */\n setSearch(query: string): void;\n}\n\ntype SelectData = AlpineMachine<SelectContext, SelectProps, typeof selectHooks> & UiSelectApi & {\n readonly root: BindingObject;\n init(): void;\n destroy(): void;\n};\n\nconst optionSelector = '[data-ui-select-option], [data-ui-select-option-create]';\nconst selectedTemplateSelector = 'template[data-ui-select-option-selected-template]';\n\nconst projectedInteractiveElements = new Set([\n 'A', 'AREA', 'BUTTON', 'DETAILS', 'EMBED', 'IFRAME', 'INPUT', 'OBJECT', 'OPTION', 'SELECT', 'SUMMARY', 'TEXTAREA',\n]);\nconst projectedExecutableElements = new Set(['SCRIPT', 'STYLE']);\nconst projectedInteractionAttributes = new Set([\n 'autofocus',\n 'contenteditable',\n 'controls',\n 'download',\n 'draggable',\n 'form',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n 'href',\n 'id',\n 'name',\n 'popover',\n 'popovertarget',\n 'popovertargetaction',\n 'role',\n 'tabindex',\n 'target',\n]);\n\nconst isProjectedInteractionAttribute = (name: string): boolean => (\n projectedInteractionAttributes.has(name)\n || (name.startsWith('aria-') && name !== 'aria-hidden')\n || name.startsWith('data-ui-select')\n || name === 'data-ui-interactive'\n || name.startsWith('data-ui-action')\n || name.startsWith('data-selected')\n || name.startsWith('data-highlighted')\n || name.startsWith('data-disabled')\n || name.startsWith('x-')\n || name.startsWith('hx-')\n || name.startsWith('v-')\n || name.startsWith('wire:')\n || name.startsWith('@')\n || name.startsWith(':')\n || name.startsWith('on')\n);\n\nconst sanitizeSelectedContent = (node: Node): Node | null => {\n if (!(node instanceof Element)) return node;\n const elementName = node.localName.toUpperCase();\n if (projectedExecutableElements.has(elementName)) return null;\n\n let projected = node;\n if (projectedInteractiveElements.has(elementName) || node.hasAttribute('contenteditable')) {\n projected = document.createElement('span');\n Array.from(node.attributes).forEach((attribute) => {\n if (!isProjectedInteractionAttribute(attribute.name)) {\n projected.setAttribute(attribute.name, attribute.value);\n }\n });\n projected.append(...Array.from(node.childNodes));\n }\n\n Array.from(projected.attributes).forEach((attribute) => {\n if (isProjectedInteractionAttribute(attribute.name)) projected.removeAttribute(attribute.name);\n });\n\n Array.from(projected.childNodes).forEach((child) => {\n const sanitized = sanitizeSelectedContent(child);\n if (!sanitized) child.remove();\n else if (sanitized !== child) child.replaceWith(sanitized);\n });\n projected.setAttribute('x-ignore', 'true');\n return projected;\n};\n\nconst cloneSelectedNodes = (nodes: Iterable<Node>): DocumentFragment => {\n const fragment = document.createDocumentFragment();\n Array.from(nodes).forEach((node) => {\n if (node instanceof HTMLTemplateElement && node.matches(selectedTemplateSelector)) return;\n const clone = node.cloneNode(true);\n const sanitized = sanitizeSelectedContent(clone);\n if (sanitized) fragment.append(sanitized);\n });\n return fragment;\n};\n\nconst sameStrings = (left: readonly string[], right: readonly string[]): boolean => (\n left.length === right.length && left.every((value, index) => value === right[index])\n);\n\nconst UiSelect = (AlpineInstance: Alpine.Alpine): TrellisAlpineComponent<SelectData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let reflectControlledState = false;\n let buttonId = '';\n let inputId = '';\n let listboxId = '';\n let optionsId = '';\n let popover: SelectSurface | null = null;\n let disconnectObserver: (() => void) | null = null;\n let disconnectSelectedTemplateObservers: (() => void) | null = null;\n let cleanup: CleanupManager;\n let hiddenInputsKey = '';\n const chipInstances = new Map<string, {instance: TemplateInstance<Record<string, unknown>>; content: string}>();\n let inputSearching = false;\n let restoreFocusAfterClose = false;\n let lastOptionEl: HTMLElement | null = null;\n let typeahead = '';\n let typeaheadTimer = 0;\n let virtualSearchTimer = 0;\n let virtualTotal = 0;\n let virtualSearchPopulation = 0;\n let synchronizedVirtualizerUrl: string | null = null;\n let activeOptionCatalog: OptionCatalog | null = null;\n const selectedLabelCache = new Map<string, string>();\n\n const root = (): HTMLElement => {\n if (!rootEl) throw new Error('Select has not been initialized.');\n return rootEl;\n };\n\n const control = (): HTMLElement => {\n const el = root().querySelector<HTMLElement>('[data-ui-select-control]');\n if (!el) throw new Error('Select requires a control element.');\n return el;\n };\n\n const trigger = (): HTMLElement => {\n const el = root().querySelector<HTMLElement>('[data-ui-select-trigger], [data-ui-select-button], [data-ui-select-input]');\n if (!el) throw new Error('Select requires a trigger element.');\n return el;\n };\n\n const input = (): HTMLInputElement | null => root().querySelector<HTMLInputElement>('[data-ui-select-input]');\n const searchInput = (): HTMLInputElement | null => root().querySelector<HTMLInputElement>('[data-ui-select-search-input]');\n const sheetTitle = (): HTMLElement => {\n const el = root().querySelector<HTMLElement>('[data-ui-select-sheet-title]');\n if (!el) throw new Error('Select requires an adaptive picker title.');\n return el;\n };\n\n const popoverEl = (): PopoverElement => {\n const el = root().querySelector<HTMLElement>('[data-ui-select-popover]');\n if (!el) throw new Error('Select requires a popover element.');\n return el as PopoverElement;\n };\n\n const listbox = (): HTMLElement => {\n const el = root().querySelector<HTMLElement>('[data-ui-select-listbox]');\n if (!el) throw new Error('Select requires a listbox element.');\n return el;\n };\n\n const optionsEl = (): HTMLElement => {\n const el = root().querySelector<HTMLElement>('[data-ui-select-options]');\n if (!el) throw new Error('Select requires an options element.');\n return el;\n };\n\n const virtualizerEl = (): NestedVirtualizerElement | null => (\n root().querySelector<NestedVirtualizerElement>('[data-ui-select-virtualizer]')\n );\n\n const virtualizerApi = (): NestedVirtualizerApi | null => {\n const scope = virtualizerEl()?._x_dataStack?.find((candidate) => (\n typeof candidate.setUrl === 'function' && typeof candidate.setTotalItems === 'function'\n ));\n return scope as NestedVirtualizerApi | undefined ?? null;\n };\n\n const chipsEl = (): HTMLElement | null => root().querySelector<HTMLElement>('[data-ui-select-chips]');\n const hiddenInputsEl = (): HTMLElement | null => root().querySelector<HTMLElement>('[data-ui-select-hidden-inputs]');\n const currentProps = (): Readonly<SelectProps> => bridge.getCommittedSnapshot().props;\n const currentContext = (): Readonly<SelectContext> => bridge.getCommittedSnapshot().context;\n const isExpanded = (): boolean => bridge.hasTag('expanded');\n const isVisible = (): boolean => bridge.hasTag('visible');\n\n const resolveOptionLabel = (el: HTMLElement, props: Readonly<SelectProps>): string => {\n const explicit = el.dataset.label || el.getAttribute('aria-label') || '';\n if (explicit) return explicit;\n if (el.dataset.textValue) return el.dataset.textValue;\n const itemValue = getPathValue(parseItemData(el.dataset.item), props.path);\n if (itemValue !== undefined && itemValue !== null) return String(itemValue);\n const label = el.querySelector<HTMLElement>('[data-ui-select-option-label]');\n return (label?.textContent ?? el.textContent ?? '').trim();\n };\n\n const createOptionCatalog = (props: Readonly<SelectProps> = currentProps()): OptionCatalog => new OptionCatalog({\n root: root(),\n listboxId,\n props,\n resolveLabel: resolveOptionLabel,\n rememberLabel: (value, label) => selectedLabelCache.set(value, label),\n });\n\n const withOptionCatalog = <T>(operation: (catalog: OptionCatalog) => T, props?: Readonly<SelectProps>): T => {\n if (activeOptionCatalog) return operation(activeOptionCatalog);\n activeOptionCatalog = createOptionCatalog(props);\n try {\n return operation(activeOptionCatalog);\n } finally {\n activeOptionCatalog = null;\n }\n };\n\n const selectionValues = (selection: readonly SelectedOption[] = currentContext().selection): string[] => (\n selection.map(({value}) => value)\n );\n const selectionLabels = (selection: readonly SelectedOption[] = currentContext().selection): string[] => (\n selection.map(({label}) => label)\n );\n const optionProjection = (\n catalog: OptionCatalog,\n query = currentContext().search.query,\n selection: readonly SelectedOption[] = currentContext().selection,\n ): OptionProjection => catalog.project(query, selection);\n\n const fixedSearchAvailable = (catalog: OptionCatalog): boolean => {\n const props = currentProps();\n if (!searchInput()) return false;\n if (props.mode === 'combobox') return true;\n const mountedOptions = catalog.ordinaryCount;\n const optionCount = props.virtualized\n ? Math.max(mountedOptions, props.optionsTotalItems, virtualSearchPopulation)\n : mountedOptions;\n return optionCount >= props.searchMinItems;\n };\n\n const selectionForValues = (\n values: readonly string[],\n catalog: OptionCatalog,\n props: Readonly<SelectProps> = currentProps(),\n ): SelectContext['selection'] => {\n const unique = Array.from(new Set(values.filter(Boolean)));\n const normalized = props.multiple ? unique : unique.slice(0, 1);\n const projection = catalog.project('', []);\n return normalized.map((value) => ({\n value,\n label: projection.firstByValue.get(value)?.selectedLabel\n ?? selectedLabelCache.get(value)\n ?? (typeof props.selectedLabelMap[value] === 'string' ? props.selectedLabelMap[value] : undefined)\n ?? value,\n }));\n };\n\n const valuesFromProps = (props: Readonly<SelectProps>): string[] => (\n props.multiple\n ? Array.from(new Set([...props.values, ...(props.value ? [props.value] : [])]))\n : props.value ? [props.value] : props.values.slice(0, 1)\n );\n\n const initialContext = (props: SelectProps): SelectContext => {\n return withOptionCatalog((catalog) => {\n const explicit = valuesFromProps(props);\n const selectedFromOptions = catalog.project('', [])\n .options.filter((option) => asBool({value: option.el.dataset.selected}))\n .map((option) => option.value);\n return {\n selection: selectionForValues(explicit.length > 0 ? explicit : selectedFromOptions, catalog, props),\n search: {query: '', optionsId: ''},\n navigation: {activeValue: ''},\n creation: {value: ''},\n };\n }, props);\n };\n\n const selectedSummary = (): string => {\n const {selection} = currentContext();\n const props = currentProps();\n if (selection.length === 0 || (props.mode === 'pillbox' && props.multiple)) return '';\n if (props.multiple && selection.length > 1) return `${selection.length} ${props.suffix}`;\n return selection[0]?.label ?? selection[0]?.value ?? '';\n };\n\n const explicitSelectedContent = (option: SelectOption): DocumentFragment | null => {\n const template = option.el.querySelector<HTMLTemplateElement>(selectedTemplateSelector);\n return template ? cloneSelectedNodes(template.content.childNodes) : null;\n };\n\n const selectedContent = (option: SelectOption): DocumentFragment => {\n const explicit = explicitSelectedContent(option);\n if (explicit) return explicit;\n const source = option.el.querySelector<HTMLElement>('[data-ui-select-option-selected-content]')\n ?? option.el.querySelector<HTMLElement>('[data-ui-select-option-label]');\n if (source) return cloneSelectedNodes(source.childNodes);\n const fragment = document.createDocumentFragment();\n fragment.append(document.createTextNode(option.selectedLabel));\n return fragment;\n };\n\n const syncRoot = (): void => {\n const props = currentProps();\n if (reflectControlledState) {\n const values = selectionValues();\n if (isExpanded() || !props.open || (!props.disabled && !props.readonly)) {\n reflectSchemaProp({el: root(), schema: selectSchema, key: 'open', value: isExpanded()});\n }\n reflectSchemaProp({\n el: root(),\n schema: selectSchema,\n key: 'value',\n value: props.multiple ? '' : values[0] ?? '',\n });\n reflectSchemaProp({\n el: root(),\n schema: selectSchema,\n key: 'values',\n value: props.multiple ? [...values] : [],\n });\n }\n root().dataset.state = isExpanded() ? 'open' : 'closed';\n root().dataset.mark = props.mark;\n syncControlPresence({el: root(), state: {\n disabled: props.disabled,\n required: props.required,\n invalid: props.invalid,\n }, value: 'true'});\n };\n\n const isPillbox = (): boolean => currentProps().mode === 'pillbox' && currentProps().multiple;\n\n const syncControl = (): void => {\n const props = currentProps();\n const empty = isPillbox() && currentContext().selection.length === 0;\n const el = control();\n el.className = resolveStyle({\n part: selectStyles.parts.control,\n props: {...props, mode: isPillbox() ? 'pillbox' : props.mode === 'combobox' ? 'combobox' : 'listbox', empty},\n });\n el.dataset.state = isExpanded() ? 'open' : 'closed';\n el.dataset.mode = isPillbox() ? 'pillbox' : props.mode;\n setPresence({el, attr: 'data-ui-select-pillbox-control', present: isPillbox(), value: ''});\n setPresence({el, attr: 'data-empty', present: empty, value: 'true'});\n syncControlPresence({el, state: {disabled: props.disabled, invalid: props.invalid}, value: 'true'});\n };\n\n const syncTrigger = (catalog: OptionCatalog): void => {\n const props = currentProps();\n const el = trigger();\n el.id ||= buttonId;\n el.dataset.state = isExpanded() ? 'open' : 'closed';\n el.setAttribute('aria-haspopup', 'listbox');\n el.setAttribute('aria-expanded', isExpanded() ? 'true' : 'false');\n el.setAttribute('aria-controls', listboxId);\n setPresence({el, attr: 'aria-invalid', present: props.invalid, value: 'true'});\n if (el instanceof HTMLButtonElement) el.disabled = props.disabled;\n\n const summary = selectedSummary();\n const valueEl = root().querySelector<HTMLElement>('[data-ui-select-button-value]');\n const placeholder = root().querySelector<HTMLElement>('[data-ui-select-button-placeholder]');\n if (valueEl) {\n valueEl.replaceChildren();\n const selected = currentContext().selection.length === 1 && summary\n ? catalog.project('', currentContext().selection).firstByValue.get(currentContext().selection[0]?.value ?? '')\n : undefined;\n if (selected) valueEl.append(selectedContent(selected));\n else valueEl.textContent = summary;\n valueEl.hidden = summary === '';\n }\n if (placeholder) {\n placeholder.hidden = isPillbox()\n ? currentContext().selection.length > 0\n : summary !== '';\n }\n\n root().querySelectorAll<HTMLElement>('[data-ui-select-clear], [data-ui-select-button-clear]').forEach((clear) => {\n clear.hidden = props.disabled || !props.clearable || currentContext().selection.length === 0;\n if (clear instanceof HTMLButtonElement) clear.disabled = props.disabled;\n });\n root().querySelectorAll<HTMLElement>('[data-ui-select-search-clear]').forEach((clear) => {\n clear.hidden = props.disabled || !currentContext().search.query;\n if (clear instanceof HTMLButtonElement) clear.disabled = props.disabled;\n });\n };\n\n const syncInputs = (catalog: OptionCatalog): void => {\n const props = currentProps();\n const context = currentContext();\n const inputEl = input();\n if (inputEl) {\n inputEl.id ||= inputId;\n inputEl.className = resolveStyle({part: selectStyles.parts.input, className: props.inputClass});\n inputEl.value = isPillbox()\n ? context.search.query\n : isExpanded() && inputSearching ? context.search.query : selectedSummary();\n inputEl.placeholder = isPillbox() && context.selection.length > 0 ? '' : props.placeholder;\n inputEl.setAttribute('role', 'combobox');\n inputEl.setAttribute('autocomplete', 'off');\n inputEl.setAttribute('aria-autocomplete', 'list');\n inputEl.setAttribute('aria-expanded', isExpanded() ? 'true' : 'false');\n inputEl.setAttribute('aria-controls', listboxId);\n syncNativeControl({input: inputEl, state: {\n disabled: props.disabled,\n readonly: props.readonly,\n required: props.required,\n nativeRequired: false,\n invalid: props.invalid,\n ariaRequired: props.required,\n }});\n }\n\n const search = searchInput();\n if (search) {\n const searchRow = search.closest<HTMLElement>('[data-ui-select-search]');\n if (searchRow) searchRow.hidden = !fixedSearchAvailable(catalog);\n search.value = context.search.query;\n search.disabled = props.disabled;\n search.readOnly = props.readonly;\n }\n\n const active = optionProjection(catalog).firstByValue.get(context.navigation.activeValue);\n [trigger(), inputEl, search, listbox()].forEach((element) => {\n if (active?.id) element?.setAttribute('aria-activedescendant', active.id);\n else element?.removeAttribute('aria-activedescendant');\n });\n };\n\n const syncListbox = (): void => {\n const props = currentProps();\n const surface = popoverEl();\n const box = listbox();\n surface.id = `${listboxId}-popover`;\n surface.className = resolveStyle({part: selectStyles.parts.popover, props, className: props.listboxClass});\n surface.dataset.uiSurface = props.surface;\n surface.dataset.uiElevation = props.elevation;\n surface.setAttribute('popover', 'manual');\n surface.dataset.state = isExpanded() ? 'open' : 'closed';\n surface.hidden = !isVisible();\n box.id = listboxId;\n box.setAttribute('role', 'listbox');\n box.tabIndex = -1;\n box.setAttribute('aria-labelledby', trigger().id);\n setPresence({el: box, attr: 'aria-multiselectable', present: props.multiple, value: 'true'});\n };\n\n const syncOptions = (catalog: OptionCatalog): void => {\n const props = currentProps();\n const context = currentContext();\n root().querySelectorAll<HTMLElement>('[data-ui-select-create-query]').forEach((query) => {\n query.textContent = context.search.query;\n });\n const records = optionProjection(catalog).options;\n records.forEach((option) => {\n option.el.id = option.id;\n option.el.hidden = !option.visible;\n option.el.setAttribute('role', 'option');\n option.el.setAttribute('aria-selected', option.selected ? 'true' : 'false');\n if (!option.create) option.el.dataset.value = option.value;\n if (!option.create) option.el.dataset.label = option.label;\n setPresence({el: option.el, attr: 'data-selected', present: option.selected, value: 'true'});\n setPresence({el: option.el, attr: 'data-highlighted', present: option.value === context.navigation.activeValue, value: 'true'});\n setPresence({el: option.el, attr: 'data-disabled', present: option.disabled, value: 'true'});\n setPresence({el: option.el, attr: 'aria-disabled', present: option.disabled, value: 'true'});\n option.el.querySelectorAll<HTMLElement>('[data-ui-select-option-indicator]').forEach((indicator) => {\n setPresence({el: indicator, attr: 'data-selected', present: option.selected, value: 'true'});\n });\n });\n const empty = root().querySelector<HTMLElement>('[data-ui-select-option-empty]');\n if (empty) {\n empty.hidden = props.virtualized && props.optionsFetchUrl\n ? virtualTotal !== 0\n : records.some((option) => option.visible && !option.create);\n }\n };\n\n const optionDomSignature = (): string => JSON.stringify(\n Array.from(root().querySelectorAll<HTMLElement>(optionSelector)).map((option) => ({\n create: option.hasAttribute('data-ui-select-option-create'),\n value: option.dataset.value ?? '',\n label: option.hasAttribute('data-ui-select-option-create')\n ? option.textContent?.trim() ?? ''\n : option.dataset.label ?? option.textContent?.trim() ?? '',\n disabled: option.dataset.disabled ?? '',\n selected: option.dataset.selected ?? '',\n selectedContent: option.querySelector<HTMLTemplateElement>(selectedTemplateSelector)?.innerHTML ?? null,\n })),\n );\n\n const syncChips = (catalog: OptionCatalog): void => {\n const container = chipsEl();\n if (!container) return;\n const props = currentProps();\n const context = currentContext();\n const records = catalog.project('', context.selection);\n const chips = context.selection.map(({value, label}) => ({\n value,\n label,\n disabled: records.firstByValue.get(value)?.disabled ?? false,\n option: records.firstByValue.get(value),\n }));\n const chipSize = props.size === 'xs' || props.size === 'sm' ? 'xs' : 'sm';\n const template = findItemTemplate(root(), 'x-ui-select:chip');\n container.hidden = !isPillbox() || chips.length === 0;\n const selectedValues = new Set(container.hidden ? [] : chips.map(({value}) => value));\n chipInstances.forEach(({instance}, value) => {\n if (!selectedValues.has(value) || instance.template !== template || instance.element.parentElement !== container) {\n instance.destroy();\n chipInstances.delete(value);\n }\n });\n if (container.hidden) return;\n if (!template) throw new Error('A pillbox select requires a chip template.');\n const styles = {\n chip: resolveStyle({part: badgeStyles.parts.root,\n props: {variant: props.chipVariant, color: props.chipColor, size: chipSize, radius: 'sm'},\n className: resolveStyle({part: selectStyles.parts.chip, className: props.chipClass})}),\n label: resolveStyle({part: selectStyles.parts.chipLabel}),\n plainLabel: resolveStyle({part: selectStyles.parts.chipPlainLabel}),\n remove: resolveStyle({part: badgeStyles.parts.close, props: {size: chipSize},\n className: resolveStyle({part: selectStyles.parts.chipRemove})}),\n };\n chips.forEach((chip, index) => {\n const selectedTemplate = chip.option?.el.querySelector<HTMLTemplateElement>(selectedTemplateSelector);\n const content = selectedTemplate?.innerHTML ?? '';\n const scope = {\n $chip: {value: chip.value, label: chip.label || chip.value,\n disabled: props.disabled || props.readonly || chip.disabled,\n hasSelectedContent: Boolean(selectedTemplate)},\n $styles: styles,\n $chipAppearance: {variant: props.chipVariant, color: props.chipColor, size: chipSize},\n };\n let mounted = chipInstances.get(chip.value);\n if (!mounted) {\n const instance = createTemplateInstance(AlpineInstance, template, scope);\n instance.element.dataset.uiSelectChip = '';\n instance.element.dataset.value = chip.value;\n mounted = {instance, content: ''};\n chipInstances.set(chip.value, mounted);\n } else mounted.instance.update(scope);\n if (mounted.content !== content) {\n const host = mounted.instance.element.querySelector<HTMLElement>('[data-ui-select-chip-selected-content]');\n if (host) host.replaceChildren(...(chip.option ? [explicitSelectedContent(chip.option) ?? ''] : []));\n mounted.content = content;\n }\n const element = mounted.instance.element;\n const before = container.children[index] ?? null;\n if (element !== before) mounted.instance.mount(container, before);\n });\n };\n\n const syncHiddenInputs = (): void => {\n const container = hiddenInputsEl();\n if (!container) return;\n const props = currentProps();\n hiddenInputsKey = syncRepeatedHiddenInputs({container, state: {\n name: props.name,\n required: props.required,\n values: props.disabled ? [] : selectionValues(),\n form: root().dataset.form ?? '',\n marker: 'data-ui-select-hidden-input',\n }, currentKey: hiddenInputsKey});\n };\n\n const syncAll = (): void => withOptionCatalog((catalog) => {\n syncRoot();\n syncControl();\n syncTrigger(catalog);\n syncInputs(catalog);\n syncListbox();\n syncOptions(catalog);\n syncChips(catalog);\n syncHiddenInputs();\n });\n\n const focusForOpen = (): void => {\n if (!rootEl) return;\n withOptionCatalog((catalog) => {\n if (!bridge.hasTag('interactive')) return;\n const props = currentProps();\n const focusTarget = (target: HTMLElement | null): void => {\n const showIndicator = target !== null\n && target.ownerDocument.activeElement === target\n && target.matches(':focus-visible');\n focusElement(target, {showIndicator});\n };\n if (popover?.presentation() !== 'anchored') {\n const target = (fixedSearchAvailable(catalog) ? searchInput() : null)\n ?? root().querySelector<HTMLElement>('[data-ui-select-sheet-close]')\n ?? listbox();\n focusTarget(target);\n } else if (props.mode === 'combobox') focusTarget(input());\n else if (fixedSearchAvailable(catalog)) focusTarget(searchInput());\n else focusTarget(trigger());\n });\n };\n\n const activateCommittedOption = (): void => withOptionCatalog((catalog) => {\n if (currentContext().navigation.activeValue) return;\n const enabled = optionProjection(catalog).enabled;\n const selected = selectionValues()\n .map((value) => enabled.find((option) => option.value === value))\n .find((option): option is SelectOption => option !== undefined);\n if (selected) setActive(selected.value);\n });\n\n const reconcileOptions = (): void => withOptionCatalog((catalog) => {\n const context = currentContext();\n const selection = selectionForValues(selectionValues(context.selection), catalog);\n if (!sameStrings(selectionLabels(selection), selectionLabels(context.selection))) {\n bridge.send({type: 'RECONCILE_SELECTION', selection});\n }\n const enabled = optionProjection(catalog).enabled;\n if (context.navigation.activeValue && !enabled.some((option) => option.value === context.navigation.activeValue)) {\n bridge.send({type: 'ACTIVE', value: currentProps().autoHighlight ? enabled[0]?.value ?? '' : ''});\n }\n syncAll();\n });\n\n const propsChanged = (event: Record<string, unknown>): void => withOptionCatalog((catalog) => {\n const changes = Array.isArray(event.changes) ? event.changes : [];\n const keys = changes.flatMap((change) => (\n change && typeof change === 'object' && 'key' in change ? [String(change.key)] : []\n ));\n if (keys.some((key) => key === 'value' || key === 'values' || key === 'multiple' || key === 'selectedLabelMap')) {\n const selection = selectionForValues(valuesFromProps(currentProps()), catalog);\n bridge.send({type: 'RECONCILE_SELECTION', selection});\n }\n if (keys.includes('optionsTotalItems')) {\n virtualTotal = currentProps().optionsTotalItems;\n virtualSearchPopulation = virtualTotal;\n virtualizerApi()?.setTotalItems(virtualTotal);\n }\n if (keys.includes('optionsFetchUrl')) {\n syncVirtualizerUrl();\n queueMicrotask(syncVirtualizerUrl);\n }\n syncAll();\n });\n\n const virtualizedOptionsUrl = (query: string): string => {\n const props = currentProps();\n const url = new URL(props.optionsFetchUrl, document.baseURI);\n if (query) url.searchParams.set(props.optionSearchParam, query);\n else url.searchParams.delete(props.optionSearchParam);\n return /^[a-z][a-z\\d+.-]*:/i.test(props.optionsFetchUrl) || props.optionsFetchUrl.startsWith('//')\n ? url.href\n : `${url.pathname}${url.search}${url.hash}`;\n };\n\n const syncVirtualizerUrl = (): void => {\n if (!rootEl) return;\n const props = currentProps();\n if (!props.virtualized) return;\n const desired = props.optionsFetchUrl\n ? virtualizedOptionsUrl(currentContext().search.query)\n : '';\n const virtualizer = virtualizerEl();\n if (!virtualizer) return;\n if (virtualizer.dataset.fetchUrl === desired) {\n synchronizedVirtualizerUrl = desired;\n return;\n }\n if (synchronizedVirtualizerUrl === desired) return;\n const api = virtualizerApi();\n if (!api) return;\n synchronizedVirtualizerUrl = desired;\n api.setUrl(desired, {reset: true});\n };\n\n const scheduleVirtualSearch = (): void => {\n window.clearTimeout(virtualSearchTimer);\n const props = currentProps();\n if (\n !props.virtualized\n || !props.optionsFetchUrl\n || (!props.searchable && props.mode !== 'combobox')\n ) return;\n virtualSearchTimer = window.setTimeout(() => {\n syncVirtualizerUrl();\n const api = virtualizerApi();\n if (!api) return;\n if (virtualTotal === 0 && props.optionsTotalItems > 0) {\n virtualTotal = props.optionsTotalItems;\n api.setTotalItems(virtualTotal);\n }\n }, props.optionSearchDebounce);\n };\n\n const bridge = createAlpineMachine({\n schema: selectSchema,\n hooks: selectHooks,\n createMachine: ({props}) => createSelectMachine({\n props,\n context: initialContext(props),\n effects: {\n prepareOpen: () => withOptionCatalog(() => {\n restoreFocusAfterClose = false;\n popover?.open();\n activateCommittedOption();\n syncAll();\n queueMicrotask(focusForOpen);\n }),\n finishOpen: () => {\n syncAll();\n dispatch({el: root(), name: 'ui:open'});\n },\n prepareClose: ({event}) => {\n inputSearching = false;\n restoreFocusAfterClose = event.restoreFocus === true\n || event.type === 'SELECT'\n || event.type === 'CREATE';\n if (restoreFocusAfterClose) focusElement(trigger(), {showIndicator: false});\n syncAll();\n },\n finishClose: () => {\n popover?.close();\n syncAll();\n if (restoreFocusAfterClose) focusElement(trigger(), {showIndicator: false});\n restoreFocusAfterClose = false;\n dispatch({el: root(), name: 'ui:close'});\n },\n commitSelection: ({event}) => {\n syncAll();\n declareMorphAttributes(root(), 'data-value', 'data-values');\n dispatchNativeControlChange({\n container: hiddenInputsEl(),\n fallback: root(),\n marker: 'data-ui-select-hidden-input',\n });\n const {selection} = currentContext();\n if (event.type === 'CLEAR') dispatch({el: root(), name: 'ui:clear'});\n dispatch({el: root(), name: 'ui:change', detail: {\n value: selection[0]?.value ?? '',\n values: selectionValues(selection),\n label: selection[0]?.label ?? '',\n labels: selectionLabels(selection),\n option: lastOptionEl,\n }});\n lastOptionEl = null;\n },\n commitSearch: () => {\n syncAll();\n dispatch({el: root(), name: 'ui:search', detail: {search: currentContext().search.query}});\n scheduleVirtualSearch();\n },\n prepareCreate: ({event}) => {\n syncAll();\n dispatch({el: root(), name: 'ui:create', detail: {\n search: currentContext().search.query,\n value: currentContext().creation.value,\n modal: typeof event.modal === 'string' ? event.modal : '',\n }});\n },\n syncProps: ({event}) => propsChanged(event),\n syncOptions: reconcileOptions,\n syncActive: syncAll,\n syncDom: syncAll,\n },\n }),\n });\n\n const sendSelection = (\n type: 'SELECT' | 'DESELECT' | 'SELECT_ALL',\n selection: SelectContext['selection'],\n ): void => bridge.send({type, selection});\n\n const selectOption = (option: SelectOption, catalog: OptionCatalog, event?: Event): void => {\n event?.preventDefault();\n const props = currentProps();\n if (props.disabled || props.readonly || option.disabled) return;\n if (option.create) {\n bridge.send({\n type: 'CREATE',\n value: option.value || currentContext().search.query,\n modal: option.el.dataset.modal ?? '',\n });\n return;\n }\n\n lastOptionEl = option.el;\n inputSearching = false;\n const currentValues = selectionValues();\n const values = props.multiple\n ? currentValues.includes(option.value)\n ? currentValues.filter((value) => value !== option.value)\n : [...currentValues, option.value]\n : [option.value];\n sendSelection('SELECT', selectionForValues(values, catalog));\n };\n\n const setActive = (value: string): void => withOptionCatalog((catalog) => {\n if (value === currentContext().navigation.activeValue) return;\n bridge.send({type: 'ACTIVE', value});\n const option = optionProjection(catalog).firstByValue.get(value);\n dispatch({el: root(), name: 'ui:highlight', detail: {value, option: option?.el ?? null}});\n });\n\n const moveActive = (delta: 1 | -1): void => withOptionCatalog((catalog) => {\n const records = optionProjection(catalog).enabled;\n if (records.length === 0) return;\n const current = records.findIndex((option) => option.value === currentContext().navigation.activeValue);\n let index = current < 0 ? delta > 0 ? 0 : records.length - 1 : current + delta;\n if (index >= records.length) index = currentProps().loop ? 0 : records.length - 1;\n if (index < 0) index = currentProps().loop ? records.length - 1 : 0;\n setActive(records[index]?.value ?? '');\n });\n\n const setSearch = (query: string): void => withOptionCatalog((catalog) => {\n const props = currentProps();\n if (props.disabled || props.readonly) return;\n inputSearching = true;\n const first = props.autoHighlight ? optionProjection(catalog, query).enabled[0]?.value ?? '' : '';\n bridge.send({type: 'SEARCH', query, optionsId, activeValue: first});\n });\n\n const handleKeydown = (event: KeyboardEvent): void => withOptionCatalog((catalog) => {\n if (event.key === 'Tab' && popover?.presentation() !== 'anchored') {\n trapFocus(event, popoverEl());\n return;\n }\n const textInput = event.target instanceof HTMLInputElement;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n if (!isExpanded()) bridge.send({type: 'OPEN'});\n moveActive(event.key === 'ArrowDown' ? 1 : -1);\n return;\n }\n if (!textInput && isExpanded() && (event.key === 'Home' || event.key === 'End')) {\n event.preventDefault();\n const records = optionProjection(catalog).enabled;\n setActive(event.key === 'Home' ? records[0]?.value ?? '' : records.at(-1)?.value ?? '');\n return;\n }\n if (isExpanded() && (event.key === 'Enter' || (!textInput && event.key === ' '))) {\n const option = optionProjection(catalog).firstByValue.get(currentContext().navigation.activeValue);\n if (option) selectOption(option, catalog, event);\n return;\n }\n if ((event.key === 'Backspace' || event.key === 'Delete') && isPillbox() && !currentContext().search.query) {\n const inputEl = input();\n if (inputEl && (inputEl.selectionStart !== 0 || inputEl.selectionEnd !== 0)) return;\n const unfiltered = catalog.project('', currentContext().selection);\n const value = [...selectionValues()].reverse().find((candidate) => (\n !unfiltered.firstByValue.get(candidate)?.disabled\n ));\n if (value) {\n event.preventDefault();\n component.deselect(value, event);\n }\n return;\n }\n if (event.key === 'Escape' && isVisible()) {\n event.preventDefault();\n event.stopPropagation();\n bridge.send({type: 'CLOSE', restoreFocus: true});\n return;\n }\n if (!textInput && !fixedSearchAvailable(catalog) && event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {\n typeahead += event.key.toLowerCase();\n window.clearTimeout(typeaheadTimer);\n typeaheadTimer = window.setTimeout(() => { typeahead = ''; }, 500);\n const match = optionProjection(catalog).enabled.find((option) => normalizeOptionText(option.label).startsWith(typeahead));\n if (match) setActive(match.value);\n }\n });\n\n const setup = (): void => {\n const el = root();\n const activateControl = (event: Event, target: Element): boolean => {\n if (!target.closest('[data-ui-select-trigger], [data-ui-select-icon=\"trailing\"], [data-ui-select-control]')) {\n return false;\n }\n event.preventDefault();\n if (event instanceof PointerEvent || (event instanceof MouseEvent && event.detail > 0)) {\n focusElement(trigger(), {showIndicator: false});\n } else focusElement(trigger());\n if (trigger() instanceof HTMLInputElement) {\n if (!isExpanded()) bridge.send({type: 'OPEN'});\n } else component.toggle(event);\n return true;\n };\n\n addListener({target: el, event: 'click', cleanup, handler: (event) => {\n const target = event.target;\n if (!(target instanceof Element)) return;\n if (target.closest('[data-ui-select-sheet-close]')) {\n component.close(event);\n return;\n }\n const searchClear = target.closest('[data-ui-select-search-clear]');\n if (searchClear) {\n event.preventDefault();\n setSearch('');\n return;\n }\n const clear = target.closest('[data-ui-select-clear], [data-ui-select-button-clear]');\n if (clear) {\n component.clear(event);\n return;\n }\n const chipRemove = target.closest<HTMLElement>('[data-ui-select-chip-remove]');\n if (chipRemove) {\n component.deselect(chipRemove.dataset.value ?? '', event);\n return;\n }\n const optionEl = target.closest<HTMLElement>(optionSelector);\n if (optionEl) {\n withOptionCatalog((catalog) => {\n const option = optionProjection(catalog).byElement.get(optionEl);\n if (option) selectOption(option, catalog, event);\n });\n return;\n }\n if (!(event instanceof MouseEvent) || event.detail === 0) activateControl(event, target);\n }});\n addListener({target: el, event: 'input', cleanup, handler: (event) => {\n const target = event.target;\n if (!(target instanceof HTMLInputElement)) return;\n if (target.matches('[data-ui-select-input], [data-ui-select-search-input]')) setSearch(target.value);\n }});\n addListener({target: el, event: 'keydown', cleanup, handler: (event) => {\n if (event instanceof KeyboardEvent) handleKeydown(event);\n }});\n addListener({target: el, event: 'pointerdown', cleanup, handler: (event) => {\n const target = event.target;\n if (!(target instanceof Element)) return;\n if (\n target.closest(optionSelector)\n || target.closest('[data-ui-select-search-clear]')\n || target.closest('[data-ui-select-clear], [data-ui-select-button-clear], [data-ui-select-chip-remove]')\n ) {\n event.preventDefault();\n return;\n }\n activateControl(event, target);\n }});\n addListener({target: el, event: 'pointerover', cleanup, handler: (event) => {\n const target = event.target;\n if (!(target instanceof Element)) return;\n const optionEl = target.closest<HTMLElement>(optionSelector);\n if (!optionEl) return;\n withOptionCatalog((catalog) => {\n const option = optionProjection(catalog).byElement.get(optionEl);\n if (option && option.visible && !option.disabled) setActive(option.value);\n });\n }});\n addListener({target: el, event: 'focusout', cleanup, handler: (event) => {\n if (!(event instanceof FocusEvent)) return;\n const next = event.relatedTarget;\n if (next instanceof Node && el.contains(next)) return;\n if (isVisible()) bridge.send({type: 'CLOSE'});\n }});\n addListener({target: el, event: 'ui:virtualizer-total-change', cleanup, handler: (event) => {\n if (!(event instanceof CustomEvent) || !virtualizerEl()?.contains(event.target as Node)) return;\n const total = Number(event.detail?.totalItems);\n if (Number.isFinite(total) && total >= 0) {\n virtualTotal = Math.floor(total);\n virtualSearchPopulation = Math.max(virtualSearchPopulation, virtualTotal);\n }\n bridge.send({type: 'OPTIONS_CHANGED'});\n }});\n addListener({target: el, event: 'ui:virtualizer-load', cleanup, handler: (event) => {\n if (!virtualizerEl()?.contains(event.target as Node)) return;\n bridge.send({type: 'OPTIONS_CHANGED'});\n }});\n addListener({target: popoverEl(), event: 'toggle', cleanup, handler: (event) => {\n if (!('newState' in event) || event.newState !== 'closed' || !isVisible()) return;\n bridge.send({type: 'CLOSE'});\n }});\n cleanup.add(addDismissableLayer({\n isEnabled: () => bridge.hasTag('interactive'),\n roots: () => [root(), popoverEl()],\n onDismiss: () => bridge.send({type: 'CLOSE'}),\n }));\n\n const observeSelectedTemplates = (): void => {\n disconnectSelectedTemplateObservers?.();\n const observers = Array.from(root().querySelectorAll<HTMLTemplateElement>(selectedTemplateSelector))\n .map((template) => {\n const observer = new MutationObserver(() => {\n bridge.send({type: 'OPTIONS_CHANGED'});\n });\n observer.observe(template.content, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n return observer;\n });\n disconnectSelectedTemplateObservers = () => observers.forEach((observer) => observer.disconnect());\n };\n\n disconnectObserver = observeSemanticChanges({\n targets: listbox(),\n read: optionDomSignature,\n onChange: () => {\n observeSelectedTemplates();\n bridge.send({type: 'OPTIONS_CHANGED'});\n },\n observer: {\n attributes: true,\n attributeFilter: [\n 'data-disabled',\n 'data-item',\n 'data-label',\n 'data-selected',\n 'data-selected-label',\n 'data-text-value',\n 'data-ui-select-option-selected-template',\n 'data-value',\n ],\n characterData: true,\n childList: true,\n subtree: true,\n },\n });\n observeSelectedTemplates();\n };\n\n let component!: TrellisAlpineComponent<SelectData>;\n component = {\n ...bridge,\n get isOpen(): boolean {\n return this.snapshot.current?.tags.includes('expanded') ?? false;\n },\n get isSearching(): boolean {\n return this.snapshot.current?.tags.includes('searching') ?? false;\n },\n get value(): string {\n return this.snapshot.current?.context.selection[0]?.value ?? '';\n },\n get values(): readonly string[] {\n return this.snapshot.current?.context.selection.map(({value}) => value) ?? [];\n },\n get selectedLabels(): readonly string[] {\n return this.snapshot.current?.context.selection.map(({label}) => label) ?? [];\n },\n get search(): string {\n return this.snapshot.current?.context.search.query ?? '';\n },\n get activeValue(): string {\n return this.snapshot.current?.context.navigation.activeValue ?? '';\n },\n init(): void {\n cleanup = cleanupManagerFor(this);\n rootEl = this.$el;\n buttonId = this.$id('select-button');\n inputId = this.$id('select-input');\n listboxId = this.$id('select-listbox');\n optionsId = optionsEl().id || root().dataset.optionsId || this.$id('select-options');\n optionsEl().id = optionsId;\n bridge.connect(this.$el, this.snapshot);\n virtualTotal = currentProps().optionsTotalItems;\n virtualSearchPopulation = virtualTotal;\n sheetTitle().id ||= `${listboxId}-title`;\n popover = createSelectSurface({\n reference: control,\n floating: popoverEl,\n labelId: () => sheetTitle().id,\n position: () => currentProps().side,\n align: () => currentProps().align,\n gap: () => currentProps().gap,\n offset: () => currentProps().offset,\n matchReferenceWidth: true,\n });\n setup();\n syncAll();\n queueMicrotask(syncVirtualizerUrl);\n reflectControlledState = true;\n if (currentProps().open && !currentProps().disabled && !currentProps().readonly) {\n queueMicrotask(() => bridge.send({type: 'OPEN'}));\n }\n },\n destroy(): void {\n chipInstances.forEach(({instance}) => instance.destroy());\n chipInstances.clear();\n window.clearTimeout(typeaheadTimer);\n window.clearTimeout(virtualSearchTimer);\n disconnectObserver?.();\n disconnectObserver = null;\n disconnectSelectedTemplateObservers?.();\n disconnectSelectedTemplateObservers = null;\n popover?.destroy();\n popover = null;\n bridge.disconnect();\n rootEl = null;\n },\n get root(): BindingObject {\n const props = this.snapshot.current?.props ?? currentProps();\n return mergeBindings({inputs: [\n resolveStyle({part: selectStyles.parts.root, props, className: props.class}),\n {\n 'data-ui-select': '',\n ':data-state': () => (bridge.hasTag('expanded') ? 'open' : 'closed'),\n },\n ]});\n },\n open(event?: Event): void {\n event?.preventDefault();\n if (currentProps().disabled || currentProps().readonly) return;\n bridge.send({type: 'OPEN'});\n },\n close(event?: Event): void {\n event?.preventDefault();\n bridge.send({type: 'CLOSE', restoreFocus: event instanceof KeyboardEvent});\n },\n toggle(event?: Event): void {\n event?.preventDefault();\n if (currentProps().disabled || currentProps().readonly) return;\n bridge.send({type: 'TOGGLE'});\n },\n select(value: string, event?: Event): void {\n withOptionCatalog((catalog) => {\n const option = catalog.project('', currentContext().selection).firstByValue.get(value);\n if (option && !option.create) selectOption(option, catalog, event);\n });\n },\n deselect(value: string, event?: Event): void {\n withOptionCatalog((catalog) => {\n event?.preventDefault();\n if (currentProps().disabled || currentProps().readonly) return;\n const option = catalog.project('', currentContext().selection).firstByValue.get(value);\n if (option?.disabled) return;\n sendSelection('DESELECT', selectionForValues(\n selectionValues().filter((candidate) => candidate !== value),\n catalog,\n ));\n });\n },\n selectAll(event?: Event): void {\n withOptionCatalog((catalog) => {\n event?.preventDefault();\n if (!currentProps().multiple || currentProps().disabled || currentProps().readonly) return;\n const records = optionProjection(catalog).enabled;\n sendSelection('SELECT_ALL', records.map((option) => ({\n value: option.value,\n label: option.selectedLabel,\n })));\n });\n },\n clear(event?: Event): void {\n event?.preventDefault();\n event?.stopPropagation();\n if (currentProps().disabled || currentProps().readonly) return;\n inputSearching = false;\n const resetRemoteSearch = currentContext().search.query !== '';\n bridge.send({type: 'CLEAR'});\n if (resetRemoteSearch) scheduleVirtualSearch();\n },\n setSearch,\n };\n\n return component;\n};\n\nconst registerSelect = (AlpineInstance: Alpine.Alpine): void => {\n // The template directive declares markup; the component owns its instances.\n AlpineInstance.directive('ui-select', () => {});\n defineAlpineData('UiSelect', () => UiSelect(AlpineInstance))(AlpineInstance);\n};\n\nexport {registerSelect, UiSelect};\nexport type {SelectData, SelectTransition, UiSelectApi};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\nimport {registerMotionCapability} from '../../capabilities/motion';\nimport {registerSelect as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerSelect = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n registerMotionCapability(AlpineInstance);\n registerComponent(AlpineInstance);\n};\n\nexport {registerSelect};\nexport default registerSelect;\nexport * from './index';\n"],"mappings":"ypCAAA,IAAM,GAAuB,GAA0B,EAAM,KAAK,CAAC,CAAC,YAAY,EAO1E,GAAiB,GAAqC,CACnD,KAEL,GAAI,CACA,OAAO,KAAK,MAAM,CAAG,CACzB,MAAQ,CACJ,MACJ,CACJ,EAEM,IAAgB,EAAe,IAA0B,CACvD,GAAC,GAAQ,GAAS,KAEtB,OAAO,EAAK,MAAM,GAAG,CAAC,CAAC,QAAiB,EAAO,IAAQ,CAC/C,GAAyC,OAAO,GAAU,UAA1D,EACJ,OAAQ,EAAkC,EAC9C,EAAG,CAAI,CACX,ECZM,EAAiB,CAAC,OAAQ,UAAW,UAAW,OAAO,EACvD,GAAe,CAAC,UAAW,SAAU,UAAW,UAAW,QAAQ,EACnE,GAAc,EACd,EAAkB,CAAC,OAAQ,QAAQ,EACnC,EAAc,EACd,EAAsB,EACtB,EAAc,EAGP,EAAM,EAAgB,MAAM,EAC9B,EAAM,GAAc,SAAS,EAC9B,EAAM,GAAa,IAAI,EACrB,EAAM,EAAa,IAAI,EAE3B,EAAM,EAAiB,MAAM,EAC3B,EAAM,EAAa,QAAQ,EAIpB,EAAM,EAAqB,MAAM,EAMxC,EAAM,EAAa,QAAQ,EAE3B,EAAO,QAAQ,OAAO,EACf,EAAM,EAAqB,MAAM,EACxC,EAAM,GAAa,IAAI,EACtB,EAAO,QAAQ,QAAQ,EChBlC,IAAM,GAAe,CAAC,UAAW,WAAY,UAAW,QAAQ,EAC1D,GAAkB,GAClB,EAAe,EACf,EAAe,EACf,GAAe,GACf,EAAgB,GAChB,EAAuB,EACvB,EAAgB,CAAC,OAAQ,OAAO,EAChC,GAAe,CAAC,QAAS,WAAY,MAAM,EAC3C,GAAkB,EA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eAAkB,EAAS,CAAc,CAAC,CAAC,CAAC,CAAc,CAC/E,EC71CM,GAAa,IAAI,QAEjB,GAAkB,GAAqC,CACrD,GAAW,IAAI,CAAc,IACjC,GAAW,IAAI,CAAc,EAC7B,EAAyB,CAAc,EACvC,EAAkB,CAAc,EACpC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,t}from"./dom-DiTFTWeR.js";import{C as n,_ as r,d as i,g as a,h as o,o as s,s as c}from"./motion-B90yNOaV.js";import{t as l}from"./capability-motion-D_BJBnwB.js";import{c as u,f as d,l as f,n as p,o as m}from"./codecs-CQ7olTJL.js";import{i as h,t as g}from"./alpine-machine-CE2UN4Qu.js";import{n as _,t as v}from"./alpine-data-Dvc_bXq6.js";import{n as y,t as b}from"./styles-CX2j92ex.js";import{t as x}from"./machine-CNnHDbyo.js";import{n as S,t as C}from"./item-template-DSfME41Q.js";var w={x:!1,y:!1};function T(){return w.x||w.y}function E(e,t){let n=a(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function D(e){return!(e.pointerType===`touch`||T())}function O(e,t,n={}){let[r,i,a]=E(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!D(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var k=[`info`,`success`,`warning`,`danger`,`debug`],ee=[`auto`,`neutral`,`accent`,`success`,`warning`,`danger`],te=[`default`,`soft`,`surface`,`solid`,`outline`],ne=[`top-right`,`top-left`,`top-center`,`bottom-right`,`bottom-left`,`bottom-center`],A={level:f(k,`info`),color:f(ee,`auto`),variant:f(te,`default`),title:d,description:d,duration:u.default(5e3).min(0),dismissible:p.default(!0),class:d,contentClass:d,closeClass:d},j={id:d.default(`ui-toast-root`),position:f(ne,`top-right`),duration:u.default(5e3).min(0),includeMessages:p.default(!0),maxItems:u.default(3).min(0),class:d},M=[h({name:`opening`,state:`opening`,project:()=>({}),onDone:`OPENING_DONE`,onError:`OPENING_ERROR`}),h({name:`closing`,state:`closing`,project:({context:e})=>({reason:e.dismissal.reason}),onDone:`CLOSING_DONE`,onError:`CLOSING_ERROR`})],N=e=>e===`outlet`||e===`visibility`||e===`consumer`||e===`gesture`?e:null,P=(e,t)=>e.props??t,F=({event:e,props:t})=>P(e,t).duration!==t.duration,re=({event:e,props:t})=>F({event:e,props:t})&&P(e,t).duration===0,I=({event:e,props:t})=>F({event:e,props:t})&&P(e,t).duration>0,ie=(e,t)=>x({initial:`idle`,states:{idle:{on:{OPEN:{target:`opening`,effects:`prepareOpen`},PAUSE:{guard:`addsPauseSource`,reduce:`addPauseSource`},RESUME:{guard:`hasPauseSource`,reduce:`removePauseSource`},PROPS_CHANGED:{reduce:`reconcileProps`,effects:`syncProps`}}},opening:{tags:[`visible`,`expanded`,`transitioning`],on:{OPENING_DONE:[{target:`open.persistent`,guard:`isPersistent`,effects:`finishOpen`},{target:`open.paused`,guard:`isPaused`,effects:`finishOpen`},{target:`open.running`,effects:`finishOpen`}],OPENING_ERROR:[{target:`open.persistent`,guard:`isPersistent`,effects:`finishOpen`},{target:`open.paused`,guard:`isPaused`,effects:`finishOpen`},{target:`open.running`,effects:`finishOpen`}],PAUSE:{guard:`addsPauseSource`,reduce:`addPauseSource`},RESUME:{guard:`hasPauseSource`,reduce:`removePauseSource`},PROPS_CHANGED:{reduce:`reconcileProps`,effects:`syncProps`},DISMISS:{target:`closing`,reduce:`dismiss`,effects:`prepareClose`}}},open:{id:`open`,initial:`running`,tags:[`visible`,`expanded`,`open`],on:{DISMISS:{target:`closing`,reduce:`dismiss`,effects:`prepareClose`}},states:{persistent:{on:{PAUSE:{guard:`addsPauseSource`,reduce:`addPauseSource`},RESUME:{guard:`hasPauseSource`,reduce:`removePauseSource`},PROPS_CHANGED:[{target:`paused`,guard:`becomesTimedWhilePaused`,reduce:`reconcileProps`,effects:`syncProps`},{target:`running`,guard:`becomesTimed`,reduce:`reconcileProps`,effects:`syncProps`},{reduce:`reconcileProps`,effects:`syncProps`}]}},running:{entry:`startTimer`,exit:`stopTimer`,on:{PAUSE:{target:`paused`,guard:`addsPauseSource`,reduce:`addPauseSource`},TICK:{reduce:`tick`},PROPS_CHANGED:[{target:`persistent`,guard:`becomesPersistent`,reduce:`reconcileProps`,effects:`syncProps`},{target:`running`,guard:`durationChanges`,reduce:`reconcileProps`,effects:`syncProps`},{reduce:`reconcileProps`,effects:`syncProps`}]}},paused:{tags:[`paused`],on:{PAUSE:{guard:`addsPauseSource`,reduce:`addPauseSource`},RESUME:[{target:`running`,guard:`releasesFinalPauseSource`,reduce:`removePauseSource`},{guard:`hasPauseSource`,reduce:`removePauseSource`}],PROPS_CHANGED:[{target:`persistent`,guard:`becomesPersistent`,reduce:`reconcileProps`,effects:`syncProps`},{reduce:`reconcileProps`,effects:`syncProps`}]}}}},closing:{tags:[`visible`,`transitioning`],on:{PROPS_CHANGED:{reduce:`reconcileProps`,effects:`syncProps`},CLOSING_DONE:{target:`removed`,effects:`finishClose`},CLOSING_ERROR:{target:`removed`,effects:`finishClose`}}},removed:{tags:[`removed`],on:{PROPS_CHANGED:{reduce:`reconcileProps`,effects:`syncProps`}}}}},{context:{timer:{remaining:e.duration,pauseSources:[]},dismissal:{reason:`api`}},props:e,reducers:{reconcileProps:({context:e,event:t,props:n})=>{let r=P(t,n);return{context:r.duration===n.duration?e:{...e,timer:{...e.timer,remaining:r.duration}},props:r}},addPauseSource:({context:e,event:t})=>({context:{...e,timer:{remaining:e.timer.pauseSources.length===0&&typeof t.remaining==`number`?t.remaining:e.timer.remaining,pauseSources:[...e.timer.pauseSources,N(t.source)]}}}),removePauseSource:({context:e,event:t})=>({context:{...e,timer:{...e.timer,pauseSources:e.timer.pauseSources.filter(e=>e!==t.source)}}}),tick:({context:e,event:t})=>({context:{...e,timer:{...e.timer,remaining:Math.max(0,Number(t.remaining)||0)}}}),dismiss:({context:e,event:t})=>({context:{...e,dismissal:{reason:t.reason===`timeout`||t.reason===`close`||t.reason===`swipe`?t.reason:`api`}}})},guards:{isPersistent:({props:e})=>e.duration===0,isPaused:({context:e})=>e.timer.pauseSources.length>0,addsPauseSource:({context:e,event:t})=>{let n=N(t.source);return n!==null&&!e.timer.pauseSources.includes(n)},hasPauseSource:({context:e,event:t})=>{let n=N(t.source);return n!==null&&e.timer.pauseSources.includes(n)},releasesFinalPauseSource:({context:e,event:t})=>{let n=N(t.source);return n!==null&&e.timer.pauseSources.length===1&&e.timer.pauseSources[0]===n},durationChanges:F,becomesPersistent:re,becomesTimed:I,becomesTimedWhilePaused:e=>I(e)&&e.context.timer.pauseSources.length>0},effects:{prepareOpen:({props:e})=>t.prepareOpen(e),finishOpen:t.finishOpen,startTimer:({context:e})=>t.startTimer(e.timer.remaining),stopTimer:t.stopTimer,prepareClose:t.prepareClose,syncProps:({props:e})=>t.syncProps(e),finishClose:({context:e})=>t.finishClose(e.dismissal.reason)}}),L=b({definition:{component:`ui.toast`,parts:{root:{base:[`group/toast pointer-events-auto relative grid w-full min-w-0 items-center gap-x-3 gap-y-1 overflow-hidden rounded-overlay-md px-3 py-2.5 outline-none`,`data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0`],variants:{variant:{default:``,soft:``,surface:``,solid:``,outline:``},color:{neutral:``,accent:``,success:``,warning:``,danger:``},hasMarker:{true:`grid-cols-[auto_minmax(0,1fr)_auto]`,false:`grid-cols-[minmax(0,1fr)_auto]`},hasDescription:{true:``,false:``}},defaults:{variant:`default`,color:`neutral`,hasMarker:!1,hasDescription:!1}},marker:{base:`size-2 self-center rounded-full`,variants:{color:{neutral:`hidden`,accent:``,success:``,warning:``,danger:``},variant:{default:`hidden`,soft:``,surface:``,solid:`hidden`,outline:``}},defaults:{color:`neutral`,variant:`default`}},content:{base:`grid min-w-0 gap-0.5 self-center`},title:{base:`min-w-0`},description:{base:`min-w-0`},close:{base:[`-mr-1 inline-flex size-control-md shrink-0 items-center justify-center self-center rounded-full outline-none`]},closeIcon:{base:`size-icon fill-current`},outlet:{base:[`pointer-events-none fixed z-toast flex w-[min(24rem,calc(100vw-2rem))] flex-col gap-2`],variants:{position:{"top-right":`right-4 top-4 justify-items-end`,"top-left":`left-4 top-4 justify-items-start`,"top-center":`left-1/2 top-4 -translate-x-1/2 justify-items-center`,"bottom-right":`bottom-4 right-4 justify-items-end`,"bottom-left":`bottom-4 left-4 justify-items-start`,"bottom-center":`bottom-4 left-1/2 -translate-x-1/2 justify-items-center`}},defaults:{position:`top-right`}}}}}),R=e=>[`info`,`success`,`warning`,`danger`,`debug`].includes(String(e)),z=e=>[`auto`,`neutral`,`accent`,`success`,`warning`,`danger`].includes(String(e)),B=e=>[`default`,`soft`,`surface`,`solid`,`outline`].includes(String(e)),V=e=>e===`info`?`accent`:e===`success`||e===`warning`||e===`danger`?e:`neutral`,H=(e,t)=>z(e)&&e!==`auto`?e:V(t),U=(e,t)=>{let n=typeof e==`number`?e:Number(e);return Number.isFinite(n)&&n>=0?n:t},W=e=>{let t=e.style;return`translateY(${Number.parseFloat(t.getPropertyValue(`--ui-toast-stack-offset`))||0}px) scale(${Number.parseFloat(t.getPropertyValue(`--ui-toast-stack-scale`))||1})`},G=e=>Array.from(e.querySelectorAll(`:scope > [data-ui-toast]`)).filter(e=>e.dataset.state!==`closing`&&e.dataset.state!==`closed`),K=e=>{i(e)},q=(e,t=!1,n)=>{let r=n??e.getBoundingClientRect().height;K(e);let i=Array.from(e.querySelectorAll(`:scope > [data-ui-toast]`));e.dataset.stack=i.length>1?`collapsed`:`single`;let a=getComputedStyle(e),o=Number.parseFloat(a.rowGap||a.gap||`0`)||0,l=i.map(e=>Math.ceil(e.scrollHeight||e.getBoundingClientRect().height)),u=Number.parseFloat(a.getPropertyValue(`--ui-toast-stack-peek`))||8,d=e.dataset.position?.startsWith(`bottom`)?-1:1,f=e.dataset.stackExpanded===`true`,p=Math.min(Math.max(0,i.length-1),3);e.style.setProperty(`--ui-toast-front-height`,`${l[0]??0}px`),e.style.setProperty(`--ui-toast-stack-height`,`${(l[0]??0)+p*u}px`),e.style.setProperty(`--ui-toast-stack-expanded-height`,`${l.reduce((e,t)=>e+t,0)+Math.max(0,i.length-1)*o}px`);let m=e.getBoundingClientRect().height;if(t&&Math.abs(r-m)>=1){let t=e.style.height;c(e,{keyframes:{height:[`${r}px`,`${m}px`]},role:`layout`,cleanup:()=>{e.style.height=t}})}let h=0;i.forEach((n,r)=>{let a=Math.min(r,3),c=f?h*d:a*u*d,p=f?1:Math.max(.91,1-a*.03),m=f?1:Math.max(.72,1-a*.08);f&&(h+=(l[r]??0)+o),n.dataset.stackIndex=String(r),n.dataset.swipeAxis=e.dataset.position?.endsWith(`left`)||e.dataset.position?.endsWith(`right`)?`x`:`y`,n.style.setProperty(`--ui-toast-stack-index`,String(r)),n.style.setProperty(`--ui-toast-stack-depth`,String(a)),n.style.setProperty(`--ui-toast-stack-direction`,String(d)),n.style.setProperty(`--ui-toast-outside`,d>0?`-100%`:`100%`),n.style.setProperty(`--ui-toast-stack-offset`,`${c}px`),n.style.setProperty(`--ui-toast-stack-scale`,String(p)),n.style.setProperty(`--ui-toast-stack-opacity`,String(m)),n.style.zIndex=String(i.length-r);let g=`translateY(${c}px) scale(${p})`;n.dataset.swiping!==`true`&&(t&&n.dataset.state===`open`?s(n).animate({opacity:m,transform:g}).role(`layout`).play():n.dataset.state===`open`&&(n.style.opacity=String(m),n.style.transform=g))})},J=(e,t)=>{e.dispatchEvent(new CustomEvent(`ui:toast-dismiss-request`,{detail:{reason:t}}))},Y=(e,t)=>{t!==0&&G(e).slice(t).forEach(e=>J(e,`api`))},X=(e,t)=>{let n=H(t.color,t.level),r=e.dataset.description===`true`||!!t.description.trim(),i=n!==`neutral`&&t.variant!==`solid`&&t.variant!=="default",a=t.level===`danger`||t.level===`warning`;if(Object.entries({level:t.level,color:n,variant:t.variant,duration:String(t.duration),dismissible:String(t.dismissible)}).forEach(([t,n])=>{e.dataset[t]!==n&&(e.dataset[t]=n)}),e.setAttribute(`role`,a?`alert`:`status`),e.setAttribute(`aria-live`,a?`assertive`:`polite`),e.querySelectorAll(`[data-ui-toast-close]`).forEach(e=>{e.hidden=!t.dismissible}),e.hasAttribute(`data-ui-toast-recipe`)){let a=y({part:L.parts.root,props:{variant:t.variant,color:n,hasDescription:r,hasMarker:i},className:t.class});e.className!==a&&(e.className=a),e.querySelector(`[data-ui-toast-marker]`)?.setAttribute(`class`,y({part:L.parts.marker,props:{variant:t.variant,color:n}})),e.querySelectorAll(`[data-ui-toast-content]`).forEach(e=>{e.className=y({part:L.parts.content,className:t.contentClass})}),e.querySelectorAll(`[data-ui-toast-title]`).forEach(e=>{e.className=`text-sm font-medium ${y({part:L.parts.title})}`}),e.querySelectorAll(`[data-ui-toast-description]`).forEach(e=>{e.className=`text-sm ${y({part:L.parts.description})}`}),e.querySelectorAll(`[data-ui-toast-close]`).forEach(e=>{e.className=y({part:L.parts.close,className:t.closeClass})})}},Z=()=>{let a=null,s,c=0,l=null,u=null,d=!1,f=null,p=()=>{if(!a)throw Error(`Toast has not been initialized.`);return a},m=()=>p().parentElement?.matches(`[data-ui-toast-outlet]`)?p().parentElement:null,h=()=>l===null?y.getSnapshot().context.timer.remaining:Math.max(0,c-performance.now()),_=()=>{l!==null&&clearTimeout(l),u!==null&&clearInterval(u),l=u=null},y=g({schema:A,hooks:M,createMachine:({props:t})=>ie(t,{prepareOpen:e=>{p().dataset.state=`opening`,X(p(),e),m()&&q(m(),!0)},finishOpen:()=>{p().dataset.state=`open`,m()&&q(m(),!0)},startTimer:e=>{e<=0||(c=performance.now()+e,l=window.setTimeout(()=>y.send({type:`DISMISS`,reason:`timeout`}),e),u=window.setInterval(()=>y.send({type:`TICK`,remaining:h()}),100))},stopTimer:_,prepareClose:()=>{_(),p().dataset.state=`closing`,m()&&q(m(),!0)},finishClose:t=>{let n=p(),r=m();n.dataset.state=`closed`,e({el:n,name:`ui:dismiss`,detail:{reason:t}}),n.remove(),r&&q(r,!0)},syncProps:e=>{X(p(),e),m()&&q(m())}})}),b=e=>{d||y.send({type:`PAUSE`,source:e,remaining:h()})},x=e=>{d||y.send({type:`RESUME`,source:e})};return{...y,get isOpen(){return this.snapshot.current?.tags.includes(`open`)??!1},get isPaused(){return(this.snapshot.current?.context.timer.pauseSources.length??0)>0},get remaining(){return this.snapshot.current?.context.timer.remaining??0},init(){s=v(this),a=this.$el,y.connect(this.$el,this.snapshot),document.hidden&&b(`visibility`),t({target:p(),event:`click`,handler:e=>{let t=e.target;y.getSnapshot().props.dismissible&&t instanceof Element&&t.closest(`[data-ui-toast-close]`)&&y.send({type:`DISMISS`,reason:`close`})},cleanup:s}),t({target:p(),event:`ui:toast-dismiss-request`,handler:e=>{let t=e instanceof CustomEvent?e.detail?.reason:`api`;y.send({type:`DISMISS`,reason:t})},cleanup:s}),t({target:p(),event:`ui:toast-pause-request`,handler:e=>{e instanceof CustomEvent&&e.detail?.paused===!0?b(`outlet`):x(`outlet`)},cleanup:s}),t({target:document,event:`visibilitychange`,handler:()=>document.hidden?b(`visibility`):x(`visibility`),cleanup:s}),t({target:p(),event:`pointerdown`,handler:e=>{if(!(e instanceof PointerEvent)||!e.isPrimary||e.button!==0||!y.getSnapshot().props.dismissible||e.target instanceof Element&&e.target.closest(`button, a, input, select, textarea`))return;let t=p(),a=m()?.dataset.position??`bottom-right`,s=a.endsWith(`left`)||a.endsWith(`right`),c=s?a.endsWith(`left`)?-1:1:a.startsWith(`top`)?-1:1,l=s?e.clientX:e.clientY,u=performance.now(),h=W(t),g=Number.parseFloat(t.style.getPropertyValue(`--ui-toast-stack-opacity`))||1,_=r(0);f?.(),i(t),b(`gesture`),t.dataset.swiping=`true`,t.setPointerCapture(e.pointerId);let v=_.on(`change`,e=>{let n=s?`translateX(${e}px)`:`translateY(${e}px)`;t.style.transform=`${h} ${n}`;let r=Math.abs(e),i=s?t.offsetWidth:t.offsetHeight;t.style.opacity=String(Math.max(.35,g*(1-r/Math.max(i*2,1))))}),S=!1,C=()=>{window.removeEventListener(`pointermove`,T),window.removeEventListener(`pointerup`,E),window.removeEventListener(`pointercancel`,D)},w=()=>{S||(S=!0,C(),v(),delete t.dataset.swiping,f===w&&(f=null))},T=t=>{if(t.pointerId!==e.pointerId)return;t.preventDefault();let n=(s?t.clientX:t.clientY)-l;_.set(n*c>=0?n:n*.2)},E=(r,i=!1)=>{if(r.pointerId!==e.pointerId)return;C();let a=_.get(),l=Math.max(1,performance.now()-u),f=Math.abs(a)/l,p=!i&&a*c>0&&(Math.abs(a)>=45||f>.11),m=p?o(_,c*(s?window.innerWidth:window.innerHeight),n.gestureExit):o(_,0,{type:`spring`,...n.gestureSettle}),v=o(t,{opacity:p?0:g},n.gestureExit);Promise.allSettled([m.finished,v.finished]).then(()=>{w(),!d&&(x(`gesture`),p?J(t,`swipe`):(t.style.opacity=String(g),t.style.transform=h))})},D=e=>E(e,!0);f=w,window.addEventListener(`pointermove`,T),window.addEventListener(`pointerup`,E),window.addEventListener(`pointercancel`,D)},cleanup:s}),y.send(`OPEN`)},destroy(){d=!0,f?.(),_(),y.disconnect(),a=null},dismiss(){y.send({type:`DISMISS`,reason:`api`})},pause(){b(`consumer`)},resume(){x(`consumer`)}}},Q=e=>{let n=new Set,r=new Set,i=null,a,o=e=>{i?.querySelectorAll(`:scope > [data-ui-toast]`).forEach(t=>{t.dispatchEvent(new CustomEvent(`ui:toast-pause-request`,{detail:{paused:e}}))})},s=e=>{let t=n.size===0;if(n.add(e),!i||!t)return;let r=i.getBoundingClientRect().height;i.dataset.stackExpanded=`true`,o(!0),q(i,!0,r)},c=e=>{if(n.delete(e),!i||n.size>0)return;let t=i.getBoundingClientRect().height;delete i.dataset.stackExpanded,o(!1),q(i,!0,t)};return{props:null,init(){a=v(this),this.props=m({el:this.$el,schema:j,onChange:()=>this.sync()});let e=this.$el;i=e,this.sync(),a.add(O(e,()=>(s(`pointer`),()=>c(`pointer`)))),t({target:e,event:`focusin`,handler:()=>s(`focus`),cleanup:a}),t({target:e,event:`focusout`,handler:()=>queueMicrotask(()=>{e.contains(document.activeElement)||c(`focus`)}),cleanup:a}),t({target:document,event:`ui:toast`,handler:e=>this.add(e instanceof CustomEvent?e.detail:{}),cleanup:a}),queueMicrotask(()=>Y(e,this.props.maxItems))},destroy(){r.forEach(e=>e.destroy()),r.clear(),i&&K(i),this.props.disconnect(),n.clear(),i=null},sync(){let e=this.$el;e.id=this.props.id,e.dataset.position=this.props.position,e.dataset.duration=String(this.props.duration),e.dataset.maxItems=String(this.props.maxItems),e.className=y({part:L.parts.outlet,props:{position:this.props.position},className:this.props.class}),q(e),Y(e,this.props.maxItems)},add(t){let i=typeof t.title==`string`?t.title:``,a=typeof t.description==`string`?t.description:``;if(!i.trim()&&!a.trim())return;let o=this.$el,s=S(o,`x-ui-toast:item`);if(!s)throw Error(`A toast outlet requires an item template.`);let c={title:i,description:a,level:R(t.level)?t.level:`info`,color:z(t.color)?t.color:`auto`,variant:B(t.variant)?t.variant:`default`,duration:U(t.duration,this.props.duration),dismissible:typeof t.dismissible!=`boolean`||t.dismissible},l=C(e,s,{$toast:c}),u=l.element;u.hasAttribute(`x-data`)||u.setAttribute(`x-data`,`UiToast`),u.dataset.uiToast=``,Object.entries(c).forEach(([e,t])=>{u.dataset[e]=String(t)}),u.dataset.description=String(!!a.trim()),r.add(l),e.onElRemoved(u,()=>r.delete(l)),u.addEventListener(`ui:dismiss`,()=>{r.delete(l),queueMicrotask(()=>l.destroy())},{once:!0}),l.mount(o,o.firstChild),n.size>0&&u.dispatchEvent(new CustomEvent(`ui:toast-pause-request`,{detail:{paused:!0}})),q(o),Y(o,this.props.maxItems)}}},ae=e=>{e.directive(`ui-toast`,()=>{}),_(`UiToast`,Z)(e),_(`UiToastOutlet`,()=>Q(e))(e)},$=new WeakSet,oe=e=>{$.has(e)||($.add(e),l(e),ae(e))};export{Z as n,Q as r,oe as t};
|
|
2
|
+
//# sourceMappingURL=entry.generated-ChoqPigj.js.map
|