/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{w as o,d as r}from"./p-W-2TssC9.js";import{e as i}from"./p-C8IsBmNU.js";import{K as e,a as l}from"./p-Q7JLYEUZ.js";const n=o=>{if(void 0===r||o===l.None||void 0===o)return null;const e=i.get("appRootSelector","ion-app"),n=r.querySelector(e);return null!=n?n:r.body},s=o=>{const r=n(o);return null===r?0:r.clientHeight},t=async r=>{let i,l,t,a;const d=async()=>{const r=await e.getResizeMode(),n=void 0===r?void 0:r.mode;i=()=>{void 0===a&&(a=s(n)),t=!0,u(t,n)},l=()=>{t=!1,u(t,n)},null==o||o.addEventListener("keyboardWillShow",i),null==o||o.addEventListener("keyboardWillHide",l)},u=(o,i)=>{r&&r(o,c(i))},c=o=>{if(0===a||a===s(o))return;const r=n(o);return null!==r?new Promise((o=>{const i=new ResizeObserver((()=>{r.clientHeight===a&&(i.disconnect(),o())}));i.observe(r)})):void 0};return await d(),{init:d,destroy:()=>{null==o||o.removeEventListener("keyboardWillShow",i),null==o||o.removeEventListener("keyboardWillHide",l),i=l=void 0},isKeyboardVisible:()=>t}};export{t as c}