importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.4.1/workbox-sw.js');

// Note: Ignore the error that Glitch raises about workbox being undefined.
workbox.skipWaiting();
workbox.clientsClaim();

workbox.routing.registerRoute(
  /.*\.js/,
  workbox.strategies.staleWhileRevalidate({
    cacheName: 'js-cache'
  })
);

workbox.routing.registerRoute(
  /.*\.(?:png|jpg|jpeg|svg|gif)/,
  workbox.strategies.staleWhileRevalidate({
    cacheName: 'image-cache'
  })
);

workbox.routing.registerRoute(
  /\/api\//,
  workbox.strategies.networkFirst({
    cacheName: 'api-cache'
  })
);

workbox.routing.registerRoute(
  /\/omniauth\//,
  workbox.strategies.networkOnly()
);

function handlePushEvent(event) {
  return Promise.resolve()
  .then(() => {
    return event.data.json();
  })
  .then((data) => {
    const title = data.title;
    const options = data.options;
    if (!options.icon) {
      options.icon = '/images/icon-512x512.png';
    }
    return registration.showNotification(title, options);
  })
  .catch((err) => {
    const title = 'Message Received from Botnbot';
    const options = {
      body: event.data.text(),
      icon: '/images/icon-512x512.png'
    };
    return registration.showNotification(title, options);
  });
}

self.addEventListener('push', function(event) {
  event.waitUntil(handlePushEvent(event));
});


workbox.precaching.precacheAndRoute([]);

@@ -1,8 +1,135 @@
+/* global importScripts */%0A/* global registration */%0A/* global workbox */%0A/* eslint no-restricted-globals: %5B%22off%22, %22self%22%5D */%0A%0A
 importSc
@@ -443,29 +443,31 @@
 : 'js-cache'
+,
 %0A  %7D)
+,
 %0A);%0A%0Aworkbox
@@ -592,29 +592,31 @@
 image-cache'
+,
 %0A  %7D)
+,
 %0A);%0A%0Aworkbox
@@ -714,21 +714,23 @@
 i-cache'
+,
 %0A  %7D)
+,
 %0A);%0A%0Awor
@@ -809,16 +809,17 @@
 rkOnly()
+,
 %0A);%0A%0Afun
@@ -876,16 +876,18 @@
 solve()%0A
+  
   .then(
@@ -895,21 +895,8 @@
 ) =%3E
- %7B%0A    return
  eve
@@ -909,23 +909,20 @@
 a.json()
-;
+)
 %0A  
-%7D)%0A
   .then(
@@ -939,36 +939,8 @@
 %7B%0A  
-  const title = data.title;%0A
     
@@ -944,24 +944,26 @@
    const
+ %7B
  options
  = data.
@@ -958,25 +958,21 @@
 ions
+ %7D
  = data
-.options
 ;%0A
+  
     
@@ -992,16 +992,18 @@
 icon) %7B%0A
+  
       op
@@ -1051,14 +1051,18 @@
     
+  
 %7D%0A    
+ 
+ 
 retu
@@ -1086,32 +1086,37 @@
 howNotification(
+data.
 title, options);
@@ -1122,11 +1122,15 @@
 ;%0A  
+ 
+ 
 %7D)%0A
+  
   .c
@@ -1135,19 +1135,16 @@
 .catch((
-err
 ) =%3E %7B%0A 
@@ -1142,24 +1142,26 @@
 () =%3E %7B%0A    
+  
 const title 
@@ -1195,16 +1195,18 @@
 tnbot';%0A
+  
     cons
@@ -1225,16 +1225,18 @@
 %7B%0A      
+  
 body: ev
@@ -1258,16 +1258,18 @@
 ,%0A      
+ 
+ 
 icon: '/
@@ -1296,16 +1296,21 @@
 png'
-%0A
+,%0A  
     %7D;%0A
+  
     
@@ -1363,16 +1363,18 @@
 tions);%0A
+  
   %7D);%0A%7D%0A
@@ -1408,23 +1408,18 @@
 h', 
-function
 (event)
+ =%3E
  %7B%0A 

Fix lint errors