{"version":3,"sources":["./node_modules/@ionic/core/dist/esm/keyboard-5742b5da.js"],"names":["KEYBOARD_DID_OPEN","KEYBOARD_DID_CLOSE","previousVisualViewport","currentVisualViewport","keyboardOpen","resetKeyboardAssist","startKeyboardAssist","win","startNativeListeners","visualViewport","copyVisualViewport","onresize","trackViewportChanges","keyboardDidOpen","keyboardDidResize","setKeyboardOpen","keyboardDidClose","setKeyboardClose","addEventListener","ev","fireKeyboardOpenEvent","fireKeyboardCloseEvent","width","height","scale","innerHeight","nativeEv","CustomEvent","detail","keyboardHeight","dispatchEvent","Object","assign","Math","round","offsetTop","offsetLeft","pageTop","pageLeft"],"mappings":"4FAAA,giBAAMA,EAAoB,qBACpBC,EAAqB,qBAE3B,IAAIC,EAAyB,GACzBC,EAAwB,GACxBC,GAAe,EAInB,MAAMC,EAAsB,KAC1BH,EAAyB,GACzBC,EAAwB,GACxBC,GAAe,GAEXE,EAAuBC,IAC3BC,EAAqBD,GAChBA,EAAIE,iBAGTN,EAAwBO,EAAmBH,EAAIE,gBAC/CF,EAAIE,eAAeE,SAAW,KAC5BC,EAAqBL,GACjBM,KAAqBC,EAAkBP,GACzCQ,EAAgBR,GAETS,EAAiBT,IACxBU,EAAiBV,MASjBC,EAAwBD,IAC5BA,EAAIW,iBAAiB,kBAAmBC,GAAMJ,EAAgBR,EAAKY,IACnEZ,EAAIW,iBAAiB,kBAAmB,IAAMD,EAAiBV,KAE3DQ,EAAkB,CAACR,EAAKY,KAC5BC,EAAsBb,EAAKY,GAC3Bf,GAAe,GAEXa,EAAoBV,IACxBc,EAAuBd,GACvBH,GAAe,GAcXS,EAAkB,KAEbT,GACPF,EAAuBoB,QAAUnB,EAAsBmB,QAFzBpB,EAAuBqB,OAASpB,EAAsBoB,QAAUpB,EAAsBqB,MA1D7F,IAmErBV,EAAqBP,GAClBH,IAAiBY,EAAiBT,GAQrCS,EAAoBT,GACjBH,GAAgBD,EAAsBoB,SAAWhB,EAAIkB,YAKxDL,EAAwB,CAACb,EAAKmB,KAClC,MACMP,EAAK,IAAIQ,YAAY3B,EAAmB,CAC5C4B,OAAQ,CAAEC,eAFWH,EAAWA,EAASG,eAAiBtB,EAAIkB,YAActB,EAAsBoB,UAIpGhB,EAAIuB,cAAcX,IAKdE,EAA0Bd,IAC9B,MAAMY,EAAK,IAAIQ,YAAY1B,GAC3BM,EAAIuB,cAAcX,IAQdP,EAAwBL,IAC5BL,EAAyB6B,OAAOC,OAAO,GAAI7B,GAC3CA,EAAwBO,EAAmBH,EAAIE,iBAM3CC,EAAsBD,IACnB,CACLa,MAAOW,KAAKC,MAAMzB,EAAea,OACjCC,OAAQU,KAAKC,MAAMzB,EAAec,QAClCY,UAAW1B,EAAe0B,UAC1BC,WAAY3B,EAAe2B,WAC3BC,QAAS5B,EAAe4B,QACxBC,SAAU7B,EAAe6B,SACzBd,MAAOf,EAAee","file":"60.75d2bbad3a0daeff140e.js","sourcesContent":["const KEYBOARD_DID_OPEN = 'ionKeyboardDidShow';\nconst KEYBOARD_DID_CLOSE = 'ionKeyboardDidHide';\nconst KEYBOARD_THRESHOLD = 150;\nlet previousVisualViewport = {};\nlet currentVisualViewport = {};\nlet keyboardOpen = false;\n/**\n * This is only used for tests\n */\nconst resetKeyboardAssist = () => {\n previousVisualViewport = {};\n currentVisualViewport = {};\n keyboardOpen = false;\n};\nconst startKeyboardAssist = (win) => {\n startNativeListeners(win);\n if (!win.visualViewport) {\n return;\n }\n currentVisualViewport = copyVisualViewport(win.visualViewport);\n win.visualViewport.onresize = () => {\n trackViewportChanges(win);\n if (keyboardDidOpen() || keyboardDidResize(win)) {\n setKeyboardOpen(win);\n }\n else if (keyboardDidClose(win)) {\n setKeyboardClose(win);\n }\n };\n};\n/**\n * Listen for events fired by native keyboard plugin\n * in Capacitor/Cordova so devs only need to listen\n * in one place.\n */\nconst startNativeListeners = (win) => {\n win.addEventListener('keyboardDidShow', ev => setKeyboardOpen(win, ev));\n win.addEventListener('keyboardDidHide', () => setKeyboardClose(win));\n};\nconst setKeyboardOpen = (win, ev) => {\n fireKeyboardOpenEvent(win, ev);\n keyboardOpen = true;\n};\nconst setKeyboardClose = (win) => {\n fireKeyboardCloseEvent(win);\n keyboardOpen = false;\n};\n/**\n * Returns `true` if the `keyboardOpen` flag is not\n * set, the previous visual viewport width equal the current\n * visual viewport width, and if the scaled difference\n * of the previous visual viewport height minus the current\n * visual viewport height is greater than KEYBOARD_THRESHOLD\n *\n * We need to be able to accommodate users who have zooming\n * enabled in their browser (or have zoomed in manually) which\n * is why we take into account the current visual viewport's\n * scale value.\n */\nconst keyboardDidOpen = () => {\n const scaledHeightDifference = (previousVisualViewport.height - currentVisualViewport.height) * currentVisualViewport.scale;\n return (!keyboardOpen &&\n previousVisualViewport.width === currentVisualViewport.width &&\n scaledHeightDifference > KEYBOARD_THRESHOLD);\n};\n/**\n * Returns `true` if the keyboard is open,\n * but the keyboard did not close\n */\nconst keyboardDidResize = (win) => {\n return keyboardOpen && !keyboardDidClose(win);\n};\n/**\n * Determine if the keyboard was closed\n * Returns `true` if the `keyboardOpen` flag is set and\n * the current visual viewport height equals the\n * layout viewport height.\n */\nconst keyboardDidClose = (win) => {\n return keyboardOpen && currentVisualViewport.height === win.innerHeight;\n};\n/**\n * Dispatch a keyboard open event\n */\nconst fireKeyboardOpenEvent = (win, nativeEv) => {\n const keyboardHeight = nativeEv ? nativeEv.keyboardHeight : win.innerHeight - currentVisualViewport.height;\n const ev = new CustomEvent(KEYBOARD_DID_OPEN, {\n detail: { keyboardHeight }\n });\n win.dispatchEvent(ev);\n};\n/**\n * Dispatch a keyboard close event\n */\nconst fireKeyboardCloseEvent = (win) => {\n const ev = new CustomEvent(KEYBOARD_DID_CLOSE);\n win.dispatchEvent(ev);\n};\n/**\n * Given a window object, create a copy of\n * the current visual and layout viewport states\n * while also preserving the previous visual and\n * layout viewport states\n */\nconst trackViewportChanges = (win) => {\n previousVisualViewport = Object.assign({}, currentVisualViewport);\n currentVisualViewport = copyVisualViewport(win.visualViewport);\n};\n/**\n * Creates a deep copy of the visual viewport\n * at a given state\n */\nconst copyVisualViewport = (visualViewport) => {\n return {\n width: Math.round(visualViewport.width),\n height: Math.round(visualViewport.height),\n offsetTop: visualViewport.offsetTop,\n offsetLeft: visualViewport.offsetLeft,\n pageTop: visualViewport.pageTop,\n pageLeft: visualViewport.pageLeft,\n scale: visualViewport.scale\n };\n};\n\nexport { KEYBOARD_DID_CLOSE, KEYBOARD_DID_OPEN, copyVisualViewport, keyboardDidClose, keyboardDidOpen, keyboardDidResize, resetKeyboardAssist, setKeyboardClose, setKeyboardOpen, startKeyboardAssist, trackViewportChanges };\n"],"sourceRoot":"webpack:///"}