var __awaiter=this&&this.__awaiter||function(n,t,r,e){function i(n){return n instanceof r?n:new r((function(t){t(n)}))}return new(r||(r=Promise))((function(r,u){function a(n){try{c(e.next(n))}catch(n){u(n)}}function o(n){try{c(e["throw"](n))}catch(n){u(n)}}function c(n){n.done?r(n.value):i(n.value).then(a,o)}c((e=e.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var r={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},e,i,u,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(n){return function(t){return c([n,t])}}function c(o){if(e)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(r=0)),r)try{if(e=1,i&&(u=o[0]&2?i["return"]:o[0]?i["throw"]||((u=i["return"])&&u.call(i),0):i.next)&&!(u=u.call(i,o[1])).done)return u;if(i=0,u)o=[o[0]&2,u.value];switch(o[0]){case 0:case 1:u=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;i=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(u=r.trys,u=u.length>0&&u[u.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!u||o[1]>u[0]&&o[1]0){var n={priority:Number.MIN_SAFE_INTEGER,handler:function(){return undefined},id:-1};u.forEach((function(t){if(t.priority>=n.priority){n=t}}));r=true;u=u.filter((function(t){return t.id!==n.id}));o(n).then((function(){return r=false}))}};c()};if(u()){var o;var c=function(){o===null||o===void 0?void 0:o.destroy();o=new t.CloseWatcher;o.onclose=function(){a();c()}};c()}else{n.addEventListener("backbutton",a)}}));var c=n("OVERLAY_BACK_BUTTON_PRIORITY",100);var f=n("MENU_BACK_BUTTON_PRIORITY",99)}}}));