/* ! speed-kit 1.13.1 | Copyright (c) 2018 Baqend GmbH */ "use strict";function t(t,e){const s=3&e.length,i=e.length-s,r=3432918353,n=461845907;let a,o,c,h;for(a=t,h=0;h>>16)*r&65535)<<16)&4294967295)<<15|c>>>17))*n+(((c>>>16)*n&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(c=0,s){case 3:c^=(255&e.charCodeAt(h+2))<<16;case 2:c^=(255&e.charCodeAt(h+1))<<8;case 1:a^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(h)))*r+(((c>>>16)*r&65535)<<16)&4294967295)<<15|c>>>17))*n+(((c>>>16)*n&65535)<<16)&4294967295}return a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}class e{constructor(t,e=62353,s=5){this.w=t,this.x=e,this.y=s}static fromBuffer(t){const s=new Int32Array(t,0,2),[i,r]=s;return new e(new Uint8Array(t,8),i,r)}static fromJSON(t){return new e((s=t.b,Uint8Array.from([...atob(s)].map(t=>t.charCodeAt(0)))),t.m,t.h);var s}contains(t){return this.u(t).every(t=>this.v(t))}u(e){const s=[],i=t(0,e),r=t(i,e);for(let t=0;t>3];if(e){return 0!=(e&1<<(7&t))}return!1}}var s;!function(t){t[t.OK=200]="OK",t[t.BaqendRedirect=231]="BaqendRedirect",t[t.MovedPermanently=301]="MovedPermanently",t[t.BadRequest=400]="BadRequest",t[t.Forbidden=403]="Forbidden",t[t.InternalServerError=500]="InternalServerError",t[t.BadGateway=502]="BadGateway",t[t.FetchTypeError=542]="FetchTypeError"}(s||(s={}));const i="baqend-speedkit",r="baqend-speedkit-store",n="default",a="baqend-speed-kit";function o(){const{userAgent:t}=navigator,e=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];let s=null;if(/trident/i.test(e[1]))return s=/\brv[ :]+(\d+)/g.exec(t)||[],["IE ",parseInt(s[1],10)||0];if("Chrome"===e[1]&&null!=(s=t.match(/\b(Edge)\/(\d+)/)))return[s.slice(1)[0],parseInt(s.slice(1)[1],10)];const i=e[2]?[e[1],parseInt(e[2],10)]:[navigator.appName,parseInt(navigator.appVersion,10)];return null!=(s=t.match(/version\/(\d+)/i))&&i.splice(1,1,parseInt(s[1],10)),i}function c(t){return new Promise(e=>setTimeout(e,t))}function h(t){const[e]=o();return"Safari"===e?async function t(e){const s=Date.now();if(e<10)return;if(e<500)return c(e);await c(500);const i=Date.now()-s;return t(e-i)}(t):c(t)}class l{constructor(t){this.public=t.has("public"),this.private=t.has("private"),this.noCache=t.has("no-cache"),this.onlyIfCached=t.has("only-if-cached"),this.maxAge=t.get("max-age"),this.swMaxAge=t.get("sw-max-age"),this.maxStale=t.get("max-stale"),this.minFresh=t.get("min-fresh"),this.staleWhileRevalidate=t.get("stale-while-revalidate"),this.staleIfError=t.get("stale-if-error"),this.mustRevalidate=t.has("must-revalidate"),this.proxyRevalidate=t.has("proxy-revalidate"),this.immutable=t.has("immutable"),this.noStore=t.has("no-store"),this.noTransform=t.has("no-transform")}static fromString(t){const e=t.split(/,\s*/).map(t=>t.split("=",2)).map(([t,e])=>[t,e?parseInt(e,10):-1]),s=new Map(e);return new l(s)}}function u(t,e){const s=t.headers.get("date")||"";return Date.parse(s)+e}function p(t,e){return l.fromString(t.headers.get(e)||"")}function d(t,e){const s=p(t,"cache-control"),i=p(t,"baqend-sw-control"),r=function(...t){for(const e of t)if(null!=e)return e;return null}(s.swMaxAge,i.maxAge,s.maxAge),n=t.headers.get("date");if(n&&null!=r){const s=function(t,e,s=0){const i=t.headers.get(e);return null==i?s:parseInt(i,10)}(t,"age"),i=(new Date(n),u(t,e)+1e3*(r-s));return Date.now(),Date.now()t.split("=",2));return new Map(e)}async function w(t){const e=(await caches.keys()).filter(t).map(t=>caches.delete(t));await Promise.all(e)}class v{constructor(t,e,s){this.cacheKey=e,this.serverRevision=s,this.Ac=t}async delete(){await w(t=>t.startsWith(i)&&t.endsWith(this.cacheKey)),this.cacheKey}async loadResponse(t){const e=await this.Ab(t),s=new Request(t.cacheKey);return await caches.match(s,{cacheName:e})}async storeResponse(t,e){const s=await this.Aa(t),i=new Request(t.cacheKey);await s.put(i,e)}Aa(t){const e=this.Ab(t);return this.cacheKey,caches.open(e)}Ab(t){const e=this.Ac.getUserAgentClass(t.request)||"assets";return`${i}-${e}-${this.cacheKey}`}}var y;!function(t){t.Document="document",t.Audio="audio",t.Video="video",t.Track="track",t.Image="image",t.Style="style",t.Script="script",t.Font="font"}(y||(y={}));const b=[y.Document,y.Script,y.Style];function A(t,e){return new Request(t,e)}function R(t,e,s={}){const i=new Headers,r=["accept","accept-language","content-language","content-type"];for(const[e,s]of t.headers)r.includes(e.toLocaleLowerCase())&&i.append(e,s);const n={headers:i,credentials:"omit"};return"navigate"!==t.mode&&(n.mode=t.mode),new Request(e,Object.assign(n,s))}function S(t){const e=q(t),{pathname:s}=new URL(t.url),i=".svg"===O(s);return!e||b.includes(e)||i}function q(t){const e=function(t){for(const e of Object.values(y))if(e===t)return e;return null}(t.destination||"");if(e)return t.url,e;const s=function(t){const e=[];if(!t||"*/*"===t)return null;(t.includes("text/html")||t.includes("application/xhtml+xml"))&&e.push(y.Document);t.includes("text/css")&&e.push(y.Style);(t.includes("text/javascript")||t.includes("application/javascript")||t.includes("application/wasm"))&&e.push(y.Script);t.includes("image/")&&e.push(y.Image);t.includes("font/")&&e.push(y.Font);t.includes("video/")&&e.push(y.Video);t.includes("audio/")&&e.push(y.Audio);t.includes("text/vtt")&&e.push(y.Track);return 1===e.length?e[0]:null}(t.headers.get("Accept")||"");if(s)return t.url,s;if("navigate"===t.mode)return y.Document;const{pathname:i}=new URL(t.url),r=function(t){switch(t){case".js":case".mjs":case".wasm":case".wast":return y.Script;case".html":case".htm":return y.Document;case".css":return y.Style;case".woff2":case".woff":case".ttf":case".otf":case".eot":return y.Font;case".mp3":case".wav":return y.Audio;case".vtt":return y.Track;case".png":case".jpeg":case".jpg":case".gif":case".svg":case".ico":case".webp":return y.Image;case".mp4":case".ogg":case".ogv":case".webm":return y.Video;default:return null}}(O(i));return r?(t.url,r):i.endsWith("/")?y.Document:null}function O(t){const e=t.lastIndexOf(".");return-1===e||t.lastIndexOf("/")>e?"":t.substr(e).toLowerCase()}class k{constructor(){this.Ah=new Promise(t=>{this.resolver=t})}finish(){this.resolver&&this.resolver()}waitForRequest(){return this.Ah}}function x(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,s,a):r(e,s))||a);return n>3&&a&&Object.defineProperty(e,s,a),a}const I=new Map;class C{constructor(t,e){this.clientId=t,this.url=e}static fromClientID(t){const e=I.get(t);if(!e){const e=clients.get(t),s=new C(t,e.then(t=>new URL(t.url)));return I.set(t,s),s}return e}static fromNavigateURL(t){return new C("",Promise.resolve(new URL(t)))}}class U{constructor(t=""){this.AG=new Map,t&&this.fromString(t)}clear(){this.AG.clear()}fromString(t){this.clear();const e=t.trim();if(!e)return;const s=e.split(/\s*;\s+/);for(const t of s){const[e,s]=t.split(/\s*=\s*/,2);this.AG.set(e,s)}}toString(){return[...this.AG].map(([t,e])=>`${t}=${e}`).join("; ")}getItem(t){return this.AG.get(t)}keys(){return this.AG.keys()}}function D(t){return function(e){return class extends e{async handle(e,s,i){if(!this.Ad(s))return!1;const{type:r}=s,n=x(s,["type"]);return t===r&&super.handle(e,n,i)}Ad(t){return!!t&&"object"==typeof t&&"string"==typeof t.type}}}}function E(t){return function(e){return class extends e{cachePath(){return t}}}}class L{constructor(){this.f=[]}observe(t){this.f.push(t)}notify(){for(const t of this.f)t()}}let F=class extends L{constructor(){super(),this.AH=new Map}getCookies(t){return this.AH.get(t)||new U}updateCookies(t,e){this.AH.set(t,new U(e)),this.notify()}toJSON(){return{origins:[...this.AH].map(([t,e])=>[t,e.toString()])}}fromJSON(t){if("string"==typeof t)return this.fromJSON({origins:[[location.origin,t]]}),void this.notify();const{origins:e}=t;this.AH.clear();for(const[t,s]of e)this.AH.set(t,new U(s));this.AH}};F=N([E("/com.baqend.speedkit.cookie")],F);class P{constructor(t,e,s,i,r,n=!1,a=new Map){this.wasCacheHit=!1,this.originalRequest=t,this.request=t,this.cacheKey=e,this.navigation=s,this.cookies=i,this.s=r,this.t=n,this.marks=a}static create(t,e){const s=C.fromNavigateURL(t),{navigation:i=s,cookies:r=new U,critical:n=!1}=e,a=x(e,["navigation","cookies","critical"]),o=new Request(t,a);return new P(o,t,i,r,"navigate"===e.mode,n)}static fromEvent(t,e=new U){const{request:s}=t,i="navigate"===s.mode,r=s.url,n=i?C.fromNavigateURL(r):C.fromClientID(t.clientId);return new P(s,r,n,e,i)}get url(){return new URL(this.request.url)}get timings(){const t=Object.create(null);for(const[e,s]of this.marks)t[e]=s;return t}mark(t){this.marks.set(t,Date.now())}isNavigateRequest(){return this.s}isCritical(){return this.t}isSameOrigin(){return this.url.origin===location.origin}set url(t){const e=t.toString();this.url.toString()!==e&&(this.request=R(this.request,e))}set method(t){this.request.method.toUpperCase()!==t&&(this.request=A(this.request,{method:t}))}set mode(t){this.request.mode!==t&&(this.request=A(this.request,{mode:t}))}set cache(t){this.request.cache!==t&&(this.request=A(this.request,{cache:t}))}async fetch(){this.mark("fetchStart");const t=await fetch(this.request);return this.mark("fetchEnd"),t}fetchOriginal(){return fetch(this.originalRequest)}}function j(t,e){if(!e)return t.toString();try{return new URL(e).toString()}catch(s){if(e.startsWith("//"))return`${t.protocol}${e}`;if(e.startsWith("/"))return`${t.origin}${e}`;const i=function t(e){return e.startsWith("/")?t(e.substr(1)):e}(t.pathname).split("/"),r=e.split("/");i.pop();for(const t of r)".."===t?i.pop():"."===t||i.push(t);return`${t.origin}/${i.join("/")}`}}class ${}function J(t){if("string"!=typeof t)return null;const e=/^regexp:\/(.*)\/([\w]*)$/.exec(t);if(e){const[,t,s]=e;return new RegExp(t,s)}return null}function M(t){return JSON.parse(t,(t,e)=>"string"==typeof e&&J(e)||e)}$.propName="";class W extends ${constructor(t=[]){super(),this.Ae=t}matches(t,e){return!!this.Ae.length&&this.Ae.every(s=>s.matches(t,e))}toJSON(){const t={};for(const e of this.Ae){t[e.constructor.propName]=e.toJSON()}return t}fromJSON(t){if("string"==typeof t)return this.fromJSON(M(t));for(const[e,s]of Object.entries(t)){if(!st[e])throw new Error(`Illegal rule: ${e}`);{const t=new st[e];t.fromJSON(s),this.addCondition(t)}}return this}addCondition(t){return this.Ae.push(t)}removeCondition(t){const e=this.Ae.indexOf(t);return!(e<0)&&(this.Ae.splice(e,1),!0)}}function B(t,e){return e instanceof Array?e.some(e=>B(t,e)):e instanceof RegExp?e.test(t):t.startsWith(e)}class z extends ${constructor(t=[]){super(),this.Af=t}matches(t,e){if(!this.Af.length)return!1;const s=q(t);if(s){const t=this.Af.includes(s);return t}return!1}toJSON(){return this.Af}fromJSON(t){if("string"==typeof t)return this.fromJSON(M(t));if(t instanceof Array)return this.Af=t,this;throw new Error("Invalid ContentTypeCondition JSON")}}z.propName="contentType";class H extends ${constructor(t){super(),this.Ai=t}test(t){return null!=this.Ai&&B(t,this.Ai)}toJSON(){return this.Ai?function t(e){return e instanceof Array?e.map(e=>t(e)):e instanceof RegExp?`regexp:/${(s=e).source}/${s.flags||""}`:e;var s}(this.Ai):null}fromJSON(t){if(null==t||"null"===t)return this.Ai=null,this;try{return this.fromJSON(M(t))}catch(t){}return this.Ai=t,this}}class T extends H{matches(t,e){if(!e)return!1;if(!t.url.startsWith(location.origin))return location.origin,!1;const s=[...e.keys()].some(t=>this.test(t));return s}}T.propName="cookie";class K extends ${matches(t,e){const s=t.headers.get("user-agent")||navigator.userAgent;return!s||(this.constructor.name,this.userAgentMatches(s),this.userAgentMatches(s))}toJSON(){return!0}fromJSON(t){return this}}class G extends K{userAgentMatches(t){const e=t.toLowerCase();return e.includes("wow64")||e.includes("windows nt")||e.includes("win64")||e.includes("msie")||e.includes("macintosh;")||e.includes("linux x86_64")}}function Q(t){const[,e,s,i,r,n,a]=/^(?:(https?:)\/\/)?(([\w.-]+)(?::(\d+))?)([^#]*)(#.*)?$/.exec(t);return{protocol:e,host:s,hostname:i,port:r,pathname:n,hash:a}}G.propName="desktop";class V extends H{matches(t,e){return this.test(Q(t.url).host)}}V.propName="host";class X extends K{userAgentMatches(t){return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(?:browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br[ev]w|bumb|bw\-[nu]|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c[- ]|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))}}X.propName="mobile";class Z extends H{matches(t,e){return this.test(Q(t.url).pathname)}}Z.propName="pathname";class Y extends ${constructor(t=[]){super(),this.Ag=t}get size(){return this.Ag.length}toJSON(){return this.Ag.map(t=>t.toJSON())}fromJSON(t){if(t instanceof Array)return this.Ag=t.map(t=>(new W).fromJSON(t)),this;throw new Error("Invalid RuleSet JSON")}matches(t,e){return this.Ag.some(s=>s.matches(t,e))}[Symbol.iterator](){return this.Ag[Symbol.iterator]()}addRule(t){return this.Ag.push(t)}removeRule(t){const e=this.Ag.indexOf(t);return!(e<0)&&(this.Ag.splice(e,1),!0)}}class _ extends K{userAgentMatches(t){const e=t.toLowerCase();return e.includes("tablet")||e.includes("ipad")||e.includes("nexus 7")||e.includes("nexus 10")||e.includes("silk/")||!!e.match(/\bgt-[pn]\d{4}\b/)}}_.propName="tablet";class tt extends K{userAgentMatches(t){const e=t.toLowerCase();return e.includes("appletv")||e.includes("apple tv")||e.includes("googletv")||e.includes("crkey")||e.includes("armv7l")||e.includes("aftt")||e.includes("aftm")||e.includes("roku")||e.includes("bravia")||e.includes("philipstv")||e.includes("tsbnettv")||e.includes("smarttv")||!!e.match(/\btv\b/)}}tt.propName="tv";class et extends H{matches(t,e){return this.test(function(t){const[,e]=/^(?:(?:\w+?:)?\/\/)?(.*)$/.exec(t);return e}(t.url))}}et.propName="url";const st={[z.propName]:z,[T.propName]:T,[G.propName]:G,[V.propName]:V,[X.propName]:X,[Z.propName]:Z,[_.propName]:_,[tt.propName]:tt,[et.propName]:et};var it;const rt=2;let nt=it=class extends L{constructor(t){super(),this.M=null,this.N=null,this.O=!0,this.properties=it.getDefaults(),this.L=t}get appURL(){if(!this.optionalAppURL)throw new Error("Options are not initialized yet.");return this.optionalAppURL}get reconnectInterval(){return this.properties.reconnectInterval}get refreshInterval(){return 1e3*this.properties.refreshInterval}get relativeModuleImports(){return this.properties.relativeModuleImports}get staleWhileRevalidate(){return 1e3*this.properties.staleWhileRevalidate}get preloadBloomFilter(){return this.properties.preloadBloomFilter}get cachingDisabled(){return this.properties.disableCache}configure(t){this.fromJSON(t),this.notify()}shouldCacheRequest(t,e=!1){const{request:s,cookies:i,url:r}=t;return!this.properties.disableCache&&(this.properties.whitelist.size&&!this.properties.whitelist.matches(s,i)?(s.url,!1):this.properties.blacklist.matches(s,i)?(s.url,!1):!!e||(this.properties.enabledSites.size&&"navigate"===s.mode&&(this.O=this.properties.enabledSites.matches(s,i)),this.O))}shouldDelayRequest(t){return!!this.properties.delayed.matches(t.request,t.cookies)&&(t.url,!0)}hasRelativeModuleImports(){return this.properties.relativeModuleImports}async isEnabledOnSite(t){return!!t.isNavigateRequest()||this.H(t,this.properties.enabledSites)}async isEnabledOnURL(t,e=this.properties.enabledSites){if(!e.size)return!0;const s=e.matches(new Request(t.toString()));return s}async H(t,e){return!e||!e.size||(t.isNavigateRequest()?e.matches(t.request,t.cookies):this.isEnabledOnURL(await t.navigation.url,e))}getUserAgentClass(t){if(!this.properties.userAgentDetection)return null;const e=t.headers.get("user-agent")||navigator.userAgent||navigator.vendor,s="navigate"===t.mode&&e!==this.N;return null==this.M||s?(this.N=e,this.I(e)?this.M="mobile":this.J(e)?this.M="tablet":this.M=this.K(e)?"tv":"desktop"):this.M}async shouldFetchOrigin(t){if("navigate"!==t.mode||-1===this.properties.fetchOriginInterval)return!1;if(0===this.properties.fetchOriginInterval)return!0;const e=Math.floor(Date.now()/1e3),s=await this.L.get("/fetch-origin-time")||e;if(s<=e){const t=s+this.properties.fetchOriginInterval+rt;return await this.L.set("/fetch-origin-time",t),!0}return!1}async getImageOptions(t){const e=it.getImageDefaults();if(this.properties.image instanceof Array){for(const s of this.properties.image){if(!s.rules||s.rules.matches(t.request)){await this.H(t,s.enabledSites)&&(s.options,Object.assign(e,s.options))}}return e}return Object.assign(e,this.properties.image)}shouldStripQueryParameter(t){return null!==this.properties.stripQueryParams&&B(t,this.properties.stripQueryParams)}async getCriticalResources(t){const e=[];for(const{enabledOn:s,resources:i}of this.properties.criticalResources)await this.H(t,s)&&e.push(...i);return e.filter((t,s)=>e.indexOf(t)===s)}I(t){const e=t;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(?:browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br[ev]w|bumb|bw\-[nu]|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c[- ]|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}J(t){if(["iPad","Linux armv"].some(t=>navigator.platform.startsWith(t)))return!0;return t.includes("Tablet PC")}K(t){const e=navigator.platform.toLowerCase();if(["nintendo","playstation"].some(t=>e.startsWith(t)))return!0;const s=t;return!!(s.toLowerCase().includes("appletv")||s.includes("googletv")||s.includes("smarttv"))}toJSON(){const t=this.properties.image instanceof Array?this.properties.image.map(t=>({options:t.options,enabledSites:t.enabledSites&&t.enabledSites.toJSON(),rules:t.rules&&t.rules.toJSON()})):this.properties.image,e=this.properties.criticalResources.map(t=>({enabledOn:t.enabledOn&&t.enabledOn.toJSON(),resources:t.resources})),s=new URL(this.appURL);let i,r="local";return s.host.endsWith(".app.baqend.com")?r=s.host.substring(s.host.length-".app.baqend.com".length):i=s.host,{appName:r,appDomain:i,image:t,criticalResources:e,blacklist:this.properties.blacklist.toJSON(),whitelist:this.properties.whitelist.toJSON(),delayed:this.properties.delayed.toJSON(),enabledSites:this.properties.enabledSites.toJSON(),disableCache:this.properties.disableCache,userAgentDetection:this.properties.userAgentDetection,stripQueryParams:this.properties.stripQueryParams||void 0,fetchOriginInterval:this.properties.fetchOriginInterval,preloadBloomFilter:this.properties.preloadBloomFilter,reconnectInterval:this.properties.reconnectInterval,refreshInterval:this.properties.refreshInterval,staleWhileRevalidate:this.properties.staleWhileRevalidate}}fromJSON(t){const{sw:e,scope:s,disabled:i}=t,r=x(t,["sw","scope","disabled"]),{appName:n,appDomain:a}=r,o=x(r,["appName","appDomain"]);this.optionalAppURL=`https://${a||`${n}.app.baqend.com`}/v1`,this.optionalAppURL;const c=it.getDefaults(),{maxStaleness:h,refreshInterval:l}=o,u=x(o,["maxStaleness","refreshInterval"]),p=l||h&&h/1e3||c.refreshInterval,{whitelist:d,blacklist:m,delayed:f,enabledSites:g,criticalResources:w,image:v}=u,y=x(u,["whitelist","blacklist","delayed","enabledSites","criticalResources","image"]);this.properties=Object.assign({},c,{refreshInterval:p,whitelist:(new Y).fromJSON(d||[]),blacklist:(new Y).fromJSON(m||[]),delayed:(new Y).fromJSON(f||[]),enabledSites:(new Y).fromJSON(g||[]),criticalResources:it.initCriticalResources(w),image:it.initImage(v)},y)}static getDefaults(){return{blacklist:new Y,criticalResources:[],delayed:new Y,disableCache:!1,enabledSites:new Y,fetchOriginInterval:-1,image:this.getImageDefaults(),preloadBloomFilter:!0,reconnectInterval:6e4,refreshInterval:300,relativeModuleImports:!1,staleWhileRevalidate:1800,stripQueryParams:null,userAgentDetection:!1,whitelist:new Y}}static getImageDefaults(){return{downscale:!0,screenSizeFactor:1,maxWidth:!1,maxHeight:!1,quality:85,webp:!0,pjpeg:!0,crop:!1}}static initImage(t){return t?t instanceof Array?t.map(t=>({enabledSites:t.enabledSites&&(new Y).fromJSON(t.enabledSites),rules:t.rules&&(new Y).fromJSON(t.rules),options:it.normalizeImageOptions(t.options)})).reverse():it.normalizeImageOptions(t):{}}static normalizeImageOptions(t){return"number"==typeof t.quality?t.quality=Math.max(1,Math.min(100,Math.round(t.quality))):!1===t.quality&&(t.quality=100),t}static initCriticalResources(t=[]){return t.length?t.map(it.makeResourceRule).map(it.normalizeResourceURLs).map(it.instantiateResourceEnabledOn).reverse():[]}static makeResourceRule(t){return"string"==typeof t?{resources:[t]}:t}static normalizeResourceURLs({enabledOn:t,resources:e}){const s=new URL(location.href);return{enabledOn:t,resources:e.map(t=>j(s,t))}}static instantiateResourceEnabledOn({enabledOn:t,resources:e}){return{enabledOn:t&&(new Y).fromJSON(t),resources:e}}};nt=it=N([E("/com.baqend.speedkit.config")],nt);class at{constructor(t,e,s,i){this.AX=new Map,this.options=t,this.AU=e,this.AV=s,this.screen=i;const[r,n]=o();this.AW=!("Chrome"===r&&n<64||"Firefox"===r&&n<61)}async handleRequest(t,e){const s=this.AI(t);s.mark("cacheStart");const i=this.AU.revision,r=await i.loadResponse(s);if(s.mark("cacheEnd"),e&&e.waitUntil(this.AL(s)),s.url,r)return this.AM(s,r);if(s.isNavigateRequest()){const{navigation:t}=s,e=await this.options.getCriticalResources(s);for(const s of e){const e=P.create(s,{navigation:t,critical:!0});this.handleRequest(e)}}const n=await this.AK(s);return n||this.AO(s)}shouldHandle(t,e=!1){return this.options.shouldCacheRequest(t,e)}isEnabledOnURL(t,e){return this.options.isEnabledOnURL(t,e)}async fetchEnhanced(t){try{t.mode=this.AT(t);const e=this.AU.isStale(t.cacheKey);return t.cache=e?"no-cache":"default",t.url.toString(),t.request.cache,await t.fetch()}catch(t){const e=t instanceof TypeError?s.FetchTypeError:s.BadGateway;return new Response(t.message,{status:e})}}AI(t){const{url:e}=t;for(const t of Array.from(e.searchParams.keys()))this.options.shouldStripQueryParameter(t)&&e.searchParams.delete(t);return e.hash&&(e.hash=""),e.searchParams.sort(),t.method="GET",t.url=e,t.cacheKey=e.toString(),t}async AJ(t){const e=t.url,s=this.AX.get(e);return!!s&&(await s.waitForRequest(),!0)}async AK(t){if(t.isNavigateRequest()||!t.isSameOrigin()||!this.AW)return null;const e=t.originalRequest.url;try{const t=await fetch(e,{mode:"same-origin",cache:"only-if-cached"});if(d(t,this.AV.getDrift()))return t}catch(t){}return null}async AL(t){if(await this.options.shouldFetchOrigin(t.request)){await h(1e3*rt);try{await t.fetchOriginal()}catch(t){t.stack}}}async AM(t,e){return navigator.onLine?await this.AN(t,e)?(t.url,t.wasCacheHit=!0,e):(t.url,this.AO(t)):(t.url,t.wasCacheHit=!0,e)}async AN(t,e){return!!d(e,this.AV.getDrift())&&(await this.AS(t)&&!this.isCorrupted(t,e))}isCorrupted(t,e){return!1}async AO(t){if(await this.AJ(t.originalRequest)){const e=await this.AU.revision,s=await e.loadResponse(t);if(t.url.toString(),s)return this.AM(t,s)}return t.isCritical()&&this.AX.set(t.originalRequest.url,new k),this.AP(t)}async AP(t){const e=await this.fetchEnhanced(t);return this.AQ(t,e)}async AQ(t,e){if(e.status>=s.InternalServerError)return this.AR(t.originalRequest),t.isCritical()?new Response("",{status:s.InternalServerError}):(this.AU.disconnect(),t.fetchOriginal());if(e.status>=s.BadRequest)return this.AR(t.originalRequest),t.isCritical()?new Response("",{status:s.BadRequest}):t.fetchOriginal();if(this.options.cachingDisabled)return this.AR(t.originalRequest),e;return this.AU.revision.storeResponse(t,e.clone()).then(()=>{t.url.toString(),this.AU.addToRevalidationWhitelist(t.cacheKey),this.AR(t.originalRequest)}).catch(e=>{t.url,e.message,this.AR(t.originalRequest)}),e}AR(t){const e=this.AX.get(t.url);e&&(e.finish(),this.AX.delete(t.url))}async AS(t){t.url.toString();if(!this.AU.isFromSameSession())return!1;if(t.isNavigateRequest()){if("reload"===t.request.cache)return t.request.cache,await this.AU.purgeBloomFilter(),!1;"no-cache"===t.request.cache&&(t.request.cache,this.AU.fetchBloomFilter())}return!this.AU.isStale(t.cacheKey)}AT(t){return t.isSameOrigin()?"same-origin":t.request.headers.has("origin")||t.request.url.startsWith(this.options.appURL)?"cors":"no-cors"}}class ot extends at{get assetPrefix(){return`${this.options.appURL}/asset/`}async g(t){return this.i(t.request)?t:this.j(t)}async fetchEnhanced(t){const e=await this.g(t),s=await super.fetchEnhanced(e),i=await this.handleRedirect(s,t.originalRequest);return this.h(t.request,i)}isCorrupted(t,e){if(!e.url||!S(t.request))return!1;return!(q(t.request)===y.Script&&!this.options.relativeModuleImports)&&(e.url,t.url.toString(),e.url.includes("/v1/asset/"))}async h(t,e){if(!S(t))return t.url,e;if(q(t)===y.Script&&!this.options.relativeModuleImports)return t.url,e;const s=await m(e);return Object.defineProperty(s,"url",{value:t.url}),t.url,s}i(t){return t.url.startsWith(this.options.appURL)}async j(t){const{request:e,url:s}=t;s.hash="";const i=this.options.getUserAgentClass(e);i&&"desktop"!==i&&s.searchParams.append("bqvariation",i),t.url=s;const r=await this.k(t),n=new URL(`${this.assetPrefix}${r}`);return e.url,t.url=n,t}async k(t){const{request:e,url:s}=t,i=q(e);if(e.destination,i!==y.Image)return s;if(".svg"===O(s.pathname))return s;const r=[],n=await this.options.getImageOptions(t),a=await this.l(e,n);a&&r.push(a),n.webp&&r.push("auto=webp"),100!==n.quality&&r.push(`quality=${n.quality}`),n.pjpeg&&s.pathname.match(/\.jpe?g$/i)&&r.push("format=pjpeg");const o=n.crop;if(o)if("string"==typeof o)r.push(`crop=${o},smart`);else if(o instanceof Array)if(o.length>=4){const[t,e,s,i]=o;r.push(`crop=${s},${i},x${t},y${e}`)}else if(o.length>=2){const[t,e]=o;r.push(`crop=${t},${e},smart`)}return r.length&&(s.searchParams.append("bqoptimize","1"),s.search+=`;${r.join(";")}`),s}async l(t,e){const s=t.headers.get("width");if(null!==s)return`width=${this.n(parseInt(s,10))}`;if(!e.downscale)return null;if(e.maxHeight)return`height=${e.maxHeight}`;const i=await this.m(e),r=e.maxWidth?e.maxWidth:i;return isFinite(r)&&r>0?`width=${r}`:null}async m(t){const{width:e,dpr:s}=this.screen,i=s*(t.screenSizeFactor||1);return this.n(e*i)}n(t){return t<=240?240:t<=375?375:t<=576?576:t<=768?768:t<=992?992:t<=1200?1200:t<=1920?1920:t<=2560?2560:t<=3840?3840:t}}let ct=class extends L{constructor(){super(...arguments),this.A=0}getDrift(){return this.A}updateDrift(t){this.A=t,this.notify()}toJSON(){return{drift:this.A}}fromJSON(t){this.A=t.drift}};function ht(t,e,s,i){return Promise.resolve(t).then(t=>new Promise((r,n)=>{const a=t.transaction(e,s),o=Promise.resolve(i(a.objectStore(e)));a.oncomplete=(()=>o.then(r)),a.onabort=a.onerror=(()=>n(a.error))}))}function lt(t,e,s){return ht(t,e,"readwrite",s)}function ut(t,e){const s=indexedDB.open(i,t);return s.onupgradeneeded=(t=>e(t.oldVersion,s.result)),function(t){return new Promise((e,s)=>{t.onsuccess=(()=>e(t.result)),t.onerror=(()=>s(t.error))})}(s)}ct=N([E("/com.baqend.speedkit.clock")],ct);class pt{constructor(t){this.app=t}}class dt{constructor(t){this.provider=t}}function mt(t,...e){return"object"==typeof t&&void 0===t.prototype&&e.every(e=>e in t)}let ft=class{constructor(t){this.C=t}async handle(t,e,s){return t.toString(),!!(s&&e&&e.clientURL)&&(s.postMessage(this.C.pop(e.clientURL)),!0)}};ft=N([D("get-navigate-info")],ft);let gt=class extends pt{async handle(t,e){return!!mt(e,"config","cookie")&&(await this.app.setConfig(e.config,e.cookie),!0)}};gt=N([D("send-config")],gt);let wt=class extends pt{async handle(t,e){return!!mt(e,"data")&&(await this.app.setCookies(e.data,mt(e,"event")?e.event:void 0),!0)}};wt=N([D("send-cookies")],wt);let vt=class extends pt{async handle(){return await w(t=>t.startsWith(i)),!0}};vt=N([D("clear-cache")],vt);let yt=class extends pt{async handle(t,e){return!!this.B(e)&&(await this.app.prewarmResources(t,e.data),!0)}B(t){return!!t&&"object"==typeof t&&t.data instanceof Array&&t.data.every(t=>"string"==typeof t.url)}};yt=N([D("prewarm-fetch")],yt);let bt=class extends dt{async handle(){return await this.provider.disconnect(),!0}};bt=N([D("disconnect")],bt);let At=class extends dt{async handle(){return await this.provider.connect(),!0}};At=N([D("connect")],At);let Rt=class extends dt{async handle(){return await this.provider.fetchBloomFilter(),!0}};Rt=N([D("fetch-bloom-filter")],Rt);let St=class extends L{constructor(){super(...arguments),this.dpr=1,this.width=1/0}fromJSON(t){this.dpr=t.dpr||1,this.width=t.width||1/0}toJSON(){const{dpr:t,width:e}=this;return{dpr:t,width:e}}};var qt;St=N([E("/com.baqend.speedkit.screen")],St);const Ot=Symbol("State"),kt=Symbol("Waiters");class xt{constructor(t=""){this[qt]=new Map,this[Ot]=t}get state(){return this[Ot]}waitUntil(...t){if(!t.length)throw new TypeError("You must wait for at least one desired state.");return t.indexOf(this.state)>=0?Promise.resolve(this.state):Promise.race(t.map(t=>this.AY(t)))}transition(t){const e=this[Ot];return t===e?e:(this[Ot]=t,this.AZ(t),e)}AY(t){return new Promise(e=>{const s=this[kt].get(t)||[];s.push(e),this[kt].set(t,s)})}AZ(t){const e=this[kt].get(t)||[];this[kt].delete(t);for(const s of e)s(t)}}var Nt;qt=kt,function(t){t.INSTALLING="installing",t.RUNNING="running",t.FAILED="failed"}(Nt||(Nt={}));class It extends xt{constructor(t){super(Nt.INSTALLING),this.q=t,this.r=[],this.q.addEventListener("fetch",t=>this.o(t)),this.q.addEventListener("message",t=>t.waitUntil(this.p(t))),this.q.addEventListener("push",t=>this.push(t)),this.q.addEventListener("notificationclick",t=>this.notificationclick(t))}run(){this.transition(Nt.RUNNING)}fail(){this.transition(Nt.FAILED)}skipWaiting(){this.q.addEventListener("install",t=>t.waitUntil(this.q.skipWaiting()))}claimClients(){this.q.addEventListener("activate",t=>t.waitUntil(this.q.clients.claim()))}pushMessageHandler(t){this.r.push(t)}o(t){if(this.state!==Nt.FAILED)if(this.state!==Nt.RUNNING)t.request.url,t.respondWith(this.waitUntil(Nt.RUNNING,Nt.FAILED).then(e=>{if(e===Nt.FAILED)return fetch(t.request);const s=this.fetch(t);return s||fetch(t.request)}));else{const e=this.fetch(t);if(!e)return;t.respondWith(e)}else t.request.url}async p(t){await this.waitUntil(Nt.RUNNING);const e=t.source,s=new URL(e.url);t.data;for(const e of this.r)if(await e.handle(s,t.data,t.ports?t.ports[0]:void 0))return;t.data}}const Ct="bqpassthrough";const Ut=new class{constructor(){this.D=new Map}capture(t,e,s){const i=this.D.get(t)||[];i.push({url:t,wasCacheHit:e,timings:s}),this.D.set(t,i)}pop(t){const e=this.D.get(t);return e&&e.length?(1===e.length&&this.D.delete(t),e.shift()):null}},Dt=new class{constructor(){this.P=ut(1,(t,e)=>{t<1&&e.createObjectStore(r)})}get(t){return(e=this.P,s=r,i=(e=>e.get(t)),ht(e,s,"readonly",i)).then(t=>t.result||null);var e,s,i}set(t,e){return lt(this.P,r,s=>s.put(e,t)&&void 0)}clear(){return Promise.all([(t=this.P,e=r,lt(t,e,t=>t.clear()).then(()=>void 0))]).then(()=>void 0);var t,e}},Et=new class{constructor(t,e,s){this.E=t,this.F=e.open(s)}async store(t){if("function"!=typeof t.cachePath)throw new TypeError("Cannot store an object without cachePath method.");const e=t.cachePath(),s=t.toJSON();await this.E.set(e,s),location.origin}async load(t,e=!1){if("function"!=typeof t.cachePath)throw new TypeError("Cannot store an object without cachePath method.");const s=t.cachePath(),i=await this.E.get(s);if(null!=i)return void t.fromJSON(i);const r=await this.F,n=await async function(t,e,s=!1){const i=await t.match(`${location.origin}${e}`);if(!i){const t=`Could not load object "${location.origin}${e}" from cache.`;if(s)throw new Error(t);return null}const r=await i.statusText;try{return M(r)}catch(t){const i=`Object at "${e}" is not in JSON format.`;if(s)throw new Error(i);return r}}(r,s,e);null!==n&&(t.fromJSON(n),await this.E.set(s,n))}async loadAll(...t){await Promise.all(t.map(t=>this.load(t)))}watch(...t){for(const e of t)e.observe(()=>this.store(e))}}(Dt,caches,i),Lt=new nt(Dt),Ft=new F,Pt=new ct,jt=new St,$t=new class{constructor(t,e){this.AE=null,this.maxAge=0,this.loading=!1,this.disconnected=!1,this.shuttingDown=!1,this.reconnectAttempt=0,this.AB=t,this.AC=e,this.AD=new Set,this.AF=new v(e,n)}get bloomFilterUrl(){return`${this.AC.appURL}/bloomfilter`}get revision(){return this.AF}isFromSameSession(){if(!this.AE)return!1;const t=this.AC.staleWhileRevalidate,e=this.maxAge+t>Date.now();return this.maxAge,Date.now(),e}isStale(t){return!(this.AD.has(t)||!this.AE)&&this.AE.contains(t)}isDisconnected(){return this.disconnected}addToRevalidationWhitelist(t){this.AD.add(t)}async purgeBloomFilter(){const t=await caches.open(i);await t.delete(this.bloomFilterUrl),this.AE=null,this.fetchBloomFilter()}async init(){const t=await caches.match(this.bloomFilterUrl,{cacheName:i});if(!t)return;this.maxAge=u(t,this.AB.getDrift())+this.AC.refreshInterval,this.$(t);const s=await t.json();this.AE=e.fromJSON(s)}async refreshBloomFilter(){const t=Date.now();this.maxAge>t||await this.fetchBloomFilter()}connect(){this.reconnectAttempt=0,this.disconnected=!1}async unregister(){this.disconnected=!0,this.shuttingDown=!0,await registration.unregister()}async disconnect(t=!0){if(this.disconnected=!0,!t||this.shuttingDown)return;const e=Math.min(this.AC.reconnectInterval*Math.pow(5,this.reconnectAttempt),216e5);return this.reconnectAttempt+=1,await h(e),this.fetchBloomFilter()}async fetchBloomFilter(){if(!this.loading&&navigator.onLine){this.loading=!0;try{const t={accept:"application/octet-stream, application/json;q=0.7"},e=new URL(this.bloomFilterUrl);e.searchParams.append("BCB","1"),e.searchParams.append("skversion","1.13.1");const r=await fetch(e.toString(),{headers:t});if(r.status!==s.OK)return this.loading=!1,r.status===s.Forbidden?(r.status,this.unregister()):(r.status,this.disconnect());const n=r.clone(),o=g(r.headers.get(a));if("true"===o.get("disabled"))return this.loading=!1,this.disconnect();await this._(o),this.shuttingDown||(this.reconnectAttempt=0,this.disconnected=!1),this.AE=await this.AA(r),this.AD.clear();const c=Date.now();this.maxAge=c+this.AC.refreshInterval;const h=Date.parse(r.headers.get("date"));this.AB.updateDrift(c-h);const l=await caches.open(i);await l.put(this.bloomFilterUrl,await this.z(n)),this.loading=!1}catch(t){return this.loading=!1,this.disconnect()}}}async z(t){const e=new Headers(t.headers),s=e.get(a);return e.set(a,`${s};cacheKey=${this.AF.cacheKey}`),m(t,{headers:e})}$(t){const e=g(t.headers.get(a)),s=e.get("cachingId"),i=e.get("cacheKey");s&&(this.AF=new v(this.AC,i||s,s))}async _(t){const e=t.get("cachingId");if(!e)return;const s=this.AF,{serverRevision:i}=s;i?e!==i&&(s.serverRevision,this.AF=new v(this.AC,e,e),await s.delete()):this.AF=new v(this.AC,s.cacheKey,e)}async AA(t){const s=t.headers.get("content-type");if(s.startsWith("application/octet-stream")){const s=await t.arrayBuffer();return e.fromBuffer(s)}if(s.startsWith("application/json")){const s=await t.json();return e.fromJSON(s)}throw new Error(`Weird server reply: ${s}`)}}(Pt,Lt),Jt=new class extends ot{async handleRedirect(t,e){if(t.status===s.BaqendRedirect){const i=this.G(e,t.headers.get("location")),r=new Headers(t.headers);return r.set("location",i),new Response(null,{headers:r,status:s.MovedPermanently,statusText:t.statusText})}return t}G(t,e){if(e.startsWith("http"))return e;if(e.startsWith("//"))return`https:${e}`;const s=new URL(t.url);if(e.startsWith("/"))return`${s.origin}${e}`;const i=`${s.origin}${s.pathname}`;return i.endsWith("/")?`${i}${e}`:`${i.substr(0,i.lastIndexOf("/")+1)}${e}`}}(Lt,$t,Pt,jt),Mt=new class extends It{constructor(t,e,s,i,r,n){super(t),this.c=!1,this.d=!1,this.e=0,this.X=e,this.Y=s,this.Z=i,this.a=r,this.b=n}push(t){if(!t.data)return;t.data.json();const e=t.data.json();if(e.isBaqend){const{title:s}=e;t.waitUntil(registration.showNotification(s,e))}}fetch(t){const e=P.fromEvent(t,this.Y.getCookies(location.origin)),{request:s,url:i}=e,r=this.d;if(e.isNavigateRequest()&&(this.e=0,this.d=!1),!this.U(s))return null;if(function(t){return"GET"!==t.method&&"HEAD"!==t.method}(s))return s.url,s.method,e.isNavigateRequest()&&(this.c=!0),null;if(this.c&&e.isNavigateRequest())return s.url,this.c=!1,null;if(function(t){return"dynamic"===t.headers.get("baqend-speed-kit-request")}(s))return r?(s.url,null):(t.respondWith(this.V()),null);if(navigator.onLine&&this.Z.isDisconnected())return s.url,null;if(!this.a.shouldHandle(e)&&!this.X.shouldDelayRequest(e))return null;const[n,a]=o();return"Firefox"===n&&59===a&&!e.isNavigateRequest()&&i.hash&&S(s)?null:navigator.onLine&&this.Z.isDisconnected()?(s.url,null):(e.mark("handleStart"),Promise.resolve().then(async()=>{if(this.X.shouldDelayRequest(e))return i.searchParams.get(Ct)?(i.searchParams.delete(Ct),fetch(R(s,i.toString()))):await this.X.isEnabledOnSite(e)?this.Q(s):fetch(s);if(!await this.X.isEnabledOnSite(e))return fetch(s);t.waitUntil(this.Z.refreshBloomFilter()),e.isNavigateRequest()&&(this.d=!0);const r=await this.a.handleRequest(e,t);return e.mark("handleEnd"),this.b.capture(e.originalRequest.url,e.wasCacheHit,e.timings),r}))}async Q(t){const e=q(t);return e===y.Script?this.R(t):e===y.Image?this.S(t):fetch(t)}R(t){const e=new URL(t.url);e.searchParams.append(Ct,"1");const s=`(function(){\n const thisNode = document.currentScript; \n function loadScript() {\n const scr = document.createElement('script');\n for (let i = 0, len = thisNode.attributes.length; i < len; i++) {\n var attr = thisNode.attributes.item(i);\n scr.setAttribute(attr.nodeName, attr.nodeValue);\n }\n scr.async = true;\n scr.src = '${e}';\n thisNode.parentNode.replaceChild(scr, thisNode);\n }\n \n function documentComplete(cb) {\n if (document.readyState === 'complete') {\n return cb();\n }\n \n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n cb();\n }\n });\n }\n \n documentComplete(() => {\n window.setTimeout(() => {\n loadScript();\n }, 1000);\n });\n})();\n`;return new Response(s,this.T("application/javascript; charset=utf-8"))}S(t){const e=Uint8Array.from([71,73,70,56,57,97,1,0,1,0,128,0,0,0,0,0,255,255,255,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,1,68,0,59]);return h(1e3).then(()=>fetch(t)).catch(console.error),new Response(e,this.T("image/gif"))}T(t){return{headers:{"content-type":t}}}U(t){return function(t){return t.url.startsWith("http")}(t)?t.url.length>3800?(t.url,!1):"same-origin"!==t.mode||(t.url,!1):(t.url,!1)}async V(){return new Response(null,{status:304,statusText:"Page was not served via Speed Kit"})}async setConfig(t,e){this.X.configure(t),this.Y.updateCookies(location.origin,e)}async setCookies(t,e){"load"===e&&(this.e+=1,2===this.e&&this.Z.fetchBloomFilter()),this.Y.updateCookies(location.origin,t)}async prewarmResources(t,e){if(await this.a.isEnabledOnURL(t))return;if(!e.length)return;this.Z.refreshBloomFilter();const s=this.Z.revision,i=C.fromNavigateURL(t.toString());for(const{url:r}of e){const e=this.Y.getCookies(location.origin),n=P.create(r,{navigation:i,cookies:e}),a=n.url.origin!==t.origin;if(this.a.shouldHandle(n,!0),await s.loadResponse(n),a&&this.a.shouldHandle(n,!0)&&!await s.loadResponse(n))return void await this.a.handleRequest(n)}}notificationclick(t){const e=t.notification;if(e.data.isBaqend){const s=t.action,i=e.data.closeNotification;if("close"===s)return e.close();t.waitUntil(this.W(e.data.launchUrl)),i&&setTimeout(e.close.bind(e),1e4)}}async W(t){if(t)return clients.openWindow(t);const e=await clients.matchAll();return e.length>0?e[0].focus():clients.openWindow("/")}}(self,Lt,Ft,$t,Jt,Ut);Mt.skipWaiting(),Mt.claimClients(),Mt.pushMessageHandler(new ft(Ut)),Mt.pushMessageHandler(new vt(Mt)),Mt.pushMessageHandler(new At($t)),Mt.pushMessageHandler(new bt($t)),Mt.pushMessageHandler(new Rt($t)),Mt.pushMessageHandler(new yt(Mt)),Mt.pushMessageHandler(new gt(Mt)),Mt.pushMessageHandler(new wt(Mt)),Et.watch(Lt,Ft,Pt,jt),Et.loadAll(Lt,Ft,Pt,jt).then(async()=>{await $t.init(),Lt.preloadBloomFilter&&$t.refreshBloomFilter(),Mt.run()}).catch(t=>{Mt.fail()});