/g,">").replace(/\//g,"/")}function htmlUnescape(e){return e.replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(///g,"/")}function ExpiredToBe(){return this instanceof ExpiredToBe?(this.items=[],this.alarms=[],this.prefs={prefNotification:"alerts",prefAlarmMsg:"An alarm has expired.",prefCycle:0,prefHours:9,prefMins:0,prefSnoozeTime:5,showPanel:!1,allowTimers:!1},this.notifyError="",this.removeLocalAlarm=e=>{let i=this.alarms.slice();i=i.filter((i=>i.id!==e)),this.alarms=i},this.clearErrMsg=()=>{this.notifyError="",this.updateErrorMsg()},this.updateErrorMsg=()=>{document.getElementById("notify-error").innerText=htmlUnescape(this.notifyError)},this.getPermReturn=(e=!1)=>new Promise(((i,t)=>{if(this.clearErrMsg(),"Notification"in window)if(e)i(Notification.permission);else if("granted"===Notification.permission)i("granted");else if("default"===Notification.permission)try{Notification.requestPermission().then((e=>{"denied"!==e&&"granted"!==e||i(e),"default"===e?("denied"===window.Notification.permission&&i("autodeny"),i(e)):i(e)}))}catch(e){if(!(e instanceof TypeError))throw e;Notification.requestPermission((e=>{i(e)}))}else"default"===Notification.permission?("denied"===Notification.permission&&i("denied"),i("default")):i("denied");else i("none")})),{currentItems:()=>this.items,alarmItems:()=>this.alarms,getPrefs:()=>this.prefs,setPref:e=>{let i=Object.assign({},this.prefs,e);this.prefs=i},setAlarms:e=>{this.alarms=e},getAlarm:e=>this.alarms.find((i=>parseInt(i.title.substr(4),10)===e)),refreshAlarms:()=>{showList()},removeAlarm:e=>{this.removeLocalAlarm(e)},processItem:e=>{"remove"===e.whichEvent?this.removeLocalAlarm(e.expiredId):"clearall"===e.whichEvent&&(this.alarms.length=0),this.items.push(e)},removeItem:e=>{let i=this.items.findIndex((i=>i.id===e)),t=this.items.slice();t.splice(i,1),this.items=t},getPermissions:(e=!1)=>this.getPermReturn().then((e=>e)),setError:e=>{this.notifyError=htmlEscape(e),this.updateErrorMsg()},clearErrors:()=>{this.clearErrMsg()},updatePassiveNotification:()=>{runPassiveNotification("1")},triggerAlarm:e=>{this.getPermReturn(!0).then((e=>{if("granted"===e){new Notification("Expired To Be",{body:"One of your Expiration items is set to expire!",icon:"icon32.png"}).addEventListener("click",(e=>{parent.focus(),window.focus(),e.target.close()}))}else message("An expiration alarm was triggered, but notification permissions have been revoked since the alarm was originally set.",!0)}))}}):new ExpiredToBe}window.ourExpirations=window.ourExpirations||new ExpiredToBe