(function(u){if(typeof exports=="object"&&typeof module<"u")module.exports=u();else if(typeof define=="function"&&define.amd)define([],u);else{var l;l=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this,l.toolbox=u()}})(function(){return function u(l,$,m){function g(c,e){if(!$[c]){if(!l[c]){var d=typeof require=="function"&&require;if(!e&&d)return d(c,!0);if(p)return p(c,!0);var n=new Error("Cannot find module '"+c+"'");throw n.code="MODULE_NOT_FOUND",n}var o=$[c]={exports:{}};l[c][0].call(o.exports,function(f){var y=l[c][1][f];return g(y||f)},o,o.exports,u,l,$,m)}return $[c].exports}for(var p=typeof require=="function"&&require,h=0;hC.value[y]){var T=C.value[f];i.push(T),S.delete(T),C.continue()}},x.oncomplete=function(){a(i)},x.onabort=t}):Promise.resolve([])}function c(v,R){return R?new Promise(function(s,a){var t=[],r=v.transaction(o,"readwrite"),i=r.objectStore(o),x=i.index(y),S=x.count();x.count().onsuccess=function(){var w=S.result;w>R&&(x.openCursor().onsuccess=function(b){var C=b.target.result;if(C){var T=C.value[f];t.push(T),i.delete(T),w-t.length>R&&C.continue()}})},r.oncomplete=function(){s(t)},r.onabort=a}):Promise.resolve([])}function e(v,R,s,a){return h(v,s,a).then(function(t){return c(v,R).then(function(r){return t.concat(r)})})}var d="sw-toolbox-",n=1,o="store",f="url",y="timestamp",k={};l.exports={getDb:g,setTimestampForUrl:p,expireEntries:e}},{}],3:[function(u,l,$){"use strict";function m(n){var o=e.match(n.request);o?n.respondWith(o(n.request)):e.default&&n.request.method==="GET"&&n.request.url.indexOf("http")===0&&n.respondWith(e.default(n.request))}function g(n){c.debug("activate event fired");var o=d.cache.name+"$$$inactive$$$";n.waitUntil(c.renameCache(o,d.cache.name))}function p(n){return n.reduce(function(o,f){return o.concat(f)},[])}function h(n){var o=d.cache.name+"$$$inactive$$$";c.debug("install event fired"),c.debug("creating cache ["+o+"]"),n.waitUntil(c.openCache({cache:{name:o}}).then(function(f){return Promise.all(d.preCacheItems).then(p).then(c.validatePrecacheInput).then(function(y){return c.debug("preCache list: "+(y.join(", ")||"(none)")),f.addAll(y)})}))}u("serviceworker-cache-polyfill");var c=u("./helpers"),e=u("./router"),d=u("./options");l.exports={fetchListener:m,activateListener:g,installListener:h}},{"./helpers":1,"./options":4,"./router":6,"serviceworker-cache-polyfill":16}],4:[function(u,l,$){"use strict";var m;m=self.registration?self.registration.scope:self.scope||new URL("./",self.location).href,l.exports={cache:{name:"$$$toolbox-cache$$$"+m+"$$$",maxAgeSeconds:null,maxEntries:null},debug:!1,networkTimeoutSeconds:null,preCacheItems:[],successResponses:/^0|([123]\d\d)|(40[14567])|410$/}},{}],5:[function(u,l,$){"use strict";var m=new URL("./",self.location),g=m.pathname,p=u("path-to-regexp"),h=function(c,e,d,n){e instanceof RegExp?this.fullUrlRegExp=e:(e.indexOf("/")!==0&&(e=g+e),this.keys=[],this.regexp=p(e,this.keys)),this.method=c,this.options=n,this.handler=d};h.prototype.makeHandler=function(c){var e;if(this.regexp){var d=this.regexp.exec(c);e={},this.keys.forEach(function(n,o){e[n.name]=d[o+1]})}return function(n){return this.handler(n,e,this.options)}.bind(this)},l.exports=h},{"path-to-regexp":15}],6:[function(u,l,$){"use strict";function m(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var g=u("./route"),p=u("./helpers"),h=function(e,d){for(var n=e.entries(),o=n.next(),f=[];!o.done;){var y=new RegExp(o.value[0]);y.test(d)&&f.push(o.value[1]),o=n.next()}return f},c=function(){this.routes=new Map,this.routes.set(RegExp,new Map),this.default=null};["get","post","put","delete","head","any"].forEach(function(e){c.prototype[e]=function(d,n,o){return this.add(e,d,n,o)}}),c.prototype.add=function(e,d,n,o){o=o||{};var f;d instanceof RegExp?f=RegExp:(f=o.origin||self.location.origin,f=f instanceof RegExp?f.source:m(f)),e=e.toLowerCase();var y=new g(e,d,n,o);this.routes.has(f)||this.routes.set(f,new Map);var k=this.routes.get(f);k.has(e)||k.set(e,new Map);var v=k.get(e),R=y.regexp||y.fullUrlRegExp;v.has(R.source)&&p.debug('"'+d+'" resolves to same regex as existing route.'),v.set(R.source,y)},c.prototype.matchMethod=function(e,d){var n=new URL(d),o=n.origin,f=n.pathname;return this._match(e,h(this.routes,o),f)||this._match(e,[this.routes.get(RegExp)],d)},c.prototype._match=function(e,d,n){if(d.length===0)return null;for(var o=0;o0)return k[0].makeHandler(n)}}return null},c.prototype.match=function(e){return this.matchMethod(e.method,e.url)||this.matchMethod("any",e.url)},l.exports=new c},{"./helpers":1,"./route":5}],7:[function(u,l,$){"use strict";function m(h,c,e){return e=e||{},p.debug("Strategy: cache first ["+h.url+"]",e),p.openCache(e).then(function(d){return d.match(h).then(function(n){var o=e.cache||g.cache,f=Date.now();return p.isResponseFresh(n,o.maxAgeSeconds,f)?n:p.fetchAndCache(h,e)})})}var g=u("../options"),p=u("../helpers");l.exports=m},{"../helpers":1,"../options":4}],8:[function(u,l,$){"use strict";function m(h,c,e){return e=e||{},p.debug("Strategy: cache only ["+h.url+"]",e),p.openCache(e).then(function(d){return d.match(h).then(function(n){var o=e.cache||g.cache,f=Date.now();if(p.isResponseFresh(n,o.maxAgeSeconds,f))return n})})}var g=u("../options"),p=u("../helpers");l.exports=m},{"../helpers":1,"../options":4}],9:[function(u,l,$){"use strict";function m(h,c,e){return g.debug("Strategy: fastest ["+h.url+"]",e),new Promise(function(d,n){var o=!1,f=[],y=function(v){f.push(v.toString()),o?n(new Error('Both cache and network failed: "'+f.join('", "')+'"')):o=!0},k=function(v){v instanceof Response?d(v):y("No result returned")};g.fetchAndCache(h.clone(),e).then(k,y),p(h,c,e).then(k,y)})}var g=u("../helpers"),p=u("./cacheOnly");l.exports=m},{"../helpers":1,"./cacheOnly":8}],10:[function(u,l,$){l.exports={networkOnly:u("./networkOnly"),networkFirst:u("./networkFirst"),cacheOnly:u("./cacheOnly"),cacheFirst:u("./cacheFirst"),fastest:u("./fastest")}},{"./cacheFirst":7,"./cacheOnly":8,"./fastest":9,"./networkFirst":11,"./networkOnly":12}],11:[function(u,l,$){"use strict";function m(h,c,e){e=e||{};var d=e.successResponses||g.successResponses,n=e.networkTimeoutSeconds||g.networkTimeoutSeconds;return p.debug("Strategy: network first ["+h.url+"]",e),p.openCache(e).then(function(o){var f,y,k=[];if(n){var v=new Promise(function(s){f=setTimeout(function(){o.match(h).then(function(a){var t=e.cache||g.cache,r=Date.now(),i=t.maxAgeSeconds;p.isResponseFresh(a,i,r)&&s(a)})},1e3*n)});k.push(v)}var R=p.fetchAndCache(h,e).then(function(s){if(f&&clearTimeout(f),d.test(s.status))return s;throw p.debug("Response was an HTTP error: "+s.statusText,e),y=s,new Error("Bad response")}).catch(function(s){return p.debug("Network or response error, fallback to cache ["+h.url+"]",e),o.match(h).then(function(a){if(a)return a;if(y)return y;throw s})});return k.push(R),Promise.race(k)})}var g=u("../options"),p=u("../helpers");l.exports=m},{"../helpers":1,"../options":4}],12:[function(u,l,$){"use strict";function m(p,h,c){return g.debug("Strategy: network only ["+p.url+"]",c),fetch(p)}var g=u("../helpers");l.exports=m},{"../helpers":1}],13:[function(u,l,$){"use strict";var m=u("./options"),g=u("./router"),p=u("./helpers"),h=u("./strategies"),c=u("./listeners");p.debug("Service Worker Toolbox is loading"),self.addEventListener("install",c.installListener),self.addEventListener("activate",c.activateListener),self.addEventListener("fetch",c.fetchListener),l.exports={networkOnly:h.networkOnly,networkFirst:h.networkFirst,cacheOnly:h.cacheOnly,cacheFirst:h.cacheFirst,fastest:h.fastest,router:g,options:m,cache:p.cache,uncache:p.uncache,precache:p.precache}},{"./helpers":1,"./listeners":3,"./options":4,"./router":6,"./strategies":10}],14:[function(u,l,$){l.exports=Array.isArray||function(m){return Object.prototype.toString.call(m)=="[object Array]"}},{}],15:[function(u,l,$){function m(t,r){for(var i,x=[],S=0,w=0,b="",C=r&&r.delimiter||"/";(i=a.exec(t))!=null;){var T=i[0],A=i[1],E=i.index;if(b+=t.slice(w,E),w=E+T.length,A)b+=A[1];else{var O=t[w],P=i[2],F=i[3],j=i[4],D=i[5],U=i[6],L=i[7];b&&(x.push(b),b="");var M=P!=null&&O!=null&&O!==P,N=U==="+"||U==="*",_=U==="?"||U==="*",q=i[2]||C,I=j||D;x.push({name:F||S++,prefix:P||"",delimiter:q,optional:_,repeat:N,partial:M,asterisk:!!L,pattern:I?d(I):L?".*":"[^"+e(q)+"]+?"})}}return w=46||p==="Chrome"&&h>=50)||(Cache.prototype.addAll=function(c){function e(n){this.name="NetworkError",this.code=19,this.message=n}var d=this;return e.prototype=Object.create(Error.prototype),Promise.resolve().then(function(){if(arguments.length<1)throw new TypeError;return c=c.map(function(n){return n instanceof Request?n:String(n)}),Promise.all(c.map(function(n){typeof n=="string"&&(n=new Request(n));var o=new URL(n.url).protocol;if(o!=="http:"&&o!=="https:")throw new e("Invalid scheme");return fetch(n.clone())}))}).then(function(n){if(n.some(function(o){return!o.ok}))throw new e("Incorrect response status");return Promise.all(n.map(function(o,f){return d.put(c[f],o)}))}).then(function(){})},Cache.prototype.add=function(c){return this.addAll([c])})})()},{}]},{},[13])(13)});