(()=>{var e;function r(){var n,r,t,i;return e||(n="meta_data",r="client",(t=indexedDB.open(n)).onupgradeneeded=function(){return t.result.createObjectStore(r)},i=o(t),e=function(t,e){return i.then(function(n){return e(n.transaction(r,t).objectStore(r))})}),e}function o(e){return new Promise(function(n,t){e.oncomplete=e.onsuccess=function(){return n(e.result)},e.onabort=e.onerror=function(){return t(e.error)}})}function t(t,n){return(1<arguments.length&&void 0!==n?n:r())("readonly",function(n){return o(n.get(t))})}function i(t,e,n){return(2<arguments.length&&void 0!==n?n:r())("readwrite",function(n){return n.put(e,t),o(n.transaction)})}self.addEventListener("push",function(n){var r;self.registration?(r=n.data.json(),t("client_id").then(function(e){t("browser_key").then(function(n){var t=!r.client_id||!e||r.client_id!=e;r.browser_key&&n&&r.browser_key==n&&!t&&self.registration.showNotification(r.title,r)})})):console.warn("Notification not Registered.")}),self.addEventListener("notificationclick",function(n){n.notification.data.url&&clients.openWindow(n.notification.data.url),n.notification.close()}),self.addEventListener("message",function(n){n=JSON.parse(n.data);i("client_id",n.client_id).then(function(){}).catch(function(n){return console.warn("Client ID saving failed!",n)}),i("browser_key",n.browser_key).then(function(){}).catch(function(n){return console.warn("Browser ID saving failed!",n)})})})();