preline
Version:
Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
16 lines • 37.2 kB
JavaScript
var e={189:(e,t,n)=>{n.d(t,{lP:()=>o});const o={auto:"auto","auto-start":"auto-start","auto-end":"auto-end",top:"top","top-left":"top-start","top-right":"top-end",bottom:"bottom","bottom-left":"bottom-start","bottom-right":"bottom-end",right:"right","right-start":"right-start","right-end":"right-end",left:"left","left-start":"left-start","left-end":"left-end"}},615:(e,t,n)=>{n.d(t,{A:()=>o});class o{constructor(e,t,n){this.el=e,this.options=t,this.events=n,this.el=e,this.options=t,this.events={}}createCollection(e,t){var n;e.push({id:(null===(n=null==t?void 0:t.el)||void 0===n?void 0:n.id)||e.length+1,element:t})}fireEvent(e,t=null){if(this.events.hasOwnProperty(e))return this.events[e](t)}on(e,t){this.events[e]=t}}},663:(e,t,n)=>{n.d(t,{ll:()=>oe,rD:()=>re,UU:()=>se,cY:()=>ie});const o=Math.min,i=Math.max,s=Math.round,r=Math.floor,l=e=>({x:e,y:e}),a={left:"right",right:"left",bottom:"top",top:"bottom"},c={start:"end",end:"start"};function d(e,t){return"function"==typeof e?e(t):e}function u(e){return e.split("-")[0]}function h(e){return e.split("-")[1]}function p(e){return"y"===e?"height":"width"}function f(e){return["top","bottom"].includes(u(e))?"y":"x"}function m(e){return"x"===f(e)?"y":"x"}function g(e){return e.replace(/start|end/g,(e=>c[e]))}function w(e){return e.replace(/left|right|bottom|top/g,(e=>a[e]))}function y(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function v(e,t,n){let{reference:o,floating:i}=e;const s=f(t),r=m(t),l=p(r),a=u(t),c="y"===s,d=o.x+o.width/2-i.width/2,g=o.y+o.height/2-i.height/2,w=o[l]/2-i[l]/2;let y;switch(a){case"top":y={x:d,y:o.y-i.height};break;case"bottom":y={x:d,y:o.y+o.height};break;case"right":y={x:o.x+o.width,y:g};break;case"left":y={x:o.x-i.width,y:g};break;default:y={x:o.x,y:o.y}}switch(h(t)){case"start":y[r]-=w*(n&&c?-1:1);break;case"end":y[r]+=w*(n&&c?-1:1)}return y}async function b(e,t){var n;void 0===t&&(t={});const{x:o,y:i,platform:s,rects:r,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=d(t,e),m=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(f),g=l[p?"floating"===h?"reference":"floating":h],w=y(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(g)))||n?g:g.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v="floating"===h?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,b=await(null==s.getOffsetParent?void 0:s.getOffsetParent(l.floating)),x=await(null==s.isElement?void 0:s.isElement(b))&&await(null==s.getScale?void 0:s.getScale(b))||{x:1,y:1},C=y(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:a}):v);return{top:(w.top-C.top+m.top)/x.y,bottom:(C.bottom-w.bottom+m.bottom)/x.y,left:(w.left-C.left+m.left)/x.x,right:(C.right-w.right+m.right)/x.x}}function x(){return"undefined"!=typeof window}function C(e){return A(e)?(e.nodeName||"").toLowerCase():"#document"}function E(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function L(e){var t;return null==(t=(A(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function A(e){return!!x()&&(e instanceof Node||e instanceof E(e).Node)}function T(e){return!!x()&&(e instanceof Element||e instanceof E(e).Element)}function S(e){return!!x()&&(e instanceof HTMLElement||e instanceof E(e).HTMLElement)}function O(e){return!(!x()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof E(e).ShadowRoot)}function P(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=F(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(i)}function k(e){return["table","td","th"].includes(C(e))}function D(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function R(e){const t=M(),n=T(e)?F(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function M(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function I(e){return["html","body","#document"].includes(C(e))}function F(e){return E(e).getComputedStyle(e)}function K(e){return T(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function H(e){if("html"===C(e))return e;const t=e.assignedSlot||e.parentNode||O(e)&&e.host||L(e);return O(t)?t.host:t}function V(e){const t=H(e);return I(t)?e.ownerDocument?e.ownerDocument.body:e.body:S(t)&&P(t)?t:V(t)}function $(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=V(e),s=i===(null==(o=e.ownerDocument)?void 0:o.body),r=E(i);if(s){const e=U(r);return t.concat(r,r.visualViewport||[],P(i)?i:[],e&&n?$(e):[])}return t.concat(i,$(i,[],n))}function U(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q(e){const t=F(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=S(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,a=s(n)!==r||s(o)!==l;return a&&(n=r,o=l),{width:n,height:o,$:a}}function N(e){return T(e)?e:e.contextElement}function W(e){const t=N(e);if(!S(t))return l(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=q(t);let a=(r?s(n.width):n.width)/o,c=(r?s(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),c&&Number.isFinite(c)||(c=1),{x:a,y:c}}const B=l(0);function j(e){const t=E(e);return M()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:B}function z(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),s=N(e);let r=l(1);t&&(o?T(o)&&(r=W(o)):r=W(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==E(e))&&t}(s,n,o)?j(s):l(0);let c=(i.left+a.x)/r.x,d=(i.top+a.y)/r.y,u=i.width/r.x,h=i.height/r.y;if(s){const e=E(s),t=o&&T(o)?E(o):o;let n=e,i=U(n);for(;i&&o&&t!==n;){const e=W(i),t=i.getBoundingClientRect(),o=F(i),s=t.left+(i.clientLeft+parseFloat(o.paddingLeft))*e.x,r=t.top+(i.clientTop+parseFloat(o.paddingTop))*e.y;c*=e.x,d*=e.y,u*=e.x,h*=e.y,c+=s,d+=r,n=E(i),i=U(n)}}return y({width:u,height:h,x:c,y:d})}function X(e,t){const n=K(e).scrollLeft;return t?t.left+n:z(L(e)).left+n}function G(e,t,n){void 0===n&&(n=!1);const o=e.getBoundingClientRect();return{x:o.left+t.scrollLeft-(n?0:X(e,o)),y:o.top+t.scrollTop}}function _(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=E(e),o=L(e),i=n.visualViewport;let s=o.clientWidth,r=o.clientHeight,l=0,a=0;if(i){s=i.width,r=i.height;const e=M();(!e||e&&"fixed"===t)&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:r,x:l,y:a}}(e,n);else if("document"===t)o=function(e){const t=L(e),n=K(e),o=e.ownerDocument.body,s=i(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=i(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+X(e);const a=-n.scrollTop;return"rtl"===F(o).direction&&(l+=i(t.clientWidth,o.clientWidth)-s),{width:s,height:r,x:l,y:a}}(L(e));else if(T(t))o=function(e,t){const n=z(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,s=S(e)?W(e):l(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:i*s.x,y:o*s.y}}(t,n);else{const n=j(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return y(o)}function Y(e,t){const n=H(e);return!(n===t||!T(n)||I(n))&&("fixed"===F(n).position||Y(n,t))}function J(e,t,n){const o=S(t),i=L(t),s="fixed"===n,r=z(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=l(0);if(o||!o&&!s)if(("body"!==C(t)||P(i))&&(a=K(t)),o){const e=z(t,!0,s,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&(c.x=X(i));const d=!i||o||s?l(0):G(i,a);return{x:r.left+a.scrollLeft-c.x-d.x,y:r.top+a.scrollTop-c.y-d.y,width:r.width,height:r.height}}function Z(e){return"static"===F(e).position}function Q(e,t){if(!S(e)||"fixed"===F(e).position)return null;if(t)return t(e);let n=e.offsetParent;return L(e)===n&&(n=n.ownerDocument.body),n}function ee(e,t){const n=E(e);if(D(e))return n;if(!S(e)){let t=H(e);for(;t&&!I(t);){if(T(t)&&!Z(t))return t;t=H(t)}return n}let o=Q(e,t);for(;o&&k(o)&&Z(o);)o=Q(o,t);return o&&I(o)&&Z(o)&&!R(o)?n:o||function(e){let t=H(e);for(;S(t)&&!I(t);){if(R(t))return t;if(D(t))return null;t=H(t)}return null}(e)||n}const te={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const s="fixed"===i,r=L(o),a=!!t&&D(t.floating);if(o===r||a&&s)return n;let c={scrollLeft:0,scrollTop:0},d=l(1);const u=l(0),h=S(o);if((h||!h&&!s)&&(("body"!==C(o)||P(r))&&(c=K(o)),S(o))){const e=z(o);d=W(o),u.x=e.x+o.clientLeft,u.y=e.y+o.clientTop}const p=!r||h||s?l(0):G(r,c,!0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:n.y*d.y-c.scrollTop*d.y+u.y+p.y}},getDocumentElement:L,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const l=[..."clippingAncestors"===n?D(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=$(e,[],!1).filter((e=>T(e)&&"body"!==C(e))),i=null;const s="fixed"===F(e).position;let r=s?H(e):e;for(;T(r)&&!I(r);){const t=F(r),n=R(r);n||"fixed"!==t.position||(i=null),(s?!n&&!i:!n&&"static"===t.position&&i&&["absolute","fixed"].includes(i.position)||P(r)&&!n&&Y(e,r))?o=o.filter((e=>e!==r)):i=t,r=H(r)}return t.set(e,o),o}(t,this._c):[].concat(n),s],a=l[0],c=l.reduce(((e,n)=>{const s=_(t,n,r);return e.top=i(s.top,e.top),e.right=o(s.right,e.right),e.bottom=o(s.bottom,e.bottom),e.left=i(s.left,e.left),e}),_(t,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ee,getElementRects:async function(e){const t=this.getOffsetParent||ee,n=this.getDimensions,o=await n(e.floating);return{reference:J(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=q(e);return{width:t,height:n}},getScale:W,isElement:T,isRTL:function(e){return"rtl"===F(e).direction}};function ne(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function oe(e,t,n,s){void 0===s&&(s={});const{ancestorScroll:l=!0,ancestorResize:a=!0,elementResize:c="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:u=!1}=s,h=N(e),p=l||a?[...h?$(h):[],...$(t)]:[];p.forEach((e=>{l&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)}));const f=h&&d?function(e,t){let n,s=null;const l=L(e);function a(){var e;clearTimeout(n),null==(e=s)||e.disconnect(),s=null}return function c(d,u){void 0===d&&(d=!1),void 0===u&&(u=1),a();const h=e.getBoundingClientRect(),{left:p,top:f,width:m,height:g}=h;if(d||t(),!m||!g)return;const w={rootMargin:-r(f)+"px "+-r(l.clientWidth-(p+m))+"px "+-r(l.clientHeight-(f+g))+"px "+-r(p)+"px",threshold:i(0,o(1,u))||1};let y=!0;function v(t){const o=t[0].intersectionRatio;if(o!==u){if(!y)return c();o?c(!1,o):n=setTimeout((()=>{c(!1,1e-7)}),1e3)}1!==o||ne(h,e.getBoundingClientRect())||c(),y=!1}try{s=new IntersectionObserver(v,{...w,root:l.ownerDocument})}catch(e){s=new IntersectionObserver(v,w)}s.observe(e)}(!0),a}(h,n):null;let m,g=-1,w=null;c&&(w=new ResizeObserver((e=>{let[o]=e;o&&o.target===h&&w&&(w.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame((()=>{var e;null==(e=w)||e.observe(t)}))),n()})),h&&!u&&w.observe(h),w.observe(t));let y=u?z(e):null;return u&&function t(){const o=z(e);y&&!ne(y,o)&&n();y=o,m=requestAnimationFrame(t)}(),n(),()=>{var e;p.forEach((e=>{l&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)})),null==f||f(),null==(e=w)||e.disconnect(),w=null,u&&cancelAnimationFrame(m)}}const ie=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:s,placement:r,middlewareData:l}=t,a=await async function(e,t){const{placement:n,platform:o,elements:i}=e,s=await(null==o.isRTL?void 0:o.isRTL(i.floating)),r=u(n),l=h(n),a="y"===f(n),c=["left","top"].includes(r)?-1:1,p=s&&a?-1:1,m=d(t,e);let{mainAxis:g,crossAxis:w,alignmentAxis:y}="number"==typeof m?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&"number"==typeof y&&(w="end"===l?-1*y:y),a?{x:w*p,y:g*c}:{x:g*c,y:w*p}}(t,e);return r===(null==(n=l.offset)?void 0:n.placement)&&null!=(o=l.arrow)&&o.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:r}}}}},se=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:x,fallbackStrategy:C="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:L=!0,...A}=d(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const T=u(i),S=f(l),O=u(l)===l,P=await(null==a.isRTL?void 0:a.isRTL(c.floating)),k=x||(O||!L?[w(l)]:function(e){const t=w(e);return[g(e),t,g(t)]}(l)),D="none"!==E;!x&&D&&k.push(...function(e,t,n,o){const i=h(e);let s=function(e,t,n){const o=["left","right"],i=["right","left"],s=["top","bottom"],r=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:o:t?o:i;case"left":case"right":return t?s:r;default:return[]}}(u(e),"start"===n,o);return i&&(s=s.map((e=>e+"-"+i)),t&&(s=s.concat(s.map(g)))),s}(l,L,E,P));const R=[l,...k],M=await b(t,A),I=[];let F=(null==(o=s.flip)?void 0:o.overflows)||[];if(y&&I.push(M[T]),v){const e=function(e,t,n){void 0===n&&(n=!1);const o=h(e),i=m(e),s=p(i);let r="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=w(r)),[r,w(r)]}(i,r,P);I.push(M[e[0]],M[e[1]])}if(F=[...F,{placement:i,overflows:I}],!I.every((e=>e<=0))){var K,H;const e=((null==(K=s.flip)?void 0:K.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:F},reset:{placement:t}};let n=null==(H=F.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:H.placement;if(!n)switch(C){case"bestFit":{var V;const e=null==(V=F.filter((e=>{if(D){const t=f(e.placement);return t===S||"y"===t}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])?void 0:V[0];e&&(n=e);break}case"initialPlacement":n=l}if(i!==n)return{reset:{placement:n}}}return{}}}},re=(e,t,n)=>{const o=new Map,i={platform:te,...n},s={...i.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,l=s.filter(Boolean),a=await(null==r.isRTL?void 0:r.isRTL(t));let c=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=v(c,o,a),h=o,p={},f=0;for(let n=0;n<l.length;n++){const{name:s,fn:m}=l[n],{x:g,y:w,data:y,reset:b}=await m({x:d,y:u,initialPlacement:o,placement:h,strategy:i,middlewareData:p,rects:c,platform:r,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=w?w:u,p={...p,[s]:{...p[s],...y}},b&&f<=50&&(f++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await r.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:d,y:u}=v(c,h,a))),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:p}})(e,t,{...i,platform:s})}},862:(e,t,n)=>{n.d(t,{A:()=>o});const o=class{constructor(){this.components=[],this.currentlyOpenedComponents=[],this.activeComponent=null,this.allowedKeybindings=new Set(["Escape","Enter"," ","Space","ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Tab","Home","End"]),this.initGlobalListeners()}initGlobalListeners(){document.addEventListener("keydown",(e=>this.handleGlobalKeydown(e))),document.addEventListener("focusin",(e=>this.handleGlobalFocusin(e)))}isAllowedKeybinding(e){return!!this.allowedKeybindings.has(e.key)||!(1!==e.key.length||!/^[a-zA-Z]$/.test(e.key)||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)}getActiveComponent(e){if(!e)return null;const t=this.components.filter((t=>t.wrapper.contains(e)||t.context&&t.context.contains(e)));if(0===t.length)return null;if(1===t.length)return t[0];let n=null,o=Number.MAX_SAFE_INTEGER;for(const i of t){let t=0,s=e;for(;s&&s!==i.wrapper&&s!==i.context;)t++,s=s.parentElement;t<o&&(o=t,n=i)}return n}handleGlobalFocusin(e){const t=e.target;this.activeComponent=this.getActiveComponent(t)}handleGlobalKeydown(e){const t=e.target;if(this.activeComponent=this.getActiveComponent(t),this.activeComponent&&this.isAllowedKeybinding(e))switch(e.key){case"Escape":if(this.activeComponent.isOpened)this.activeComponent.handlers.onEsc&&(this.activeComponent.handlers.onEsc(),e.preventDefault(),e.stopPropagation());else{const n=this.findClosestOpenParent(t);(null==n?void 0:n.handlers.onEsc)&&(n.handlers.onEsc(),e.preventDefault(),e.stopPropagation())}break;case"Enter":this.activeComponent.handlers.onEnter&&(this.activeComponent.handlers.onEnter(),e.preventDefault(),e.stopPropagation());break;case" ":case"Space":if("INPUT"===t.tagName||"TEXTAREA"===t.tagName)return;this.activeComponent.handlers.onSpace&&(this.activeComponent.handlers.onSpace(),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":if(this.activeComponent.handlers.onArrow){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;this.activeComponent.handlers.onArrow(e),e.preventDefault(),e.stopPropagation()}break;case"Tab":if(!this.activeComponent.handlers.onTab)break;const n=e.shiftKey?this.activeComponent.handlers.onShiftTab:this.activeComponent.handlers.onTab;n&&n();break;case"Home":this.activeComponent.handlers.onHome&&(this.activeComponent.handlers.onHome(),e.preventDefault(),e.stopPropagation());break;case"End":this.activeComponent.handlers.onEnd&&(this.activeComponent.handlers.onEnd(),e.preventDefault(),e.stopPropagation());break;default:this.activeComponent.handlers.onFirstLetter&&1===e.key.length&&/^[a-zA-Z]$/.test(e.key)&&(this.activeComponent.handlers.onFirstLetter(e.key),e.preventDefault(),e.stopPropagation())}}findClosestOpenParent(e){let t=e.parentElement;for(;t;){const e=this.currentlyOpenedComponents.find((e=>e.wrapper===t&&e!==this.activeComponent));if(e)return e;t=t.parentElement}return null}registerComponent(e,t,n=!0,o="",i="",s){const r={wrapper:e,handlers:t,isOpened:n,name:o,selector:i,context:s,isRegistered:!0};return this.components.push(r),r}updateComponentState(e,t){e.isOpened=t,t?this.currentlyOpenedComponents.includes(e)||this.currentlyOpenedComponents.push(e):this.currentlyOpenedComponents=this.currentlyOpenedComponents.filter((t=>t!==e))}unregisterComponent(e){this.components=this.components.filter((t=>t!==e)),this.currentlyOpenedComponents=this.currentlyOpenedComponents.filter((t=>t!==e))}addAllowedKeybinding(e){this.allowedKeybindings.add(e)}removeAllowedKeybinding(e){this.allowedKeybindings.delete(e)}getAllowedKeybindings(){return Array.from(this.allowedKeybindings)}}},926:(e,t,n)=>{n.d(t,{BF:()=>s,JD:()=>a,PK:()=>o,gj:()=>i,un:()=>r,yd:()=>c,zG:()=>l});
/*
* @version: 3.2.3
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
const o=e=>"true"===e,i=(e,t,n="")=>(window.getComputedStyle(e).getPropertyValue(t)||n).replace(" ",""),s=(e,t,n="")=>{let o="";return e.classList.forEach((e=>{e.includes(t)&&(o=e)})),o.match(/:(.*)]/)?o.match(/:(.*)]/)[1]:n},r=()=>!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),l=()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),a=(e,t,n=null)=>{const o=new CustomEvent(e,{detail:{payload:n},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(o)},c=(e,t)=>{const n=()=>{t(),e.removeEventListener("transitionend",n,!0)},o=window.getComputedStyle(e),i=o.getPropertyValue("transition-duration");"none"!==o.getPropertyValue("transition-property")&&parseFloat(i)>0?e.addEventListener("transitionend",n,!0):t()}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};n.d(o,{A:()=>d});var i=n(926),s=n(663),r=n(615),l=n(862),a=n(189);
/*
* HSDropdown
* @version: 3.2.3
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
class c extends r.A{constructor(e,t,n){super(e,t,n),this.longPressTimer=null,this.openedViaKeyboard=!1,this.onTouchStartListener=null,this.onTouchEndListener=null,this.toggle=this.el.querySelector(":scope > .hs-dropdown-toggle")||this.el.querySelector(":scope > .hs-dropdown-toggle-wrapper > .hs-dropdown-toggle")||this.el.children[0],this.closers=Array.from(this.el.querySelectorAll(":scope .hs-dropdown-close"))||null,this.menu=this.el.querySelector(":scope > .hs-dropdown-menu"),this.eventMode=(0,i.gj)(this.el,"--trigger","click"),this.closeMode=(0,i.gj)(this.el,"--auto-close","true"),this.hasAutofocus=(0,i.PK)((0,i.gj)(this.el,"--has-autofocus","true")||"true"),this.autofocusOnKeyboardOnly=(0,i.PK)((0,i.gj)(this.el,"--autofocus-on-keyboard-only","true")||"true"),this.animationInProcess=!1,this.onCloserClickListener=[],this.toggle&&this.menu&&this.init()}elementMouseEnter(){this.onMouseEnterHandler()}elementMouseLeave(){this.onMouseLeaveHandler()}toggleClick(e){this.onClickHandler(e)}toggleContextMenu(e){e.preventDefault(),this.onContextMenuHandler(e)}handleTouchStart(e){this.longPressTimer=window.setTimeout((()=>{e.preventDefault();const t=e.touches[0],n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY});this.toggle&&this.toggle.dispatchEvent(n)}),400)}handleTouchEnd(e){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}closerClick(){this.close()}init(){if(this.createCollection(window.$hsDropdownCollection,this),this.toggle.disabled)return!1;this.toggle&&this.buildToggle(),this.menu&&this.buildMenu(),this.closers&&this.buildClosers(),(0,i.un)()||(0,i.zG)()||(this.onElementMouseEnterListener=()=>this.elementMouseEnter(),this.onElementMouseLeaveListener=()=>this.elementMouseLeave(),this.el.addEventListener("mouseenter",this.onElementMouseEnterListener),this.el.addEventListener("mouseleave",this.onElementMouseLeaveListener)),"undefined"!=typeof window&&(window.HSAccessibilityObserver||(window.HSAccessibilityObserver=new l.A),this.setupAccessibility())}resizeHandler(){this.eventMode=(0,i.gj)(this.el,"--trigger","click"),this.closeMode=(0,i.gj)(this.el,"--auto-close","true"),this.hasAutofocus=(0,i.PK)((0,i.gj)(this.el,"--has-autofocus","true")||"true"),this.autofocusOnKeyboardOnly=(0,i.PK)((0,i.gj)(this.el,"--autofocus-on-keyboard-only","true")||"true")}isOpen(){return this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")}buildToggle(){var e;(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.el.classList.contains("open")?this.toggle.ariaExpanded="true":this.toggle.ariaExpanded="false"),"contextmenu"===this.eventMode?(this.onToggleContextMenuListener=e=>this.toggleContextMenu(e),this.onTouchStartListener=this.handleTouchStart.bind(this),this.onTouchEndListener=this.handleTouchEnd.bind(this),this.toggle.addEventListener("contextmenu",this.onToggleContextMenuListener),this.toggle.addEventListener("touchstart",this.onTouchStartListener,{passive:!1}),this.toggle.addEventListener("touchend",this.onTouchEndListener),this.toggle.addEventListener("touchmove",this.onTouchEndListener)):(this.onToggleClickListener=e=>this.toggleClick(e),this.toggle.addEventListener("click",this.onToggleClickListener))}buildMenu(){this.menu.role=this.menu.getAttribute("role")||"menu",this.menu.tabIndex=-1;const e=this.menu.querySelectorAll('[role="menuitemcheckbox"]'),t=this.menu.querySelectorAll('[role="menuitemradio"]');e.forEach((e=>e.addEventListener("click",(()=>this.selectCheckbox(e))))),t.forEach((e=>e.addEventListener("click",(()=>this.selectRadio(e))))),this.menu.addEventListener("click",(e=>{const t=e.target;"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||"BUTTON"===t.tagName||"A"===t.tagName||t.closest("button")||t.closest("a")||t.closest("input")||t.closest("textarea")||t.closest("select")||this.menu.focus()}))}buildClosers(){this.closers.forEach((e=>{this.onCloserClickListener.push({el:e,fn:()=>this.closerClick()}),e.addEventListener("click",this.onCloserClickListener.find((t=>t.el===e)).fn)}))}getScrollbarSize(){let e=document.createElement("div");e.style.overflow="scroll",e.style.width="100px",e.style.height="100px",document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}onContextMenuHandler(e){const t={getBoundingClientRect:(()=>new DOMRect,()=>new DOMRect(e.clientX,e.clientY,0,0))};c.closeCurrentlyOpened(),this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")?(this.close(),document.body.style.overflow="",document.body.style.paddingRight=""):(document.body.style.overflow="hidden",document.body.style.paddingRight=`${this.getScrollbarSize()}px`,this.open(t))}onClickHandler(e){var t;if("hover"===this.eventMode&&window.matchMedia("(hover: hover)").matches&&"mouse"===e.pointerType){const n=e.currentTarget;return"A"===n.tagName&&n.hasAttribute("href")&&"#"!==n.getAttribute("href")||(e.preventDefault(),e.stopPropagation(),null===(t=e.stopImmediatePropagation)||void 0===t||t.call(e)),!1}this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")?this.close():this.open()}onMouseEnterHandler(){if("hover"!==this.eventMode)return!1;(!this.el._floatingUI||this.el._floatingUI&&!this.el.classList.contains("open"))&&this.forceClearState(),!this.el.classList.contains("open")&&this.menu.classList.contains("hidden")&&this.open()}onMouseLeaveHandler(){if("hover"!==this.eventMode)return!1;this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")&&this.close()}destroyFloatingUI(){const e=(window.getComputedStyle(this.el).getPropertyValue("--scope")||"").trim();this.menu.classList.remove("block"),this.menu.classList.add("hidden"),this.menu.style.inset=null,this.menu.style.position=null,this.el&&this.el._floatingUI&&(this.el._floatingUI.destroy(),this.el._floatingUI=null),"window"===e&&this.el.appendChild(this.menu),this.animationInProcess=!1}focusElement(){const e=this.menu.querySelector("[autofocus]");if(e)return e.focus(),!0;const t=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden])');if(t.length>0){return t[0].focus(),!0}return!1}setupFloatingUI(e){const t=e||this.el,n=window.getComputedStyle(this.el),o=(n.getPropertyValue("--placement")||"").trim(),i=(n.getPropertyValue("--flip")||"true").trim(),r=(n.getPropertyValue("--strategy")||"fixed").trim(),l=(n.getPropertyValue("--offset")||"10").trim(),c=(n.getPropertyValue("--gpu-acceleration")||"true").trim(),d=(window.getComputedStyle(this.el).getPropertyValue("--adaptive")||"adaptive").replace(" ",""),u=r,h=parseInt(l,10),p=a.lP[o]||"bottom-start",f=[..."true"===i?[(0,s.UU)()]:[],(0,s.cY)(h)],m={placement:p,strategy:u,middleware:f},g=e=>{const t=this.menu.getBoundingClientRect(),n=window.innerWidth-(window.innerWidth-document.documentElement.clientWidth);return e+t.width>n&&(e=n-t.width),e<0&&(e=0),e},w=()=>{(0,s.rD)(t,this.menu,m).then((({x:e,y:t,placement:n})=>{const o=g(e);"absolute"===u&&"none"===d?Object.assign(this.menu.style,{position:u,margin:"0"}):"absolute"===u?Object.assign(this.menu.style,{position:u,transform:`translate3d(${e}px, ${t}px, 0px)`,margin:"0"}):"true"===c?Object.assign(this.menu.style,{position:u,left:"",top:"",inset:"0px auto auto 0px",margin:"0",transform:`translate3d(${"adaptive"===d?o:0}px, ${t}px, 0)`}):Object.assign(this.menu.style,{position:u,left:`${e}px`,top:`${t}px`,transform:""}),this.menu.setAttribute("data-placement",n)}))};w();return{update:w,destroy:(0,s.ll)(t,this.menu,w)}}selectCheckbox(e){e.ariaChecked="true"===e.ariaChecked?"false":"true"}selectRadio(e){if("true"===e.ariaChecked)return!1;const t=e.closest(".group").querySelectorAll('[role="menuitemradio"]');Array.from(t).filter((t=>t!==e)).forEach((e=>{e.ariaChecked="false"})),e.ariaChecked="true"}calculatePopperPosition(e){const t=this.setupFloatingUI(e),n=this.menu.getAttribute("data-placement");return t.update(),t.destroy(),n}open(e,t=!1){if(this.el.classList.contains("open")||this.animationInProcess)return!1;this.openedViaKeyboard=t,this.animationInProcess=!0,this.menu.style.cssText="";const n=e||this.el,o=window.getComputedStyle(this.el),s=(o.getPropertyValue("--scope")||"").trim(),r=(o.getPropertyValue("--strategy")||"fixed").trim();"window"===s&&document.body.appendChild(this.menu),"static"!==r&&(this.el._floatingUI=this.setupFloatingUI(n)),this.menu.style.margin=null,this.menu.classList.remove("hidden"),this.menu.classList.add("block"),setTimeout((()=>{var e;(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="true"),this.el.classList.add("open"),window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!0),"window"===s&&this.menu.classList.add("open"),this.animationInProcess=!1,!this.hasAutofocus||this.autofocusOnKeyboardOnly&&!this.openedViaKeyboard||this.focusElement(),this.fireEvent("open",this.el),(0,i.JD)("open.hs.dropdown",this.el,this.el)}))}close(e=!0){if(this.animationInProcess||!this.el.classList.contains("open"))return!1;const t=(window.getComputedStyle(this.el).getPropertyValue("--scope")||"").trim();if(this.animationInProcess=!0,"window"===t&&this.menu.classList.remove("open"),window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!1),e){const e=this.el.querySelector("[data-hs-dropdown-transition]")||this.menu;let t=!1;const n=()=>{t||(t=!0,this.destroyFloatingUI())};(0,i.yd)(e,n);const o=window.getComputedStyle(e).getPropertyValue("transition-duration"),s=1e3*parseFloat(o)||150;setTimeout(n,s+50)}else this.destroyFloatingUI();(()=>{var e;this.menu.style.margin=null,(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="false"),this.el.classList.remove("open"),this.openedViaKeyboard=!1,this.fireEvent("close",this.el),(0,i.JD)("close.hs.dropdown",this.el,this.el)})()}forceClearState(){this.destroyFloatingUI(),this.menu.style.margin=null,this.el.classList.remove("open"),this.menu.classList.add("hidden"),this.openedViaKeyboard=!1}destroy(){(0,i.un)()||(0,i.zG)()||(this.el.removeEventListener("mouseenter",this.onElementMouseEnterListener),this.el.removeEventListener("mouseleave",(()=>this.onElementMouseLeaveListener)),this.onElementMouseEnterListener=null,this.onElementMouseLeaveListener=null),"contextmenu"===this.eventMode?(this.toggle&&(this.toggle.removeEventListener("contextmenu",this.onToggleContextMenuListener),this.toggle.removeEventListener("touchstart",this.onTouchStartListener),this.toggle.removeEventListener("touchend",this.onTouchEndListener),this.toggle.removeEventListener("touchmove",this.onTouchEndListener)),this.onToggleContextMenuListener=null,this.onTouchStartListener=null,this.onTouchEndListener=null):(this.toggle&&this.toggle.removeEventListener("click",this.onToggleClickListener),this.onToggleClickListener=null),this.closers.length&&(this.closers.forEach((e=>{e.removeEventListener("click",this.onCloserClickListener.find((t=>t.el===e)).fn)})),this.onCloserClickListener=null),this.el.classList.remove("open"),this.destroyFloatingUI(),window.$hsDropdownCollection=window.$hsDropdownCollection.filter((({element:e})=>e.el!==this.el))}static findInCollection(e){return window.$hsDropdownCollection.find((t=>e instanceof c?t.element.el===e.el:"string"==typeof e?t.element.el===document.querySelector(e):t.element.el===e))||null}static getInstance(e,t){const n=window.$hsDropdownCollection.find((t=>t.element.el===("string"==typeof e?document.querySelector(e):e)));return n?t?n:n.element:null}static autoInit(){if(!window.$hsDropdownCollection){window.$hsDropdownCollection=[],window.addEventListener("click",(e=>{const t=e.target;c.closeCurrentlyOpened(t)}));let e=window.innerWidth;window.addEventListener("resize",(()=>{window.innerWidth!==e&&(e=innerWidth,c.closeCurrentlyOpened(null,!1))}))}window.$hsDropdownCollection&&(window.$hsDropdownCollection=window.$hsDropdownCollection.filter((({element:e})=>document.contains(e.el)))),document.querySelectorAll(".hs-dropdown:not(.--prevent-on-load-init)").forEach((e=>{window.$hsDropdownCollection.find((t=>{var n;return(null===(n=null==t?void 0:t.element)||void 0===n?void 0:n.el)===e}))||new c(e)}))}static open(e,t=!1){const n=c.findInCollection(e);n&&n.element.menu.classList.contains("hidden")&&n.element.open(void 0,t)}static close(e){const t=c.findInCollection(e);t&&!t.element.menu.classList.contains("hidden")&&t.element.close()}static closeCurrentlyOpened(e=null,t=!0){const n=e&&e.closest(".hs-dropdown")&&e.closest(".hs-dropdown").parentElement.closest(".hs-dropdown")?e.closest(".hs-dropdown").parentElement.closest(".hs-dropdown"):null;let o=n?window.$hsDropdownCollection.filter((e=>e.element.el.classList.contains("open")&&e.element.menu.closest(".hs-dropdown").parentElement.closest(".hs-dropdown")===n)):window.$hsDropdownCollection.filter((e=>e.element.el.classList.contains("open")));if(e){const t=e.closest(".hs-dropdown");if(t)"inside"===(0,i.BF)(t,"--auto-close")&&(o=o.filter((e=>e.element.el!==t)));else{const t=e.closest(".hs-dropdown-menu");if(t){const e=window.$hsDropdownCollection.find((e=>e.element.menu===t));e&&"inside"===(0,i.BF)(e.element.el,"--auto-close")&&(o=o.filter((t=>t.element.el!==e.element.el)))}}}o&&o.forEach((e=>{if("false"===e.element.closeMode||"outside"===e.element.closeMode)return!1;e.element.close(t)})),o&&o.forEach((e=>{if("contextmenu"!==(0,i.BF)(e.element.el,"--trigger"))return!1;document.body.style.overflow="",document.body.style.paddingRight=""}))}setupAccessibility(){this.accessibilityComponent=window.HSAccessibilityObserver.registerComponent(this.el,{onEnter:()=>{this.isOpened()||this.open(void 0,!0)},onSpace:()=>{this.isOpened()||this.open(void 0,!0)},onEsc:()=>{this.isOpened()&&(this.close(),this.toggle&&this.toggle.focus())},onArrow:e=>{if(!e.metaKey)switch(e.key){case"ArrowDown":this.isOpened()?this.focusMenuItem("next"):this.open(void 0,!0);break;case"ArrowUp":this.isOpened()&&this.focusMenuItem("prev");break;case"ArrowRight":this.onArrowX(e,"right");break;case"ArrowLeft":this.onArrowX(e,"left")}},onHome:()=>{this.isOpened()&&this.onStartEnd(!0)},onEnd:()=>{this.isOpened()&&this.onStartEnd(!1)},onTab:()=>{this.isOpened()&&this.close()},onFirstLetter:e=>{this.isOpened()&&this.onFirstLetter(e)}},this.isOpened(),"Dropdown",".hs-dropdown",this.menu)}onFirstLetter(e){var t;if(!this.isOpened()||!this.menu)return;const n=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden])');if(0===n.length)return;const o=Array.from(n).indexOf(document.activeElement);for(let i=1;i<=n.length;i++){const s=(o+i)%n.length;if(((null===(t=n[s].textContent)||void 0===t?void 0:t.trim().toLowerCase())||"").startsWith(e.toLowerCase()))return void n[s].focus()}n[0].focus()}onArrowX(e,t){if(!this.isOpened())return;e.preventDefault(),e.stopImmediatePropagation();const n=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden])');if(!n.length)return;const o=Array.from(n).indexOf(document.activeElement);let i=-1;i="right"===t?(o+1)%n.length:o>0?o-1:n.length-1,n[i].focus()}onStartEnd(e=!0){if(!this.isOpened())return;const t=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden])');if(!t.length)return;t[e?0:t.length-1].focus()}focusMenuItem(e){const t=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden])');if(!t.length)return;const n=Array.from(t).indexOf(document.activeElement);t["next"===e?(n+1)%t.length:(n-1+t.length)%t.length].focus()}static on(e,t,n){const o=c.findInCollection(t);o&&(o.element.events[e]=n)}isOpened(){return this.isOpen()}containsElement(e){return this.el.contains(e)}}window.addEventListener("load",(()=>{c.autoInit()})),window.addEventListener("resize",(()=>{window.$hsDropdownCollection||(window.$hsDropdownCollection=[]),window.$hsDropdownCollection.forEach((e=>e.element.resizeHandler()))})),"undefined"!=typeof window&&(window.HSDropdown=c);const d=c;var u=o.A;export{u as default};