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