/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{e as n,f as e,w as i,B as a}from"./p-C8IsBmNU.js";import{r as o}from"./p-BiTKUjko.js";const r="ionViewWillEnter",t="ionViewDidEnter",s="ionViewWillLeave",c="ionViewDidLeave",l="ionViewWillUnload",u=n=>{n.tabIndex=-1,n.focus()},d=n=>null!==n.offsetParent,f="ion-last-focus",w=e=>{if(n.get("focusManagerPriority",!1)){const n=document.activeElement;null!==n&&(null==e?void 0:e.contains(n))&&n.setAttribute(f,"true")}},p=i=>{const a=n.get("focusManagerPriority",!1);if(Array.isArray(a)&&!i.contains(document.activeElement)){const n=i.querySelector(`[${f}]`);if(n&&d(n))return void u(n);for(const n of a)switch(n){case"content":const a=i.querySelector('main, [role="main"]');if(a&&d(a))return void u(a);break;case"heading":const o=i.querySelector('h1, [role="heading"][aria-level="1"]');if(o&&d(o))return void u(o);break;case"banner":const r=i.querySelector('header, [role="banner"]');if(r&&d(r))return void u(r);break;default:e(`Unrecognized focus manager priority value ${n}`)}u(i)}},v=n=>new Promise(((e,a)=>{i((()=>{const i=D(n);m(n,i),b(n).then((i=>{i.animation&&i.animation.destroy(),g(n),e(i)}),(e=>{g(n),a(e)})).finally((()=>{z(i,!1)}))}))})),m=(n,e)=>{const i=n.enteringEl,a=n.leavingEl;w(a),W(i,a,n.direction),z(e,!0),n.showGoBack?i.classList.add("can-go-back"):i.classList.remove("can-go-back"),M(i,!1),i.style.setProperty("pointer-events","none"),a&&(M(a,!1),a.style.setProperty("pointer-events","none"))},b=async n=>{const e=await h(n);return e&&a.isBrowser?y(e,n):k(n)},g=n=>{const e=n.enteringEl,i=n.leavingEl;e.classList.remove("ion-page-invisible"),e.style.removeProperty("pointer-events"),void 0!==i&&(i.classList.remove("ion-page-invisible"),i.style.removeProperty("pointer-events")),p(e)},h=async n=>{if(n.leavingEl&&n.animated&&0!==n.duration)return n.animationBuilder?n.animationBuilder:"ios"===n.mode?(await import("./p-CkzsSTjr.js")).iosTransitionAnimation:(await import("./p-CGo9Zrhw.js")).mdTransitionAnimation},y=async(n,e)=>{await P(e,!0);const i=n(e.baseEl,e);V(e.enteringEl,e.leavingEl);const a=await C(i,e);return e.progressCallback&&e.progressCallback(void 0),a&&U(e.enteringEl,e.leavingEl),{hasCompleted:a,animation:i}},k=async e=>{const i=e.enteringEl,a=e.leavingEl,o=n.get("focusManagerPriority",!1);return await P(e,o),V(i,a),U(i,a),{hasCompleted:!0}},P=async(n,e)=>{(void 0!==n.deepWait?n.deepWait:e)&&await Promise.all([L(n.enteringEl),L(n.leavingEl)]),await j(n.viewIsReady,n.enteringEl)},j=async(n,e)=>{n&&await n(e)},C=(n,e)=>{const i=e.progressCallback,a=new Promise((e=>{n.onFinish((n=>e(1===n)))}));return i?(n.progressStart(!0),i(n)):n.play(),a},V=(n,e)=>{B(e,s),B(n,r)},U=(n,e)=>{B(n,t),B(e,c)},B=(n,e)=>{if(n){const i=new CustomEvent(e,{bubbles:!1,cancelable:!1});n.dispatchEvent(i)}},E=()=>new Promise((n=>o((()=>o((()=>n())))))),L=async n=>{const e=n;if(e){if(null!=e.componentOnReady){if(null!=await e.componentOnReady())return}else if(null!=e.__registerHost){const n=new Promise((n=>o(n)));return void await n}await Promise.all(Array.from(e.children).map(L))}},M=(n,e)=>{e?(n.setAttribute("aria-hidden","true"),n.classList.add("ion-page-hidden")):(n.hidden=!1,n.removeAttribute("aria-hidden"),n.classList.remove("ion-page-hidden"))},W=(n,e,i)=>{void 0!==n&&(n.style.zIndex="back"===i?"99":"101"),void 0!==e&&(e.style.zIndex="100")},z=(n,e)=>{if(!n)return;const i="header-transitioning";e?n.classList.add(i):n.classList.remove(i)},A=n=>{if(n.classList.contains("ion-page"))return n;return n.querySelector(":scope > .ion-page, :scope > ion-nav, :scope > ion-tabs")||n},D=n=>{if("ios"!==n.mode)return null;const e="back"===n.direction?n.leavingEl:n.enteringEl;return e?e.querySelector("ion-header"):null};export{r as L,t as a,s as b,c,l as d,L as e,A as g,B as l,M as s,v as t,E as w}