Skip to content

feat: add manifest.json and registered a service worker#237

Open
jedryczkatymon wants to merge 5 commits into
devfrom
feat/205-mobile-app
Open

feat: add manifest.json and registered a service worker#237
jedryczkatymon wants to merge 5 commits into
devfrom
feat/205-mobile-app

Conversation

@jedryczkatymon
Copy link
Copy Markdown
Member

nie mogę spakować apki na mobile zanim nie dodam tych rzeczy
(odnośnie service-worker-register.tsx -> wiem, że useEffecta nie używamy, ale to tylko PoC 😄 )

Copilot AI review requested due to automatic review settings April 7, 2026 12:21
@jedryczkatymon jedryczkatymon requested a review from olios123 as a code owner April 7, 2026 12:21
@solvro
Copy link
Copy Markdown

solvro Bot commented Apr 7, 2026

The preview deployment for frontend-testownik-dev is ready. 🟢

Open Preview | Open Build Logs | Open Application Logs

Last updated at: 2026-05-24 15:23:56 CET

This comment was marked as outdated.

@olios123
Copy link
Copy Markdown
Member

olios123 commented Apr 9, 2026

Hej, przejrzysz review od Copilota i zrobisz resolve już poprawionych rzeczy ?
Przede wszystkim spojrzyj na komentarz odnośnie manifest.json

@Antoni-Czaplicki
Copy link
Copy Markdown
Member

zerknij też na https://nextjs.org/docs/app/guides/progressive-web-apps

najlepiej by było użyć manifest.ts żeby mieć typowany obiekt

Copilot AI review requested due to automatic review settings April 21, 2026 07:12

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings April 21, 2026 07:26

This comment was marked as outdated.

@jedryczkatymon
Copy link
Copy Markdown
Member Author

dobra, trochę tam poprawiłem, problem polega na tym, że nie będziemy wiedzieć czy działa dopóki nie zmergujemy, bo PWABuilder w wersji wtyczki do VS Code się psuje i nie wykrywa manifest.webmanifest generowany przez manifest.ts

@Antoni-Czaplicki
Copy link
Copy Markdown
Member

Hej @jedryczkatymon
zerkniesz na review od bota i co ogarnięte oznaczysz resolve? Bez tego mam blokade merge

jak możesz zerknij też czy wszystko git bo były konflikty i musiałem force pushować

This comment was marked as outdated.

@Antoni-Czaplicki
Copy link
Copy Markdown
Member

@jedryczkatymon jak tam?

@jedryczkatymon
Copy link
Copy Markdown
Member Author

@jedryczkatymon jak tam?

Dzisiaj przysiądę i pójdzie PR

Copilot AI review requested due to automatic review settings May 23, 2026 14:40

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings May 23, 2026 15:04

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings May 23, 2026 15:20

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings May 23, 2026 19:39
@Antoni-Czaplicki
Copy link
Copy Markdown
Member

resolved and hidden all previous ai reviews and branch got cleaned up

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Comment thread public/manifest.json Outdated
Comment thread src/components/service-worker-register.tsx Outdated
Comment thread public/sw.js Outdated
Comment thread public/sw.js Outdated
@Antoni-Czaplicki Antoni-Czaplicki linked an issue May 23, 2026 that may be closed by this pull request
Copilot AI review requested due to automatic review settings May 24, 2026 14:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 21 changed files in this pull request and generated 4 comments.

Files not reviewed (2)
  • pnpm-lock.yaml: Language not supported
  • public/sw.js: Language not supported

Comment thread src/sw.ts
Comment on lines +23 to +42
runtimeCaching: [
{
matcher({ request, sameOrigin, url }) {
if (!sameOrigin) {
return false;
}
if (request.method !== "GET") {
return true;
}
if (request.headers.has("Authorization")) {
return true;
}
return SENSITIVE_PATH_PREFIXES.some((prefix) =>
url.pathname.startsWith(prefix),
);
},
handler: new NetworkOnly(),
},
...defaultCache,
],
Comment thread public/sw.js Outdated
Comment on lines +1 to +2
var w=[{revision:null,url:"/_next/static/media/opengraph-image.06uic5ht6.aff.png"},{revision:null,url:"/_next/static/media/logo.0wd2e_f.v-49o.svg"},{revision:null,url:"/_next/static/media/logo-dark.0_55--v62s08b.svg"},{revision:null,url:"/_next/static/media/favicon.0zsj~n962g272.ico"},{revision:null,url:"/_next/static/l0iKdMw8X290IfMFcxkTi/_ssgManifest.js"},{revision:null,url:"/_next/static/l0iKdMw8X290IfMFcxkTi/_clientMiddlewareManifest.js"},{revision:null,url:"/_next/static/l0iKdMw8X290IfMFcxkTi/_buildManifest.js"},{revision:null,url:"/_next/static/chunks/turbopack-0hxh7ku~ztpa6.js"},{revision:null,url:"/_next/static/chunks/172ivk05m2bo8.js"},{revision:null,url:"/_next/static/chunks/16rb85u~rg37f.js"},{revision:null,url:"/_next/static/chunks/14u0pvu28enmo.js"},{revision:null,url:"/_next/static/chunks/145o.lsi86g0w.css"},{revision:null,url:"/_next/static/chunks/13p-eg31hy4r9.js"},{revision:null,url:"/_next/static/chunks/1352oh6y39x4s.js"},{revision:null,url:"/_next/static/chunks/12_331qljvpz..js"},{revision:null,url:"/_next/static/chunks/123z3_c0bz0p9.js"},{revision:null,url:"/_next/static/chunks/11bfq3-h3gy4c.js"},{revision:null,url:"/_next/static/chunks/118a504enpyzu.js"},{revision:null,url:"/_next/static/chunks/10y.pwmxjjjqk.js"},{revision:null,url:"/_next/static/chunks/104l0fvx54wj-.js"},{revision:null,url:"/_next/static/chunks/0z~0882382gvy.js"},{revision:null,url:"/_next/static/chunks/0z97~83vjqptg.js"},{revision:null,url:"/_next/static/chunks/0y2l0xgouorae.css"},{revision:null,url:"/_next/static/chunks/0x9tlntlqq_d9.js"},{revision:null,url:"/_next/static/chunks/0wxb0ru_ff026.js"},{revision:null,url:"/_next/static/chunks/0wpa4ig.eotgk.js"},{revision:null,url:"/_next/static/chunks/0wooikl-ul2kd.js"},{revision:null,url:"/_next/static/chunks/0w_ca~l54g3fw.js"},{revision:null,url:"/_next/static/chunks/0v072dnk0fh1m.js"},{revision:null,url:"/_next/static/chunks/0uz4ru71rhm2b.js"},{revision:null,url:"/_next/static/chunks/0uds2c0vioouv.js"},{revision:null,url:"/_next/static/chunks/0u5h4hlrg0y8x.js"},{revision:null,url:"/_next/static/chunks/0typ-cp5k1ls6.js"},{revision:null,url:"/_next/static/chunks/0tps_-qpifszc.js"},{revision:null,url:"/_next/static/chunks/0qc.7mj._qrn1.css"},{revision:null,url:"/_next/static/chunks/0ow8x71uqegil.js"},{revision:null,url:"/_next/static/chunks/0nj7_0z86yzc8.js"},{revision:null,url:"/_next/static/chunks/0n_bnncmioiff.js"},{revision:null,url:"/_next/static/chunks/0n7w3rz3jt5hr.js"},{revision:null,url:"/_next/static/chunks/0n3ru1lp60s6l.css"},{revision:null,url:"/_next/static/chunks/0n02rcnt.xtjk.js"},{revision:null,url:"/_next/static/chunks/0mvw90h4_8bta.js"},{revision:null,url:"/_next/static/chunks/0mcgx~9nkb0-b.js"},{revision:null,url:"/_next/static/chunks/0k.m8w.7-a3xc.js"},{revision:null,url:"/_next/static/chunks/0jvjj2m6w3twt.js"},{revision:null,url:"/_next/static/chunks/0iet4xty.keb1.js"},{revision:null,url:"/_next/static/chunks/0i-112x7.uz1s.js"},{revision:null,url:"/_next/static/chunks/0hr2pnmeaaxa6.js"},{revision:null,url:"/_next/static/chunks/0h9pbatd_byvf.js"},{revision:null,url:"/_next/static/chunks/0h8-~mdn8_0en.js"},{revision:null,url:"/_next/static/chunks/0ge9cv96.8gn-.js"},{revision:null,url:"/_next/static/chunks/0f8pc_tcays4j.js"},{revision:null,url:"/_next/static/chunks/0exn7tuj~0h7d.js"},{revision:null,url:"/_next/static/chunks/0eiutdzyk1u-s.js"},{revision:null,url:"/_next/static/chunks/0ed~h.87czbyq.js"},{revision:null,url:"/_next/static/chunks/0ed59gpsfl1ie.js"},{revision:null,url:"/_next/static/chunks/0d6mfypvpyrhq.js"},{revision:null,url:"/_next/static/chunks/0cw_ryqsp~q7c.js"},{revision:null,url:"/_next/static/chunks/0cfxgxhsf390n.js"},{revision:null,url:"/_next/static/chunks/0c1jedyjrx~bm.js"},{revision:null,url:"/_next/static/chunks/0c.2wnkm67pd~.js"},{revision:null,url:"/_next/static/chunks/0aswkgju_dw97.js"},{revision:null,url:"/_next/static/chunks/0a.kre0dvja43.js"},{revision:null,url:"/_next/static/chunks/0_9gorbp-p8dg.js"},{revision:null,url:"/_next/static/chunks/0_7s0.hv.kwyg.js"},{revision:null,url:"/_next/static/chunks/09xcbed_1xh5s.js"},{revision:null,url:"/_next/static/chunks/0989ksawcjb7~.js"},{revision:null,url:"/_next/static/chunks/092dlyyoi5qhe.js"},{revision:null,url:"/_next/static/chunks/07bha-9k3if-r.js"},{revision:null,url:"/_next/static/chunks/072dgox8prfm..js"},{revision:null,url:"/_next/static/chunks/06j4yvl06fyum.js"},{revision:null,url:"/_next/static/chunks/04gcxva48dgyd.js"},{revision:null,url:"/_next/static/chunks/03~yq9q893hmn.js"},{revision:null,url:"/_next/static/chunks/03o9w180mw2u4.js"},{revision:null,url:"/_next/static/chunks/033oyvauenvh8.js"},{revision:null,url:"/_next/static/chunks/00hyyb8mgibk1.js"},{revision:null,url:"/_next/static/chunks/00cyib-7p3-ay.js"},{revision:null,url:"/_next/static/chunks/0.s_0cx.5knjr.js"},{revision:null,url:"/_next/static/chunks/0.1go1yjh_33f.js"},{revision:null,url:"/_next/static/chunks/0-17qcfub5_tb.js"},{revision:"a0c506315efd4b8cf04cf7772e314248",url:"/solvro_mono.svg"},{revision:"415d9a545b0669f8399293a223f900ce",url:"/manifest.json"},{revision:"96933cc9517dbda7718eb0ccd146debf",url:"/icon-512.png"},{revision:"bd02d4a8132d37d4d81f307f99d0ddf8",url:"/icon-512-maskable.png"},{revision:"5cc689681d951eeaf7af6dd63d0658eb",url:"/icon-192.png"},{revision:"5aa2f65a080e13002b066c3c5563436f",url:"/icon-192-maskable.png"},{revision:"0ee5dfca21af7288f5b48c1e4cf59d91",url:"/favicon.svg"},{revision:"f2bc2ea7e0da5c43670c3c44232fec40",url:"/favicon-dark.svg"},{revision:"36b50630d6c0d82e0c3fc11a48a36611",url:"/apple-touch-icon.png"},{revision:"edc51dcf30745c34c2df5ebea40bdeb7",url:"/favicon/180x180.png"},{revision:"8d9b8ad559d71f09ac1c1b51068f98c2",url:"/banned-screen/mc-font.otf"},{revision:"e8a3307e5824d62b46878b5e7c99e979",url:"/banned-screen/dirt-background.webp"},{revision:"46518d07730b02b60fcd29aa950a4c04",url:"/offline"},{revision:"c6092feffed734936c09d24e63c257ca",url:"/offline.html"}];var y={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"serwist",runtime:"runtime",suffix:typeof registration<"u"?registration.scope:""},L=e=>[y.prefix,e,y.suffix].filter(t=>t&&t.length>0).join("-"),Ke=e=>{for(let t of Object.keys(y))e(t)},N={updateDetails:e=>{Ke(t=>{let s=e[t];typeof s=="string"&&(y[t]=s)})},getGoogleAnalyticsName:e=>e||L(y.googleAnalytics),getPrecacheName:e=>e||L(y.precache),getPrefix:()=>y.prefix,getRuntimeName:e=>e||L(y.runtime),getSuffix:()=>y.suffix},S;function re(){if(S===void 0){let e=new Response("");if("body"in e)try{new Response(e.body),S=!0}catch{S=!1}S=!1}return S}var He=(e,...t)=>{let s=e;return t.length>0&&(s+=` :: ${JSON.stringify(t)}`),s};var Ge=He,l=class extends Error{details;constructor(e,t){let s=Ge(e,t);super(s),this.name=e,this.details=t}};var ne=e=>new URL(String(e),location.href).href.replace(new RegExp(`^${location.origin}`),"");function D(e){return new Promise(t=>setTimeout(t,e))}var F=new Set;function se(e,t){let s=new URL(e);for(let r of t)s.searchParams.delete(r);return s.href}async function ae(e,t,s,r){let n=se(t.url,s);if(t.url===n)return e.match(t,r);let a={...r,ignoreSearch:!0},o=await e.keys(t,a);for(let i of o)if(n===se(i.url,s))return e.match(i,r)}var oe=class{promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},ie=async()=>{for(let e of F)await e()},ze="-precache-",Qe=async(e,t=ze)=>{let s=(await self.caches.keys()).filter(r=>r.includes(t)&&r.includes(self.registration.scope)&&r!==e);return await Promise.all(s.map(r=>self.caches.delete(r))),s},ce=e=>{self.addEventListener("activate",t=>{t.waitUntil(Qe(N.getPrecacheName(e)).then(s=>{}))})},le=()=>{self.addEventListener("activate",()=>self.clients.claim())},V=(e,t)=>{let s=t();return e.waitUntil(s),s};var W=(e,t)=>t.some(s=>e instanceof s),ue,he;function Je(){return ue||(ue=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ye(){return he||(he=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var K=new WeakMap,M=new WeakMap,O=new WeakMap;function Xe(e){let t=new Promise((s,r)=>{let n=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{s(v(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",a),e.addEventListener("error",o)});return O.set(t,e),t}function Ze(e){if(K.has(e))return;let t=new Promise((s,r)=>{let n=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{s(),n()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});K.set(e,t)}var H={get(e,t,s){if(e instanceof IDBTransaction){if(t==="done")return K.get(e);if(t==="store")return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return v(e[t])},set(e,t,s){return e[t]=s,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function fe(e){H=e(H)}function et(e){return Ye().includes(e)?function(...t){return e.apply(G(this),t),v(this.request)}:function(...t){return v(e.apply(G(this),t))}}function tt(e){return typeof e=="function"?et(e):(e instanceof IDBTransaction&&Ze(e),W(e,Je())?new Proxy(e,H):e)}function v(e){if(e instanceof IDBRequest)return Xe(e);if(M.has(e))return M.get(e);let t=tt(e);return t!==e&&(M.set(e,t),O.set(t,e)),t}var G=e=>O.get(e);function P(e,t,{blocked:s,upgrade:r,blocking:n,terminated:a}={}){let o=indexedDB.open(e,t),i=v(o);return r&&o.addEventListener("upgradeneeded",c=>{r(v(o.result),c.oldVersion,c.newVersion,v(o.transaction),c)}),s&&o.addEventListener("blocked",c=>s(c.oldVersion,c.newVersion,c)),i.then(c=>{a&&c.addEventListener("close",()=>a()),n&&c.addEventListener("versionchange",u=>n(u.oldVersion,u.newVersion,u))}).catch(()=>{}),i}function me(e,{blocked:t}={}){let s=indexedDB.deleteDatabase(e);return t&&s.addEventListener("blocked",r=>t(r.oldVersion,r)),v(s).then(()=>{})}var st=["get","getKey","getAll","getAllKeys","count"],rt=["put","add","delete","clear"],B=new Map;function de(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(B.get(t))return B.get(t);let s=t.replace(/FromIndex$/,""),r=t!==s,n=rt.includes(s);if(!(s in(r?IDBIndex:IDBObjectStore).prototype)||!(n||st.includes(s)))return;let a=async function(o,...i){let c=this.transaction(o,n?"readwrite":"readonly"),u=c.store;return r&&(u=u.index(i.shift())),(await Promise.all([u[s](...i),n&&c.done]))[0]};return B.set(t,a),a}fe(e=>({...e,get:(t,s,r)=>de(t,s)||e.get(t,s,r),has:(t,s)=>!!de(t,s)||e.has(t,s)}));var nt=["continue","continuePrimaryKey","advance"],pe={},z=new WeakMap,we=new WeakMap,at={get(e,t){if(!nt.includes(t))return e[t];let s=pe[t];return s||(s=pe[t]=function(...r){z.set(this,we.get(this)[t](...r))}),s}};async function*ot(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;let s=new Proxy(t,at);for(we.set(s,t),O.set(s,G(t));t;)yield s,t=await(z.get(s)||t.continue()),z.delete(s)}function ge(e,t){return t===Symbol.asyncIterator&&W(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&W(e,[IDBIndex,IDBObjectStore])}fe(e=>({...e,get(t,s,r){return ge(t,s)?ot:e.get(t,s,r)},has(t,s){return ge(t,s)||e.has(t,s)}}));var _e=async(e,t)=>{let s=null;if(e.url&&(s=new URL(e.url).origin),s!==self.location.origin)throw new l("cross-origin-copy-response",{origin:s});let r=e.clone(),n={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},a=t?t(n):n,o=re()?r.body:await r.blob();return new Response(o,a)},ve=()=>{self.__WB_DISABLE_DEV_LOGS=!0},ye=3,it="serwist-background-sync",E="requests",q="queueName",ct=class{_db=null;async addEntry(e){let t=(await this.getDb()).transaction(E,"readwrite",{durability:"relaxed"});await t.store.add(e),await t.done}async getFirstEntryId(){return(await(await this.getDb()).transaction(E).store.openCursor())?.value.id}async getAllEntriesByQueueName(e){let t=await(await this.getDb()).getAllFromIndex(E,q,IDBKeyRange.only(e));return t||[]}async getEntryCountByQueueName(e){return(await this.getDb()).countFromIndex(E,q,IDBKeyRange.only(e))}async deleteEntry(e){await(await this.getDb()).delete(E,e)}async getFirstEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"next")}async getLastEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"prev")}async getEndEntryFromIndex(e,t){return(await(await this.getDb()).transaction(E).store.index(q).openCursor(e,t))?.value}async getDb(){return this._db||(this._db=await P(it,ye,{upgrade:this._upgradeDb})),this._db}_upgradeDb(e,t){t>0&&t<ye&&e.objectStoreNames.contains(E)&&e.deleteObjectStore(E),e.createObjectStore(E,{autoIncrement:!0,keyPath:"id"}).createIndex(q,q,{unique:!1})}},xe=class{_queueName;_queueDb;constructor(e){this._queueName=e,this._queueDb=new ct}async pushEntry(e){delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async unshiftEntry(e){let t=await this._queueDb.getFirstEntryId();t?e.id=t-1:delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async popEntry(){return this._removeEntry(await this._queueDb.getLastEntryByQueueName(this._queueName))}async shiftEntry(){return this._removeEntry(await this._queueDb.getFirstEntryByQueueName(this._queueName))}async getAll(){return await this._queueDb.getAllEntriesByQueueName(this._queueName)}async size(){return await this._queueDb.getEntryCountByQueueName(this._queueName)}async deleteEntry(e){await this._queueDb.deleteEntry(e)}async _removeEntry(e){return e&&await this.deleteEntry(e.id),e}},lt=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"],Y=class J{_requestData;static async fromRequest(t){let s={url:t.url,headers:{}};t.method!=="GET"&&(s.body=await t.clone().arrayBuffer()),t.headers.forEach((r,n)=>{s.headers[n]=r});for(let r of lt)t[r]!==void 0&&(s[r]=t[r]);return new J(s)}constructor(t){t.mode==="navigate"&&(t.mode="same-origin"),this._requestData=t}toObject(){let t=Object.assign({},this._requestData);return t.headers=Object.assign({},this._requestData.headers),t.body&&(t.body=t.body.slice(0)),t}toRequest(){return new Request(this._requestData.url,this._requestData)}clone(){return new J(this.toObject())}},Ne="serwist-background-sync",ut=1440*7,Q=new Set,Ee=e=>{let t={request:new Y(e.requestData).toRequest(),timestamp:e.timestamp};return e.metadata&&(t.metadata=e.metadata),t},be=class{_name;_onSync;_maxRetentionTime;_queueStore;_forceSyncFallback;_syncInProgress=!1;_requestsAddedDuringSync=!1;constructor(e,{forceSyncFallback:t,onSync:s,maxRetentionTime:r}={}){if(Q.has(e))throw new l("duplicate-queue-name",{name:e});Q.add(e),this._name=e,this._onSync=s||this.replayRequests,this._maxRetentionTime=r||ut,this._forceSyncFallback=!!t,this._queueStore=new xe(this._name),this._addSyncListener()}get name(){return this._name}async pushRequest(e){await this._addRequest(e,"push")}async unshiftRequest(e){await this._addRequest(e,"unshift")}async popRequest(){return this._removeRequest("pop")}async shiftRequest(){return this._removeRequest("shift")}async getAll(){let e=await this._queueStore.getAll(),t=Date.now(),s=[];for(let r of e){let n=this._maxRetentionTime*60*1e3;t-r.timestamp>n?await this._queueStore.deleteEntry(r.id):s.push(Ee(r))}return s}async size(){return await this._queueStore.size()}async _addRequest({request:e,metadata:t,timestamp:s=Date.now()},r){let n={requestData:(await Y.fromRequest(e.clone())).toObject(),timestamp:s};switch(t&&(n.metadata=t),r){case"push":await this._queueStore.pushEntry(n);break;case"unshift":await this._queueStore.unshiftEntry(n);break}this._syncInProgress?this._requestsAddedDuringSync=!0:await this.registerSync()}async _removeRequest(e){let t=Date.now(),s;switch(e){case"pop":s=await this._queueStore.popEntry();break;case"shift":s=await this._queueStore.shiftEntry();break}if(s){let r=this._maxRetentionTime*60*1e3;return t-s.timestamp>r?this._removeRequest(e):Ee(s)}}async replayRequests(){let e;for(;e=await this.shiftRequest();)try{await fetch(e.request.clone())}catch{throw await this.unshiftRequest(e),new l("queue-replay-failed",{name:this._name})}}async registerSync(){if("sync"in self.registration&&!this._forceSyncFallback)try{await self.registration.sync.register(`${Ne}:${this._name}`)}catch{}}_addSyncListener(){"sync"in self.registration&&!this._forceSyncFallback?self.addEventListener("sync",e=>{if(e.tag===`${Ne}:${this._name}`){let t=async()=>{this._syncInProgress=!0;let s;try{await this._onSync({queue:this})}catch(r){if(r instanceof Error)throw s=r,s}finally{this._requestsAddedDuringSync&&!(s&&!e.lastChance)&&await this.registerSync(),this._syncInProgress=!1,this._requestsAddedDuringSync=!1}};e.waitUntil(t())}}):this._onSync({queue:this})}static get _queueNames(){return Q}},Re=class{_queue;constructor(e,t){this._queue=new be(e,t)}async fetchDidFail({request:e}){await this._queue.pushRequest({request:e})}},X={cacheWillUpdate:async({response:e})=>e.status===200||e.status===0?e:null};function U(e){return typeof e=="string"?new Request(e):e}var ke=class{event;request;url;params;_cacheKeys={};_strategy;_handlerDeferred;_extendLifetimePromises;_plugins;_pluginStateMap;constructor(e,t){this.event=t.event,this.request=t.request,t.url&&(this.url=t.url,this.params=t.params),this._strategy=e,this._handlerDeferred=new oe,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let s of this._plugins)this._pluginStateMap.set(s,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:t}=this,s=U(e),r=await this.getPreloadResponse();if(r)return r;let n=this.hasCallback("fetchDidFail")?s.clone():null;try{for(let o of this.iterateCallbacks("requestWillFetch"))s=await o({request:s.clone(),event:t})}catch(o){if(o instanceof Error)throw new l("plugin-error-request-will-fetch",{thrownErrorMessage:o.message})}let a=s.clone();try{let o;o=await fetch(s,s.mode==="navigate"?void 0:this._strategy.fetchOptions);for(let i of this.iterateCallbacks("fetchDidSucceed"))o=await i({event:t,request:a,response:o});return o}catch(o){throw n&&await this.runCallbacks("fetchDidFail",{error:o,event:t,originalRequest:n.clone(),request:a.clone()}),o}}async fetchAndCachePut(e){let t=await this.fetch(e),s=t.clone();return this.waitUntil(this.cachePut(e,s)),t}async cacheMatch(e){let t=U(e),s,{cacheName:r,matchOptions:n}=this._strategy,a=await this.getCacheKey(t,"read"),o={...n,cacheName:r};s=await caches.match(a,o);for(let i of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await i({cacheName:r,matchOptions:n,cachedResponse:s,request:a,event:this.event})||void 0;return s}async cachePut(e,t){let s=U(e);await D(0);let r=await this.getCacheKey(s,"write");if(!t)throw new l("cache-put-with-no-response",{url:ne(r.url)});let n=await this._ensureResponseSafeToCache(t);if(!n)return!1;let{cacheName:a,matchOptions:o}=this._strategy,i=await self.caches.open(a),c=this.hasCallback("cacheDidUpdate"),u=c?await ae(i,r.clone(),["__WB_REVISION__"],o):null;try{await i.put(r,c?n.clone():n)}catch(d){if(d instanceof Error)throw d.name==="QuotaExceededError"&&await ie(),d}for(let d of this.iterateCallbacks("cacheDidUpdate"))await d({cacheName:a,oldResponse:u,newResponse:n.clone(),request:r,event:this.event});return!0}async getCacheKey(e,t){let s=`${e.url} | ${t}`;if(!this._cacheKeys[s]){let r=e;for(let n of this.iterateCallbacks("cacheKeyWillBeUsed"))r=U(await n({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[s]=r}return this._cacheKeys[s]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let s of this.iterateCallbacks(e))await s(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]=="function"){let s=this._pluginStateMap.get(t);yield n=>{let a={...n,state:s};return t[e](a)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async getPreloadResponse(){if(this.event instanceof FetchEvent&&this.event.request.mode==="navigate"&&"preloadResponse"in this.event)try{let e=await this.event.preloadResponse;if(e)return e}catch{return}}async _ensureResponseSafeToCache(e){let t=e,s=!1;for(let r of this.iterateCallbacks("cacheWillUpdate"))if(t=await r({request:this.request,response:t,event:this.event})||void 0,s=!0,!t)break;return s||t&&t.status!==200&&(t=void 0),t}},b=class{cacheName;plugins;fetchOptions;matchOptions;constructor(e={}){this.cacheName=N.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,s=typeof e.request=="string"?new Request(e.request):e.request,r=new ke(this,e.url?{event:t,request:s,url:e.url,params:e.params}:{event:t,request:s}),n=this._getResponse(r,s,t);return[n,this._awaitComplete(n,r,s,t)]}async _getResponse(e,t,s){await e.runCallbacks("handlerWillStart",{event:s,request:t});let r;try{if(r=await this._handle(t,e),r===void 0||r.type==="error")throw new l("no-response",{url:t.url})}catch(n){if(n instanceof Error){for(let a of e.iterateCallbacks("handlerDidError"))if(r=await a({error:n,event:s,request:t}),r!==void 0)break}if(!r)throw n}for(let n of e.iterateCallbacks("handlerWillRespond"))r=await n({event:s,request:t,response:r});return r}async _awaitComplete(e,t,s,r){let n,a;try{n=await e}catch{}try{await t.runCallbacks("handlerDidRespond",{event:r,request:s,response:n}),await t.doneWaiting()}catch(o){o instanceof Error&&(a=o)}if(await t.runCallbacks("handlerDidComplete",{event:r,request:s,response:n,error:a}),t.destroy(),a)throw a}};var p=class extends b{_networkTimeoutSeconds;constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(X),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let s=[],r=[],n;if(this._networkTimeoutSeconds){let{id:i,promise:c}=this._getTimeoutPromise({request:e,logs:s,handler:t});n=i,r.push(c)}let a=this._getNetworkPromise({timeoutId:n,request:e,logs:s,handler:t});r.push(a);let o=await t.waitUntil((async()=>await t.waitUntil(Promise.race(r))||await a)());if(!o)throw new l("no-response",{url:e.url});return o}_getTimeoutPromise({request:e,logs:t,handler:s}){let r;return{promise:new Promise(n=>{r=setTimeout(async()=>{n(await s.cacheMatch(e))},this._networkTimeoutSeconds*1e3)}),id:r}}async _getNetworkPromise({timeoutId:e,request:t,logs:s,handler:r}){let n,a;try{a=await r.fetchAndCachePut(t)}catch(o){o instanceof Error&&(n=o)}return e&&clearTimeout(e),(n||!a)&&(a=await r.cacheMatch(t)),a}},R=class extends b{_networkTimeoutSeconds;constructor(e={}){super(e),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let s,r;try{let n=[t.fetch(e)];if(this._networkTimeoutSeconds){let a=D(this._networkTimeoutSeconds*1e3);n.push(a)}if(r=await Promise.race(n),!r)throw new Error(`Timed out the network response after ${this._networkTimeoutSeconds} seconds.`)}catch(n){n instanceof Error&&(s=n)}if(!r)throw new l("no-response",{url:e.url,error:s});return r}};var C=e=>e&&typeof e=="object"?e:{handle:e},g=class{handler;match;method;catchHandler;constructor(e,t,s="GET"){this.handler=C(t),this.match=e,this.method=s}setCatchHandler(e){this.catchHandler=C(e)}},Se=class T extends b{_fallbackToNetwork;static defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:t}){return!t||t.status>=400?null:t}};static copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:t}){return t.redirected?await _e(t):t}};constructor(t={}){t.cacheName=N.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(T.copyRedirectedCacheableResponsesPlugin)}async _handle(t,s){let r=await s.getPreloadResponse();if(r)return r;let n=await s.cacheMatch(t);return n||(s.event&&s.event.type==="install"?await this._handleInstall(t,s):await this._handleFetch(t,s))}async _handleFetch(t,s){let r,n=s.params||{};if(this._fallbackToNetwork){let a=n.integrity,o=t.integrity,i=!o||o===a;if(r=await s.fetch(new Request(t,{integrity:t.mode!=="no-cors"?o||a:void 0})),a&&i&&t.mode!=="no-cors"){this._useDefaultCacheabilityPluginIfNeeded();let c=await s.cachePut(t,r.clone())}}else throw new l("missing-precache-entry",{cacheName:this.cacheName,url:t.url});return r}async _handleInstall(t,s){this._useDefaultCacheabilityPluginIfNeeded();let r=await s.fetch(t);if(!await s.cachePut(t,r.clone()))throw new l("bad-precaching-response",{url:t.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,s=0;for(let[r,n]of this.plugins.entries())n!==T.copyRedirectedCacheableResponsesPlugin&&(n===T.defaultPrecacheCacheabilityPlugin&&(t=r),n.cacheWillUpdate&&s++);s===0?this.plugins.push(T.defaultPrecacheCacheabilityPlugin):s>1&&t!==null&&this.plugins.splice(t,1)}},De=class extends g{_allowlist;_denylist;constructor(e,{allowlist:t=[/./],denylist:s=[]}={}){super(r=>this._match(r),e),this._allowlist=t,this._denylist=s}_match({url:e,request:t}){if(t&&t.mode!=="navigate")return!1;let s=e.pathname+e.search;for(let r of this._denylist)if(r.test(s))return!1;return!!this._allowlist.some(r=>r.test(s))}},qe=()=>!!self.registration?.navigationPreload,Te=e=>{qe()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.enable().then(()=>{e&&self.registration.navigationPreload.setHeaderValue(e)}))})};var ht=(e,t=[])=>{for(let s of[...e.searchParams.keys()])t.some(r=>r.test(s))&&e.searchParams.delete(s);return e};function*Ce(e,{directoryIndex:t="index.html",ignoreURLParametersMatching:s=[/^utm_/,/^fbclid$/],cleanURLs:r=!0,urlManipulation:n}={}){let a=new URL(e,location.href);a.hash="",yield a.href;let o=ht(a,s);if(yield o.href,t&&o.pathname.endsWith("/")){let i=new URL(o.href);i.pathname+=t,yield i.href}if(r){let i=new URL(o.href);i.pathname+=".html",yield i.href}if(n){let i=n({url:a});for(let c of i)yield c.href}}var Ae=class extends g{constructor(e,t,s){let r=({url:n})=>{let a=e.exec(n.href);if(a&&!(n.origin!==location.origin&&a.index!==0))return a.slice(1)};super(r,t,s)}},Oe=e=>{N.updateDetails(e)},dt="__WB_REVISION__",Pe=e=>{if(!e)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(typeof e=="string"){let a=new URL(e,location.href);return{cacheKey:a.href,url:a.href}}let{revision:t,url:s}=e;if(!s)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(!t){let a=new URL(s,location.href);return{cacheKey:a.href,url:a.href}}let r=new URL(s,location.href),n=new URL(s,location.href);return r.searchParams.set(dt,t),{cacheKey:r.href,url:n.href}},Ue=class{updatedURLs=[];notUpdatedURLs=[];handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)};cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:s})=>{if(e.type==="install"&&t?.originalRequest&&t.originalRequest instanceof Request){let r=t.originalRequest.url;s?this.notUpdatedURLs.push(r):this.updatedURLs.push(r)}return s}},$e=(e,t,s)=>{if(typeof e=="string"){let r=new URL(e,location.href),n=({url:a})=>a.href===r.href;return new g(n,t,s)}if(e instanceof RegExp)return new Ae(e,t,s);if(typeof e=="function")return new g(e,t,s);if(e instanceof g)return e;throw new l("unsupported-route-type",{moduleName:"serwist",funcName:"parseRoute",paramName:"capture"})};var Ie=async(e,t,s)=>{let r=t.map((o,i)=>({index:i,item:o})),n=async o=>{let i=[];for(;;){let c=r.pop();if(!c)return o(i);let u=await s(c.item);i.push({result:u,index:c.index})}},a=Array.from({length:e},()=>new Promise(n));return(await Promise.all(a)).flat().sort((o,i)=>o.index<i.index?-1:1).map(o=>o.result)};var xs=typeof navigator<"u"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);var pt="serwist-expiration",$="cache-entries",je=e=>{let t=new URL(e,location.href);return t.hash="",t.href},gt=class{_cacheName;_db=null;constructor(e){this._cacheName=e}_getId(e){return`${this._cacheName}|${je(e)}`}_upgradeDb(e){let t=e.createObjectStore($,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&me(this._cacheName)}async setTimestamp(e,t){e=je(e);let s={id:this._getId(e),cacheName:this._cacheName,url:e,timestamp:t},r=(await this.getDb()).transaction($,"readwrite",{durability:"relaxed"});await r.store.put(s),await r.done}async getTimestamp(e){return(await(await this.getDb()).get($,this._getId(e)))?.timestamp}async expireEntries(e,t){let s=await(await this.getDb()).transaction($,"readwrite").store.index("timestamp").openCursor(null,"prev"),r=[],n=0;for(;s;){let a=s.value;a.cacheName===this._cacheName&&(e&&a.timestamp<e||t&&n>=t?(s.delete(),r.push(a.url)):n++),s=await s.continue()}return r}async getDb(){return this._db||(this._db=await P(pt,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}},ft=class{_isRunning=!1;_rerunRequested=!1;_maxEntries;_maxAgeSeconds;_matchOptions;_cacheName;_timestampModel;constructor(e,t={}){this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new gt(e)}async expireEntries(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),s=await self.caches.open(this._cacheName);for(let r of t)await s.delete(r,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,this.expireEntries())}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(!this._maxAgeSeconds)return!1;let t=await this._timestampModel.getTimestamp(e),s=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t<s:!0}async delete(){this._rerunRequested=!1,await this._timestampModel.expireEntries(Number.POSITIVE_INFINITY)}},mt=e=>{F.add(e)},h=class{_config;_cacheExpirations;constructor(e={}){this._config=e,this._cacheExpirations=new Map,this._config.maxAgeFrom||(this._config.maxAgeFrom="last-fetched"),this._config.purgeOnQuotaError&&mt(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===N.getRuntimeName())throw new l("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new ft(e,this._config),this._cacheExpirations.set(e,t)),t}cachedResponseWillBeUsed({event:e,cacheName:t,request:s,cachedResponse:r}){if(!r)return null;let n=this._isResponseDateFresh(r),a=this._getCacheExpiration(t),o=this._config.maxAgeFrom==="last-used",i=(async()=>{o&&await a.updateTimestamp(s.url),await a.expireEntries()})();try{e.waitUntil(i)}catch{}return n?r:null}_isResponseDateFresh(e){if(this._config.maxAgeFrom==="last-used")return!0;let t=Date.now();if(!this._config.maxAgeSeconds)return!0;let s=this._getDateHeaderTimestamp(e);return s===null?!0:s>=t-this._config.maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=e.headers.get("date"),s=new Date(t).getTime();return Number.isNaN(s)?null:s}async cacheDidUpdate({cacheName:e,request:t}){let s=this._getCacheExpiration(e);await s.updateTimestamp(t.url),await s.expireEntries()}async deleteCacheAndMetadata(){for(let[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}},wt="serwist-google-analytics",yt=2880,Nt=/^\/(\w+\/)?collect/,Et=e=>async({queue:t})=>{let s;for(;s=await t.shiftRequest();){let{request:r,timestamp:n}=s,a=new URL(r.url);try{let o=r.method==="POST"?new URLSearchParams(await r.clone().text()):a.searchParams,i=n-(Number(o.get("qt"))||0),c=Date.now()-i;if(o.set("qt",String(c)),e.parameterOverrides)for(let u of Object.keys(e.parameterOverrides)){let d=e.parameterOverrides[u];o.set(u,d)}typeof e.hitFilter=="function"&&e.hitFilter.call(null,o),await fetch(new Request(a.origin+a.pathname,{body:o.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(o){throw await t.unshiftRequest(s),o}}},_t=e=>{let t=({url:r})=>r.hostname==="www.google-analytics.com"&&Nt.test(r.pathname),s=new R({plugins:[e]});return[new g(t,s,"GET"),new g(t,s,"POST")]},vt=e=>{let t=({url:s})=>s.hostname==="www.google-analytics.com"&&s.pathname==="/analytics.js";return new g(t,new p({cacheName:e}),"GET")},xt=e=>{let t=({url:s})=>s.hostname==="www.googletagmanager.com"&&s.pathname==="/gtag/js";return new g(t,new p({cacheName:e}),"GET")},bt=e=>{let t=({url:s})=>s.hostname==="www.googletagmanager.com"&&s.pathname==="/gtm.js";return new g(t,new p({cacheName:e}),"GET")},Le=({serwist:e,cacheName:t,...s})=>{let r=N.getGoogleAnalyticsName(t),n=new Re(wt,{maxRetentionTime:yt,onSync:Et(s)}),a=[bt(r),vt(r),xt(r),..._t(n)];for(let o of a)e.registerRoute(o)},Rt=class{_fallbackUrls;_serwist;constructor({fallbackUrls:e,serwist:t}){this._fallbackUrls=e,this._serwist=t}async handlerDidError(e){for(let t of this._fallbackUrls)if(typeof t=="string"){let s=await this._serwist.matchPrecache(t);if(s!==void 0)return s}else if(t.matcher(e)){let s=await this._serwist.matchPrecache(t.url);if(s!==void 0)return s}}},kt=(e,t,s)=>{let r=e.size;if(s&&s>r||t&&t<0)throw new l("range-not-satisfiable",{size:r,end:s,start:t});let n,a;return t!==void 0&&s!==void 0?(n=t,a=s+1):t!==void 0&&s===void 0?(n=t,a=r):s!==void 0&&t===void 0&&(n=r-s,a=r),{start:n,end:a}},St=e=>{let t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new l("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new l("single-range-only",{normalizedRangeHeader:t});let s=/(\d*)-(\d*)/.exec(t);if(!s||!(s[1]||s[2]))throw new l("invalid-range-values",{normalizedRangeHeader:t});return{start:s[1]===""?void 0:Number(s[1]),end:s[2]===""?void 0:Number(s[2])}},Dt=async(e,t)=>{try{if(t.status===206)return t;let s=e.headers.get("range");if(!s)throw new l("no-range-header");let r=St(s),n=await t.blob(),a=kt(n,r.start,r.end),o=n.slice(a.start,a.end),i=o.size,c=new Response(o,{status:206,statusText:"Partial Content",headers:t.headers});return c.headers.set("Content-Length",String(i)),c.headers.set("Content-Range",`bytes ${a.start}-${a.end-1}/${n.size}`),c}catch{return new Response("",{status:416,statusText:"Range Not Satisfiable"})}},Z=class{cachedResponseWillBeUsed=async({request:e,cachedResponse:t})=>t&&e.headers.has("range")?await Dt(e,t):t},A=class extends b{async _handle(e,t){let s=[],r=await t.cacheMatch(e),n;if(!r)try{r=await t.fetchAndCachePut(e)}catch(a){a instanceof Error&&(n=a)}if(!r)throw new l("no-response",{url:e.url,error:n});return r}};var k=class extends b{constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(X)}async _handle(e,t){let s=[],r=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(r);let n=await t.cacheMatch(e),a;if(!n)try{n=await r}catch(o){o instanceof Error&&(a=o)}if(!n)throw new l("no-response",{url:e.url,error:a});return n}},qt=class extends g{constructor(e,t){let s=({request:r})=>{let n=e.getUrlsToPrecacheKeys();for(let a of Ce(r.url,t)){let o=n.get(a);if(o)return{cacheKey:o,integrity:e.getIntegrityForPrecacheKey(o)}}};super(s,e.precacheStrategy)}},Tt=class{_precacheController;constructor({precacheController:e}){this._precacheController=e}cacheKeyWillBeUsed=async({request:e,params:t})=>{let s=t?.cacheKey||this._precacheController.getPrecacheKeyForUrl(e.url);return s?new Request(s,{headers:e.headers}):e}},Ct=(e,t={})=>{let{cacheName:s,plugins:r=[],fetchOptions:n,matchOptions:a,fallbackToNetwork:o,directoryIndex:i,ignoreURLParametersMatching:c,cleanURLs:u,urlManipulation:d,cleanupOutdatedCaches:m,concurrency:x=10,navigateFallback:I,navigateFallbackAllowlist:_,navigateFallbackDenylist:f}=t??{};return{precacheStrategyOptions:{cacheName:N.getPrecacheName(s),plugins:[...r,new Tt({precacheController:e})],fetchOptions:n,matchOptions:a,fallbackToNetwork:o},precacheRouteOptions:{directoryIndex:i,ignoreURLParametersMatching:c,cleanURLs:u,urlManipulation:d},precacheMiscOptions:{cleanupOutdatedCaches:m,concurrency:x,navigateFallback:I,navigateFallbackAllowlist:_,navigateFallbackDenylist:f}}},Fe=class{_urlsToCacheKeys=new Map;_urlsToCacheModes=new Map;_cacheKeysToIntegrities=new Map;_concurrentPrecaching;_precacheStrategy;_routes;_defaultHandlerMap;_catchHandler;_requestRules;constructor({precacheEntries:e,precacheOptions:t,skipWaiting:s=!1,importScripts:r,navigationPreload:n=!1,cacheId:a,clientsClaim:o=!1,runtimeCaching:i,offlineAnalyticsConfig:c,disableDevLogs:u=!1,fallbacks:d,requestRules:m}={}){let{precacheStrategyOptions:x,precacheRouteOptions:I,precacheMiscOptions:_}=Ct(this,t);if(this._concurrentPrecaching=_.concurrency,this._precacheStrategy=new Se(x),this._routes=new Map,this._defaultHandlerMap=new Map,this._requestRules=m,this.handleInstall=this.handleInstall.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleFetch=this.handleFetch.bind(this),this.handleCache=this.handleCache.bind(this),r&&r.length>0&&self.importScripts(...r),n&&Te(),a!==void 0&&Oe({prefix:a}),s?self.skipWaiting():self.addEventListener("message",f=>{f.data&&f.data.type==="SKIP_WAITING"&&self.skipWaiting()}),o&&le(),e&&e.length>0&&this.addToPrecacheList(e),_.cleanupOutdatedCaches&&ce(x.cacheName),this.registerRoute(new qt(this,I)),_.navigateFallback&&this.registerRoute(new De(this.createHandlerBoundToUrl(_.navigateFallback),{allowlist:_.navigateFallbackAllowlist,denylist:_.navigateFallbackDenylist})),c!==void 0&&(typeof c=="boolean"?c&&Le({serwist:this}):Le({...c,serwist:this})),i!==void 0){if(d!==void 0){let f=new Rt({fallbackUrls:d.entries,serwist:this});i.forEach(j=>{j.handler instanceof b&&!j.handler.plugins.some(Be=>"handlerDidError"in Be)&&j.handler.plugins.push(f)})}for(let f of i)this.registerCapture(f.matcher,f.handler,f.method)}u&&ve()}get precacheStrategy(){return this._precacheStrategy}get routes(){return this._routes}addEventListeners(){self.addEventListener("install",this.handleInstall),self.addEventListener("activate",this.handleActivate),self.addEventListener("fetch",this.handleFetch),self.addEventListener("message",this.handleCache)}addToPrecacheList(e){let t=[];for(let s of e){typeof s=="string"?t.push(s):s&&!s.integrity&&s.revision===void 0&&t.push(s.url);let{cacheKey:r,url:n}=Pe(s),a=typeof s!="string"&&s.revision?"reload":"default";if(this._urlsToCacheKeys.has(n)&&this._urlsToCacheKeys.get(n)!==r)throw new l("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(n),secondEntry:r});if(typeof s!="string"&&s.integrity){if(this._cacheKeysToIntegrities.has(r)&&this._cacheKeysToIntegrities.get(r)!==s.integrity)throw new l("add-to-cache-list-conflicting-integrities",{url:n});this._cacheKeysToIntegrities.set(r,s.integrity)}this._urlsToCacheKeys.set(n,r),this._urlsToCacheModes.set(n,a)}if(t.length>0){let s=`Serwist is precaching URLs without revision info: ${t.join(", ")}
This is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(s)}}handleInstall(e){return this.registerRequestRules(e),V(e,async()=>{let t=new Ue;this.precacheStrategy.plugins.push(t),await Ie(this._concurrentPrecaching,Array.from(this._urlsToCacheKeys.entries()),async([n,a])=>{let o=this._cacheKeysToIntegrities.get(a),i=this._urlsToCacheModes.get(n),c=new Request(n,{integrity:o,cache:i,credentials:"same-origin"});await Promise.all(this.precacheStrategy.handleAll({event:e,request:c,url:new URL(c.url),params:{cacheKey:a}}))});let{updatedURLs:s,notUpdatedURLs:r}=t;return{updatedURLs:s,notUpdatedURLs:r}})}async registerRequestRules(e){if(this._requestRules&&e?.addRoutes)try{await e.addRoutes(this._requestRules),this._requestRules=void 0}catch(t){throw t}}handleActivate(e){return V(e,async()=>{let t=await self.caches.open(this.precacheStrategy.cacheName),s=await t.keys(),r=new Set(this._urlsToCacheKeys.values()),n=[];for(let a of s)r.has(a.url)||(await t.delete(a),n.push(a.url));return{deletedCacheRequests:n}})}handleFetch(e){let{request:t}=e,s=this.handleRequest({request:t,event:e});s&&e.respondWith(s)}handleCache(e){if(e.data&&e.data.type==="CACHE_URLS"){let{payload:t}=e.data,s=Promise.all(t.urlsToCache.map(r=>{let n;return typeof r=="string"?n=new Request(r):n=new Request(...r),this.handleRequest({request:n,event:e})}));e.waitUntil(s),e.ports?.[0]&&s.then(()=>e.ports[0].postMessage(!0))}}setDefaultHandler(e,t="GET"){this._defaultHandlerMap.set(t,C(e))}setCatchHandler(e){this._catchHandler=C(e)}registerCapture(e,t,s){let r=$e(e,t,s);return this.registerRoute(r),r}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new l("unregister-route-route-not-registered")}getUrlsToPrecacheKeys(){return this._urlsToCacheKeys}getPrecachedUrls(){return[...this._urlsToCacheKeys.keys()]}getPrecacheKeyForUrl(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForPrecacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,s=this.getPrecacheKeyForUrl(t);if(s)return(await self.caches.open(this.precacheStrategy.cacheName)).match(s)}createHandlerBoundToUrl(e){let t=this.getPrecacheKeyForUrl(e);if(!t)throw new l("non-precached-url",{url:e});return s=>(s.request=new Request(e),s.params={cacheKey:t,...s.params},this.precacheStrategy.handle(s))}handleRequest({request:e,event:t}){let s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return;let r=s.origin===location.origin,{params:n,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:s}),o=a?.handler,i=[],c=e.method;if(!o&&this._defaultHandlerMap.has(c)&&(o=this._defaultHandlerMap.get(c)),!o)return;let u;try{u=o.handle({url:s,request:e,event:t,params:n})}catch(m){u=Promise.reject(m)}let d=a?.catchHandler;return u instanceof Promise&&(this._catchHandler||d)&&(u=u.catch(async m=>{if(d)try{return await d.handle({url:s,request:e,event:t,params:n})}catch(x){x instanceof Error&&(m=x)}if(this._catchHandler)return this._catchHandler.handle({url:s,request:e,event:t});throw m})),u}findMatchingRoute({url:e,sameOrigin:t,request:s,event:r}){let n=this._routes.get(s.method)||[];for(let a of n){let o,i=a.match({url:e,sameOrigin:t,request:s,event:r});if(i)return o=i,(Array.isArray(o)&&o.length===0||i.constructor===Object&&Object.keys(i).length===0||typeof i=="boolean")&&(o=void 0),{route:a,params:o}}return{}}};var ee={rscPrefetch:"pages-rsc-prefetch",rsc:"pages-rsc",html:"pages"},Ve=[{matcher:/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,handler:new A({cacheName:"google-fonts-webfonts",plugins:[new h({maxEntries:4,maxAgeSeconds:365*24*60*60,maxAgeFrom:"last-used"})]})},{matcher:/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,handler:new k({cacheName:"google-fonts-stylesheets",plugins:[new h({maxEntries:4,maxAgeSeconds:10080*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,handler:new k({cacheName:"static-font-assets",plugins:[new h({maxEntries:4,maxAgeSeconds:10080*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,handler:new k({cacheName:"static-image-assets",plugins:[new h({maxEntries:64,maxAgeSeconds:720*60*60,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/static.+\.js$/i,handler:new A({cacheName:"next-static-js-assets",plugins:[new h({maxEntries:64,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/image\?url=.+$/i,handler:new k({cacheName:"next-image",plugins:[new h({maxEntries:64,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:mp3|wav|ogg)$/i,handler:new A({cacheName:"static-audio-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"}),new Z]})},{matcher:/\.(?:mp4|webm)$/i,handler:new A({cacheName:"static-video-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"}),new Z]})},{matcher:/\.(?:js)$/i,handler:new k({cacheName:"static-js-assets",plugins:[new h({maxEntries:48,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:css|less)$/i,handler:new k({cacheName:"static-style-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/data\/.+\/.+\.json$/i,handler:new p({cacheName:"next-data",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:json|xml|csv)$/i,handler:new p({cacheName:"static-data-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\/api\/auth\/.*/,handler:new R({networkTimeoutSeconds:10})},{matcher:({sameOrigin:e,url:{pathname:t}})=>e&&t.startsWith("/api/"),method:"GET",handler:new p({cacheName:"apis",plugins:[new h({maxEntries:16,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})],networkTimeoutSeconds:10})},{matcher:({request:e,url:{pathname:t},sameOrigin:s})=>e.headers.get("RSC")==="1"&&e.headers.get("Next-Router-Prefetch")==="1"&&s&&!t.startsWith("/api/"),handler:new p({cacheName:ee.rscPrefetch,plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({request:e,url:{pathname:t},sameOrigin:s})=>e.headers.get("RSC")==="1"&&s&&!t.startsWith("/api/"),handler:new p({cacheName:ee.rsc,plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({request:e,url:{pathname:t},sameOrigin:s})=>e.headers.get("Content-Type")?.includes("text/html")&&s&&!t.startsWith("/api/"),handler:new p({cacheName:ee.html,plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({url:{pathname:e},sameOrigin:t})=>t&&!e.startsWith("/api/"),handler:new p({cacheName:"others",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({sameOrigin:e})=>!e,handler:new p({cacheName:"cross-origin",plugins:[new h({maxEntries:32,maxAgeSeconds:3600})],networkTimeoutSeconds:10})},{matcher:/.*/i,method:"GET",handler:new R}];var Me="/offline.html",At=["/api/","/auth/"],te=new Fe({precacheEntries:w,skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,runtimeCaching:[{matcher({request:e,sameOrigin:t,url:s}){return t?e.method!=="GET"||e.headers.has("Authorization")?!0:At.some(r=>s.pathname.startsWith(r)):!1},handler:new R},...Ve]}),Ot=async()=>{let e=await te.matchPrecache(Me);return e||caches.match(Me,{ignoreSearch:!0})};te.setCatchHandler(async({request:e})=>{if(e.mode==="navigate"||e.destination==="document"){let t=await Ot();if(t)return t}return Response.error()});te.addEventListeners();
Comment thread src/app/providers.tsx
Comment on lines +15 to +17
const serwistDisabled =
process.env.NODE_ENV !== "production" ||
process.env.NEXT_PUBLIC_ENABLE_SW === "false";
Comment thread src/components/pwa-install-prompt.tsx Outdated
Comment on lines +77 to +81
const clearInstallQuery = useCallback(() => {
if (searchParams.get("install") === "true") {
router.replace(pathname);
}
}, [pathname, router, searchParams]);
Copilot AI review requested due to automatic review settings May 24, 2026 15:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 22 changed files in this pull request and generated 2 comments.

Files not reviewed (2)
  • pnpm-lock.yaml: Language not supported
  • public/sw.js: Language not supported

Comment on lines +77 to +81
const clearInstallQuery = useCallback(() => {
if (searchParameters.get("install") === "true") {
router.replace(pathname);
}
}, [pathname, router, searchParameters]);
Comment thread public/sw.js
Comment on lines +1 to +2
var w=[{revision:null,url:"/_next/static/media/opengraph-image.06uic5ht6.aff.png"},{revision:null,url:"/_next/static/media/logo.0wd2e_f.v-49o.svg"},{revision:null,url:"/_next/static/media/logo-dark.0_55--v62s08b.svg"},{revision:null,url:"/_next/static/media/favicon.0zsj~n962g272.ico"},{revision:null,url:"/_next/static/lFD51ZFC2Qlx8Oo7glBcH/_ssgManifest.js"},{revision:null,url:"/_next/static/lFD51ZFC2Qlx8Oo7glBcH/_clientMiddlewareManifest.js"},{revision:null,url:"/_next/static/lFD51ZFC2Qlx8Oo7glBcH/_buildManifest.js"},{revision:null,url:"/_next/static/chunks/turbopack-0hxh7ku~ztpa6.js"},{revision:null,url:"/_next/static/chunks/172ivk05m2bo8.js"},{revision:null,url:"/_next/static/chunks/16rb85u~rg37f.js"},{revision:null,url:"/_next/static/chunks/14vnrfzlo.-k2.js"},{revision:null,url:"/_next/static/chunks/14u0pvu28enmo.js"},{revision:null,url:"/_next/static/chunks/145o.lsi86g0w.css"},{revision:null,url:"/_next/static/chunks/13p-eg31hy4r9.js"},{revision:null,url:"/_next/static/chunks/1352oh6y39x4s.js"},{revision:null,url:"/_next/static/chunks/12_331qljvpz..js"},{revision:null,url:"/_next/static/chunks/123z3_c0bz0p9.js"},{revision:null,url:"/_next/static/chunks/11bfq3-h3gy4c.js"},{revision:null,url:"/_next/static/chunks/118a504enpyzu.js"},{revision:null,url:"/_next/static/chunks/10y.pwmxjjjqk.js"},{revision:null,url:"/_next/static/chunks/104l0fvx54wj-.js"},{revision:null,url:"/_next/static/chunks/0z~0882382gvy.js"},{revision:null,url:"/_next/static/chunks/0z97~83vjqptg.js"},{revision:null,url:"/_next/static/chunks/0y2l0xgouorae.css"},{revision:null,url:"/_next/static/chunks/0x9tlntlqq_d9.js"},{revision:null,url:"/_next/static/chunks/0wxb0ru_ff026.js"},{revision:null,url:"/_next/static/chunks/0wpa4ig.eotgk.js"},{revision:null,url:"/_next/static/chunks/0wooikl-ul2kd.js"},{revision:null,url:"/_next/static/chunks/0w_ca~l54g3fw.js"},{revision:null,url:"/_next/static/chunks/0v072dnk0fh1m.js"},{revision:null,url:"/_next/static/chunks/0uz4ru71rhm2b.js"},{revision:null,url:"/_next/static/chunks/0uds2c0vioouv.js"},{revision:null,url:"/_next/static/chunks/0u5h4hlrg0y8x.js"},{revision:null,url:"/_next/static/chunks/0typ-cp5k1ls6.js"},{revision:null,url:"/_next/static/chunks/0tps_-qpifszc.js"},{revision:null,url:"/_next/static/chunks/0qc.7mj._qrn1.css"},{revision:null,url:"/_next/static/chunks/0ow8x71uqegil.js"},{revision:null,url:"/_next/static/chunks/0nj7_0z86yzc8.js"},{revision:null,url:"/_next/static/chunks/0n_bnncmioiff.js"},{revision:null,url:"/_next/static/chunks/0n7w3rz3jt5hr.js"},{revision:null,url:"/_next/static/chunks/0n3ru1lp60s6l.css"},{revision:null,url:"/_next/static/chunks/0n02rcnt.xtjk.js"},{revision:null,url:"/_next/static/chunks/0mvw90h4_8bta.js"},{revision:null,url:"/_next/static/chunks/0mcgx~9nkb0-b.js"},{revision:null,url:"/_next/static/chunks/0k.m8w.7-a3xc.js"},{revision:null,url:"/_next/static/chunks/0jvjj2m6w3twt.js"},{revision:null,url:"/_next/static/chunks/0iet4xty.keb1.js"},{revision:null,url:"/_next/static/chunks/0i-112x7.uz1s.js"},{revision:null,url:"/_next/static/chunks/0hr2pnmeaaxa6.js"},{revision:null,url:"/_next/static/chunks/0h8-~mdn8_0en.js"},{revision:null,url:"/_next/static/chunks/0ge9cv96.8gn-.js"},{revision:null,url:"/_next/static/chunks/0f8pc_tcays4j.js"},{revision:null,url:"/_next/static/chunks/0exn7tuj~0h7d.js"},{revision:null,url:"/_next/static/chunks/0eiutdzyk1u-s.js"},{revision:null,url:"/_next/static/chunks/0ed~h.87czbyq.js"},{revision:null,url:"/_next/static/chunks/0ed59gpsfl1ie.js"},{revision:null,url:"/_next/static/chunks/0d6mfypvpyrhq.js"},{revision:null,url:"/_next/static/chunks/0cw_ryqsp~q7c.js"},{revision:null,url:"/_next/static/chunks/0cfxgxhsf390n.js"},{revision:null,url:"/_next/static/chunks/0c1jedyjrx~bm.js"},{revision:null,url:"/_next/static/chunks/0c.2wnkm67pd~.js"},{revision:null,url:"/_next/static/chunks/0aswkgju_dw97.js"},{revision:null,url:"/_next/static/chunks/0a.kre0dvja43.js"},{revision:null,url:"/_next/static/chunks/0_9gorbp-p8dg.js"},{revision:null,url:"/_next/static/chunks/0_7s0.hv.kwyg.js"},{revision:null,url:"/_next/static/chunks/09xcbed_1xh5s.js"},{revision:null,url:"/_next/static/chunks/0989ksawcjb7~.js"},{revision:null,url:"/_next/static/chunks/092dlyyoi5qhe.js"},{revision:null,url:"/_next/static/chunks/07bha-9k3if-r.js"},{revision:null,url:"/_next/static/chunks/072dgox8prfm..js"},{revision:null,url:"/_next/static/chunks/06j4yvl06fyum.js"},{revision:null,url:"/_next/static/chunks/04gcxva48dgyd.js"},{revision:null,url:"/_next/static/chunks/03~yq9q893hmn.js"},{revision:null,url:"/_next/static/chunks/03o9w180mw2u4.js"},{revision:null,url:"/_next/static/chunks/033oyvauenvh8.js"},{revision:null,url:"/_next/static/chunks/00hyyb8mgibk1.js"},{revision:null,url:"/_next/static/chunks/00cyib-7p3-ay.js"},{revision:null,url:"/_next/static/chunks/0.s_0cx.5knjr.js"},{revision:null,url:"/_next/static/chunks/0.1go1yjh_33f.js"},{revision:null,url:"/_next/static/chunks/0-17qcfub5_tb.js"},{revision:"a0c506315efd4b8cf04cf7772e314248",url:"/solvro_mono.svg"},{revision:"fb7b4a04529879c15d7ab902fc5b36a4",url:"/manifest.json"},{revision:"96933cc9517dbda7718eb0ccd146debf",url:"/icon-512.png"},{revision:"bd02d4a8132d37d4d81f307f99d0ddf8",url:"/icon-512-maskable.png"},{revision:"5cc689681d951eeaf7af6dd63d0658eb",url:"/icon-192.png"},{revision:"5aa2f65a080e13002b066c3c5563436f",url:"/icon-192-maskable.png"},{revision:"0ee5dfca21af7288f5b48c1e4cf59d91",url:"/favicon.svg"},{revision:"f2bc2ea7e0da5c43670c3c44232fec40",url:"/favicon-dark.svg"},{revision:"36b50630d6c0d82e0c3fc11a48a36611",url:"/apple-touch-icon.png"},{revision:"edc51dcf30745c34c2df5ebea40bdeb7",url:"/favicon/180x180.png"},{revision:"8d9b8ad559d71f09ac1c1b51068f98c2",url:"/banned-screen/mc-font.otf"},{revision:"e8a3307e5824d62b46878b5e7c99e979",url:"/banned-screen/dirt-background.webp"},{revision:"ce626769b7fe733154bc0e0d507fe751",url:"/offline"},{revision:"c6092feffed734936c09d24e63c257ca",url:"/offline.html"}];var y={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"serwist",runtime:"runtime",suffix:typeof registration<"u"?registration.scope:""},L=e=>[y.prefix,e,y.suffix].filter(t=>t&&t.length>0).join("-"),Ke=e=>{for(let t of Object.keys(y))e(t)},N={updateDetails:e=>{Ke(t=>{let s=e[t];typeof s=="string"&&(y[t]=s)})},getGoogleAnalyticsName:e=>e||L(y.googleAnalytics),getPrecacheName:e=>e||L(y.precache),getPrefix:()=>y.prefix,getRuntimeName:e=>e||L(y.runtime),getSuffix:()=>y.suffix},D;function re(){if(D===void 0){let e=new Response("");if("body"in e)try{new Response(e.body),D=!0}catch{D=!1}D=!1}return D}var He=(e,...t)=>{let s=e;return t.length>0&&(s+=` :: ${JSON.stringify(t)}`),s};var Ge=He,l=class extends Error{details;constructor(e,t){let s=Ge(e,t);super(s),this.name=e,this.details=t}};var ne=e=>new URL(String(e),location.href).href.replace(new RegExp(`^${location.origin}`),"");function S(e){return new Promise(t=>setTimeout(t,e))}var F=new Set;function se(e,t){let s=new URL(e);for(let r of t)s.searchParams.delete(r);return s.href}async function ae(e,t,s,r){let n=se(t.url,s);if(t.url===n)return e.match(t,r);let a={...r,ignoreSearch:!0},o=await e.keys(t,a);for(let i of o)if(n===se(i.url,s))return e.match(i,r)}var oe=class{promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},ie=async()=>{for(let e of F)await e()},Qe="-precache-",ze=async(e,t=Qe)=>{let s=(await self.caches.keys()).filter(r=>r.includes(t)&&r.includes(self.registration.scope)&&r!==e);return await Promise.all(s.map(r=>self.caches.delete(r))),s},ce=e=>{self.addEventListener("activate",t=>{t.waitUntil(ze(N.getPrecacheName(e)).then(s=>{}))})},le=()=>{self.addEventListener("activate",()=>self.clients.claim())},V=(e,t)=>{let s=t();return e.waitUntil(s),s};var W=(e,t)=>t.some(s=>e instanceof s),ue,he;function Je(){return ue||(ue=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ye(){return he||(he=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var K=new WeakMap,M=new WeakMap,O=new WeakMap;function Xe(e){let t=new Promise((s,r)=>{let n=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{s(v(e.result)),n()},o=()=>{r(e.error),n()};e.addEventListener("success",a),e.addEventListener("error",o)});return O.set(t,e),t}function Ze(e){if(K.has(e))return;let t=new Promise((s,r)=>{let n=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{s(),n()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});K.set(e,t)}var H={get(e,t,s){if(e instanceof IDBTransaction){if(t==="done")return K.get(e);if(t==="store")return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return v(e[t])},set(e,t,s){return e[t]=s,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function fe(e){H=e(H)}function et(e){return Ye().includes(e)?function(...t){return e.apply(G(this),t),v(this.request)}:function(...t){return v(e.apply(G(this),t))}}function tt(e){return typeof e=="function"?et(e):(e instanceof IDBTransaction&&Ze(e),W(e,Je())?new Proxy(e,H):e)}function v(e){if(e instanceof IDBRequest)return Xe(e);if(M.has(e))return M.get(e);let t=tt(e);return t!==e&&(M.set(e,t),O.set(t,e)),t}var G=e=>O.get(e);function P(e,t,{blocked:s,upgrade:r,blocking:n,terminated:a}={}){let o=indexedDB.open(e,t),i=v(o);return r&&o.addEventListener("upgradeneeded",c=>{r(v(o.result),c.oldVersion,c.newVersion,v(o.transaction),c)}),s&&o.addEventListener("blocked",c=>s(c.oldVersion,c.newVersion,c)),i.then(c=>{a&&c.addEventListener("close",()=>a()),n&&c.addEventListener("versionchange",u=>n(u.oldVersion,u.newVersion,u))}).catch(()=>{}),i}function me(e,{blocked:t}={}){let s=indexedDB.deleteDatabase(e);return t&&s.addEventListener("blocked",r=>t(r.oldVersion,r)),v(s).then(()=>{})}var st=["get","getKey","getAll","getAllKeys","count"],rt=["put","add","delete","clear"],B=new Map;function de(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(B.get(t))return B.get(t);let s=t.replace(/FromIndex$/,""),r=t!==s,n=rt.includes(s);if(!(s in(r?IDBIndex:IDBObjectStore).prototype)||!(n||st.includes(s)))return;let a=async function(o,...i){let c=this.transaction(o,n?"readwrite":"readonly"),u=c.store;return r&&(u=u.index(i.shift())),(await Promise.all([u[s](...i),n&&c.done]))[0]};return B.set(t,a),a}fe(e=>({...e,get:(t,s,r)=>de(t,s)||e.get(t,s,r),has:(t,s)=>!!de(t,s)||e.has(t,s)}));var nt=["continue","continuePrimaryKey","advance"],pe={},Q=new WeakMap,we=new WeakMap,at={get(e,t){if(!nt.includes(t))return e[t];let s=pe[t];return s||(s=pe[t]=function(...r){Q.set(this,we.get(this)[t](...r))}),s}};async function*ot(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;let s=new Proxy(t,at);for(we.set(s,t),O.set(s,G(t));t;)yield s,t=await(Q.get(s)||t.continue()),Q.delete(s)}function ge(e,t){return t===Symbol.asyncIterator&&W(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&W(e,[IDBIndex,IDBObjectStore])}fe(e=>({...e,get(t,s,r){return ge(t,s)?ot:e.get(t,s,r)},has(t,s){return ge(t,s)||e.has(t,s)}}));var _e=async(e,t)=>{let s=null;if(e.url&&(s=new URL(e.url).origin),s!==self.location.origin)throw new l("cross-origin-copy-response",{origin:s});let r=e.clone(),n={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},a=t?t(n):n,o=re()?r.body:await r.blob();return new Response(o,a)},ve=()=>{self.__WB_DISABLE_DEV_LOGS=!0},ye=3,it="serwist-background-sync",E="requests",q="queueName",ct=class{_db=null;async addEntry(e){let t=(await this.getDb()).transaction(E,"readwrite",{durability:"relaxed"});await t.store.add(e),await t.done}async getFirstEntryId(){return(await(await this.getDb()).transaction(E).store.openCursor())?.value.id}async getAllEntriesByQueueName(e){let t=await(await this.getDb()).getAllFromIndex(E,q,IDBKeyRange.only(e));return t||[]}async getEntryCountByQueueName(e){return(await this.getDb()).countFromIndex(E,q,IDBKeyRange.only(e))}async deleteEntry(e){await(await this.getDb()).delete(E,e)}async getFirstEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"next")}async getLastEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"prev")}async getEndEntryFromIndex(e,t){return(await(await this.getDb()).transaction(E).store.index(q).openCursor(e,t))?.value}async getDb(){return this._db||(this._db=await P(it,ye,{upgrade:this._upgradeDb})),this._db}_upgradeDb(e,t){t>0&&t<ye&&e.objectStoreNames.contains(E)&&e.deleteObjectStore(E),e.createObjectStore(E,{autoIncrement:!0,keyPath:"id"}).createIndex(q,q,{unique:!1})}},xe=class{_queueName;_queueDb;constructor(e){this._queueName=e,this._queueDb=new ct}async pushEntry(e){delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async unshiftEntry(e){let t=await this._queueDb.getFirstEntryId();t?e.id=t-1:delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async popEntry(){return this._removeEntry(await this._queueDb.getLastEntryByQueueName(this._queueName))}async shiftEntry(){return this._removeEntry(await this._queueDb.getFirstEntryByQueueName(this._queueName))}async getAll(){return await this._queueDb.getAllEntriesByQueueName(this._queueName)}async size(){return await this._queueDb.getEntryCountByQueueName(this._queueName)}async deleteEntry(e){await this._queueDb.deleteEntry(e)}async _removeEntry(e){return e&&await this.deleteEntry(e.id),e}},lt=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"],Y=class J{_requestData;static async fromRequest(t){let s={url:t.url,headers:{}};t.method!=="GET"&&(s.body=await t.clone().arrayBuffer()),t.headers.forEach((r,n)=>{s.headers[n]=r});for(let r of lt)t[r]!==void 0&&(s[r]=t[r]);return new J(s)}constructor(t){t.mode==="navigate"&&(t.mode="same-origin"),this._requestData=t}toObject(){let t=Object.assign({},this._requestData);return t.headers=Object.assign({},this._requestData.headers),t.body&&(t.body=t.body.slice(0)),t}toRequest(){return new Request(this._requestData.url,this._requestData)}clone(){return new J(this.toObject())}},Ne="serwist-background-sync",ut=1440*7,z=new Set,Ee=e=>{let t={request:new Y(e.requestData).toRequest(),timestamp:e.timestamp};return e.metadata&&(t.metadata=e.metadata),t},be=class{_name;_onSync;_maxRetentionTime;_queueStore;_forceSyncFallback;_syncInProgress=!1;_requestsAddedDuringSync=!1;constructor(e,{forceSyncFallback:t,onSync:s,maxRetentionTime:r}={}){if(z.has(e))throw new l("duplicate-queue-name",{name:e});z.add(e),this._name=e,this._onSync=s||this.replayRequests,this._maxRetentionTime=r||ut,this._forceSyncFallback=!!t,this._queueStore=new xe(this._name),this._addSyncListener()}get name(){return this._name}async pushRequest(e){await this._addRequest(e,"push")}async unshiftRequest(e){await this._addRequest(e,"unshift")}async popRequest(){return this._removeRequest("pop")}async shiftRequest(){return this._removeRequest("shift")}async getAll(){let e=await this._queueStore.getAll(),t=Date.now(),s=[];for(let r of e){let n=this._maxRetentionTime*60*1e3;t-r.timestamp>n?await this._queueStore.deleteEntry(r.id):s.push(Ee(r))}return s}async size(){return await this._queueStore.size()}async _addRequest({request:e,metadata:t,timestamp:s=Date.now()},r){let n={requestData:(await Y.fromRequest(e.clone())).toObject(),timestamp:s};switch(t&&(n.metadata=t),r){case"push":await this._queueStore.pushEntry(n);break;case"unshift":await this._queueStore.unshiftEntry(n);break}this._syncInProgress?this._requestsAddedDuringSync=!0:await this.registerSync()}async _removeRequest(e){let t=Date.now(),s;switch(e){case"pop":s=await this._queueStore.popEntry();break;case"shift":s=await this._queueStore.shiftEntry();break}if(s){let r=this._maxRetentionTime*60*1e3;return t-s.timestamp>r?this._removeRequest(e):Ee(s)}}async replayRequests(){let e;for(;e=await this.shiftRequest();)try{await fetch(e.request.clone())}catch{throw await this.unshiftRequest(e),new l("queue-replay-failed",{name:this._name})}}async registerSync(){if("sync"in self.registration&&!this._forceSyncFallback)try{await self.registration.sync.register(`${Ne}:${this._name}`)}catch{}}_addSyncListener(){"sync"in self.registration&&!this._forceSyncFallback?self.addEventListener("sync",e=>{if(e.tag===`${Ne}:${this._name}`){let t=async()=>{this._syncInProgress=!0;let s;try{await this._onSync({queue:this})}catch(r){if(r instanceof Error)throw s=r,s}finally{this._requestsAddedDuringSync&&!(s&&!e.lastChance)&&await this.registerSync(),this._syncInProgress=!1,this._requestsAddedDuringSync=!1}};e.waitUntil(t())}}):this._onSync({queue:this})}static get _queueNames(){return z}},Re=class{_queue;constructor(e,t){this._queue=new be(e,t)}async fetchDidFail({request:e}){await this._queue.pushRequest({request:e})}},X={cacheWillUpdate:async({response:e})=>e.status===200||e.status===0?e:null};function U(e){return typeof e=="string"?new Request(e):e}var ke=class{event;request;url;params;_cacheKeys={};_strategy;_handlerDeferred;_extendLifetimePromises;_plugins;_pluginStateMap;constructor(e,t){this.event=t.event,this.request=t.request,t.url&&(this.url=t.url,this.params=t.params),this._strategy=e,this._handlerDeferred=new oe,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let s of this._plugins)this._pluginStateMap.set(s,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:t}=this,s=U(e),r=await this.getPreloadResponse();if(r)return r;let n=this.hasCallback("fetchDidFail")?s.clone():null;try{for(let o of this.iterateCallbacks("requestWillFetch"))s=await o({request:s.clone(),event:t})}catch(o){if(o instanceof Error)throw new l("plugin-error-request-will-fetch",{thrownErrorMessage:o.message})}let a=s.clone();try{let o;o=await fetch(s,s.mode==="navigate"?void 0:this._strategy.fetchOptions);for(let i of this.iterateCallbacks("fetchDidSucceed"))o=await i({event:t,request:a,response:o});return o}catch(o){throw n&&await this.runCallbacks("fetchDidFail",{error:o,event:t,originalRequest:n.clone(),request:a.clone()}),o}}async fetchAndCachePut(e){let t=await this.fetch(e),s=t.clone();return this.waitUntil(this.cachePut(e,s)),t}async cacheMatch(e){let t=U(e),s,{cacheName:r,matchOptions:n}=this._strategy,a=await this.getCacheKey(t,"read"),o={...n,cacheName:r};s=await caches.match(a,o);for(let i of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await i({cacheName:r,matchOptions:n,cachedResponse:s,request:a,event:this.event})||void 0;return s}async cachePut(e,t){let s=U(e);await S(0);let r=await this.getCacheKey(s,"write");if(!t)throw new l("cache-put-with-no-response",{url:ne(r.url)});let n=await this._ensureResponseSafeToCache(t);if(!n)return!1;let{cacheName:a,matchOptions:o}=this._strategy,i=await self.caches.open(a),c=this.hasCallback("cacheDidUpdate"),u=c?await ae(i,r.clone(),["__WB_REVISION__"],o):null;try{await i.put(r,c?n.clone():n)}catch(d){if(d instanceof Error)throw d.name==="QuotaExceededError"&&await ie(),d}for(let d of this.iterateCallbacks("cacheDidUpdate"))await d({cacheName:a,oldResponse:u,newResponse:n.clone(),request:r,event:this.event});return!0}async getCacheKey(e,t){let s=`${e.url} | ${t}`;if(!this._cacheKeys[s]){let r=e;for(let n of this.iterateCallbacks("cacheKeyWillBeUsed"))r=U(await n({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[s]=r}return this._cacheKeys[s]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let s of this.iterateCallbacks(e))await s(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]=="function"){let s=this._pluginStateMap.get(t);yield n=>{let a={...n,state:s};return t[e](a)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async getPreloadResponse(){if(this.event instanceof FetchEvent&&this.event.request.mode==="navigate"&&"preloadResponse"in this.event)try{let e=await this.event.preloadResponse;if(e)return e}catch{return}}async _ensureResponseSafeToCache(e){let t=e,s=!1;for(let r of this.iterateCallbacks("cacheWillUpdate"))if(t=await r({request:this.request,response:t,event:this.event})||void 0,s=!0,!t)break;return s||t&&t.status!==200&&(t=void 0),t}},b=class{cacheName;plugins;fetchOptions;matchOptions;constructor(e={}){this.cacheName=N.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,s=typeof e.request=="string"?new Request(e.request):e.request,r=new ke(this,e.url?{event:t,request:s,url:e.url,params:e.params}:{event:t,request:s}),n=this._getResponse(r,s,t);return[n,this._awaitComplete(n,r,s,t)]}async _getResponse(e,t,s){await e.runCallbacks("handlerWillStart",{event:s,request:t});let r;try{if(r=await this._handle(t,e),r===void 0||r.type==="error")throw new l("no-response",{url:t.url})}catch(n){if(n instanceof Error){for(let a of e.iterateCallbacks("handlerDidError"))if(r=await a({error:n,event:s,request:t}),r!==void 0)break}if(!r)throw n}for(let n of e.iterateCallbacks("handlerWillRespond"))r=await n({event:s,request:t,response:r});return r}async _awaitComplete(e,t,s,r){let n,a;try{n=await e}catch{}try{await t.runCallbacks("handlerDidRespond",{event:r,request:s,response:n}),await t.doneWaiting()}catch(o){o instanceof Error&&(a=o)}if(await t.runCallbacks("handlerDidComplete",{event:r,request:s,response:n,error:a}),t.destroy(),a)throw a}};var p=class extends b{_networkTimeoutSeconds;constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(X),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let s=[],r=[],n;if(this._networkTimeoutSeconds){let{id:i,promise:c}=this._getTimeoutPromise({request:e,logs:s,handler:t});n=i,r.push(c)}let a=this._getNetworkPromise({timeoutId:n,request:e,logs:s,handler:t});r.push(a);let o=await t.waitUntil((async()=>await t.waitUntil(Promise.race(r))||await a)());if(!o)throw new l("no-response",{url:e.url});return o}_getTimeoutPromise({request:e,logs:t,handler:s}){let r;return{promise:new Promise(n=>{r=setTimeout(async()=>{n(await s.cacheMatch(e))},this._networkTimeoutSeconds*1e3)}),id:r}}async _getNetworkPromise({timeoutId:e,request:t,logs:s,handler:r}){let n,a;try{a=await r.fetchAndCachePut(t)}catch(o){o instanceof Error&&(n=o)}return e&&clearTimeout(e),(n||!a)&&(a=await r.cacheMatch(t)),a}},R=class extends b{_networkTimeoutSeconds;constructor(e={}){super(e),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let s,r;try{let n=[t.fetch(e)];if(this._networkTimeoutSeconds){let a=S(this._networkTimeoutSeconds*1e3);n.push(a)}if(r=await Promise.race(n),!r)throw new Error(`Timed out the network response after ${this._networkTimeoutSeconds} seconds.`)}catch(n){n instanceof Error&&(s=n)}if(!r)throw new l("no-response",{url:e.url,error:s});return r}};var T=e=>e&&typeof e=="object"?e:{handle:e},g=class{handler;match;method;catchHandler;constructor(e,t,s="GET"){this.handler=T(t),this.match=e,this.method=s}setCatchHandler(e){this.catchHandler=T(e)}},De=class C extends b{_fallbackToNetwork;static defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:t}){return!t||t.status>=400?null:t}};static copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:t}){return t.redirected?await _e(t):t}};constructor(t={}){t.cacheName=N.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(C.copyRedirectedCacheableResponsesPlugin)}async _handle(t,s){let r=await s.getPreloadResponse();if(r)return r;let n=await s.cacheMatch(t);return n||(s.event&&s.event.type==="install"?await this._handleInstall(t,s):await this._handleFetch(t,s))}async _handleFetch(t,s){let r,n=s.params||{};if(this._fallbackToNetwork){let a=n.integrity,o=t.integrity,i=!o||o===a;if(r=await s.fetch(new Request(t,{integrity:t.mode!=="no-cors"?o||a:void 0})),a&&i&&t.mode!=="no-cors"){this._useDefaultCacheabilityPluginIfNeeded();let c=await s.cachePut(t,r.clone())}}else throw new l("missing-precache-entry",{cacheName:this.cacheName,url:t.url});return r}async _handleInstall(t,s){this._useDefaultCacheabilityPluginIfNeeded();let r=await s.fetch(t);if(!await s.cachePut(t,r.clone()))throw new l("bad-precaching-response",{url:t.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,s=0;for(let[r,n]of this.plugins.entries())n!==C.copyRedirectedCacheableResponsesPlugin&&(n===C.defaultPrecacheCacheabilityPlugin&&(t=r),n.cacheWillUpdate&&s++);s===0?this.plugins.push(C.defaultPrecacheCacheabilityPlugin):s>1&&t!==null&&this.plugins.splice(t,1)}},Se=class extends g{_allowlist;_denylist;constructor(e,{allowlist:t=[/./],denylist:s=[]}={}){super(r=>this._match(r),e),this._allowlist=t,this._denylist=s}_match({url:e,request:t}){if(t&&t.mode!=="navigate")return!1;let s=e.pathname+e.search;for(let r of this._denylist)if(r.test(s))return!1;return!!this._allowlist.some(r=>r.test(s))}},qe=()=>!!self.registration?.navigationPreload,Ce=e=>{qe()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.enable().then(()=>{e&&self.registration.navigationPreload.setHeaderValue(e)}))})};var ht=(e,t=[])=>{for(let s of[...e.searchParams.keys()])t.some(r=>r.test(s))&&e.searchParams.delete(s);return e};function*Te(e,{directoryIndex:t="index.html",ignoreURLParametersMatching:s=[/^utm_/,/^fbclid$/],cleanURLs:r=!0,urlManipulation:n}={}){let a=new URL(e,location.href);a.hash="",yield a.href;let o=ht(a,s);if(yield o.href,t&&o.pathname.endsWith("/")){let i=new URL(o.href);i.pathname+=t,yield i.href}if(r){let i=new URL(o.href);i.pathname+=".html",yield i.href}if(n){let i=n({url:a});for(let c of i)yield c.href}}var Ae=class extends g{constructor(e,t,s){let r=({url:n})=>{let a=e.exec(n.href);if(a&&!(n.origin!==location.origin&&a.index!==0))return a.slice(1)};super(r,t,s)}},Oe=e=>{N.updateDetails(e)},dt="__WB_REVISION__",Pe=e=>{if(!e)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(typeof e=="string"){let a=new URL(e,location.href);return{cacheKey:a.href,url:a.href}}let{revision:t,url:s}=e;if(!s)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(!t){let a=new URL(s,location.href);return{cacheKey:a.href,url:a.href}}let r=new URL(s,location.href),n=new URL(s,location.href);return r.searchParams.set(dt,t),{cacheKey:r.href,url:n.href}},Ue=class{updatedURLs=[];notUpdatedURLs=[];handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)};cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:s})=>{if(e.type==="install"&&t?.originalRequest&&t.originalRequest instanceof Request){let r=t.originalRequest.url;s?this.notUpdatedURLs.push(r):this.updatedURLs.push(r)}return s}},$e=(e,t,s)=>{if(typeof e=="string"){let r=new URL(e,location.href),n=({url:a})=>a.href===r.href;return new g(n,t,s)}if(e instanceof RegExp)return new Ae(e,t,s);if(typeof e=="function")return new g(e,t,s);if(e instanceof g)return e;throw new l("unsupported-route-type",{moduleName:"serwist",funcName:"parseRoute",paramName:"capture"})};var Ie=async(e,t,s)=>{let r=t.map((o,i)=>({index:i,item:o})),n=async o=>{let i=[];for(;;){let c=r.pop();if(!c)return o(i);let u=await s(c.item);i.push({result:u,index:c.index})}},a=Array.from({length:e},()=>new Promise(n));return(await Promise.all(a)).flat().sort((o,i)=>o.index<i.index?-1:1).map(o=>o.result)};var xs=typeof navigator<"u"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);var pt="serwist-expiration",$="cache-entries",je=e=>{let t=new URL(e,location.href);return t.hash="",t.href},gt=class{_cacheName;_db=null;constructor(e){this._cacheName=e}_getId(e){return`${this._cacheName}|${je(e)}`}_upgradeDb(e){let t=e.createObjectStore($,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&me(this._cacheName)}async setTimestamp(e,t){e=je(e);let s={id:this._getId(e),cacheName:this._cacheName,url:e,timestamp:t},r=(await this.getDb()).transaction($,"readwrite",{durability:"relaxed"});await r.store.put(s),await r.done}async getTimestamp(e){return(await(await this.getDb()).get($,this._getId(e)))?.timestamp}async expireEntries(e,t){let s=await(await this.getDb()).transaction($,"readwrite").store.index("timestamp").openCursor(null,"prev"),r=[],n=0;for(;s;){let a=s.value;a.cacheName===this._cacheName&&(e&&a.timestamp<e||t&&n>=t?(s.delete(),r.push(a.url)):n++),s=await s.continue()}return r}async getDb(){return this._db||(this._db=await P(pt,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}},ft=class{_isRunning=!1;_rerunRequested=!1;_maxEntries;_maxAgeSeconds;_matchOptions;_cacheName;_timestampModel;constructor(e,t={}){this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new gt(e)}async expireEntries(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),s=await self.caches.open(this._cacheName);for(let r of t)await s.delete(r,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,this.expireEntries())}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(!this._maxAgeSeconds)return!1;let t=await this._timestampModel.getTimestamp(e),s=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t<s:!0}async delete(){this._rerunRequested=!1,await this._timestampModel.expireEntries(Number.POSITIVE_INFINITY)}},mt=e=>{F.add(e)},h=class{_config;_cacheExpirations;constructor(e={}){this._config=e,this._cacheExpirations=new Map,this._config.maxAgeFrom||(this._config.maxAgeFrom="last-fetched"),this._config.purgeOnQuotaError&&mt(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===N.getRuntimeName())throw new l("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new ft(e,this._config),this._cacheExpirations.set(e,t)),t}cachedResponseWillBeUsed({event:e,cacheName:t,request:s,cachedResponse:r}){if(!r)return null;let n=this._isResponseDateFresh(r),a=this._getCacheExpiration(t),o=this._config.maxAgeFrom==="last-used",i=(async()=>{o&&await a.updateTimestamp(s.url),await a.expireEntries()})();try{e.waitUntil(i)}catch{}return n?r:null}_isResponseDateFresh(e){if(this._config.maxAgeFrom==="last-used")return!0;let t=Date.now();if(!this._config.maxAgeSeconds)return!0;let s=this._getDateHeaderTimestamp(e);return s===null?!0:s>=t-this._config.maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=e.headers.get("date"),s=new Date(t).getTime();return Number.isNaN(s)?null:s}async cacheDidUpdate({cacheName:e,request:t}){let s=this._getCacheExpiration(e);await s.updateTimestamp(t.url),await s.expireEntries()}async deleteCacheAndMetadata(){for(let[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}},wt="serwist-google-analytics",yt=2880,Nt=/^\/(\w+\/)?collect/,Et=e=>async({queue:t})=>{let s;for(;s=await t.shiftRequest();){let{request:r,timestamp:n}=s,a=new URL(r.url);try{let o=r.method==="POST"?new URLSearchParams(await r.clone().text()):a.searchParams,i=n-(Number(o.get("qt"))||0),c=Date.now()-i;if(o.set("qt",String(c)),e.parameterOverrides)for(let u of Object.keys(e.parameterOverrides)){let d=e.parameterOverrides[u];o.set(u,d)}typeof e.hitFilter=="function"&&e.hitFilter.call(null,o),await fetch(new Request(a.origin+a.pathname,{body:o.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(o){throw await t.unshiftRequest(s),o}}},_t=e=>{let t=({url:r})=>r.hostname==="www.google-analytics.com"&&Nt.test(r.pathname),s=new R({plugins:[e]});return[new g(t,s,"GET"),new g(t,s,"POST")]},vt=e=>{let t=({url:s})=>s.hostname==="www.google-analytics.com"&&s.pathname==="/analytics.js";return new g(t,new p({cacheName:e}),"GET")},xt=e=>{let t=({url:s})=>s.hostname==="www.googletagmanager.com"&&s.pathname==="/gtag/js";return new g(t,new p({cacheName:e}),"GET")},bt=e=>{let t=({url:s})=>s.hostname==="www.googletagmanager.com"&&s.pathname==="/gtm.js";return new g(t,new p({cacheName:e}),"GET")},Le=({serwist:e,cacheName:t,...s})=>{let r=N.getGoogleAnalyticsName(t),n=new Re(wt,{maxRetentionTime:yt,onSync:Et(s)}),a=[bt(r),vt(r),xt(r),..._t(n)];for(let o of a)e.registerRoute(o)},Rt=class{_fallbackUrls;_serwist;constructor({fallbackUrls:e,serwist:t}){this._fallbackUrls=e,this._serwist=t}async handlerDidError(e){for(let t of this._fallbackUrls)if(typeof t=="string"){let s=await this._serwist.matchPrecache(t);if(s!==void 0)return s}else if(t.matcher(e)){let s=await this._serwist.matchPrecache(t.url);if(s!==void 0)return s}}},kt=(e,t,s)=>{let r=e.size;if(s&&s>r||t&&t<0)throw new l("range-not-satisfiable",{size:r,end:s,start:t});let n,a;return t!==void 0&&s!==void 0?(n=t,a=s+1):t!==void 0&&s===void 0?(n=t,a=r):s!==void 0&&t===void 0&&(n=r-s,a=r),{start:n,end:a}},Dt=e=>{let t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new l("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new l("single-range-only",{normalizedRangeHeader:t});let s=/(\d*)-(\d*)/.exec(t);if(!s||!(s[1]||s[2]))throw new l("invalid-range-values",{normalizedRangeHeader:t});return{start:s[1]===""?void 0:Number(s[1]),end:s[2]===""?void 0:Number(s[2])}},St=async(e,t)=>{try{if(t.status===206)return t;let s=e.headers.get("range");if(!s)throw new l("no-range-header");let r=Dt(s),n=await t.blob(),a=kt(n,r.start,r.end),o=n.slice(a.start,a.end),i=o.size,c=new Response(o,{status:206,statusText:"Partial Content",headers:t.headers});return c.headers.set("Content-Length",String(i)),c.headers.set("Content-Range",`bytes ${a.start}-${a.end-1}/${n.size}`),c}catch{return new Response("",{status:416,statusText:"Range Not Satisfiable"})}},Z=class{cachedResponseWillBeUsed=async({request:e,cachedResponse:t})=>t&&e.headers.has("range")?await St(e,t):t},A=class extends b{async _handle(e,t){let s=[],r=await t.cacheMatch(e),n;if(!r)try{r=await t.fetchAndCachePut(e)}catch(a){a instanceof Error&&(n=a)}if(!r)throw new l("no-response",{url:e.url,error:n});return r}};var k=class extends b{constructor(e={}){super(e),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(X)}async _handle(e,t){let s=[],r=t.fetchAndCachePut(e).catch(()=>{});t.waitUntil(r);let n=await t.cacheMatch(e),a;if(!n)try{n=await r}catch(o){o instanceof Error&&(a=o)}if(!n)throw new l("no-response",{url:e.url,error:a});return n}},qt=class extends g{constructor(e,t){let s=({request:r})=>{let n=e.getUrlsToPrecacheKeys();for(let a of Te(r.url,t)){let o=n.get(a);if(o)return{cacheKey:o,integrity:e.getIntegrityForPrecacheKey(o)}}};super(s,e.precacheStrategy)}},Ct=class{_precacheController;constructor({precacheController:e}){this._precacheController=e}cacheKeyWillBeUsed=async({request:e,params:t})=>{let s=t?.cacheKey||this._precacheController.getPrecacheKeyForUrl(e.url);return s?new Request(s,{headers:e.headers}):e}},Tt=(e,t={})=>{let{cacheName:s,plugins:r=[],fetchOptions:n,matchOptions:a,fallbackToNetwork:o,directoryIndex:i,ignoreURLParametersMatching:c,cleanURLs:u,urlManipulation:d,cleanupOutdatedCaches:m,concurrency:x=10,navigateFallback:I,navigateFallbackAllowlist:_,navigateFallbackDenylist:f}=t??{};return{precacheStrategyOptions:{cacheName:N.getPrecacheName(s),plugins:[...r,new Ct({precacheController:e})],fetchOptions:n,matchOptions:a,fallbackToNetwork:o},precacheRouteOptions:{directoryIndex:i,ignoreURLParametersMatching:c,cleanURLs:u,urlManipulation:d},precacheMiscOptions:{cleanupOutdatedCaches:m,concurrency:x,navigateFallback:I,navigateFallbackAllowlist:_,navigateFallbackDenylist:f}}},Fe=class{_urlsToCacheKeys=new Map;_urlsToCacheModes=new Map;_cacheKeysToIntegrities=new Map;_concurrentPrecaching;_precacheStrategy;_routes;_defaultHandlerMap;_catchHandler;_requestRules;constructor({precacheEntries:e,precacheOptions:t,skipWaiting:s=!1,importScripts:r,navigationPreload:n=!1,cacheId:a,clientsClaim:o=!1,runtimeCaching:i,offlineAnalyticsConfig:c,disableDevLogs:u=!1,fallbacks:d,requestRules:m}={}){let{precacheStrategyOptions:x,precacheRouteOptions:I,precacheMiscOptions:_}=Tt(this,t);if(this._concurrentPrecaching=_.concurrency,this._precacheStrategy=new De(x),this._routes=new Map,this._defaultHandlerMap=new Map,this._requestRules=m,this.handleInstall=this.handleInstall.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleFetch=this.handleFetch.bind(this),this.handleCache=this.handleCache.bind(this),r&&r.length>0&&self.importScripts(...r),n&&Ce(),a!==void 0&&Oe({prefix:a}),s?self.skipWaiting():self.addEventListener("message",f=>{f.data&&f.data.type==="SKIP_WAITING"&&self.skipWaiting()}),o&&le(),e&&e.length>0&&this.addToPrecacheList(e),_.cleanupOutdatedCaches&&ce(x.cacheName),this.registerRoute(new qt(this,I)),_.navigateFallback&&this.registerRoute(new Se(this.createHandlerBoundToUrl(_.navigateFallback),{allowlist:_.navigateFallbackAllowlist,denylist:_.navigateFallbackDenylist})),c!==void 0&&(typeof c=="boolean"?c&&Le({serwist:this}):Le({...c,serwist:this})),i!==void 0){if(d!==void 0){let f=new Rt({fallbackUrls:d.entries,serwist:this});i.forEach(j=>{j.handler instanceof b&&!j.handler.plugins.some(Be=>"handlerDidError"in Be)&&j.handler.plugins.push(f)})}for(let f of i)this.registerCapture(f.matcher,f.handler,f.method)}u&&ve()}get precacheStrategy(){return this._precacheStrategy}get routes(){return this._routes}addEventListeners(){self.addEventListener("install",this.handleInstall),self.addEventListener("activate",this.handleActivate),self.addEventListener("fetch",this.handleFetch),self.addEventListener("message",this.handleCache)}addToPrecacheList(e){let t=[];for(let s of e){typeof s=="string"?t.push(s):s&&!s.integrity&&s.revision===void 0&&t.push(s.url);let{cacheKey:r,url:n}=Pe(s),a=typeof s!="string"&&s.revision?"reload":"default";if(this._urlsToCacheKeys.has(n)&&this._urlsToCacheKeys.get(n)!==r)throw new l("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(n),secondEntry:r});if(typeof s!="string"&&s.integrity){if(this._cacheKeysToIntegrities.has(r)&&this._cacheKeysToIntegrities.get(r)!==s.integrity)throw new l("add-to-cache-list-conflicting-integrities",{url:n});this._cacheKeysToIntegrities.set(r,s.integrity)}this._urlsToCacheKeys.set(n,r),this._urlsToCacheModes.set(n,a)}if(t.length>0){let s=`Serwist is precaching URLs without revision info: ${t.join(", ")}
This is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(s)}}handleInstall(e){return this.registerRequestRules(e),V(e,async()=>{let t=new Ue;this.precacheStrategy.plugins.push(t),await Ie(this._concurrentPrecaching,Array.from(this._urlsToCacheKeys.entries()),async([n,a])=>{let o=this._cacheKeysToIntegrities.get(a),i=this._urlsToCacheModes.get(n),c=new Request(n,{integrity:o,cache:i,credentials:"same-origin"});await Promise.all(this.precacheStrategy.handleAll({event:e,request:c,url:new URL(c.url),params:{cacheKey:a}}))});let{updatedURLs:s,notUpdatedURLs:r}=t;return{updatedURLs:s,notUpdatedURLs:r}})}async registerRequestRules(e){if(this._requestRules&&e?.addRoutes)try{await e.addRoutes(this._requestRules),this._requestRules=void 0}catch(t){throw t}}handleActivate(e){return V(e,async()=>{let t=await self.caches.open(this.precacheStrategy.cacheName),s=await t.keys(),r=new Set(this._urlsToCacheKeys.values()),n=[];for(let a of s)r.has(a.url)||(await t.delete(a),n.push(a.url));return{deletedCacheRequests:n}})}handleFetch(e){let{request:t}=e,s=this.handleRequest({request:t,event:e});s&&e.respondWith(s)}handleCache(e){if(e.data&&e.data.type==="CACHE_URLS"){let{payload:t}=e.data,s=Promise.all(t.urlsToCache.map(r=>{let n;return typeof r=="string"?n=new Request(r):n=new Request(...r),this.handleRequest({request:n,event:e})}));e.waitUntil(s),e.ports?.[0]&&s.then(()=>e.ports[0].postMessage(!0))}}setDefaultHandler(e,t="GET"){this._defaultHandlerMap.set(t,T(e))}setCatchHandler(e){this._catchHandler=T(e)}registerCapture(e,t,s){let r=$e(e,t,s);return this.registerRoute(r),r}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new l("unregister-route-route-not-registered")}getUrlsToPrecacheKeys(){return this._urlsToCacheKeys}getPrecachedUrls(){return[...this._urlsToCacheKeys.keys()]}getPrecacheKeyForUrl(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForPrecacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,s=this.getPrecacheKeyForUrl(t);if(s)return(await self.caches.open(this.precacheStrategy.cacheName)).match(s)}createHandlerBoundToUrl(e){let t=this.getPrecacheKeyForUrl(e);if(!t)throw new l("non-precached-url",{url:e});return s=>(s.request=new Request(e),s.params={cacheKey:t,...s.params},this.precacheStrategy.handle(s))}handleRequest({request:e,event:t}){let s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return;let r=s.origin===location.origin,{params:n,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:s}),o=a?.handler,i=[],c=e.method;if(!o&&this._defaultHandlerMap.has(c)&&(o=this._defaultHandlerMap.get(c)),!o)return;let u;try{u=o.handle({url:s,request:e,event:t,params:n})}catch(m){u=Promise.reject(m)}let d=a?.catchHandler;return u instanceof Promise&&(this._catchHandler||d)&&(u=u.catch(async m=>{if(d)try{return await d.handle({url:s,request:e,event:t,params:n})}catch(x){x instanceof Error&&(m=x)}if(this._catchHandler)return this._catchHandler.handle({url:s,request:e,event:t});throw m})),u}findMatchingRoute({url:e,sameOrigin:t,request:s,event:r}){let n=this._routes.get(s.method)||[];for(let a of n){let o,i=a.match({url:e,sameOrigin:t,request:s,event:r});if(i)return o=i,(Array.isArray(o)&&o.length===0||i.constructor===Object&&Object.keys(i).length===0||typeof i=="boolean")&&(o=void 0),{route:a,params:o}}return{}}};var ee={rscPrefetch:"pages-rsc-prefetch",rsc:"pages-rsc",html:"pages"},Ve=[{matcher:/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,handler:new A({cacheName:"google-fonts-webfonts",plugins:[new h({maxEntries:4,maxAgeSeconds:365*24*60*60,maxAgeFrom:"last-used"})]})},{matcher:/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,handler:new k({cacheName:"google-fonts-stylesheets",plugins:[new h({maxEntries:4,maxAgeSeconds:10080*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,handler:new k({cacheName:"static-font-assets",plugins:[new h({maxEntries:4,maxAgeSeconds:10080*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,handler:new k({cacheName:"static-image-assets",plugins:[new h({maxEntries:64,maxAgeSeconds:720*60*60,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/static.+\.js$/i,handler:new A({cacheName:"next-static-js-assets",plugins:[new h({maxEntries:64,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/image\?url=.+$/i,handler:new k({cacheName:"next-image",plugins:[new h({maxEntries:64,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:mp3|wav|ogg)$/i,handler:new A({cacheName:"static-audio-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"}),new Z]})},{matcher:/\.(?:mp4|webm)$/i,handler:new A({cacheName:"static-video-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"}),new Z]})},{matcher:/\.(?:js)$/i,handler:new k({cacheName:"static-js-assets",plugins:[new h({maxEntries:48,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:css|less)$/i,handler:new k({cacheName:"static-style-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\/_next\/data\/.+\/.+\.json$/i,handler:new p({cacheName:"next-data",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\.(?:json|xml|csv)$/i,handler:new p({cacheName:"static-data-assets",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})]})},{matcher:/\/api\/auth\/.*/,handler:new R({networkTimeoutSeconds:10})},{matcher:({sameOrigin:e,url:{pathname:t}})=>e&&t.startsWith("/api/"),method:"GET",handler:new p({cacheName:"apis",plugins:[new h({maxEntries:16,maxAgeSeconds:1440*60,maxAgeFrom:"last-used"})],networkTimeoutSeconds:10})},{matcher:({request:e,url:{pathname:t},sameOrigin:s})=>e.headers.get("RSC")==="1"&&e.headers.get("Next-Router-Prefetch")==="1"&&s&&!t.startsWith("/api/"),handler:new p({cacheName:ee.rscPrefetch,plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({request:e,url:{pathname:t},sameOrigin:s})=>e.headers.get("RSC")==="1"&&s&&!t.startsWith("/api/"),handler:new p({cacheName:ee.rsc,plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({request:e,url:{pathname:t},sameOrigin:s})=>e.headers.get("Content-Type")?.includes("text/html")&&s&&!t.startsWith("/api/"),handler:new p({cacheName:ee.html,plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({url:{pathname:e},sameOrigin:t})=>t&&!e.startsWith("/api/"),handler:new p({cacheName:"others",plugins:[new h({maxEntries:32,maxAgeSeconds:1440*60})]})},{matcher:({sameOrigin:e})=>!e,handler:new p({cacheName:"cross-origin",plugins:[new h({maxEntries:32,maxAgeSeconds:3600})],networkTimeoutSeconds:10})},{matcher:/.*/i,method:"GET",handler:new R}];var Me="/offline.html",At=["/api/","/auth/"],te=new Fe({precacheEntries:w,skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,runtimeCaching:[{matcher({request:e,sameOrigin:t,url:s}){return t?e.method!=="GET"||e.headers.has("Authorization")?!0:At.some(r=>s.pathname.startsWith(r)):!1},handler:new R},...Ve]}),Ot=async()=>{let e=await te.matchPrecache(Me);return e??caches.match(Me,{ignoreSearch:!0})};te.setCatchHandler(async({request:e})=>{if(e.mode==="navigate"||e.destination==="document"){let t=await Ot();if(t!=null)return t}return Response.error()});te.addEventListeners();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Appka do sklepów z aplikacjami

4 participants