phanpy-cz/sw.js

3 lines
21 KiB
JavaScript
Raw Normal View History

2024-11-13 19:53:32 +00:00
try{self["workbox:core:7.2.0"]&&_()}catch{}try{self["workbox:cacheable-response:7.2.0"]&&_()}catch{}class ee{constructor(e={}){this._statuses=e.statuses,this._headers=e.headers}isResponseCacheable(e){let t=!0;return this._statuses&&(t=this._statuses.includes(e.status)),this._headers&&t&&(t=Object.keys(this._headers).some(n=>e.headers.get(n)===this._headers[n])),t}}class C{constructor(e){this.cacheWillUpdate=async({response:t})=>this._cacheableResponse.isResponseCacheable(t)?t:null,this._cacheableResponse=new ee(e)}}try{self["workbox:core:7.2.0"]&&_()}catch{}const te=(s,...e)=>{let t=s;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t},se=te;let ne=class extends Error{constructor(e,t){const n=se(e,t);super(n),this.name=e,this.details=t}};function Q(s){s.then(()=>{})}const ae=(s,e)=>e.some(t=>s instanceof t);let H,K;function re(){return H||(H=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ie(){return K||(K=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const G=new WeakMap,M=new WeakMap,J=new WeakMap,O=new WeakMap,U=new WeakMap;function oe(s){const e=new Promise((t,n)=>{const a=()=>{s.removeEventListener("success",i),s.removeEventListener("error",r)},i=()=>{t(f(s.result)),a()},r=()=>{n(s.error),a()};s.addEventListener("success",i),s.addEventListener("error",r)});return e.then(t=>{t instanceof IDBCursor&&G.set(t,s)}).catch(()=>{}),U.set(e,s),e}function ce(s){if(M.has(s))return;const e=new Promise((t,n)=>{const a=()=>{s.removeEventListener("complete",i),s.removeEventListener("error",r),s.removeEventListener("abort",r)},i=()=>{t(),a()},r=()=>{n(s.error||new DOMException("AbortError","AbortError")),a()};s.addEventListener("complete",i),s.addEventListener("error",r),s.addEventListener("abort",r)});M.set(s,e)}let v={get(s,e,t){if(s instanceof IDBTransaction){if(e==="done")return M.get(s);if(e==="objectStoreNames")return s.objectStoreNames||J.get(s);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return f(s[e])},set(s,e,t){return s[e]=t,!0},has(s,e){return s instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in s}};function le(s){v=s(v)}function he(s){return s===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const n=s.call(T(this),e,...t);return J.set(n,e.sort?e.sort():[e]),f(n)}:ie().includes(s)?function(...e){return s.apply(T(this),e),f(G.get(this))}:function(...e){return f(s.apply(T(this),e))}}function ue(s){return typeof s=="function"?he(s):(s instanceof IDBTransaction&&ce(s),ae(s,re())?new Proxy(s,v):s)}function f(s){if(s instanceof IDBRequest)return oe(s);if(O.has(s))return O.get(s);const e=ue(s);return e!==s&&(O.set(s,e),U.set(e,s)),e}const T=s=>U.get(s);function de(s,e,{blocked:t,upgrade:n,blocking:a,terminated:i}={}){const r=indexedDB.open(s,e),o=f(r);return n&&r.addEventListener("upgradeneeded",c=>{n(f(r.result),c.oldVersion,c.newVersion,f(r.transaction),c)}),t&&r.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),o.then(c=>{i&&c.addEventListener("close",()=>i()),a&&c.addEventListener("versionchange",l=>a(l.oldVersion,l.newVersion,l))}).catch(()=>{}),o}function fe(s,{blocked:e}={}){const t=indexedDB.deleteDatabase(s);return e&&t.addEventListener("blocked",n=>e(n.oldVersion,n)),f(t).then(()=>{})}const pe=["get","getKey","getAll","getAllKeys","count"],me=["put","add","delete","clear"],A=new Map;function $(s,e){if(!(s instanceof IDBDatabase&&!(e in s)&&typeof e=="string"))return;if(A.get(e))return A.get(e);const t=e.replace(/FromIndex$/,""),n=e!==t,a=me.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(a||pe.includes(t)))return;const i=async function(r,...o){const c=this.transaction(r,a?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(o.shift())),(await Promise.all([l[t](...o),a&&c.done]))[0]};return A.set(e,i),i}le(s=>({...s,get:(e,t,n)=>$(e,t)||s.get(e,t,n),has:(e,t)=>!!$(e,t)||s.has(e,t)}));try{self["workbox:expiration:7.2.0"]&&_()}catch{}const ge="workbox-expiration",x="cache-entries",q=s=>{const e=new URL(
2024-06-16 18:14:43 +00:00
//# sourceMappingURL=sw.js.map