UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 687 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DwjyRJ2u.js","assets/ErrorBlock-CuwX01Wv.js","assets/web-BWdORzMO.js","assets/userStore-BExk_Pfb.js","assets/dist-CrVLAEWP.js","assets/dist-H6yvDjb0.js","assets/dist-CJH2NxBr.js","assets/dist-CdzpWFT_.js","assets/dist-Dmx4nq4D.js","assets/dist-9lbUaBVw.js","assets/dist-BvjKwZYU.js","assets/dist-DCr6Xzka.js","assets/dist-DBuq_xgo.js","assets/dist-BEi7q3Xw.js"])))=>i.map(i=>d[i]); import{$ as e,$t as t,At as n,C as r,Ct as i,D as a,Dt as o,Et as s,F as c,Gt as l,H as u,Ht as d,In as f,Mt as p,N as m,Nt as h,P as g,Pt as _,Rn as v,S as y,St as b,Tt as x,V as S,Vt as ee,W as te,Wt as ne,X as re,Xt as ie,Yt as ae,a as oe,at as se,cn as ce,ct as le,dn as ue,dt as de,en as fe,et as pe,fn as C,ft as me,gt as he,h as ge,i as _e,in as ve,it as ye,jt as be,k as xe,l as Se,ln as Ce,lt as we,m as Te,mt as Ee,nn as De,o as Oe,ot as ke,pt as Ae,q as je,qt as Me,r as Ne,rn as Pe,t as Fe,tn as Ie,tt as Le,un as Re,ut as ze,vt as Be,w as Ve,wt as He,y as Ue,zt as We}from"./ErrorBlock-CuwX01Wv.js";import{A as w,B as T,D as E,E as Ge,F as D,H as O,I as Ke,M as k,O as qe,R as Je,S as A,T as Ye,U as Xe,V as Ze,X as Qe,Y as $e,a as j,b as et,c as M,d as tt,f as nt,h as rt,j as N,k as it,m as P,n as at,o as ot,p as st,q as F,s as I,t as ct,u as L,w as lt,x as R,y as ut}from"./web-BWdORzMO.js";import{S as dt,n as ft,w as pt,x as mt}from"./userStore-BExk_Pfb.js";import{Ct as ht,K as gt,Ot as _t,_t as vt,st as yt,ut as bt,vt as xt}from"./dist-CrVLAEWP.js";import{a as St,c as Ct,i as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./codemirror-theme-BOECWlIc.js";import{n as At,r as jt}from"./dist-CdzpWFT_.js";var Mt=(e,t)=>{let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n);return`${r}${r.includes(`?`)?r.endsWith(`?`)||r.endsWith(`&`)?``:`&`:`?`}${new URLSearchParams({preset:t.preset,format:t.format}).toString()}${i}`},z=v(ue(),1),Nt=P(`<span class=text-sm>`),Pt=P(`<p class=text-xs> `),Ft=P(`<div class="flex flex-col ml-2"><p class="text-sm text-title">`),It=P(`<div><span>`),Lt=P(`<img alt class="h-full w-full rounded-full object-cover"loading=lazy>`,!0,!1,!1),Rt=e=>{let t=N(()=>!!e.user.profilePicture?.file.url);return e.user.username?(()=>{var n=It(),r=n.firstChild;return I(r,E(A,{get when(){return e.user.profilePicture?.file.url},get fallback(){return Te.formatUserInitials({firstName:e.user.firstName,lastName:e.user.lastName,username:e.user.username})},children:e=>(()=>{var t=Lt();return k(()=>L(t,`src`,Mt(e(),{preset:`thumbnail-small`,format:`webp`}))),t})()})),I(n,E(lt,{get children(){return[E(R,{get when(){return e.mode===`short`},get children(){var t=Nt();return I(t,()=>Te.formatUserName(e.user,e.nameFormat)),t}}),E(R,{get when(){return e.mode===`long`},get children(){var t=Ft(),n=t.firstChild;return I(n,()=>e.user.username),I(t,E(A,{get when(){return e.user.firstName},get children(){var t=Pt(),n=t.firstChild;return I(t,()=>e.user.firstName,n),I(t,()=>e.user.lastName,null),t}}),null),t}})]}}),null),k(i=>{var a=(0,z.default)(`flex items-center`,{"w-full":e.mode===`long`}),o=(0,z.default)(`rounded-full flex bg-input-base text-title justify-center items-center font-bold overflow-hidden`,{"border border-border":!t(),"h-16 w-16 min-w-16 text-sm":e.mode===`icon`&&e.size===`large`,"h-10 w-10 min-w-10 text-[10px]":e.mode===`icon`&&e.size!==`x-small`&&e.size!==`small`&&e.size!==`large`,"h-5 w-5 min-w-5 text-[7px]":e.mode===`icon`&&e.size===`x-small`,"h-7 w-7 min-w-7 text-[8px]":e.mode===`icon`&&e.size===`small`||e.mode===`long`,"h-5 w-5 min-w-5 mr-2 text-[7px]":e.mode===`short`&&e.size===`x-small`,"h-7 w-7 min-w-7 mr-2 text-[8px]":e.mode===`short`&&e.size===`small`,"h-8 w-8 min-w-8 mr-2.5 text-[10px]":e.mode===`short`&&e.size!==`x-small`&&e.size!==`small`});return a!==i.e&&j(n,i.e=a),o!==i.t&&j(r,i.t=o),i},{e:void 0,t:void 0}),n})():null};function zt(e){return(...t)=>{for(let n of e)n&&n(...t)}}var B=e=>typeof e==`function`&&!e.length?e():e,Bt=e=>Array.isArray(e)?e:e?[e]:[];function Vt(e,...t){return typeof e==`function`?e(...t):e}var Ht=O;function Ut(e,t,n,r){return e.addEventListener(t,n,r),Ht(e.removeEventListener.bind(e,t,n,r))}function Wt(e,t,n,r){let i=()=>{Bt(B(e)).forEach(e=>{e&&Bt(B(t)).forEach(t=>Ut(e,t,n,r))})};typeof e==`function`?w(i):k(i)}var Gt=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function Kt(e){let t={},n;for(;n=Gt.exec(e);)t[n[1]]=n[2];return t}function qt(e,t){if(typeof e==`string`){if(typeof t==`string`)return`${e};${t}`;e=Kt(e)}else typeof t==`string`&&(t=Kt(t));return{...e,...t}}function Jt(...e){return zt(e)}function Yt(e,t,n=-1){return n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}function Xt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Zt(e){return typeof e==`number`}function Qt(e){return Object.prototype.toString.call(e)===`[object String]`}function $t(e){return typeof e==`function`}function en(e){return t=>`${e()}-${t}`}function tn(){let e=new Map,t=(t,n,r,i)=>{let a=i?.once?(...t)=>{e.delete(r),r(...t)}:r;e.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,r,i)},n=(t,n,r,i)=>{let a=e.get(r)?.fn||r;t.removeEventListener(n,a,i),e.delete(r)},r=()=>{e.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})};return O(()=>{r()}),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function nn(e,t){return e?e===t||e.contains(t):!1}function rn(e,t=!1){let{activeElement:n}=on(e);if(!n?.nodeName)return null;if(sn(n)&&n.contentDocument)return rn(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=on(n).getElementById(e);if(t)return t}}return n}function an(e){return on(e).defaultView||window}function on(e){return e?e.ownerDocument||e:document}function sn(e){return e.tagName===`IFRAME`}var cn=(e=>(e.Escape=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`,e.Space=` `,e.ArrowDown=`ArrowDown`,e.ArrowLeft=`ArrowLeft`,e.ArrowRight=`ArrowRight`,e.ArrowUp=`ArrowUp`,e.End=`End`,e.Home=`Home`,e.PageDown=`PageDown`,e.PageUp=`PageUp`,e))(cn||{});function ln(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function un(){return ln(/^Mac/i)}function dn(){return ln(/^iPhone/i)}function fn(){return ln(/^iPad/i)||un()&&navigator.maxTouchPoints>1}function pn(){return dn()||fn()}function mn(){return un()||pn()}function V(e,t){return t&&($t(t)?t(e):t[0](t[1],e)),e?.defaultPrevented}function hn(e){return t=>{for(let n of e)V(t,n)}}function gn(e){return un()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function _n(e){if(e)if(yn())e.focus({preventScroll:!0});else{let t=bn(e);e.focus(),xn(t)}}var vn=null;function yn(){if(vn==null){vn=!1;try{document.createElement(`div`).focus({get preventScroll(){return vn=!0,!0}})}catch{}}return vn}function bn(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function xn(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}var Sn=[`input:not([type='hidden']):not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`[tabindex]`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable='false'])`],Cn=[...Sn,`[tabindex]:not([tabindex="-1"]):not([disabled])`],wn=`${Sn.join(`:not([hidden]),`)},[tabindex]:not([disabled]):not([hidden])`,Tn=Cn.join(`:not([hidden]):not([tabindex="-1"]),`);function En(e,t){let n=Array.from(e.querySelectorAll(wn)).filter(Dn);return t&&Dn(e)&&n.unshift(e),n.forEach((e,t)=>{if(sn(e)&&e.contentDocument){let r=e.contentDocument.body,i=En(r,!1);n.splice(t,1,...i)}}),n}function Dn(e){return On(e)&&!kn(e)}function On(e){return e.matches(wn)&&An(e)}function kn(e){return Number.parseInt(e.getAttribute(`tabindex`)||`0`,10)<0}function An(e,t){return e.nodeName!==`#comment`&&jn(e)&&Mn(e,t)&&(!e.parentElement||An(e.parentElement,e))}function jn(e){if(!(e instanceof HTMLElement)&&!(e instanceof SVGElement))return!1;let{display:t,visibility:n}=e.style,r=t!==`none`&&n!==`hidden`&&n!==`collapse`;if(r){if(!e.ownerDocument.defaultView)return r;let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:i}=t(e);r=n!==`none`&&i!==`hidden`&&i!==`collapse`}return r}function Mn(e,t){return!e.hasAttribute(`hidden`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function Nn(e,t){return t.some(t=>t.contains(e))}function Pn(e,t,n){let r=t?.tabbable?Tn:wn,i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(r)&&An(e)&&(!n||Nn(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(i.currentNode=t.from),i}function Fn(e){let t=e;for(;t&&!In(t);)t=t.parentElement;return t||document.scrollingElement||document.documentElement}function In(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Ln(){}function Rn(e,t=-1/0,n=1/0){return Math.min(Math.max(e,t),n)}function zn(e,t,n,r){let i=(e-(Number.isNaN(t)?0:t))%r,a=Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i;Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(n/r)*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor((n-t)/r)*r);let o=r.toString(),s=o.indexOf(`.`),c=s>=0?o.length-s:0;if(c>0){let e=10**c;a=Math.round(a*e)/e}return a}function Bn(e){return[e.clientX,e.clientY]}function Vn(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=a,o=0,s=e-1;o<e;s=o++){let[a,c]=t[o],[l,u]=t[s],[,d]=t[s===0?e-1:s-1]||[0,0],f=(c-u)*(n-a)-(a-l)*(r-c);if(u<c){if(r>=u&&r<c){if(f===0)return!0;f>0&&(r===u?r>d&&(i=!i):i=!i)}}else if(c<u){if(r>c&&r<=u){if(f===0)return!0;f<0&&(r===u?r<d&&(i=!i):i=!i)}}else if(r===c&&(n>=l&&n<=a||n>=a&&n<=l))return!0}return i}function H(e,t){return T(e,t)}var Hn=new Map,Un=new Set;function Wn(){if(typeof window>`u`)return;let e=e=>{if(!e.target)return;let n=Hn.get(e.target);n||(n=new Set,Hn.set(e.target,n),e.target.addEventListener(`transitioncancel`,t)),n.add(e.propertyName)},t=e=>{if(!e.target)return;let n=Hn.get(e.target);if(n&&(n.delete(e.propertyName),n.size===0&&(e.target.removeEventListener(`transitioncancel`,t),Hn.delete(e.target)),Hn.size===0)){for(let e of Un)e();Un.clear()}};document.body.addEventListener(`transitionrun`,e),document.body.addEventListener(`transitionend`,t)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Wn):Wn());function Gn(e,t){let n=Kn(e,t,`left`),r=Kn(e,t,`top`),i=t.offsetWidth,a=t.offsetHeight,o=e.scrollLeft,s=e.scrollTop,c=o+e.offsetWidth,l=s+e.offsetHeight;n<=o?o=n:n+i>c&&(o+=n+i-c),r<=s?s=r:r+a>l&&(s+=r+a-l),e.scrollLeft=o,e.scrollTop=s}function Kn(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);){if(t.offsetParent.contains(e)){i-=e[r];break}t=t.offsetParent}return i}function qn(e,t){if(document.contains(e)){let n=document.scrollingElement||document.documentElement;if(window.getComputedStyle(n).overflow!==`hidden`){let{left:n,top:r}=e.getBoundingClientRect();e?.scrollIntoView?.({block:`nearest`});let{left:i,top:a}=e.getBoundingClientRect();(Math.abs(n-i)>1||Math.abs(r-a)>1)&&(t?.containingElement?.scrollIntoView?.({block:`center`,inline:`center`}),e.scrollIntoView?.({block:`nearest`}))}else{let t=Fn(e);for(;e&&t&&e!==n&&t!==n;)Gn(t,e),e=t,t=Fn(e)}}}var Jn={border:`0`,clip:`rect(0 0 0 0)`,"clip-path":`inset(50%)`,height:`1px`,margin:`0 -1px -1px 0`,overflow:`hidden`,padding:`0`,position:`absolute`,width:`1px`,"white-space":`nowrap`};function Yn(e,t){let[n,r]=D(Xn(t?.()));return w(()=>{r(e()?.tagName.toLowerCase()||Xn(t?.()))}),n}function Xn(e){return Qt(e)?e:void 0}function U(e){let[t,n]=F(e,[`as`]);if(!t.as)throw Error("[kobalte]: Polymorphic is missing the required `as` prop.");return E(ct,T(n,{get component(){return t.as}}))}var Zn=Object.defineProperty,Qn=(e,t)=>{for(var n in t)Zn(e,n,{get:t[n],enumerable:!0})};Qn({},{Button:()=>nr,Root:()=>tr});var $n=[`button`,`color`,`file`,`image`,`reset`,`submit`];function er(e){let t=e.tagName.toLowerCase();return t===`button`?!0:t===`input`&&e.type?$n.indexOf(e.type)!==-1:!1}function tr(e){let t,[n,r]=F(H({type:`button`},e),[`ref`,`type`,`disabled`]),i=Yn(()=>t,()=>`button`),a=N(()=>{let e=i();return e!=null&&er({tagName:e,type:n.type})}),o=N(()=>i()===`input`),s=N(()=>i()===`a`&&t?.getAttribute(`href`)!=null);return E(U,T({as:`button`,ref(e){var r=Jt(e=>t=e,n.ref);typeof r==`function`&&r(e)},get type(){return M(()=>!!(a()||o()))()?n.type:void 0},get role(){return!a()&&!s()?`button`:void 0},get tabIndex(){return!a()&&!s()&&!n.disabled?0:void 0},get disabled(){return M(()=>!!(a()||o()))()?n.disabled:void 0},get"aria-disabled"(){return!a()&&!o()&&n.disabled?!0:void 0},get"data-disabled"(){return n.disabled?``:void 0}},r))}var nr=tr;function rr(e){let[t,n]=D(e.defaultValue?.()),r=N(()=>e.value?.()!==void 0),i=N(()=>r()?e.value?.():t());return[i,t=>{$e(()=>{let a=Vt(t,i());return Object.is(a,i())||(r()||n(a),e.onChange?.(a)),a})}]}function ir(e){let[t,n]=rr(e);return[()=>t()??!1,n]}function ar(e){let[t,n]=rr(e);return[()=>t()??[],n]}function or(e={}){let[t,n]=ir({value:()=>B(e.isSelected),defaultValue:()=>!!B(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{!B(e.isReadOnly)&&!B(e.isDisabled)&&n(t)},toggle:()=>{!B(e.isReadOnly)&&!B(e.isDisabled)&&n(!t())}}}function sr(e){let t=e.startIndex??0,n=e.startLevel??0,r=[],i=t=>{if(t==null)return``;let n=e.getKey??`key`,r=Qt(n)?t[n]:n(t);return r==null?``:String(r)},a=t=>{if(t==null)return``;let n=e.getTextValue??`textValue`,r=Qt(n)?t[n]:n(t);return r==null?``:String(r)},o=t=>{if(t==null)return!1;let n=e.getDisabled??`disabled`;return(Qt(n)?t[n]:n(t))??!1},s=t=>{if(t!=null)return Qt(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(let c of e.dataSource){if(Qt(c)||Zt(c)){r.push({type:`item`,rawValue:c,key:String(c),textValue:String(c),disabled:o(c),level:n,index:t}),t++;continue}if(s(c)!=null){r.push({type:`section`,rawValue:c,key:``,textValue:``,disabled:!1,level:n,index:t}),t++;let i=s(c)??[];if(i.length>0){let a=sr({dataSource:i,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:n+1});r.push(...a),t+=a.length}}else r.push({type:`item`,rawValue:c,key:i(c),textValue:a(c),disabled:o(c),level:n,index:t}),t++}return r}function cr(e,t=[]){return N(()=>{let n=sr({dataSource:B(e.dataSource),getKey:B(e.getKey),getTextValue:B(e.getTextValue),getDisabled:B(e.getDisabled),getSectionChildren:B(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)})}var lr=new Map,ur=!1;try{ur=new Intl.NumberFormat(`de-DE`,{signDisplay:`exceptZero`}).resolvedOptions().signDisplay===`exceptZero`}catch{}var dr=!1;try{dr=new Intl.NumberFormat(`de-DE`,{style:`unit`,unit:`degree`}).resolvedOptions().style===`unit`}catch{}var fr={degree:{narrow:{default:`°`,"ja-JP":` 度`,"zh-TW":`度`,"sl-SI":` °`}}},pr=class{constructor(e,t={}){this.numberFormatter=mr(e,t),this.options=t}format(e){let t=``;if(t=!ur&&this.options.signDisplay!=null?hr(this.numberFormatter,this.options.signDisplay,e):this.numberFormatter.format(e),this.options.style===`unit`&&!dr){let{unit:e,unitDisplay:n=`short`,locale:r}=this.resolvedOptions();if(!e)return t;let i=fr[e]?.[n];t+=i[r]||i.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange==`function`)return this.numberFormatter.formatRange(e,t);if(t<e)throw RangeError(`End date must be >= start date`);return`${this.format(e)} \u{2013} ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts==`function`)return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw RangeError(`End date must be >= start date`);let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!ur&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!dr&&this.options.style===`unit`&&(e={...e,style:`unit`,unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}};function mr(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes(`-nu-`)&&(e.includes(`-u-`)||(e+=`-u-`),e+=`-nu-${n}`),t.style===`unit`&&!dr){let{unit:e,unitDisplay:n=`short`}=t;if(!e)throw Error(`unit option must be provided with style: "unit"`);if(!fr[e]?.[n])throw Error(`Unsupported unit ${e} with unitDisplay = ${n}`);t={...t,style:`decimal`}}let r=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(lr.has(r))return lr.get(r);let i=new Intl.NumberFormat(e,t);return lr.set(r,i),i}function hr(e,t,n){if(t===`auto`)return e.format(n);if(t===`never`)return e.format(Math.abs(n));{let r=!1;if(t===`always`?r=n>0||Object.is(n,0):t===`exceptZero`&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let t=e.format(-n),r=e.format(n),i=t.replace(r,``).replace(/\u200e|\u061C/,``);return[...i].length!==1&&console.warn(`@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case`),t.replace(r,`!!!`).replace(i,`+`).replace(`!!!`,r)}else return e.format(n)}}var gr=new Set([`Avst`,`Arab`,`Armi`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),_r=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function vr(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize().script??``;return gr.has(t)}let t=e.split(`-`)[0];return _r.has(t)}function yr(e){return vr(e)?`rtl`:`ltr`}function br(){let e=typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:yr(e)}}var xr=br(),Sr=new Set;function Cr(){xr=br();for(let e of Sr)e(xr)}function wr(){let[e,t]=D(xr),n=N(()=>e());return Xe(()=>{Sr.size===0&&window.addEventListener(`languagechange`,Cr),Sr.add(t),O(()=>{Sr.delete(t),Sr.size===0&&window.removeEventListener(`languagechange`,Cr)})}),{locale:()=>n().locale,direction:()=>n().direction}}var Tr=it();function Er(){let e=wr();return Qe(Tr)||e}var Dr=new Map;function Or(e){let{locale:t}=Er(),n=N(()=>t()+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():``));return N(()=>{let r=n(),i;return Dr.has(r)&&(i=Dr.get(r)),i||(i=new Intl.Collator(t(),e),Dr.set(r,i)),i})}function kr(e){let{locale:t}=Er();return N(()=>new pr(t(),B(e)))}var Ar=class e extends Set{anchorKey;currentKey;constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n||t.anchorKey,this.currentKey=r||t.currentKey):(this.anchorKey=n,this.currentKey=r)}};function jr(e){let[t,n]=rr(e);return[()=>t()??new Ar,n]}function Mr(e){return mn()?e.altKey:e.ctrlKey}function Nr(e){return un()?e.metaKey:e.ctrlKey}function Pr(e){return new Ar(e)}function Fr(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ir(e){let t=H({selectionMode:`none`,selectionBehavior:`toggle`},e),[n,r]=D(!1),[i,a]=D(),[o,s]=jr({value:N(()=>{let e=B(t.selectedKeys);return e==null?e:Pr(e)}),defaultValue:N(()=>{let e=B(t.defaultSelectedKeys);return e==null?new Ar:Pr(e)}),onChange:e=>t.onSelectionChange?.(e)}),[c,l]=D(B(t.selectionBehavior));return w(()=>{let e=o();B(t.selectionBehavior)===`replace`&&c()===`toggle`&&typeof e==`object`&&e.size===0&&l(`replace`)}),w(()=>{l(B(t.selectionBehavior)??`toggle`)}),{selectionMode:()=>B(t.selectionMode),disallowEmptySelection:()=>B(t.disallowEmptySelection)??!1,selectionBehavior:c,setSelectionBehavior:l,isFocused:n,setFocused:r,focusedKey:i,setFocusedKey:a,selectedKeys:o,setSelectedKeys:e=>{(B(t.allowDuplicateSelectionEvents)||!Fr(e,o()))&&s(e)}}}function Lr(e){let[t,n]=D(``),[r,i]=D(-1);return{typeSelectHandlers:{onKeyDown:a=>{if(B(e.isDisabled))return;let o=B(e.keyboardDelegate),s=B(e.selectionManager);if(!o.getKeyForSearch)return;let c=Rr(a.key);if(!c||a.ctrlKey||a.metaKey)return;c===` `&&t().trim().length>0&&(a.preventDefault(),a.stopPropagation());let l=n(e=>e+c),u=o.getKeyForSearch(l,s.focusedKey())??o.getKeyForSearch(l);u==null&&zr(l)&&(l=l[0],u=o.getKeyForSearch(l,s.focusedKey())??o.getKeyForSearch(l)),u!=null&&(s.setFocusedKey(u),e.onTypeSelect?.(u)),clearTimeout(r()),i(window.setTimeout(()=>n(``),500))}}}}function Rr(e){return e.length===1||!/^[A-Z]/i.test(e)?e:``}function zr(e){return e.split(``).every(t=>t===e[0])}function Br(e,t,n){let r=T({selectOnFocus:()=>B(e.selectionManager).selectionBehavior()===`replace`},e),i=()=>n?.()??t(),{direction:a}=Er(),o={top:0,left:0};Wt(()=>B(r.isVirtualized)?void 0:i(),`scroll`,()=>{let e=i();e&&(o={top:e.scrollTop,left:e.scrollLeft})});let{typeSelectHandlers:s}=Lr({isDisabled:()=>B(r.disallowTypeAhead),keyboardDelegate:()=>B(r.keyboardDelegate),selectionManager:()=>B(r.selectionManager)}),c=()=>B(r.orientation)??`vertical`,l=e=>{V(e,s.onKeyDown),e.altKey&&e.key===`Tab`&&e.preventDefault();let n=t();if(!n?.contains(e.target))return;let i=B(r.selectionManager),o=B(r.selectOnFocus),l=t=>{t!=null&&(i.setFocusedKey(t),e.shiftKey&&i.selectionMode()===`multiple`?i.extendSelection(t):o&&!Mr(e)&&i.replaceSelection(t))},u=B(r.keyboardDelegate),d=B(r.shouldFocusWrap),f=i.focusedKey();switch(e.key){case c()===`vertical`?`ArrowDown`:`ArrowRight`:if(u.getKeyBelow){e.preventDefault();let t;t=f==null?u.getFirstKey?.():u.getKeyBelow(f),t==null&&d&&(t=u.getFirstKey?.(f)),l(t)}break;case c()===`vertical`?`ArrowUp`:`ArrowLeft`:if(u.getKeyAbove){e.preventDefault();let t;t=f==null?u.getLastKey?.():u.getKeyAbove(f),t==null&&d&&(t=u.getLastKey?.(f)),l(t)}break;case c()===`vertical`?`ArrowLeft`:`ArrowUp`:if(u.getKeyLeftOf){e.preventDefault();let t=a()===`rtl`,n;n=f==null?t?u.getFirstKey?.():u.getLastKey?.():u.getKeyLeftOf(f),l(n)}break;case c()===`vertical`?`ArrowRight`:`ArrowDown`:if(u.getKeyRightOf){e.preventDefault();let t=a()===`rtl`,n;n=f==null?t?u.getLastKey?.():u.getFirstKey?.():u.getKeyRightOf(f),l(n)}break;case`Home`:if(u.getFirstKey){e.preventDefault();let t=u.getFirstKey(f,Nr(e));t!=null&&(i.setFocusedKey(t),Nr(e)&&e.shiftKey&&i.selectionMode()===`multiple`?i.extendSelection(t):o&&i.replaceSelection(t))}break;case`End`:if(u.getLastKey){e.preventDefault();let t=u.getLastKey(f,Nr(e));t!=null&&(i.setFocusedKey(t),Nr(e)&&e.shiftKey&&i.selectionMode()===`multiple`?i.extendSelection(t):o&&i.replaceSelection(t))}break;case`PageDown`:u.getKeyPageBelow&&f!=null&&(e.preventDefault(),l(u.getKeyPageBelow(f)));break;case`PageUp`:u.getKeyPageAbove&&f!=null&&(e.preventDefault(),l(u.getKeyPageAbove(f)));break;case`a`:Nr(e)&&i.selectionMode()===`multiple`&&B(r.disallowSelectAll)!==!0&&(e.preventDefault(),i.selectAll());break;case`Escape`:e.defaultPrevented||(e.preventDefault(),B(r.disallowEmptySelection)||i.clearSelection());break;case`Tab`:if(!B(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{let e=Pn(n,{tabbable:!0}),t,r;do r=e.lastChild(),r&&(t=r);while(r);t&&!t.contains(document.activeElement)&&_n(t)}break}}},u=e=>{let t=B(r.selectionManager),n=B(r.keyboardDelegate),a=B(r.selectOnFocus);if(t.isFocused()){e.currentTarget.contains(e.target)||t.setFocused(!1);return}if(e.currentTarget.contains(e.target)){if(t.setFocused(!0),t.focusedKey()==null){let r=e=>{e!=null&&(t.setFocusedKey(e),a&&t.replaceSelection(e))},i=e.relatedTarget;i&&e.currentTarget.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING?r(t.lastSelectedKey()??n.getLastKey?.()):r(t.firstSelectedKey()??n.getFirstKey?.())}else if(!B(r.isVirtualized)){let e=i();if(e){e.scrollTop=o.top,e.scrollLeft=o.left;let n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(_n(n),Gn(e,n))}}}},d=e=>{let t=B(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)},f=e=>{i()===e.target&&e.preventDefault()},p=()=>{let e=B(r.autoFocus);if(!e)return;let n=B(r.selectionManager),i=B(r.keyboardDelegate),a;e===`first`&&(a=i.getFirstKey?.()),e===`last`&&(a=i.getLastKey?.());let o=n.selectedKeys();o.size&&(a=o.values().next().value),n.setFocused(!0),n.setFocusedKey(a);let s=t();s&&a==null&&!B(r.shouldUseVirtualFocus)&&_n(s)};return Xe(()=>{r.deferAutoFocus?setTimeout(p,0):p()}),w(Ze([i,()=>B(r.isVirtualized),()=>B(r.selectionManager).focusedKey()],e=>{let[t,n,i]=e;if(n)i&&r.scrollToKey?.(i);else if(i&&t){let e=t.querySelector(`[data-key="${i}"]`);e&&Gn(t,e)}})),{tabIndex:N(()=>{if(!B(r.shouldUseVirtualFocus))return B(r.selectionManager).focusedKey()==null?0:-1}),onKeyDown:l,onMouseDown:f,onFocusIn:u,onFocusOut:d}}function Vr(e,t){let n=()=>B(e.selectionManager),r=()=>B(e.key),i=()=>B(e.shouldUseVirtualFocus),a=e=>{n().selectionMode()!==`none`&&(n().selectionMode()===`single`?n().isSelected(r())&&!n().disallowEmptySelection()?n().toggleSelection(r()):n().replaceSelection(r()):e?.shiftKey?n().extendSelection(r()):n().selectionBehavior()===`toggle`||Nr(e)||`pointerType`in e&&e.pointerType===`touch`?n().toggleSelection(r()):n().replaceSelection(r()))},o=()=>n().isSelected(r()),s=()=>B(e.disabled)||n().isDisabled(r()),c=()=>!s()&&n().canSelectItem(r()),l=null,u=t=>{c()&&(l=t.pointerType,t.pointerType===`mouse`&&t.button===0&&!B(e.shouldSelectOnPressUp)&&a(t))},d=t=>{c()&&t.pointerType===`mouse`&&t.button===0&&B(e.shouldSelectOnPressUp)&&B(e.allowsDifferentPressOrigin)&&a(t)},f=t=>{c()&&(B(e.shouldSelectOnPressUp)&&!B(e.allowsDifferentPressOrigin)||l!==`mouse`)&&a(t)},p=e=>{!c()||![`Enter`,` `].includes(e.key)||(Mr(e)?n().toggleSelection(r()):a(e))},m=e=>{s()&&e.preventDefault()},h=e=>{let a=t();i()||s()||!a||e.target===a&&n().setFocusedKey(r())},g=N(()=>{if(!(i()||s()))return r()===n().focusedKey()?0:-1}),_=N(()=>B(e.virtualized)?void 0:r());return w(Ze([t,r,i,()=>n().focusedKey(),()=>n().isFocused()],([t,n,r,i,a])=>{t&&n===i&&a&&!r&&document.activeElement!==t&&(e.focus?e.focus():_n(t))})),{isSelected:o,isDisabled:s,allowsSelection:c,tabIndex:g,dataKey:_,onPointerDown:u,onPointerUp:d,onClick:f,onKeyDown:p,onMouseDown:m,onFocus:h}}var Hr=class{collection;state;constructor(e,t){this.collection=e,this.state=t}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(e==null||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if(this.state.selectionMode()===`none`)return!1;let t=this.getKey(e);return t!=null&&this.state.selectedKeys().has(t)}isEmpty(){return this.state.selectedKeys().size===0}isSelectAll(){if(this.isEmpty())return!1;let e=this.state.selectedKeys();return this.getAllSelectableKeys().every(t=>e.has(t))}firstSelectedKey(){let e;for(let t of this.state.selectedKeys()){let n=this.collection().getItem(t),r=n?.index!=null&&e?.index!=null&&n.index<e.index;(!e||r)&&(e=n)}return e?.key}lastSelectedKey(){let e;for(let t of this.state.selectedKeys()){let n=this.collection().getItem(t),r=n?.index!=null&&e?.index!=null&&n.index>e.index;(!e||r)&&(e=n)}return e?.key}extendSelection(e){if(this.selectionMode()===`none`)return;if(this.selectionMode()===`single`){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let n=this.state.selectedKeys(),r=n.anchorKey||t,i=new Ar(n,r,t);for(let e of this.getKeyRange(r,n.currentKey||t))i.delete(e);for(let e of this.getKeyRange(t,r))this.canSelectItem(e)&&i.add(e);this.state.setSelectedKeys(i)}getKeyRange(e,t){let n=this.collection().getItem(e),r=this.collection().getItem(t);return n&&r?n.index!=null&&r.index!=null&&n.index<=r.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){let n=[],r=e;for(;r!=null;){let e=this.collection().getItem(r);if(e&&e.type===`item`&&n.push(r),r===t)return n;r=this.collection().getKeyAfter(r)}return[]}getKey(e){let t=this.collection().getItem(e);return t?!t||t.type!==`item`?null:t.key:e}toggleSelection(e){if(this.selectionMode()===`none`)return;if(this.selectionMode()===`single`&&!this.isSelected(e)){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let n=new Ar(this.state.selectedKeys());n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),!(this.disallowEmptySelection()&&n.size===0)&&this.state.setSelectedKeys(n)}replaceSelection(e){if(this.selectionMode()===`none`)return;let t=this.getKey(e);if(t==null)return;let n=this.canSelectItem(t)?new Ar([t],t,t):new Ar;this.state.setSelectedKeys(n)}setSelectedKeys(e){if(this.selectionMode()===`none`)return;let t=new Ar;for(let n of e){let e=this.getKey(n);if(e!=null&&(t.add(e),this.selectionMode()===`single`))break}this.state.setSelectedKeys(t)}selectAll(){this.selectionMode()===`multiple`&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){let e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new Ar)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode()!==`none`&&(this.selectionMode()===`single`?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior()===`toggle`||t&&t.pointerType===`touch`?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;let t=this.selectedKeys();if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;for(let n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){if(this.state.selectionMode()===`none`)return!1;let t=this.collection().getItem(e);return t!=null&&!t.disabled}isDisabled(e){let t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){let e=[];return(t=>{for(;t!=null;){if(this.canSelectItem(t)){let n=this.collection().getItem(t);if(!n)continue;n.type===`item`&&e.push(t)}t=this.collection().getKeyAfter(t)}})(this.collection().getFirstKey()),e}},Ur=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(let t of e)this.keyMap.set(t.key,t);if(this.keyMap.size===0)return;let t,n=0;for(let[e,r]of this.keyMap)t?(t.nextKey=e,r.prevKey=t.key):(this.firstKey=e,r.prevKey=void 0),r.type===`item`&&(r.index=n++),t=r,t.nextKey=void 0;this.lastKey=t.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}};function Wr(e){let t=Ir(e),n=cr({dataSource:()=>B(e.dataSource),getKey:()=>B(e.getKey),getTextValue:()=>B(e.getTextValue),getDisabled:()=>B(e.getDisabled),getSectionChildren:()=>B(e.getSectionChildren),factory:t=>e.filter?new Ur(e.filter(t)):new Ur(t)},[()=>e.filter]),r=new Hr(n,t);return qe(()=>{let e=t.focusedKey();e!=null&&!n().getItem(e)&&t.setFocusedKey(void 0)}),{collection:n,selectionManager:()=>r}}var Gr=it();function Kr(){return Qe(Gr)}function qr(){let e=Kr();if(e===void 0)throw Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}function Jr(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Yr(e,t){let n=t.ref();if(!n)return-1;let r=e.length;if(!r)return-1;for(;r--;){let t=e[r]?.ref();if(t&&Jr(t,n))return r+1}return 0}function Xr(e){let t=e.map((e,t)=>[t,e]),n=!1;return t.sort(([e,t],[r,i])=>{let a=t.ref(),o=i.ref();return a===o||!a||!o?0:Jr(a,o)?(e>r&&(n=!0),-1):(e<r&&(n=!0),1)}),n?t.map(([e,t])=>t):e}function Zr(e,t){let n=Xr(e);e!==n&&t(n)}function Qr(e){let t=e[0],n=e[e.length-1]?.ref(),r=t?.ref()?.parentElement;for(;r;){if(n&&r.contains(n))return r;r=r.parentElement}return on(r).body}function $r(e,t){w(()=>{let n=setTimeout(()=>{Zr(e(),t)});O(()=>clearTimeout(n))})}function ei(e,t){if(typeof IntersectionObserver!=`function`){$r(e,t);return}let n=[];w(()=>{let r=()=>{let r=!!n.length;n=e(),r&&Zr(e(),t)},i=Qr(e()),a=new IntersectionObserver(r,{root:i});for(let t of e()){let e=t.ref();e&&a.observe(e)}O(()=>a.disconnect())})}function ti(e={}){let[t,n]=ar({value:()=>B(e.items),onChange:t=>e.onItemsChange?.(t)});ei(t,n);let r=e=>(n(t=>Yt(t,e,Yr(t,e))),()=>{n(t=>{let n=t.filter(t=>t.ref()!==e.ref());return t.length===n.length?t:n})});return{DomCollectionProvider:e=>E(Gr.Provider,{value:{registerItem:r},get children(){return e.children}})}}function ni(e){let t=qr(),n=H({shouldRegisterItem:!0},e);w(()=>{n.shouldRegisterItem&&O(t.registerItem(n.getItem()))})}var ri=[`top`,`right`,`bottom`,`left`],ii=Math.min,ai=Math.max,oi=Math.round,si=Math.floor,ci=e=>({x:e,y:e}),li={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ui(e,t,n){return ai(e,ii(t,n))}function di(e,t){return typeof e==`function`?e(t):e}function fi(e){return e.split(`-`)[0]}function pi(e){return e.split(`-`)[1]}function mi(e){return e===`x`?`y`:`x`}function hi(e){return e===`y`?`height`:`width`}function gi(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function _i(e){return mi(gi(e))}function vi(e,t,n){n===void 0&&(n=!1);let r=pi(e),i=_i(e),a=hi(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Di(o)),[o,Di(o)]}function yi(e){let t=Di(e);return[bi(e),t,bi(t)]}function bi(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var xi=[`left`,`right`],Si=[`right`,`left`],Ci=[`top`,`bottom`],wi=[`bottom`,`top`];function Ti(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Si:xi:t?xi:Si;case`left`:case`right`:return t?Ci:wi;default:return[]}}function Ei(e,t,n,r){let i=pi(e),a=Ti(fi(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(bi)))),a}function Di(e){let t=fi(e);return li[t]+e.slice(t.length)}function Oi(e){return{top:0,right:0,bottom:0,left:0,...e}}function ki(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Oi(e)}function Ai(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ji(e,t,n){let{reference:r,floating:i}=e,a=gi(t),o=_i(t),s=hi(o),c=fi(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(pi(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Mi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=di(t,e),p=ki(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ai(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ai(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ni=50,Pi=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mi},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ji(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Ni&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ji(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Fi=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=di(e,t)||{};if(l==null)return{};let d=ki(u),f={x:n,y:r},p=_i(i),m=hi(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),ee=S?S[y]:0;(!ee||!await(o.isElement==null?void 0:o.isElement(S)))&&(ee=s.floating[y]||a.floating[m]);let te=b/2-x/2,ne=ee/2-h[m]/2-1,re=ii(d[_],ne),ie=ii(d[v],ne),ae=re,oe=ee-h[m]-ie,se=ee/2-h[m]/2+te,ce=ui(ae,se,oe),le=!c.arrow&&pi(i)!=null&&se!==ce&&a.reference[m]/2-(se<ae?re:ie)-h[m]/2<0,ue=le?se<ae?se-ae:se-oe:0;return{[p]:f[p]+ue,data:{[p]:ce,centerOffset:se-ce-ue,...le&&{alignmentOffset:ue}},reset:le}}}),Ii=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=di(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=fi(r),_=gi(o),v=fi(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Di(o)]:yi(o)),x=p!==`none`;!d&&x&&b.push(...Ei(o,m,p,y));let S=[o,...b],ee=await s.detectOverflow(t,h),te=[],ne=i.flip?.overflows||[];if(l&&te.push(ee[g]),u){let e=vi(r,a,y);te.push(ee[e[0]],ee[e[1]])}if(ne=[...ne,{placement:r,overflows:te}],!te.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==gi(t))||ne.every(e=>gi(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:ne},reset:{placement:t}};let n=ne.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=ne.filter(e=>{if(x){let t=gi(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Li(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ri(e){return ri.some(t=>e[t]>=0)}var zi=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=di(e,t);switch(i){case`referenceHidden`:{let e=Li(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ri(e)}}}case`escaped`:{let e=Li(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ri(e)}}}default:return{}}}}},Bi=new Set([`left`,`top`]);async function Vi(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=fi(n),s=pi(n),c=gi(n)===`y`,l=Bi.has(o)?-1:1,u=a&&c?-1:1,d=di(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Hi=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Vi(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ui=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=di(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=gi(fi(i)),p=mi(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ui(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ui(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Wi=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=di(e,t),u=await o.detectOverflow(t,l),d=fi(i),f=pi(i),p=gi(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=ii(h-u[g],v),x=ii(m-u[_],y),S=!t.middlewareData.shift,ee=b,te=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(te=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(ee=v),S&&!f){let e=ai(u.left,0),t=ai(u.right,0),n=ai(u.top,0),r=ai(u.bottom,0);p?te=m-2*(e!==0||t!==0?e+t:ai(u.left,u.right)):ee=h-2*(n!==0||r!==0?n+r:ai(u.top,u.bottom))}await c({...t,availableWidth:te,availableHeight:ee});let ne=await o.getDimensions(s.floating);return m!==ne.width||h!==ne.height?{reset:{rects:!0}}:{}}}};function Gi(){return typeof window<`u`}function Ki(e){return Yi(e)?(e.nodeName||``).toLowerCase():`#document`}function qi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ji(e){return((Yi(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Yi(e){return Gi()?e instanceof Node||e instanceof qi(e).Node:!1}function Xi(e){return Gi()?e instanceof Element||e instanceof qi(e).Element:!1}function Zi(e){return Gi()?e instanceof HTMLElement||e instanceof qi(e).HTMLElement:!1}function Qi(e){return!Gi()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof qi(e).ShadowRoot}function $i(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ua(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ea(e){return/^(table|td|th)$/.test(Ki(e))}function ta(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var na=/transform|translate|scale|rotate|perspective|filter/,ra=/paint|layout|strict|content/,ia=e=>!!e&&e!==`none`,aa;function oa(e){let t=Xi(e)?ua(e):e;return ia(t.transform)||ia(t.translate)||ia(t.scale)||ia(t.rotate)||ia(t.perspective)||!ca()&&(ia(t.backdropFilter)||ia(t.filter))||na.test(t.willChange||``)||ra.test(t.contain||``)}function sa(e){let t=fa(e);for(;Zi(t)&&!la(t);){if(oa(t))return t;if(ta(t))return null;t=fa(t)}return null}function ca(){return aa??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),aa}function la(e){return/^(html|body|#document)$/.test(Ki(e))}function ua(e){return qi(e).getComputedStyle(e)}function da(e){return Xi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fa(e){if(Ki(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Qi(e)&&e.host||Ji(e);return Qi(t)?t.host:t}function pa(e){let t=fa(e);return la(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zi(t)&&$i(t)?t:pa(t)}function ma(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=pa(e),i=r===e.ownerDocument?.body,a=qi(r);if(i){let e=ha(a);return t.concat(a,a.visualViewport||[],$i(r)?r:[],e&&n?ma(e):[])}else return t.concat(r,ma(r,[],n))}function ha(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ga(e){let t=ua(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Zi(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=oi(n)!==a||oi(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _a(e){return Xi(e)?e:e.contextElement}function va(e){let t=_a(e);if(!Zi(t))return ci(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ga(t),o=(a?oi(n.width):n.width)/r,s=(a?oi(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ya=ci(0);function ba(e){let t=qi(e);return!ca()||!t.visualViewport?ya:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xa(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qi(e)?!1:t}function Sa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_a(e),o=ci(1);t&&(r?Xi(r)&&(o=va(r)):o=va(e));let s=xa(a,n,r)?ba(a):ci(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=qi(a),t=r&&Xi(r)?qi(r):r,n=e,i=ha(n);for(;i&&r&&t!==n;){let e=va(i),t=i.getBoundingClientRect(),r=ua(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=qi(i),i=ha(n)}}return Ai({width:u,height:d,x:c,y:l})}function Ca(e,t){let n=da(e).scrollLeft;return t?t.left+n:Sa(Ji(e)).left+n}function wa(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ca(e,n),y:n.top+t.scrollTop}}function Ta(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ji(r),s=t?ta(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ci(1),u=ci(0),d=Zi(r);if((d||!d&&!a)&&((Ki(r)!==`body`||$i(o))&&(c=da(r)),d)){let e=Sa(r);l=va(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?wa(o,c):ci(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ea(e){return Array.from(e.getClientRects())}function Da(e){let t=Ji(e),n=da(e),r=e.ownerDocument.body,i=ai(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ai(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ca(e),s=-n.scrollTop;return ua(r).direction===`rtl`&&(o+=ai(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Oa=25;function ka(e,t){let n=qi(e),r=Ji(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ca();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ca(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Oa&&(a-=o)}else l<=Oa&&(a+=l);return{width:a,height:o,x:s,y:c}}function Aa(e,t){let n=Sa(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Zi(e)?va(e):ci(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ja(e,t,n){let r;if(t===`viewport`)r=ka(e,n);else if(t===`document`)r=Da(Ji(e));else if(Xi(t))r=Aa(t,n);else{let n=ba(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ai(r)}function Ma(e,t){let n=fa(e);return n===t||!Xi(n)||la(n)?!1:ua(n).position===`fixed`||Ma(n,t)}function Na(e,t){let n=t.get(e);if(n)return n;let r=ma(e,[],!1).filter(e=>Xi(e)&&Ki(e)!==`body`),i=null,a=ua(e).position===`fixed`,o=a?fa(e):e;for(;Xi(o)&&!la(o);){let t=ua(o),n=oa(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||$i(o)&&!n&&Ma(e,o))?r=r.filter(e=>e!==o):i=t,o=fa(o)}return t.set(e,r),r}function Pa(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ta(t)?[]:Na(t,this._c):[].concat(n),r],o=ja(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ja(t,a[e],i);s=ai(n.top,s),c=ii(n.right,c),l=ii(n.bottom,l),u=ai(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Fa(e){let{width:t,height:n}=ga(e);return{width:t,height:n}}function Ia(e,t,n){let r=Zi(t),i=Ji(t),a=n===`fixed`,o=Sa(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ci(0);function l(){c.x=Ca(i)}if(r||!r&&!a)if((Ki(t)!==`body`||$i(i))&&(s=da(t)),r){let e=Sa(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?wa(i,s):ci(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function La(e){return ua(e).position===`static`}function Ra(e,t){if(!Zi(e)||ua(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ji(e)===n&&(n=n.ownerDocument.body),n}function za(e,t){let n=qi(e);if(ta(e))return n;if(!Zi(e)){let t=fa(e);for(;t&&!la(t);){if(Xi(t)&&!La(t))return t;t=fa(t)}return n}let r=Ra(e,t);for(;r&&ea(r)&&La(r);)r=Ra(r,t);return r&&la(r)&&La(r)&&!oa(r)?n:r||sa(e)||n}var Ba=async function(e){let t=this.getOffsetParent||za,n=this.getDimensions,r=await n(e.floating);return{reference:Ia(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Va(e){return ua(e).direction===`rtl`}var Ha={convertOffsetParentRelativeRectToViewportRelativeRect:Ta,getDocumentElement:Ji,getClippingRect:Pa,getOffsetParent:za,getElementRects:Ba,getClientRects:Ea,getDimensions:Fa,getScale:va,isElement:Xi,isRTL:Va};function Ua(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wa(e,t){let n=null,r,i=Ji(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=si(d),h=si(i.clientWidth-(u+f)),g=si(i.clientHeight-(d+p)),_=si(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:a