text: /*!
   * (C) Ionic http://ionicframework.com - MIT License
   * Built with http://stenciljs.com
   */
  const{h:e}=window.Ionic;import{a as t,b as o,g as n}from"./chunk-b9ec67ac.js";import{a as i,b as s,c as r,e as a,f as l,g as p,h as c}from"./chunk-2994e275.js";import{a as d}from"./chunk-5f438245.js";function m(e,t,o){let n="top",i="left";const s=t.querySelector(".popover-content"),r=s.getBoundingClientRect(),a=r.width,l=r.height,p=window.innerWidth,c=window.innerHeight,d=o&&o.target&&o.target.getBoundingClientRect(),m=null!=d&&"top"in d?d.top:c/2-l/2,u=null!=d&&"left"in d?d.left:p/2,v=d&&d.width||0,y=d&&d.height||0,f=t.querySelector(".popover-arrow"),g=f.getBoundingClientRect(),b=g.width,w=g.height;null==d&&(f.style.display="none");const D={top:m+y,left:u+v/2-b/2},P={top:m+y+(w-1),left:u+v/2-a/2};let E=!1,k=!1;P.left<h+25?(E=!0,P.left=h):a+h+P.left+25>p&&(k=!0,P.left=p-a-h,i="right"),m+y+l>c&&m-l>0?(D.top=m-(w+1),console.log(D),console.log(m),console.log(l),P.top=m-l-(w-1),t.className=t.className+" popover-bottom",n="bottom"):m+y+l>c&&(s.style.bottom=h+"%"),f.style.top=D.top+"px",f.style.left=D.left+"px",s.style.top=P.top+"px",s.style.left=P.left+"px",E&&(s.style.left=`calc(${P.left}px + var(--ion-safe-area-left, 0px))`),k&&(s.style.left=`calc(${P.left}px - var(--ion-safe-area-right, 0px))`),s.style.transformOrigin=n+" "+i;const x=new e,S=new e;S.addElement(t.querySelector("ion-backdrop")),S.fromTo("opacity",.01,.08);const B=new e;return B.addElement(t.querySelector(".popover-wrapper")),B.fromTo("opacity",.01,1),Promise.resolve(x.addElement(t).easing("ease").duration(100).add(S).add(B))}const h=5;function u(e,t){const o=new e,n=new e;n.addElement(t.querySelector("ion-backdrop"));const i=new e;return i.addElement(t.querySelector(".popover-wrapper")),i.fromTo("opacity",.99,0),n.fromTo("opacity",.08,0),Promise.resolve(o.addElement(t).easing("ease").duration(500).add(n).add(i))}function v(e,t,o){let n="top",i="left";const s=t.querySelector(".popover-content"),r=s.getBoundingClientRect(),a=r.width,l=r.height,p=window.innerWidth,c=window.innerHeight,d=o&&o.target&&o.target.getBoundingClientRect(),m=null!=d&&"top"in d?d.top:c/2-l/2,h=d&&d.height||0,u={top:m,left:null!=d&&"left"in d?d.left:p/2-a/2};u.left<y?u.left=y:a+y+u.left>p&&(u.left=p-a-y,i="right"),m+h+l>c&&m-l>0?(u.top=m-l,t.className=t.className+" popover-bottom",n="bottom"):m+h+l>c&&(s.style.bottom=y+"px"),s.style.top=u.top+"px",s.style.left=u.left+"px",s.style.transformOrigin=n+" "+i;const v=new e,f=new e;f.addElement(t.querySelector("ion-backdrop")),f.fromTo("opacity",.01,.08);const g=new e;g.addElement(t.querySelector(".popover-wrapper")),g.fromTo("opacity",.01,1);const b=new e;b.addElement(t.querySelector(".popover-content")),b.fromTo("scale",.001,1);const w=new e;return w.addElement(t.querySelector(".popover-viewport")),w.fromTo("opacity",.01,1),Promise.resolve(v.addElement(t).easing("cubic-bezier(0.36,0.66,0.04,1)").duration(300).add(f).add(g).add(b).add(w))}const y=12;function f(e,t){const o=new e,n=new e;n.addElement(t.querySelector("ion-backdrop"));const i=new e;return i.addElement(t.querySelector(".popover-wrapper")),i.fromTo("opacity",.99,0),n.fromTo("opacity",.08,0),Promise.resolve(o.addElement(t).easing("ease").duration(500).add(n).add(i))}class g{constructor(){this.presented=!1,this.keyboardClose=!0,this.backdropDismiss=!0,this.showBackdrop=!0,this.translucent=!1,this.animated=!0}componentDidLoad(){this.ionPopoverDidLoad.emit()}componentDidUnload(){this.ionPopoverDidUnload.emit()}onDismiss(e){e.stopPropagation(),e.preventDefault(),this.dismiss()}onBackdropTap(){this.dismiss(void 0,i)}lifecycle(e){const t=this.usersElement,o=b[e.type];if(t&&o){const n=new CustomEvent(o,{bubbles:!1,cancelable:!1,detail:e.detail});t.dispatchEvent(n)}}async present(){if(this.presented)return;const e=this.el.querySelector(".popover-content");if(!e)throw new Error("container is undefined");const o=Object.assign({},this.componentProps,{popover:this.el});return this.usersElement=await t(this.delegate,e,this.component,["popover-viewport",this.el["s-sc"]],o),await d(this.usersElement),a(this,"popoverEnter",m,v,this.event)}async dismiss(e,t){const n=await s(this,e,t,"popoverLeave",u,f,this.event);return n&&await o(this.delegate,this.usersElement),n}onDidDismiss(){return r(this.el,"ionPopoverDidDismiss")}onWillDismiss(){return r(this.el,"ionPopoverWillDismiss")}hostData(){return{style:{zIndex:2e4+this.overlayIndex},"no-router":!0,class:Object.assign({"popover-translucent":this.translucent},n(this.cssClass))}}render(){return[e("ion-backdrop",{tappable:this.backdropDismiss,visible:this.showBackdrop}),e("div",{class:"popover-wrapper"},e("div",{class:"popover-arrow"}),e("div",{class:"popover-content"}))]}static get is(){return"ion-popover"}static get encapsulation(){return"scoped"}static get properties(){return{animated:{type:Boolean,attr:"animated"},animationCtrl:{connect:"ion-animation-controller"},backdropDismiss:{type:Boolean,attr:"backdrop-dismiss"},component:{type:String,attr:"component"},componentProps:{type:"Any",attr:"component-props"},config:{context:"config"},cssClass:{type:String,attr:"css-class"},delegate:{type:"Any",attr:"delegate"},dismiss:{method:!0},el:{elementRef:!0},enterAnimation:{type:"Any",attr:"enter-animation"},event:{type:"Any",attr:"event"},keyboardClose:{type:Boolean,attr:"keyboard-close"},leaveAnimation:{type:"Any",attr:"leave-animation"},mode:{type:String,attr:"mode"},onDidDismiss:{method:!0},onWillDismiss:{method:!0},overlayIndex:{type:Number,attr:"overlay-index"},present:{method:!0},showBackdrop:{type:Boolean,attr:"show-backdrop"},translucent:{type:Boolean,attr:"translucent"}}}static get events(){return[{name:"ionPopoverDidLoad",method:"ionPopoverDidLoad",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPopoverDidUnload",method:"ionPopoverDidUnload",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPopoverDidPresent",method:"didPresent",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPopoverWillPresent",method:"willPresent",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPopoverWillDismiss",method:"willDismiss",bubbles:!0,cancelable:!0,composed:!0},{name:"ionPopoverDidDismiss",method:"didDismiss",bubbles:!0,cancelable:!0,composed:!0}]}static get listeners(){return[{name:"ionDismiss",method:"onDismiss"},{name:"ionBackdropTap",method:"onBackdropTap"},{name:"ionPopoverDidPresent",method:"lifecycle"},{name:"ionPopoverWillPresent",method:"lifecycle"},{name:"ionPopoverWillDismiss",method:"lifecycle"},{name:"ionPopoverDidDismiss",method:"lifecycle"}]}static get style(){return".sc-ion-popover-ios-h{left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:1000}.popover-wrapper.sc-ion-popover-ios{opacity:0;z-index:10}.popover-content.sc-ion-popover-ios{display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;overflow:auto;z-index:10}.popover-viewport.sc-ion-popover-ios{--ion-safe-area-top:0px;--ion-safe-area-right:0px;--ion-safe-area-bottom:0px;--ion-safe-area-left:0px}.popover-content.sc-ion-popover-ios{border-radius:10px;width:200px;min-width:0;min-height:0;max-height:90%;background-color:var(--ion-background-color,#fff);color:var(--ion-text-color,#000)}.popover-arrow.sc-ion-popover-ios{display:block;position:absolute;width:20px;height:10px;overflow:hidden}.popover-arrow.sc-ion-popover-ios:after{left:3px;top:3px;border-radius:3px;position:absolute;width:14px;height:14px;-webkit-transform:rotate(45deg);transform:rotate(45deg);background-color:var(--ion-background-color,#fff);content:\"\";z-index:10}.popover-bottom.sc-ion-popover-ios-h   .popover-arrow.sc-ion-popover-ios{top:auto;bottom:-10px}.popover-bottom.sc-ion-popover-ios-h   .popover-arrow.sc-ion-popover-ios:after{top:-6px}.popover-translucent.sc-ion-popover-ios-h   .popover-arrow.sc-ion-popover-ios:after, .popover-translucent.sc-ion-popover-ios-h   .popover-content.sc-ion-popover-ios{background:rgba(var(--ion-background-color-rgb,255,255,255),.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}"}static get styleMode(){return"ios"}}const b={ionPopoverDidPresent:"ionViewDidEnter",ionPopoverWillPresent:"ionViewWillEnter",ionPopoverWillDismiss:"ionViewWillLeave",ionPopoverDidDismiss:"ionViewDidLeave"};class w{create(e){return l(this.doc.createElement("ion-popover"),e)}dismiss(e,t,o){return p(this.doc,e,t,"ion-popover",o)}async getTop(){return c(this.doc,"ion-popover")}static get is(){return"ion-popover-controller"}static get properties(){return{create:{method:!0},dismiss:{method:!0},doc:{context:"document"},getTop:{method:!0}}}}export{g as IonPopover,w as IonPopoverController};