@dk-address/web 0.0.0-stage → 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dyrhoi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,42 @@
1
- # Temporary Holding Version
1
+ # @dk-address/web
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Danish address autocomplete as unstyled web components, built on [KDS Adressevælger](https://confluence.kds.dk/spaces/ADV/pages/234782998), the replacement for DAWA's autocomplete. It works in plain HTML and in any framework, and needs no API key.
4
+
5
+ Load it from a CDN:
6
+
7
+ ```html
8
+ <script
9
+ type="module"
10
+ src="https://cdn.jsdelivr.net/npm/@dk-address/web@0.1/dist/dk-address.js"
11
+ ></script>
12
+ ```
13
+
14
+ Or install it, and import it once in your app:
15
+
16
+ ```sh
17
+ npm i @dk-address/web
18
+ ```
19
+
20
+ ```js
21
+ import "@dk-address/web";
22
+ ```
23
+
24
+ Then build the field from its parts:
25
+
26
+ ```html
27
+ <dk-address name="address" id-name="address_id">
28
+ <dk-address-label>Address</dk-address-label>
29
+ <dk-address-input><input /></dk-address-input>
30
+ <dk-address-popup hidden>
31
+ <dk-address-list></dk-address-list>
32
+ </dk-address-popup>
33
+ </dk-address>
34
+
35
+ <script type="module">
36
+ document.querySelector("dk-address").addEventListener("addressselect", (event) => {
37
+ console.log(event.detail.details);
38
+ });
39
+ </script>
40
+ ```
41
+
42
+ In a form, the text submits under `name` and the picked address's id under `id-name`. Read [Use it without React](https://dk-address.dyrhoi.com/docs/guides/vanilla) to style it, prefill it from a saved id and read its state.
@@ -0,0 +1,5 @@
1
+ var Bu=Object.defineProperty;var _u=(e)=>e;function zu(e,t){this[e]=_u.bind(null,t)}var Yu=(e,t)=>{for(var n in t)Bu(e,n,{get:t[n],enumerable:!0,configurable:!0,set:zu.bind(t,n)})};var ue=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};function gt(){return be&&(/iP(hone|ad|od)/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function sn(e){return!!e&&be&&getComputedStyle(e).direction==="rtl"}var be;var Ie=ue(()=>{be=typeof window<"u"&&typeof document<"u"});function jd(e,t){let n=Vs.get(e);if(!n)Vs.set(e,n={});let r=n[t];if(r?.isConnected)return r;let o=e.createElement("div");return o.setAttribute("role",t==="assertive"?"alert":"status"),o.setAttribute("aria-live",t),o.setAttribute("aria-atomic","true"),o.setAttribute("data-ui-sdk-announcer",t==="assertive"?"assertive":""),o.style.cssText="position:fixed;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap",e.body.append(o),n[t]=o,o}function Ks(e,{priority:t="polite",doc:n=typeof document>"u"?void 0:document}={}){if(!e)return;if(qs)return qs(e,t);if(!n?.body)return;let r=jd(n,t);r.textContent="",clearTimeout(Hs[t]),Hs[t]=setTimeout(()=>{r.textContent=e},100)}var Vs,qs,Hs;var Bs=ue(()=>{Vs=new WeakMap,Hs={}});function Ke(e,t,n){let r=e.style.getPropertyValue(t),o=e.style.getPropertyPriority(t);e.style.setProperty(t,n);let s=e.style.getPropertyValue(t);return()=>{if(e.style.getPropertyValue(t)!==s)return;if(r)e.style.setProperty(t,r,o);else e.style.removeProperty(t)}}function Xr(e){if(typeof CSS>"u"||!CSS.registerProperty)return;for(let t of e){if(ia.has(t))continue;ia.add(t);try{CSS.registerProperty({name:t,syntax:"*",inherits:!1})}catch{}}}function aa(e){if(Yr.has(e))return Yr.get(e);let t;for(let r=e;r&&!t;r=r.defaultView?.frameElement?.ownerDocument)t=r.head?.querySelector('meta[property="csp-nonce"]');let n=t?t.nonce||t.getAttribute("nonce")||"":null;return Yr.set(e,n),n}function xe(e,t,n){if(!e.head)return;let r=e.defaultView;if(aa(e)===""&&r&&"adoptedStyleSheets"in e)Ud(e,r,t,n);else Yd(e,t,n)}function Yd(e,t,n){let r=e.getElementById(t);if(r){if(Ur.get(r)===n)return;if(r.textContent!==n)r.textContent=n;Ur.set(r,n);return}let o=e.createElement("style");o.id=t;let s=aa(e);if(s)o.nonce=s;o.textContent=n,Ur.set(o,n);let a=e.head.querySelectorAll(':scope > style[id^="ui-sdk-"]');if(a.length)a[a.length-1].after(o);else e.head.prepend(o)}function Ud(e,t,n,r){let o=sa().get(e);if(!o)sa().set(e,o=new Map);let s=o.get(n);if(!s)o.set(n,s={sheet:new t.CSSStyleSheet,css:""});if(s.css!==r)s.sheet.replaceSync(r),s.css=r;if(!e.adoptedStyleSheets.includes(s.sheet))e.adoptedStyleSheets=[...e.adoptedStyleSheets,s.sheet]}function Gr(e){xe(e,"ui-sdk-hidden",'@layer ui-sdk { :where([data-slot][hidden]:not([hidden="until-found"])) { display: none !important } }')}function Nt(e){if(typeof window>"u")return;if(!performance.getEntriesByType("paint").length)e();else if($t)$t.push(e);else $t=[e],(window.requestIdleCallback??setTimeout)(()=>{let t=$t;$t=void 0,t.forEach((n)=>n())})}function la(e){let t,n=requestAnimationFrame(()=>{t=setTimeout(e)});return()=>{cancelAnimationFrame(n),clearTimeout(t)}}var ia,sa=()=>globalThis[Symbol.for("ui-sdk.styles@1")]??=new WeakMap,Yr,Ur,$t;var Oe=ue(()=>{ia=new Set;Yr=new WeakMap;Ur=new WeakMap});function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Mn(e){let t="nativeEvent"in e?e.nativeEvent:e;return t.isComposing===!0||t.keyCode===229}var Se=()=>{};function Wn(e){if(!e.towardMore)return e.scrollAtStart?"sheet":"scroll";return!e.atLargest&&e.expandOnScroll?"sheet":"scroll"}var yo=()=>{};function Bf(e,t){return e*t/(1-t)}function vo(e){let{extent:t,velocity:n,candidates:r}=e;if(Math.abs(n)<e.minFlingVelocity)return $e(r,t);let o=t+Bf(n,e.rate),s=_f(r,t,Math.sign(n)),a=$e(r,o);if((n>0?r[a]<=t+0.5:r[a]>=t-0.5)&&s!==-1)a=s;if(!e.skipSnapPoints&&s!==-1)a=n>0?Math.min(a,s):Math.max(a,s);return a}function $e(e,t){let n=0;for(let r=1;r<e.length;r++)if(Math.abs(e[r]-t)<Math.abs(e[n]-t))n=r;return n}function _f(e,t,n){if(n>0)return e.findIndex((r)=>r>t+0.5);for(let r=e.length-1;r>=0;r--)if(e[r]<t-0.5)return r;return-1}var jn=()=>{};function xo(e,t,n=wo){if(e<=0)return 0;return(1-1/(e*n/t+1))*t}function Vn(e,t,n=wo){if(e<=0)return 0;return(1/(1-Math.min(e/t,0.999999))-1)*t/n}function yl(e,t,n=wo){if(e<=0)return 1;let r=e*n/t+1;return n/(r*r)}var wo=0.55;var vl=()=>{};function kt(e,t,n,r){let o=2*Math.PI/(e*1000),s=t;if(Math.abs(s-1)<0.000001)return Yf(o,n,r);if(s<1)return zf(o,s,n,r);return Uf(o,s,n,r)}function zf(e,t,n,r){let o=t*e,s=e*Math.sqrt(1-t*t),a=(r+o*n)/s;return{position:(i)=>Math.exp(-o*i)*(n*Math.cos(s*i)+a*Math.sin(s*i)),velocity:(i)=>{let l=Math.cos(s*i),c=Math.sin(s*i);return Math.exp(-o*i)*((a*s-o*n)*l-(n*s+o*a)*c)}}}function Yf(e,t,n){let r=n+e*t;return{position:(o)=>Math.exp(-e*o)*(t+r*o),velocity:(o)=>Math.exp(-e*o)*(r-e*(t+r*o))}}function Uf(e,t,n,r){let o=Math.sqrt(t*t-1),s=-e*(t+o),a=-e*(t-o),i=(r-s*n)/(a-s),l=n-i;return{position:(c)=>i*Math.exp(a*c)+l*Math.exp(s*c),velocity:(c)=>i*a*Math.exp(a*c)+l*s*Math.exp(s*c)}}function qn(e,{positionTolerance:t=0.5,velocityTolerance:n=0.02,step:r=1,limit:o=1e4}={}){for(let s=0;s<=o;s+=r)if(Math.abs(e.position(s))<=t&&Math.abs(e.velocity(s))<=n)return s;return o}function Hn(e,t,n,r,o=8.333333333333334){let s=n-t;if(Math.abs(s)<0.000001)return"linear";let a=[];for(let i=0;i<r;i+=o)a.push(Xf(1+e.position(i)/s));return a.push("1"),`linear(${a.join(", ")})`}function Xf(e){return String(Math.round(e*1e4)/1e4)}var Kn=()=>{};function he(e,t){return{phase:"idle",extent:e,restingIndex:t}}function Bn(e,t,n){switch(t.type){case"down":return Qf(e,t,n);case"move":return Jf(e,t,n);case"up":return tp(e,t,n);case"settled":return np(e);case"rest":return rp(e,t,n);case"snap-to":return op(e,t,n);case"nudge":return ip(e,t,n);case"close":return st(e,n,{targetIndex:-1,motion:So(e,t.time),time:t.time,reason:"imperative",outcome:{type:"dismiss",reason:"imperative"}})}}function So(e,t){if(e.phase!=="settling")return{extent:e.extent,velocity:0};let n=kt(e.response,e.dampingRatio,e.from-e.to,e.velocity),r=Math.max(0,t-e.startTime);return{extent:e.to+n.position(r),velocity:n.velocity(r)}}function Qf(e,t,n){let r=t.pointer==="mouse"?n.physics.mouseSlop:n.physics.touchSlop;if(e.phase==="idle"&&e.restingIndex>=0)return{state:{...e,phase:"pending",originX:t.x,originY:t.y,slop:r},effects:Ae};if(e.phase!=="settling")return{state:e,effects:Ae};let{extent:o}=So(e,t.time);return{state:{phase:"dragging",extent:o,restingIndex:e.restingIndex,anchorY:t.y,anchorExtent:sp(o,n),lastY:t.y,isScrollingContent:!1},effects:[{type:"move",extent:o}]}}function Jf(e,t,n){if(e.phase==="pending")return Zf(e,t,n);if(e.phase==="scrolling"&&n.contentScroll)return n.contentScroll.move(e,t);if(e.phase==="dragging")return ep(e,t,n);return{state:e,effects:Ae}}function Zf(e,t,n){let r=t.x-e.originX,o=t.y-e.originY;if(Math.max(Math.abs(r),Math.abs(o))<e.slop)return{state:e,effects:Ae};if(Math.abs(r)>Math.abs(o))return{state:he(e.extent,e.restingIndex),effects:Ae};let s=n.contentScroll?.claim(e,t,o<0,n);if(s)return{state:s,effects:Ae};let a={...ko(e,e.originY+Math.sign(o)*e.slop),lastY:t.y},i=wl(a.anchorExtent+(a.anchorY-t.y),n);return{state:{...a,extent:i},effects:[{type:"move",extent:i}]}}function ko(e,t){return{phase:"dragging",extent:e.extent,restingIndex:e.restingIndex,anchorY:t,anchorExtent:e.extent,lastY:t,isScrollingContent:!1}}function ep(e,t,n){let r=e.lastY-t.y,o=e.isScrollingContent?{anchorY:e.lastY,anchorExtent:e.extent}:e,s=o.anchorExtent+(o.anchorY-t.y),a=n.contentScroll?.drag(e,t,r,s,n);if(a)return a;let i=wl(s,n);return{state:{...e,anchorY:o.anchorY,anchorExtent:o.anchorExtent,extent:i,lastY:t.y,isScrollingContent:!1},effects:[{type:"move",extent:i}]}}function tp(e,t,n){if(e.phase==="pending"||e.phase==="scrolling")return{state:he(e.extent,e.restingIndex),effects:Ae};if(e.phase!=="dragging")return{state:e,effects:Ae};let r=n.contentScroll?.release(e,t,n);if(r)return r;let o=-t.velocity*ap(e.extent,n),s=[0,...xl(n)],a=n.physics,i={candidates:s,rate:a.projectionRate,minFlingVelocity:a.minFlingVelocity,skipSnapPoints:a.skipSnapPoints},l=vo({...i,extent:e.extent,velocity:o}),c={motion:{extent:e.extent,velocity:o},time:t.time,reason:"swipe"};if(n.dismissible){if(l>0)return st(e,n,{...c,targetIndex:l-1});return st(e,n,{...c,targetIndex:-1,outcome:{type:"dismiss",reason:"swipe"}})}let d=e.anchorExtent+(e.anchorY-e.lastY),h=vo({...i,extent:d,velocity:-t.velocity})===0,u=Math.max(0,l-1);if(!h)return st(e,n,{...c,targetIndex:u});return st(e,n,{...c,targetIndex:0,outcome:{type:"attempt-dismiss",reason:"swipe"}})}function np(e){if(e.phase!=="settling")return{state:e,effects:Ae};return{state:he(e.to,e.targetIndex),effects:Ae}}function rp(e,t,n){if(t.extent<1&&n.dismissible)return{state:he(0,-1),effects:[{type:"dismiss",reason:"swipe"}]};let r=$e(xl(n),t.extent),o=r===e.restingIndex?[]:[{type:"snap",id:n.snapPoints[r].id,reason:"swipe"}];return{state:he(t.extent,r),effects:o}}function op(e,t,n){let r=n.snapPoints.findIndex((o)=>o.id===t.id);if(r===-1||e.phase==="dragging")return{state:e,effects:Ae};return st(e,n,{targetIndex:r,motion:So(e,t.time),time:t.time,reason:t.reason})}function ip(e,t,n){if(e.phase!=="idle"||e.restingIndex<0)return{state:e,effects:Ae};return st(e,n,{targetIndex:e.restingIndex,motion:{extent:e.extent,velocity:-Gf},time:t.time,reason:"imperative"})}function st(e,t,n){let{targetIndex:r,motion:o,time:s,reason:a}=n,i=t.physics,l=r<0?0:t.snapPoints[r].extent,d=Math.abs(o.velocity)>=i.minFlingVelocity?i.momentumDampingRatio:i.dampingRatio,h={phase:"settling",extent:o.extent,restingIndex:e.restingIndex,targetIndex:r,from:o.extent,to:l,velocity:o.velocity,response:i.response,dampingRatio:d,startTime:s},u=[{type:"settle",from:o.extent,to:l,velocity:o.velocity,response:i.response,dampingRatio:d}];if(r>=0&&r!==e.restingIndex)u.push({type:"snap",id:t.snapPoints[r].id,reason:a});if(n.outcome)u.push(n.outcome);return{state:h,effects:u}}function wl(e,t){let n=At(t),{coefficient:r,dimension:o}=Ao(t);if(e>n)return n+xo(e-n,o,r);if(t.dismissible)return Math.max(0,e);let s=t.snapPoints[0].extent;if(e<s)return s-xo(s-e,o,r);return e}function sp(e,t){let n=At(t),{coefficient:r,dimension:o}=Ao(t);if(e>n)return n+Vn(e-n,o,r);let s=t.snapPoints[0].extent;if(!t.dismissible&&e<s)return s-Vn(s-e,o,r);return e}function Ao(e){return{coefficient:e.physics.rubberBand,dimension:e.physics.rubberBandDimension??e.dimension}}function ap(e,t){let{coefficient:n,dimension:r}=Ao(t),o=At(t),s=t.snapPoints[0].extent,a=e>o?e-o:!t.dismissible&&e<s?s-e:0;if(a<=0)return 1;return yl(Vn(a,r,n),r,n)}function At(e){return e.snapPoints[e.snapPoints.length-1].extent}function xl(e){return e.snapPoints.map((t)=>t.extent)}var Ae,Gf=1;var _n=ue(()=>{jn();vl();Kn();Ae=[]});var Sl,kl;var Al=ue(()=>{yo();_n();Sl=[],kl={claim(e,t,n,r){if(!t.scroll)return;if(Wn({towardMore:n,scrollAtStart:t.scroll.atStart,atLargest:e.extent>=At(r)-0.5,expandOnScroll:r.expandOnScroll})!=="scroll")return;return{phase:"scrolling",extent:e.extent,restingIndex:e.restingIndex,lastY:t.y}},move(e,t){if(t.y>e.lastY&&t.scroll?.atStart)return{state:ko(e,t.y),effects:Sl};return{state:{...e,lastY:t.y},effects:Sl}},drag(e,t,n,r,o){let s=t.scroll;if(!s)return;if(e.isScrollingContent&&(n>0?!s.atEnd:!s.atStart)){let c=[{type:"scroll",delta:n}];return{state:{...e,lastY:t.y},effects:c}}let a=At(o);if(!(n>0&&r>a&&e.extent<=a&&!s.atEnd))return;let i=[{type:"scroll",delta:r-a}];if(e.extent!==a)i.unshift({type:"move",extent:a});return{state:{...e,extent:a,anchorY:t.y,anchorExtent:a,lastY:t.y,isScrollingContent:!0},effects:i}},release(e,t,n){if(!e.isScrollingContent)return;let r=n.snapPoints.length-1,o=[{type:"fling-scroll",velocity:-t.velocity}];if(e.restingIndex!==r)o.push({type:"snap",id:n.snapPoints[r].id,reason:"swipe"});return{state:he(e.extent,r),effects:o}}}});var zn;var El=ue(()=>{zn={ios:{response:0.34,dampingRatio:1,momentumDampingRatio:0.88,projectionRate:0.99,minFlingVelocity:0.5,skipSnapPoints:!0,rubberBand:1.9,rubberBandDimension:24,touchSlop:8,mouseSlop:4,dim:0.2,velocityHorizon:70}}});function lp(e){return String(e)}function cp(e,t){if(typeof e==="number")return e<=1?e*t.container:e;if(e==="content")return t.content;let n=parseFloat(e);if(e.endsWith("rem"))return n*t.rootFontSize;if(e.endsWith("%"))return n/100*t.container;if(e.endsWith("px"))return n;return NaN}function Cl(e,t){let n=e.map((o,s)=>({value:o,index:s,extent:Math.min(cp(o,t),t.content)})).filter((o)=>o.extent>0).sort((o,s)=>o.extent-s.extent||o.index-s.index),r=[];for(let o of n){let s=lp(o.value),a=r[r.length-1];if(a&&o.extent-a.extent<1){if(a.ids.push(s),o.index>a.index)Object.assign(a,{id:s,value:o.value,index:o.index});a.extent=Math.max(a.extent,o.extent);continue}r.push({id:s,value:o.value,extent:Math.round(o.extent*100)/100,ids:[s],index:o.index})}return r.map(({index:o,...s})=>s)}function at(e,t){if(t===null||t===void 0)return-1;let n=String(t);return e.findIndex((r)=>r.ids.includes(n))}function Ml(e,t,n){let r=at(e,n),o=at(e,t);return r>=0&&o>=0&&o<=r}var Pl=()=>{};function up(e,t,n){let r=Math.max(0,t.layoutHeight-t.offsetTop-t.height);if(Math.abs(t.height-t.layoutHeight)<=1)Ol.set(e,t.scale);if(n>0)return Math.round(Math.min(n,r));return t.scale>(Ol.get(e)??1)+0.01?0:Math.round(r)}function Tl(e,t){let n=e.ownerDocument.defaultView,r=n?.visualViewport;if(!n||!r)return()=>{};let o=null,s=(l)=>{let c=up(n,l,0),d=o!==null&&c!==o;if(o=c,d)t?.before();if(e.style.setProperty("--keyboard-inset",`${c}px`),e.style.setProperty("--visual-viewport-height",`${Math.round(l.height)}px`),c>0)e.setAttribute("data-keyboard","");else e.removeAttribute("data-keyboard");if(d)t?.after()},a=pp.get(n);s(a&&a.layoutHeight-a.offsetTop-a.height<=1?a:Dl(n,r));let i=fp(n,r,s);return()=>{i(),e.style.removeProperty("--keyboard-inset"),e.style.removeProperty("--visual-viewport-height"),e.removeAttribute("data-keyboard")}}function Dl(e,t){return{width:t.width,layoutHeight:e.innerHeight,height:t.height,offsetTop:t.offsetTop,scale:t.scale}}function dp(e,t){let n=new Set,r=(a)=>{let i=Dl(e,t);for(let l of n)l(i,a)};t.addEventListener("resize",r),t.addEventListener("scroll",r);let s={followers:n,stop:()=>{t.removeEventListener("resize",r),t.removeEventListener("scroll",r),Eo.delete(t)}};return Eo.set(t,s),s}function fp(e,t,n){let{followers:r,stop:o}=Eo.get(t)??dp(e,t);return r.add(n),()=>{if(r.delete(n)&&!r.size)o()}}var Ol,Eo,pp;var Ll=ue(()=>{Ol=new WeakMap;Eo=new WeakMap;pp=new WeakMap});function Ht(e,t=!1){if(e==="start")return t?"right":"left";if(e==="end")return t?"left":"right";return e}var Yn;var Un=ue(()=>{Yn={top:"bottom",bottom:"top",left:"right",right:"left"}});function Co(e,t){return Ht(e,e==="start"||e==="end"?sn(t):!1)}function lt(e,t,n,r){let o=Ne(e);return r.y=(o?n:t)*Il(e),r.x=o?t:n,r}function Kt(e,t){let n=`${Math.round(t*Il(e)*100)/100}px`;return Ne(e)?`0 ${n}`:`${n} 0`}function Fl(e,t){return Ne(t)?e.offsetHeight:e.offsetWidth}function Rl(e,t,n){let r=Mo(e,t,n);if(!r)return null;let{start:o,end:s}=hp(r,n);return{atStart:o,atEnd:s,area:r}}function Mo(e,t,n){let r=t.ownerDocument.defaultView;if(!r||!(e instanceof Element)||!t.contains(e))return null;let o=Ne(n);for(let s=e;s&&s!==t.parentElement;s=s.parentElement){if(!(o?s.scrollHeight>s.clientHeight+1:s.scrollWidth>s.clientWidth+1)||!(s instanceof HTMLElement))continue;let i=o?r.getComputedStyle(s).overflowY:r.getComputedStyle(s).overflowX;if(/auto|scroll/.test(i))return s}return null}function mp(e,t){if(Ne(t)){let s=e.scrollHeight-e.clientHeight;return{position:t==="bottom"?e.scrollTop:s-e.scrollTop,max:s}}let n=e.scrollWidth-e.clientWidth,r=Math.abs(e.scrollLeft),o=sn(e)?n-r:r;return{position:t==="right"?o:n-o,max:n}}function hp(e,t){let{position:n,max:r}=mp(e,t);return{start:n<=0.5,end:n>=r-1}}function Po(e,t,n){if(Ne(t))e.scrollTop+=t==="bottom"?n:-n;else{let r=t==="right"?n:-n;e.scrollLeft+=sn(e)?-r:r}}var Ne=(e)=>e==="bottom"||e==="top",Il=(e)=>e==="bottom"||e==="right"?1:-1;var Oo=ue(()=>{Ie();Un()});function Gn(e,t){e.requestAnimationFrame(()=>e.requestAnimationFrame(t))}function Qn(e){return e==="bottom"?-We:-32}function Jn(e,t){let n=[];for(let r=0;r<e.duration;r+=16.666666666666668)n.push(t(e.extentAt(r)));return n.push(t(e.extentAt(e.duration))),n}function ct(e,t){let n=Object.entries(t).map(([r,o])=>Ke(e,r,o));return()=>n.forEach((r)=>r())}var Xn=1000,We=120,$l=200,Nl=150;var Zn=ue(()=>{Oe()});function Wl(e,t,n=-1){let r=n<0?0:t[n],o=n<0?t[0]:t[n+1];if(o===void 0||o<=r)return e>r?1:0;return To((e-r)/(o-r))}function jl(e,t){let n=t[t.length-1],r=t.length>1?t[t.length-2]:0;if(n<=r)return e>=n?1:0;return To((e-r)/(n-r))}function Vl(e,t){let n=t[t.length-1];return n>0?To(e/n):0}var To=(e)=>Math.max(0,Math.min(1,e));var ql=()=>{};function zl(e){let t=e.defaultView?.CSS;if(Lo.has(e)||!t?.registerProperty)return;Lo.add(e);for(let n of Do)try{t.registerProperty({name:n,syntax:"<number>",inherits:!1,initialValue:"0"})}catch{}}function Yl(){if(typeof document<"u"&&!Lo.has(document))Nt(()=>zl(document))}function Ul(e){zl(e.sheet.ownerDocument);let t=[1],n=-1,r=[],o=new Map,s={dim:0,progress:0,expand:0},a;function i(L){t=L.snapExtents.length?L.snapExtents:[1],n=L.undimmedIndex}function l(L,R=s){return R.dim=er(Wl(L,t,n)),R.progress=er(Vl(L,t)),R.expand=er(jl(L,t)),R}let c=!1;function d(L,{rest:R=!1}={}){if(c)return;N(),l(L),h(s.dim),x(e.sheet,s),v(s.progress);for(let V of e.outlets())if(x(V.el,s),V.keyframes)w(V,s.expand,R);if(R)e.themeColor?.(s.dim)}function h(L){let R=e.backdrop();if(R)R.style.opacity=String(L);let V=u();if(V)V.currentTime=L*1000}function u(){if(!e.dimmed||a)return a;return a=e.dimmed.animate({opacity:[0,1]},{...Kl,duration:1000,fill:"both"}),a.pause(),a.currentTime=0,a}function v(L){let R=e.ancestors();for(let V=0;V<R.length;V++)R[V].style.setProperty("--drawer-stack",String(V+L))}function x(L,{dim:R,progress:V,expand:z}){L.style.setProperty("--drawer-progress",String(V)),L.style.setProperty("--drawer-dim",String(R)),L.style.setProperty("--drawer-expand",String(z))}function w(L,R,V){let z=o.get(L.el);if(!z)z=L.el.animate(Bl(L.keyframes),{duration:1000,fill:"both"}),z.pause(),o.set(L.el,z);if(z.currentTime=R*1000,!V)return;z.commitStyles?.(),z.cancel(),o.delete(L.el)}function k(L){if(c)return;if(N(),q(),!Bt())return d(L.type==="settle"?L.extentAt(L.duration):0,{rest:!0});let R=M(L);u();let V=L.type==="settle"?{duration:Math.max(1,L.duration),fill:"both"}:{timeline:L.timeline,fill:"both"},z=(ee,E,p,b)=>{let C=ee.animate(E,{...V,...b,easing:gp(p)});if(L.type==="settle")C.startTime=L.startTime;r.push(C)},Z=e.backdrop();if(Z)z(Z,{opacity:[0,1]},R.dim);if(e.dimmed)z(e.dimmed,{opacity:[0,1]},R.dim,Kl);A(e.sheet,R,z),e.ancestors().forEach((ee,E)=>z(ee,{"--drawer-stack":[E,E+1]},R.progress));for(let ee of e.outlets())if(A(ee.el,R,z),ee.keyframes)z(ee.el,Bl(ee.keyframes),R.expand);if(L.type!=="settle")return;let ne=L.extentAt(L.duration);W(ne);let re=r;if(re[0])re[0].onfinish=()=>r===re&&N()}function A(L,R,V){V(L,{"--drawer-progress":[0,1]},R.progress),V(L,{"--drawer-dim":[0,1]},R.dim),V(L,{"--drawer-expand":[0,1]},R.expand)}function W(L){let R=l(L,{dim:0,progress:0,expand:0});h(R.dim),x(e.sheet,R),v(R.progress);for(let V of e.outlets()){if(x(V.el,R),!V.keyframes)continue;for(let[z,Z]of Object.entries(V.keyframes)){let ne=Z[R.expand>=0.5?Z.length-1:0];V.el.style.setProperty(_l(z),String(ne))}}e.themeColor?.(R.dim)}function M(L){let R={dim:[],progress:[],expand:[]},V={dim:0,progress:0,expand:0},z=L.type==="settle"?Math.max(2,Math.ceil(L.duration/Hl)+1):61;for(let Z=0;Z<z;Z++){let ne=Z/(z-1),re=L.type==="settle"?L.extentAt(Math.min(L.duration,Z*Hl)):L.extentAt(ne);l(re,V),R.dim.push(V.dim),R.progress.push(V.progress),R.expand.push(V.expand)}return R}function I(L){for(let R of r)R.startTime=L}function N(){if(!r.length)return;for(let L of r)L.cancel();r=[]}function q(){for(let L of o.values())L.cancel();o.clear()}function Q(){c=!0,N(),q(),e.backdrop()?.style.removeProperty("opacity"),a?.cancel();for(let L of Do.slice(0,3))e.sheet.style.removeProperty(L);for(let L of e.outlets()){for(let R of Do.slice(0,3))L.el.style.removeProperty(R);for(let R of Object.keys(L.keyframes??{}))L.el.style.removeProperty(_l(R))}}return{configure:i,compute:l,apply:d,play:k,sync:I,follow:k,stop:N,destroy:Q}}function gp(e){return`linear(${e.map(er).join(", ")})`}function _l(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}var Hl=16.666666666666668,Do,Lo,Bt=()=>typeof CSS<"u"&&CSS.supports("animation-timing-function","linear(0, 1)"),er=(e)=>Math.round(e*1e4)/1e4,Kl,Bl=(e)=>e;var _t=ue(()=>{ql();Oe();Do=["--drawer-progress","--drawer-dim","--drawer-expand","--drawer-stack"],Lo=new WeakSet;Kl={pseudoElement:"::backdrop"}});function yp(e,t,n=0,r=e.length){let o=r-n;if(o<2)return 0;let s=e[r-1];if(o<4)return Xl(e,t,n,r);let a=0,i=0,l=0,c=0,d=0,h=0,u=0,v=0;for(let k=n;k<r;k++){let A=e[k]-s,W=t[k],M=A*A;a+=1,i+=A,l+=M,c+=M*A,d+=M*M,h+=W,u+=W*A,v+=W*M}let x=a*(l*d-c*c)-i*(i*d-c*l)+l*(i*c-l*l);if(Math.abs(x)<0.000000001)return Xl(e,t,n,r);return(a*(u*d-c*v)-h*(i*d-c*l)+l*(i*v-u*l))/x}function Xl(e,t,n,r){let o=0,s=0,a=r-n;for(let c=n;c<r;c++)o+=e[c]/a,s+=t[c]/a;let i=0,l=0;for(let c=n;c<r;c++){let d=e[c]-o;i+=d*(t[c]-s),l+=d*d}return l>0?i/l:0}function Gl(e={}){let{horizon:t,staleAfter:n,maxSpeed:r,capacity:o}={...bp,...e},s=new Float64Array(o),a=new Float64Array(o),i=new Float64Array(o),l=new Float64Array(o),c=0,d=-1;function h(x,w){if(c>0&&x<=s[d])return;d=(d+1)%o,s[d]=x,a[d]=w,c=Math.min(c+1,o)}function u(x){if(c<2)return 0;let w=s[d];if(x-w>n)return 0;let k=0;for(let W=c-1;W>=0;W--){let M=(d-W+o)%o;if(w-s[M]>t)continue;i[k]=s[M],l[k]=a[M],k++}let A=yp(i,l,0,k);return Math.max(-r,Math.min(r,A))}function v(){c=0,d=-1}return{add:h,velocity:u,reset:v}}var bp;var Ql=ue(()=>{bp={horizon:70,staleAfter:40,maxSpeed:8,capacity:20}});function Jl(e,t=!1,n){let r=e.defaultView??window,o=(c)=>n===void 0||!("pointerId"in c)||c.pointerId===n,s=(c)=>{if(!o(c))return;c.preventDefault(),c.stopPropagation(),e.removeEventListener("click",s,!0)},a=()=>{e.removeEventListener("click",s,!0),e.removeEventListener("pointerdown",i,!0),e.removeEventListener("pointerup",l,!0),e.removeEventListener("pointercancel",l,!0)},i=(c)=>o(c)&&a(),l=(c)=>o(c)&&r.setTimeout(a);if(e.addEventListener("click",s,!0),e.addEventListener("pointerdown",i,!0),!t)return r.setTimeout(a);e.addEventListener("pointerup",l,!0),e.addEventListener("pointercancel",l,!0)}var vp,tr=(e)=>vp.has(e);var Zl=ue(()=>{vp=new WeakSet});function ec(e){let{sheet:t}=e,n=t.ownerDocument,r=n.defaultView??window,o=he(0,-1),s=0,a=null,i=0,l=0,c=null,d=null,h=null,u=null,v=null,x=null,w=null,k=!1,A=!1,W=null,M=null,I=null,N={x:0,y:0},q=Gl({horizon:e.config().physics.velocityHorizon}),Q=[J(n,"touchstart",U,{capture:!0,passive:!0}),J(n,"touchmove",oe,{capture:!0,passive:!1}),J(n,"touchend",ae,{capture:!0,passive:!0}),J(n,"touchcancel",ae,{capture:!0,passive:!0}),J(t,"pointerdown",f)],L=!1;function R(g){if(L)return;t.style.translate=Kt(e.side(),e.size()-g),s=g}function V(g,O){if(L)return;let D=Bn(o,g,e.config());o=D.state;let H="time"in g?g.time:performance.now();for(let j of D.effects)z(j,H,O);let B=o.phase==="dragging";if(B===k)return;k=B,e.onDragChange(k)}function z(g,O,D){switch(g.type){case"move":if(c)ee(),R(g.extent),e.onFrame(g.extent);else a=g.extent,p();return;case"settle":return Z(g,O);case"scroll":return i+=g.delta,p();case"fling-scroll":if(v)u={velocity:g.velocity,startTime:O,startScroll:0,area:v};return p();case"snap":return M=g.id,e.onSnap(g.id,g.reason,D);case"dismiss":if(g.reason!=="swipe")return;return h="swipe",e.onDismiss(D);case"attempt-dismiss":return e.onDismissAttempt(D)}}function Z(g,O){ee(),a=null;let D=e.closedExtent(),H=g.from<=0?D:g.from,B=g.to<=0?D:g.to,j=e.reducedMotion()&&(H===D||B===D),Y=e.reducedMotion()?re(H,B,j):ne(H,B,g);if(R(j?Math.max(B,0):B),Math.abs(B-H)<0.5&&g.velocity===0||Y.duration===0)return E();let X=e.size(),ie=e.side();if(c=j?t.animate({opacity:H===D?[0,1]:[1,0]},{duration:Y.duration,fill:"both"}):Math.abs(B-H)<1||!Bt()?t.animate({translate:Jn(Y,(G)=>Kt(ie,X-G))},{duration:Y.duration,fill:"backwards"}):t.animate({translate:[Kt(ie,X-H),Kt(ie,X-B)]},{duration:Y.duration,easing:Y.easing,fill:"backwards"}),j)d=c;let le=c;c.onfinish=()=>{if(c===le)E()},c.startTime=O,e.onMotion({type:"settle",extentAt:Y.extentAt,startTime:O,duration:Y.duration})}function ne(g,O,D){let H=kt(D.response,D.dampingRatio,g-O,D.velocity),B=qn(H);return{duration:B,easing:Hn(H,g,O,B),extentAt:(j)=>O+H.position(j)}}function re(g,O,D){let H=D?Nl:$l,B=(j)=>1-(1-j)**3;return{duration:H,easing:"cubic-bezier(0.33, 1, 0.68, 1)",extentAt:(j)=>g+(O-g)*B(Math.min(1,j/H))}}function ee(){if(c?.cancel(),c=null,d)d.cancel(),d=null}function E(){if(ee(),V({type:"settled"}),o.phase!=="idle")return;if(o.restingIndex<0)return h=null,M=null,e.onRest(null);M=e.config().snapPoints[o.restingIndex].id,e.onRest(M)}function p(){l||=r.requestAnimationFrame(b)}function b(g){if(l=0,i&&v)Po(v,e.side(),i),i=0;if(u)C(g);if(a===null)return;R(a),a=null,e.onFrame(s)}function C(g){if(!u)return;let O=Math.max(0,g-u.startTime),D=u.velocity*(Io**O-1)/Math.log(Io);if(Po(u.area,e.side(),D-u.startScroll),u.startScroll=D,Math.abs(u.velocity*Io**O)<0.01)u=null;else p()}function K(g){return g instanceof Element&&g.closest(wp)!==null}function _(g){let O=Rl(g,t,e.side());return v=O?.area??null,O&&{atStart:O.atStart,atEnd:O.atEnd}}function U(g){let O=W!==null&&tr(W);if(W=null,x||g.touches.length>1||h||O)return;if(!e.owns(g.target)||K(g.target))return;let D=g.changedTouches[0];x={id:D.identifier,originX:D.clientX,originY:D.clientY},u=null,q.reset(),lt(e.side(),D.clientX,D.clientY,N),q.add(g.timeStamp,N.y),V({type:"down",time:g.timeStamp,x:N.x,y:N.y,pointer:"touch"},g)}function oe(g){let O=P(g.changedTouches);if(!O)return;lt(e.side(),O.clientX,O.clientY,N),q.add(g.timeStamp,N.y);let D=o.phase==="dragging",H=_(g.target);if(V({type:"move",time:g.timeStamp,x:N.x,y:N.y,scroll:H},g),o.phase==="pending")return ce(g,O,H);if(o.phase!=="dragging")return;if(g.cancelable)g.preventDefault();else if(!D&&v)v.style.overscrollBehavior="none"}function ce(g,O,D){if(!g.cancelable||!x)return;let H=lt(e.side(),x.originX,x.originY,{x:0,y:0});if(Math.abs(N.y-H.y)<Math.abs(N.x-H.x))return;let B=e.config().snapPoints.at(-1)?.extent??0;if((D?Wn({towardMore:N.y<H.y,scrollAtStart:D.atStart,atLargest:s>=B-0.5,expandOnScroll:e.config().expandOnScroll}):"sheet")==="sheet")g.preventDefault()}function ae(g){if(!P(g.changedTouches))return;if(x=null,v)v.style.removeProperty("overscroll-behavior");let O=g.type==="touchcancel"?0:q.velocity(g.timeStamp);V({type:"up",time:g.timeStamp,velocity:O},g)}function P(g){if(!x)return null;for(let O=0;O<g.length;O++)if(g[O].identifier===x.id)return g[O];return null}function f(g){if(W=g,g.pointerType==="touch"||g.button!==0||w!==null||h)return;let O=g.target;if(!e.owns(O)||K(O)||!(O instanceof Element)||!e.canMouseDrag(O))return;w=g.pointerId,A=!1,I=o.phase==="settling"&&o.targetIndex>=0?M:null,u=null,q.reset(),lt(e.side(),g.clientX,g.clientY,N),q.add(g.timeStamp,N.y),m=[J(n,"pointermove",y,{capture:!0}),J(n,"pointerup",S,{capture:!0}),J(n,"pointercancel",S,{capture:!0})];let D=g.pointerType==="pen"?"pen":"mouse";V({type:"down",time:g.timeStamp,x:N.x,y:N.y,pointer:D},g)}let m=[];function y(g){if(g.pointerId!==w)return;if(W&&tr(W))return T(g,0,I);let O=g.getCoalescedEvents?.();for(let D of O?.length?O:[g])q.add(D.timeStamp,lt(e.side(),D.clientX,D.clientY,N).y);if(lt(e.side(),g.clientX,g.clientY,N),V({type:"move",time:g.timeStamp,x:N.x,y:N.y,scroll:_(g.target)},g),o.phase!=="dragging"||A)return;A=!0,n.getSelection()?.removeAllRanges(),t.style.userSelect="none";try{t.setPointerCapture(g.pointerId)}catch{}}function S(g){if(g.pointerId!==w)return;if(W&&tr(W))return T(g,0,I);T(g,g.type==="pointercancel"?0:q.velocity(g.timeStamp))}function T(g,O,D=null){w=null,W=null,m.forEach((j)=>j()),m=[],t.style.removeProperty("user-select");let H=g.timeStamp,B=e.config().snapPoints.findIndex((j)=>j.id===D);if(D!==null&&B>=0)o=he(o.extent,B),V({type:"snap-to",time:H,id:D,reason:"imperative"});else V({type:"up",time:H,velocity:O},g);if(A)Jl(n)}return{open(g,O){h=null,M=g,ee();let D=e.config().snapPoints.findIndex((B)=>B.id===g);if(!O&&D>=0)return o=he(e.config().snapPoints[D].extent,D),R(o.extent),e.onRest(g);o=he(0,-1),R(e.closedExtent()),V({type:"snap-to",time:performance.now()+Xn,id:g,reason:"imperative"});let H=c;if(!H)return;Gn(r,(B)=>{if(c!==H||o.phase!=="settling")return;H.startTime=B,o={...o,startTime:B},e.onMotionStart(B)})},close(){let g=h;if(h="close",!g)V({type:"close",time:performance.now()})},snapTo(g,O){if(h==="close")return;h=null,V({type:"snap-to",time:performance.now(),id:g,reason:O})},nudge(){if(!h&&!e.reducedMotion())V({type:"nudge",time:performance.now()})},relayout(g,O){let D=e.config().snapPoints;if(h||M===null||o.phase==="dragging"||o.phase==="pending")return R(s);let H=D.findIndex((ie)=>ie.id===M),B=D.findIndex((ie)=>ie.id===O),j=H>=0?H:B>=0?B:$e(D.map((ie)=>ie.extent),s),{id:Y,extent:X}=D[j];if(o.phase==="idle"){if(o=he(s,H),g||Math.abs(X-s)<0.5){if(o=he(X,j),R(X),!g)return;if(Y!==M)z({type:"snap",id:Y,reason:"content-resize"},performance.now());return e.onRest(Y)}}V({type:"snap-to",time:performance.now(),id:Y,reason:"content-resize"})},target:()=>h?null:M,isMoving:()=>o.phase!=="idle",destroy(){if(L=!0,ee(),l)r.cancelAnimationFrame(l);if(Q.forEach((g)=>g()),m.forEach((g)=>g()),k)e.onDragChange(!1);for(let g of["translate","user-select","opacity"])t.style.removeProperty(g)}}}var Io=0.998,wp='input, textarea, select, [contenteditable]:not([contenteditable="false"]), [data-drawer-no-drag]';var tc=ue(()=>{yo();_n();jn();Kn();Ql();Se();Zl();Oo();Zn();_t()});function rc(e){let{sheet:t,host:n}=e,r=t.ownerDocument,o=r.defaultView??window,s=he(0,-1),a=0,i=[],l=null,c=!1,d=!1,h=!1,u=null,v=0,x=0,w=null,k=new Map,A=null,W=ct(n,{inset:`0 0 calc(var(--keyboard-inset, 0px) - ${We}px) 0`,display:"block","overflow-y":"scroll","overflow-x":"hidden","scroll-snap-type":"y mandatory","scrollbar-width":"none","overscroll-behavior":"contain","pointer-events":"auto"}),M=ct(t,{position:"absolute",left:"0",right:"0"}),I="onscrollend"in n,N=o.ScrollTimeline,q=[J(n,"scroll",ee,{passive:!0}),...I?[J(n,"scrollend",C)]:[],J(n,"touchstart",()=>{if(c=!0,d=!1,l&&!u)_()},{passive:!0}),J(n,"touchend",p,{passive:!0}),J(n,"touchcancel",p,{passive:!0})],Q=gt()?1:We+1,L=new IntersectionObserver(K,{root:n,rootMargin:`0px 0px -${Q}px 0px`,threshold:0});L.observe(t);let R=()=>e.config().dimension,V=()=>e.config().snapPoints.at(-1)?.extent??0,z=()=>V()+xp-a,Z=()=>Math.min(n.scrollTop+a,V());function ne(){let m=e.config();a=m.dismissible?-We:m.snapPoints[0].extent,t.style.top=`${R()-a}px`;for(let T of i)T.remove();let y=m.snapPoints.map((T)=>T.extent);i=(m.dismissible?[a,...y]:y).map((T)=>re(T-a,"start")),i.push(re(z()+n.clientHeight-1,"none")),n.append(...i);for(let T of k.keys())if(!t.contains(T))k.delete(T);for(let T of Sp(t))if(!k.has(T))k.set(T,[T.style.getPropertyValue("overflow-y"),T.style.getPropertyPriority("overflow-y")])}function re(m,y){let S=r.createElement("div");return S.setAttribute("aria-hidden","true"),S.style.cssText=`position:absolute;left:0;width:1px;height:1px;top:${m}px;scroll-snap-align:${y};pointer-events:none`,S}function ee(){if(l||u)return;if(A&&c&&Math.abs(n.scrollTop-A.offsetTop)>1)U();if(c&&!h)b(!0);if(!N)x||=o.requestAnimationFrame(E);if(o.clearTimeout(v),!I&&!c)v=o.setTimeout(C,nc)}function E(){x=0,e.onFrame(Z())}function p(){if(c=!1,b(!1),A){U();let m=e.config().snapPoints,y=$e(m.map((S)=>S.extent),Z());return f(m[y].id,"swipe")}if(!e.config().dismissible&&n.scrollTop<-2)e.onDismissAttempt();if(d||!I)v=o.setTimeout(C,nc);d=!1}function b(m){if(h===m)return;h=m,e.onDragChange(m)}function C(){if(c){d=!0;return}if(l||u)return;let m=e.config(),y=Bn(s,{type:"rest",extent:Z()},m);s=y.state;for(let S of y.effects)if(S.type==="snap")w=S.id,e.onSnap(S.id,S.reason);if(s.restingIndex>=0)ae(m.snapPoints[s.restingIndex].id)}function K(m){if(m[m.length-1].isIntersecting||l||u||w===null||!e.config().dismissible)return;u="swipe",w=null,e.onDismiss()}function _(){if(!l)return;let m=Math.max(0,l.extentAt(performance.now()-l.startTime)-a);ce(),A=re(m,"start"),n.append(A),n.scrollTop=m,E(),P()}function U(){A?.remove(),A=null}function oe(m,y,S,T){ce();let g=e.config().physics,O=kt(g.response,g.dampingRatio,y-m,0),D=Math.max(1,qn(O)),H=Math.max(a,m);n.scrollTop=H-a;let B=(ie)=>m+O.position(Math.max(0,ie)),j=Math.abs(m-y)<0.5,Y=!j&&!Bt(),X=t.animate({translate:Y?Jn({duration:D,extentAt:B},(ie)=>`0 ${H-ie}px`):[`0 ${H-y}px`,`0 ${H-m}px`]},{duration:D,easing:j||Y?"linear":Hn(O,y,m,D),fill:"both"});X.startTime=S,l={animation:X,to:m,extentAt:B,startTime:S},e.onMotion({type:"settle",extentAt:B,startTime:S,duration:D}),X.onfinish=()=>{if(l?.animation!==X)return;l=null,T(),X.cancel()}}function ce(){l?.animation.cancel(),l=null}function ae(m){let y=e.config(),S=y.snapPoints.findIndex((g)=>g.id===m);s=he(y.snapPoints[S].extent,S),w=m,n.style.pointerEvents=e.isInteractive(m)?"none":"auto";let T=S===y.snapPoints.length-1;for(let[g,[O,D]]of k)if(T)g.style.setProperty("overflow-y",O,D);else g.style.overflowY="hidden";e.onRest(m),P()}function P(){if(!N)return;let m=z(),y=new N({source:n,axis:"block"});e.onMotion({type:"timeline",timeline:y,extentAt:(S)=>Math.min(V(),S*m+a)})}function f(m,y){let S=e.config().snapPoints.find((g)=>g.id===m);if(!S||u==="close")return;if(u=null,m!==w)w=m,e.onSnap(m,y);let T=l?l.extentAt(performance.now()-l.startTime):Z();oe(S.extent,T,performance.now(),()=>ae(m))}return{open(m,y){u=null,w=m,ne();let S=e.config().snapPoints.find((g)=>g.id===m);if(!S)return;if(!y)return n.scrollTop=S.extent-a,ae(m);oe(S.extent,-We,performance.now()+Xn,()=>ae(m));let T=l;Gn(o,(g)=>{if(!T||l!==T)return;T.animation.startTime=g,T.startTime=g,e.onMotionStart(g)})},close(){let m=u;if(u="close",m)return;w=null;let y=l?l.extentAt(performance.now()-l.startTime):Z();oe(-We,y,performance.now(),()=>e.onRest(null))},snapTo:f,nudge(){if(u||e.reducedMotion()||w===null)return;let m=e.config().snapPoints.find((y)=>y.id===w);if(m)oe(m.extent,m.extent-20,performance.now(),()=>ae(m.id))},relayout(m,y){if(u||c)return;let S=e.config().snapPoints,T=S.findIndex((B)=>B.id===w),g=S.findIndex((B)=>B.id===y),O=T>=0?T:g>=0?g:$e(S.map((B)=>B.extent),Z()),D=a;ne();let H=S[O];if(H.id!==w)w=H.id,e.onSnap(H.id,"content-resize");if(l){let B=l,j=performance.now();if(B.to!==H.extent||a!==D)oe(H.extent,B.extentAt(j-B.startTime),Math.max(j,B.startTime),()=>ae(H.id)),l=Object.assign(B,l);return}n.scrollTop=H.extent-a,ae(H.id)},target:()=>u?null:w,isMoving:()=>!!l||h,destroy(){if(ce(),U(),o.clearTimeout(v),x)o.cancelAnimationFrame(x);L.disconnect(),q.forEach((m)=>m());for(let m of i)m.remove();for(let[m,[y,S]]of k)m.style.setProperty("overflow-y",y,S);if(h)e.onDragChange(!1);t.style.removeProperty("top"),M(),W()}}}function Sp(e){let t=e.ownerDocument.defaultView??window;return Array.from(e.querySelectorAll("*")).filter((n)=>/auto|scroll/.test(t.getComputedStyle(n).overflowY))}var nc=120,xp=24;var oc=ue(()=>{_n();jn();Kn();Se();Ie();Zn();_t()});function kp(e){let t=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/.exec(e);return t?[t[1],t[2],t[3]].map(Number):null}function ic(e,t){let n=Array.from(e.querySelectorAll('meta[name="theme-color"]')),r=n.map((l)=>l.content),o=r.map((l)=>kp(Ap(e,l))),s=-1;function a(l){let c=Math.round(l*t*100)/100;if(c===s)return;s=c,n.forEach((d,h)=>{let u=o[h];if(!u)return;d.content=c?`rgb(${u.map((v)=>Math.round(v*(1-c))).join(" ")})`:r[h]})}function i(){n.forEach((l,c)=>l.content=r[c]),s=-1}return{write:a,restore:i}}function Ap(e,t){let n=e.createElement("span");n.style.color=t,n.style.display="none",e.body.append(n);let r=e.defaultView?.getComputedStyle(n).color??t;return n.remove(),r}var sc=()=>{};function Mp(e){return{side:()=>"bottom",snapPoints:()=>["content"],snapPoint:()=>null,dismissible:()=>!0,modalAbove:()=>{return},driver:()=>"auto",expandOnScroll:()=>!0,physics:()=>{return},backdrop:()=>{return},hostBackdrop:!1,outlets:()=>[],parent:()=>{return},themeColor:()=>!1,preventEdgeSwipe:()=>!1,canMouseDrag:Cp,onSnap:zt,onRest:zt,onDismissAttempt:zt,onDragChange:zt,onLayout:zt,...Pp(e)}}function Pp(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function cc(e){for(let t=e.parent;t;t=t.parent){let n=nr.get(t);if(n)return n}}function Op(e){for(let t=e instanceof Element?e:null;t;){if(Fo.has(t))return t;let n=t.getRootNode();t=t.parentElement??(n instanceof ShadowRoot?n.host:null)}return null}function Tp(e,t){let n=e.closest("[popover]");return!!n&&n!==t&&t.contains(n)}function Dp(e,t){let n=t.driver();if(n!=="auto")return n==="scroll-snap";return t.modalAbove()===void 0&&t.expandOnScroll()&&!!e.matchMedia?.("(hover: none) and (pointer: coarse)").matches}function uc(e,t){let n=Mp(t),{host:r}=n,o=e.ownerDocument,s=o.defaultView??window,a=s.matchMedia?.("(prefers-reduced-motion: reduce)"),i=Co(n.side(),e),l=[],c=0,d,h=zn.ios,u,v,x={snapPoints:[],dimension:0,dismissible:!0,expandOnScroll:!0,physics:h,contentScroll:kl},w=i==="bottom"&&Dp(s,n);Fo.add(e);let k=[lc(r,i,e),Ip(e)],A=[],W=Ul({sheet:e,backdrop:n.backdrop,dimmed:n.hostBackdrop?r:void 0,outlets:n.outlets,ancestors:()=>A,themeColor:(f)=>u?.write(f)});function M(){let f=n.physics();if(f!==d)d=f,h=f?{...zn.ios,...f}:zn.ios;return x.physics=h,x.dismissible=n.dismissible(),x.expandOnScroll=n.expandOnScroll(),x}let I=!1;function N(){I=!0;let f=Co(n.side(),e);if(f!==i)i=f,k[0](),k[0]=lc(r,i,e);let m=(Ne(i)?r.clientHeight:r.clientWidth)-(w?We:0);re??=s.visualViewport?.height,c=Fl(e,i);let y=parseFloat(s.getComputedStyle(o.documentElement).fontSize)||16,S=Cl(n.snapPoints(),{container:m,content:c,rootFontSize:y});if(!S.length)S.push({id:"content",value:"content",extent:c,ids:["content"]});let T=m!==x.dimension||S.length!==l.length||S.some((g,O)=>g.id!==l[O].id||Math.abs(g.extent-l[O].extent)>=0.5);if(l=S,x.dimension=m,x.snapPoints=l.map(({id:g,extent:O})=>({id:g,extent:O})),W.configure({snapExtents:x.snapPoints.map((g)=>g.extent),undimmedIndex:at(l,n.modalAbove())}),T)V();return T}let q=!1,Q=(f)=>f===null?null:l.find((m)=>m.id===f)?.value??null,L={sheet:e,host:r,side:()=>i,config:M,size:()=>c,closedExtent:()=>Qn(i),reducedMotion:()=>!!a?.matches,owns:(f)=>Op(f)===e,canMouseDrag:n.canMouseDrag,onSnap:(f,m,y)=>{let S=Q(f);if(S!==null)n.onSnap(S,m,y)},onRest(f){if(q)return;let m=l.find((y)=>y.id===f);if(W.apply(m?.extent??Qn(i),{rest:!0}),n.onRest(Q(f)),_&&f!==null)oe();_=!1},onDismiss:n.onDismiss,onDismissAttempt:n.onDismissAttempt,onDragChange:n.onDragChange,isInteractive:(f)=>P.isInteractiveAt(Q(f)),onFrame:(f)=>q||W.apply(f),onMotion:(f)=>q||W.play(f),onMotionStart:(f)=>q||W.sync(f)},R=!0;function V(){if(!R)return n.onLayout({side:i,snapPoints:l});queueMicrotask(()=>q||n.onLayout({side:i,snapPoints:l}))}M();let z=w?rc(L):ec(L);e.setAttribute("data-driver",w?"scroll-snap":"pointer"),R=!1;let Z=new ResizeObserver(()=>{ce(!1)});Z.observe(e),Z.observe(r);let ne=0,re,ee=null,p=[Tl(r,{before:()=>ne=e.getBoundingClientRect().top,after:b}),...n.preventEdgeSwipe()?[J(o,"touchstart",C,{capture:!0,passive:!1})]:[],...gt()?[J(o,"touchend",K,{capture:!0,passive:!1})]:[],J(e,"focusin",U)];function b(){ce(!0),oe();let f=s.visualViewport?.height;if(f===re)return;re=f,ee?.cancel(),ee=null;let m=ne-e.getBoundingClientRect().top;if(Math.abs(m)<1||a?.matches)return;ee=r.animate({translate:[`0 ${m}px`,"0 0"]},Lp)}function C(f){if(!f.cancelable)return;let m=f.touches[0];if(!m||m.clientX>ac&&m.clientX<s.innerWidth-ac)return;let y=f.target;if(y&&(r.contains(y)||n.backdrop()?.contains(y)))f.preventDefault()}function K(f){let m=f.target;if(!(m instanceof HTMLInputElement||m instanceof HTMLTextAreaElement))return;if(!e.contains(m)||m===o.activeElement||z.isMoving()||!f.cancelable)return;f.preventDefault(),m.focus({preventScroll:!0})}let _=!1;function U(){if(z.isMoving())_=!0;else oe()}function oe(){let f=o.activeElement;if(!(f instanceof HTMLElement)||!e.contains(f)||f===e||Tp(f,e))return;let m=Mo(f,e,"bottom");if(!m)return;let y=s.visualViewport,S=Math.min(m.getBoundingClientRect().bottom,y?y.offsetTop+y.height:s.innerHeight),{top:T,bottom:g}=f.getBoundingClientRect(),O=16,D=m.getBoundingClientRect().top,H=g+O>S?g+O-S:T-O<D?T-O-D:0;if(H)m.scrollBy({top:H,behavior:a?.matches?"instant":"smooth"})}function ce(f){let m=!I;if(N()&&!m)z.relayout(f,l[at(l,n.snapPoint())]?.id)}function ae(f){let m=at(l,f);return l[m>=0?m:0]?.id}let P={element:e,parent:n.parent,open(f){if(q)return;A=[];for(let y=n.parent();y;y=y.parent())A.push(y.element);if(N(),M(),n.themeColor())u??=ic(o,h.dim);if(f)W.apply(Qn(i));v?.();let m=n.backdrop();v=m&&ct(m,{"will-change":"opacity"}),z.open(ae(n.snapPoint()),f)},close:()=>q||z.close(),snapTo(f,m){let y=at(l,f);if(y>=0&&l[y].id!==z.target())z.snapTo(l[y].id,m)},nudge:()=>z.nudge(),snapPoints:()=>l,target:()=>Q(z.target()),isInteractiveAt:(f)=>Ml(l,f,n.modalAbove()),refresh(){ce(!1)},destroy(){q=!0,Z.disconnect(),ee?.cancel(),p.forEach((f)=>f()),z.destroy(),W.destroy(),v?.(),u?.restore(),k.forEach((f)=>f()),e.removeAttribute("data-driver"),Fo.delete(e)}};return P}function lc(e,t,n){let r=Ne(t),o=r?t==="bottom":t==="right"!==(n.ownerDocument.defaultView?.getComputedStyle(e).direction==="rtl");return ct(e,{position:"fixed",inset:"0 0 var(--keyboard-inset, 0px) 0",width:"auto",height:"auto","max-width":"none","max-height":"none",margin:"0",padding:"0",border:"0",background:"transparent",color:"inherit",overflow:"visible",display:"flex","flex-direction":r?"column":"row","justify-content":o?"flex-end":"flex-start","pointer-events":"none"})}function Ip(e){return ct(e,{"pointer-events":"auto","overscroll-behavior":"contain","will-change":"translate"})}var Ep='a[href], button, label, summary, [role="button"], [role="link"], [role="slider"], [tabindex]:not([tabindex="-1"])',Cp=(e)=>!e.closest(Ep),zt=()=>{},Fo,nr,ac=24,Lp;var dc=ue(()=>{Al();El();Pl();Se();Ll();Ie();Oo();Zn();_t();tc();oc();sc();Fo=new WeakSet,nr=new WeakMap;Lp={duration:250,easing:"cubic-bezier(0.38, 0.7, 0.125, 1)"}});var fc={};Yu(fc,{prepareVariables:()=>Yl,presentSheet:()=>Np});function Fp(e){let t=e.getAttribute("data-slot");if(!t)return;xe(e.ownerDocument,`ui-sdk-sheet-${t}`,`@layer ui-sdk { :where([data-slot="${t}"])::backdrop { background: var(--sheet-backdrop, rgb(0 0 0 / 0.2)); pointer-events: auto } }`)}function Rp(e,t){let n=[],r=(o)=>{for(let s of Array.from(o.children)){if(t.includes(s))continue;if(t.some((a)=>a&&s.contains(a)))r(s);else if(s instanceof HTMLElement)n.push(Ke(s,"display","none"))}};return r(e),()=>n.forEach((o)=>o())}function $p(e,t,n){let r,o=t.bind(e,{...n,position:void 0,inline:!0,onShow(){let[s,a]=n.drillIn();if(s)r=Rp(s,[e,a]);return()=>r?.()},onClose(){r?.(),r=Ke(e,"display","none")}});return()=>{o(),r?.()}}function Np(e,t,n){if(n.drillIn)return $p(e,t,n);let r=e.parentElement;if(!r)return;Fp(r);let o;return t.bind(e,{...n,position:void 0,host:()=>r,onShow(s){let a=Wp(e,r,t,n,s);return o=a.sheet,()=>{a.hide(),o=void 0}},onClose:()=>o?.close()})}function Wp(e,t,n,r,o){let s=null,a=cc(o),i=!r.backdrop?.(),l=uc(e,{host:t,snapPoints:()=>r.snapPoints??["content"],snapPoint:()=>s,backdrop:r.backdrop,hostBackdrop:i,dismissible:r.dismissible,onDismissAttempt:r.onDismissAttempt,parent:()=>a?.(),onSnap:(h)=>s=h,onDismiss(h){n.requestClose("swipe",h),requestAnimationFrame(()=>{let u=s??l.snapPoints()[0]?.value;if(o.active()&&u!==void 0)l.snapTo(u,"imperative")})}});nr.set(o,()=>l),r.onSheet?.(l);let c=J(e,"focusin",(h)=>{let u=l.snapPoints().at(-1);if(u&&l.snapPoints().length>1&&h.target.matches("input, textarea"))l.snapTo(u.value,"imperative")}),d=i?getComputedStyle(e).getPropertyValue("--sheet-backdrop"):"transparent";if(d)t.style.setProperty("--sheet-backdrop",d);if(o.active())l.open(n.opener()!=="initial");return{sheet:l,hide(){c(),nr.delete(o),l.destroy(),r.onSheet?.(void 0),t.style.removeProperty("--sheet-backdrop")}}}var pc=ue(()=>{Se();Oe();dc();_t()});class mt extends Error{name="AdressevaelgerError";status;url;constructor(e,t){super(e);this.status=t.status,this.url=Uu(t.url)}}function Uu(e){return e.replace(/([?&]token=)[^&]*/i,"$1***")}function Ot(e){return e instanceof Error&&e.name==="AbortError"}function fr(e){let t=e.vejnavn??e.vejNavn??"",n=e.husnummer??e.husNummer??"";switch(e.type){case"vejnavn":return{type:"streetName",label:e.titel,streetName:t||e.titel};case"vejnavnhusnummer":return{type:"streetNameNumber",label:e.titel,streetName:t,houseNumber:n};case"navngivenvejpostnummer":if(!e.id)return null;return{type:"street",id:e.id,label:e.titel,streetName:t,postalCode:e.postnr??"",postalDistrict:e.postdistrikt??"",accessAddressCount:e.antal_husnumre??0};case"husnummer":if(!e.id)return null;return{type:"accessAddress",id:e.id,label:e.titel,streetName:t,houseNumber:n};case"adresse":if(!e.id)return null;return{type:"address",id:e.id,label:e.titel,accessAddressId:e.husnummerId??""};default:return null}}function mi(e){return{validFrom:e.virkningfra,validTo:e.virkningtil,registeredFrom:e.registreringfra,registeredTo:e.registreringtil}}function ht(e){let t=e.adgangspunkt?.koordinater??null;return{type:"accessAddress",id:e.id_lokalid,label:e.adgangsadressebetegnelse,houseNumber:e.husnummertekst,streetName:e.vejnavn,statusCode:e.status,position:t?{x:t.x,y:t.y,crs:"EPSG:25832"}:null,postalCode:{id:e.postnummer.id_lokalid,code:e.postnummer.postnr,name:e.postnummer.navn},municipalityCode:e.navngivenvejkommunedel?.kommune??null,roadCode:e.navngivenvejkommunedel?.vejkode??null,streetId:e.navngivenvejpostnummer?.id_lokalid??null,namedRoadId:e.navngivenvej?.id_lokalid??null,supplementaryTownName:e.supplerendebynavn?.navn??null,...mi(e),raw:e}}function Tt(e){return{type:"address",id:e.id_lokalid,label:e.adressebetegnelse,floor:e.etagebetegnelse,door:e.doerbetegnelse,statusCode:e.status,accessAddress:ht(e.husnummer),...mi(e),raw:e}}function pr(e){return{type:"street",id:e.id,label:e.titel,streetName:e.vejnavn,postalCode:e.postnr,postalDistrict:e.postdistrikt,postalCodeId:e.postnummer,accessAddressCount:e.antal_husnumre,geometry:e.geometri?{type:"MultiLineString",coordinates:e.geometri.coordinates,crs:"EPSG:25832"}:null,raw:e}}function Dt(e){return"id"in e?`${e.type}:${e.id}`:`${e.type}:${e.label}`}var Xu=/[^\p{L}\p{N}\s.,'-]/gu;function Je(e){return e.replace(Xu," ").replace(/\s+/g," ").trim().slice(0,73).trimEnd()}function mr(e){let t=String(e).trim();if(!/^\d{1,4}$/.test(t))throw RangeError(`Municipality code must be 1 to 4 digits, got "${t}"`);return t.padStart(4,"0")}var hi="adressevaelger123",gi="https://adressevaelger.dk",hr=200;function tn(e={}){let t=e.token??hi,n=(e.baseUrl??gi).replace(/\/+$/,""),r=e.fetch??((a,i)=>globalThis.fetch(a,i));async function o(a,i,l){let d=[...i,["token",t]].map(([k,A])=>`${k}=${encodeURIComponent(A)}`).join("&"),h=`${n}/${a}?${d}`,u=await r(h,{signal:l,headers:{accept:"application/json"}});if(u.status===404)return null;let v=await u.text();if(!u.ok)throw new mt(v.trim()||u.statusText||`HTTP ${u.status}`,{status:u.status,url:h});let x;try{x=JSON.parse(v)}catch{throw new mt(`Expected JSON from KDS, got: ${v.slice(0,200)}`,{status:u.status,url:h})}if(x.status==="fejl"){let k=x.beskrivelse;throw new mt(typeof k==="string"?k:"KDS returned an error",{status:u.status,url:h})}return x}function s(a,i){let l=new Map(a.map((c)=>[c.id,c]));return i.flatMap((c)=>l.get(c)??[])}return{async search(a,i={}){let l=Je(a);if(!l)return[];let c=[["tekst",l]];if(i.limit!==void 0){let{limit:u}=i;if(!Number.isInteger(u)||u<1||u>hr)throw RangeError(`limit must be an integer from 1 to ${hr}, got ${u}`);c.push(["maksimum",String(u)])}if(i.municipalityCodes?.length)c.push(["kommunekode",i.municipalityCodes.map(mr).join(",")]);if(i.includeProvisional)c.push(["medtagforeloebige","true"]);let d=(i.kind??"address")==="address"?"adresser":"husnumre";return((await o(`${d}/soeg`,c,i.signal))?.fund??[]).flatMap((u)=>fr(u)??[])},async getAddress(a,i={}){let l=await o(`adresser/${encodeURIComponent(a)}`,[],i.signal);return l?Tt(l.adresse):null},async getAddresses(a,i={}){if(a.length===0)return[];let l=await o("adresser",[["id_lokalids",a.join(",")]],i.signal);return s((l?.adresser??[]).map(Tt),a)},async getAccessAddress(a,i={}){let l=await o(`husnumre/${encodeURIComponent(a)}`,[],i.signal);return l?ht(l.husnummer):null},async getAccessAddresses(a,i={}){if(a.length===0)return[];let l=await o("husnumre",[["id_lokalids",a.join(",")]],i.signal);return s((l?.husnumre??[]).map(ht),a)},async getAccessAddressUnits(a,i={}){return((await o(`husnumre/${encodeURIComponent(a)}/adresser`,[],i.signal))?.adresser??[]).map(Tt)},async getStreet(a,i={}){let l=await o(`navngivenvejpostnumre/${encodeURIComponent(a)}`,[],i.signal);return l?pr(l.navngivenvejpostnummer):null},async getStreetAccessAddresses(a,i={}){return((await o(`navngivenvejpostnumre/${encodeURIComponent(a)}/husnumre`,[],i.signal))?.husnumre??[]).map(ht)}}}var Gu=new Intl.Collator("da",{numeric:!0,sensitivity:"base"});function bi(e,t){let n=t.trim().toLowerCase();if(!n)return[];return e.filter((r)=>r.houseNumber.toLowerCase().startsWith(n)).toSorted((r,o)=>Gu.compare(r.houseNumber,o.houseNumber)).map((r)=>({type:"accessAddress",id:r.id,label:r.label,streetName:r.streetName,houseNumber:r.houseNumber}))}function yi(e,t,n){let r=new Set;for(let s of e){if("id"in s)r.add(s.id);if(s.type==="address")r.add(s.accessAddressId)}let o=t.filter((s)=>!("id"in s)||!r.has(s.id));return[...e,...o].slice(0,n)}function vi(e,t,n,r){return{action:"refine",value:e+t,caret:e.length,template:r?{before:e,after:t,kind:n,streetId:r}:{before:e,after:t,kind:n}}}function gr(e){return{action:"refine",value:e,caret:e.length,template:null}}function wi(e){return{action:"complete",value:e,caret:e.length}}function xi(e,t){switch(e.type){case"streetName":return gr(`${e.streetName} `);case"streetNameNumber":return gr(e.label);case"street":return vi(`${e.streetName} `,`, ${e.postalCode} ${e.postalDistrict}`,"houseNumber",e.id);case"accessAddress":{if(t==="accessAddress")return wi(e.label);let n=`${e.streetName} ${e.houseNumber}, `;if(!e.label.startsWith(n))return gr(e.label);return vi(n,`, ${e.label.slice(n.length)}`,"unit")}case"address":return wi(e.label)}}function br(e,t){let{before:n,after:r}=t;if(e.length<n.length+r.length)return null;if(!e.startsWith(n)||!e.endsWith(r))return null;let o=n.length,s=e.length-r.length;return{start:o,end:s,kind:t.kind,text:e.slice(o,s)}}var Qu=100,Si={value:"",caret:null,slot:null,suggestions:[],status:"idle",error:null,open:!1,selection:null,fields:{},expanded:!1};function yr(e,t={}){return Object.fromEntries((e?.fields??[]).map(({name:n})=>[n,t[n]??""]))}function Ju(e){return(e.type==="address"?e.accessAddress:e).postalCode.code}function vr(e={}){let t=e,n,r=()=>t.client??(n??=tn()),o=()=>t.kind??"address",s=()=>t.fields,a=()=>t.fields?t.searchField:void 0,i={...Si,fields:yr(t.fields)},l=null,c=new Set,d=null,h=[],u=null,v,x,w,k=0,A=0,W=new Map;function M(E){i={...i,...E};let p=a();if(p!==void 0&&i.fields[p]!==i.value)i={...i,fields:{...i.fields,[p]:i.value}};for(let b of c)b()}function I(E){let p=a();if(l&&p!==void 0)return l.fields[p]===E;return i.selection?.suggestion.label===E}function N(E,p){let b=p.format(E);l={fields:b,postalCode:Ju(E)};let C=a(),K=C===void 0?void 0:b[C];return K===void 0?{fields:b,expanded:!0}:{fields:b,expanded:!0,value:K,caret:Q(K.length)}}function q(E){let p=a();if(!l||p===void 0||/\b\d{4}\b/.test(E))return E;let b=s()?.fields.find((C)=>C.parts.includes("postalCode"));if(!b||b.name===p)return E;if(i.fields[b.name]!==l.fields[b.name])return E;return`${E}, ${l.postalCode}`}function Q(E){return A+=1,{position:E,revision:A}}function L(E){if(t.houseNumberPrefix===!1||E?.kind!=="houseNumber"||!d?.streetId)return[];let p=W.get(d.streetId);return Array.isArray(p)?bi(p,E.text):[]}function R(){let E=u===i.value?h:[];return yi(E,L(i.slot),t.limit??Qu)}function V(E){if(W.has(E))return;W.set(E,"loading"),r().getStreetAccessAddresses(E).then((p)=>{if(W.set(E,p),d?.streetId===E&&i.slot?.kind==="houseNumber")M({suggestions:R()})},()=>{W.delete(E)})}function z(){clearTimeout(v),v=void 0,x?.abort(),x=void 0,k+=1}function Z(E){clearTimeout(v),v=void 0;let p=i.value;if(!Je(p)){z(),h=[],u=p,M({suggestions:[],status:"idle",error:null,open:!1});return}let b=t.debounceMs??100;if(E||b<=0)ne(p);else v=setTimeout(()=>void ne(p),b)}async function ne(E){v=void 0,x?.abort();let p=new AbortController;x=p,k+=1;let b=k;M({status:"loading",error:null});try{let C=await r().search(q(E),{kind:o(),limit:t.limit,municipalityCodes:t.municipalityCodes,includeProvisional:t.includeProvisional,signal:p.signal});if(b!==k||E!==i.value)return;h=C,u=E,M({status:"success",suggestions:R()})}catch(C){if(b!==k||Ot(C)||E!==i.value)return;h=[],u=E,M({status:"error",error:C,suggestions:R(),expanded:i.expanded||s()!==void 0})}finally{if(x===p)x=void 0}}async function re(E){w?.abort();let p=new AbortController;w=p;let b=()=>!p.signal.aborted&&i.selection?.suggestion===E;try{let C=E.type==="address"?await r().getAddress(E.id,{signal:p.signal}):await r().getAccessAddress(E.id,{signal:p.signal});if(!b())return;if(!C){M({selection:{suggestion:E,status:"error",details:null,error:Error(`KDS has no ${E.type} with id ${E.id}`)},expanded:i.expanded||s()!==void 0});return}let K={suggestion:E,status:"success",details:C,error:null},_=s();M({selection:K,..._&&N(C,_)}),t.onSelect?.(K)}catch(C){if(!b()||Ot(C))return;M({selection:{suggestion:E,status:"error",details:null,error:C},expanded:i.expanded||s()!==void 0})}}let ee={getState:()=>i,subscribe(E){return c.add(E),()=>c.delete(E)},setInput(E){if(E===i.value)return;let p=null;if(d){if(p=br(E,d),!p)d=null}let b=I(E)?i.selection:null;if(!b)w?.abort();if(M({value:E,caret:null,slot:p,selection:b,open:Je(E)!==""}),L(p).length>0)M({suggestions:R()});Z(!1)},async select(E){let p=xi(E,o());if(p.action==="refine"){if(d=p.template,d?.streetId&&t.houseNumberPrefix!==!1)V(d.streetId);w?.abort(),M({value:p.value,caret:Q(p.caret),slot:d?br(p.value,d):null,selection:null,open:!0}),Z(!0);return}if(E.type!=="address"&&E.type!=="accessAddress")return;z(),d=null,l=null;let b=t.fetchDetails!==!1,C={suggestion:E,status:b?"loading":"success",details:null,error:null};if(M({value:p.value,caret:Q(p.caret),slot:null,open:!1,selection:C}),b)await re(E);else{if(s())M({expanded:!0});t.onSelect?.(C)}},async selectById(E){z(),d=null,w?.abort();let p=new AbortController;w=p;let b=p.signal;try{let C=o()==="address"?await r().getAddress(E,{signal:b}):await r().getAccessAddress(E,{signal:b});if(b.aborted||!C)return null;let _={suggestion:C.type==="address"?{type:"address",id:C.id,label:C.label,accessAddressId:C.accessAddress.id}:{type:"accessAddress",id:C.id,label:C.label,streetName:C.streetName,houseNumber:C.houseNumber},status:"success",details:C,error:null};h=[],u=null,l=null;let U=s();return M({value:C.label,caret:Q(C.label.length),slot:null,suggestions:[],status:"idle",error:null,open:!1,selection:_,...U&&N(C,U)}),t.onSelect?.(_),_}catch(C){if(b.aborted||Ot(C))return null;return M({status:"error",error:C}),null}},setOpen(E){if(E!==i.open)M({open:E})},setOptions(E){let p=t;t={...t,...E};let b=(p.kind??"address")!==o(),C=b||p.limit!==t.limit||p.includeProvisional!==t.includeProvisional||String(p.municipalityCodes??"")!==String(t.municipalityCodes??"");if(b)d=null,w?.abort(),M({slot:null,selection:null});if(JSON.stringify(p.fields?.fields)!==JSON.stringify(t.fields?.fields)){let K=t.fields,_=i.selection?.details;if(K&&_)M(N(_,K));else l=null,M({fields:yr(K,i.fields),expanded:K?i.expanded:!1})}if(C&&Je(i.value))u=null,M({open:!0}),Z(!0)},setField(E,p){if(E===a()){ee.setInput(p);return}if(!(E in i.fields)||i.fields[E]===p)return;let b=i.selection&&l?.fields[E]===p?i.selection:null;if(!b)w?.abort();M({fields:{...i.fields,[E]:p},selection:b})},expand(){if(!i.expanded)M({expanded:!0})},clear(){z(),w?.abort(),d=null,l=null,h=[],u=null,M({...Si,fields:yr(s()),caret:Q(0)})},destroy(){z(),w?.abort()}};return ee}var se=!1;function Le(e){}function me(e,t,n){}function ki(e,t){return e}function Ai(e,t){}function Ei(e,t,n,r,o,s){}function Ci(e,t,n,r){}function Mi(e,t,n){}function Pi(e){}function Oi(e,t){}function Ti(e){e()}var Di=()=>!1;function Li(e,t,n){}function Ii(e,t,n,r){}function wr(e,t,n){}var Fi=new Set;function Ve(e){Fi.add(e),queueMicrotask(()=>{if(Fi.delete(e))e()})}var Zu='input, textarea, select, [contenteditable]:not([contenteditable="false"])';function Ri(e,{el:t}){let n=e.target.closest(Zu);if(n&&!n.contains(t??null))return;e.preventDefault()}var Ze={pointerdown:Ri,mousedown:Ri};var $i;function Ni(e){let t=$i?.get(e);return $i?.delete(e),t}var ed=4,Ce=(e,t)=>!!(e.compareDocumentPosition(t)&ed),xr=(e,t)=>Ce(e,t)?-1:1,td=16,nd=32;function et(e){let t=e.length<td?null:e[0].el.parentNode;while(t&&!e.every(({el:n})=>t.contains(n)))t=t.parentNode;if(t){let n=new Map(e.map((a)=>[a.el,a])),r=[],o=e[0].el.ownerDocument.createTreeWalker(t,1),s=e.length*nd;for(let a=t;a&&s--;a=o.nextNode()){let i=n.get(a);if(i&&r.push(i)===e.length)return r}}return e.sort((n,r)=>xr(n.el,r.el))}function Wi(){let e=new Map,t,n=[],r=!1,o,s=new Set,a=(d)=>e.get(d.key)===d;function i(d,h){o??=new MutationObserver(()=>t=void 0);let u=h[h.length-1]?.el;for(let{el:v}of d)for(let x=v.parentNode;x&&!s.has(x);x=x.parentNode)if(s.add(x),o.observe(x,{childList:!0}),x.contains(u))break}function l(){let d=[...e.values()],h=et(d.filter((u)=>u.el.isConnected));if(h.length<d.length)return h;if(typeof MutationObserver<"u")o?.disconnect(),s.clear(),i(h,h);return t=h}function c(d){let h=n.filter(a);if(h.some((v)=>!v.el.isConnected))return;let u=d.filter(a);if(h.length*Math.log2(u.length+2)>u.length)return;for(let v of h){let x=0,w=u.length;while(x<w){let k=x+w>>1;if(Ce(u[k].el,v.el))x=k+1;else w=k}u.splice(x,0,v)}if(o)i(h,u);return u}return{list(){if(o?.takeRecords().length)t=void 0;if(t&&(n.length||r))t=c(t);return n=[],r=!1,t??l()},add(d){if(t&&e.has(d.key))r=!0;if(e.set(d.key,d),t)n.push(d);return()=>{if(!a(d))return;if(e.delete(d.key),r=!0,!e.size)o?.disconnect(),s.clear(),t=void 0}},get:(d)=>e.get(d),size:()=>e.size}}var nn=(e)=>e.isTrusted;function ji(e,t){setTimeout(()=>{if(!e.defaultPrevented)t()})}var Sr=new Set;function kr(e,t){if(Sr.has(e))return t();Sr.add(e);try{t()}finally{Sr.delete(e)}}function Vi(e,t){return e!==void 0&&t===void 0}var rd=new WeakMap,rn=new WeakMap;function qi(e,t){return rn.set(e,t),()=>{if(rn.get(e)===t)rn.delete(e)}}function od(e){let t=rn.get(e);if(t)t();else e.focus()}var Ar=new WeakSet;function Hi(e,t){let n=t??e.ownerDocument;if(Ar.has(n))return;Ar.add(n),setTimeout(()=>Ar.delete(n)),od(e)}function Cr(e,t,n){rd.set(e,{internals:t,bind:n})}var id=new Set;function Lt(e){id.forEach((t)=>t(e))}var sd=new Set(["text","search","url","tel","email","password","date","month","week","time","datetime-local","number"]),ad=new WeakSet;var ld=(e)=>Array.from(e.getRootNode().querySelectorAll("button, input[type=submit], input[type=image]")).find((t)=>t.form===e&&(t.type==="submit"||t.type==="image")),cd=(e)=>e.filter((t)=>t instanceof HTMLInputElement&&sd.has(t.type));function Ki(e){if(!e)return;let t=ld(e);if(t){if(!t.disabled)t.click();return}if(cd(Array.from(e.elements)).filter((n)=>!ad.has(n)).length<=1)e.requestSubmit()}function ud(e){for(let t=e.parentElement;t;t=t.parentElement){if(!(t instanceof HTMLFieldSetElement)||!t.disabled)continue;if(!t.querySelector(":scope > legend")?.contains(e))return!0}return!1}var Er=new WeakMap;function Bi(e,t){let n,r,o=!0,s=()=>{if(r){r.disconnect();for(let l=e.parentElement;l?.closest("fieldset");l=l.parentElement)r.observe(l,{childList:!0,attributeFilter:["disabled"]})}let i=ud(e);if(i!==n)t(n=i)},a=()=>{if(!o)return;if(typeof MutationObserver<"u")r=new MutationObserver(s);s(),Er.set(e,s)};if(e.isConnected)a();else queueMicrotask(a);return()=>{o=!1,r?.disconnect(),Er.delete(e)}}var Mr=(e)=>Er.get(e)?.(),Me=(e)=>e.disabled||e.formDisabled;var dd=globalThis[Symbol.for("ui-sdk.label-ids@1")]??={count:0};function on(e){let t=[],n=e.closest("label");if(n?.control===e)t.push(n);if(e.id)e.getRootNode().querySelectorAll(`label[for="${CSS.escape(e.id)}"]`).forEach((o)=>{if(o!==n&&o.control===e)t.push(o)});return t.sort(xr)}function _i(e,t,n=e){let r,o=()=>{let s=e.getAttribute("aria-labelledby");if(e.hasAttribute("aria-label")||s!==null&&s!==r)return;let a=t();for(let l of a)if(!l.id)l.id=`ui-sdk-label-${++dd.count}`;let i=a.map((l)=>l.id).join(" ");if(!i){if(r!==void 0)e.removeAttribute("aria-labelledby");r=void 0;return}if(r=i,s!==i)e.setAttribute("aria-labelledby",i)};return queueMicrotask(o),n.addEventListener("focusin",o),()=>n.removeEventListener("focusin",o)}function zi(e,t,n){let r=()=>e.value!==e.defaultValue&&!t().includes(e.value),o=Ni(e);if(r()){n();return}if(o===void 0)return;queueMicrotask(()=>{if(e.isConnected&&!r()){if(e.value=o,r())n()}})}Ie();function an(){return be&&typeof HTMLElement.prototype.showPopover==="function"}function Pr(e){if(e)return e;if(be&&!an())return document.body;return null}function fe(e=document){let t=e.activeElement;while(t?.shadowRoot?.activeElement)t=t.shadowRoot.activeElement;return t}function ln(e){let t=[e],n=e;while(n){let r=n.assignedSlot??n.parentNode??n.host;if(r&&r!==n.parentNode)t.push(r);n=r}return t}function ye(e,t){return ln(t).some((n)=>e.contains(n))}var Yi;var fd;function It(){if(Yi)return Yi==="apple";return fd??=be&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent)}function pd(e){try{return Intl.getCanonicalLocales(e?e.split(/[.@]/)[0].replaceAll("_","-"):[])[0]}catch{}}function Ui(){if(typeof navigator>"u")return;return pd(navigator.languages?.[0]??navigator.language)}var md="abcdefghijklmnopqrstuvwxyz",hd=/\p{Diacritic}/gu,gd=/\p{Script=Latin}/u,bd=/^[\u0000-\u007f]*$/,yd=/^(tr|az|lt)\b/i;function vd(e){let t=new Intl.Collator(e,{sensitivity:"base",usage:"search"}),n=yd.test(e??"")?(i)=>i.toLocaleLowerCase(e):(i)=>i.toLowerCase(),r=new Map,o=new Map;function s(i){let l=r.get(i);if(l!==void 0)return l;let c=n(i);if(i<"€")return r.set(i,c),c;let d=n(i.normalize("NFD").replace(hd,""));if(d.length===i.length&&d!==c&&t.compare(i,d)===0)l=d;else if(gd.test(i))l=[...md].find((h)=>t.compare(i,h)===0);return l??=c.length===i.length?c:i,r.set(i,l),l}function a(i){let l=o.get(i);if(l!==void 0)return l;if(bd.test(i))l=n(i);else{l="";for(let c of i)l+=s(c)}if(o.size>50000)o.clear();return o.set(i,l),l}return{locale:e,fold:a}}var cn,Xi=!1;function wd(){if(cn)return cn;if(!Xi&&typeof window<"u")Xi=!0,window.addEventListener("languagechange",()=>cn=void 0);return cn=vd(Ui())}var tt=(e)=>wd().fold(e);function Or(e){let t=0;while(t<e.length&&e.charCodeAt(t)<=32)t++;return t}var xd=new Set([" ","-","_","/",".",":",",","(",")","[","]","@","#"]),un=(e,t)=>t===0||xd.has(e[t-1]);function Gi(e,t,n){let r=tt(t.trim());if(!r)return[];let o=tt(e),s=o.indexOf(r);if(n==="startsWith"){let a=Or(o);return o.startsWith(r,a)?[{start:a,end:a+r.length}]:[]}if(s!==-1){let a=n==="fuzzy"?Sd(o,r,s):s;return[{start:a,end:a+r.length}]}return n==="fuzzy"?kd(o,r):[]}function Sd(e,t,n){for(let r=n;r!==-1;r=e.indexOf(t,r+1))if(un(e,r))return r;return n}function kd(e,t){let n=[],r=0;for(let o of t){if(o===" ")continue;let s=e.indexOf(o,r);if(s===-1)return[];let a=n.at(-1);if(a&&a.end===s)a.end=s+1;else n.push({start:s,end:s+1});r=s+1}return n}function Qi(e,t){if(!t.length)return[{text:e,match:!1}];let n=[],r=0;for(let{start:o,end:s}of t){if(o>r)n.push({text:e.slice(r,o),match:!1});n.push({text:e.slice(o,s),match:!0}),r=s}if(r<e.length)n.push({text:e.slice(r),match:!1});return n}var Pe=(e)=>tt(e).trim();function Zi(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Ad(e){let t="",n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);while(n.nextNode()){let r=n.currentNode,o=r.parentElement?.closest('[aria-hidden="true"], [hidden]');if(o&&e.contains(o)&&(o!==e||o.getAttribute("aria-hidden")==="true"))continue;t+=r.textContent}return t}function es(e){return Ad(e).replace(/\s+/g," ").trim()||(e.getAttribute("aria-label")??"")}function Ji(e,t){return t.length===1?e+1:Math.max(e,0)}function ts(e=500){let t="",n="",r=!1,o;function s(){t="",n="",r=!1,clearTimeout(o)}function a(l,c,d){let h=l.length;for(let u=0;u<h;u++){let v=((d+u)%h+h)%h;if(Pe(l[v]).startsWith(c))return v}return-1}function i(l,c,d){if(l.length!==1||l===" "&&!t)return-1;clearTimeout(o),o=setTimeout(s,e);let h=Pe(l)||l;if(r=h===n&&(r||t.length===1),n=h,t+=h,r){let u=a(c,t,Math.max(d,0));return u!==-1?u:a(c,h,Ji(d,h))}return a(c,t,Ji(d,t))}return Object.assign(i,{reset:s,active:()=>t.length>0})}var ns=(e,t)=>0.09*e.length/t.length;function Ed(e,t,n){for(let r=n;r!==-1;r=e.indexOf(t,r+1))if(un(e,r))return r;return-1}function Cd(e,t){let n=0,r=-2,o=0,s=0;for(let a of t){if(a===" ")continue;let i=e.indexOf(a,n);if(i===-1)return 0;if(s++,un(e,i))o+=1;if(i===r+1)o+=1;r=i,n=i+1}if(!s)return 0;return 0.1+0.4*o/(2*s)}function rs(e,t){let n=Pe(t);if(!n)return 1;let r=Pe(e);if(r===n)return 1;let o=r.indexOf(n);if(o===0)return 0.9+ns(n,r);if(o>0)return(Ed(r,n,o)!==-1?0.75:0.6)+ns(n,r);return Cd(r,n)}function os(e,t){let n=rs(e.label,t);for(let r of e.keywords??[])n=Math.max(n,rs(r,t)*0.95);return n}function Tr(e,t,n,r){if(t==="first")return 0;if(t==="last")return n-1;let o=e+t;if(r)return(o%n+n)%n;return Math.max(0,Math.min(n-1,o))}function is(e,t,n,r,o=0,s=0){if(n-o<e)return Math.max(0,n-o);if(n+r+s>e+t)return Math.max(0,n+r+s-t);return e}function qe(e){return typeof e==="string"?{value:e,label:e}:e}var dn=(e)=>typeof e==="object"&&("type"in e)&&e.type==="group",fn=(e)=>typeof e==="object"&&("type"in e)&&e.type==="separator";function Dr(e,t){let n=[];return e.forEach((r,o)=>{if(fn(r))return;if(dn(r)){for(let s of r.items)n.push(ss(qe(s),t,`group-${o}`));return}n.push(ss(qe(r),t))}),n}function ss(e,t,n){return{key:t(e.value),value:e.value,label:e.label,keywords:e.keywords,disabled:!!e.disabled,group:n}}function as(e,t){for(let n=e.parentElement;n;n=n.parentElement){let r=getComputedStyle(n);if(/(auto|scroll)/.test(r.overflowY)&&n.scrollHeight>n.clientHeight){let o=e.getBoundingClientRect().top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop,s=parseFloat(r.scrollPaddingTop)||0,a=parseFloat(r.scrollPaddingBottom)||0,i=is(n.scrollTop,n.clientHeight,o,e.offsetHeight,s,a),l=Math.min(i,n.scrollHeight-n.clientHeight);if(l!==n.scrollTop)n.scrollTop=l;return}if(n===t)return}}function ls(e,t){let{store:n}=e,r=typeof e.focus==="function"?e.focus:()=>e.focus,o=Wi(),s=new Map,a=ts(),i=new Set,l,c,d,h,u=0,v=0,x=(f,m)=>{if(m?.data===f)return m;let y=Dr(f,e.toKey);return{data:f,flat:y,byKey:new Map(y.map((S)=>[S.key,S]))}};function w(){let f=e.items();if(!f)return;return l=x(f,l)}function k(){let f=e.emptyItems?.();return f&&(c=x(f,c))}function A(){if(!e.items()||!(e.showEmpty?.()??!e.query().trim()))return;return k()}function W(f){return w()?.byKey.get(f)??k()?.byKey.get(f)}function M(){let f=A()??w();if(!f)return;let m=e.query(),y=e.filter(),S=e.rank?.()??!1;if(d?.data!==f.data||d.query!==m||d.filter!==y||d.rank!==S){let T=t.data(f.data,m,y,{rank:S});d={data:f.data,query:m,filter:y,rank:S,list:T,flat:Dr(T,e.toKey)}}return d}function I(f,m){let y=o.get(f)?.el;if(!y||y===m||!y.isConnected)return;let S=m.getAttribute("data-slot")??"";me(`Two items have the value "${f}". Give each item its own value, or arrow keys skip one and choosing it picks the other.`,{component:S.replace(/-item$/,"")||"listbox"})}function N(f,m){let y=m.meta(),S=y.label??es(m.el);if(y.pinned)return S;let T=s.get(f);if(T?.label!==S)s.set(f,{...T,label:S,value:y.value}),u++;return S}function q(f,m){let y=m.meta();return{key:f,value:y.value,label:N(f,m),keywords:y.keywords,get disabled(){return!!m.meta().disabled},group:y.group,pinned:y.pinned}}let Q=new Map,L=(f,m)=>!!w()||V(f,m);function R(f,m){return Q.set(f,m),L(f,m)}function V(f,m){let y=o.get(f),S=m.label??(y?N(f,y):s.get(f)?.label)??(typeof m.value==="string"?m.value:"");return t.matches({value:m.value,label:S,keywords:m.keywords},e.query(),e.filter())}function z(f){if(!i.size)return f;let m=f.length?o.get(f[0].key)?.el:void 0,y=[],S=[];for(let T of i){let g=o.get(T);if(!g?.el.isConnected)continue;(!!m?.isConnected&&Ce(g.el,m)?y:S).push(q(T,g))}return y.length||S.length?[...y,...f,...S]:f}function Z(){let f=o.list(),m=e.query(),y=e.filter();if(h?.order===f&&h.query===m&&h.filter===y&&h.version===u)return h.list;let S=f.map((T)=>q(T.key,T)).filter((T,g)=>f[g].meta().pinned||V(T.key,T));return h={order:f,query:m,filter:y,version:u,list:S},S}function ne(){let f=M();if(f)return z(f.flat);return Z()}let re=(f)=>f.disabled||!!e.blocked?.(f);function ee(f){if(f===null)return;let m=W(f);if(m)return m;let y=o.get(f);if(y)return q(f,y);let S=s.get(f);if(S)return{key:f,value:S.value,label:S.label,disabled:!1}}function E(f,m){if(r()==="real"&&m&&e.active())f.focus({preventScroll:!0});if(e.keepInView?.()!==!1)as(f,(e.scrollRoot??e.container)?.())}function p(f,{focus:m=!0,event:y}={}){n.set({highlighted:f});let S=ne(),T=f===null?-1:S.findIndex((D)=>D.key===f);e.onHighlight?.(f,T,y);let g=S.length-1;if(e.skipDisabled)while(g>0&&S[g].disabled)g--;if(T!==-1&&T===g)e.onLastReached?.();if(f===null)return;let O=o.get(f)?.el;if(O?.isConnected)E(O,m)}function b(f,{loop:m=e.loop()&&Math.abs(Number(f))===1}={}){let y=ne(),S=e.skipDisabled?y.filter((D)=>!D.disabled):y;if(!S.length)return;let T=n.get().highlighted,g=S.findIndex((D)=>D.key===T);if(g!==-1||typeof f!=="number")return S[Tr(g,f,S.length,m)].key;let O=y.findIndex((D)=>D.key===T);if(O!==-1){let D=y.slice(0,O).filter((H)=>!H.disabled).length;return S[Tr(f>0?D-1:D,f,S.length,m)].key}return S[f>0?0:S.length-1].key}function C(f,m){let y=b(f);if(y!==void 0)p(y,{event:m})}function K(f,m){let y=ne().filter((T)=>!T.pinned),S=a(f,y.map((T)=>re(T)?"":T.label),y.findIndex((T)=>T.key===m));return S===-1?void 0:y[S]}function _(f){let m=f.ownerDocument;return!m.activeElement||m.activeElement===m.body}let U=typeof MutationObserver>"u"?void 0:new MutationObserver(oe);function oe(){let f=n.get().highlighted,m=f===null?void 0:o.get(f)?.el;if(m?.isConnected&&_(m))E(m,!0)}function ce(f,m){let y=()=>n.get().highlighted===f&&e.active();if(r()!=="real"||!y()||m.ownerDocument.activeElement===m)return;queueMicrotask(()=>{if(y()&&m.isConnected)E(m,!0)})}function ae(f,m,y){if(v++,se)I(f,m);let S={key:f,el:m,meta:y},T=o.add(S),g=y();if(g.pinned)i.add(f);else{let O=s.get(f);if(g.label!==void 0&&O?.label!==g.label)u++;s.set(f,{...O,label:g.label??O?.label??"",value:g.value,keywords:g.keywords,group:g.group})}return queueMicrotask(()=>{if(o.get(f)!==S||!S.el.isConnected)return;if(N(f,S),S.el.parentNode)U?.observe(S.el.parentNode,{childList:!0})}),e.onRegister?.(f),ce(f,m),()=>{if(o.get(f)!==S)return;if(T(),v++,i.delete(f),!o.size())U?.disconnect();e.onRegister?.(f),queueMicrotask(()=>P(f,m))}}function P(f,m){if(o.get(f)||W(f)||n.get().highlighted!==f)return;if(n.set({highlighted:null}),e.onHighlight?.(null,-1),r()==="real"&&e.active()&&_(m))e.container?.()?.focus({preventScroll:!0})}return{entries:ne,visibleData:M,dataItems:()=>w()?.flat,find:ee,disabled:re,isItemDisabled:(f)=>!!ee(f)?.disabled,highlight:p,move:C,stepKey:b,firstEnabled:()=>ne().find((f)=>!f.pinned&&!re(f))?.key,search:K,register:ae,typing:()=>a.active(),resetTyping:()=>a.reset(),labelOf(f){let m=W(f);if(m)return m.label;let y=o.get(f);if(y)return N(f,y);return s.get(f)?.label},valueOf(f){let m=W(f);if(m)return m.value;return o.get(f)?.meta().value??s.get(f)?.value},matches:R,listing(f){let m={},y,T=!w()&&!!e.query().trim()?new Set(Z().map((O)=>O.key)):void 0,g=(O,D,H)=>{if(typeof m[O]==="string")return;let B=o.get(O),j=H?D:B?.meta()??D,X=!T||T.has(O)||!B?.el.isConnected&&V(O,j)?"":"-";if(j.index!==void 0)X+=y??=ne().length;if(f)X+=f(O,j.value);m[O]=X};for(let[O,D]of Q)g(O,D,!0);for(let[O,D]of s)g(O,D,!1);for(let O of w()?.flat??[])g(O.key,O,!1);for(let O of k()?.flat??[])g(O.key,O,!1);return m},listingInputs:()=>[e.items()?i.size:v,e.items()?0:u,e.query(),e.filter(),e.items(),e.emptyItems?.(),e.showEmpty?.(),e.rank?.()],selectable(f){let m=[];for(let y of ne()){if(y.pinned||y.disabled)continue;if(f!==void 0&&(o.get(y.key)?.meta().group??y.group)!==f)continue;m.push(y.key)}return m},count(){let f=0;for(let m of ne())if(!m.pinned)f++;return f},groupMatches(f){if(w()||!e.query().trim())return!0;return o.list().some((m)=>m.meta().group===f&&V(m.key,m.meta()))},element:(f)=>o.get(f)?.el,labelsVersion:()=>u,remember(f,m,y,S){let T=s.get(f),g=T?.keywords,O=T?.label===m&&(!S||g?.length===S.length&&S.every((D,H)=>D===g[H]));if(T&&O){if(T.value!==y)s.set(f,{...T,value:y});return}s.set(f,{...T,label:m,value:y,...S&&{keywords:S}}),u++}}}var cs=(e,t)=>e.entries().find((n)=>n.key===t&&!n.pinned&&!e.disabled(n));function Lr(e,t,n){if(t===n||t!==null&&!cs(e,t))return!1;return e.highlight(t),!0}function Ir(e,t){let n=e.find(t);return n&&!n.pinned?n.value??null:null}function Md(e,t,n){let r=tt(t.trim());if(!r)return!0;let o=tt(e);return n==="startsWith"?o.startsWith(r,Or(o)):o.includes(r)}function Fr(e,t,n){if(n===!1||n===void 0||!t.trim())return 1;if(typeof n==="function"){let r=n(e,t);return typeof r==="number"?Math.max(0,r):r?1:0}return[e.label,...e.keywords??[]].some((r)=>Md(r,t,n))?1:0}function Rr(e,t,n){return Fr(e,t,n)>0}function Pd(e,t,n,{rank:r=!1}={}){if(n===!1||n===void 0||!t.trim())return e;if(r)return Od(e,t,n);let o=[],s,a=(i)=>{if(s&&o.length)o.push(s);s=void 0,o.push(i)};for(let i of e){if(fn(i)){s=i;continue}if(dn(i)){let l=i.items.filter((c)=>Rr(qe(c),t,n));if(l.length)a({...i,items:l});continue}if(Rr(qe(i),t,n))a(i)}return o}var us=(e,t)=>t.score-e.score;function Od(e,t,n){let r=[],o,s=(i,l)=>{r.push({entry:i,score:l,separator:r.length?o:void 0}),o=void 0};for(let i of e){if(fn(i)){o=i;continue}if(dn(i)){let c=[];for(let d of i.items){let h=Fr(qe(d),t,n);if(h>0)c.push({entry:d,score:h})}if(!c.length)continue;c.sort(us),s({...i,items:c.map((d)=>d.entry)},c[0].score);continue}let l=Fr(qe(i),t,n);if(l>0)s(i,l)}let a=[...r].sort(us);if(a.some((i,l)=>i!==r[l]))return a.map((i)=>i.entry);return r.flatMap((i)=>i.separator?[i.separator,i.entry]:[i.entry])}var Td={data:Pd,matches:Rr};function ds(e){return ls(e,Td)}function fs(e,t){return(n)=>{if(n===null)return;if(n==="false")return!1;return e.includes(n)?n:t}}var ps=10;function $r(e,{apple:t}){let{key:n}=e;if(n==="ArrowDown")return e.metaKey?"last":1;if(n==="ArrowUp")return e.metaKey?"first":-1;if(n==="PageDown")return ps;if(n==="PageUp")return-ps;let r=t&&e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey;if(r&&n==="n")return 1;if(r&&n==="p")return-1}function ms(e,{listbox:t,highlighted:n,choose:r,focusInput:o}){let s=e.key==="Home"?"first":e.key==="End"?"last":$r(e,{apple:It()});if(s!==void 0)return e.preventDefault(),t.move(s,e);if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),n===null)return;let a=t.element(n);if(e.key==="Enter"&&a?.matches("a[href]"))return a.click();return r(n,e)}if(Zi(e))o()}var Nr=new WeakMap;function hs(e,t){let n=Nr.get(e);if(!n)Nr.set(e,n=[]);n.push(t)}function nt(e,t,n){hs(e.store,{from:"options",keys:t,derive:n})}function gs(e,t,n,{live:r=!0}={}){let{store:o}=e;hs(o,{from:"state",keys:t,derive:n}),o.subscribe((s)=>{if(s&&!r)return;let a=n(o.get());if(a)o.set(a)})}function bs(e,t,n,r){let o=Nr.get(e);if(!o)return n;let s=n??{};for(let a of o){if(!n&&a.from==="state")continue;let i={...r,...s},l=a.from==="state"?e.view(i,()=>a.derive(i)):a.derive(s,r,t);s={...s};for(let c of a.keys)if(l&&c in l)s[c]=l[c];else if(a.from==="state")s[c]=i[c]}return n||Object.keys(s).length?s:void 0}var ys=new WeakSet;function we(e,t){if(Object.is(e,t))return!0;if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;if(ys.has(e)||ys.has(t))return!1;return e.every((n,r)=>Object.is(n,t[r]))}function vs(e,t){let n=e,r=0,o=0,s,a,i=!1,l,c=new Set,d=new Map,h,u={get(){return l??v()},set(w,k=!1){if(s&&!k&&!i){let I=v();if(I!==n){let N={...I};for(let q in w)delete N[q];u.set(N,!0)}}let A=[];for(let I in w)if(!we(n[I],w[I]))A.push(I);if(!A.length)return;let W=n;n={...n,...w};let M=A.every((I)=>t.includes(I));x(A,W,M,k)},subscribe(w){return c.add(w),()=>{c.delete(w)}},setFanout(w){h=w},follow(w){s=w},view(w,k){let A=l;l=w;try{return k()}finally{l=A}}};function v(){if(!s||i)return n;i=!0;let w;try{w=s(n)}finally{i=!1}if(!w)return n;if(a?.state===n&&a.over===w)return a.result;let k=n;for(let A in w)if(!we(n[A],w[A])){k={...n,...w};break}return a={state:n,over:w,result:k},k}function x(w,k,A,W){if(!A)r++;if(!W)o++;let M=(I)=>I(A,W,w);c.forEach(M);for(let[I,N]of d)if(!w.length||w.some((q)=>!Object.hasOwn(I,q)))N.forEach(M);h?.(w,k,M)}return rt.set(u,{state:()=>n,renders:()=>r,writes:()=>o,touch:()=>x([],n,!1,!1),skipping:d}),u}var rt=new WeakMap;function pn(e,t,n){return mn(rt.get(e).skipping,t,n)}function mn(e,t,n){let r=e.get(t);if(!r)e.set(t,r=new Set);return r.add(n),()=>{if(r.delete(n),!r.size&&e.get(t)===r)e.delete(t)}}var Ft=(e)=>rt.get(e).state();var hn=(e)=>rt.get(e).renders(),ws=(e,t)=>{rt.set(e,rt.get(t))},xs=(e)=>rt.get(e).touch();var Ss={};function ks(e,t,n){let r;gs({store:e},["listing"],(o)=>{let s=[...t.listingInputs(),...n?.inputs()??[]];if(!r||!we(s,r.inputs)){let a=t.listing(n?.entry);r={inputs:s,listing:Dd(o.listing,a)?o.listing:a}}return{listing:r.listing}},{live:!1})}function Dd(e,t){for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(typeof e[n]!=="string")return!1;return!0}var Wr=new WeakMap;function gn(e,t){let n=Wr.get(e);if(n)return void n.push(t);let r=[t];Wr.set(e,r),Ve(()=>{Wr.delete(e);let o={};for(let s of r)s(o);e.set(o)})}function As(e,t,n){let r=(a)=>gn(e,(i)=>{i[t]=a(i[t]??e.get()[t])}),o=!0,s=!1;return r((a)=>{if(!o)return a;return s=!0,[...a,n]}),()=>{o=!1,r((a)=>{if(!s)return a;let i=a.indexOf(n);return i===-1?a:a.filter((l,c)=>c!==i)})}}function bn(e,t,{now:n=!1}={}){let r=(o)=>n?e.set({[t]:o}):gn(e,(s)=>s[t]=o);return r(!0),()=>r(!1)}function Ld(e,t){let n=e.getAttribute("aria-labelledby");if(n&&n!==`${t}-label`)return{labelledBy:n};let r=[...e.labels??[]].map((s)=>s.id).filter(Boolean);if(r.length)return{labelledBy:r.join(" ")};let o=e.getAttribute("aria-label");return o?{label:o}:null}function Es(e,t,n){gn(t,(r)=>{let o=Ld(e,n);if(JSON.stringify(o)!==JSON.stringify(t.get().fieldName))r.fieldName=o})}function jr(e,t){let n=e.labeled?null:e.fieldName;return{"aria-labelledby":e.labeled?`${t}-label`:n&&("label"in n)?void 0:n?.labelledBy??`${t}-input`,"aria-label":n&&"label"in n?n.label:void 0}}Ie();var yn=new WeakMap;function vn(e,t){yn.get(e)?.();let n=e.getAnimations?.({subtree:!0}).filter(Cs),r=n?.every((i)=>Vr(i)!==e);if(e.setAttribute("data-starting-style",""),n&&r){for(let i of e.getAnimations({subtree:!0}))if(Cs(i)&&!n.some((l)=>Id(i,l)))i.finish()}let o,s,a=requestAnimationFrame(()=>s=setTimeout(()=>{if(e.removeAttribute("data-starting-style"),t)o=Os(e,t)}));return()=>{cancelAnimationFrame(a),clearTimeout(s),o?.(),e.removeAttribute("data-starting-style")}}var Cs=(e)=>("transitionProperty"in e),Vr=(e)=>e.effect?.target,Id=(e,t)=>Vr(e)===Vr(t)&&e.transitionProperty===t.transitionProperty;function Ms(e){return e.split(",").map((t)=>{let n=parseFloat(t)||0;return t.trim().endsWith("ms")?n/1000:n})}function Fd(e){return Math.max(Ps(getComputedStyle(e)),Ps(getComputedStyle(e,"::backdrop")))}function Ps(e){let t=(n,r,o="1")=>{let s=Ms(n),a=Ms(r),i=o.split(",").map((l)=>l.trim()==="infinite"?1:parseFloat(l)||1);return s.map((l,c)=>(l*(i[c%i.length]??1)+(a[c%a.length]??0))*1000)};return Math.max(0,...t(e.transitionDuration,e.transitionDelay),...t(e.animationDuration,e.animationDelay,e.animationIterationCount))}function Rd(e){let t=0;for(let n of e){let r=n.effect?.getComputedTiming(),o=Number(r?.endTime);if(!r||!Number.isFinite(o))continue;t=Math.max(t,o-(Number(r.localTime)||0))}return t}var $d=(e)=>!e.timeline||!("source"in e.timeline);function Os(e,t){let n=!1,r=e.getAnimations({subtree:!0}).filter($d),o=()=>{if(n)return;n=!0,clearTimeout(s),t()},s=r.length?setTimeout(o,Math.max(Fd(e),Rd(r))+50):void 0;if(!r.length)Ti(o);else Promise.allSettled(r.map((a)=>a.finished)).then(o);return()=>{n=!0,clearTimeout(s)}}function qr(e,t){e.toggleAttribute("data-open",t),e.toggleAttribute("data-closed",!t)}function Ts(e,t){yn.get(e)?.(),e.removeAttribute("data-starting-style"),e.setAttribute("data-ending-style","");let n=e.hasAttribute("inert");e.setAttribute("inert","");let r=e.ownerDocument?.defaultView?.MutationObserver,o=!1,s=r&&new r(()=>o=!0);s?.observe(e,{attributeFilter:["inert"]});let a=0,i=()=>{if(cancelAnimationFrame(a),yn.delete(e),e.removeAttribute("data-ending-style"),o||=!!s?.takeRecords().length,s?.disconnect(),!o)e.toggleAttribute("inert",n)},l=!1,c=Os(e,()=>{if(!l)return i(),t();yn.set(e,i),a=requestAnimationFrame(()=>{a=requestAnimationFrame(i)}),t()});return l=!0,()=>{c(),i()}}function ot(e){return{"data-open":e?"":void 0,"data-closed":e?void 0:""}}function bt(e){return e.replace(/[\s%]/g,encodeURIComponent)}var wn=["ArrowDown","ArrowUp","PageDown","PageUp","ctrl+n","ctrl+p"],xn=(e)=>Me(e)||e.readOnly,Sn=(e)=>({"data-disabled":Me(e)?"":void 0,"data-readonly":e.readOnly?"":void 0,"data-required":e.required?"":void 0});function Nd(e,t,n){let r=e.ownerDocument.createDocumentFragment(),o=()=>{if(t()&&r.childNodes.length)e.append(r);else if(!t()&&e.childNodes.length)r.append(...Array.from(e.childNodes))};o();let s=n(o);return()=>{if(s(),r.childNodes.length)e.append(r)}}function Ds(e,t,n,r=()=>!1){if(!be)return;setTimeout(()=>{if(!e.isConnected||r()||e.getAttribute("aria-labelledby")||e.getAttribute("aria-label")||on(e).length)return;me(t,n)},300)}function Ls(e,t){if(e===void 0)return{};return{"aria-posinset":String(e+1),"aria-setsize":String(t.entries().length)}}function Is(e,{api:t,key:n,props:r}){return t.internal.listbox.register(n,e,()=>{let o=t.internal.itemProps(n)??r;return{value:o.value,label:o.label,keywords:o.keywords,disabled:o.disabled,group:o.group,index:o.index}})}function Fs(){return{props:{id:"id"},role:"group",attrs:(e,{id:t,key:n,api:r})=>({"aria-labelledby":Wd(e,t,n),hidden:r.internal.listbox.groupMatches(n)?void 0:""})}}var Wd=(e,t,n)=>e.groupLabels.includes(n)?`${t}-group-${bt(n)}`:void 0;function Rs(){return{role:"none",attrs:(e,{api:t})=>({"aria-hidden":"true",hidden:t.internal.filterQuery()&&!e.items?"":void 0})}}function $s(){let e=(t,n)=>n.internal.isEmpty(t);return{props:{stash:"boolean"},state:(t,{api:n})=>({loading:t.status==="loading",empty:e(t,n),query:t.query}),role:"status",attrs:(t,{api:n})=>({"aria-live":"polite","aria-atomic":"true","data-empty":e(t,n)?"":void 0,"data-loading":t.status==="loading"?"":void 0}),bind(t,{api:n,store:r,props:o}){if(o.stash)return Nd(t,()=>e(r.get(),n),r.subscribe)}}}function Ns(){return{state:(e,{api:t})=>({status:e.status,loading:e.status==="loading",count:t.internal.itemCount()}),role:"status",attrs:(e)=>({"aria-live":"polite","aria-atomic":"true","data-loading":e.status==="loading"?"":void 0})}}function Ws(){return{props:{id:{kind:"string",from:"group.id",required:!0},group:{kind:"string",from:"group.id",required:!0}},attrs:(e,{id:t,props:n})=>({id:`${t}-group-${bt(n.group)}`}),bind:(e,{store:t,props:n})=>As(t,"groupLabels",n.group)}}function js(){return{state:(e)=>({open:e.open}),attrs:(e)=>({"aria-hidden":"true",...ot(e.open)}),bind(e,{api:t}){t.internal.popup.checkPlacement()}}}Bs();var Br="pointer",Hr=!1,_s=!1,zs=!1,Ys=!1,_r=!1,Rt="mouse",Kr=!1,Vd=()=>Kr=!1,kn=null,qd=()=>kn=null;function Gs(e){if(e.key!=="Enter"&&e.key!==" ")return;kn=e.target,setTimeout(qd)}function Hd(e){Gs(e),_r=!1;let t=e.metaKey||e.ctrlKey||e.altKey||/^(Meta|Control|Alt|Shift)$/.test(e.key);if(e.key==="Tab"||!t)Br="keyboard"}function Us(e){if(Br="pointer",_r=!1,!("pointerType"in e)){if(!Kr)Rt="touch";return}Kr=!0,setTimeout(Vd);let t=e.pointerType;Rt=Qs(e)?"virtual":t==="touch"||t==="pen"?t:"mouse"}function An(){if(Hr||typeof document>"u")return;Hr=!0,document.addEventListener("keydown",Hd,!0),document.addEventListener("keyup",Gs,!0),document.addEventListener("pointerdown",Us,!0),document.addEventListener("touchstart",Us,{capture:!0,passive:!0}),window.addEventListener("blur",(e)=>{if(e.target===window)_r=!0})}function En(){if(Hr||_s)return;_s=!0,queueMicrotask(An)}function Qs(e){if(e.type==="pointermove")return!1;if(e.width===0&&e.height===0&&e.pressure===0)return!0;return e.pointerType==="mouse"&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0}function Kd(e){if(e.detail>0)return Rt;return!!kn&&kn.contains(e.target)?"keyboard":"virtual"}var Xs=()=>Br==="keyboard"?"keyboard":Rt;function He(e){if(An(),!e)return Xs();if(!nn(e))return"programmatic";if(e.type.startsWith("key"))return"keyboard";if(e.type.startsWith("touch"))return"touch";if(e.type==="click")return Kd(e);let t=e.pointerType;if(t==="mouse"||t==="touch"||t==="pen")return Qs(e)?"virtual":t;if("button"in e)return Rt;return Xs()}function Cn(e){An(),zs=!0;try{e.focus({preventScroll:!0})}finally{zs=!1}}function zr(e){An(),Ys=!0;try{e.focus({preventScroll:!0})}finally{Ys=!1}}var Js=(e)=>e==="pointer"||e==="touch"?"pointer":"keyboard";function Zs(e,t,n=()=>[]){let r=t,o,s=(d)=>{if(r=d,e.getAttribute("data-modality")!==d)e.setAttribute("data-modality",d)};s(t);let a=(d)=>{if(d.metaKey||d.ctrlKey||/^(Meta|Control|Alt|Shift)$/.test(d.key))return;s("keyboard")},i=()=>s("pointer"),l=(d)=>{let h={x:d.clientX,y:d.clientY},u=o&&Math.hypot(h.x-o.x,h.y-o.y)>2;if(o=h,u&&r!=="pointer")s("pointer")},c=[e,...n().filter((d)=>!!d)];for(let d of c)d.addEventListener("keydown",a,!0);return e.addEventListener("pointerdown",i,!0),e.addEventListener("pointermove",l,!0),()=>{for(let d of c)d.removeEventListener("keydown",a,!0);e.removeEventListener("pointerdown",i,!0),e.removeEventListener("pointermove",l,!0),e.removeAttribute("data-modality")}}function Bd(e){if(e.type==="removed")return`${e.label} removed`;if(e.loading)return"Loading";if(!e.count)return"No results";return e.count===1?"1 result":`${e.count} results`}function ea(e){return e==="contains"||e==="startsWith"||e==="fuzzy"?e:void 0}var _d=(e)=>({segments:[{text:e,match:!1}],matched:!1});function ta(){let e=new WeakMap,t=(n,r,o)=>{let{matchQuery:s,matchMode:a}=n.internal,i=a()?s():"",l=e.get(n);if(!l)e.set(n,l=new Map);let c=l.get(r);if(c&&c.text===o&&c.query===i)return c.state;let d=i.trim()?Gi(o,i,a()):[],h=d.length?{segments:Qi(o,d),matched:!0}:c&&!c.state.matched&&c.text===o?c.state:_d(o);return l.set(r,{text:o,query:i,state:h}),h};return{props:{text:"string",write:"boolean",id:"id"},state:(n,{api:r,key:o,props:s})=>t(r,o,s.text),attrs:(n,{api:r,key:o,props:s})=>({"data-matched":t(r,o,s.text).matched?"":void 0}),bind(n,{api:r,key:o,props:s,store:a}){if(!s.write)return;let i,l=()=>{let d=t(r,o,s.text);if(d===i)return;i=d,n.replaceChildren(...d.segments.map(({text:h,match:u})=>{if(!u)return h;let v=n.ownerDocument.createElement("mark");return v.textContent=h,v}))};l();let c=a.subscribe(l);return()=>{c(),n.textContent=s.text}}}}var na=(e)=>!!e&&nn(e)&&He(e)==="virtual",zd=500;function ra({store:e,query:t,count:n,loading:r,shown:o,silent:s,announcement:a}){let i,l=t(),c=r(),d=!1,h=()=>{if(i=void 0,!o()||s()||!t().trim())return;let u={type:"results",count:n(),query:t(),loading:r()},v=(a()??Bd)(u);if(v)Ks(v);d=u.loading};e.subscribe(()=>{let u=t(),v=r(),x=u!==l,w=c&&!v&&d;if(l=u,c=v,!x&&!w)return;clearTimeout(i),i=setTimeout(h,zd)})}function oa({count:e,status:t,onLoadMore:n}){let r=-1;function o(){let a=n(),i=t();if(!a||i==="loading")return;if(e()===r&&i!=="error")return;r=e(),a()}function s(a){let i=(l)=>{let c=l.target;if(!(c instanceof HTMLElement))return;if(c.scrollTop+c.clientHeight>=c.scrollHeight-40)o()};return a.addEventListener("scroll",i,{capture:!0,passive:!0}),()=>a.removeEventListener("scroll",i,{capture:!0})}return{reached:o,bind:s}}Oe();Se();var Pn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),ca=new WeakMap;function da(e){let t=ca.get(e);if(t)return t;let n={selectors:new Map,selecting:new Map};return ca.set(e,n),e.setFanout((r,o,s)=>{let a=e.get();for(let i of r){let l=n.selecting.get(i);if(!l)continue;let c=(h)=>n.selectors.get(`${String(i)}:${h}`)?.forEach(s),d=o[i];for(let[h,u]of l)if(h(d,a[i],c)===!0)u.forEach(s)}}),n}function fa(e){let t=Object.entries(e).filter(([,o])=>Pn(o)||typeof o==="function"||o.length>0),n=(o,s)=>Pn(o)?o.values(s):typeof o==="function"?o(s):o,r=(o,s)=>{let a=Fe(o,s);return t.map(([i,l])=>[i,n(l,a)])};return{reading(o,s){let a=Fe(o,s);return new Map(Object.entries(e).flatMap(([i,l])=>Pn(l)?[]:[[i,n(l,a)]]))},selection(o,s){let a=r(o,s);return a.length?JSON.stringify(a):""},subscribe(o,s,a){let i=[pn(o.store,e,s)];for(let[l,c]of r(o,a)){let d=e[l],h=Pn(d)?d.moved:Qr;if(i.push(...c.map((u)=>Xd(o.store,l,u,s,h))),h!==Qr)i.push(pa(o.store,l,h,s))}return()=>i.forEach((l)=>l())}}}function Xd(e,t,n,r,o=Qr){let s=pa(e,t,o,()=>{}),a=mn(da(e).selectors,`${String(t)}:${n}`,r);return()=>{a(),s()}}function pa(e,t,n,r){let{selecting:o}=da(e),s=o.get(t);if(!s)o.set(t,s=new Map);let a=mn(s,n,r);return()=>{if(a(),!s.size&&o.get(t)===s)o.delete(t)}}function Qr(e,t,n){if(e==null)e=ua(t,e);else if(t==null)t=ua(e,t);if(Jr(e)&&Jr(t)){for(let s in e)if(!Object.hasOwn(t,s)||!Object.is(e[s],t[s]))n(s);for(let s in t)if(!Object.hasOwn(e,s))n(s);return}if(!Array.isArray(e)||!Array.isArray(t))return[e,t].forEach(n);let r=0,o=0;while(r<e.length&&e[r]===t[r])r++;while(o<e.length-r&&o<t.length-r&&e[e.length-1-o]===t[t.length-1-o])o++;for(let s of[e,t])for(let a=r;a<s.length-o;a++)n(s[a])}var Jr=(e)=>!!e&&Object.getPrototypeOf(e)===Object.prototype,Gd=[],Qd={},ua=(e,t)=>Array.isArray(e)?Gd:Jr(e)?Qd:t;var it=(e)=>e.owner,ke=(e)=>it(e).slots[e.slot],Fe=(e,t)=>({id:e.id,key:e.key,props:t,api:e.api}),ma=(e,t=e.props)=>({el:e.el,id:e.id,key:e.key,props:t,store:e.store,api:e.api});function ga(e){let{parts:t}=e.owner,n=`${e.slot}:${e.key}`;if(!t.has(n))t.set(n,e);e.leases++;let r=!0;return()=>{if(!r)return;if(r=!1,--e.leases)return;let{owner:o}=e;if(!o.released.length)queueMicrotask(()=>ya(o));o.released.push(e)}}function ba(e){let{owner:t}=e;if(!t.released.length)queueMicrotask(()=>ya(t));t.released.push(e)}function ya(e){for(let t of e.released){let n=`${t.slot}:${t.key}`;if(!t.leases&&e.parts.get(n)===t)e.parts.delete(n)}e.released=[]}function Be(e,t=e.props,n=e.store.get()){let r=ke(e),o=Fe(e,t),s=r.attrs?.(n,o),a=r.role,i=typeof a==="function"?a(n,o):a;if(se)Ei(r,e.slot,s,i,{component:it(e).label,id:e.id},r.live?.read(n,o));let{name:l}=it(e),c={"data-slot":e.slot==="root"?l:`${l}-${e.slot}`,...a===void 0?void 0:{role:i},...s};if(a!==void 0)c.role=i;return Aa(e,c)}var eo=new Set(["aria-label","aria-labelledby","aria-description","title","autocomplete","autocapitalize","autocorrect","spellcheck","inputmode","enterkeyhint"]);var to=(e)=>typeof e==="string"&&e.split(/\s+/).every((t)=>t.startsWith("ui-sdk-"));function Tn(e,t=e.props,n=e.store.get()){return ke(e).present?.(n,Fe(e,t))??!0}function no(e){return ke(e).present!==void 0}function va(e,t=e.props){return Aa(e,ke(e).live?.read(e.store.get(),Fe(e,t))??{})}var Dn=(e,t=e.props)=>ke(e).selects?.selection(e,t)??"";var Jd={};function yt(e,t,n=e.props){let r=ke(e).selects,o=[ga(e),r?r.subscribe(e,t,n):pn(e.store,Jd,t)];return()=>o.forEach((s)=>s())}function wa(e){let{on:t,press:n}=ke(e),r={};for(let o in t){let s=t[o];r[o]=(a)=>{if(a.defaultPrevented||af(a))return;it(e).sleeping?.wake(),s(a,ma(e))}}if(typeof n==="function"&&!r.click)r.click=(o)=>{if(!o.defaultPrevented)it(e).sleeping?.wake(),n(ma(e),o)};return r}function xa(e){e.propsListeners?.forEach((t)=>t())}function Sa(e,t){let n=e.propsListeners??=new Set;return n.add(t),()=>{n.delete(t)}}var ha=new WeakMap;function Zd(e){let t=ke(e),n=ha.get(t);if(n===void 0)n=!!t.attrs&&"hidden"in t.attrs(e.store.get(),Fe(e,e.props)),ha.set(t,n);return n}function ro(e,t,n={by:"core"}){let r=e,{parts:o}=r.owner,s=`${e.slot}:${e.key}`;if(!e.el&&(o.get(s)??r)===r)o.delete(s),o.set(s,r);if(se){ef(e,e.el,t);let{focus:u}=ke(e);Ci(typeof u==="function"?u(e.store.get(),Fe(e,e.props)):u,e.slot,t,{component:it(e).label,id:e.id})}let a={};e.el=t,r.binding=a;let i=[ga(r)];if(Zd(e))Gr(t.ownerDocument);for(let[u,v]of Object.entries(wa(e)))if(n.by==="core"||n.attaches!=="all"&&!n.attaches.includes(u))i.push(J(t,u,v));let l=ke(e);if(l.live)i.push(l.live.attach(e,t));if(n.by==="framework"&&l.direct)i.push(l.direct.attach(e,t));let c=l.asleep?.(t,e);if(c)i.push(c);let d=()=>{let u=l.bind?.(t,e);if(u)i.push(u)},{sleeping:h}=r.owner;if(h&&l.bind)h.binds.add(d),i.push(()=>h.binds.delete(d));else d();if(l.attrs&&typeof MutationObserver<"u")i.push(nf(r,t));return()=>{if(i.forEach((u)=>u()),r.binding!==a)return;if(e.el=r.binding=void 0,r.own!==void 0)Zr(r)}}function ef(e,t,n){if(!e.key||!t||t===n)return;queueMicrotask(()=>{if(e.el!==n||!t.isConnected||!n.isConnected)return;let{parts:r,label:o}=it(e);for(let s of r.values())if(s.el===t)return;me(`two "${e.slot}" parts share the key "${e.key}". Give each an id or a unique value.`,{component:o,id:e.id})})}var oo=(e,t)=>ke(e).connect?.(t)??(()=>{}),On=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns","for","headers"],ka=(e)=>ke(e).attrs?.(e.store.get(),Fe(e,{...e.props,id:void 0})).id;function Aa(e,t){let{owner:n}=e;if(!n.named?.size||!On.some((s)=>t[s]))return t;let r=tf(n,e.store);if(!r.size)return t;let o={...t};for(let s of On){let a=o[s];if(a)o[s]=a.split(" ").map((i)=>r.get(i)??i).join(" ")}return o}function tf(e,t){let n=hn(t);if(e.aliases?.version===n)return e.aliases.map;let r=new Map;for(let o of e.named){let s=ka(o);if(s!==void 0&&s!==o.own)r.set(s,o.own)}return e.aliases={version:n,map:r},r}function nf(e,t){if(t.hasAttribute("id")||e.own!==void 0)Zr(e);let n=new MutationObserver(()=>Zr(e));return n.observe(t,{attributeFilter:["id"]}),()=>n.disconnect()}function Zr(e){let{owner:t}=e;if(!t.unread)t.unread=new Set,Ve(()=>rf(t,e.store));t.unread.add(e)}function rf(e,t){let n=e.unread;e.unread=void 0;let r=e.renamed===!0;e.renamed=void 0;for(let o of n)r=sf(o,o.el&&of(o.el))||r;if(r)xs(t)}var of=(e)=>e.localName==="form"?e.getAttribute("id"):e.id;function sf(e,t){let n=ka(e),r=t&&t!==n?t:void 0;if(r===e.own)return!1;let{owner:o}=e;if(e.own=r,o.named??=new Set,r===void 0)o.named.delete(e);else o.named.add(e);return o.aliases=void 0,n!==void 0}function af(e){return(e.type==="keydown"||e.type==="keyup")&&(typeof e.key!=="string"||Mn(e))}function so(e){return{read:e,attach(t,n){let r=`live:${t.id}`,o=()=>Wt(n,va(t),r);o();let s=yt(t,o);return()=>{s(),Wt(n,{},r)}}}}function Ca(e){let t=new WeakMap;return{names:e,attach:(n,r)=>{let o=Be(n),s=t.get(r)??new Map;t.set(r,s);for(let[i,l]of s)if(o[i]===void 0&&r.getAttribute(i)===l)r.removeAttribute(i);s.clear();let a=()=>{let i=Be(n);for(let l of e){let c=i[l];if(c===void 0){if(o[l]!==void 0&&r.getAttribute(l)===o[l])r.removeAttribute(l);continue}let d=r.getAttribute(l);if(d===c)continue;if(eo.has(l)&&d!==null&&d!==o[l])continue;r.setAttribute(l,c),s.set(l,c)}o=i};return a(),yt(n,a)}}}var io=new WeakMap,vt=new WeakMap,Ln;function Wt(e,t,n="render"){Ma(e,t,n,!1)}function ao(e,t){Ma(e,{},t,!0)}function jt(e,t){if(e===Ln)return;for(let n of Object.values(io.get(e)??{}))n.delete(t);for(let n of Object.values(vt.get(e)??{}))n.delete(t)}function Ma(e,t,n,r){let o=Ln;Ln=e;try{lf(e,t,n,r)}finally{Ln=o}}function lf(e,t,n,r){let o=io.get(e)??{},s=o[n]??new Map,a=new Map,i=t.style===void 0?[]:ff(t.style);for(let[u,v]of i)a.set(`style:${u}`,v);for(let[u,v]of Object.entries(t))if(v!==void 0&&u!=="style")a.set(u,v);let l=a.has("id")||s.has("id")?e.getAttribute("id"):null,c=uf(l,o,n);if(c)a.delete("id");let d=new Set,h=new Map;for(let u of new Set([...a.keys(),...s.keys()])){if(!eo.has(u))continue;let v=e.getAttribute(u);if(h.set(u,v),v===null||v===a.get(u)||u==="aria-labelledby"&&to(v))continue;if(!Object.values(o).some((x)=>x.get(u)===v))d.add(u)}for(let u of d)a.delete(u);for(let u of s.keys()){if(a.has(u)||d.has(u)||u==="id"&&c)continue;if(u.startsWith("style:")){e.style.removeProperty(u.slice(6));continue}if(!r){e.removeAttribute(u),Ea(e,n,u,null);continue}let v=e.getAttribute(u);if(v!==s.get(u))continue;let x=vt.get(e)?.[n]?.get(u);if(x===void 0)e.removeAttribute(u);else if(v!==x)e.setAttribute(u,x)}for(let[u,v]of i)if(e.style.getPropertyValue(u)!==v)e.style.setProperty(u,v);for(let[u,v]of Object.entries(t)){if(v===void 0||!a.has(u))continue;let x=u==="id"?l:h.has(u)?h.get(u):e.getAttribute(u);if(x!==(s.get(u)??null))Ea(e,n,u,x);if(x===v)continue;if(u==="value"&&df(e)&&e.value!==v)e.value=v;e.setAttribute(u,v)}if(o[n]=a,io.set(e,o),r)delete vt.get(e)?.[n]}function Ea(e,t,n,r){let o=r==null||n==="id"?void 0:On.includes(n)?cf(r):r;if(o===void 0)return void vt.get(e)?.[t]?.delete(n);let s=vt.get(e);if(!s)vt.set(e,s={});(s[t]??=new Map).set(n,o)}var cf=(e)=>e.split(/\s+/).filter((t)=>t&&!t.startsWith("ui-sdk-")).join(" ")||void 0;function uf(e,t,n){if(e===null||e===t[n]?.get("id"))return!1;return!e.startsWith("ui-sdk-")||Object.values(t).some((r)=>r.get("id")===e)}var df=(e)=>e.localName==="textarea"||e.localName==="input"&&e.type!=="file";function ff(e){let t=[];for(let n of e.split(";")){let r=n.indexOf(":");if(r>0)t.push([n.slice(0,r).trim(),n.slice(r+1).trim()])}return t}function _e(e,t){let n=[...e.parts()].filter((r)=>r.slot===t&&!!r.el?.isConnected);return et(n).map(({el:r,key:o,props:s})=>({el:r,key:o,props:s}))}var pf=(e)=>e==="fuzzy"?os:e;function Pa(e,t){let{id:n,store:r,options:o}=e,s=!1,a=null,i,l=()=>i??t.query(),c,d=oa({count:()=>h.count(),status:()=>r.get().status,onLoadMore:()=>o().onLoadMore}),h=ds({store:r,focus:()=>r.get().focusInList?"real":"virtual",items:t.items,emptyItems:t.emptyItems,toKey:(M)=>String(M??""),filter:()=>pf(t.filter()),rank:()=>t.filter()==="fuzzy"||typeof t.filter()==="function",query:l,loop:()=>o().loop??!0,skipDisabled:!0,active:()=>r.get().open,onHighlight:t.onHighlight,onLastReached:d.reached,container:t.container,scrollRoot:t.scrollRoot,onRegister(){if(s)return;s=!0,Ve(()=>{s=!1,r.set({mounts:r.get().mounts+1})})}});ks(r,h);let u=(M)=>e.props("item",M);function v(M){let{highlighted:I,settled:N}=r.get();if(!t.items()&&!N)return I;let q=t.autoHighlight(),Q=q==="always"||q==="typing"&&l()!=="",L=I!==null&&h.entries().some((V)=>V.key===I),R=Q?t.preferred?.(h)??h.firstEnabled()??null:null;return M&&Q?R:L?I:R}function x(M,I){let N=v(M);if(N!==r.get().highlighted)t.highlight(N,I)}function w(M){let I=$r(M,{apple:It()});if(I===void 0||M.altKey&&M.key==="ArrowUp")return!1;if(!r.get().open){if(!t.open||I!==1&&I!==-1)return!1;return M.preventDefault(),t.open(M,I===-1?"last":"first"),!0}M.preventDefault();let N=h.stepKey(I);if(N!==void 0)t.highlight(N,{reason:"list-navigation",event:M});return!0}let k=t.query(),A=r.get();r.subscribe(()=>{let M=r.get(),I=A;A=M;let N=t.query();if(N!==k){k=N;let q=a??{reason:"imperative"};a=null,x(!0,q)}else if(M.mounts!==I.mounts&&!t.settlesMount?.()||M.items!==I.items||M.settled!==I.settled){let q=I.highlighted===null?null:{reason:"item-removed"};if(M.highlighted!==I.highlighted)t.highlight(M.highlighted,q);else x(!1,q)}}),e.onOptions(()=>{if(c===void 0)return;let M=c,I=a;c=void 0,queueMicrotask(()=>{if(t.query()===M)x(!0,I)})});let W=t.autoHighlight();return e.onOptions(()=>{let M=t.autoHighlight();if(M===W)return;W=M,queueMicrotask(()=>x(!1,{reason:"imperative"}))}),ra({store:r,query:t.query,count:()=>h.count(),loading:()=>r.get().status==="loading",shown:()=>r.get().open,silent:()=>_e(e,"status").length>0,announcement:()=>o().announcement}),{listbox:h,itemProps:u,settledHighlight:v,settle:x,navigate:w,loadMore:d,matchQuery:t.query,matchMode:()=>ea(t.filter()),cause(M,I){a={reason:M,event:I}},settleFor(M){c=t.query(),i=M;try{x(!0,a)}finally{i=void 0}},hover(M,I){if(I.pointerType==="touch"||!r.get().open||u(M)?.disabled)return;if(r.get().highlighted!==M)t.highlight(M,{reason:"item-hover",event:I})},isEmpty:(M)=>(!!t.items()||M.settled)&&h.count()===0,itemCount:()=>h.count(),filterQuery:t.query,activeDescendant(M){let{highlighted:I}=M;if(!M.open||M.focusInList||I===null)return;if(!h.element(I)?.isConnected)return;return`${n}-option-${bt(I)}`}}}function Oa(){let e=(t,n)=>t.internal.text(n);return{role:"combobox",focus:"native",keys:wn,attrs:(t,{id:n,api:r})=>({id:`${n}-input`,value:e(r,t),autocomplete:"off",autocapitalize:"none",spellcheck:"false","aria-expanded":String(t.open)}),live:so((t,{api:n})=>({"aria-activedescendant":n.internal.activeDescendant(t)})),on:{input:(t,{api:n,el:r})=>n.internal.typed(r,t),keydown:(t,{api:n})=>n.internal.onInputKeyDown(t)},bind(t,{api:n,id:r,store:o}){Es(t,o,r);let s=t,a,i=()=>{let l=e(n,o.get());if(l===a)return;if(a=l,s.value!==l)s.value=l};return zi(s,()=>[e(n,o.get())],()=>n.internal.typed(s)),i(),o.subscribe(i)}}}function Ta(){return{props:{value:"string",label:"string",keywords:"list",disabled:"boolean",index:"number",group:{kind:"string",from:"group.id"}},role:"option",focus:"active-descendant",attrs:(e,{id:t,key:n,props:r,api:o})=>({id:`${t}-option-${bt(n)}`,tabindex:e.focusInList?"-1":void 0,"aria-disabled":r.disabled?"true":void 0,"aria-selected":void 0,...Ls(r.index,o.internal.listbox),hidden:o.internal.listbox.matches(n,r)?void 0:"","data-disabled":r.disabled?"":void 0}),direct:Ca(["hidden"]),live:so((e,{key:t})=>({"aria-selected":e.highlighted===t?"true":"false","data-highlighted":e.highlighted===t?"":void 0})),on:{...Ze,pointermove:(e,{api:t,key:n})=>t.internal.hover(n,e)},press:({api:e,key:t},n)=>e.internal.press(t,n),bind(e,{api:t,key:n,props:r}){let o=Is(e,{api:t,key:n,props:r});return()=>{o(),e.removeAttribute("data-highlighted"),e.setAttribute("aria-selected","false")}}}}var Vt=new WeakMap,ze,mf=!1,Da=0;function Ia(e){Da++;try{e()}finally{Da--}}function Fa(e){let t=ze,n={starts:[]};ze=n;let r;try{r=e()}finally{ze=t}if(Vt.set(r,n),t)t.starts.push(()=>(La(r),()=>$a(r)));else if(!mf&&typeof document<"u")La(r);return r}function wt(e){if(ze)ze.starts.push(e);else if(se)me("`whenKept` runs only while an instance is made, so this work never starts.")}function Ra(e,t){let n=ze,r={starts:[]};ze=r;try{t()}finally{ze=n}let o=Vt.get(e);if(!o)return;o.starts.push(...r.starts);for(let s of o.stops?r.starts:[]){let a=s();if(a)o.stops.push(a)}}function La(e){let t=Vt.get(e);if(!t||t.stops)return;let n=t.stops=[];for(let r of t.starts){let o=r();if(o)n.push(o)}}function $a(e){let t=Vt.get(e),n=t?.stops;if(!n)return;t.stops=void 0,n.forEach((r)=>r())}function Na(e){$a(e),Vt.delete(e)}var hf=Symbol.for("ui-sdk.controller.attach"),gf=Symbol.for("ui-sdk.controller.detach");function Wa(e,t){e?.[hf]?.(t)}function ja(e,t){e?.[gf]?.(t)}function Va(e,t){let n=e.options().controller,r=!1;wt(()=>(r=!0,Wa(n,t),()=>{r=!1,ja(n,t)})),e.onOptions(({controller:o})=>{if(o===n)return;if(ja(n,t),n=o,r)Wa(o,t)})}Se();Se();function bf(e,t){let{x:n,y:r}=e,{borders:o}=t,s=n>=o.left&&n<t.width-o.right&&r>=o.top&&r<t.height-o.bottom,a=n>=t.clientLeft&&n<t.clientLeft+t.clientWidth&&r>=t.clientTop&&r<t.clientTop+t.clientHeight;return s&&!a}function qa(e,t){if(!(t instanceof Element))return!1;let n=t.ownerDocument;if(t===n.documentElement)return e.clientX>=t.clientWidth||e.clientY>=t.clientHeight;if(t.clientWidth===0&&t.clientHeight===0)return!1;let r=t.getBoundingClientRect(),o=getComputedStyle(t);return bf({x:e.clientX-r.left,y:e.clientY-r.top},{width:r.width,height:r.height,clientLeft:t.clientLeft,clientTop:t.clientTop,clientWidth:t.clientWidth,clientHeight:t.clientHeight,borders:{top:parseFloat(o.borderTopWidth)||0,right:parseFloat(o.borderRightWidth)||0,bottom:parseFloat(o.borderBottomWidth)||0,left:parseFloat(o.borderLeftWidth)||0}})}var de=globalThis[Symbol.for("ui-sdk.layers@2")]??={stack:[],listening:new Map};function Ka(){return de.persistent??=new Set}function yf(e){for(let t of Ka())if(ye(t,e))return!0;return!1}function Ba(){return[...Ka()].filter((e)=>e.isConnected)}function _a(){return de.pushed??0}function lo(e){return xt().some((t)=>(t.order??0)>e)}function xt(){return de.stack.filter((e)=>e.active())}function Fn(){return xt()}function za(){return de.escapeAt??-1/0}function In(e,t,n){return Ya(e,ln(t),n)}function Ya(e,t,n){if(t.some((r)=>e.contains(r,n)))return!0;return xt().some((r)=>r.parent===e&&Ya(r,t,n))}function vf(e,t){let n=!1,r,o;function s(u,v,x){let w=[],k=!1;if(yf(v))return{dismissed:w,consume:k};for(let A of[...de.stack].reverse())if(A.active()){if(In(A,v,u))break;if(A.modal!==!1)k=!0;if(w.push(A),A.shield)break}else if(A.exiting?.()){if(In(A,v,u))break;if(A.modal===!1)continue;if(A.overBackdrop?.(x.x,x.y))k=!0;break}return{dismissed:w,consume:k}}function a(u,v,x){let{dismissed:w,consume:k}=s(u,v,x);for(let A of w)A.onOutsidePress?.(u);return k}let i=J(t,"pointerdown",(u)=>{n=!1;let v=u.composedPath()[0];if(u.pointerType==="touch"){r={x:u.clientX,y:u.clientY,target:v};return}if(r=void 0,o=void 0,qa(u,v))return;let x={x:u.clientX,y:u.clientY},{dismissed:w,consume:k}=s(u,v,x);if(w[0]?.outsidePress==="click"){if(u.button!==0)return;if(o={layer:w[0],target:v,point:x},k)u.preventDefault(),n=!0;return}if(k)u.preventDefault(),n=!0;for(let A of w)A.onOutsidePress?.(u)},{capture:!0}),l=J(t,"pointerup",(u)=>{let v=o;if(o=void 0,!v||!v.layer.active())return;if(In(v.layer,u.composedPath()[0],u))return;a(u,v.target,v.point)},{capture:!0}),c=J(t,"click",(u)=>{if(n&&u.detail){n=!1,u.preventDefault(),u.stopPropagation();return}if(n=!1,!r)return;let v=r;if(r=void 0,Math.hypot(u.clientX-v.x,u.clientY-v.y)>10)return;if(a(u,v.target,{x:v.x,y:v.y}))u.preventDefault(),u.stopPropagation()},{capture:!0}),d=J(e,"keydown",(u)=>Xa(e,u)),h=J(t,"blur",(u)=>{for(let v of xt().reverse())v.onBlur?.(u)});return()=>{if(i(),l(),d(),h(),!n)return c();let u=()=>(c(),v(),x()),v=J(t,"pointerdown",u,{capture:!0}),x=J(t,"click",u,{capture:!0})}}function Rn(e,t){return In(e,t)}function qt(e){let t=ln(e);return xt().reverse().find((n)=>t.some((r)=>n.contains(r)))}function Ua(e){de.closed=e,setTimeout(()=>{if(de.closed===e)de.closed=void 0})}function co(){return de.closed}function Ha(){if(!se)return;Le({type:"layers",stack:de.stack.map((e)=>({component:e.component??"popup",id:e.id??"",modal:e.modal,blocking:!!e.blocking,el:e.el}))})}function wf(e){let t=e.defaultView;if(!t)return()=>{};let n=de.listening.get(e);if(!n)de.listening.set(e,n={layers:0,stop:vf(e,t)});let r=n;return r.layers++,()=>{if(--r.layers>0)return;de.listening.delete(e),r.stop()}}function uo(e){return e.el?.ownerDocument??document}function Xa(e,t,n){if(t.key!=="Escape"||t.defaultPrevented||Mn(t))return;let r=xt().filter((o)=>uo(o)===e).at(-1);if(!r?.onEscape||n&&r!==n)return;de.escapeAt=performance.now(),r.onEscape(t)}function Ga(e,t){Xa(uo(e),t,e)}function Qa(e){de.pushed=(de.pushed??0)+1,e.order=de.pushed,de.stack.push(e);let t=wf(uo(e));Ha();let n=!1;return()=>{if(n)return;n=!0;let r=de.stack.indexOf(e);if(r!==-1)de.stack.splice(r,1);t(),Ha()}}Se();Ie();Oe();var Te=globalThis[Symbol.for("ui-sdk.modal@2")]??={holders:new WeakMap,thaw:new WeakMap,inert:new WeakMap};function el(e=document,t){let n={},r=Te.holders.get(e);if(!r)Te.holders.set(e,r=new Set);if(!r.size)Te.thaw.set(e,Sf(e));r.add(n);let o=t&&gt()?Df(t):void 0;return()=>{if(!r.delete(n))return;if(o?.(),r.size)return;Te.thaw.get(e)?.(),Te.thaw.delete(e)}}function xf({scrollbar:e,gutter:t,padding:n}){let r={overflow:"hidden","scroll-behavior":"auto"};if(e>0)if(t)r["scrollbar-gutter"]="stable";else r["padding-right"]=`${n+e}px`;return r}function Sf(e){let{scroller:t,gutter:n,padding:r}=kf.get(e)??Af(e),o=xf({scrollbar:n,gutter:typeof CSS<"u"&&CSS.supports("scrollbar-gutter","stable"),padding:r}),s=Object.entries(o).map(([a,i])=>Ke(t,a,i));if(n>0)s.push(Ke(e.documentElement,"--scrollbar-width",`${n}px`));return()=>s.forEach((a)=>a())}var kf=new WeakMap;function Af(e){let t=e.defaultView??window,n=Ef(e,t),r=t.getComputedStyle(n);return{scroller:n,gutter:Cf(n,e,t,r),padding:parseFloat(r.paddingRight)||0}}function Ef(e,t){let{body:n,documentElement:r}=e;if(!n||t.getComputedStyle(r).overflowY==="visible")return r;return/auto|scroll/.test(t.getComputedStyle(n).overflowY)?n:r}function Cf(e,t,n,r){if(e===t.documentElement)return n.innerWidth-e.clientWidth;let o=(parseFloat(r.borderLeftWidth)||0)+(parseFloat(r.borderRightWidth)||0);return e.offsetWidth-e.clientWidth-o}function Mf(e,t){let n=t.getComputedStyle(e),r=/auto|scroll/.test(n.overflowY)&&e.scrollHeight>e.clientHeight,o=/auto|scroll/.test(n.overflowX)&&e.scrollWidth>e.clientWidth;return r||o}function Pf(e,t){let{body:n,documentElement:r}=e.ownerDocument;for(let o=e;o&&o!==n&&o!==r;o=o.parentElement)if(Mf(o,t))return!0;return!1}function Of(e){if(e.fingers>1||e.zoomed)return"browser";if(e.scroller||e.slider||e.selecting)return"element";return"page"}var Tf="@layer ui-sdk { [data-scroll-guard], [data-scroll-guard] * { overscroll-behavior: contain } }";function Df(e){let t=e.ownerDocument,n=t.defaultView??window;xe(t,"ui-sdk-scroll-guard",Tf);let r=!e.hasAttribute("data-scroll-guard");if(r)e.setAttribute("data-scroll-guard","");let o="browser",s=J(t,"touchstart",(i)=>{let l=i.target instanceof Element?i.target:null;o=Of({fingers:i.touches.length,zoomed:(n.visualViewport?.scale??1)!==1,scroller:!!l&&Pf(l,n),slider:!!l?.closest('input[type="range"]'),selecting:t.getSelection()?.type==="Range"})},{capture:!0,passive:!0}),a=J(t,"touchmove",(i)=>{if(o==="page"&&i.cancelable)i.preventDefault()},{passive:!1});return()=>{if(s(),a(),r)e.removeAttribute("data-scroll-guard")}}var Lf='[aria-live]:not([aria-live="off"]):not([data-slot="carousel-content"]),[role="status"],[role="alert"],[role="log"],output';function Ja(e){let t=e.parentNode;return t instanceof ShadowRoot?t.host:t}function Za(e){let t=e[0]?.ownerDocument??document,n=[...e,...Array.from(t.querySelectorAll(Lf)),...Ba()],r=n.filter((a)=>!n.some((i)=>i!==a&&i.contains(a))),o=new Set;for(let a of r)for(let i=a;i;i=Ja(i))o.add(i);let s=[];for(let a of r)for(let i=a;i&&i!==t.body;i=Ja(i))for(let l of Array.from(i.parentNode?.children??[])){if(o.has(l)||!(l instanceof HTMLElement))continue;let c=Te.inert.get(l)??(l.inert?1/0:0);if(c===0)l.inert=!0;if(c!==1/0)Te.inert.set(l,c+1);s.push(l)}return()=>{for(let a of s){let i=Te.inert.get(a);if(i===void 0)continue;if(i<=1)a.inert=!1,Te.inert.delete(a);else Te.inert.set(a,i-1)}}}function tl(e){let t=e,n=Za(t),r=!1,o=(s)=>{let a=n;t=s,n=Za(s),a()};return Object.assign(()=>{if(r)return;r=!0,n()},{keep(s){if(r)return()=>{};return o([...t,s]),()=>{if(!r)o(t.filter((a)=>a!==s))}}})}Ie();Oe();var Re={tab:"close",blur:"always",outsidePress:"pointerdown",shield:!1,keepTrigger:!0,focusOnMount:!1,dismissOnFocusLoss:!0,closeWatcher:!1,blocking:!1,movesFocus:!0},nl=(e)=>e.trapFocus?"trap":"flow",If={menu:Re,select:Re,combobox:{...Re,tab:"native"},popover:{...Re,tab:nl,blur:"iframe"},dialog:{...Re,tab:nl,blur:"never",outsidePress:"click",shield:!0,keepTrigger:!1,focusOnMount:!0,dismissOnFocusLoss:!1,closeWatcher:!0,blocking:(e)=>e.inertAndLock},tooltip:{...Re,tab:"native",movesFocus:!1},hoverCard:{...Re,tab:"flow"},navigationMenu:{...Re,tab:"flow",blur:"never"}};function rl(e,t){let n={...If[e]};for(let r of Object.keys(Re)){let o=t[r];if(o!==void 0)Object.assign(n,{[r]:o})}return n}var Ff=()=>globalThis[Symbol.for("ui-sdk.popup-elements@1")]??=new WeakMap;function St(e){let t=Ff();t.set(e,(t.get(e)??0)+1);let n=!1;return()=>{if(n)return;n=!0;let r=(t.get(e)??1)-1;if(r>0)t.set(e,r);else t.delete(e)}}Se();var ol=["a[href]","area[href]","button","input:not([type='hidden'])","select","textarea","iframe","summary","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])","[tabindex]"].join(",");function fo(e){if(!(e instanceof HTMLElement)||e.tabIndex<0)return!1;if(e.matches(":disabled")||e.closest("[inert]"))return!1;if((e.checked?[]:po(e)).some((n)=>n.checked&&fo(n)))return!1;if(typeof e.checkVisibility==="function")return e.checkVisibility({visibilityProperty:!0});return e.getClientRects().length>0&&getComputedStyle(e).visibility!=="hidden"}function po(e){if(!(e instanceof HTMLInputElement)||e.type!=="radio"||!e.name)return[];return(e.form?Array.from(e.form.elements):Array.from(e.getRootNode().querySelectorAll(`input[name="${CSS.escape(e.name)}"]`))).filter((n)=>n instanceof HTMLInputElement&&n.type==="radio"&&n.name===e.name&&n.form===e.form)}function Ye(e){return Array.from(e.querySelectorAll(ol)).filter(fo)}function mo(e){let t=(o)=>[...o.filter((s)=>s.index>0).sort((s,a)=>s.index-a.index),...o.filter((s)=>s.index<=0)].flatMap((s)=>s.stops),n=(o,s)=>{for(let a of o){let i=a.hasAttribute("tabindex")?a.tabIndex:0;if(a.hasAttribute("inert")||a.shadowRoot&&i<0)continue;let l=a.matches(ol)&&!a.shadowRoot?.delegatesFocus&&fo(a)?[a]:[],c=a instanceof HTMLSlotElement?a.assignedElements():[];if(a.shadowRoot||c.length){let d=[];n(a.shadowRoot?.children??c,d),s.push({index:i,stops:[...l,...t(d)]})}else s.push({index:i,stops:l}),n(a.children,s)}},r=[];return n(e.children,r),r.flatMap((o)=>o.stops)}function il(e,t){let n=(r)=>{for(let o=r;o&&o!==t;o=o.parentElement)if(o.assignedSlot)return!0;return!1};return e.filter((r)=>r.tabIndex>0&&!n(r)).sort((r,o)=>r.tabIndex-o.tabIndex)}function sl(e,t){let n=e.ownerDocument??document;return Ye(n.body).find((r)=>!r.contains(e)&&!t?.contains(r)&&Ce(e,r))}var Rf="position:fixed;width:1px;height:1px;opacity:0;pointer-events:none;outline:none";function al(e,t){let n=e.ownerDocument,r,o=[],s=()=>{o.forEach((u)=>u.remove()),o=[],r=void 0},a=()=>{let u=n.createElement("span");return u.tabIndex=0,u.setAttribute("aria-hidden","true"),u.style.cssText=Rf,u},i=()=>{let u=n.activeElement;if(o.length||!t()||!(u instanceof HTMLIFrameElement)||!e.contains(u))return;r=u,o=[a(),a()],u.before(o[0]),u.after(o[1])},l=()=>{i(),setTimeout(i)},c=J(n.defaultView??window,"blur",l),d=J(n,"focusout",l),h=J(n,"focusin",(u)=>{let v=o.indexOf(u.target),x=r;if(s(),v<0||!x)return;let w=Ye(e),k=v===0?-1:1;(w.at((w.indexOf(x)+k)%w.length)??e).focus({preventScroll:!0})});return()=>{c(),d(),h(),s()}}function ml(e){return{consumeOutsidePress:e===!0||e==="pointer",trapFocus:e===!0||e==="trap-focus",inertAndLock:e===!0}}var $f={mouse:"pointer",pen:"pointer",touch:"touch",keyboard:"keyboard",virtual:"keyboard",programmatic:"imperative",agent:"imperative"},hl=(e)=>e?$f[He(e)]:"imperative";function Nf(e){if(e==="initial"||e==="hover")return"none";if(e==="touch")return"popup";return"auto"}function Wf(e){if(e.focusable&&!e.consumed)return!1;return e.type==="pointerdown"?"later":!0}var jf=new Set(["text","search","url","tel","email","password"]);function Vf(e){if(e.localName==="input"&&jf.has(e.type)&&e.value&&e.getAttribute("aria-expanded")!=="true")e.select()}function ll(e,t){for(let n of e){let r=n();if(r&&t(r))return r}}function bo(e,t,n){nt(e,t,(r,o)=>("open"in r)&&r.open!==o.open?n(!!r.open,o):void 0)}function gl(e,t){return{id:`${t}-content`,tabindex:"-1",hidden:e.mounted?void 0:"",...ot(e.open)}}var qf="a[href],button,input,select,textarea,summary,[tabindex],[contenteditable]";function Hf(e,t){if(typeof e==="function")return e()??void 0;if(typeof e==="string")return t.querySelector(e)??void 0;return e}function $n(e){return e.isConnected&&!e.closest("[inert]")}function cl(e){let t=e.getRangeAt(0).cloneRange(),n=!t.collapsed&&e.anchorNode===t.endContainer&&e.anchorOffset===t.endOffset;return{range:t,backward:n}}function ho(){let e=fe();return!e||e===e.ownerDocument.body||!$n(e)||e.checkVisibility?.()===!1}function go(e,t){return e.x<t.left||e.x>t.right||e.y<t.top||e.y>t.bottom}function ul(e){return e.getRootNode().activeElement}function Kf(e){let t=globalThis.CloseWatcher;if(!t||!/Android/.test(navigator.userAgent))return;let n;try{n=new t}catch{return}return n.addEventListener("close",(r)=>{if(performance.now()-za()<100)return;e(r)}),()=>n?.destroy()}var dl=new WeakMap,Nn=new WeakSet,fl=new WeakMap;function pl(e,t){for(let n=e;n;n=n.parent)if(n===t||Nn.has(n)&&(n.order??0)>(t.order??0))return!0;return!1}function bl(e){let t=rl(e.preset,e),n=()=>typeof t.tab==="function"?t.tab(e.modal()):t.tab,{store:r}=e,o,s,a,i,l,c,d=r.get().open?"initial":"imperative",h=t.focusOnMount&&r.get().open,u=!1,v=!1,x=!1,w=!0,k,A,W=r.get().open,M=()=>{return},I=[],N=e.returnTrigger??e.trigger,q,Q,L,R,V=(P,f)=>e.onOpenChangeComplete?.(P,f),z=(P)=>P||!!s?.el&&be;bo({store:r},["mounted"],(P)=>z(P)===P?{mounted:P}:void 0);function Z(P){k=P;let f=P?.isContentEditable?P.ownerDocument.getSelection():null;A=f?.rangeCount&&P.contains(f.anchorNode)?cl(f):void 0;let m=k&&qt(k),y=m?void 0:co();M=m?.returnTarget??(()=>y)}let ne=r.get().open;r.subscribe(()=>{let{open:P}=r.get();if(P===ne)return;if(ne=P,P){if(R?.(!0),e.onOpenChange?.(!0),i?.(),i=void 0,s){for(let F of[s.el,s.backdrop])if(F)qr(F,!0)}h=!0,u=!0,w=!0;let G=be?fe():null;Z(G&&G!==G.ownerDocument.body?G:void 0);let ve=N();W=d==="imperative"||x&&!!k&&!qt(k)&&!co()&&!(ve&&ye(ve,k));let De=!!s;if(r.set({mounted:!0}),o){if(De)ce();_()}else if(!be)u=!1,V(!0);return}let f=t.movesFocus&&w;w=!0,h=!1,u=!1,d="imperative",x=!1;let m=R?.(!1),y=s?.el;if(a)Ua(E());let S=M,T=A;if(A=void 0,!y||!be){e.onOpenChange?.(!1,m),r.set({mounted:!1}),V(!1,m);return}let g=fe(),O=e.trigger(),D=!g||g===y.ownerDocument.body||ye(y,g)||!!a&&Rn(a,g)&&!(O&&ye(O,g));e.onOpenChange?.(!1,m),o?.config.onClose?.();let H=_a(),B=[y,...s?.backdrop?[s.backdrop]:[]],j=B.length,Y=B.map((G)=>(qr(G,!1),Ts(G,()=>{if(--j>0)return;i=void 0,r.set({mounted:!1}),ce(),V(!1,m)})));if(j>0)i=()=>Y.forEach((G)=>G());if(l?.(),l=void 0,c?.(),c=void 0,!f||!D)return;if(f===!0){b(y,S,!1,T);let G=fe();setTimeout(()=>{if(G&&!G.isConnected&&ho()&&!lo(H))b(y,S)});return}if(f==="unless-moved"){queueMicrotask(()=>{let G=fe();if(!(!!G&&G!==y.ownerDocument.body&&!ye(y,G))&&!lo(H))b(y,S,!1,T)});return}let X=()=>{ie(),clearTimeout(le),setTimeout(()=>{let G=fe();if(!G||G===y.ownerDocument.body)b(y,S,!1,T)})},ie=J(window,"pointerup",X,{capture:!0}),le=setTimeout(X,1000)});function re(P,f,m=M,y=!1){let S=()=>m(f,y),T=()=>p(P,y);return W?[()=>k,S,N,T,e.trigger]:[N,()=>k,S,T,e.trigger]}let ee=!1;function E(P=$n,f=!1){if(ee)return;ee=!0;try{return ll(re(s?.el,P,M,f),P)}finally{ee=!1}}function p(P,f=!1){let m=I[0]?.node;if(m?.isConnected&&!P?.contains(m)){for(let Y of[...I.slice(1).map((X)=>X.node),m.ownerDocument.body]){let X=Ye(Y).filter((le)=>!P?.contains(le)),ie=X.find((le)=>Ce(m,le)&&!m.contains(le))??X.filter((le)=>Ce(le,m)).pop();if(ie)return ie}return}let y=I.findIndex((Y,X)=>!Y.node.isConnected&&I[X+1]?.node.isConnected);if(y===-1)return;let S=I[y],T=S.next?.deref(),g=S.previous?.deref(),O=I[y+1].node,D=(Y)=>!!Y?.isConnected&&Y.parentNode===O,H=D(T)?T.previousElementSibling===(S.previous?g:null):!S.next&&(S.previous?D(g)&&!g.nextElementSibling:!O.firstElementChild);if(f&&!H)return;let B=(Y,X)=>Y.contains(X)||Ce(Y,X),j=D(T)?(Y)=>B(T,Y):D(g)?(Y)=>Ce(g,Y)&&!g.contains(Y):(Y)=>B(O,Y);for(let{node:Y}of I.slice(y+1)){let X=Ye(Y).filter((G)=>!P?.contains(G)),ie=D(g)?X.filter((G)=>!B(g,G)||g.contains(G)).pop():void 0,le=X.find(j)??ie??X[0];if(le)return le}}function b(P,f,m=!1,y,S=e.finalFocus?.()??"trigger"){if(S==="none")return;let T=(O)=>{if(!$n(O)||P.contains(O))return!1;let D=O.ownerDocument.getSelection(),H=y&&O===k?D?.rangeCount&&O.contains(D.anchorNode)?cl(D):y:void 0;if(Cn(O),fe()!==O)return!1;if(H&&O.contains(H.range.startContainer)){let{startContainer:B,startOffset:j,endContainer:Y,endOffset:X}=H.range;if(H.backward)D?.setBaseAndExtent(Y,X,B,j);else D?.setBaseAndExtent(B,j,Y,X)}return!0},g=re(P,T,f,m);if(S!=="trigger")g.unshift(()=>Hf(S,P.ownerDocument));ll(g,T)}function C(P){if(!h||!s||!r.get().open||!t.movesFocus)return;h=!1;let f=d==="initial"&&t.focusOnMount?"auto":Nf(d);if(f==="none")return;let m=()=>{if(!s||!r.get().open)return;let y=f==="popup"?s.el:P?.();if(!y)return;if(zr(y),!s||!r.get().open)return;let S=fe();if(!S||!ye(y,S)&&!ye(s.el,S)){zr(s.el);return}Vf(y)};if(v)requestAnimationFrame(()=>{let y=fe();if(!s||!y||!ye(s.el,y))m()});else m()}function K(P,f){let m=[],y=e.trigger(),S=f.host?.()??P;if(d==="initial"&&!k){let F=fe();Z(F&&F!==F.ownerDocument.body&&!ye(P,F)?F:void 0)}P.removeAttribute("hidden"),S.removeAttribute("hidden");let T=s?.backdrop;if(T){let F=U(T,f.inline);m.push(()=>{F(),oe(T)})}if(!f.inline){S.setAttribute("popover","manual");try{S.showPopover()}catch{}}if(f.position&&e.position){let F=e.position(()=>f.anchor?.()??e.trigger(),P,f.position);if(q=F.place,Q=F.follow,m.push(F,()=>q=Q=void 0),f.rendered)m.push(f.rendered(F.follow))}if(!f.inline&&!an()&&!S.style.zIndex)S.style.zIndex="2147483000";m.push(vn(P,u?()=>{u=!1,V(!0)}:void 0)),En();let g=e.modal(),O=t.blur,D=e.persistent?.()??[],H=(F,te)=>F===P&&!!te&&("clientX"in te)&&go({x:te.clientX,y:te.clientY},P.getBoundingClientRect()),B=N()??(!y&&k?.isConnected?k:void 0);if(B||!y)I=[];for(let F=B??null;F&&F!==P.ownerDocument.body;F=F.parentElement){let{nextElementSibling:te,previousElementSibling:ge}=F;I.push({node:F,next:te&&new WeakRef(te),previous:ge&&new WeakRef(ge)})}let j={parent:e.parent?.()??(y&&qt(y)),active:()=>r.get().open,exiting:()=>!r.get().open&&r.get().mounted,modal:g.consumeOutsidePress,blocking:typeof t.blocking==="function"?t.blocking(g):t.blocking,outsidePress:t.outsidePress,shield:t.shield,component:e.owner?.component,id:e.owner?.id,el:P,contains:(F,te)=>P.contains(F)&&!H(F,te)||D.some((ge)=>ge.contains(F))||(e.contains?e.contains(F,te):!!e.trigger()?.contains(F)),overBackdrop:(F,te)=>!!s?.backdrop&&!go({x:F,y:te},s.backdrop.getBoundingClientRect())&&go({x:F,y:te},P.getBoundingClientRect()),returnTarget:E,onOutsidePress:(F)=>{let te=F.composedPath()[0];e.close("outside-press",{event:F,focus:Wf({type:F.type,focusable:!!te?.closest?.(qf),consumed:g.consumeOutsidePress})})},onEscape:(F)=>{if(F.preventDefault(),e.onEscape)e.onEscape(F);else e.close("escape-key",{event:F,focus:!0})},onBlur:O==="never"?void 0:O==="always"?(F)=>e.close("window-blur",{event:F,focus:!1}):(F)=>setTimeout(()=>{let te=ul(P)??P.ownerDocument.activeElement;if(te?.tagName==="IFRAME"&&!P.contains(te))e.close("focus-out",{event:F,focus:!1})})};if(a=j,dl.set(j,[P,...T?[T]:[]]),m.push(Qa(j)),fl.set(j,{inside:(F)=>F.contains(P)||!!y&&F.contains(y),again:()=>{let F=fe();ce();for(let te of[S,T])try{te?.hidePopover()}catch{}if(_(),F&&F!==fe())F.focus({preventScroll:!0})}}),g.inertAndLock)Nn.add(j);for(let F of[e.onShow,f.onShow]){let te=F?.(j);if(te)m.push(te)}let Y,X,ie,le=()=>{let F=[P,...s?.backdrop?[s.backdrop]:[],...D];if(y&&t.keepTrigger)F.push(y);for(let ge of Fn())if(ge!==j&&pl(ge,j))F.push(...dl.get(ge)??[]);Y=el(P.ownerDocument,P);let te=tl(F);j.keep=te.keep,l=X=te},G=()=>{if(ie?.(),X?.(),Y?.(),l===X)l=void 0;X=Y=j.keep=void 0};if(g.inertAndLock)ie=la(()=>{if(ie=void 0,!r.get().open)return;let F=fe();if(le(),n()==="trap"&&F&&!$n(F))h=!0,C(f.initialFocus)});L=()=>{let F=e.modal();if(j.modal=F.consumeOutsidePress,j.blocking=typeof t.blocking==="function"?t.blocking(F):t.blocking,F.inertAndLock)Nn.add(j);else Nn.delete(j);if(F.inertAndLock&&!g.inertAndLock&&r.get().open)le();else if(!F.inertAndLock&&g.inertAndLock)G();g=F},m.push(G,()=>L=void 0);let ve=new Set(Fn());for(let F=j.parent;F;F=F.parent)ve.add(F);ve.delete(j);for(let F of ve)if(F.keep&&pl(j,F))for(let te of[P,...T?[T]:[]])m.push(F.keep(te));if(n()==="flow"&&t.dismissOnFocusLoss){let F;m.push(J(P.ownerDocument,"mousedown",(te)=>{F=te,setTimeout(()=>{if(F===te)F=void 0})},{capture:!0}),J(P.ownerDocument,"focusin",(te)=>{let ge=ul(P)??te.target;if(!r.get().open||Rn(j,ge))return;if(F&&j.contains(ge,F))return;e.close("focus-out",{event:te,focus:!1})}))}if(m.push(al(P,()=>n()==="trap")),t.closeWatcher){let F=Kf((te)=>e.close("back",{event:te,focus:!0}));if(F)c=F,m.push(()=>{if(F(),c===F)c=void 0})}let De=(F)=>{let{target:te,submitter:ge}=F;if((ge?.getAttribute("formmethod")??te.getAttribute("method"))?.toLowerCase()!=="dialog"||qt(te)!==j)return;F.preventDefault(),e.close("close-press",{event:F,focus:!0,returnValue:ge?.value||void 0})};if(P.addEventListener("submit",De),m.push(()=>P.removeEventListener("submit",De)),r.get().open&&!h&&n()==="trap"&&ho())h=!0;for(let F of Fn()){let te=fl.get(F);if(F!==j&&te?.inside(P))te.again()}return queueMicrotask(()=>C(f.initialFocus)),()=>{if(m.forEach((F)=>F()),a===j)a=void 0;if(!r.get().mounted&&!f.inline)try{S.hidePopover()}catch{}}}function _(){if(!o||s)return;let{el:P,config:f}=o;s={el:P,cleanup:()=>{},backdrop:f.backdrop?.()},s.cleanup=K(P,f)}function U(P,f=!1){if(P.removeAttribute("hidden"),f)return vn(P);P.setAttribute("popover","manual");try{P.showPopover()}catch{}if(!an()&&!P.style.zIndex)P.style.zIndex="2147483000";return vn(P)}function oe(P){if(!r.get().mounted)try{P.hidePopover()}catch{}}function ce(){if(!s)return;let{cleanup:P}=s;s=void 0,P()}function ae(P){if(P.key==="Escape"&&a)return Ga(a,P);let f=s?.el;if(P.key!=="Tab"||!f)return;let m=n();if(m==="native")return;if(m==="close")return e.close("focus-out",{event:P,focus:!1});let y=Ye(f),S=mo(f),T=S[0],g=S.at(-1),O=fe(),D=!T||O===T||O===f,H=!g||O===g,B=m==="trap"?il(y,f):[];if(B.length){let Y=[...B,...y.filter((De)=>!B.includes(De))],X=Y.indexOf(O),ie=O===f?Y.at(P.shiftKey?-1:0):Y.at((X+(P.shiftKey?-1:1))%Y.length),le=B.includes(O)||!!ie&&B.includes(ie),G=O?.shadowRoot,ve=!P.shiftKey&&!!G&&Ye(G).length>0;if(O!==f&&(X<0||!le||ve))return;P.preventDefault(),ie?.focus({preventScroll:!0});return}if(m==="trap"){if(P.shiftKey?D:H){P.preventDefault(),((P.shiftKey?g:T)??f).focus({preventScroll:!0});return}let Y=y.indexOf(O),X=Y<0?void 0:y[Y+(P.shiftKey?-1:1)],ie=X&&!X.checked?po(X):[];if(ie.some((le)=>le.checked)&&!ie.includes(O)){P.preventDefault(),X?.focus({preventScroll:!0});return}setTimeout(()=>{let le=fe(f.ownerDocument);if(s?.el===f&&!(le&&(ye(f,le)||!!a&&Rn(a,le))))((P.shiftKey?g:T)??f).focus({preventScroll:!0})});return}let j=e.trigger()??(k?.isConnected?k:void 0);if(!j)return;if(P.shiftKey&&D)P.preventDefault(),j.focus({preventScroll:!0});else if(!P.shiftKey&&H){let Y=sl(j,f);if(!Y)return;P.preventDefault(),Y.focus()}}return{bind(P,f={}){let m=!1,y=St(P),S=()=>{if(o={el:P,config:f},r.get().mounted){if(s&&s.el!==P)ce();_()}};if(P.isConnected)S();else queueMicrotask(()=>{if(!m&&P.isConnected)S()});return()=>{m=!0;let T=e.finalFocus?.()??"trigger";if(y(),o?.el!==P)return;if(o=void 0,s?.el===P){let g=fe(),O=r.get().open&&t.movesFocus&&(!g||g===P.ownerDocument.body||ye(P,g)),D=M;if(ce(),O){let H=A;A=void 0,queueMicrotask(()=>{if(!o&&!P.isConnected&&ho())b(P,D,!0,H,T)})}}}},keydown:ae,triggerKeydown(P){let f=s?.el;if(P.key!=="Tab"||P.shiftKey||!f||!r.get().open)return;if(n()!=="flow")return;P.preventDefault(),(mo(f)[0]??f).focus({preventScroll:!0})},opening(P,f){d=P,v=f?.type==="pointerdown",x=f?.type==="keydown"},opener:()=>d,observe(P){R=P},requestClose:(P,f)=>e.close(P,{event:f,focus:!0}),returnFocus(P){w=P},initialFocus:C,place:()=>q?.(),checkPlacement:()=>Q?.(),updateModal:()=>L?.(),layer:()=>a,element:()=>s?.el,mountedAs:z,backdrop(P){if(!s||s.backdrop===P)return()=>{};let{el:f}=s,m=o?.config.host?.()??f,y=!!o?.config.inline;s.backdrop=P;let S=U(P,y),T=fe();if(!y)try{m.hidePopover(),m.showPopover()}catch{}if(T&&T!==fe())T.focus({preventScroll:!0});let g=a?.keep?.(P);return()=>{if(g?.(),S(),s?.backdrop===P)s.backdrop=void 0;oe(P)}}}}Se();Ie();var gc,mc=()=>gc??=Promise.resolve().then(() => (pc(),fc)),hc=(e)=>be&&matchMedia(e).matches;function bc(e,t,n,r,o){let s=()=>{let l=n(),c=l==="auto"&&hc("(max-width: 640px) and (pointer: coarse)");return l==="sheet"||c?"sheet":r},a=()=>e.set({presentation:s()}),i=n();if(i==="sheet")a();if(be&&!gc&&(i==="sheet"||i==="auto"&&hc("(pointer: coarse)")))(window.requestIdleCallback??setTimeout)(()=>mc().then((l)=>l.prepareVariables()));return{open:a,resolve:s,bind(l,c){let d=t();if(n()==="auto"&&d.opener()==="initial"&&e.get().open)queueMicrotask(a);if(e.get().presentation!=="sheet")return d.bind(l,c);let h,u=!1,v=()=>l.hidden||(l.hidden=!0),x=new MutationObserver(v),w=(A)=>{if(x.disconnect(),!u)h=A()};mc().then(({presentSheet:A})=>w(()=>A(l,d,{...o?.sheet,...c})),()=>w(()=>d.bind(l,c))),v(),x.observe(l,{attributeFilter:["hidden"]});let k=St(l);return()=>{u=!0,x.disconnect(),k(),h?.()}}}}var yc=[0.5,1];function vc(e,t){let{store:n}=t;if(Yt.get(n)&&n.get().presentation==="sheet"&&He()!=="touch")queueMicrotask(()=>e.isConnected&&e.focus({preventScroll:!0}));Yt.delete(n);let r=[J(e,"touchend",(o)=>{if(n.get().open||!o.cancelable||t.presentation.resolve()!=="sheet")return;o.preventDefault(),t.open(o)},{passive:!1}),J(e,"focus",()=>Yt.set(n,!0)),J(e,"blur",(o)=>o.relatedTarget&&Yt.set(n,!1))];return()=>{if(r.forEach((o)=>o()),e.ownerDocument.activeElement===e)Yt.set(n,!0)}}var Yt=new WeakMap;Un();var wc;function jp(){return wc??=typeof CSS<"u"&&typeof CSS.supports==="function"&&["position-anchor: --a","position-try-fallbacks: flip-y","position-visibility: always"].every((e)=>CSS.supports(e)),wc}var $o=(e)=>{let t=document.documentElement;return!e.x&&!e.y&&Math.abs(e.width-t.clientWidth)<1&&Math.abs(e.height-t.clientHeight)<1};function xc(e,t,n,r,o){if(!jp()||e.getRootNode()!==n.getRootNode()||!(t.width||t.height)||!$o(o))return!1;let s=(a)=>a.split(",").some((i)=>parseFloat(i)>0);return!s(r.transitionDuration)&&(r.animationName==="none"||!s(r.animationDuration))}function Sc(e,t,n,r,o){let{sideOffset:s,alignOffset:a,collisionPadding:i}=r,l=t==="top"||t==="bottom",[c,d]=l?["left","right"]:["top","bottom"],h=l?o.width:o.height,u=n==="start"?`anchor(${c}) + ${a}px`:n==="end"?`anchor(${d}) - ${h+a}px`:`anchor(center) - ${h/2-a}px`,v=Yn[t];return{[v]:`round(anchor(${t}), 1px)`,[t]:"auto",[`margin-${v}`]:`${s}px`,[`margin-${t}`]:`${i}px`,[c]:`round(min(max(${u}, min(${i}px, anchor(${d}))), max(100% - ${h+i}px, anchor(${c}) - ${h}px)), 1px)`,"position-anchor":e,"position-try-fallbacks":l?"flip-y":"flip-x","position-visibility":"always"}}var Ro=new WeakMap,Vp=globalThis[Symbol.for("ui-sdk.anchor-names@1")]??={count:0};function No(e){let t=Ro.get(e);if(!t)t=`--ui-anchor-${++Vp.count}`,Ro.set(e,t);if(!e.style.getPropertyValue("anchor-name").split(",").some((r)=>r.trim()===t)){let r=getComputedStyle(e).getPropertyValue("anchor-name");e.style.setProperty("anchor-name",r&&r!=="none"?`${r}, ${t}`:t)}return t}function kc(e){let t=Ro.get(e),n=e.style.getPropertyValue("anchor-name").split(",").map((r)=>r.trim()).filter((r)=>r&&r!==t);if(n.length)e.style.setProperty("anchor-name",n.join(", "));else e.style.removeProperty("anchor-name");if(!e.getAttribute("style"))e.removeAttribute("style")}var Et=new Map,Ac=()=>{},Wo=Ac,Ec=(e)=>Et.forEach((t,n)=>e.target instanceof Node&&t?.contains(e.target)||n()),Cc=(e)=>Et.forEach((t,n)=>e.some((r)=>r.attributeName!="aria-activedescendant"&&!t?.contains(r.target))&&n());function qp(){let e=new AbortController,t={capture:!0,passive:!0,signal:e.signal},n=[[document,["scroll","load","input","pointermove","focusin","transitionstart","animationstart"]],[window,["resize"]],[window.visualViewport,["resize","scroll"]],[document.fonts,["loadingdone"]]];for(let[o,s]of n)for(let a of s)o?.addEventListener(a,Ec,t);let r=new MutationObserver(Cc);return r.observe(document,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),()=>{e.abort(),r.disconnect()}}var rr=new Map;function Hp(e){let t=new AbortController,n={capture:!0,passive:!0,signal:t.signal};for(let o of["scroll","load","transitionstart","animationstart"])e.addEventListener(o,Ec,n);let r=new MutationObserver(Cc);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),()=>{t.abort(),r.disconnect()}}function Mc(e){let t=[];for(let n=e;n;)if(n.nodeType===11&&"host"in n)t.push(n),n=n.host;else n=n.assignedSlot??n.parentNode;return t}function Pc(e){let t=[...e];for(let n of t){let r=rr.get(n)??{count:0,stop:Hp(n)};r.count++,rr.set(n,r)}return()=>{for(let n of t.splice(0)){let r=rr.get(n);if(--r.count)continue;r.stop(),rr.delete(n)}}}function Oc(e,t){if(!Et.size)Wo=qp();let n=typeof ResizeObserver=="function"?new ResizeObserver(e):void 0;if(t)n?.observe(t);return Et.set(e,n&&t),()=>{if(n?.disconnect(),Et.delete(e),Et.size)return;Wo(),Wo=Ac}}Un();Oe();function Kp(e){let t=e;if(!e.getClientRects().length){if(getComputedStyle(e).display!=="contents")return;if(t=e.ownerDocument.createRange(),t.selectNodeContents(e),!t.getClientRects().length)return}let{x:n,y:r,width:o,height:s}=t.getBoundingClientRect();return{x:n,y:r,width:o,height:s}}function Bp(e){let t="getBoundingClientRect"in e?e.getBoundingClientRect():{width:0,height:0,...e};return{x:t.x,y:t.y,width:t.width,height:t.height,left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height}}var Ct=(e)=>e==="top"||e==="bottom";function Tc(e,t,n,r,o){let{sideOffset:s,alignOffset:a}=o,i=n==="top"||n==="bottom",l=0,c=0;if(n==="bottom")c=e.y+e.height+s;if(n==="top")c=e.y-t.height-s;if(n==="right")l=e.x+e.width+s;if(n==="left")l=e.x-t.width-s;if(i){if(r==="start")l=e.x+a;if(r==="center")l=e.x+e.width/2-t.width/2+a;if(r==="end")l=e.x+e.width-t.width-a}else{if(r==="start")c=e.y+a;if(r==="center")c=e.y+e.height/2-t.height/2+a;if(r==="end")c=e.y+e.height-t.height-a}return{x:l,y:c}}function jo(e,t,n,r,o){if(e==="bottom")return t.y+n.height-(r.y+r.height-o);if(e==="top")return r.y+o-t.y;if(e==="right")return t.x+n.width-(r.x+r.width-o);return r.x+o-t.x}function _p(e,t,n,r){let{sideOffset:o,collisionPadding:s}=r,a=e==="bottom"?n.y+n.height-s-(t.y+t.height+o):e==="top"?t.y-o-s-n.y:n.height-s*2,i=e==="right"?n.x+n.width-s-(t.x+t.width+o):e==="left"?t.x-o-s-n.x:n.width-s*2;return{width:Math.max(0,i),height:Math.max(0,a)}}var Rc=(e,t,n=!1)=>n&&Ct(e)&&t!=="center"?t==="start"?"end":"start":t,Ue=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));function Dc(e,t,n,r){let o={x:0,y:0,...n},s={...r,side:Ht(r.side,r.rtl)},a=Rc(s.side,s.align,s.rtl),i=s.side,l=Tc(e,t,i,a,s),c=jo(i,l,t,o,s.collisionPadding);if(c>0){let v=Yn[i],x=Tc(e,t,v,a,s);if(jo(v,x,t,o,s.collisionPadding)<c)i=v,l=x}let d=s.collisionPadding,h=_p(i,e,o,s),u=!1;if(jo(i,l,t,o,d)>0){if((i==="top"||i==="bottom")&&t.height&&(e.height>=t.height||s.inside))u=!0,l.y=Ue(Ue(l.y,o.y+d,o.y+o.height-t.height-d),e.y,e.y+e.height-t.height),h.height=Math.max(0,o.height-d*2);else if((i==="left"||i==="right")&&t.width&&(e.width>=t.width||s.inside))u=!0,l.x=Ue(Ue(l.x,o.x+d,o.x+o.width-t.width-d),e.x,e.x+e.width-t.width),h.width=Math.max(0,o.width-d*2)}if(i==="top"||i==="bottom"){let v=Ue(l.x,o.x+d,o.x+o.width-t.width-d);l.x=v===l.x?v:Ue(v,e.x-t.width,e.x+e.width)}else{let v=Ue(l.y,o.y+d,o.y+o.height-t.height-d);l.y=v===l.y?v:Ue(v,e.y-t.height,e.y+e.height)}return{...l,side:i,align:s.align,available:h,inside:u}}var zp=3,Yp=500,$c=["--available-height","--available-width"],Lc=!1;function Nc(){if(Lc)return;Lc=!0,Nt(()=>Xr($c))}function Ic(e){let t=new Map,n=(r,o)=>{if(t.get(r)===o)return!1;return t.set(r,o),!0};return{style(r,o){if(n(`style:${r}`,o))e.style.setProperty(r,o)},attribute(r,o){if(!n(r,o))return;if(o===null)e.removeAttribute(r);else e.setAttribute(r,o)},reset:()=>t.clear()}}function Up(){let e=window.visualViewport;return{x:e?.offsetLeft??0,y:e?.offsetTop??0,width:e?.width??document.documentElement.clientWidth,height:e?.height??document.documentElement.clientHeight}}function Wc(e,t,n={}){let r=()=>typeof n==="function"?n():n,o=()=>typeof e==="function"?e():e,s=(b)=>({side:b.side??"bottom",align:b.align??"start",sideOffset:Number(b.sideOffset??4),alignOffset:Number(b.alignOffset??0),collisionPadding:Number(b.collisionPadding??8)});Xr($c),Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",left:"0",top:"0"});let a=Ic(t),i=getComputedStyle(t),l,c="",d="",h=!1,u=!1,v=!1,x=[],w=()=>{},k=!1,A,W={left:"0",top:"0"},M,I=new Set;function N(b={left:"0",top:"0"}){if(A)kc(A.anchor);A=void 0;for(let C of I)a.style(C,"");I.clear(),c="",a.style("inset","auto"),a.style("margin","0"),a.style("left",b.left),a.style("top",b.top)}function q(){if(v)return!1;let b=r(),C=s(b),K=Number(b.arrowPadding??6),_=o();if(!_)return!1;let U="nodeType"in _?_:void 0,oe=U&&Kp(U);if(U&&h&&(!U.isConnected||!oe)){if(A)N(W);return!1}let ce=U?Mc(U):[];if(ce.length!==x.length||ce.some((pe,Ee)=>pe!==x[Ee]))w(),x=ce,w=Pc(ce);u=!U&&"getBoundingClientRect"in _;let ae=Up();if(A&&(U!==A.anchor||!$o(ae)))N();if(!k){if(k=!0,U&&oe&&xc(U,oe,t,i,ae))A={anchor:U,name:No(U)};else for(let pe of Xp)if(t.style.getPropertyValue(pe))t.style.removeProperty(pe)}else if(A)No(A.anchor);let P=!h,f=t.style.transition;if(P)t.style.transition="none";let m=Bp(oe??_),y={width:t.offsetWidth,height:t.offsetHeight},S=Vo(b),T=S?{width:S.offsetWidth,height:S.offsetHeight}:void 0,g=[m.x,m.y,m.width,m.height,y.width,y.height,ae.x,ae.y,ae.width,ae.height,T?.width,T?.height,...Object.values(C),K].join();if(g===c&&(!S||S===l?.el))return!1;c=g;let O={left:t.clientLeft,top:t.clientTop,width:t.clientWidth,height:t.clientHeight},D=i.direction==="rtl",H=Gp(i,y);if(A){let pe=Ht(C.side,D),Ee=Sc(A.name,pe,Rc(pe,C.align,D),C,H);for(let[je,ft]of Object.entries(Ee))I.add(je),a.style(je,ft)}let B=Jp(t.getBoundingClientRect(),H,i),{scale:j}=B,Y={width:H.width*j.x,height:H.height*j.y},X=[m.x,m.y,m.width,m.height,ae.x,ae.y,ae.width,ae.height,...Object.values(C)].join(),ie={...C,inside:d===X,sideOffset:C.sideOffset*(Ct(C.side)?j.y:j.x),alignOffset:C.alignOffset*(Ct(C.side)?j.x:j.y),rtl:D},le={x:m.x,y:m.y,width:m.width,height:m.height},G=Dc(le,Y,ae,ie);d=G.inside?X:"";let ve=M;M=le;let De=(pe)=>Math.abs(B.x-pe.x)<=1&&Math.abs(B.y-pe.y)<=1;if(A){let pe=De(G),Ee=!pe&&!!ve&&De(Dc(ve,Y,ae,ie));if(!pe&&!Ee)return N(),t.style.transition=f,q();if(Ee)c="";W={left:`${parseFloat(i.left)+parseFloat(i.marginLeft)}px`,top:`${parseFloat(i.top)+parseFloat(i.marginTop)}px`}}else{let pe={x:B.x-(parseFloat(i.left)||0)*j.x,y:B.y-(parseFloat(i.top)||0)*j.y},Ee=t.ownerDocument.defaultView?.devicePixelRatio||1,je=(ft)=>Math.round(ft*Ee)/Ee;a.style("left",`${je((G.x-pe.x)/j.x)}px`),a.style("top",`${je((G.y-pe.y)/j.y)}px`)}let F=Ct(G.side)?j.x:j.y;if(P)h=!0,i.left,t.style.transition=f;a.attribute("data-side",G.side),a.attribute("data-align",G.align),a.style("--available-height",`${G.available.height/j.y}px`),a.style("--available-width",`${G.available.width/j.x}px`),a.style("--anchor-width",`${m.width/j.x}px`),a.style("--anchor-height",`${m.height/j.y}px`);let[te,ge]=tm(G.side,G.align,D,m,Y,G);a.style("--transform-origin",`${Math.round(te/j.x)}px ${Math.round(ge/j.y)}px`);let dr={x:G.x+O.left*j.x,y:G.y+O.top*j.y,width:O.width*j.x,height:O.height*j.y},Ku=em(m,dr,G.side,K*F);if(a.style("--arrow-offset",`${Math.round(Ku/F)}px`),S&&T){let pe={...dr,...Y},Ee={width:T.width*j.x,height:T.height*j.y},je=Zp(m,pe,Ee,G.side,K*F),ft=Math.round(je.offset/F);if(l?.el!==S)l={el:S,write:Ic(S)};let{write:pt}=l;pt.style("position","absolute"),pt.style("left",Ct(G.side)?`${ft}px`:""),pt.style("top",Ct(G.side)?"":`${ft}px`),pt.attribute("data-side",G.side),pt.attribute("data-align",G.align),pt.attribute("data-arrow-clamped",je.clamped?"":null)}return!0}let Q=0,L=0;function R(){if(Q=0,L=q()?0:L+1,L<zp||u)Q=requestAnimationFrame(R)}function V(){L=0,Q||=requestAnimationFrame(R)}let z=Oc(V,t),Z=setInterval(()=>Q||q()&&V(),Yp);q(),V();let ne=()=>{cancelAnimationFrame(Q),clearInterval(Z),z(),w(),x=[],v=!0},re=r(),ee=Fc(re),E=Vo(re);function p(){let b=r(),C=Fc(b),K=Vo(b);if(C===ee&&K===E)return;ee=C,E=K,V()}return Object.assign(ne,{follow:p,place(){h=!1,c="",a.reset(),l?.write.reset(),q()}})}var Xp=["position-anchor","position-try-fallbacks","position-visibility"],Vo=(e)=>typeof e.arrow==="function"?e.arrow():e.arrow,Fc=(e)=>[e.side,e.align,e.sideOffset,e.alignOffset,e.collisionPadding,e.arrowPadding].join();function Gp(e,t){let n=(i)=>parseFloat(e.getPropertyValue(i))||0,r=(i,l)=>e.boxSizing==="border-box"?0:n(`padding-${i}`)+n(`padding-${l}`)+n(`border-${i}-width`)+n(`border-${l}-width`),o=parseFloat(e.width)+r("left","right"),s=parseFloat(e.height)+r("top","bottom"),a={width:Math.abs(o-t.width)<1,height:Math.abs(s-t.height)<1};return{width:a.width?o:t.width,height:a.height?s:t.height,exact:a}}var Qp=(e)=>{let t=parseFloat(e)||0;if(e.endsWith("turn"))return t*2*Math.PI;if(e.endsWith("grad"))return t*Math.PI/200;if(e.endsWith("rad"))return t;return t*Math.PI/180};function Jp(e,t,n){let[r=0,o=0]=n.transformOrigin.split(" ").map((f)=>parseFloat(f)||0),s=(f,m)=>!f?0:f.endsWith("%")?parseFloat(f)/100*m:parseFloat(f)||0,a=n.translate&&n.translate!=="none"?n.translate.split(" "):[],i=s(a[0],t.width),l=s(a[1],t.height),c=n.rotate&&n.rotate!=="none"?n.rotate.split(" "):[],d={x:[1,0,0],y:[0,1,0],z:[0,0,1]}[c[0]],[h,u,v]=d??(c.length===4?c.slice(0,3).map(parseFloat):[0,0,1]),x=Math.hypot(h,u,v)||1,[w,k,A]=[h/x,u/x,v/x],W=c.length?Qp(c[c.length-1]):0,[M,I]=[Math.cos(W),Math.sin(W)],N=[M+(1-M)*w*w,(1-M)*w*k-I*A,(1-M)*w*k+I*A,M+(1-M)*k*k],[q=1,Q=q]=n.scale&&n.scale!=="none"?n.scale.split(" ").map(parseFloat):[],L=/^matrix(3d)?\((.*)\)$/.exec(n.transform??""),R=L?.[2].split(",").map(parseFloat)??[],[V,z,Z,ne,re,ee,E,p,b]=!L?[1,0,0,1,0,0,0,0,1]:L[1]?[R[0],R[1],R[4],R[5],R[12],R[13],R[3],R[7],R[15]]:[...R,0,0,1],C=(f,m)=>{let[y,S]=[f-r,m-o],T=E*y+p*S+b||1,g=q*(V*y+Z*S+re)/T,O=Q*(z*y+ne*S+ee)/T;return[r+i+N[0]*g+N[1]*O,o+l+N[2]*g+N[3]*O]},K=[C(0,0),C(t.width,0),C(0,t.height),C(t.width,t.height)],_=K.map(([f])=>f),U=K.map(([,f])=>f),oe=Math.min(..._),ce=Math.min(...U),ae=(f,m,y=!1)=>m>0.01&&Math.abs(f-m)>=(y?0.05:1)?f/m:1,P={x:ae(e.width,Math.max(..._)-oe,t.exact?.width),y:ae(e.height,Math.max(...U)-ce,t.exact?.height)};return{x:e.x-P.x*oe,y:e.y-P.y*ce,scale:P}}function Zp(e,t,n,r,o){let s=r==="top"||r==="bottom",a=s?n.width:n.height,l=(s?e.x+e.width/2-t.x:e.y+e.height/2-t.y)-a/2,c=(s?t.width:t.height)-a-o,d=Math.max(o,Math.min(l,c));return{offset:Math.round(d),clamped:Math.abs(d-l)>0.5}}function em(e,t,n,r){let o=n==="top"||n==="bottom",s=o?e.x+e.width/2-t.x:e.y+e.height/2-t.y,a=o?t.width:t.height;return Math.round(Math.min(Math.max(s,r),Math.max(r,a-r)))}function tm(e,t,n,r,o,s){if(e==="top"||e==="bottom"){let i=n?r.right-s.x:r.left-s.x,l=n?r.left-s.x:r.right-s.x;return[t==="center"?r.left+r.width/2-s.x:t==="start"?i:l,e==="bottom"?0:o.height]}let a=t==="center"?r.top+r.height/2-s.y:t==="start"?r.top-s.y:r.bottom-s.y;return[e==="right"?0:o.width,a]}function qo(e,t,n){if(typeof t!=="string")return t??n();let r=e.getRootNode();return(r===e.ownerDocument?null:r.querySelector(t))??e.ownerDocument.querySelector(t)}function Ho(e,t,n){return{side:e.side??t.side??"bottom",align:e.align??t.align,sideOffset:e.sideOffset??t.sideOffset??4,alignOffset:e.alignOffset??t.alignOffset??0,collisionPadding:e.collisionPadding,arrow:n,arrowPadding:e.arrowPadding}}var jc={position:Wc,prepare:()=>wt(Nc),anchor:qo,options:Ho};var Ko=(e)=>({open:e.open,disabled:Me(e),readOnly:e.readOnly,required:e.required}),Bo=(e,t)=>`${t}-${e.listed?"list":"content"}`,nm={"aria-labelledby":void 0,"aria-label":void 0};function Vc(){return{props:{side:"string",align:"string",sideOffset:"number",alignOffset:"number",collisionPadding:"number",arrowPadding:"number",container:"value",anchor:"string",keepMounted:"boolean"},connect:St,present:(e,{props:t})=>e.mounted||!!t.keepMounted||!!e.prepared,role:(e)=>e.listed?"presentation":"listbox",roles:["presentation","listbox"],keys:[...wn,"Home","End","Enter"," ","typeahead"],attrs:(e,{id:t})=>({...gl(e,t),"aria-multiselectable":!e.listed&&e.multiple?"true":void 0,...e.listed?nm:jr(e,t),"aria-busy":!e.listed&&e.status==="loading"?"true":void 0,"data-presentation":e.presentation}),on:{...Ze,keydown:(e,{api:t})=>t.internal.onListKeyDown(e)},bind:(e,t)=>rm(e,t.key,t.store,t.api.internal,{part:t,anchor:t.api.internal.anchorElement,snapPoints:yc})}}function rm(e,t,n,r,o){let{aligned:s}=o,a=!0;Ve(()=>a&&n.set({settled:!0}));let i=r.loadMore.bind(e),l=r.presentation.bind(e,{snapPoints:o.snapPoints,anchor:()=>qo(e,r.contentProps(t).anchor,()=>s?.()||o.anchor()),position:()=>{let c=r.contentProps(t),d=s?.()?{...c,side:"bottom",align:"start",sideOffset:0}:c;return Ho(d,{align:"start"},r.arrowElement())},rendered:(c)=>Sa(o.part,c),initialFocus:r.initialFocus});return()=>{a=!1,i(),l(),n.set({settled:!1})}}function qc(){return{role:"listbox",keys:{none:"The field's input handles them, or the content around the list once focus is in it."},attrs:(e,{id:t})=>({id:`${t}-list`,"aria-multiselectable":e.multiple?"true":void 0,...jr(e,t),"aria-busy":e.status==="loading"?"true":void 0}),bind:(e,{store:t})=>bn(t,"listed")}}function Hc(e,t,n){}Oe();var Kc=new WeakMap;function Bc(e,t){let n=Kc.get(e);if(!n)Kc.set(e,n={});if(n[t]=(n[t]??0)+1,n[t]===1)e.setAttribute(t,"");return()=>{if(n[t]--,n[t]===0)e.removeAttribute(t)}}function om(e){xe(e,"ui-sdk-mirror","@layer ui-sdk{:where([data-mirror][aria-hidden]){display:inline-block}:where([data-mirror][aria-hidden]:dir(rtl)){scale:-1 1}}")}function im(e,t,n,r){let o,s,a,i=!0,l=()=>{let d=e.parentElement?.closest(t.item);if(!d)return!1;if(!o)o=Bc(d,"data-has-icon"),r(d);if(!t.list)return!0;let h=d.parentElement?.closest(t.list);if(h)s=Bc(h,"data-has-icons");return!!h},c=()=>{if(!l())return;a?.(),a=void 0};if(!l())queueMicrotask(()=>{if(i&&!l())a=n(c)});return()=>{i=!1,a?.(),o?.(),s?.()}}function _c(e){return{props:{mirror:"boolean",id:"id",item:{kind:"string",from:"item.value"}},state:(t,{props:n})=>({mirror:!!n.mirror}),attrs:(t,{props:n})=>({"aria-hidden":"true","data-mirror":n.mirror?"":void 0}),bind(t,{api:n,props:r,id:o,store:s}){om(t.ownerDocument);let a=(c)=>se&&queueMicrotask(()=>{if(c.isConnected)Hc(c,"An item with only an icon",{component:e.component,id:o})}),i=im(t,e,s.subscribe,a),l=e.register?.(t,{api:n,props:r});return()=>{i(),l?.()}}}}var zc={item:'[role="option"]',list:'[role="listbox"]'};var sm=[];function Yc(e,{api:t}){return{open:e.open,presentation:e.presentation,status:e.status,items:t.internal.listbox.visibleData()?.list??sm}}var Ut=Oa(),am={open:[],mounted:[],value:[],query:[],initial:[],items:[],status:[],listed:[],labeled:[],inline:[],disabled:[],formDisabled:[],readOnly:[],required:[],name:[],form:[],mounts:[],settled:[],groupLabels:[],fieldName:[],presentation:[],trigger:[],payload:[],titled:[],described:[],modal:[]},Uc=(e)=>({label:e({attrs:(t,{id:n})=>({id:`${n}-label`,for:`${n}-input`,...Sn(t)}),press({api:t,el:n}){if(n instanceof HTMLLabelElement&&n.control)return;t.focus()},bind:(t,{store:n})=>bn(n,"labeled")}),input:e({...Ut,keys:(t)=>[...Ut.keys,"Enter","Escape","Tab",...t.inline?["ArrowRight","End"]:[]],state:Ko,attrs:(t,n)=>({...Ut.attrs(t,n),name:t.name,form:t.form,"aria-autocomplete":t.inline?"both":"list","aria-controls":t.mounted?Bo(t,n.id):void 0,"aria-labelledby":t.labeled?`${n.id}-label`:void 0,required:t.required?"":void 0,readonly:t.readOnly?"":void 0,disabled:t.disabled?"":void 0,...ot(t.open),...Sn(t)}),on:{...Ut.on,focusin(t,{api:n,store:r}){if(n.internal.options().openOnFocus&&!r.get().open)n.internal.show({event:t,by:"keyboard",reason:"trigger-focus"})},focusout(t,{api:n,store:r}){let o=t.relatedTarget;if(!r.get().open)return;if(!o&&r.get().presentation==="sheet")return;if(o&&(n.internal.ownsElement(o)||n.internal.contentElement()?.contains(o)))return;if(!o&&!document.hasFocus())return;n.internal.hide({reason:"focus-out",event:t})}},press({api:t,store:n},r){if(n.get().open||!t.internal.options().openOnFocus)return;t.internal.show({event:r,by:hl(r),reason:"trigger-press"})},bind(t,n){let{api:r,id:o}=n,s=t;if(se)Ds(t,"The field has no accessible name. Add an AutocompleteLabel, a Field label or an aria-label.",{component:"autocomplete",id:o});let a=[Ut.bind(t,n),r.internal.bindReset(s),Bi(s,r.internal.setFormDisabled),vc(t,{store:n.store,presentation:r.internal.presentation,open:(i)=>r.internal.show({event:i,by:"touch",reason:"trigger-press"})})];return()=>a.forEach((i)=>i())}}),trigger:e({state:Ko,attrs:(t,{id:n})=>({type:"button",tabindex:"-1","aria-expanded":String(t.open),"aria-controls":t.mounted?Bo(t,n):void 0,disabled:Me(t)?"":void 0,...ot(t.open),...Sn(t)}),on:Ze,press({api:t,store:n},r){if(t.internal.inputElement()?.focus({preventScroll:!0}),n.get().open)t.internal.hide({reason:"trigger-press",event:r});else t.internal.show({event:r,by:"pointer",reason:"trigger-press"})}}),clear:e({props:{keepMounted:"boolean"},present:(t,{props:n})=>!!n.keepMounted||t.value!==""&&!xn(t),state:(t)=>({disabled:xn(t)}),attrs:(t)=>({type:"button",tabindex:"-1",disabled:Me(t)?"":void 0,"data-disabled":xn(t)?"":void 0}),on:Ze,press({api:t}){t.clear({reason:"clear-press"}),t.internal.inputElement()?.focus({preventScroll:!0})}}),content:e({...Vc(),state:Yc}),viewport:e({present:(t)=>t.presentation==="sheet"}),header:e({present:(t)=>t.presentation==="sheet"&&t.open}),list:e({...qc(),state:Yc}),item:e({...Ta(),selects:fa({highlighted:({key:t})=>[t],listing:({key:t})=>[t],...am}),state:(t,{key:n,props:r})=>({highlighted:t.highlighted===n,disabled:!!r.disabled})}),"item-text":e(ta()),"item-icon":e(_c({component:"autocomplete",...zc})),group:e(Fs()),"group-label":e(Ws()),separator:e(Rs()),empty:e($s()),status:e(Ns()),arrow:e(js())});var lm=["escape-key","outside-press","focus-out","window-blur","back","swipe"];function Xc(e){return lm.includes(e)}var cm=new Set(["image-load","image-error","imperative","item-removed","unmount","reset","restore","timeout","resize","page-hide"]),Xe;function _o(e,t){if(Xe==="agent")return Xe;if(cm.has(e))return"programmatic";if(t){let n=t();return n==="programmatic"&&Xe?Xe:n}return Xe??"programmatic"}function Xt(e,t){let n=Xe;Xe=e;try{return t()}finally{Xe=n}}function zo(e,t,n=!0){if(!n)return{...e,source:t};let r=!1;return{...e,source:t,cancel:()=>{r=!0},get canceled(){return r}}}var um=(e)=>`${e[0].toUpperCase()}${e.slice(1)}`,Gc=(e,t)=>`on${um(e)}${t}`;var Qt={},Gt=new Set,dm=new WeakMap;function Qc(e,t,n){let r,o,s=()=>{if(r?.(),r=void 0,o)Gt.delete(o);o=void 0};wt(()=>{if(Qt.add)r=Qt.add(e,t,n);else if(typeof document<"u"){if(Gt.add(o=new WeakRef(e)),dm.set(e,()=>r=Qt.add?.(e,t,n)),Gt.size%1000===0){for(let a of Gt)if(!a.deref())Gt.delete(a)}}return s})}function fm(e,t,n,r,o){if(se&&e.options().debug)console.debug(`[ui-sdk] ${e.label}#${e.id} ${t}: ${String(n)} (${r}, ${o})`)}function Jc(e,t){let{store:n,options:r}=e,o=new Map,s=new Map,a=new Map;if(e.onOptions((i,l)=>{if(se)Oi(o,i);if(!l)return;let c;for(let[d,h]of o){if(!(d in l))continue;if(we(l[d],h.value))c=h.source;o.delete(d)}return c}),se)e.onDestroy(()=>Pi(o));return(i,l,c)=>{if(a.has(i)&&we(a.get(i),l))return!1;let d=(s.get(i)??0)+1;s.set(i,d);let h=n.get()[i];if(we(h,l))return!1;let{reason:u,event:v}=c,x=zo(c,c.source??t(u,v));if(se)Li(u,v,{component:e.label,id:e.id});fm(e,i,l,u,x.source);let w=r(),k=w[i]!==void 0,A=a.has(i),W=a.get(i);a.set(i,l);try{Xt(x.source,()=>{let M=Gc(i,"Change"),I=w[M];if(typeof I==="function"){let q=se&&!!v?.defaultPrevented;if(I(l,x),se)Ii(M,q,x,{component:e.label,id:e.id})}let N=s.get(i)!==d;if(!x.canceled&&!k&&!N)n.set({[i]:l})})}finally{if(A)a.set(i,W);else a.delete(i)}if(se)Le({type:"change",component:e.label,id:e.id,key:i,value:l,reason:u,source:x.source,canceled:x.canceled,controlled:k});if(x.canceled)return!1;if(Qt.change?.(e.id,i,l,x,h),k){if(o.set(i,{value:l,source:x.source}),se)Mi(o,{component:e.label,id:e.id,key:i,value:l,reason:u,source:x.source},()=>r()[i])}return!0}}var or=(e,t)=>_o(e,t&&(()=>He(t)));function pm(){return En(),or}function ir(e,t=pm()){return Jc(e,t)}var mm=new WeakSet,Yo=(e)=>(mm.add(e),e);function Zc(e,t){return Yo(Promise.resolve({reason:e,source:or(e,t)}))}function eu(e){let{popup:t,store:n,rules:r={}}=e,o="imperative",s="trigger-press",a,i,l;t.observe((w)=>{let k=w?void 0:i??{reason:"imperative",source:"programmatic"};if(i=void 0,!k)return;return a?.resolve(k),a=void 0,k}),e.onDestroy(()=>{a?.resolve({reason:"unmount",source:"programmatic"}),a=void 0});function c(w){if(!a){let k;a={promise:Yo(new Promise((W)=>k=W)),resolve:k}}if(w&&!w.aborted){let k=()=>t.requestClose("imperative");w.addEventListener("abort",k,{once:!0}),a.promise.then(()=>w.removeEventListener("abort",k))}return a.promise}function d(w={},k){return h(w,k).result}function h(w,k){let{event:A,signal:W}=w;if(W?.aborted)return{opened:!1,result:Zc("imperative")};let M=w.reason??(A?"trigger-press":"imperative"),I=k??M,N={...w,reason:I,payloadReason:M},q=!1,Q=(L=w.by??"imperative")=>{l=w.anchor;let R=e.payload?.opening(w.trigger,w.payload,{reason:M,event:A});if(t.opening(L,A),q=e.change(!0,{reason:I,event:A}),!q)R?.();return q};if(n.get().open){if(t.opener()==="hover"&&w.by!=="hover")t.opening(w.by??"imperative",A);if(w.trigger===void 0&&e.payload?.reopening(w,{reason:M})&&w.anchor)l=w.anchor;return r.reopen?.(N,Q),{opened:q,result:c(W)}}if(r.open)r.open(N,Q);else Q();return{opened:q,result:q?c(W):Zc(I,A)}}function u(w={}){if(!n.get().open)return!1;let{event:k,returnValue:A}=w,W=w.reason??"imperative";if(e.dismissal&&!e.dismissal.allows(W,k))return!1;let M=!1,I=()=>{i={reason:W,source:or(W,k),returnValue:A},t.returnFocus(w.focus??e.returnFocus??!0);let N=e.change(!1,{reason:W,event:k,...A!==void 0&&{returnValue:A}});if(!N)t.returnFocus(!0),i=void 0;return M=N,N};if(r.close)r.close({...w,reason:W},I);else I();return M}function v({trigger:w,payload:k,anchor:A,reason:W,event:M}){l=A,e.payload?.handOver(w,k,{reason:W,event:M})}let x=(w,k)=>h({reason:"imperative",event:k},w).opened;return{api:{isOpen:()=>n.get().open,setOpen:(w,{reason:k,event:A}={})=>w?x(k,A):u({reason:k,event:A}),open:(w={})=>d({...w,reason:w.reason??"imperative"}),close:({reason:w,event:k,returnValue:A}={})=>u({reason:w,event:k,returnValue:A}),toggle:({reason:w,event:k}={})=>n.get().open?u({reason:w,event:k}):x(w,k)},show:d,attempt:h,hide:u,takeOver:v,result:c,anchor:()=>l}}function tu(e,t){let n=e,{store:r,element:o,options:s}=n,{preset:a}=t,i=t.slot??"content",l=t.trigger??"trigger",c=ir(n),d=(p)=>p!==void 0&&n.props(i,p)||_e(n,i)[0]?.props||n.props(i)||{},h=()=>{if(A?.trigger)return A.trigger();let p=r.get().trigger;return p!==null&&o(l,p)||o(l)},u=null,v,x=()=>{let p=r.get().trigger;if(A?.trigger||p===null||p===u)return h();let b=v??_e(n,l).length<=1;return o(l,p)??(b?o(l):void 0)},w=r.get().open;r.subscribe(()=>{let{open:p,trigger:b}=r.get();if(p===w)return;if(w=p,!p)return;u=b!==null&&!o(l,b)?b:null,v=_e(n,l).length<=1});let k={label:n.label,role:t.role??a.role,store:r,options:s,onOptions:n.onOptions,onDestroy:n.onDestroy,element:o,parts:n.parts,preset:a,get popup(){return Z},get control(){return ne},triggerElement:h,triggerSlot:l,triggerDisabled:(p)=>!!n.props(l,p)?.disabled,contentProps:d},A=k.rules=t.rules?.(k),W=a.dismissal?.(s,A),M=a.presentation?.(k,W),I=a.press?.(k),N=a.group?.(k),q=a.hover?.(k,N),Q=a.focus?.(k),L=a.triggerName?.(k);a.resetStyles?.prepare(n.label,i),a.placement?.prepare();function R(p,b){if(a.modal===void 0)return;return{modal:p.modal??(b.presentation==="sheet"?!0:a.modal)}}function V(){let p=R(s(),r.get());if(p)r.set(p)}function z(p,b){if(A?.dismiss)A.dismiss(p,b);else ne.hide({reason:p,...b})}let Z=bl({...t.behavior,preset:a.behavior,position:a.placement?.position,owner:{component:n.label,id:n.id},store:r,trigger:h,returnTrigger:x,contains:(p,b)=>A?.contains?A.contains(p,b):!!h()?.contains(p)||!!I?.contains(p,b),close:z,modal:()=>A?.modal?.()??ml(r.get().modal),parent:()=>A?.parent?.(),persistent:()=>A?.persistent?.()??[],finalFocus:()=>d().finalFocus,onEscape:(p)=>A?.onEscape?A.onEscape(p):z("escape-key",{event:p,focus:!0}),onShow:(p)=>A?.onShow?.(p),onOpenChange(p,b){if(A?.onOpenChange?.(p,b),N?.change(p),p){M?.open(),V();return}q?.clear(),Q?.clear()},onOpenChangeComplete(p,b){A?.onOpenChangeComplete?.(p,b),s().onOpenChangeComplete?.(p)}}),ne=eu({dismissal:W,popup:Z,store:r,payload:a.payload?.(r,(p,b)=>c("payload",p,b)),change:(p,b)=>c("open",p,{...b,...A?.details?.()}),onDestroy:n.onDestroy,get returnFocus(){return A?.returnFocus},rules:{open(p,b){if(q?.clear(),N?.opening(p.event),A?.open)A.open(p,b);else b()},reopen(p){if(q?.clear(),A?.reopen)return A.reopen(p);let{trigger:b,payload:C,payloadReason:K,event:_}=p;if(b!==void 0&&b!==r.get().trigger)ne.takeOver({trigger:b,payload:C,reason:K,event:_})},close:(p,b)=>A?.close?A.close(p,b):b()}});V(),nt(n,["modal"],(p,b,C)=>R(C,{...b,...p}));let re=r.get().modal;r.subscribe(()=>{let{modal:p}=r.get();if(p===re)return;re=p,Z.updateModal()});let ee={dismissal:W,presentation:M,press:I,group:N,hover:q,focus:Q,triggerName:L,rules:A};return{...{...ne.api,getPayload:()=>r.get().payload,focus:()=>h()?.focus()},internal:Object.assign(k,ee)}}function nu(e){let t=e.open??e.defaultOpen??!1;return{open:t,mounted:t,trigger:null,payload:void 0,titled:null,described:!1,modal:!1,presentation:"popover"}}function ru(e,t={}){let n=()=>e().dismissible!==!1,r=(o,s)=>e().onDismissAttempt?.({reason:o,event:s});return{allows(o,s){let a=t.refusal?.(o)??(Xc(o)&&!n()?"attempt":void 0);if(!a)return!0;if(a==="attempt"&&o!=="focus-out"&&o!=="window-blur")r(o,s),t.refused?.(o);return!1},sheet:{dismissible:n,onDismissAttempt:(o)=>r("swipe",o)}}}function hm(e,t){let n=e.preset.behavior==="dialog";if(n)e.store.set({presentation:"dialog"});return bc(e.store,()=>e.popup,()=>e.rules?.presentation?e.rules.presentation():e.options().presentation,n?"dialog":"popover",t)}var ou={behavior:"combobox",modal:!1,dismissal:ru,placement:jc,presentation:hm};Se();var gm=["input","trigger","clear","label"];function iu(e){let t=e.value??e.defaultValue??"";return{...nu(e),value:t,query:t,initial:e.defaultValue??"",highlighted:null,items:e.items,status:e.status??"idle",listed:!1,labeled:!1,fieldName:null,inline:!!e.inlineComplete,disabled:!!e.disabled,formDisabled:!1,readOnly:!!e.readOnly,required:!!e.required,name:e.name,form:e.form,mounts:0,settled:!1,focusInList:!1,groupLabels:[],presentation:"popover",listing:Ss}}function su(e){return{items:e.items,status:e.status??"idle",inline:!!e.inlineComplete,disabled:!!e.disabled,readOnly:!!e.readOnly,required:!!e.required,name:e.name,form:e.form,...e.defaultValue===void 0?{}:{initial:e.defaultValue},...e.open===void 0?{}:{open:e.open},...e.value===void 0?{}:{value:e.value}}}function bm(e){let{id:t,store:n,options:r,element:o}=e;bo(e,["highlighted","focusInList"],(p)=>p?void 0:{highlighted:null,focusInList:!1});let s=ir(e),a=n.get().value,i="imperative",l=null,c=()=>o("input"),d=()=>W.element()??o("content"),h=()=>{let p=n.get();return!Me(p)&&!p.readOnly},u=()=>!!r().inlineComplete;function v(p,b){let C=Pe(p);if(!C)return;return b.entries().find((K)=>!b.disabled(K)&&Pe(K.label).startsWith(C))}let x=Pa(e,{query:()=>n.get().query,items:()=>n.get().items,emptyItems:()=>r().emptyItems,filter:()=>r().filter??"contains",autoHighlight:()=>r().autoHighlight||u()?"typing":!1,preferred:(p)=>u()?v(n.get().query,p)?.key:void 0,highlight(p,b){if(x.listbox.highlight(p,{event:b?.event}),p!==null&&u()&&b?.reason==="list-navigation")L(p,b.event)},open(p,b){if(!p.altKey)l=b;I({event:p,by:"keyboard"})},onHighlight:(p,b,C)=>r().onHighlight?.(p,{index:b,event:C}),container:()=>o("list")??d(),scrollRoot:d});nt(e,["highlighted"],(p,b)=>{if(p.items===b.items)return;return{highlighted:n.view({...b,...p},()=>x.settledHighlight(!1))}});let w=(p)=>gm.some((b)=>_e(e,b).some(({el:C})=>C.contains(p))),k=tu(e,{preset:ou,rules:()=>({trigger:c,returnFocus:!1,dismiss:(p,{event:b})=>N({reason:p,event:b}),contains:w,onOpenChange(p){if(p)return;l=null,n.set({highlighted:null,focusInList:!1})},onShow(){let p=o("content");if(p)return Zs(p,Js(i),()=>[c()])},open({event:p,by:b},C){if(!h())return;i=b==="touch"&&M.resolve()!=="sheet"?"pointer":b??"imperative",n.set({focusInList:na(p)&&p?.target!==c()}),C(i)},close(p,b){let C=n.get().focusInList&&!!d()?.contains(document.activeElement);b();let K=c();if(C&&K&&!n.get().open)Cn(K)}})}),{control:A,popup:W}=k.internal,M=k.internal.presentation,{show:I,hide:N}=A;function q(p,b,{event:C,query:K=p,item:_}={}){let U=n.get();if((Me(U)||U.readOnly)&&b!=="reset")return!1;if(a=p,x.cause(b,C),p===U.value||s("value",p,{reason:b,event:C,..._&&{item:_}})){if(a===p)n.set({query:K});return!0}let oe=c();if(oe&&oe.value!==U.value)oe.value=U.value;return!1}function Q(p,b){if(!h())return;let C=p.value,K=b,U=u()&&!K?.isComposing&&!!K?.inputType?.startsWith("insert")&&K.inputType!=="insertReplacementText"&&p.selectionEnd===C.length?v(C,x.listbox):void 0,oe=U?C+U.label.slice(C.length):C;if(!q(oe,"input-change",{event:b,query:C}))return;if(U&&oe!==C)p.value=oe,p.setSelectionRange(C.length,oe.length);if(!n.get().open&&(b||p.matches(":focus"))){if(C)l="first";I({event:b,by:"keyboard",reason:"input-change"})}}function L(p,b){let C=x.listbox.find(p)?.label,K=c(),{query:_}=n.get();if(C===void 0||!q(C,"list-navigation",{event:b,query:_}))return;if(!K)return;K.value=C;let U=Pe(C).startsWith(Pe(_))?_.length:C.length;K.setSelectionRange(U,C.length)}function R(p){return r().onSubmit?.(n.get().value,{event:p}),!p?.defaultPrevented}function V(p,b){let C=x.listbox.find(p);if(!C||x.listbox.disabled(C)||!h())return!1;q(C.label,"item-press",{event:b,item:{value:C.key,label:C.label}});let K=c();if(K&&K.value!==n.get().value)K.value=n.get().value;return N({reason:"item-press",event:b}),!0}function z(p,b){if(!V(p,b)||!r().submitOnSelect)return;if(R(b))Ki(c()?.form)}function Z(p){let{open:b,highlighted:C}=n.get();if(b&&C!==null){let K=x.listbox.element(C);if(K?.matches("a[href]"))return p.preventDefault(),K.click();if(!V(C,p))return p.preventDefault();if(!r().submitOnSelect||!R(p))p.preventDefault();return}if(b)N({reason:"input-commit",event:p});if(!R(p))p.preventDefault()}function ne(p){if(x.navigate(p))return;let{open:b,value:C,query:K}=n.get();switch(p.key){case"ArrowUp":if(p.altKey&&b)p.preventDefault(),N({reason:"escape-key",event:p});return;case"ArrowDown":if(p.altKey&&!b)p.preventDefault(),I({event:p,by:"keyboard"});return;case"Enter":return Z(p);case"ArrowRight":case"End":if(u()&&C!==K&&!p.shiftKey)x.cause("input-change",p),n.set({query:C});return;case"Escape":if(b&&C!==K&&q(K,"escape-key",{event:p})){let _=c();if(_)_.value=K}return;case"Tab":if(b)N({reason:"focus-out",event:p})}}function re(p){return J(p.ownerDocument,"reset",(b)=>{if(b.target!==p.form||Vi(r().value,r().defaultValue))return;ji(b,()=>{let{initial:C}=n.get();if(q(C,"reset"),p.value!==n.get().value)p.value=n.get().value})},{capture:!0})}let ee={id:t,isOpen:k.isOpen,setOpen:k.setOpen,open:k.open,close:k.close,toggle:k.toggle,getValue:()=>n.get().value,setValue:(p,{reason:b="imperative",event:C}={})=>p!==n.get().value&&q(p,b,{event:C}),clear:({reason:p="imperative",event:b}={})=>n.get().value!==""&&q("",p,{event:b}),getHighlighted:()=>Ir(x.listbox,n.get().highlighted),highlight:(p)=>n.get().open&&Lr(x.listbox,p===null?null:String(p),n.get().highlighted),focus:()=>c()?.focus(),internal:{...x,options:r,popup:W,presentation:M,show:I,hide:N,press:z,typed:Q,onInputKeyDown:ne,ownsElement:w,bindReset:re,inputElement:c,anchorElement:c,contentElement:d,arrowElement:()=>o("arrow"),text:(p)=>p.value,itemProps:(p)=>e.props("item",p),setFormDisabled:(p)=>n.set({formDisabled:p}),initialFocus(){let p=l;if(l=null,n.get().focusInList){let b=x.listbox.firstEnabled();if(b===void 0)return d();return x.listbox.highlight(b,{focus:!1}),x.listbox.element(b)??d()}if(p==="first"&&n.get().query)x.settle(!0,null);else if(p)x.listbox.highlight(x.listbox.stepKey(p)??null);return n.get().presentation==="sheet"?c():void 0},onListKeyDown(p){if(!n.get().focusInList||p.target===c())return;ms(p,{listbox:x.listbox,highlighted:n.get().highlighted,choose:z,focusInput(){n.set({focusInList:!1}),c()?.focus({preventScroll:!0})}})},contentProps:(p)=>k.internal.contentProps(p)}};nt(e,["query"],(p,b)=>("value"in p)&&p.value!==b.value&&p.value!==a?{query:p.value}:void 0);let E=n.get().value;return n.subscribe(()=>{let{value:p}=n.get();if(p===E)return;if(E=p,p===a)return;a=p,n.set({query:p})}),ee}var au=bm;function lu(e){if(e===null)return;if(e==="false")return!1;if(e==="pointer")return"pointer";return!0}function uu(e){let t=e.slots((a)=>a),n=e.name,r=e.label??n;if(se)Ai(t,{component:r});let o=(a)=>{let i=a,l=a.id,c=vs({...e.state(i),...e.sync?.(i)},e.live??[]),d=[],h=[],u={component:r,id:l},v=se?(e.controlled??["open","value","checked"]).filter((E)=>(E in c.get())):[];if(se)wr(u,v,i);let x=Object.create(se?ki(t,u):t),w=new Set;function k(E){if(w.has(E))return;w.add(E),Object.assign(x,E.slots),V(),E.extend?.(L)}let A={name:n,label:r,slots:x,parts:new Map,released:[]},{parts:W}=A;function M(E={}){return E.id??(E.value==null?"":String(E.value))}let I;function N(E,p={},b=!1){let C=M(p),K=`${E}:${C}`,_=W.get(K);if(!_){if(W.set(K,_={slot:E,key:C,id:l,get api(){return L},store:c,props:p,el:void 0,owner:A,leases:0}),b)ba(_)}else if(b)return _;return _.props=p,xa(_),_}function q(E,p){if(p===void 0){for(let C of W.values())if(C.slot===E&&C.el?.isConnected)return C.el;return}let b=W.get(`${E}:${p}`)?.el;return b?.isConnected?b:void 0}let Q={id:l,label:r,store:c,options:()=>i,onOptions:(E)=>h.push(E),onDestroy:(E)=>d.push(E),parts:()=>W.values(),element:q,props:(E,p="")=>{let b=I?.[E];return b&&M(b)===p?b:W.get(`${E}:${p}`)?.props}},L=void 0;function R(){if(L=e.api(Q),Va(Q,L),se){for(let E of e.agent?.actions??[])if(typeof L[E]!=="function")me(`lists \`${E}\` in \`agent.actions\`, but its api has no such method.`,u)}}function V(){let{sleeping:E}=A;if(!E)return;A.sleeping=void 0,Ra(ee,R);for(let p of[...E.binds])p()}if(e.asleep?.(i))A.sleeping={wake:V,binds:new Set};else R();let z=!1,Z=!1,ne=!1,re=(E,p)=>bs(c,E,e.sync?.(E),p),ee={types:void 0,name:n,id:l,get:c.get,subscribe:c.subscribe,get api(){return V(),L},part:N,use:k,preview(E){let p=re({...E,id:l},c.get()),b=c.get();for(let C in p)if(!we(b[C],p[C]))return{...b,...p}},view(E,p,b){let C=I;I=b;try{return c.view(E,p)}finally{I=C}},setOptions(E){let p=Ft(c),b=E.id===l?E:{...E,id:l},C=se&&Z?re(b,p):void 0;if(i=b,se)wr(u,v,i);if(A.sleeping&&!e.asleep(i))V();let K=re(i,p);if(se&&C){let U=ym(C,K);if(U.length)Le({type:"relay",...u,keys:U})}let _;z=!0;try{for(let oe of h)_=oe(i,K)??_;let U=Ft(c)===p?K:re(i,Ft(c));if(U)Xt(_,()=>c.set(U,!0))}finally{z=!1}},startState:(E)=>e.state({...E,id:l}),follow(E){Z=!0;let p,b,C=(K=Ft(c),_)=>{if(_)return re({..._,id:l},K);if(ne)return b;let U=E();if(p?.options!==U||p.state!==K)p={options:U,state:K},b=re({...U,id:l},K);return b};if(c.follow(C),se)c.subscribe((K,_,U)=>{if(z&&!_&&!Di())Le({type:"relay",...u,keys:[...U]})});return C},destroy(){if(ne)return;if(ne=!0,Na(ee),Ia(()=>d.forEach((E)=>E())),se)Le({type:"instance",action:"destroy",...u,controlled:v})}};if(ws(ee,c),Qc(ee,W,e),se)Le({type:"instance",action:"create",...u,controlled:v});return ee},s=(a)=>Fa(()=>o(a));return Object.defineProperty(s,"name",{value:n}),Object.assign(s,{options:e.options,slots:t})}function ym(e,t){let n=e,r=t??{};return[...new Set([...Object.keys(n),...Object.keys(r)])].filter((s)=>!we(n[s],r[s]))}var cu=new WeakMap;function Uo(e){let t=cu.get(e);if(!t){let{options:n,slots:r={}}=e;t={options:{debug:"boolean",...n},slots:Object.fromEntries(Object.entries(r).map(([o,s])=>[o,s.props??{}]))},cu.set(e,t)}return t}var Jt=(e)=>hn(e);var vm=uu({name:"autocomplete",options:{container:"value",value:"string",defaultValue:"string",onValueChange:"callback",open:"boolean",defaultOpen:"boolean",onOpenChange:"callback",onOpenChangeComplete:"callback",onSubmit:"callback",items:"value",emptyItems:"value",filter:fs(["contains","startsWith","fuzzy"],"contains"),inlineComplete:"boolean",autoHighlight:"boolean",openOnFocus:"boolean",submitOnSelect:"boolean",status:"string",onHighlight:"callback",onLoadMore:"callback",announcement:"value",loop:"boolean",modal:lu,presentation:"string",disabled:"boolean",readOnly:"boolean",required:"boolean",name:"string",form:"string",controller:"value",dismissible:"boolean",onDismissAttempt:"callback"},state:iu,live:["highlighted"],controlled:["open","value"],sync:su,api:au,slots:(e)=>Uc(e),agent:{actions:["setOpen","setValue","clear"]}}),du=vm;var Xo=new WeakMap,fu=new WeakMap;function Mt(e,t,...n){if(t==="customValidity")fu.set(e,n[0]);let r=Xo.get(e)?.[t];return r?.(...n),!!r}function Go(e,t,n){let r="",o=()=>{let c=n.value();if(c instanceof FormData)t.setFormValue(c,n.state());else if(Array.isArray(c)){let v=new FormData,x=n.name?.();if(x)for(let w of c)v.append(x,w);t.setFormValue(v,n.state())}else t.setFormValue(c,n.state());let d=n.valueMissing(),h=fu.get(e),u=n.invalid?.();if(h)t.setValidity({customError:!0},h,n.anchor?.()??e);else if(u)t.setValidity(u.flags,u.message,u.anchor??n.anchor?.()??e);else if(d)t.setValidity({valueMissing:!0},n.message(),n.anchor?.()??e);else t.setValidity({});if((u?.message??"")===r)return;r=u?.message??"",Lt(e)};o();let s=n.subscribe(o),a=n.focus?qi(e,n.focus):()=>{};if(e.matches(":disabled"))n.disabled(!0);Xo.set(e,{reset:()=>{n.reset(),o()},disabled:(c)=>n.disabled(c),restore:(c)=>{if(typeof c==="string")n.restore(c)},customValidity:o});let i=_i(e,()=>on(e)),l=()=>{if(n.focus)Hi(e,t.form)};return e.addEventListener("invalid",l),()=>{e.removeEventListener("invalid",l),s(),i(),Xo.delete(e),a()}}Oe();function pu(){let e=[],t=!0;return{waitUntil:(o)=>{if(!t)throw new DOMException("waitUntil() can only be called while the event dispatches.","InvalidStateError");e.push(o)},done:()=>(t=!1,e)}}var Qo=new WeakMap,xu=0,mu=new Set;function Su(e){if(typeof customElements>"u"||mu.has(e))return!1;if(customElements.get(e))return me(`<${e}> is already defined by another library or another copy of ui-sdk. This one is skipped.`),!1;return mu.add(e),!0}function ti(e){if(!Qo.has(e))Qo.set(e,`auto-${++xu}`);return Qo.get(e)}function li(e){return e.querySelector(":scope > button, :scope > a, :scope > ui-button > button, :scope > ui-button > a")??e.firstElementChild}var ci=(e)=>(t)=>t.querySelector(`:scope > ${e}`)??t.firstElementChild;function ut(e,t){if(t)return t(e);return e.hasAttribute("as-child")?e.firstElementChild:e}var ku=(e,t)=>e.id!==t.id||e.value!==t.value,ur=(e)=>e.replace(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`),lr=["role","aria-disabled"];function Au(e,t){if(t===null)return;if(typeof e==="function")return e(t);if(e==="boolean")return t!=="false";if(e==="number"){let n=Number(t);return t.trim()===""||Number.isNaN(n)?void 0:n}if(e==="list")return t.split(",").map((n)=>n.trim()).filter(Boolean);return t}var wm=new Set(["disabled","required"]);function ui(e,t,n){let r=e.getAttribute(ur(t));if(n==="boolean"&&wm.has(t))return r===null?void 0:!0;return Au(n,r)}function Eu(e,t){let n={};for(let[r,o]of Object.entries(t)){let s=ui(e,r,o);if(s!==void 0)n[r]=s}return n}var hu=(e,t)=>typeof t==="function"?t(e):t;function Cu(e,t,n={}){for(let[r,o]of Object.entries(t)){if(r in e)continue;let s=ur(r);Object.defineProperty(e,r,{configurable:!0,get(){return ui(this,r,o)??hu(this,n[r])??(o==="boolean"?!1:void 0)},set(a){let i=a===!1&&o==="boolean"&&!hu(this,n[r]);if(a==null||i)this.removeAttribute(s);else this.setAttribute(s,a===!0?"":Array.isArray(a)?a.join(","):String(a))}})}}function Mu(e,t){for(let n of t){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=e[n];delete e[n],e[n]=r}}var Ge=new Set;function Pu(e,t,n){Ge.add(e);try{return Mt(e,"restore",t,n)}finally{Ge.delete(e)}}var dt=new Map;function ni(e){for(let t of dt.keys())if(t.contains(e))dt.delete(t)}function Ou(e,t,n){let r={};dt.set(e,r),queueMicrotask(()=>{if(dt.get(e)!==r)return;dt.delete(e),Pu(e,t,n)})}function xm(e){let t=Pt.get(e);if(Ge.has(e)||!!t&&Ge.has(t))return!0;for(let n of Ge)if(e.contains(n))return!0;return!1}function Sm(e,t){return t===void 0&&!!e&&typeof e==="object"&&"reason"in e&&!(typeof Event<"u"&&e instanceof Event)}function ri(e,t,n=[],r=[],o={}){return new Proxy(t,{get(s,a){if(a in s||typeof a!=="string"||!/^on[A-Z]/.test(a))return s[a];if(n.includes(a))return;return(i,l)=>{if(xm(e))return;let c=Sm(i,l),{cancel:d,canceled:h,...u}=(c?i:l)??{},v=c?u:{...u,value:i},x=r.includes(a)?pu():void 0;if(x)v.waitUntil=x.waitUntil;let w=new CustomEvent(o[a]??a.slice(2).toLowerCase(),{detail:v,bubbles:!1,cancelable:typeof d==="function"||typeof i?.preventDefault==="function",composed:!0}),k=e.dispatchEvent(w),A=x?.done()??[];if(!k){if(typeof d==="function")d();else if(i&&typeof i.preventDefault==="function")i.preventDefault()}return A.length>1?Promise.all(A).then((W)=>W.at(-1)):A[0]}}})}var ar=new WeakMap;function km(e){return e?ar.get(e):void 0}var Am=/^(?:get|is|can)[A-Z]|^focus$/;function Em(e,t,n){let r={};for(let o of n){let s=t[o];if(typeof s==="function")r[o]=(...a)=>{if(!Am.test(o))ni(e);return s.apply(t,a)}}return Object.freeze(r)}var Tu=new Map,Du=new Set,Jo;function Lu(){if(Jo)return Jo;let e=globalThis,t=Symbol.for("ui-sdk.web-styles@1");return e[t]=(e[t]??0)+1,Jo=`ui-sdk-web-${e[t]}`}var cr="",oi=0,gu=new WeakMap;function Iu(e,t,n=!1){if(n)Du.add(e);if(!t&&!n)return;if(t)Tu.set(e,t);cr=Fu(),xe(document,Lu(),cr),oi++}function Fu(){return["@layer ui-sdk {",' :where([data-slot][hidden]:not([hidden="until-found"])) { display: none !important }',...[...Tu].map(([e,t])=>` :where(${e}:not([hidden]), ${e}[hidden="until-found"]) { display: ${t} }`),...[...Du].map((e)=>` :where(${e}[align]) { text-align: inherit }`)," :where([as-child]) { display: contents }","}"].join(`
2
+ `)}function ii(e){let t=e.getRootNode();if(!Cm(t))return Pm(e.ownerDocument);let n=Mm(t.ownerDocument);if(!n||t.adoptedStyleSheets.includes(n))return;t.adoptedStyleSheets=[n,...t.adoptedStyleSheets]}var Cm=(e)=>e.nodeType===11&&("host"in e);function Mm(e){let t=e.defaultView;if(!t)return;let n=gu.get(e);if(!n)gu.set(e,n={sheet:new t.CSSStyleSheet,version:-1});if(n.version!==oi)n.sheet.replaceSync(Fu()),n.version=oi;return n.sheet}function Pm(e){if(cr)xe(e,Lu(),cr)}var si=new Set;function bu(e){for(let t of si)if(t!==e&&e.contains(t))t.reconfigure()}var ai=new WeakMap;var Pt=new WeakMap,Zt=new WeakMap;function Om(e,t){for(let n=e.el;n&&n!==t;n=n.parentElement){let r=Zt.get(n);if(r===e)return;if(r?.el===e.el&&en.has(r))return r}}function Tm(e){e.dataSlot=void 0;let t=[];for(let n=e.el;n;n=n.parentElement){let r=Zt.get(n);if(r&&r!==e&&r.el===e.el&&en.has(r))t.push(r)}if(!t.length)return;e.el.removeAttribute("data-slot"),jt(e.el,"data-slot");for(let n of t)n.sync?.()}var en=new WeakSet,Ru=new WeakMap,$u=(e)=>e.value!==void 0&&typeof e.value!=="string";function Dm(e,t,n){for(let r=e.parentElement;r;r=r.parentElement){let o=Zt.get(r);if(o?.slot!==t||Pt.get(r)!==n)continue;return o.keyed&&$u(o.props)?{...o.props,value:o.props.id}:o.props}}function sr(e,t){let n=e.getAttribute("for");if(n){let r=e.getRootNode(),o="getElementById"in r?r.getElementById(n):null;if(o?.matches(t))return o}for(let r=e.parentElement;r;r=r.parentElement){if(r.matches(t))return r;let o=Pt.get(r);if(o?.matches(t))return o}}function Nu(e,t){queueMicrotask(()=>{if(!e.isConnected)t()})}var Wu=new WeakMap,Lm=(e,t,n)=>(Wu.set(e,n.state),Go(e,t,n));function ju(e){return class extends e{static formAssociated=!0;#t;constructor(){super();this.#t=this.attachInternals(),Cr(this,this.#t,Lm)}get form(){return this.#t.form}get labels(){return this.#t.labels}get name(){return this.getAttribute("name")??""}set name(t){this.setAttribute("name",t)}get validity(){return this.#t.validity}get validationMessage(){return this.#t.validationMessage}get willValidate(){return this.#t.willValidate}checkValidity(){return this.#t.checkValidity()}reportValidity(){return this.#t.reportValidity()}setCustomValidity(t){if(!Mt(this,"customValidity",t))this.#t.setValidity(t?{customError:!0}:{},t)}formResetCallback(){dt.delete(this),Mt(this,"reset")}formDisabledCallback(t){Mt(this,"disabled",t)}formStateRestoreCallback(t,n){if(dt.delete(this),!Pu(this,t,n))Ou(this,t,n)}}}var Zo=(e)=>`default${e[0].toUpperCase()}${e.slice(1)}`;function Im(e,t,n){if(!Su(e))return;Iu(e,n.display);let r={debug:"boolean",...n.attributes},o=n.state??{},s=(a,i,l)=>{let c=Eu(a,r);for(let d of l)delete c[d];for(let[d,h]of Object.entries(i))if(h!==void 0)c[d]=h;for(let d of Object.keys(o)){if(!(d in c))continue;let h=Zo(d);if(!(h in c))c[h]=c[d];delete c[d]}return{...c,...n.options?.(a)}};customElements.define(e,class a extends(n.formAssociated?ju(HTMLElement):HTMLElement){static observedAttributes=[...Object.keys(r).map(ur),...lr];#t;get#e(){return ar.get(this)}get api(){if(!this.#e)return;return this.#t??=Em(this,this.#e.api,n.api??[])}#r=new Set;#n=new Set;#o=!1;#a=!1;#l=new Set;#b=new Set;#w=new Set;#u=!1;#d={};#f={};#y;static{for(let[i,{get:l,set:c}]of Object.entries(o))Object.defineProperty(a.prototype,i,{get(){if(i in this.#f)return this.#f[i];return this.#e?l(this.#e.api):void 0},set(d){if(ni(this),this.#e&&!this.#u)this.#x(()=>c(this.#e.api,d));else this.#f[i]=d}});for(let i of n.properties??[])Object.defineProperty(a.prototype,i,{get(){return this.#d[i]},set(l){if(Object.is(this.#d[i],l))return;if(this.#d[i]=l,!this.#o)return;this.#i(),this.#S()}});Cu(a.prototype,r,n.defaults)}#i(i){this.#e?.setOptions(ri(this,{...s(this,this.#d,this.#l),...i,id:this.#e.id},n.silent,n.actions,n.events))}attributeChangedCallback(i,l,c){if(jt(this,i),lr.includes(i))return;let d=i.replace(/-(\w)/g,(v,x)=>x.toUpperCase());if(d in o&&c!==l&&!this.#a)ni(this);if(!this.#a||c===null)this.#l.delete(d);else if(l===null)this.#l.add(d);if(!this.#o)return;if(this.#i(),bu(this),!(d in o)||c===l)return;let h=r[d],u=h==="boolean"?!1:h==="list"?[]:null;this.#x(()=>o[d].set(this.#e.api,c===null?u:Au(h,c)))}#x(i){let l=Ge.has(this);Ge.add(this);try{kr(this,i)}finally{if(!l)Ge.delete(this),Lt(this)}}connectedCallback(){if(ii(this),this.#o){for(let h of this.#r)Mr(h.el);if(n.options)this.#i();return}Mu(this,[...Object.keys(o),...n.properties??[],...Object.keys(r)]);for(let[h,u]of Object.entries(n.host??{}))if(!this.hasAttribute(h))this.setAttribute(h,u);let i=this.#u&&!Object.keys(this.#f).length?this.#y:void 0,l={};if(this.#u&&i===void 0)for(let[h,{get:u}]of Object.entries(o))l[h]=u(this.#e.api);Object.assign(l,this.#f),this.#f={};let c=Object.fromEntries(Object.entries(l).map(([h,u])=>[Zo(h),u]));if(this.#u)ar.delete(this),this.#t=void 0,this.#u=!1,this.#y=void 0;let d=this.#e;if(d)this.#i();else d=t(ri(this,{...s(this,this.#d,this.#l),...c,id:this.id||`ui-sdk-${e.replace(/^ui-/,"")}-${++xu}`},n.silent,n.actions,n.events)),ar.set(this,d);if(n.formAssociated&&Object.keys(l).length){let h=d.startState(s(this,this.#d,this.#l));this.#i(Object.fromEntries(Object.keys(l).map((u)=>[Zo(u),h[u]])))}if(this.#o=!0,n.options)si.add(this);if(n.self){let h=ut(this,n.target);if(h)this.#k(h);else me(`<${e}> needs an element inside it.`)}for(let[h,u]of Object.entries(n.children??{})){let v=u(this);if(v)this.#A(h,v);else if(!n.optionalChildren?.includes(h))me(`<${e}> needs its native element inside it for "${h}".`)}if(n.children||n.target)this.#g=new MutationObserver(()=>{this.#T(),this.#O()}),this.#g.observe(this,{childList:!0});if(this.#S(),this.id){let h=this.getRootNode();for(let u of h.querySelectorAll(`[for="${CSS.escape(this.id)}"]`))Ru.get(u)?.()}if(i!==void 0)Ou(this,i,"restore")}#m;#S(){this.#m?.(),this.#m=n.render?.(this,this.#e)||void 0}reconfigure(){if(this.#o)this.#i()}#h=new Map;#g;#c;#k(i){this.#c={slot:n.self,el:i,props:{}},this.register(this.#c)}#O(){if(!n.self||!n.target)return;let i=ut(this,n.target);if(i===this.#c?.el)return;if(this.#c)this.unregister(this.#c);if(this.#c=void 0,this.#i(),i)this.#k(i)}#A(i,l){let c={slot:i,el:l,props:n.childProps?.read?.(l)??{}};if(n.childProps)c.observer=new MutationObserver(()=>{c.props=n.childProps.read?.(l)??{},this.#i(),this.update(c,!1)}),c.observer.observe(l,{attributeFilter:n.childProps.attributes});this.#h.set(i,c),this.register(c)}#T(){for(let[i,l]of Object.entries(n.children??{})){let c=l(this),d=this.#h.get(i);if(d?.el===c)continue;if(d)this.unregister(d),this.#h.delete(i);if(c)this.#A(i,c)}}disconnectedCallback(){Nu(this,()=>{this.#y=Wu.get(this)?.(),this.#m?.(),this.#m=void 0,this.#g?.disconnect(),this.#g=void 0,this.#h.clear(),this.#c=void 0,this.#o=!1,si.delete(this);for(let i of this.#r)this.unregister(i);this.#e?.destroy(),this.#u=!0})}register(i){if(this.#r.add(i),en.add(i),i.sync=()=>this.#n.has(i)||this.#s(i),!this.#n.size)queueMicrotask(()=>this.#D());this.#n.add(i)}#D(){let i=et([...this.#n]);this.#n.clear();for(let l of i){if(!this.#r.has(l))continue;if(l.reread)l.props=l.reread();if(l.feature)this.#e.use(l.feature);this.#E(l),this.#s(l)}}#E(i){let l=this.#e;i.unwatch?.();let c=l.part(i.slot,i.props);i.record=c,i.selected=Dn(c),i.version=Jt(l),i.unwatch=yt(c,(d)=>{if(Tn(c)!==i.shown)return i.version=Jt(l),this.#s(i);if(d)return;let h=Jt(l);if(h===i.version)return;i.version=h,this.#s(i)})}unregister(i){i.unwatch?.(),i.unwatch=void 0,i.observer?.disconnect(),i.observer=void 0,this.#p(i),ao(i.el,this.#P),i.disconnect?.(),i.disconnect=void 0,this.#v(i),this.#r.delete(i),en.delete(i),this.#n.delete(i),Tm(i)}rebind(){let i=et([...this.#r].filter((l)=>!this.#n.has(l)));for(let l of i)this.#p(l);for(let l of i)this.#s(l)}update(i,l){if(this.#n.has(i))return;this.#C(i,l),this.#s(i);for(let c of this.#r){if(c===i||this.#n.has(c))continue;if(c.reread){let d=c.props;c.props=c.reread(),this.#C(c,ku(d,c.props))}this.#s(c)}bu(i.el)}#C(i,l){if(l)this.#p(i);let c=this.#e.part(i.slot,i.props);if(c!==i.record||Dn(c)!==i.selected)this.#E(i)}#s(i){if(this.#b.has(i))return void this.#w.add(i);ii(i.el);let c=this.#e.part(i.slot,i.props);if(i.disconnect??=oo(c,i.el),i.shown=Tn(c),i.shown){let d=this.#I(i);if(d!==void 0&&this.#F(i,d))this.#p(i),this.#R(i,d);let h=Be(c);if(h.hidden===void 0&&(no(c)||("hidden"in h)))i.el.removeAttribute("hidden");if(this.#M(i,h),!i.unbind)this.#L(i,c)}else{if(i.unbind)this.#M(i,Be(c)),this.#p(i);if(!i.el.hasAttribute("hidden"))i.el.setAttribute("hidden","");let d=Be(c)["data-slot"];if(d&&!i.el.hasAttribute("data-slot"))i.el.setAttribute("data-slot",d);this.#v(i)}}#L(i,l){let c,d=!1;if(i.unbind=()=>{d=!0,c?.()},c=ro(l,i.el),d)c()}#p(i){let l=i.unbind;i.unbind=void 0,l?.()}#I(i){if(!n.portal?.slots.includes(i.slot))return;return Pr(n.portal.container(this,i))}#F(i,l){return l?i.el.parentNode!==l:!!i.placeholder}#R(i,l){if(this.#v(i),!l)return;i.placeholder=document.createComment(`${e} ${i.slot}`),i.el.replaceWith(i.placeholder),l.appendChild(i.el),ai.set(i.el,l)}#M(i,l){let c=Om(i,this);if(c?.dataSlot)l={...l,"data-slot":c.dataSlot};i.dataSlot=l["data-slot"];let d=this.#a;this.#a=i.el===this,this.#b.add(i);try{Wt(i.el,l,this.#P)}finally{this.#a=d,this.#b.delete(i)}if(this.#w.delete(i))this.#s(i)}get#P(){return`render:${ti(this)}`}#v(i){if(!i.placeholder)return;i.placeholder.replaceWith(i.el),i.placeholder=void 0,ai.delete(i.el)}})}function Fm(e,t){if(!Su(e))return;let n=t.props??{};Iu(e,t.display,"align"in n),customElements.define(e,class r extends(t.formAssociated?ju(HTMLElement):HTMLElement){static observedAttributes=[...Object.keys(n).map(ur),"for",...lr];#t;#e;#r={};constructor(){super();Ru.set(this,()=>{if(this.isConnected)this.connectedCallback()})}static{for(let o of t.properties??[])Object.defineProperty(r.prototype,o,{get(){return this.#r[o]??(n[o]&&ui(this,o,n[o]))},set(s){this.#r[o]=s,this.attributeChangedCallback("")}});Cu(r.prototype,n,t.defaults)}#n(){let o={...t.context?.(this),...Eu(this,n)};for(let s of t.properties??[])if(this.#r[s]!==void 0)o[s]=this.#r[s];for(let[s,{slot:a,prop:i}]of Object.entries(t.from??{}))o[s]??=Dm(this,a,this.#t)?.[i];for(let s of t.ids??[])o[s]??=ti(this);if(o.value===void 0&&o.id===void 0)o.id=ti(this);if(t.keyed&&$u(o))o.id??=km(this.#t)?.api.internal.keyOf(o.value);return ri(this,o,[],t.actions)}#o;connectedCallback(){if(Mu(this,[...t.properties??[],...Object.keys(n)]),ii(this),(t.target||this.hasAttribute("as-child"))&&!this.#o)this.#o=new MutationObserver(()=>this.#l()),this.#o.observe(this,{childList:!0});let o=sr(this,t.owner)??this.#t;if(!o)return queueMicrotask(()=>this.#a());if(!("register"in o)){customElements.whenDefined(o.localName).then(()=>this.isConnected&&this.connectedCallback());return}if(o===this.#t&&this.#e&&en.has(this.#e))return;if(this.#t&&this.#e)this.#t.unregister(this.#e);let s=ut(this,t.target);if(!s)return queueMicrotask(()=>{if(this.isConnected&&!this.#e&&!ut(this,t.target))me(`<${e}> needs an element inside it.`)});if(!this.#e){if(t.render?.(this),this.#e)return}this.#t=o,this.#e={slot:t.slot,feature:t.feature,el:s,props:this.#n(),reread:(t.context||t.from)&&(()=>this.#n()),keyed:t.keyed},Pt.set(this,o),Zt.set(this,this.#e),o.register(this.#e)}#a(){if(!this.isConnected||this.#t)return;if(sr(this,t.owner))this.connectedCallback();else if(t.alone)t.alone(ut(this,t.target)??this,this);else if(!this.hasAttribute("for"))me(`<${e}> must be inside ${t.owner}.`)}#l(){let o=this.#e?.el;if(!this.isConnected||o&&ai.has(o))return;let s=ut(this,t.target);if(s===(o??null))return;if(this.#t&&this.#e)this.#t.unregister(this.#e);if(this.#t=void 0,this.#e=void 0,s)this.connectedCallback()}disconnectedCallback(){Nu(this,()=>{if(this.#o?.disconnect(),this.#o=void 0,this.#t&&this.#e)this.#t.unregister(this.#e);Pt.delete(this),Zt.delete(this),this.#t=void 0,this.#e=void 0})}attributeChangedCallback(o){if(jt(this,o),lr.includes(o))return;if(o==="for"){if(!this.isConnected)return;if(!sr(this,t.owner)&&this.#t&&this.#e)this.#t.unregister(this.#e),this.#t=void 0,Pt.delete(this);this.connectedCallback();return}if(!this.#t||!this.#e){if(t.alone&&this.isConnected&&!sr(this,t.owner))t.alone(ut(this,t.target)??this,this);return}let s=this.#e.props;this.#e.props=this.#n();let a=this.#e.props,i=ku(s,a)||!!t.rebind?.some((l)=>s[l]!==a[l]);this.#t.update(this.#e,i),t.changed?.(this)}})}var ei=new WeakMap;function yu(e,t,n={}){let r={},o=[],s=[],a=[],i=!1,l={};for(let[c,d]of Object.entries({...e,...n})){if(!d)continue;if(typeof d==="object"){let[u,v=c]=d.from.split(".");if(u in t.slots)l[c]={slot:u,prop:v};if(!(c in n))continue}let h=typeof d==="object"?d.kind:d;if(h==="value")o.push(c);else if(h==="action")a.push(c);else if(h==="id")s.push(c);else if(h==="key")i=!0;if(h==="value"||h==="action"||h==="callback")continue;if(c!=="id"||c in n)r[c]=h==="id"||h==="key"?"string":h}return{attributes:r,properties:o,ids:s,actions:a,keyed:i,from:Object.keys(l).length?l:void 0}}var vu=(e)=>typeof e==="string"?{tag:e}:e;function wu(e,t,n,r){let o=Uo(e);if(t==="root"){let{tag:k,self:A,kinds:W,properties:M=[],...I}=vu(n);ei.set(e,[...new Set([...ei.get(e)??[],k])]);let{debug:N,...q}=o.options,Q=yu(q,o,W),L={...I,self:A??("root"in o.slots&&!I.children?.root?"root":void 0),attributes:Q.attributes,properties:[...new Set([...Q.properties,...M])].filter((R)=>!I.state?.[R]),actions:Q.actions};return{kind:"owner",key:t,tagName:k,config:L}}let{tag:s,slot:a=t,owners:i=[],kinds:l,properties:c=[],...d}=vu(n),h=ei.get(e);if(!h)throw Error(`<${s}> is a part of ${e.name}: define its root first.`);let u=o.slots[a]??(d.feature?.slots[a]&&(d.feature.slots[a].props??{}));if(!u)throw Error(`<${s}>: ${e.name} has no ${a} slot.`);let{attributes:v,...x}=yu(u,o,l),w={...d,slot:a,owner:[...new Set([...r?[r]:[],...h,...i])].join(", "),props:v,...x,properties:[...new Set([...x.properties,...c])]};return{kind:"part",key:t,tagName:s,config:w}}function Rm(e,t){let{root:n,...r}=t,o=wu(e,"root",n);return[o,...Object.entries(r).flatMap(([s,a])=>a?[wu(e,s,a,o.tagName)]:[])]}function $m(e,t){if(t.kind==="owner")Im(t.tagName,e,t.config);else Fm(t.tagName,t.config)}var Nm=(e)=>e.replace(/(^|-)(\w)/g,(t,n,r)=>r.toUpperCase());function di(e,t){let n={};for(let r of Rm(e,t))$m(e,r),n[Nm(r.key)]=typeof customElements>"u"?void 0:customElements.get(r.tagName);return n}var Qe=new WeakMap,Wm={kind:"string",municipalityCodes:"list",limit:"number",debounceMs:"number",includeProvisional:"boolean",houseNumberPrefix:"boolean",fetchDetails:"boolean",defaultAddressId:"string",idName:"string",defaultValue:null,defaultOpen:null,filter:null,items:null,emptyItems:null,inlineComplete:null,openOnFocus:null,submitOnSelect:null,controller:null},jm=["kind","municipality-codes","limit","debounce-ms","include-provisional","house-number-prefix","fetch-details"];function Vm(e){return e.open&&e.status!=="idle"}function pi(e){return{client:e.client,kind:e.kind==="accessAddress"?"accessAddress":"address",municipalityCodes:e.municipalityCodes?.length?e.municipalityCodes:void 0,limit:e.limit??void 0,debounceMs:e.debounceMs??void 0,includeProvisional:e.includeProvisional,houseNumberPrefix:e.houseNumberPrefix,fetchDetails:e.fetchDetails}}function qm(e,t){let n=new Map;for(let o of e.children)if(o.localName==="dk-address-item")n.set(o.getAttribute("value")??"",o);let r=t.map((o)=>{let s=Dt(o),a=n.get(s);if(n.delete(s),!a)a=document.createElement("dk-address-item"),a.setAttribute("value",s),a.setAttribute("label",o.label),a.dataset.type=o.type,a.textContent=o.label;return a});for(let o of n.values())o.remove();r.forEach((o,s)=>{if(e.children[s]!==o)e.insertBefore(o,e.children[s]??null)})}var fi=new WeakMap;function Hm(e,t){let n=fi.get(e);if(t&&n)e.append(n),fi.delete(e);else if(!t&&!n){let r=document.createDocumentFragment();r.append(...e.childNodes),fi.set(e,r)}}var Vu=new WeakSet,Km=0;function Bm(e,t){for(let n of e.querySelectorAll("dk-address-popup")){if(n.hasAttribute("anchor")&&!Vu.has(n))continue;if(!t.id)t.id=`dk-address-control-${++Km}`;let r=`#${CSS.escape(t.id)}`;if(n.getAttribute("anchor")!==r)n.setAttribute("anchor",r);Vu.add(n)}}function _m(e,t){let n=e.querySelector(":scope > input[type=hidden][data-dk-address-id]");if(!e.idName){n?.remove();return}if(!n)n=document.createElement("input"),n.type="hidden",n.dataset.dkAddressId="",e.append(n);n.name=e.idName;let r=e.getAttribute("form");if(r)n.setAttribute("form",r);else n.removeAttribute("form");n.value=t?.suggestion.id??""}function qu(e,t){let{state:n}=t,r=Vm(n),o=e;if(o.value!==n.value)o.value=n.value;let s=n.status==="success"?"idle":n.status;if(o.status!==s)o.status=s;let a=r?"true":"false";if(e.getAttribute("open")!==a)e.setAttribute("open",a);for(let c of e.querySelectorAll("dk-address-list"))qm(c,n.suggestions);let i=n.status==="success"&&n.suggestions.length===0;for(let c of e.querySelectorAll("dk-address-empty"))Hm(c,i);let l=e.querySelector("dk-address-control");if(l?.toggleAttribute("data-open",r),l?.toggleAttribute("data-loading",n.status==="loading"),l)Bm(e,l);_m(e,n.selection),zm(e,t)}function zm(e,t){let{caret:n,value:r}=t.state;if(!n||n.revision===t.caretRevision)return;t.caretRevision=n.revision;let o=e.querySelector("dk-address-input input"),s=()=>{if(!o||o.ownerDocument.activeElement!==o||o.value!==r)return;o.setSelectionRange(n.position,n.position)};s(),requestAnimationFrame(s)}function Ym(e){let t=vr({...pi(e),onSelect:(l)=>{e.dispatchEvent(new CustomEvent("addressselect",{detail:l,bubbles:!0}))}}),n=new AbortController,{signal:r}=n,o={store:t,state:t.getState(),byKey:new Map,highlighted:null,pickHandled:!1,caretRevision:null,stop:()=>{}},s=(l)=>{let c=l?o.byKey.get(l):void 0;if(c)t.select(c)},a=t.subscribe(()=>{let l=t.getState();if(l.suggestions!==o.state.suggestions)o.byKey=new Map(l.suggestions.map((c)=>[Dt(c),c]));o.state=l,qu(e,o),e.dispatchEvent(new CustomEvent("statechange",{detail:l}))});e.addEventListener("valuechange",(l)=>{let{detail:c}=l;switch(c.reason){case"imperative":return;case"item-press":l.preventDefault(),o.pickHandled=!0,s(c.item?.value);return;case"clear-press":t.clear();return;case"escape-key":l.preventDefault();return;default:t.setInput(c.value)}},{signal:r}),e.addEventListener("openchange",(l)=>{let{detail:c}=l;if(c.reason==="imperative")return;if(c.reason==="item-press"){let d=o.highlighted;queueMicrotask(()=>{if(!o.pickHandled)s(d);o.pickHandled=!1}),l.preventDefault();return}t.setOpen(c.value)},{signal:r}),e.addEventListener("highlight",(l)=>{let{value:c}=l.detail;o.highlighted=typeof c==="string"?c:null},{signal:r}),e.ownerDocument.addEventListener("reset",(l)=>{let c=e.querySelector("dk-address-input input")?.form;if(!c||l.target!==c)return;setTimeout(()=>{if(t.clear(),e.defaultAddressId)t.selectById(e.defaultAddressId)})},{signal:r});let i=new MutationObserver(()=>t.setOptions(pi(e)));if(i.observe(e,{attributeFilter:jm}),o.stop=()=>{a(),n.abort(),i.disconnect(),t.destroy()},qu(e,o),e.defaultAddressId)t.selectById(e.defaultAddressId);return o}var Um=di(du,{root:{tag:"dk-address",display:"block",kinds:Wm,defaults:{houseNumberPrefix:!0,fetchDetails:!0},properties:["client"],options:()=>({filter:!1}),render:(e)=>{let t=e,n=Qe.get(t);if(n)n.store.setOptions(pi(t));else Qe.set(t,Ym(t));return()=>{queueMicrotask(()=>{if(t.isConnected)return;Qe.get(t)?.stop(),Qe.delete(t)})}}},label:"dk-address-label",input:{tag:"dk-address-input",target:ci("input"),display:"contents"},clear:{tag:"dk-address-clear",target:li,display:"contents"},content:{tag:"dk-address-popup",display:"block"},status:{tag:"dk-address-status",display:"block"},empty:{tag:"dk-address-empty",display:"block"},list:{tag:"dk-address-list",display:"block"},item:{tag:"dk-address-item",display:"block"}});if(typeof customElements<"u"&&!customElements.get("dk-address-control")){customElements.define("dk-address-control",class extends HTMLElement{});let e=document.createElement("style");e.textContent=":where(dk-address-control) { display: block; }",document.head.append(e)}var Hu=Um.Root;if(Hu)Object.defineProperties(Hu.prototype,{state:{get(){return Qe.get(this)?.state??null}},selection:{get(){return Qe.get(this)?.state.selection??null}},selectById:{value(e){let t=Qe.get(this);return t?t.store.selectById(e):Promise.resolve(null)}},clear:{value(){Qe.get(this)?.store.clear()}}});export{tn as createClient,Dt as suggestionKey};
3
+
4
+ //# debugId=859EEF7B8BFAE9A464756E2164756E21
5
+ //# sourceMappingURL=dk-address.js.map