/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/next-popover@0.0.41/dist/popover.es.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.id="next-popover-style",t.appendChild(document.createTextNode('#next-popover{position:absolute;left:0;top:0;z-index:5555}.popover-wrapper{position:relative;box-sizing:content-box;border-radius:6px;box-shadow:0 -2px 16px #00000014,0 3px 6px -4px #0000001f,0 9px 28px 8px #0000000d}.popover-wrapper .popover-arrow{position:absolute}.popover-wrapper .popover-arrow .popover-arrow-inner{position:absolute;width:11.3137085px;height:11.3137085px;margin:auto;border-radius:0 0 3px;pointer-events:auto}.popover-wrapper .popover-arrow .popover-arrow-inner:before{display:block;content:"";position:absolute;top:-11.3137085px;left:-11.3137085px;width:22.627417px;height:22.627417px;background-repeat:no-repeat;background-position:-10px -10px;-webkit-clip-path:inset(33% 33%);clip-path:inset(33% 33%);-webkit-clip-path:path("M 9.849242404917499 24.091883092036785 A 5 5 0 0 1 13.384776310850237 22.627416997969522 L 20.627416997969522 22.627416997969522 A 2 2 0 0 0 22.627416997969522 20.627416997969522 L 22.627416997969522 13.384776310850237 A 5 5 0 0 1 24.091883092036785 9.849242404917499 L 23.091883092036785 9.849242404917499 L 9.849242404917499 23.091883092036785 Z");clip-path:path("M 9.849242404917499 24.091883092036785 A 5 5 0 0 1 13.384776310850237 22.627416997969522 L 20.627416997969522 22.627416997969522 A 2 2 0 0 0 22.627416997969522 20.627416997969522 L 22.627416997969522 13.384776310850237 A 5 5 0 0 1 24.091883092036785 9.849242404917499 L 23.091883092036785 9.849242404917499 L 9.849242404917499 23.091883092036785 Z")}.popover-wrapper.placement__top .popover-arrow,.popover-wrapper.placement__top-start .popover-arrow,.popover-wrapper.placement__top-end .popover-arrow{width:16px;height:8px;overflow-y:clip}.popover-wrapper.placement__top .popover-arrow>.popover-arrow-inner,.popover-wrapper.placement__top-start .popover-arrow>.popover-arrow-inner,.popover-wrapper.placement__top-end .popover-arrow>.popover-arrow-inner{transform:translate(2.4px,-6px) rotate(45deg)}.popover-wrapper.placement__right .popover-arrow,.popover-wrapper.placement__right-start .popover-arrow,.popover-wrapper.placement__right-end .popover-arrow{width:8px;height:16px;overflow-x:clip}.popover-wrapper.placement__right .popover-arrow .popover-arrow-inner,.popover-wrapper.placement__right-start .popover-arrow .popover-arrow-inner,.popover-wrapper.placement__right-end .popover-arrow .popover-arrow-inner{transform:translate(2px,2.6px) rotate(135deg)}.popover-wrapper.placement__bottom .popover-arrow,.popover-wrapper.placement__bottom-start .popover-arrow,.popover-wrapper.placement__bottom-end .popover-arrow{width:16px;height:8px;overflow-y:clip}.popover-wrapper.placement__bottom .popover-arrow .popover-arrow-inner,.popover-wrapper.placement__bottom-start .popover-arrow .popover-arrow-inner,.popover-wrapper.placement__bottom-end .popover-arrow .popover-arrow-inner{transform:translate(2.4px,2.4px) rotate(225deg)}.popover-wrapper.placement__left .popover-arrow,.popover-wrapper.placement__left-start .popover-arrow,.popover-wrapper.placement__left-end .popover-arrow{width:8px;height:16px;overflow-x:clip}.popover-wrapper.placement__left .popover-arrow .popover-arrow-inner,.popover-wrapper.placement__left-start .popover-arrow .popover-arrow-inner,.popover-wrapper.placement__left-end .popover-arrow .popover-arrow-inner{transform:translate(-6px,2.4px) rotate(315deg)}.popover-wrapper .popover-content{padding:8px 12px}.popover-wrapper.mode__light{background-color:#fff;color:#000c}.popover-wrapper.mode__light .popover-arrow-inner{--arrow-background-color: linear-gradient( to right bottom, rgba(255, 255, 255, .75), rgba(255, 255, 255, .85) )}.popover-wrapper.mode__light .popover-arrow-inner:before{background:var(--arrow-background-color)}.popover-wrapper.mode__dark{background-color:#000c;color:#ffffffe6}.popover-wrapper.mode__dark .popover-arrow-inner{--arrow-background-color: linear-gradient( to right bottom, rgba(0, 0, 0, .7), rgba(0, 0, 0, .8) )}.popover-wrapper.mode__dark .popover-arrow-inner:before{background:var(--arrow-background-color)}.fade-enter-from,.fade-exit-to{opacity:0;transform:scale(.7)}.fade-enter-active,.fade-exit-active{transition:transform .1s cubic-bezier(.34,.69,.1,1),opacity .1s ease}')),document.head.appendChild(t)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();var Ee=Object.defineProperty,ve=(t,e,o)=>e in t?Ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Z=(t,e,o)=>(ve(t,"symbol"!=typeof e?e+"":e,o),o),Yt=(t,e,o)=>{if(!e.has(t))throw TypeError("Cannot "+o)},n=(t,e,o)=>(Yt(t,e,"read from private field"),o?o.call(t):e.get(t)),f=(t,e,o)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,o)},A=(t,e,o,r)=>(Yt(t,e,"write to private field"),r?r.call(t,o):e.set(t,o),o),u=(t,e,o)=>(Yt(t,e,"access private method"),o);function ct(t){if("string"==typeof t)return document.createElement(t);const{tagName:e,attributes:o,children:r,style:n}=t,i=document.createElement(e||"div"),s=["disabled","checked","selected"];return Object.entries(o||{}).forEach((([t,e])=>{e&&(s.includes(t)?i.setAttribute(t,"true"):i.setAttribute(t,`${e}`))})),r&&(Array.isArray(r)?r.forEach((t=>i.appendChild(t))):i.innerHTML=r.toString()),Object.entries(n||{}).forEach((([t,e])=>{"number"!=typeof t&&(i.style[t]=e)})),i}function P(t,e){if(!(t instanceof HTMLElement))throw new Error("Invalid param");Object.entries(e||{}).forEach((([e,o])=>{"number"!=typeof e&&(t.style[e]=o)}))}function xt(t,e){var o;return null==(o=window.getComputedStyle(t)[e])?void 0:o.split(", ")}function be(t){if(!(t instanceof HTMLElement))throw new Error("Invalid param");const e=getComputedStyle(t,null),o=e.getPropertyValue("width").replace(/(\d+(\.\d+)?)(px|em|rem)/g,"$1"),r=e.getPropertyValue("height").replace(/(\d+(\.\d+)?)(px|em|rem)/g,"$1");return{width:Number(o),height:Number(r)}}function jt(t,e){const o=[];for(;t instanceof HTMLElement&&t!==e;)((r=t).scrollHeight>r.offsetHeight||r.scrollWidth>r.offsetWidth)&&o.push(t),t.parentElement instanceof HTMLElement&&(t=t.parentElement);var r;return o}function ht(t){if(!t)throw new Error("Invalid param");const e=t.getBoundingClientRect(),o=void 0!==window.scrollX?window.scrollX:(document.documentElement||document.body.parentNode||document.body).scrollLeft,r=void 0!==window.scrollY?window.scrollY:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{width:e.width,height:e.height,top:e.top+r,right:e.right+o,bottom:e.bottom+r,left:e.left+o}}function zt(t){return{x:t.pageX||t.clientX+document.body.scrollLeft,y:t.pageY||t.clientY+document.body.scrollTop}}function ee(t){const e=ht(t),o=e.left,r=e.top,n=e.bottom,i=e.right;return{left:Math.trunc(o),top:Math.trunc(r),bottom:Math.trunc(n),right:Math.trunc(i)}}function we(t){if(!t)return{};const e=t.getBoundingClientRect(),o=window.innerWidth,r=window.innerHeight,n=e.left,i=e.top;return{horizontal:n>o-n-e.width?"left":"right",vertical:i>r-i-e.height?"top":"bottom"}}function Le(){const t=document.createElement("div");t.style.visibility="hidden",t.style.overflow="scroll",t.style.msOverflowStyle="scrollbar",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);const e=document.createElement("div");t.appendChild(e);const o=t.offsetWidth-e.offsetWidth,r=t.offsetHeight-e.offsetHeight;return document.body.removeChild(t),{width:o,height:r}}function Te(t){return Object.keys(t).map((e=>({name:e,value:t[e]})))}function oe(t,e,o){let r=null;return function(...n){const i=this;if(r&&clearTimeout(r),o){const o=!r;r=setTimeout((()=>{r=null}),e),o&&t.apply(i,n)}else r=setTimeout((()=>{t.apply(i,n)}),e)}}function Ce(t,e){let o=!1,r=!0;return function(...n){if(r)return r=!1,t.apply(e,n);o||(o=!0,requestAnimationFrame((()=>{t.apply(e,n),o=!1})))}}var W=(t=>(t.Top="top",t.TopStart="top-start",t.TopEnd="top-end",t.Bottom="bottom",t.BottomStart="bottom-start",t.BottomEnd="bottom-end",t.Left="left",t.LeftStart="left-start",t.LeftEnd="left-end",t.Right="right",t.RightStart="right-start",t.RightEnd="right-end",t))(W||{}),z=(t=>(t.Hover="hover",t.Click="click",t))(z||{}),Rt=(t=>(t.Light="light",t.Dark="dark",t))(Rt||{}),w=(t=>(t.Opening="ppening",t.Opened="opened",t.Closing="closing",t.Closed="closed",t))(w||{});const ie="next-popover",se="popover-wrapper",ne="popover-content",Vt="popover-arrow",re=Te(W),le={placement:W.Top,showArrow:!0,appendTo:document.body,emit:z.Click,mode:Rt.Light,animationClass:"fade",clickOutsideClose:!0,enterable:!0,openDelay:50,closeDelay:50,offset:16};var D,_,ft,dt,mt,ut,k,S,gt,pt,Ft,ae,Et,Gt,qt,ce,vt,Jt,B,F,bt,Kt,wt,Qt,Lt,Tt,Ct,tt,Dt,et,kt,yt,$t,ot,Bt,it,Pt,st,nt,Nt,Ht,rt,Mt,X,It,he,Ot,Ut,At,Xt,lt,Y,V;class $e{constructor(t){f(this,Ft),f(this,Et),f(this,qt),f(this,vt),f(this,B),f(this,bt),f(this,wt),f(this,tt),f(this,et),f(this,ot),f(this,it),f(this,nt),f(this,It),f(this,Ot),Z(this,"config"),Z(this,"triggerElement"),Z(this,"popoverElement"),Z(this,"arrowElement"),Z(this,"status",null),f(this,D,void 0),f(this,_,void 0),f(this,ft,void 0),f(this,dt,void 0),f(this,mt,void 0),f(this,ut,void 0),f(this,k,void 0),f(this,S,void 0),f(this,gt,void 0),f(this,pt,void 0),f(this,Lt,(()=>{this.status===w.Opened?this.closeWithDelay():this.openWithDelay()})),f(this,Tt,oe((()=>{this.openWithDelay()}),200)),f(this,Ct,oe((t=>{const{emit:e,enterable:o,offset:r}=this.config;if(e===z.Hover&&o){const e=zt(t),o=n(this,lt).call(this,{popElement:this.popoverElement,placement:n(this,_),offset:r||0});if(n(this,Y).call(this,e,o))return}this.closeWithDelay()}),200)),f(this,yt,(()=>{n(this,V).call(this),this.status!==w.Opened&&this.status!==w.Opening&&this.status!==w.Closing&&this.openWithDelay()})),f(this,$t,(t=>{const{trigger:e,emit:o,enterable:r,offset:i}=this.config;if(n(this,V).call(this),o===z.Hover&&r){const o=zt(t),r=ee(e),s=n(this,lt).call(this,{popElement:this.popoverElement,placement:n(this,_),offset:i||0}),a=n(this,Y).call(this,o,r),p=n(this,Y).call(this,o,s);if(a||p)return}this.closeWithDelay()})),f(this,st,Ce((()=>{this.config.closeOnScroll?this.close():this.update()}),300)),f(this,Ht,(({target:t})=>{const{trigger:e,clickOutsideClose:o}=this.config,{popoverWrapper:r}=u(this,B,F).call(this);if(o){if(null!=r&&r.contains(t)||e instanceof HTMLElement&&e.contains(t))return;o&&this.closeWithDelay()}})),f(this,rt,(()=>{document.removeEventListener("click",n(this,Ht))})),f(this,Mt,(t=>{const{emit:e,enterable:o,trigger:r,offset:i}=this.config;if(e===z.Hover&&o){const e=zt(t),o=ee(r);if(!n(this,Y).call(this,e,o)){const t=n(this,lt).call(this,{popElement:this.popoverElement,placement:n(this,_),offset:i||0});n(this,Y).call(this,e,t)||this.closeWithDelay()}}})),f(this,X,(()=>{document.removeEventListener("mousemove",n(this,Mt))})),f(this,At,(()=>{const{onEntered:t}=this.config,{popoverWrapper:e}=u(this,B,F).call(this),{enterActive:o,enterTo:r}=n(this,D)||{};null==e||e.classList.remove(o,r),t&&t(this)})),f(this,Xt,(()=>{const{trigger:t,triggerOpenClass:e,onClose:o,onExited:r}=this.config,{popoverWrapper:i}=u(this,B,F).call(this),{exitActive:s,exitTo:a}=n(this,D)||{};null==i||i.classList.remove(s,a),t.classList.remove(e),u(this,vt,Jt).call(this),u(this,nt,Nt).call(this),n(this,rt).call(this),n(this,X).call(this),this.status=w.Closed,o&&o(this),r&&r(this)})),f(this,lt,(({popElement:t,placement:e,offset:o=0})=>{const{Top:r,TopStart:n,TopEnd:i,Left:s,LeftStart:a,LeftEnd:p,Bottom:l,BottomStart:h,BottomEnd:c,Right:d,RightStart:f,RightEnd:m}=W,u=ht(t);let w=u.left,v=u.top,g=u.bottom,E=u.right;return(e===r||e===n||e===i)&&(g+=o),(e===l||e===h||e===c)&&(v-=o),(e===s||e===a||e===p)&&(E+=o),(e===d||e===f||e===m)&&(w-=o),{left:Math.trunc(w),top:Math.trunc(v),bottom:Math.trunc(g),right:Math.trunc(E)}})),f(this,Y,((t,e)=>{const{x:o,y:r}=t,{left:n,top:i,right:s,bottom:a}=e;return o>=n&&o<=s&&r>=i&&r<=a})),f(this,V,(()=>{clearTimeout(n(this,gt)),clearTimeout(n(this,pt))})),this.config={...le,...t,offset:t.offset&&!isNaN(t.offset)&&t.offset>=8?t.offset:le.offset,appendTo:t.appendTo||document.body};const{trigger:e,content:o}=this.config;if(!(e instanceof HTMLElement&&(o instanceof HTMLElement||"string"==typeof o||"number"==typeof o)))throw new Error("Invalid configuration");o instanceof HTMLElement&&(this.config.content=o.cloneNode(!0)),this.init()}init(){const{trigger:t,appendTo:e,defaultOpen:o}=this.config;this.triggerElement=t,u(this,Ft,ae).call(this),u(this,It,he).call(this),u(this,tt,Dt).call(this),u(this,ot,Bt).call(this),u(this,wt,Qt).call(this),A(this,k,jt(t,e)),o&&requestAnimationFrame((()=>this.open()))}open(){var t;const{config:e}=this,{trigger:o,triggerOpenClass:r,animationClass:i,appendTo:s,placement:a,offset:p,onBeforeEnter:l,onOpen:h}=this.config,{popoverWrapper:c}=u(this,B,F).call(this);if(e.disabled||this.status===w.Opening||this.status===w.Opened||this.status===w.Closing)return;if("function"==typeof l&&l(this),this.cleanup(),this.status=w.Opening,r&&o.classList.add(r),null==c||c.classList.add(`placement__${a}`),u(this,qt,ce).call(this),n(this,D)){const{enterFrom:t,enterActive:e,enterTo:o}=n(this,D);null==c||c.classList.add(t),A(this,ft,requestAnimationFrame((()=>{null==c||c.classList.remove(t||""),null==c||c.classList.add(e||"",o||"");const r=u(this,Ot,Ut).call(this,c);A(this,mt,r.clear),r.promise.then(n(this,At))})))}else n(this,At).call(this);const d=u(this,bt,Kt).call(this,{triggerElement:o,popoverElement:this.popoverElement,arrowElement:this.arrowElement||null,appendToElement:s,placement:a||W.Top,offset:p}),{placement:f,left:m,top:v,arrowLeft:g,arrowTop:E}=d;re.forEach((({value:t})=>{null==c||c.classList.remove(`placement__${t}`)})),null==c||c.classList.add(`placement__${f}`),n(this,D)&&f!==n(this,_)&&(n(this,_)&&(null==c||c.classList.remove(`${i}__${n(this,_)}`)),null==c||c.classList.add(`${i}__${f}`)),A(this,_,f),P(this.popoverElement,{transform:`translate(${m}px,${v}px)`,opacity:"1",pointerEvents:"auto"}),this.arrowElement&&this.arrowElement instanceof HTMLElement&&P(this.arrowElement,{position:"absolute",left:`${g}px`,top:`${E}px`}),document.addEventListener("click",n(this,Ht)),document.addEventListener("mousemove",n(this,Mt)),null==(t=n(this,k))||t.forEach((t=>{t.addEventListener("scroll",n(this,st),{passive:!0})})),this.status=w.Opened,"function"==typeof h&&h(this)}close(){const{trigger:t,triggerOpenClass:e,onBeforeExit:o,onClose:r,onExited:i}=this.config,{popoverWrapper:s}=u(this,B,F).call(this);if(this.status===w.Opened)if("function"==typeof o&&o(this),this.status=w.Closing,n(this,D)){const{exitFrom:t,exitActive:e,exitTo:o}=n(this,D);null==s||s.classList.add(t),A(this,dt,requestAnimationFrame((()=>{null==s||s.classList.remove(t||""),null==s||s.classList.add(e||"",o||"");const r=u(this,Ot,Ut).call(this,s);A(this,ut,r.clear),r.promise.then(n(this,Xt))})))}else e&&t.classList.remove(e),u(this,vt,Jt).call(this),u(this,nt,Nt).call(this),n(this,rt).call(this),n(this,X).call(this),this.status=w.Closed,r&&r(this),i&&i(this)}openWithDelay(){const{openDelay:t}=this.config;n(this,V).call(this),t?A(this,gt,setTimeout((()=>{this.open()}),t)):this.open()}closeWithDelay(){n(this,V).call(this);const{closeDelay:t}=this.config;t?A(this,pt,setTimeout((()=>{this.close()}),t)):this.close()}update(){if(this.status===w.Opened){const{trigger:t,animationClass:e,appendTo:o,placement:r,offset:i}=this.config,{popoverWrapper:s}=u(this,B,F).call(this),a=u(this,bt,Kt).call(this,{triggerElement:t,popoverElement:this.popoverElement,arrowElement:this.arrowElement||null,appendToElement:o,placement:r||W.Top,offset:i}),{placement:p,left:l,top:h,arrowLeft:c,arrowTop:d}=a;re.forEach((({value:t})=>{null==s||s.classList.remove(`placement__${t}`)})),null==s||s.classList.add(`placement__${p}`),n(this,D)&&p!==n(this,_)&&(n(this,_)&&(null==s||s.classList.remove(`${e}__${n(this,_)}`)),null==s||s.classList.add(`${e}__${p}`)),A(this,_,p),P(this.popoverElement,{transform:`translate(${l}px,${h}px)`,opacity:"1",pointerEvents:"auto"}),this.arrowElement&&this.arrowElement instanceof HTMLElement&&P(this.arrowElement,{position:"absolute",left:`${c}px`,top:`${d}px`})}}updateConfig(t){const{trigger:e,triggerOpenClass:o,appendTo:r}=this.config,{popoverWrapper:i,popoverContent:s}=u(this,B,F).call(this);const a=function(t,e,o=!1){const r=[];return Object.keys(t).forEach((n=>{t[n]!==e[n]&&(r.push([n,t[n],e[n]]),o&&(e[n]=t[n]))})),r}(t,this.config,!0);a.length&&(a.forEach((([t,a,p])=>{var l;switch(t){case"trigger":u(this,et,kt).call(this,p),o&&p.classList.remove(o),n(this,S)&&(n(this,S).unobserve(p),n(this,S).observe(a)),u(this,tt,Dt).call(this),this.status===w.Opened&&o&&p.classList.add(o),n(this,k)||A(this,k,jt(e,r));break;case"content":null==s||s.removeChild(p),a instanceof HTMLElement?null==s||s.appendChild(a):s.innerHTML=(a||"").toString();break;case"showArrow":a?(this.arrowElement=this.arrowElement||u(this,Et,Gt).call(this),null==i||i.appendChild(this.arrowElement)):(this.arrowElement&&null!=i&&i.contains(this.arrowElement)&&(null==i||i.removeChild(this.arrowElement)),this.arrowElement=void 0);break;case"appendTo":p.contains(this.popoverElement)&&p.removeChild(this.popoverElement),(!a||!(a instanceof HTMLElement))&&(this.config.appendTo=document.body),this.config.appendTo=a,n(this,S)&&(n(this,S).unobserve(p),n(this,S).observe(a));break;case"emit":u(this,et,kt).call(this),a&&u(this,tt,Dt).call(this),u(this,it,Pt).call(this),u(this,ot,Bt).call(this),n(this,X).call(this);break;case"mode":i.classList.remove(`mode__${p}`),i.classList.add(`mode__${a}`);break;case"enterable":u(this,it,Pt).call(this),a&&u(this,ot,Bt).call(this),n(this,X).call(this);break;case"closeOnScroll":n(this,k)||(A(this,k,jt(e,r)),this.status===w.Opened&&(null==(l=n(this,k))||l.forEach((t=>{t.addEventListener("scroll",n(this,st),{passive:!0})}))));break;case"triggerOpenClass":this.status===w.Opened&&(p&&e.classList.remove(p),a&&e.classList.add(a));break;case"animationClass":u(this,wt,Qt).call(this);break;case"disabled":a&&this.disable()}})),this.update())}toggle(){this.status===w.Opened?this.close():this.open()}enable(){this.config.disabled=!1}disable(){this.config.disabled=!0,this.close()}destroy(){var t,e;const{appendTo:o}=this.config;n(this,S)&&(n(this,S).disconnect(),A(this,S,void 0)),this.status===w.Opened&&(o.contains(this.popoverElement)&&o.removeChild(this.popoverElement),P(this.popoverElement,{transform:""})),cancelAnimationFrame(n(this,ft)),cancelAnimationFrame(n(this,dt)),null==(t=n(this,mt))||t.call(this),null==(e=n(this,ut))||e.call(this),u(this,nt,Nt).call(this),n(this,rt).call(this),u(this,et,kt).call(this),u(this,it,Pt).call(this),n(this,X).call(this),this.status=null}cleanup(){const t=document.querySelectorAll(`#${ie}`);Array.from(t).forEach((t=>{var e;t.parentElement&&(null==(e=t.parentElement)||e.removeChild(t))}))}}D=new WeakMap,_=new WeakMap,ft=new WeakMap,dt=new WeakMap,mt=new WeakMap,ut=new WeakMap,k=new WeakMap,S=new WeakMap,gt=new WeakMap,pt=new WeakMap,Ft=new WeakSet,ae=function(){const{content:t,appendTo:e,wrapperClass:o,showArrow:r,mode:n}=this.config;this.popoverElement=ct({tagName:"div",attributes:{id:ie}}),P(this.popoverElement,{position:"absolute",left:0,top:0,opacity:.001});const i=ct({tagName:"div",attributes:{class:`${se}${o?` ${o}`:""} ${n===Rt.Dark?`mode__${n}`:`mode__${Rt.Light}`}`}});e!==document.body&&P(e,{position:"relative"}),r&&(this.arrowElement=u(this,Et,Gt).call(this),i.appendChild(this.arrowElement));const s=ct({tagName:"div",attributes:{class:ne}});t instanceof HTMLElement?s.appendChild(t):s.innerHTML=t.toString(),i.appendChild(s),this.popoverElement.appendChild(i)},Et=new WeakSet,Gt=function(){const t=ct({tagName:"div",attributes:{class:Vt}});return P(t,{position:"absolute",left:0,top:0}),t.appendChild(ct({tagName:"div",attributes:{class:`${Vt}-inner`}})),t},qt=new WeakSet,ce=function(){const{appendTo:t}=this.config;t.appendChild(this.popoverElement)},vt=new WeakSet,Jt=function(){const{appendTo:t}=this.config;t.contains(this.popoverElement)&&t.removeChild(this.popoverElement),P(this.popoverElement,{transform:""})},B=new WeakSet,F=function(){const{popoverElement:t}=this,e=null==t?void 0:t.querySelector(`.${se}`),o=null==e?void 0:e.querySelector(`.${ne}`),r=null==e?void 0:e.querySelector(`.${Vt}`);return{popoverWrapper:e,popoverContent:o,popoverArrow:r}},bt=new WeakSet,Kt=function({triggerElement:t,popoverElement:e,arrowElement:o,appendToElement:r=document.body,placement:n="auto",offset:i=0}){if(!t||!e)throw new Error("Couldn't initiate");P(e,{transform:""});const s=document.body.clientWidth||document.documentElement.clientWidth,{width:a}=Le(),p=ht(t),l=p.width,h=p.height,c=p.top,d=p.right,f=p.bottom,m=p.left,u=ht(e),w=u.width,v=u.height,g=u.top,E=u.right,b=u.bottom,L=u.left,_=o instanceof HTMLElement?be(o):{width:0,height:0},k=_.width,y=_.height,T=ht(r),x=T.width,W=T.height,M=T.top,C=T.right,$=T.bottom,A=T.left;"auto"===n&&(n=we(t).vertical);const S=n.split("-")[0],O=n.split("-")[1],D={"top-start":{top:c-b-i,left:m-L,arrowTop:v,arrowLeft:w<l/2?w/2-k/2:l/2-k/2},top:{top:c-b-i,left:m+l/2-(L+w/2),arrowTop:v,arrowLeft:w/2-k/2},"top-end":{top:c-b-i,left:d-E,arrowTop:v,arrowLeft:w<l/2?w/2-k/2:w-l/2-k/2},"bottom-start":{top:f-g+i,left:m-L,arrowTop:-y,arrowLeft:w<l/2?w/2-k/2:l/2-k/2},bottom:{top:f-g+i,left:m+l/2-(L+w/2),arrowTop:-y,arrowLeft:w/2-k/2},"bottom-end":{top:f-g+i,left:d-E,arrowTop:-y,arrowLeft:w<l/2?w/2-k/2:w-l/2-k/2},"right-start":{top:c-g,left:d-L+i,arrowTop:v<h?v/2-y/2:h/2-y/2,arrowLeft:-k},right:{top:c+h/2-(g+v/2),left:d-L+i,arrowTop:v/2-y/2,arrowLeft:-k},"right-end":{top:f-b,left:d-L+i,arrowTop:v<h?v/2-y/2:v-h/2-y/2,arrowLeft:-k},"left-start":{top:c-g,left:m-L-w-i,arrowTop:v<h?v/2-y/2:h/2-y/2,arrowLeft:w},left:{top:c+h/2-(g+v/2),left:m-L-w-i,arrowTop:v/2-y/2,arrowLeft:w},"left-end":{top:f-b,left:m-L-w-i,arrowTop:v<h?v/2-y/2:v-h/2-y/2,arrowLeft:w}};let H,B=D[n].top,F=D[n].left,N=D[n].arrowLeft,z=D[n].arrowTop,X=window.scrollY-g,Y=window.innerHeight+X,R=window.scrollX-L,q=window.innerWidth+R;if(r!==document.body&&r.contains(t)&&(X=M-g,Y=W+X,R=A-L,q=x+R),F<R){if("left"===S&&(H="right"+(O?`-${O}`:"")),F=R+L>d?d-L:R,"top"===S||"bottom"===S){const t=m-A;t<0?(w>l/2||w<=l/2&&l+t<w)&&(N=(l+t)/2-k/2):N=l/2+t-k/2}}else if(F+w>q&&("right"===S&&(H="left"+(O?`-${O}`:"")),F=q+L<m?m-E:q-w,"top"===S||"bottom"===S)){const t=d-C;t>0?(w>l/2||w<=l/2&&w+t>l)&&(N=w-(l-t)/2-k/2):N=w-(l/2-t)-k/2}if(B<X){if("top"===S&&(H="bottom"+(O?`-${O}`:"")),B=X+g>f?f-g:X,"left"===S||"right"===S){const t=c-M;t<0?(v>h/2||v<=h/2&&h+t<v)&&(z=(h+t)/2-y/2):z=h/2+t-y/2}}else if(B+v>Y&&("bottom"===S&&(H="top"+(O?`-${O}`:"")),B=Y+g<c?c-b:Y-v,"left"===S||"right"===S)){const t=f-$;t>0?(v>h/2||v<=h/2&&v+t>h)&&(z=v-(h-t)/2-y/2):z=v-(h/2-t)-y/2}if(H){const t=D[H];n=H,"top"===S||"bottom"===S?(B=t.top,z=t.arrowTop):("left"===S||"right"===S)&&(F=t.left,N=t.arrowLeft)}w+F>s&&(F-=a);return{left:F,top:B,right:F+w,bottom:B+v,arrowLeft:N,arrowTop:z,placement:n}},wt=new WeakSet,Qt=function(){const{animationClass:t}=this.config;A(this,D,t?{enterFrom:`${t}-enter-from`,enterActive:`${t}-enter-active`,enterTo:`${t}-enter-to`,exitFrom:`${t}-exit-from`,exitActive:`${t}-exit-active`,exitTo:`${t}-exit-to`}:void 0)},Lt=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,tt=new WeakSet,Dt=function(){const{trigger:t,emit:e}=this.config;t instanceof HTMLElement&&e&&(e===z.Click?t.addEventListener("click",n(this,Lt)):(t.addEventListener("mouseenter",n(this,Tt)),t.addEventListener("mouseleave",n(this,Ct))))},et=new WeakSet,kt=function(t){(t=t||this.config.trigger)instanceof HTMLElement&&(t.removeEventListener("click",n(this,Lt)),t.removeEventListener("mouseenter",n(this,Tt)),t.removeEventListener("mouseleave",n(this,Ct)))},yt=new WeakMap,$t=new WeakMap,ot=new WeakSet,Bt=function(){const{enterable:t,emit:e}=this.config;t&&e===z.Hover&&(this.popoverElement.addEventListener("mouseenter",n(this,yt)),this.popoverElement.addEventListener("mouseleave",n(this,$t)))},it=new WeakSet,Pt=function(){this.popoverElement.removeEventListener("mouseenter",n(this,yt)),this.popoverElement.removeEventListener("mouseleave",n(this,$t))},st=new WeakMap,nt=new WeakSet,Nt=function(){var t;null==(t=n(this,k))||t.forEach((t=>t.removeEventListener("scroll",n(this,st))))},Ht=new WeakMap,rt=new WeakMap,Mt=new WeakMap,X=new WeakMap,It=new WeakSet,he=function(){const{trigger:t,appendTo:e}=this.config,{popoverWrapper:o}=u(this,B,F).call(this),r=A(this,S,new ResizeObserver((()=>this.update())));r.observe(o),r.observe(e),t instanceof HTMLElement&&r.observe(t)},Ot=new WeakSet,Ut=function(t){const e=xt(t,"transitionDelay"),o=xt(t,"transitionDuration"),r=xt(t,"animationDelay"),n=xt(t,"animationDuration");function i(t,e){const o=t=>1e3*Number(t.slice(0,-1).replace(",","."));for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map(((e,r)=>o(e)+o(t[r]))))}const s=i(e,o),a=i(r,n),p=Math.max(s,a);let l,h;return p>0&&(l=s>a?"transitionend":"animationend"),{promise:new Promise((e=>{if(p){const o=()=>{null==h||h(),e(null)};t.addEventListener(l,o);const r=setTimeout((()=>{null==h||h(),e(null)}),p+2);h=()=>{clearTimeout(r),t.removeEventListener(l,o)}}else requestAnimationFrame(e)})),clear:h}},At=new WeakMap,Xt=new WeakMap,lt=new WeakMap,Y=new WeakMap,V=new WeakMap;export{z as EmitType,Rt as ModeType,W as PlacementType,w as StatusType,$e as default};
//# sourceMappingURL=/sm/9f46e5a24163f4d67266bf269174645783775ac61653ec9231914713a3e89db2.map