/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{K as e}from"./p-Q7JLYEUZ.js";import"./p-Dv5UHqHj.js";import"./p-W-2TssC9.js";import"./p-C8IsBmNU.js";const t="ionKeyboardDidShow",o="ionKeyboardDidHide";let i={},s={},d=!1;const p=()=>{i={},s={},d=!1},r=t=>{if(e.getEngine())a(t);else{if(!t.visualViewport)return;s=y(t.visualViewport),t.visualViewport.onresize=()=>{w(t),h()||m(t)?n(t):b(t)&&f(t)}}},a=e=>{e.addEventListener("keyboardDidShow",(t=>n(e,t))),e.addEventListener("keyboardDidHide",(()=>f(e)))},n=(e,t)=>{c(e,t),d=!0},f=e=>{j(e),d=!1},h=()=>!d&&i.width===s.width&&(i.height-s.height)*s.scale>150,m=e=>d&&!b(e),b=e=>d&&s.height===e.innerHeight,c=(e,o)=>{const i=new CustomEvent(t,{detail:{keyboardHeight:o?o.keyboardHeight:e.innerHeight-s.height}});e.dispatchEvent(i)},j=e=>{const t=new CustomEvent(o);e.dispatchEvent(t)},w=e=>{i=Object.assign({},s),s=y(e.visualViewport)},y=e=>({width:Math.round(e.width),height:Math.round(e.height),offsetTop:e.offsetTop,offsetLeft:e.offsetLeft,pageTop:e.pageTop,pageLeft:e.pageLeft,scale:e.scale});export{o as KEYBOARD_DID_CLOSE,t as KEYBOARD_DID_OPEN,y as copyVisualViewport,b as keyboardDidClose,h as keyboardDidOpen,m as keyboardDidResize,p as resetKeyboardAssist,f as setKeyboardClose,n as setKeyboardOpen,r as startKeyboardAssist,w as trackViewportChanges}