import{g as o,c as n}from"./p-fef04ab5.js";import{OVERLAY_BACK_BUTTON_PRIORITY as t}from"./p-6fd4985d.js";import{c as e,f as a,a as i,r,g as s}from"./p-55ae49e1.js";
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */let c=0;const d=new WeakMap,l=o=>({create:n=>b(o,n),dismiss:(n,t,e)=>k(document,n,t,o,e),getTop:async()=>O(document,o)}),u=l("ion-alert"),p=l("ion-action-sheet"),f=l("ion-modal"),v=l("ion-popover"),m=l("ion-toast"),y=o=>{"undefined"!=typeof document&&j(document);const n=c++;o.overlayIndex=n,o.hasAttribute("id")||(o.id=`ion-overlay-${n}`)},b=(o,n)=>"undefined"!=typeof window&&void 0!==window.customElements?window.customElements.whenDefined(o).then((()=>{const t=document.createElement(o);return t.classList.add("overlay-hidden"),Object.assign(t,Object.assign(Object.assign({},n),{hasController:!0})),z(document).appendChild(t),new Promise((o=>e(t,o)))})):Promise.resolve(),h='[tabindex]:not([tabindex^="-"]), input:not([type=hidden]):not([tabindex^="-"]), textarea:not([tabindex^="-"]), button:not([tabindex^="-"]), select:not([tabindex^="-"]), .ion-focusable:not([tabindex^="-"])',w="input:not([type=hidden]), textarea, button, select",x=(o,n)=>{let t=o.querySelector(h);const e=t&&t.shadowRoot;e&&(t=e.querySelector(w)||t),t?a(t):n.focus()},g=(o,n)=>{const t=Array.from(o.querySelectorAll(h));let e=t.length>0?t[t.length-1]:null;const a=e&&e.shadowRoot;a&&(e=a.querySelector(w)||e),e?e.focus():n.focus()},j=o=>{0===c&&(c=1,o.addEventListener("focus",(n=>{((o,n)=>{const t=O(n,"ion-alert,ion-action-sheet,ion-loading,ion-modal,ion-picker,ion-popover"),e=o.target;t&&e&&(t.classList.contains("ion-disable-focus-trap")||(t.shadowRoot?(()=>{if(t.contains(e))t.lastFocus=e;else{const o=t.lastFocus;x(t,t),o===n.activeElement&&g(t,t),t.lastFocus=n.activeElement}})():(()=>{if(t===e)t.lastFocus=void 0;else{const o=s(t);if(!o.contains(e))return;const a=o.querySelector(".ion-overlay-wrapper");if(!a)return;if(a.contains(e))t.lastFocus=e;else{const o=t.lastFocus;x(a,t),o===n.activeElement&&g(a,t),t.lastFocus=n.activeElement}}})()))})(n,o)}),!0),o.addEventListener("ionBackButton",(n=>{const e=O(o);e&&e.backdropDismiss&&n.detail.register(t,(()=>e.dismiss(void 0,S)))})),o.addEventListener("keyup",(n=>{if("Escape"===n.key){const n=O(o);n&&n.backdropDismiss&&n.dismiss(void 0,S)}})))},k=(o,n,t,e,a)=>{const i=O(o,e,a);return i?i.dismiss(n,t):Promise.reject("overlay does not exist")},O=(o,n,t)=>{const e=((o,n)=>(void 0===n&&(n="ion-alert,ion-action-sheet,ion-loading,ion-modal,ion-picker,ion-popover,ion-toast"),Array.from(o.querySelectorAll(n)).filter((o=>o.overlayIndex>0))))(o,n).filter((o=>!o.classList.contains("overlay-hidden")));return void 0===t?e[e.length-1]:e.find((o=>o.id===t))},P=(o=!1)=>{const n=z(document).querySelector("ion-router-outlet, ion-nav, #ion-view-container-root");n&&(o?n.setAttribute("aria-hidden","true"):n.removeAttribute("aria-hidden"))},A=async(t,e,a,i,r)=>{var s,c;if(t.presented)return;P(!0),t.presented=!0,t.willPresent.emit(),null===(s=t.willPresentShorthand)||void 0===s||s.emit();const d=o(t),l=t.enterAnimation?t.enterAnimation:n.get(e,"ios"===d?a:i);await C(t,l,t.el,r)&&(t.didPresent.emit(),null===(c=t.didPresentShorthand)||void 0===c||c.emit()),"ION-TOAST"!==t.el.tagName&&B(t.el),t.keyboardClose&&t.el.focus()},B=async o=>{let n=document.activeElement;if(!n)return;const t=n&&n.shadowRoot;t&&(n=t.querySelector(w)||n),await o.onDidDismiss(),n.focus()},T=async(t,e,a,i,r,s,c)=>{var l,u;if(!t.presented)return!1;P(!1),t.presented=!1;try{t.el.style.setProperty("pointer-events","none"),t.willDismiss.emit({data:e,role:a}),null===(l=t.willDismissShorthand)||void 0===l||l.emit({data:e,role:a});const p=o(t),f=t.leaveAnimation?t.leaveAnimation:n.get(i,"ios"===p?r:s);"gesture"!==a&&await C(t,f,t.el,c),t.didDismiss.emit({data:e,role:a}),null===(u=t.didDismissShorthand)||void 0===u||u.emit({data:e,role:a}),d.delete(t),t.el.classList.add("overlay-hidden"),t.el.style.removeProperty("pointer-events")}catch(o){console.error(o)}return t.el.remove(),!0},z=o=>o.querySelector("ion-app")||o.body,C=async(o,t,e,a)=>{e.classList.remove("overlay-hidden");const i=t(o.el,a);o.animated&&n.getBoolean("animated",!0)||i.duration(0),o.keyboardClose&&i.beforeAddWrite((()=>{const o=e.ownerDocument.activeElement;o&&o.matches("input,ion-input, ion-textarea")&&o.blur()}));const r=d.get(o)||[];return d.set(o,[...r,i]),await i.play(),!0},E=(o,n)=>{let t;const e=new Promise((o=>t=o));return G(o,n,(o=>{t(o.detail)})),e},G=(o,n,t)=>{const e=a=>{r(o,n,e),t(a)};i(o,n,e)},I=o=>"cancel"===o||o===S,M=o=>o(),N=(o,t)=>{if("function"==typeof o)return n.get("_zoneGate",M)((()=>{try{return o(t)}catch(o){throw o}}))},S="backdrop";export{S as B,u as a,A as b,d as c,T as d,E as e,v as f,O as g,p as h,I as i,x as j,f as m,y as p,N as s,m as t}