text: import{r as t,c as e,f as a,h as i,H as n,g as r}from"./p-6b8b45ed.js";import{d as o,u as s,c as l,C as c}from"./p-df97b40a.js";import{g as p}from"./p-a4e6e35b.js";import{q as m,g as f,C as d,j as h}from"./p-f1686cee.js";import{C as b}from"./p-13fbc1a8.js";const w="data-calcite-popover-reference",k=class{constructor(a){t(this,a),this.calcitePopoverClose=e(this,"calcitePopoverClose",7),this.calcitePopoverOpen=e(this,"calcitePopoverOpen",7),this.closeButton=!1,this.dismissible=!1,this.disableFlip=!1,this.disablePointer=!1,this.offsetDistance=o,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.intlClose="Close",this._referenceElement=this.getReferenceElement(),this.guid=`calcite-popover-${p()}`,this.activeTransitionProp="opacity",this.getId=()=>this.el.id||this.guid,this.setExpandedAttr=()=>{const{_referenceElement:t,open:e}=this;t&&t.setAttribute("aria-expanded",e.toString())},this.addReferences=()=>{const{_referenceElement:t}=this;if(!t)return;const e=this.getId();t.setAttribute(w,e),t.setAttribute("aria-controls",e),this.setExpandedAttr()},this.removeReferences=()=>{const{_referenceElement:t}=this;t&&(t.removeAttribute(w),t.removeAttribute("aria-controls"),t.removeAttribute("aria-expanded"))},this.hide=()=>{this.open=!1},this.transitionEnd=t=>{t.propertyName===this.activeTransitionProp&&(this.open?this.calcitePopoverOpen.emit():this.calcitePopoverClose.emit())}}offsetDistanceOffsetHandler(){this.reposition()}offsetSkiddingHandler(){this.reposition()}openHandler(){this._referenceElement||this.referenceElementHandler(),this.reposition(),this.setExpandedAttr()}placementHandler(){this.reposition()}referenceElementHandler(){this.removeReferences(),this._referenceElement=this.getReferenceElement(),this.addReferences(),this.createPopper()}componentDidLoad(){this.createPopper(),this.addReferences()}disconnectedCallback(){this.removeReferences(),this.destroyPopper()}async reposition(){const{popper:t,el:e,placement:a}=this,i=this.getModifiers();t?s({el:e,modifiers:i,placement:a,popper:t}):this.createPopper()}async setFocus(t){var e;const{closeButtonEl:i}=this;if("close-button"===t&&i)return a(i),void i.setFocus();null===(e=this.el)||void 0===e||e.focus()}async toggle(t=!this.open){this.open=t}getReferenceElement(){const{referenceElement:t,el:e}=this;return("string"==typeof t?m(e,`#${t}`):t)||null}getModifiers(){const{arrowEl:t,flipPlacements:e,disableFlip:a,disablePointer:i,offsetDistance:n,offsetSkidding:r}=this,o={name:"flip",enabled:!a};e&&(o.options={fallbackPlacements:e});const s={name:"arrow",enabled:!i};return t&&(s.options={element:t}),[s,o,{name:"offset",enabled:!0,options:{offset:[r,n]}}]}createPopper(){this.destroyPopper();const{el:t,placement:e,_referenceElement:a,overlayPositioning:i}=this,n=this.getModifiers();this.popper=l({el:t,modifiers:n,overlayPositioning:i,placement:e,referenceEl:a})}destroyPopper(){const{popper:t}=this;t&&t.destroy(),this.popper=null}renderCloseButton(){const{dismissible:t,closeButton:e,intlClose:a}=this;return t||e?i("calcite-action",{class:"close-button",onClick:this.hide,ref:t=>this.closeButtonEl=t,text:a},i("calcite-icon",{icon:"x",scale:"m"})):null}renderHeader(){const{heading:t,headingLevel:e}=this,a=t?i(b,{class:"heading",level:e||2},t):null;return a?i("div",{class:"header"},a,this.renderCloseButton()):null}render(){const{_referenceElement:t,el:e,heading:a,label:r,open:o,disablePointer:s}=this,l="rtl"===f(e),p=t&&o,m=!p,h=s?null:i("div",{class:"arrow",ref:t=>this.arrowEl=t});return i(n,{"aria-hidden":m.toString(),"aria-label":r,"calcite-hydrated-hidden":m,id:this.getId(),role:"dialog"},i("div",{class:{[d.rtl]:l,[c.animation]:!0,[c.animationActive]:p},onTransitionEnd:this.transitionEnd},h,i("div",{class:{"has-header":!!a,container:!0}},this.renderHeader(),i("div",{class:"content"},i("slot",null)),a?null:this.renderCloseButton())))}get el(){return r(this)}static get watchers(){return{offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"]}}};k.style='@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:300ms}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0)}.calcite-popper-anim{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}:host([data-popper-placement^=bottom]) .calcite-popper-anim{-webkit-transform:translateY(-5px);transform:translateY(-5px)}:host([data-popper-placement^=top]) .calcite-popper-anim{-webkit-transform:translateY(5px);transform:translateY(5px)}:host([data-popper-placement^=left]) .calcite-popper-anim{-webkit-transform:translateX(5px);transform:translateX(5px)}:host([data-popper-placement^=right]) .calcite-popper-anim{-webkit-transform:translateX(-5px);transform:translateX(-5px)}:host([data-popper-placement]) .calcite-popper-anim--active{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}.arrow,.arrow::before{position:absolute;width:8px;height:8px;z-index:-1}.arrow::before{content:"";-webkit-box-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);box-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);-webkit-transform:rotate(45deg);transform:rotate(45deg);background:var(--calcite-ui-foreground-1)}:host([data-popper-placement^=top]) .arrow{bottom:-4px}:host([data-popper-placement^=bottom]) .arrow{top:-4px}:host([data-popper-placement^=left]) .arrow{right:-4px}:host([data-popper-placement^=right]) .arrow{left:-4px}:host{pointer-events:none}:host([open]){pointer-events:initial}.calcite-popper-anim{background-color:var(--calcite-ui-foreground-1);border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);border-radius:0.25rem}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}.header{border-width:0;border-bottom-width:1px;border-bottom-color:var(--calcite-ui-border-3);border-style:solid;display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-foreground-1);-ms-flex-pack:start;justify-content:flex-start}.heading{display:block;-ms-flex:1 1 auto;flex:1 1 auto;font-weight:var(--calcite-font-weight-medium);margin:0;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;-ms-flex-item-align:center;align-self:center;color:var(--calcite-ui-text-1);font-size:var(--calcite-font-size-0);line-height:1.375;white-space:normal;word-wrap:break-word;word-break:break-word}.container{background-color:var(--calcite-ui-foreground-1);position:relative;display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-direction:row;flex-direction:row;height:100%;color:var(--calcite-ui-text-1);border-radius:0.25rem}.container.has-header{-ms-flex-direction:column;flex-direction:column}.content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-item-align:center;align-self:center;height:100%}.calcite--rtl .close-button{border-radius:0.25rem 0 0 0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){height:100%}';const x=class{constructor(e){t(this,e),this.selector=`[${w}]`,this.getRelatedPopover=t=>{var e;const{selector:a,el:i}=this,n=null===(e=t.closest(a))||void 0===e?void 0:e.getAttribute(w);return m(i,`#${n}`)}}render(){return i("slot",null)}closeOpenPopovers(t){const e=t.target,{autoClose:a,el:i}=this,n="calcite-popover",r=e.closest(n),o=this.getRelatedPopover(e);a&&!r&&h(i,n).filter((t=>t.open&&t!==o)).forEach((t=>t.toggle(!1))),i.contains(e)&&o&&o.toggle()}get el(){return r(this)}};x.style="@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:300ms}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{display:block}";export{k as calcite_popover,x as calcite_popover_manager}