/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{e}from"./p-gD7P82jx.js";import{c as o}from"./p-hPTD29t1.js";const t=async(e,t,r,i,n,s)=>{var a;if(e)return e.attachViewToDom(t,r,n,i);if(!(s||"string"==typeof r||r instanceof HTMLElement))throw new Error("framework delegate is missing");const m="string"==typeof r?null===(a=t.ownerDocument)||void 0===a?void 0:a.createElement(r):r;return i&&i.forEach((e=>m.classList.add(e))),n&&Object.assign(m,n),t.appendChild(m),await new Promise((e=>o(m,e))),m},r=(e,o)=>{if(o){if(e)return e.removeViewFromDom(o.parentElement,o);o.remove()}return Promise.resolve()},i=()=>{let t,r;return{attachViewToDom:async(i,n,s={},a=[])=>{var m,c;let l;if(t=i,n){const e="string"==typeof n?null===(m=t.ownerDocument)||void 0===m?void 0:m.createElement(n):n;a.forEach((o=>e.classList.add(o))),Object.assign(e,s),t.appendChild(e),l=e,await new Promise((t=>o(e,t)))}else if(t.children.length>0&&("ION-MODAL"===t.tagName||"ION-POPOVER"===t.tagName)&&!(l=t.children[0]).classList.contains("ion-delegate-host")){const e=null===(c=t.ownerDocument)||void 0===c?void 0:c.createElement("div");e.classList.add("ion-delegate-host"),a.forEach((o=>e.classList.add(o))),e.append(...t.children),t.appendChild(e),l=e}const d=e.get("appRootSelector","ion-app"),f=document.querySelector(d)||document.body;return r=document.createComment("ionic teleport"),t.parentNode.insertBefore(r,t),f.appendChild(t),null!=l?l:t},removeViewFromDom:()=>(t&&r&&(r.parentNode.insertBefore(t,r),r.remove()),Promise.resolve())}};export{i as C,t as a,r as d}