import{__awaiter,__generator}from"tslib"; /*! * (C) Ionic http://ionicframework.com - MIT License */import{w as win}from"./index-a5d50daf.js";import{c as config}from"./ionic-global-d89a6ff6.js";import"./index-73fa3fe8.js";var shouldUseCloseWatcher=function(){return config.get("experimentalCloseWatcher",false)&&win!==undefined&&"CloseWatcher"in win};var blockHardwareBackButton=function(){document.addEventListener("backbutton",(function(){}))};var startHardwareBackButton=function(){var r=document;var n=false;var t=function(){if(n){return}var t=0;var e=[];var a=new CustomEvent("ionBackButton",{bubbles:false,detail:{register:function(r,n){e.push({priority:r,handler:n,id:t++})}}});r.dispatchEvent(a);var o=function(r){return __awaiter(void 0,void 0,void 0,(function(){var n,t;return __generator(this,(function(e){switch(e.label){case 0:e.trys.push([0,3,,4]);if(!(r===null||r===void 0?void 0:r.handler))return[3,2];n=r.handler(i);if(!(n!=null))return[3,2];return[4,n];case 1:e.sent();e.label=2;case 2:return[3,4];case 3:t=e.sent();console.error(t);return[3,4];case 4:return[2]}}))}))};var i=function(){if(e.length>0){var r={priority:Number.MIN_SAFE_INTEGER,handler:function(){return undefined},id:-1};e.forEach((function(n){if(n.priority>=r.priority){r=n}}));n=true;e=e.filter((function(n){return n.id!==r.id}));o(r).then((function(){return n=false}))}};i()};if(shouldUseCloseWatcher()){var e;var a=function(){e===null||e===void 0?void 0:e.destroy();e=new win.CloseWatcher;e.onclose=function(){t();a()}};a()}else{r.addEventListener("backbutton",t)}};var OVERLAY_BACK_BUTTON_PRIORITY=100;var MENU_BACK_BUTTON_PRIORITY=99;export{MENU_BACK_BUTTON_PRIORITY,OVERLAY_BACK_BUTTON_PRIORITY,blockHardwareBackButton,shouldUseCloseWatcher,startHardwareBackButton};