From 043dd9211829eff1cadecbd540b1ea07892dd58c Mon Sep 17 00:00:00 2001 From: David Melendez Date: Sun, 12 Oct 2025 19:17:57 -0600 Subject: [PATCH 1/6] Update minimatch dependency to version 9.0.3, change target network to Sepolia, and modify RandomnessComponent with new contract addresses and temporary dev mode implementation for randomness generation. --- .../contract/RandomnessComponent.tsx | 31 ++++++++++++++++++- .../nextjs/contracts/deployedContracts.ts | 6 ++-- packages/nextjs/package.json | 1 + packages/nextjs/scaffold.config.ts | 2 +- .../snfoundry/contracts/src/Randomness.cairo | 2 ++ yarn.lock | 3 +- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx index 4fe3f64..f838f88 100644 --- a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx +++ b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx @@ -19,7 +19,7 @@ const VRF_PROVIDER_ADDRESS = // Dirección esperada del contrato de Randomness desplegado en testnet // Esta dirección se actualiza con cada nuevo deployment para pruebas const EXPECTED_RANDOMNESS_CONTRACT_ADDRESS = - "0x5b3558ec6cbe58d1d1279b428aaace0fd9230b5993e19f482af82306076c54f"; + "0x3d8a08f250a2101978023f3f86b002bf94fda19ba6e7b213e79ae058c031627"; interface RandomnessComponentProps { contractName: ContractName; @@ -118,6 +118,34 @@ export const RandomnessComponent = ({ // Convertir seed a u64 (número entero sin signo de 64 bits) const seedValue = BigInt(seed); + // TODO: Production mode (request_randomness_prod) is currently disabled due to VRF issues on testnet. + // For now, we're forcing dev mode (devnet_generate) for all environments including testnet. + // Once the production VRF integration is stable, uncomment the conditional logic below + // and remove the forced dev mode implementation. + + // TEMPORARY: Always use devnet_generate regardless of network + const seedHex = num.toHex(seedValue); + + const txHash = await writeTransaction([ + { + contractAddress: contractAddress as string, + entrypoint: "devnet_generate", + calldata: [seedHex], + }, + ]); + + if (txHash) { + setTxHash(txHash); + notification.success( + `5 random numbers generated successfully! Hash: ${txHash}`, + ); + if (onSuccess) { + onSuccess(txHash, generationId); + } + } + + /* COMMENTED OUT - Production mode with VRF (to be re-enabled when VRF is stable) + // Detectar si estamos en devnet o testnet/mainnet const isDevnet = forceDevMode || @@ -230,6 +258,7 @@ export const RandomnessComponent = ({ } } } + */ } catch (error: any) { // Provide more specific error messages let errorMessage = "Unknown error requesting randomness"; diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index dd0ef1f..c1dd96b 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -7,7 +7,7 @@ const deployedContracts = { devnet: { Randomness: { address: - "0x5b3558ec6cbe58d1d1279b428aaace0fd9230b5993e19f482af82306076c54f", + "0x552f59e251be892c95ff526a3626b52b35c9bb7a3b121873f0179382fa3d5d3", abi: [ { type: "impl", @@ -484,7 +484,7 @@ const deployedContracts = { sepolia: { Randomness: { address: - "0x31cdafdd0fc1a80d57f3290afff3ba0a62e9d2c628e35c81eb55e05879f0f4f", + "0x3d8a08f250a2101978023f3f86b002bf94fda19ba6e7b213e79ae058c031627", abi: [ { type: "impl", @@ -955,7 +955,7 @@ const deployedContracts = { }, ], classHash: - "0x342eab9caa3364fe668dfeaddf7c5ff2516f791c35e39dc7065c00e1b9fc017", + "0x48bff87a49d373cb93e9559587cf10619c270fa4dcd0bedde61609cd7a81d3f", }, }, } as const; diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 27dad03..ee945b7 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -68,6 +68,7 @@ "eslint": "^8", "eslint-config-next": "15.2.3", "jsdom": "^26.0.0", + "minimatch": "^9.0.3", "postcss": "^8", "shx": "^0.4.0", "tailwindcss": "^3.3.0", diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index 993d640..230cf80 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -13,7 +13,7 @@ export type ScaffoldConfig = { }; const scaffoldConfig = { - targetNetworks: [chains.devnet], + targetNetworks: [chains.sepolia], // Only show the Burner Wallet when running on devnet onlyLocalBurnerWallet: false, rpcProviderUrl: { diff --git a/packages/snfoundry/contracts/src/Randomness.cairo b/packages/snfoundry/contracts/src/Randomness.cairo index b85bea7..db1a73c 100644 --- a/packages/snfoundry/contracts/src/Randomness.cairo +++ b/packages/snfoundry/contracts/src/Randomness.cairo @@ -201,6 +201,8 @@ pub mod Randomness { } fn devnet_generate(ref self: ContractState, seed: u64) -> u64 { + // Only the contract owner can call this function + self.ownable.assert_only_owner(); assert(self.dev_mode.read(), 'DEV_DISABLED'); let next_id = self.generation_counter.read() + 1_u64; diff --git a/yarn.lock b/yarn.lock index 1e183d7..782ceb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3862,6 +3862,7 @@ __metadata: ethers: ^6.12.0 get-starknet-core: ^4.0.0 jsdom: ^26.0.0 + minimatch: ^9.0.3 next: 15.2.4 next-pwa: ^5.6.0 next-themes: ^0.2.1 @@ -9981,7 +9982,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.3, minimatch@npm:^9.0.4": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: From fe838b70cf8f1bcf7295a87053cc28ce171bbaa8 Mon Sep 17 00:00:00 2001 From: David Melendez Date: Sun, 12 Oct 2025 20:19:49 -0600 Subject: [PATCH 2/6] pdate provider logging for better debugging --- packages/nextjs/public/sw.js | 393 +----- packages/nextjs/public/workbox-4754cb34.js | 1320 +------------------- packages/nextjs/services/web3/provider.ts | 8 + 3 files changed, 10 insertions(+), 1711 deletions(-) diff --git a/packages/nextjs/public/sw.js b/packages/nextjs/public/sw.js index 924c508..cc7af33 100644 --- a/packages/nextjs/public/sw.js +++ b/packages/nextjs/public/sw.js @@ -1,392 +1 @@ -if (!self.define) { - let e, - s = {}; - const n = (n, i) => ( - (n = new URL(n + ".js", i).href), - s[n] || - new Promise((s) => { - if ("document" in self) { - const e = document.createElement("script"); - (e.src = n), (e.onload = s), document.head.appendChild(e); - } else (e = n), importScripts(n), s(); - }).then(() => { - let e = s[n]; - if (!e) throw new Error(`Module ${n} didn’t register its module`); - return e; - }) - ); - self.define = (i, c) => { - const a = - e || - ("document" in self ? document.currentScript.src : "") || - location.href; - if (s[a]) return; - let t = {}; - const r = (e) => n(e, a), - o = { module: { uri: a }, exports: t, require: r }; - s[a] = Promise.all(i.map((e) => o[e] || r(e))).then((e) => (c(...e), t)); - }; -} -define(["./workbox-4754cb34"], function (e) { - "use strict"; - importScripts(), - self.skipWaiting(), - e.clientsClaim(), - e.precacheAndRoute( - [ - { - url: "/_next/app-build-manifest.json", - revision: "b275a34557ea1a9cb4b65203cdd486b3", - }, - { - url: "/_next/static/FQQienyxJ-IKX7XJN9c-U/_buildManifest.js", - revision: "51da8d50ab8ae1c1afafe38c7e424e4e", - }, - { - url: "/_next/static/FQQienyxJ-IKX7XJN9c-U/_ssgManifest.js", - revision: "b6652df95db52feb4daf4eca35380933", - }, - { - url: "/_next/static/chunks/141-d196c46095c0e291.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/145-87bbd58530c47b49.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/2f0b94e8-734829800d3eb38b.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/473f56c0-0933f1e2ac7ad0b5.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/486-3b991d95cef62049.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/4bd1b696-48a906261550a4c5.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/658-e54429557207cf0c.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/668-1fc7cc2fee87ff24.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/684-3cf479aafee24c45.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/70646a03-d8bbffbaf77fafd0.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/850-4a1aa8fcc9cc8597.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/929-7d9534372e77efc8.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/94-3076be7aeedb9512.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/972.6d641f23fb3b1bd5.js", - revision: "6d641f23fb3b1bd5", - }, - { - url: "/_next/static/chunks/app/_not-found/page-04d3b5ab1d5bc6de.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/app/api/price/route-6c0ab67fce666a7b.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/app/configure/page-2501fcf559af4c9f.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/app/debug/page-00e35916938cbdb1.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/app/debug/randomness/page-01ec39be690d1ca3.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/app/layout-2dc3d265bddc1be4.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/app/page-f53cfa65768f16c0.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/e6909d18-d7c7e73117910c02.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/framework-859199dea06580b0.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/main-a106802aa546c841.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/main-app-58ca74d35777be74.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/pages/_app-da15c11dea942c36.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/pages/_error-cc3f077a18ea1793.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/chunks/polyfills-42372ed130431b0a.js", - revision: "846118c33b2c0e922d7b3a7676f81f6f", - }, - { - url: "/_next/static/chunks/webpack-8cb4a62bb51bf237.js", - revision: "FQQienyxJ-IKX7XJN9c-U", - }, - { - url: "/_next/static/css/a3de78c781ee431c.css", - revision: "a3de78c781ee431c", - }, - { - url: "/blast-icon-color.svg", - revision: "f455c22475a343be9fcd764de7e7147e", - }, - { - url: "/debug-icon.svg", - revision: "25aadc709736507034d14ca7aabcd29d", - }, - { - url: "/debug-image.png", - revision: "34c4ca2676dd59ff24d6338faa1af371", - }, - { - url: "/explorer-icon.svg", - revision: "84507da0e8989bb5b7616a3f66d31f48", - }, - { - url: "/gradient-s.svg", - revision: "c003f595a6d30b1b476115f64476e2cf", - }, - { url: "/logo.ico", revision: "0359e607e29a3d3b08095d84a9d25c39" }, - { url: "/logo.svg", revision: "962a8546ade641ef7ad4e1b669f0548c" }, - { url: "/manifest.json", revision: "781788f3e2bc4b2b176b5d8c425d7475" }, - { - url: "/rpc-version.png", - revision: "cf97fd668cfa1221bec0210824978027", - }, - { - url: "/scaffold-config.png", - revision: "1ebfc244c31732dc4273fe292bd07596", - }, - { - url: "/sn-symbol-gradient.png", - revision: "908b60a4f6b92155b8ea38a009fa7081", - }, - { - url: "/starkcompass-icon.svg", - revision: "eccc2ece017ee9e73e512996b74e49ac", - }, - { - url: "/voyager-icon.svg", - revision: "06663dd5ba2c49423225a8e3893b45fe", - }, - ], - { ignoreURLParametersMatching: [] }, - ), - e.cleanupOutdatedCaches(), - e.registerRoute( - "/", - new e.NetworkFirst({ - cacheName: "start-url", - plugins: [ - { - cacheWillUpdate: async ({ - request: e, - response: s, - event: n, - state: i, - }) => - s && "opaqueredirect" === s.type - ? new Response(s.body, { - status: 200, - statusText: "OK", - headers: s.headers, - }) - : s, - }, - ], - }), - "GET", - ), - e.registerRoute( - /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i, - new e.CacheFirst({ - cacheName: "google-fonts-webfonts", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 31536e3 }), - ], - }), - "GET", - ), - e.registerRoute( - /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i, - new e.StaleWhileRevalidate({ - cacheName: "google-fonts-stylesheets", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 604800 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i, - new e.StaleWhileRevalidate({ - cacheName: "static-font-assets", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 604800 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i, - new e.StaleWhileRevalidate({ - cacheName: "static-image-assets", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 64, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\/_next\/image\?url=.+$/i, - new e.StaleWhileRevalidate({ - cacheName: "next-image", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 64, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:mp3|wav|ogg)$/i, - new e.CacheFirst({ - cacheName: "static-audio-assets", - plugins: [ - new e.RangeRequestsPlugin(), - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:mp4)$/i, - new e.CacheFirst({ - cacheName: "static-video-assets", - plugins: [ - new e.RangeRequestsPlugin(), - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:js)$/i, - new e.StaleWhileRevalidate({ - cacheName: "static-js-assets", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:css|less)$/i, - new e.StaleWhileRevalidate({ - cacheName: "static-style-assets", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\/_next\/data\/.+\/.+\.json$/i, - new e.StaleWhileRevalidate({ - cacheName: "next-data", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - /\.(?:json|xml|csv)$/i, - new e.NetworkFirst({ - cacheName: "static-data-assets", - plugins: [ - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - ({ url: e }) => { - if (!(self.origin === e.origin)) return !1; - const s = e.pathname; - return !s.startsWith("/api/auth/") && !!s.startsWith("/api/"); - }, - new e.NetworkFirst({ - cacheName: "apis", - networkTimeoutSeconds: 10, - plugins: [ - new e.ExpirationPlugin({ maxEntries: 16, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - ({ url: e }) => { - if (!(self.origin === e.origin)) return !1; - return !e.pathname.startsWith("/api/"); - }, - new e.NetworkFirst({ - cacheName: "others", - networkTimeoutSeconds: 10, - plugins: [ - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), - ], - }), - "GET", - ), - e.registerRoute( - ({ url: e }) => !(self.origin === e.origin), - new e.NetworkFirst({ - cacheName: "cross-origin", - networkTimeoutSeconds: 10, - plugins: [ - new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 3600 }), - ], - }), - "GET", - ); -}); +if(!self.define){let e,s={};const n=(n,a)=>(n=new URL(n+".js",a).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(a,i)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let c={};const o=e=>n(e,t),r={module:{uri:t},exports:c,require:o};s[t]=Promise.all(a.map((e=>r[e]||o(e)))).then((e=>(i(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"24cba94d9309176532e78cb1d62f704b"},{url:"/_next/static/D1doUzJOrfW3xxpsnpoPs/_buildManifest.js",revision:"51da8d50ab8ae1c1afafe38c7e424e4e"},{url:"/_next/static/D1doUzJOrfW3xxpsnpoPs/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/141-d196c46095c0e291.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/145-06c74ecb1424b1e8.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/2f0b94e8-734829800d3eb38b.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/473f56c0-0933f1e2ac7ad0b5.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/4bd1b696-48a906261550a4c5.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/658-e54429557207cf0c.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/668-61b1540c76186c47.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/684-3cf479aafee24c45.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/70646a03-d8bbffbaf77fafd0.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/850-839837f3488a9814.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/929-7d9534372e77efc8.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/94-3076be7aeedb9512.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/972.0f900fee228de7ed.js",revision:"0f900fee228de7ed"},{url:"/_next/static/chunks/app/_not-found/page-04d3b5ab1d5bc6de.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/api/price/route-6c0ab67fce666a7b.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/configure/page-2501fcf559af4c9f.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/debug/page-834fa7470eeeb7b6.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/debug/randomness/page-b7fd465125e2745d.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/layout-ae9670c6ab3ddb7b.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/page-9f25e9a14f8c04f9.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/e6909d18-d7c7e73117910c02.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/framework-859199dea06580b0.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/main-a106802aa546c841.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/main-app-58ca74d35777be74.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/pages/_app-da15c11dea942c36.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/pages/_error-cc3f077a18ea1793.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-8a51ae7d91979afc.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/css/7fbd5887a52e6553.css",revision:"7fbd5887a52e6553"},{url:"/blast-icon-color.svg",revision:"d949ffbc94b7c50e2e4fcf2b1daf1607"},{url:"/debug-icon.svg",revision:"62ce54a2ddb8d11cb25c891c9adbdbea"},{url:"/debug-image.png",revision:"34c4ca2676dd59ff24d6338faa1af371"},{url:"/explorer-icon.svg",revision:"f6413b9b86d870f77edeb18891f6b3d5"},{url:"/gradient-s.svg",revision:"1966c9867618efad27716a8591d9ade0"},{url:"/logo.ico",revision:"0359e607e29a3d3b08095d84a9d25c39"},{url:"/logo.svg",revision:"a497d49f3c5cf63fe06eda59345d5ec1"},{url:"/manifest.json",revision:"004abf8d9f1b515402e5ee94bf8f3567"},{url:"/rpc-version.png",revision:"cf97fd668cfa1221bec0210824978027"},{url:"/scaffold-config.png",revision:"1ebfc244c31732dc4273fe292bd07596"},{url:"/sn-symbol-gradient.png",revision:"908b60a4f6b92155b8ea38a009fa7081"},{url:"/starkcompass-icon.svg",revision:"f8853deea695e7491b012b31a0e6ed82"},{url:"/voyager-icon.svg",revision:"06663dd5ba2c49423225a8e3893b45fe"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:n,state:a})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); diff --git a/packages/nextjs/public/workbox-4754cb34.js b/packages/nextjs/public/workbox-4754cb34.js index 3f04c68..5cd8247 100644 --- a/packages/nextjs/public/workbox-4754cb34.js +++ b/packages/nextjs/public/workbox-4754cb34.js @@ -1,1319 +1 @@ -define(["exports"], function (t) { - "use strict"; - try { - self["workbox:core:6.5.4"] && _(); - } catch (t) {} - const e = (t, ...e) => { - let s = t; - return e.length > 0 && (s += ` :: ${JSON.stringify(e)}`), s; - }; - class s extends Error { - constructor(t, s) { - super(e(t, s)), (this.name = t), (this.details = s); - } - } - try { - self["workbox:routing:6.5.4"] && _(); - } catch (t) {} - const n = (t) => (t && "object" == typeof t ? t : { handle: t }); - class r { - constructor(t, e, s = "GET") { - (this.handler = n(e)), (this.match = t), (this.method = s); - } - setCatchHandler(t) { - this.catchHandler = n(t); - } - } - class i extends r { - constructor(t, e, s) { - super( - ({ url: e }) => { - const s = t.exec(e.href); - if (s && (e.origin === location.origin || 0 === s.index)) - return s.slice(1); - }, - e, - s, - ); - } - } - class a { - constructor() { - (this.t = new Map()), (this.i = new Map()); - } - get routes() { - return this.t; - } - addFetchListener() { - self.addEventListener("fetch", (t) => { - const { request: e } = t, - s = this.handleRequest({ request: e, event: t }); - s && t.respondWith(s); - }); - } - addCacheListener() { - self.addEventListener("message", (t) => { - if (t.data && "CACHE_URLS" === t.data.type) { - const { payload: e } = t.data, - s = Promise.all( - e.urlsToCache.map((e) => { - "string" == typeof e && (e = [e]); - const s = new Request(...e); - return this.handleRequest({ request: s, event: t }); - }), - ); - t.waitUntil(s), - t.ports && t.ports[0] && s.then(() => t.ports[0].postMessage(!0)); - } - }); - } - handleRequest({ request: t, event: e }) { - const s = new URL(t.url, location.href); - if (!s.protocol.startsWith("http")) return; - const n = s.origin === location.origin, - { params: r, route: i } = this.findMatchingRoute({ - event: e, - request: t, - sameOrigin: n, - url: s, - }); - let a = i && i.handler; - const o = t.method; - if ((!a && this.i.has(o) && (a = this.i.get(o)), !a)) return; - let c; - try { - c = a.handle({ url: s, request: t, event: e, params: r }); - } catch (t) { - c = Promise.reject(t); - } - const h = i && i.catchHandler; - return ( - c instanceof Promise && - (this.o || h) && - (c = c.catch(async (n) => { - if (h) - try { - return await h.handle({ - url: s, - request: t, - event: e, - params: r, - }); - } catch (t) { - t instanceof Error && (n = t); - } - if (this.o) return this.o.handle({ url: s, request: t, event: e }); - throw n; - })), - c - ); - } - findMatchingRoute({ url: t, sameOrigin: e, request: s, event: n }) { - const r = this.t.get(s.method) || []; - for (const i of r) { - let r; - const a = i.match({ url: t, sameOrigin: e, request: s, event: n }); - if (a) - return ( - (r = a), - ((Array.isArray(r) && 0 === r.length) || - (a.constructor === Object && 0 === Object.keys(a).length) || - "boolean" == typeof a) && - (r = void 0), - { route: i, params: r } - ); - } - return {}; - } - setDefaultHandler(t, e = "GET") { - this.i.set(e, n(t)); - } - setCatchHandler(t) { - this.o = n(t); - } - registerRoute(t) { - this.t.has(t.method) || this.t.set(t.method, []), - this.t.get(t.method).push(t); - } - unregisterRoute(t) { - if (!this.t.has(t.method)) - throw new s("unregister-route-but-not-found-with-method", { - method: t.method, - }); - const e = this.t.get(t.method).indexOf(t); - if (!(e > -1)) throw new s("unregister-route-route-not-registered"); - this.t.get(t.method).splice(e, 1); - } - } - let o; - const c = () => ( - o || ((o = new a()), o.addFetchListener(), o.addCacheListener()), o - ); - function h(t, e, n) { - let a; - if ("string" == typeof t) { - const s = new URL(t, location.href); - a = new r(({ url: t }) => t.href === s.href, e, n); - } else if (t instanceof RegExp) a = new i(t, e, n); - else if ("function" == typeof t) a = new r(t, e, n); - else { - if (!(t instanceof r)) - throw new s("unsupported-route-type", { - moduleName: "workbox-routing", - funcName: "registerRoute", - paramName: "capture", - }); - a = t; - } - return c().registerRoute(a), a; - } - try { - self["workbox:strategies:6.5.4"] && _(); - } catch (t) {} - const u = { - cacheWillUpdate: async ({ response: t }) => - 200 === t.status || 0 === t.status ? t : null, - }, - l = { - googleAnalytics: "googleAnalytics", - precache: "precache-v2", - prefix: "workbox", - runtime: "runtime", - suffix: "undefined" != typeof registration ? registration.scope : "", - }, - f = (t) => - [l.prefix, t, l.suffix].filter((t) => t && t.length > 0).join("-"), - w = (t) => t || f(l.precache), - d = (t) => t || f(l.runtime); - function p(t, e) { - const s = new URL(t); - for (const t of e) s.searchParams.delete(t); - return s.href; - } - class y { - constructor() { - this.promise = new Promise((t, e) => { - (this.resolve = t), (this.reject = e); - }); - } - } - const g = new Set(); - function m(t) { - return "string" == typeof t ? new Request(t) : t; - } - class v { - constructor(t, e) { - (this.h = {}), - Object.assign(this, e), - (this.event = e.event), - (this.u = t), - (this.l = new y()), - (this.p = []), - (this.m = [...t.plugins]), - (this.v = new Map()); - for (const t of this.m) this.v.set(t, {}); - this.event.waitUntil(this.l.promise); - } - async fetch(t) { - const { event: e } = this; - let n = m(t); - if ( - "navigate" === n.mode && - e instanceof FetchEvent && - e.preloadResponse - ) { - const t = await e.preloadResponse; - if (t) return t; - } - const r = this.hasCallback("fetchDidFail") ? n.clone() : null; - try { - for (const t of this.iterateCallbacks("requestWillFetch")) - n = await t({ request: n.clone(), event: e }); - } catch (t) { - if (t instanceof Error) - throw new s("plugin-error-request-will-fetch", { - thrownErrorMessage: t.message, - }); - } - const i = n.clone(); - try { - let t; - t = await fetch( - n, - "navigate" === n.mode ? void 0 : this.u.fetchOptions, - ); - for (const s of this.iterateCallbacks("fetchDidSucceed")) - t = await s({ event: e, request: i, response: t }); - return t; - } catch (t) { - throw ( - (r && - (await this.runCallbacks("fetchDidFail", { - error: t, - event: e, - originalRequest: r.clone(), - request: i.clone(), - })), - t) - ); - } - } - async fetchAndCachePut(t) { - const e = await this.fetch(t), - s = e.clone(); - return this.waitUntil(this.cachePut(t, s)), e; - } - async cacheMatch(t) { - const e = m(t); - let s; - const { cacheName: n, matchOptions: r } = this.u, - i = await this.getCacheKey(e, "read"), - a = Object.assign(Object.assign({}, r), { cacheName: n }); - s = await caches.match(i, a); - for (const t of this.iterateCallbacks("cachedResponseWillBeUsed")) - s = - (await t({ - cacheName: n, - matchOptions: r, - cachedResponse: s, - request: i, - event: this.event, - })) || void 0; - return s; - } - async cachePut(t, e) { - const n = m(t); - var r; - await ((r = 0), new Promise((t) => setTimeout(t, r))); - const i = await this.getCacheKey(n, "write"); - if (!e) - throw new s("cache-put-with-no-response", { - url: - ((a = i.url), - new URL(String(a), location.href).href.replace( - new RegExp(`^${location.origin}`), - "", - )), - }); - var a; - const o = await this.R(e); - if (!o) return !1; - const { cacheName: c, matchOptions: h } = this.u, - u = await self.caches.open(c), - l = this.hasCallback("cacheDidUpdate"), - f = l - ? await (async function (t, e, s, n) { - const r = p(e.url, s); - if (e.url === r) return t.match(e, n); - const i = Object.assign(Object.assign({}, n), { - ignoreSearch: !0, - }), - a = await t.keys(e, i); - for (const e of a) if (r === p(e.url, s)) return t.match(e, n); - })(u, i.clone(), ["__WB_REVISION__"], h) - : null; - try { - await u.put(i, l ? o.clone() : o); - } catch (t) { - if (t instanceof Error) - throw ( - ("QuotaExceededError" === t.name && - (await (async function () { - for (const t of g) await t(); - })()), - t) - ); - } - for (const t of this.iterateCallbacks("cacheDidUpdate")) - await t({ - cacheName: c, - oldResponse: f, - newResponse: o.clone(), - request: i, - event: this.event, - }); - return !0; - } - async getCacheKey(t, e) { - const s = `${t.url} | ${e}`; - if (!this.h[s]) { - let n = t; - for (const t of this.iterateCallbacks("cacheKeyWillBeUsed")) - n = m( - await t({ - mode: e, - request: n, - event: this.event, - params: this.params, - }), - ); - this.h[s] = n; - } - return this.h[s]; - } - hasCallback(t) { - for (const e of this.u.plugins) if (t in e) return !0; - return !1; - } - async runCallbacks(t, e) { - for (const s of this.iterateCallbacks(t)) await s(e); - } - *iterateCallbacks(t) { - for (const e of this.u.plugins) - if ("function" == typeof e[t]) { - const s = this.v.get(e), - n = (n) => { - const r = Object.assign(Object.assign({}, n), { state: s }); - return e[t](r); - }; - yield n; - } - } - waitUntil(t) { - return this.p.push(t), t; - } - async doneWaiting() { - let t; - for (; (t = this.p.shift()); ) await t; - } - destroy() { - this.l.resolve(null); - } - async R(t) { - let e = t, - s = !1; - for (const t of this.iterateCallbacks("cacheWillUpdate")) - if ( - ((e = - (await t({ - request: this.request, - response: e, - event: this.event, - })) || void 0), - (s = !0), - !e) - ) - break; - return s || (e && 200 !== e.status && (e = void 0)), e; - } - } - class R { - constructor(t = {}) { - (this.cacheName = d(t.cacheName)), - (this.plugins = t.plugins || []), - (this.fetchOptions = t.fetchOptions), - (this.matchOptions = t.matchOptions); - } - handle(t) { - const [e] = this.handleAll(t); - return e; - } - handleAll(t) { - t instanceof FetchEvent && (t = { event: t, request: t.request }); - const e = t.event, - s = "string" == typeof t.request ? new Request(t.request) : t.request, - n = "params" in t ? t.params : void 0, - r = new v(this, { event: e, request: s, params: n }), - i = this.q(r, s, e); - return [i, this.D(i, r, s, e)]; - } - async q(t, e, n) { - let r; - await t.runCallbacks("handlerWillStart", { event: n, request: e }); - try { - if (((r = await this.U(e, t)), !r || "error" === r.type)) - throw new s("no-response", { url: e.url }); - } catch (s) { - if (s instanceof Error) - for (const i of t.iterateCallbacks("handlerDidError")) - if (((r = await i({ error: s, event: n, request: e })), r)) break; - if (!r) throw s; - } - for (const s of t.iterateCallbacks("handlerWillRespond")) - r = await s({ event: n, request: e, response: r }); - return r; - } - async D(t, e, s, n) { - let r, i; - try { - r = await t; - } catch (i) {} - try { - await e.runCallbacks("handlerDidRespond", { - event: n, - request: s, - response: r, - }), - await e.doneWaiting(); - } catch (t) { - t instanceof Error && (i = t); - } - if ( - (await e.runCallbacks("handlerDidComplete", { - event: n, - request: s, - response: r, - error: i, - }), - e.destroy(), - i) - ) - throw i; - } - } - function b(t) { - t.then(() => {}); - } - function q() { - return ( - (q = Object.assign - ? Object.assign.bind() - : function (t) { - for (var e = 1; e < arguments.length; e++) { - var s = arguments[e]; - for (var n in s) ({}).hasOwnProperty.call(s, n) && (t[n] = s[n]); - } - return t; - }), - q.apply(null, arguments) - ); - } - let D, U; - const x = new WeakMap(), - L = new WeakMap(), - I = new WeakMap(), - C = new WeakMap(), - E = new WeakMap(); - let N = { - get(t, e, s) { - if (t instanceof IDBTransaction) { - if ("done" === e) return L.get(t); - if ("objectStoreNames" === e) return t.objectStoreNames || I.get(t); - if ("store" === e) - return s.objectStoreNames[1] - ? void 0 - : s.objectStore(s.objectStoreNames[0]); - } - return k(t[e]); - }, - set: (t, e, s) => ((t[e] = s), !0), - has: (t, e) => - (t instanceof IDBTransaction && ("done" === e || "store" === e)) || - e in t, - }; - function O(t) { - return t !== IDBDatabase.prototype.transaction || - "objectStoreNames" in IDBTransaction.prototype - ? ( - U || - (U = [ - IDBCursor.prototype.advance, - IDBCursor.prototype.continue, - IDBCursor.prototype.continuePrimaryKey, - ]) - ).includes(t) - ? function (...e) { - return t.apply(B(this), e), k(x.get(this)); - } - : function (...e) { - return k(t.apply(B(this), e)); - } - : function (e, ...s) { - const n = t.call(B(this), e, ...s); - return I.set(n, e.sort ? e.sort() : [e]), k(n); - }; - } - function T(t) { - return "function" == typeof t - ? O(t) - : (t instanceof IDBTransaction && - (function (t) { - if (L.has(t)) return; - const e = new Promise((e, s) => { - const n = () => { - t.removeEventListener("complete", r), - t.removeEventListener("error", i), - t.removeEventListener("abort", i); - }, - r = () => { - e(), n(); - }, - i = () => { - s(t.error || new DOMException("AbortError", "AbortError")), - n(); - }; - t.addEventListener("complete", r), - t.addEventListener("error", i), - t.addEventListener("abort", i); - }); - L.set(t, e); - })(t), - (e = t), - ( - D || - (D = [ - IDBDatabase, - IDBObjectStore, - IDBIndex, - IDBCursor, - IDBTransaction, - ]) - ).some((t) => e instanceof t) - ? new Proxy(t, N) - : t); - var e; - } - function k(t) { - if (t instanceof IDBRequest) - return (function (t) { - const e = new Promise((e, s) => { - const n = () => { - t.removeEventListener("success", r), - t.removeEventListener("error", i); - }, - r = () => { - e(k(t.result)), n(); - }, - i = () => { - s(t.error), n(); - }; - t.addEventListener("success", r), t.addEventListener("error", i); - }); - return ( - e - .then((e) => { - e instanceof IDBCursor && x.set(e, t); - }) - .catch(() => {}), - E.set(e, t), - e - ); - })(t); - if (C.has(t)) return C.get(t); - const e = T(t); - return e !== t && (C.set(t, e), E.set(e, t)), e; - } - const B = (t) => E.get(t); - const P = ["get", "getKey", "getAll", "getAllKeys", "count"], - M = ["put", "add", "delete", "clear"], - W = new Map(); - function j(t, e) { - if (!(t instanceof IDBDatabase) || e in t || "string" != typeof e) return; - if (W.get(e)) return W.get(e); - const s = e.replace(/FromIndex$/, ""), - n = e !== s, - r = M.includes(s); - if ( - !(s in (n ? IDBIndex : IDBObjectStore).prototype) || - (!r && !P.includes(s)) - ) - return; - const i = async function (t, ...e) { - const i = this.transaction(t, r ? "readwrite" : "readonly"); - let a = i.store; - return ( - n && (a = a.index(e.shift())), - (await Promise.all([a[s](...e), r && i.done]))[0] - ); - }; - return W.set(e, i), i; - } - N = ((t) => - q({}, t, { - get: (e, s, n) => j(e, s) || t.get(e, s, n), - has: (e, s) => !!j(e, s) || t.has(e, s), - }))(N); - try { - self["workbox:expiration:6.5.4"] && _(); - } catch (t) {} - const S = "cache-entries", - K = (t) => { - const e = new URL(t, location.href); - return (e.hash = ""), e.href; - }; - class A { - constructor(t) { - (this._ = null), (this.L = t); - } - I(t) { - const e = t.createObjectStore(S, { keyPath: "id" }); - e.createIndex("cacheName", "cacheName", { unique: !1 }), - e.createIndex("timestamp", "timestamp", { unique: !1 }); - } - C(t) { - this.I(t), - this.L && - (function (t, { blocked: e } = {}) { - const s = indexedDB.deleteDatabase(t); - e && s.addEventListener("blocked", (t) => e(t.oldVersion, t)), - k(s).then(() => {}); - })(this.L); - } - async setTimestamp(t, e) { - const s = { - url: (t = K(t)), - timestamp: e, - cacheName: this.L, - id: this.N(t), - }, - n = (await this.getDb()).transaction(S, "readwrite", { - durability: "relaxed", - }); - await n.store.put(s), await n.done; - } - async getTimestamp(t) { - const e = await this.getDb(), - s = await e.get(S, this.N(t)); - return null == s ? void 0 : s.timestamp; - } - async expireEntries(t, e) { - const s = await this.getDb(); - let n = await s - .transaction(S) - .store.index("timestamp") - .openCursor(null, "prev"); - const r = []; - let i = 0; - for (; n; ) { - const s = n.value; - s.cacheName === this.L && - ((t && s.timestamp < t) || (e && i >= e) ? r.push(n.value) : i++), - (n = await n.continue()); - } - const a = []; - for (const t of r) await s.delete(S, t.id), a.push(t.url); - return a; - } - N(t) { - return this.L + "|" + K(t); - } - async getDb() { - return ( - this._ || - (this._ = await (function ( - t, - e, - { blocked: s, upgrade: n, blocking: r, terminated: i } = {}, - ) { - const a = indexedDB.open(t, e), - o = k(a); - return ( - n && - a.addEventListener("upgradeneeded", (t) => { - n( - k(a.result), - t.oldVersion, - t.newVersion, - k(a.transaction), - t, - ); - }), - s && - a.addEventListener("blocked", (t) => - s(t.oldVersion, t.newVersion, t), - ), - o - .then((t) => { - i && t.addEventListener("close", () => i()), - r && - t.addEventListener("versionchange", (t) => - r(t.oldVersion, t.newVersion, t), - ); - }) - .catch(() => {}), - o - ); - })("workbox-expiration", 1, { upgrade: this.C.bind(this) })), - this._ - ); - } - } - class F { - constructor(t, e = {}) { - (this.O = !1), - (this.T = !1), - (this.k = e.maxEntries), - (this.B = e.maxAgeSeconds), - (this.P = e.matchOptions), - (this.L = t), - (this.M = new A(t)); - } - async expireEntries() { - if (this.O) return void (this.T = !0); - this.O = !0; - const t = this.B ? Date.now() - 1e3 * this.B : 0, - e = await this.M.expireEntries(t, this.k), - s = await self.caches.open(this.L); - for (const t of e) await s.delete(t, this.P); - (this.O = !1), this.T && ((this.T = !1), b(this.expireEntries())); - } - async updateTimestamp(t) { - await this.M.setTimestamp(t, Date.now()); - } - async isURLExpired(t) { - if (this.B) { - const e = await this.M.getTimestamp(t), - s = Date.now() - 1e3 * this.B; - return void 0 === e || e < s; - } - return !1; - } - async delete() { - (this.T = !1), await this.M.expireEntries(1 / 0); - } - } - try { - self["workbox:range-requests:6.5.4"] && _(); - } catch (t) {} - async function H(t, e) { - try { - if (206 === e.status) return e; - const n = t.headers.get("range"); - if (!n) throw new s("no-range-header"); - const r = (function (t) { - const e = t.trim().toLowerCase(); - if (!e.startsWith("bytes=")) - throw new s("unit-must-be-bytes", { normalizedRangeHeader: e }); - if (e.includes(",")) - throw new s("single-range-only", { normalizedRangeHeader: e }); - const n = /(\d*)-(\d*)/.exec(e); - if (!n || (!n[1] && !n[2])) - throw new s("invalid-range-values", { normalizedRangeHeader: e }); - return { - start: "" === n[1] ? void 0 : Number(n[1]), - end: "" === n[2] ? void 0 : Number(n[2]), - }; - })(n), - i = await e.blob(), - a = (function (t, e, n) { - const r = t.size; - if ((n && n > r) || (e && e < 0)) - throw new s("range-not-satisfiable", { size: r, end: n, start: e }); - let i, a; - return ( - void 0 !== e && void 0 !== n - ? ((i = e), (a = n + 1)) - : void 0 !== e && void 0 === n - ? ((i = e), (a = r)) - : void 0 !== n && void 0 === e && ((i = r - n), (a = r)), - { start: i, end: a } - ); - })(i, r.start, r.end), - o = i.slice(a.start, a.end), - c = o.size, - h = new Response(o, { - status: 206, - statusText: "Partial Content", - headers: e.headers, - }); - return ( - h.headers.set("Content-Length", String(c)), - h.headers.set( - "Content-Range", - `bytes ${a.start}-${a.end - 1}/${i.size}`, - ), - h - ); - } catch (t) { - return new Response("", { - status: 416, - statusText: "Range Not Satisfiable", - }); - } - } - function $(t, e) { - const s = e(); - return t.waitUntil(s), s; - } - try { - self["workbox:precaching:6.5.4"] && _(); - } catch (t) {} - function z(t) { - if (!t) throw new s("add-to-cache-list-unexpected-type", { entry: t }); - if ("string" == typeof t) { - const e = new URL(t, location.href); - return { cacheKey: e.href, url: e.href }; - } - const { revision: e, url: n } = t; - if (!n) throw new s("add-to-cache-list-unexpected-type", { entry: t }); - if (!e) { - const t = new URL(n, location.href); - return { cacheKey: t.href, url: t.href }; - } - const r = new URL(n, location.href), - i = new URL(n, location.href); - return ( - r.searchParams.set("__WB_REVISION__", e), - { cacheKey: r.href, url: i.href } - ); - } - class G { - constructor() { - (this.updatedURLs = []), - (this.notUpdatedURLs = []), - (this.handlerWillStart = async ({ request: t, state: e }) => { - e && (e.originalRequest = t); - }), - (this.cachedResponseWillBeUsed = async ({ - event: t, - state: e, - cachedResponse: s, - }) => { - if ( - "install" === t.type && - e && - e.originalRequest && - e.originalRequest instanceof Request - ) { - const t = e.originalRequest.url; - s ? this.notUpdatedURLs.push(t) : this.updatedURLs.push(t); - } - return s; - }); - } - } - class V { - constructor({ precacheController: t }) { - (this.cacheKeyWillBeUsed = async ({ request: t, params: e }) => { - const s = - (null == e ? void 0 : e.cacheKey) || this.W.getCacheKeyForURL(t.url); - return s ? new Request(s, { headers: t.headers }) : t; - }), - (this.W = t); - } - } - let J, Q; - async function X(t, e) { - let n = null; - if (t.url) { - n = new URL(t.url).origin; - } - if (n !== self.location.origin) - throw new s("cross-origin-copy-response", { origin: n }); - const r = t.clone(), - i = { - headers: new Headers(r.headers), - status: r.status, - statusText: r.statusText, - }, - a = e ? e(i) : i, - o = (function () { - if (void 0 === J) { - const t = new Response(""); - if ("body" in t) - try { - new Response(t.body), (J = !0); - } catch (t) { - J = !1; - } - J = !1; - } - return J; - })() - ? r.body - : await r.blob(); - return new Response(o, a); - } - class Y extends R { - constructor(t = {}) { - (t.cacheName = w(t.cacheName)), - super(t), - (this.j = !1 !== t.fallbackToNetwork), - this.plugins.push(Y.copyRedirectedCacheableResponsesPlugin); - } - async U(t, e) { - const s = await e.cacheMatch(t); - return ( - s || - (e.event && "install" === e.event.type - ? await this.S(t, e) - : await this.K(t, e)) - ); - } - async K(t, e) { - let n; - const r = e.params || {}; - if (!this.j) - throw new s("missing-precache-entry", { - cacheName: this.cacheName, - url: t.url, - }); - { - const s = r.integrity, - i = t.integrity, - a = !i || i === s; - (n = await e.fetch( - new Request(t, { integrity: "no-cors" !== t.mode ? i || s : void 0 }), - )), - s && - a && - "no-cors" !== t.mode && - (this.A(), await e.cachePut(t, n.clone())); - } - return n; - } - async S(t, e) { - this.A(); - const n = await e.fetch(t); - if (!(await e.cachePut(t, n.clone()))) - throw new s("bad-precaching-response", { - url: t.url, - status: n.status, - }); - return n; - } - A() { - let t = null, - e = 0; - for (const [s, n] of this.plugins.entries()) - n !== Y.copyRedirectedCacheableResponsesPlugin && - (n === Y.defaultPrecacheCacheabilityPlugin && (t = s), - n.cacheWillUpdate && e++); - 0 === e - ? this.plugins.push(Y.defaultPrecacheCacheabilityPlugin) - : e > 1 && null !== t && this.plugins.splice(t, 1); - } - } - (Y.defaultPrecacheCacheabilityPlugin = { - cacheWillUpdate: async ({ response: t }) => - !t || t.status >= 400 ? null : t, - }), - (Y.copyRedirectedCacheableResponsesPlugin = { - cacheWillUpdate: async ({ response: t }) => - t.redirected ? await X(t) : t, - }); - class Z { - constructor({ - cacheName: t, - plugins: e = [], - fallbackToNetwork: s = !0, - } = {}) { - (this.F = new Map()), - (this.H = new Map()), - (this.$ = new Map()), - (this.u = new Y({ - cacheName: w(t), - plugins: [...e, new V({ precacheController: this })], - fallbackToNetwork: s, - })), - (this.install = this.install.bind(this)), - (this.activate = this.activate.bind(this)); - } - get strategy() { - return this.u; - } - precache(t) { - this.addToCacheList(t), - this.G || - (self.addEventListener("install", this.install), - self.addEventListener("activate", this.activate), - (this.G = !0)); - } - addToCacheList(t) { - const e = []; - for (const n of t) { - "string" == typeof n - ? e.push(n) - : n && void 0 === n.revision && e.push(n.url); - const { cacheKey: t, url: r } = z(n), - i = "string" != typeof n && n.revision ? "reload" : "default"; - if (this.F.has(r) && this.F.get(r) !== t) - throw new s("add-to-cache-list-conflicting-entries", { - firstEntry: this.F.get(r), - secondEntry: t, - }); - if ("string" != typeof n && n.integrity) { - if (this.$.has(t) && this.$.get(t) !== n.integrity) - throw new s("add-to-cache-list-conflicting-integrities", { - url: r, - }); - this.$.set(t, n.integrity); - } - if ((this.F.set(r, t), this.H.set(r, i), e.length > 0)) { - const t = `Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`; - console.warn(t); - } - } - } - install(t) { - return $(t, async () => { - const e = new G(); - this.strategy.plugins.push(e); - for (const [e, s] of this.F) { - const n = this.$.get(s), - r = this.H.get(e), - i = new Request(e, { - integrity: n, - cache: r, - credentials: "same-origin", - }); - await Promise.all( - this.strategy.handleAll({ - params: { cacheKey: s }, - request: i, - event: t, - }), - ); - } - const { updatedURLs: s, notUpdatedURLs: n } = e; - return { updatedURLs: s, notUpdatedURLs: n }; - }); - } - activate(t) { - return $(t, async () => { - const t = await self.caches.open(this.strategy.cacheName), - e = await t.keys(), - s = new Set(this.F.values()), - n = []; - for (const r of e) s.has(r.url) || (await t.delete(r), n.push(r.url)); - return { deletedURLs: n }; - }); - } - getURLsToCacheKeys() { - return this.F; - } - getCachedURLs() { - return [...this.F.keys()]; - } - getCacheKeyForURL(t) { - const e = new URL(t, location.href); - return this.F.get(e.href); - } - getIntegrityForCacheKey(t) { - return this.$.get(t); - } - async matchPrecache(t) { - const e = t instanceof Request ? t.url : t, - s = this.getCacheKeyForURL(e); - if (s) { - return (await self.caches.open(this.strategy.cacheName)).match(s); - } - } - createHandlerBoundToURL(t) { - const e = this.getCacheKeyForURL(t); - if (!e) throw new s("non-precached-url", { url: t }); - return (s) => ( - (s.request = new Request(t)), - (s.params = Object.assign({ cacheKey: e }, s.params)), - this.strategy.handle(s) - ); - } - } - const tt = () => (Q || (Q = new Z()), Q); - class et extends r { - constructor(t, e) { - super(({ request: s }) => { - const n = t.getURLsToCacheKeys(); - for (const r of (function* ( - t, - { - ignoreURLParametersMatching: e = [/^utm_/, /^fbclid$/], - directoryIndex: s = "index.html", - cleanURLs: n = !0, - urlManipulation: r, - } = {}, - ) { - const i = new URL(t, location.href); - (i.hash = ""), yield i.href; - const a = (function (t, e = []) { - for (const s of [...t.searchParams.keys()]) - e.some((t) => t.test(s)) && t.searchParams.delete(s); - return t; - })(i, e); - if ((yield a.href, s && a.pathname.endsWith("/"))) { - const t = new URL(a.href); - (t.pathname += s), yield t.href; - } - if (n) { - const t = new URL(a.href); - (t.pathname += ".html"), yield t.href; - } - if (r) { - const t = r({ url: i }); - for (const e of t) yield e.href; - } - })(s.url, e)) { - const e = n.get(r); - if (e) { - return { cacheKey: e, integrity: t.getIntegrityForCacheKey(e) }; - } - } - }, t.strategy); - } - } - (t.CacheFirst = class extends R { - async U(t, e) { - let n, - r = await e.cacheMatch(t); - if (!r) - try { - r = await e.fetchAndCachePut(t); - } catch (t) { - t instanceof Error && (n = t); - } - if (!r) throw new s("no-response", { url: t.url, error: n }); - return r; - } - }), - (t.ExpirationPlugin = class { - constructor(t = {}) { - (this.cachedResponseWillBeUsed = async ({ - event: t, - request: e, - cacheName: s, - cachedResponse: n, - }) => { - if (!n) return null; - const r = this.V(n), - i = this.J(s); - b(i.expireEntries()); - const a = i.updateTimestamp(e.url); - if (t) - try { - t.waitUntil(a); - } catch (t) {} - return r ? n : null; - }), - (this.cacheDidUpdate = async ({ cacheName: t, request: e }) => { - const s = this.J(t); - await s.updateTimestamp(e.url), await s.expireEntries(); - }), - (this.X = t), - (this.B = t.maxAgeSeconds), - (this.Y = new Map()), - t.purgeOnQuotaError && - (function (t) { - g.add(t); - })(() => this.deleteCacheAndMetadata()); - } - J(t) { - if (t === d()) throw new s("expire-custom-caches-only"); - let e = this.Y.get(t); - return e || ((e = new F(t, this.X)), this.Y.set(t, e)), e; - } - V(t) { - if (!this.B) return !0; - const e = this.Z(t); - if (null === e) return !0; - return e >= Date.now() - 1e3 * this.B; - } - Z(t) { - if (!t.headers.has("date")) return null; - const e = t.headers.get("date"), - s = new Date(e).getTime(); - return isNaN(s) ? null : s; - } - async deleteCacheAndMetadata() { - for (const [t, e] of this.Y) - await self.caches.delete(t), await e.delete(); - this.Y = new Map(); - } - }), - (t.NetworkFirst = class extends R { - constructor(t = {}) { - super(t), - this.plugins.some((t) => "cacheWillUpdate" in t) || - this.plugins.unshift(u), - (this.tt = t.networkTimeoutSeconds || 0); - } - async U(t, e) { - const n = [], - r = []; - let i; - if (this.tt) { - const { id: s, promise: a } = this.et({ - request: t, - logs: n, - handler: e, - }); - (i = s), r.push(a); - } - const a = this.st({ timeoutId: i, request: t, logs: n, handler: e }); - r.push(a); - const o = await e.waitUntil( - (async () => (await e.waitUntil(Promise.race(r))) || (await a))(), - ); - if (!o) throw new s("no-response", { url: t.url }); - return o; - } - et({ request: t, logs: e, handler: s }) { - let n; - return { - promise: new Promise((e) => { - n = setTimeout(async () => { - e(await s.cacheMatch(t)); - }, 1e3 * this.tt); - }), - id: n, - }; - } - async st({ timeoutId: t, request: e, logs: s, handler: n }) { - let r, i; - try { - i = await n.fetchAndCachePut(e); - } catch (t) { - t instanceof Error && (r = t); - } - return ( - t && clearTimeout(t), (!r && i) || (i = await n.cacheMatch(e)), i - ); - } - }), - (t.RangeRequestsPlugin = class { - constructor() { - this.cachedResponseWillBeUsed = async ({ - request: t, - cachedResponse: e, - }) => (e && t.headers.has("range") ? await H(t, e) : e); - } - }), - (t.StaleWhileRevalidate = class extends R { - constructor(t = {}) { - super(t), - this.plugins.some((t) => "cacheWillUpdate" in t) || - this.plugins.unshift(u); - } - async U(t, e) { - const n = e.fetchAndCachePut(t).catch(() => {}); - e.waitUntil(n); - let r, - i = await e.cacheMatch(t); - if (i); - else - try { - i = await n; - } catch (t) { - t instanceof Error && (r = t); - } - if (!i) throw new s("no-response", { url: t.url, error: r }); - return i; - } - }), - (t.cleanupOutdatedCaches = function () { - self.addEventListener("activate", (t) => { - const e = w(); - t.waitUntil( - (async (t, e = "-precache-") => { - const s = (await self.caches.keys()).filter( - (s) => - s.includes(e) && s.includes(self.registration.scope) && s !== t, - ); - return await Promise.all(s.map((t) => self.caches.delete(t))), s; - })(e).then((t) => {}), - ); - }); - }), - (t.clientsClaim = function () { - self.addEventListener("activate", () => self.clients.claim()); - }), - (t.precacheAndRoute = function (t, e) { - !(function (t) { - tt().precache(t); - })(t), - (function (t) { - const e = tt(); - h(new et(e, t)); - })(e); - }), - (t.registerRoute = h); -}); +define(["exports"],(function(t){"use strict";try{self["workbox:core:6.5.4"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:6.5.4"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class r{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class i extends r{constructor(t,e,s){super((({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)}),e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",(t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)}))}addCacheListener(){self.addEventListener("message",(t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map((e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})})));t.waitUntil(s),t.ports&&t.ports[0]&&s.then((()=>t.ports[0].postMessage(!0)))}}))}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=i&&i.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:r})}catch(t){c=Promise.reject(t)}const h=i&&i.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch((async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:r})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n}))),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const r=this.t.get(s.method)||[];for(const i of r){let r;const a=i.match({url:t,sameOrigin:e,request:s,event:n});if(a)return r=a,(Array.isArray(r)&&0===r.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(r=void 0),{route:i,params:r}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);function h(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new r((({url:t})=>t.href===s.href),e,n)}else if(t instanceof RegExp)a=new i(t,e,n);else if("function"==typeof t)a=new r(t,e,n);else{if(!(t instanceof r))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}try{self["workbox:strategies:6.5.4"]&&_()}catch(t){}const u={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null},l={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},f=t=>[l.prefix,t,l.suffix].filter((t=>t&&t.length>0)).join("-"),w=t=>t||f(l.precache),d=t=>t||f(l.runtime);function p(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class y{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}const g=new Set;function m(t){return"string"==typeof t?new Request(t):t}class v{constructor(t,e){this.h={},Object.assign(this,e),this.event=e.event,this.u=t,this.l=new y,this.p=[],this.m=[...t.plugins],this.v=new Map;for(const t of this.m)this.v.set(t,{});this.event.waitUntil(this.l.promise)}async fetch(t){const{event:e}=this;let n=m(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this.u.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:i,response:t});return t}catch(t){throw r&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:r.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=m(t);let s;const{cacheName:n,matchOptions:r}=this.u,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},r),{cacheName:n});s=await caches.match(i,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:n,matchOptions:r,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(t,e){const n=m(t);var r;await(r=0,new Promise((t=>setTimeout(t,r))));const i=await this.getCacheKey(n,"write");if(!e)throw new s("cache-put-with-no-response",{url:(a=i.url,new URL(String(a),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var a;const o=await this.R(e);if(!o)return!1;const{cacheName:c,matchOptions:h}=this.u,u=await self.caches.open(c),l=this.hasCallback("cacheDidUpdate"),f=l?await async function(t,e,s,n){const r=p(e.url,s);if(e.url===r)return t.match(e,n);const i=Object.assign(Object.assign({},n),{ignoreSearch:!0}),a=await t.keys(e,i);for(const e of a)if(r===p(e.url,s))return t.match(e,n)}(u,i.clone(),["__WB_REVISION__"],h):null;try{await u.put(i,l?o.clone():o)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await async function(){for(const t of g)await t()}(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:c,oldResponse:f,newResponse:o.clone(),request:i,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.h[s]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=m(await t({mode:e,request:n,event:this.event,params:this.params}));this.h[s]=n}return this.h[s]}hasCallback(t){for(const e of this.u.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this.u.plugins)if("function"==typeof e[t]){const s=this.v.get(e),n=n=>{const r=Object.assign(Object.assign({},n),{state:s});return e[t](r)};yield n}}waitUntil(t){return this.p.push(t),t}async doneWaiting(){let t;for(;t=this.p.shift();)await t}destroy(){this.l.resolve(null)}async R(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class R{constructor(t={}){this.cacheName=d(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,n="params"in t?t.params:void 0,r=new v(this,{event:e,request:s,params:n}),i=this.q(r,s,e);return[i,this.D(i,r,s,e)]}async q(t,e,n){let r;await t.runCallbacks("handlerWillStart",{event:n,request:e});try{if(r=await this.U(e,t),!r||"error"===r.type)throw new s("no-response",{url:e.url})}catch(s){if(s instanceof Error)for(const i of t.iterateCallbacks("handlerDidError"))if(r=await i({error:s,event:n,request:e}),r)break;if(!r)throw s}for(const s of t.iterateCallbacks("handlerWillRespond"))r=await s({event:n,request:e,response:r});return r}async D(t,e,s,n){let r,i;try{r=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:n,request:s,response:r}),await e.doneWaiting()}catch(t){t instanceof Error&&(i=t)}if(await e.runCallbacks("handlerDidComplete",{event:n,request:s,response:r,error:i}),e.destroy(),i)throw i}}function b(t){t.then((()=>{}))}function q(){return q=Object.assign?Object.assign.bind():function(t){for(var e=1;e(t[e]=s,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function O(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(U||(U=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(B(this),e),k(x.get(this))}:function(...e){return k(t.apply(B(this),e))}:function(e,...s){const n=t.call(B(this),e,...s);return I.set(n,e.sort?e.sort():[e]),k(n)}}function T(t){return"function"==typeof t?O(t):(t instanceof IDBTransaction&&function(t){if(L.has(t))return;const e=new Promise(((e,s)=>{const n=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),n()},i=()=>{s(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));L.set(t,e)}(t),e=t,(D||(D=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,N):t);var e}function k(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,s)=>{const n=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(k(t.result)),n()},i=()=>{s(t.error),n()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&x.set(e,t)})).catch((()=>{})),E.set(e,t),e}(t);if(C.has(t))return C.get(t);const e=T(t);return e!==t&&(C.set(t,e),E.set(e,t)),e}const B=t=>E.get(t);const P=["get","getKey","getAll","getAllKeys","count"],M=["put","add","delete","clear"],W=new Map;function j(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(W.get(e))return W.get(e);const s=e.replace(/FromIndex$/,""),n=e!==s,r=M.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!r&&!P.includes(s))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let a=i.store;return n&&(a=a.index(e.shift())),(await Promise.all([a[s](...e),r&&i.done]))[0]};return W.set(e,i),i}N=(t=>q({},t,{get:(e,s,n)=>j(e,s)||t.get(e,s,n),has:(e,s)=>!!j(e,s)||t.has(e,s)}))(N);try{self["workbox:expiration:6.5.4"]&&_()}catch(t){}const S="cache-entries",K=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class A{constructor(t){this._=null,this.L=t}I(t){const e=t.createObjectStore(S,{keyPath:"id"});e.createIndex("cacheName","cacheName",{unique:!1}),e.createIndex("timestamp","timestamp",{unique:!1})}C(t){this.I(t),this.L&&function(t,{blocked:e}={}){const s=indexedDB.deleteDatabase(t);e&&s.addEventListener("blocked",(t=>e(t.oldVersion,t))),k(s).then((()=>{}))}(this.L)}async setTimestamp(t,e){const s={url:t=K(t),timestamp:e,cacheName:this.L,id:this.N(t)},n=(await this.getDb()).transaction(S,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(t){const e=await this.getDb(),s=await e.get(S,this.N(t));return null==s?void 0:s.timestamp}async expireEntries(t,e){const s=await this.getDb();let n=await s.transaction(S).store.index("timestamp").openCursor(null,"prev");const r=[];let i=0;for(;n;){const s=n.value;s.cacheName===this.L&&(t&&s.timestamp=e?r.push(n.value):i++),n=await n.continue()}const a=[];for(const t of r)await s.delete(S,t.id),a.push(t.url);return a}N(t){return this.L+"|"+K(t)}async getDb(){return this._||(this._=await function(t,e,{blocked:s,upgrade:n,blocking:r,terminated:i}={}){const a=indexedDB.open(t,e),o=k(a);return n&&a.addEventListener("upgradeneeded",(t=>{n(k(a.result),t.oldVersion,t.newVersion,k(a.transaction),t)})),s&&a.addEventListener("blocked",(t=>s(t.oldVersion,t.newVersion,t))),o.then((t=>{i&&t.addEventListener("close",(()=>i())),r&&t.addEventListener("versionchange",(t=>r(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),o}("workbox-expiration",1,{upgrade:this.C.bind(this)})),this._}}class F{constructor(t,e={}){this.O=!1,this.T=!1,this.k=e.maxEntries,this.B=e.maxAgeSeconds,this.P=e.matchOptions,this.L=t,this.M=new A(t)}async expireEntries(){if(this.O)return void(this.T=!0);this.O=!0;const t=this.B?Date.now()-1e3*this.B:0,e=await this.M.expireEntries(t,this.k),s=await self.caches.open(this.L);for(const t of e)await s.delete(t,this.P);this.O=!1,this.T&&(this.T=!1,b(this.expireEntries()))}async updateTimestamp(t){await this.M.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.B){const e=await this.M.getTimestamp(t),s=Date.now()-1e3*this.B;return void 0===e||er||e&&e<0)throw new s("range-not-satisfiable",{size:r,end:n,start:e});let i,a;return void 0!==e&&void 0!==n?(i=e,a=n+1):void 0!==e&&void 0===n?(i=e,a=r):void 0!==n&&void 0===e&&(i=r-n,a=r),{start:i,end:a}}(i,r.start,r.end),o=i.slice(a.start,a.end),c=o.size,h=new Response(o,{status:206,statusText:"Partial Content",headers:e.headers});return h.headers.set("Content-Length",String(c)),h.headers.set("Content-Range",`bytes ${a.start}-${a.end-1}/${i.size}`),h}catch(t){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}function $(t,e){const s=e();return t.waitUntil(s),s}try{self["workbox:precaching:6.5.4"]&&_()}catch(t){}function z(t){if(!t)throw new s("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location.href);return{cacheKey:e.href,url:e.href}}const{revision:e,url:n}=t;if(!n)throw new s("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location.href);return{cacheKey:t.href,url:t.href}}const r=new URL(n,location.href),i=new URL(n,location.href);return r.searchParams.set("__WB_REVISION__",e),{cacheKey:r.href,url:i.href}}class G{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:t,state:e})=>{e&&(e.originalRequest=t)},this.cachedResponseWillBeUsed=async({event:t,state:e,cachedResponse:s})=>{if("install"===t.type&&e&&e.originalRequest&&e.originalRequest instanceof Request){const t=e.originalRequest.url;s?this.notUpdatedURLs.push(t):this.updatedURLs.push(t)}return s}}}class V{constructor({precacheController:t}){this.cacheKeyWillBeUsed=async({request:t,params:e})=>{const s=(null==e?void 0:e.cacheKey)||this.W.getCacheKeyForURL(t.url);return s?new Request(s,{headers:t.headers}):t},this.W=t}}let J,Q;async function X(t,e){let n=null;if(t.url){n=new URL(t.url).origin}if(n!==self.location.origin)throw new s("cross-origin-copy-response",{origin:n});const r=t.clone(),i={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},a=e?e(i):i,o=function(){if(void 0===J){const t=new Response("");if("body"in t)try{new Response(t.body),J=!0}catch(t){J=!1}J=!1}return J}()?r.body:await r.blob();return new Response(o,a)}class Y extends R{constructor(t={}){t.cacheName=w(t.cacheName),super(t),this.j=!1!==t.fallbackToNetwork,this.plugins.push(Y.copyRedirectedCacheableResponsesPlugin)}async U(t,e){const s=await e.cacheMatch(t);return s||(e.event&&"install"===e.event.type?await this.S(t,e):await this.K(t,e))}async K(t,e){let n;const r=e.params||{};if(!this.j)throw new s("missing-precache-entry",{cacheName:this.cacheName,url:t.url});{const s=r.integrity,i=t.integrity,a=!i||i===s;n=await e.fetch(new Request(t,{integrity:"no-cors"!==t.mode?i||s:void 0})),s&&a&&"no-cors"!==t.mode&&(this.A(),await e.cachePut(t,n.clone()))}return n}async S(t,e){this.A();const n=await e.fetch(t);if(!await e.cachePut(t,n.clone()))throw new s("bad-precaching-response",{url:t.url,status:n.status});return n}A(){let t=null,e=0;for(const[s,n]of this.plugins.entries())n!==Y.copyRedirectedCacheableResponsesPlugin&&(n===Y.defaultPrecacheCacheabilityPlugin&&(t=s),n.cacheWillUpdate&&e++);0===e?this.plugins.push(Y.defaultPrecacheCacheabilityPlugin):e>1&&null!==t&&this.plugins.splice(t,1)}}Y.defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:t})=>!t||t.status>=400?null:t},Y.copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:t})=>t.redirected?await X(t):t};class Z{constructor({cacheName:t,plugins:e=[],fallbackToNetwork:s=!0}={}){this.F=new Map,this.H=new Map,this.$=new Map,this.u=new Y({cacheName:w(t),plugins:[...e,new V({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this.u}precache(t){this.addToCacheList(t),this.G||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this.G=!0)}addToCacheList(t){const e=[];for(const n of t){"string"==typeof n?e.push(n):n&&void 0===n.revision&&e.push(n.url);const{cacheKey:t,url:r}=z(n),i="string"!=typeof n&&n.revision?"reload":"default";if(this.F.has(r)&&this.F.get(r)!==t)throw new s("add-to-cache-list-conflicting-entries",{firstEntry:this.F.get(r),secondEntry:t});if("string"!=typeof n&&n.integrity){if(this.$.has(t)&&this.$.get(t)!==n.integrity)throw new s("add-to-cache-list-conflicting-integrities",{url:r});this.$.set(t,n.integrity)}if(this.F.set(r,t),this.H.set(r,i),e.length>0){const t=`Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(t)}}}install(t){return $(t,(async()=>{const e=new G;this.strategy.plugins.push(e);for(const[e,s]of this.F){const n=this.$.get(s),r=this.H.get(e),i=new Request(e,{integrity:n,cache:r,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:s},request:i,event:t}))}const{updatedURLs:s,notUpdatedURLs:n}=e;return{updatedURLs:s,notUpdatedURLs:n}}))}activate(t){return $(t,(async()=>{const t=await self.caches.open(this.strategy.cacheName),e=await t.keys(),s=new Set(this.F.values()),n=[];for(const r of e)s.has(r.url)||(await t.delete(r),n.push(r.url));return{deletedURLs:n}}))}getURLsToCacheKeys(){return this.F}getCachedURLs(){return[...this.F.keys()]}getCacheKeyForURL(t){const e=new URL(t,location.href);return this.F.get(e.href)}getIntegrityForCacheKey(t){return this.$.get(t)}async matchPrecache(t){const e=t instanceof Request?t.url:t,s=this.getCacheKeyForURL(e);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(t){const e=this.getCacheKeyForURL(t);if(!e)throw new s("non-precached-url",{url:t});return s=>(s.request=new Request(t),s.params=Object.assign({cacheKey:e},s.params),this.strategy.handle(s))}}const tt=()=>(Q||(Q=new Z),Q);class et extends r{constructor(t,e){super((({request:s})=>{const n=t.getURLsToCacheKeys();for(const r of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:r}={}){const i=new URL(t,location.href);i.hash="",yield i.href;const a=function(t,e=[]){for(const s of[...t.searchParams.keys()])e.some((t=>t.test(s)))&&t.searchParams.delete(s);return t}(i,e);if(yield a.href,s&&a.pathname.endsWith("/")){const t=new URL(a.href);t.pathname+=s,yield t.href}if(n){const t=new URL(a.href);t.pathname+=".html",yield t.href}if(r){const t=r({url:i});for(const e of t)yield e.href}}(s.url,e)){const e=n.get(r);if(e){return{cacheKey:e,integrity:t.getIntegrityForCacheKey(e)}}}}),t.strategy)}}t.CacheFirst=class extends R{async U(t,e){let n,r=await e.cacheMatch(t);if(!r)try{r=await e.fetchAndCachePut(t)}catch(t){t instanceof Error&&(n=t)}if(!r)throw new s("no-response",{url:t.url,error:n});return r}},t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:s,cachedResponse:n})=>{if(!n)return null;const r=this.V(n),i=this.J(s);b(i.expireEntries());const a=i.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(t){}return r?n:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const s=this.J(t);await s.updateTimestamp(e.url),await s.expireEntries()},this.X=t,this.B=t.maxAgeSeconds,this.Y=new Map,t.purgeOnQuotaError&&function(t){g.add(t)}((()=>this.deleteCacheAndMetadata()))}J(t){if(t===d())throw new s("expire-custom-caches-only");let e=this.Y.get(t);return e||(e=new F(t,this.X),this.Y.set(t,e)),e}V(t){if(!this.B)return!0;const e=this.Z(t);if(null===e)return!0;return e>=Date.now()-1e3*this.B}Z(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),s=new Date(e).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[t,e]of this.Y)await self.caches.delete(t),await e.delete();this.Y=new Map}},t.NetworkFirst=class extends R{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u),this.tt=t.networkTimeoutSeconds||0}async U(t,e){const n=[],r=[];let i;if(this.tt){const{id:s,promise:a}=this.et({request:t,logs:n,handler:e});i=s,r.push(a)}const a=this.st({timeoutId:i,request:t,logs:n,handler:e});r.push(a);const o=await e.waitUntil((async()=>await e.waitUntil(Promise.race(r))||await a)());if(!o)throw new s("no-response",{url:t.url});return o}et({request:t,logs:e,handler:s}){let n;return{promise:new Promise((e=>{n=setTimeout((async()=>{e(await s.cacheMatch(t))}),1e3*this.tt)})),id:n}}async st({timeoutId:t,request:e,logs:s,handler:n}){let r,i;try{i=await n.fetchAndCachePut(e)}catch(t){t instanceof Error&&(r=t)}return t&&clearTimeout(t),!r&&i||(i=await n.cacheMatch(e)),i}},t.RangeRequestsPlugin=class{constructor(){this.cachedResponseWillBeUsed=async({request:t,cachedResponse:e})=>e&&t.headers.has("range")?await H(t,e):e}},t.StaleWhileRevalidate=class extends R{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u)}async U(t,e){const n=e.fetchAndCachePut(t).catch((()=>{}));e.waitUntil(n);let r,i=await e.cacheMatch(t);if(i);else try{i=await n}catch(t){t instanceof Error&&(r=t)}if(!i)throw new s("no-response",{url:t.url,error:r});return i}},t.cleanupOutdatedCaches=function(){self.addEventListener("activate",(t=>{const e=w();t.waitUntil((async(t,e="-precache-")=>{const s=(await self.caches.keys()).filter((s=>s.includes(e)&&s.includes(self.registration.scope)&&s!==t));return await Promise.all(s.map((t=>self.caches.delete(t)))),s})(e).then((t=>{})))}))},t.clientsClaim=function(){self.addEventListener("activate",(()=>self.clients.claim()))},t.precacheAndRoute=function(t,e){!function(t){tt().precache(t)}(t),function(t){const e=tt();h(new et(e,t))}(e)},t.registerRoute=h})); diff --git a/packages/nextjs/services/web3/provider.ts b/packages/nextjs/services/web3/provider.ts index 909a43e..318cb28 100644 --- a/packages/nextjs/services/web3/provider.ts +++ b/packages/nextjs/services/web3/provider.ts @@ -16,6 +16,13 @@ const containsDevnet = (networks: readonly chains.Chain[]) => { const currentNetwork = scaffoldConfig.targetNetworks[0]; const currentNetworkName = currentNetwork.network; +console.log("🔍 Provider Debug:", { + currentNetworkName, + currentNetworkId: currentNetwork.id, + availableRpcUrls: Object.keys(scaffoldConfig.rpcProviderUrl), + rpcUrlConfig: scaffoldConfig.rpcProviderUrl, +}); + // Get RPC URL for the current network const rpcUrl = scaffoldConfig.rpcProviderUrl[currentNetworkName] || ""; @@ -26,6 +33,7 @@ if (rpcUrl === "") { console.warn( `No RPC Provider URL configured for ${currentNetworkName}. Using public provider.`, ); + console.warn("Available keys:", Object.keys(scaffoldConfig.rpcProviderUrl)); } const provider = From d953c92f3121f639d628144a59eea3b96ec9428f Mon Sep 17 00:00:00 2001 From: David Melendez Date: Sun, 12 Oct 2025 21:17:13 -0600 Subject: [PATCH 3/6] Update RandomnessComponent with new contract address, enhance user interface for randomness generation, and remove unused code for improved clarity and performance. --- .../contract/RandomnessComponent.tsx | 502 ++---------------- .../nextjs/contracts/deployedContracts.ts | 479 +---------------- packages/nextjs/public/sw.js | 2 +- packages/nextjs/services/web3/provider.ts | 8 - 4 files changed, 32 insertions(+), 959 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx index f838f88..0b61430 100644 --- a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx +++ b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx @@ -19,7 +19,7 @@ const VRF_PROVIDER_ADDRESS = // Dirección esperada del contrato de Randomness desplegado en testnet // Esta dirección se actualiza con cada nuevo deployment para pruebas const EXPECTED_RANDOMNESS_CONTRACT_ADDRESS = - "0x3d8a08f250a2101978023f3f86b002bf94fda19ba6e7b213e79ae058c031627"; + "0x2e91ef979c67ef901846fed17a9d72c9c745536266d01962339076bd7717714"; interface RandomnessComponentProps { contractName: ContractName; @@ -27,9 +27,6 @@ interface RandomnessComponentProps { onSuccess?: (txHash: string, generationId: string) => void; } -interface VRFCoordinatorConfigProps { - contractAddress: AddressType; -} export const RandomnessComponent = ({ contractName, @@ -40,8 +37,6 @@ export const RandomnessComponent = ({ const [isLoading, setIsLoading] = useState(false); const [txHash, setTxHash] = useState(""); const [generationId, setGenerationId] = useState(""); - const [useAlternativeMode, setUseAlternativeMode] = useState(false); - const [forceDevMode, setForceDevMode] = useState(false); const { status: walletStatus, isConnected, account, chainId } = useAccount(); const { chain } = useNetwork(); @@ -315,110 +310,33 @@ export const RandomnessComponent = ({

- 🏆 Multicall VRF - Request Randomness with Cartridge + 🎲 Generate Random Numbers (Development Mode)

- {isDevnet ? ( - <> - This function generates 5 unique random numbers in the range - [1,40] using local generation for development. - - ) : ( - <> - This function executes a multicall that first requests randomness - from the Cartridge VRF provider, then consumes that randomness to - generate 5 unique numbers in the range [1,40]. - - )} + Genera 5 números aleatorios únicos en el rango [1,40] usando la función de desarrollo devnet_generate.

+ +
+

+ ℹ️ Nota: El modo de producción con VRF está temporalmente deshabilitado. Por ahora, se usa generación local para pruebas. +

+
{/* Contract information */}
-

Consumer Contract:

+

Contrato Randomness:

-
-

- Expected address:{" "} - {EXPECTED_RANDOMNESS_CONTRACT_ADDRESS} -

-

- Current address: {contractAddress} -

+

- Network: {chain?.name || "Unknown"} →{" "} - {targetNetwork.name} + Red: {targetNetwork.name}

- Mode:{" "} - {isDevnet - ? "Development (devnet)" - : "Production (testnet/sepolia)"} + Función: devnet_generate(seed)

- {/* Technical information */} -
-

- 📋 Mode:{" "} - {isDevnet - ? forceDevMode - ? "Forced Development (devnet_generate)" - : "Development (Local)" - : useAlternativeMode - ? "Production (Safe Multicall)" - : "Production (Standard Multicall)"} -

-
- {isDevnet ? ( - <> -

- Method: devnet_generate (local generation) -

-

- Contract: {contractAddress} -

-

- Status:{" "} - {forceDevMode ? "Forced for testing" : "Automatic"} -

- - ) : ( - <> -

- Method: Multicall VRF ( - {useAlternativeMode ? "Safe Mode" : "Standard"}) -

-

- Transaction 1: request_random → VRF Provider -

-

- Transaction 2: request_randomness_prod → - Contract -

-

- VRF Provider: {VRF_PROVIDER_ADDRESS} -

-

- Callback Fee Limit:{" "} - {useAlternativeMode ? "50,000" : callbackFeeLimit} wei -

-

- Publish Delay: {publishDelay} (no delay) -

-

- Source (Seed): Used as source for VRF -

- - )} -
-
- {/* Input form */}
@@ -486,187 +404,7 @@ export const RandomnessComponent = ({
)} - {/* Specific account/wallet problem diagnosis */} - {account?.address && - account.address.startsWith( - "0x0297fd6c19289a017d50b1b65a07ea4db27596a8fade85c6b9622a3f9a24d2a9", - ) && ( -
-

- 🚨 Problematic Account Detected -

-
-

- - An account that causes transaction errors has been - detected. - -

-
-

- Problematic address: -

-

{account.address}

-
- -
-

🔧 Options to fix:

- -
- - - - - - - -
- -
- - More advanced options - -
-

• Use a different account in your wallet

-

• Verify that you have enough ETH for fees

-

• Make sure the account is active

-

• Contact support if the problem persists

-
-
-
-
-
- )} - {/* Information about Safe Mode when active */} - {useAlternativeMode && ( -
-

- ✅ Safe Mode Active -

-
-

• Using more conservative parameters (fee limit: 50,000)

-

• Higher probability of success with problematic accounts

-

• You can generate numbers using the main button

- -
-
- )} - - {/* Information about Forced Development Mode when active */} - {forceDevMode && ( -
-

- ⚠️ Forced Development Mode -

-
-

- • Using development function (devnet_generate) even on testnet -

-

• Local generation without depending on external oracles

-

• Useful for testing when there are VRF problems

- -
-
- )} - - {/* Account status (advanced debugging) */} - {isConnected && !writeDisabled && !account?.address && ( -
-

- 🔍 Account status (debugging): -

-
-

- Wallet connected:{" "} - {isConnected ? "Yes" : "No"} -

-

- Account address:{" "} - {account?.address || "Not available"} -

-

- Wallet status: {walletStatus} -

-

- Current network: {chain?.name || "Unknown"} -

-

- Target network: {targetNetwork.name} -

-
-

- 💡 If you see this, try reconnecting your wallet or refreshing - the page. -

-
- )} {/* Transaction result */} {txHash && ( @@ -690,210 +428,30 @@ export const RandomnessComponent = ({ {isLoading && ( )} - {isDevnet - ? "🎲 Generate 5 Numbers (Development)" - : useAlternativeMode - ? "🔒 Multicall VRF (Safe Mode)" - : "🔮 Multicall VRF (Standard)"} + 🎲 Generar 5 Números Aleatorios
- {/* VRF Coordinator Configuration (production only) */} - {!isDevnet && ( - - )} - {/* Additional information */}
-

💡 How it works:

- {isDevnet ? ( -
    -
  1. - 1. Directly calls devnet_generate(seed) -
  2. -
  3. - 2. The contract generates 5 unique numbers using a local LCG - algorithm -
  4. -
  5. - 3. Numbers are generated immediately without depending on - external oracles -
  6. -
  7. - 4. Numbers are stored and can be queried with{" "} - get_generation_numbers(id) -
  8. -
- ) : ( -
    -
  1. - 1. Step 1: Executes multicall with 2 - transactions -
  2. -
  3. - 2. Transaction 1:{" "} - request_random(caller, source) → VRF Provider -
  4. -
  5. - 3. Transaction 2:{" "} - request_randomness_prod(seed, fee, delay) → - Contract -
  6. -
  7. - 4. The contract requests and consumes randomness using Cartridge - VRF protocol -
  8. -
  9. - 5. Numbers are generated using verifiable decentralized - randomness -
  10. -
  11. - 6. Numbers are stored and can be queried with{" "} - get_generation_numbers(id) -
  12. -
- )} +

💡 Cómo funciona:

+
    +
  1. + 1. Llama directamente a devnet_generate(seed) +
  2. +
  3. + 2. El contrato genera 5 números únicos usando un algoritmo LCG local +
  4. +
  5. + 3. Los números se generan inmediatamente sin depender de oráculos externos +
  6. +
  7. + 4. Los números se almacenan y pueden consultarse con{" "} + get_generation_numbers(id) +
  8. +
); }; - -// Component to configure VRF Coordinator -const VRFCoordinatorConfig = ({ - contractAddress, -}: VRFCoordinatorConfigProps) => { - const [newCoordinatorAddress, setNewCoordinatorAddress] = - useState(VRF_PROVIDER_ADDRESS); - const [isLoading, setIsLoading] = useState(false); - const [isExpanded, setIsExpanded] = useState(false); - - const { writeTransaction } = useTransactor(); - - const handleUpdateCoordinator = async () => { - if ( - !newCoordinatorAddress || - !newCoordinatorAddress.startsWith("0x") || - newCoordinatorAddress.length !== 66 - ) { - notification.error("Invalid VRF coordinator address"); - return; - } - - setIsLoading(true); - - try { - const txHash = await writeTransaction([ - { - contractAddress: contractAddress as string, - entrypoint: "set_vrf_coordinator", - calldata: [newCoordinatorAddress], - }, - ]); - - if (txHash) { - notification.success( - `VRF coordinator updated successfully! Hash: ${txHash}`, - ); - setIsExpanded(false); - } - } catch (error: any) { - notification.error( - "Error updating VRF coordinator: " + (error.message || "Unknown error"), - ); - } finally { - setIsLoading(false); - } - }; - - return ( -
-
-

⚙️ VRF Configuration

- -
- - {isExpanded && ( -
-

- The contract must be configured with the correct VRF coordinator - address from Cartridge. -

- -
-
- - setNewCoordinatorAddress(e.target.value)} - placeholder="0x..." - className="input input-bordered w-full bg-base-100 text-white text-sm" - disabled={isLoading} - /> -
- -
-

- Current configured address:{" "} - {VRF_PROVIDER_ADDRESS} -

-

- Address in form: {newCoordinatorAddress} -

-

- - Note: Only the contract owner can change this configuration. - -

-
- - -
- -
- - Technical information - -
-

- • This function calls set_vrf_coordinator() on the - contract -

-

• Only the contract owner can execute this function

-

- • The contract will use this address to validate VRF callbacks -

-

- • Make sure to use the correct VRF provider address from - Cartridge -

-
-
-
- )} -
- ); -}; diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index c1dd96b..f5e87cd 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -4,487 +4,10 @@ */ const deployedContracts = { - devnet: { - Randomness: { - address: - "0x552f59e251be892c95ff526a3626b52b35c9bb7a3b121873f0179382fa3d5d3", - abi: [ - { - type: "impl", - name: "RandomnessImpl", - interface_name: - "starklotto_adapter_vrf::Randomness::IRandomnessLottery", - }, - { - type: "interface", - name: "starklotto_adapter_vrf::Randomness::IRandomnessLottery", - items: [ - { - type: "function", - name: "request_randomness_prod", - inputs: [ - { - name: "seed", - type: "core::integer::u64", - }, - { - name: "callback_fee_limit", - type: "core::integer::u128", - }, - { - name: "publish_delay", - type: "core::integer::u64", - }, - ], - outputs: [ - { - type: "core::integer::u64", - }, - ], - state_mutability: "external", - }, - { - type: "function", - name: "devnet_generate", - inputs: [ - { - name: "seed", - type: "core::integer::u64", - }, - ], - outputs: [ - { - type: "core::integer::u64", - }, - ], - state_mutability: "external", - }, - { - type: "function", - name: "get_generation_numbers", - inputs: [ - { - name: "id", - type: "core::integer::u64", - }, - ], - outputs: [ - { - type: "core::array::Array::", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_generation_status", - inputs: [ - { - name: "id", - type: "core::integer::u64", - }, - ], - outputs: [ - { - type: "core::integer::u8", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_generation_timestamps", - inputs: [ - { - name: "id", - type: "core::integer::u64", - }, - ], - outputs: [ - { - type: "(core::integer::u64, core::integer::u64)", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "get_latest_id", - inputs: [], - outputs: [ - { - type: "core::integer::u64", - }, - ], - state_mutability: "view", - }, - ], - }, - { - type: "impl", - name: "OwnableImpl", - interface_name: "openzeppelin_access::ownable::interface::IOwnable", - }, - { - type: "interface", - name: "openzeppelin_access::ownable::interface::IOwnable", - items: [ - { - type: "function", - name: "owner", - inputs: [], - outputs: [ - { - type: "core::starknet::contract_address::ContractAddress", - }, - ], - state_mutability: "view", - }, - { - type: "function", - name: "transfer_ownership", - inputs: [ - { - name: "new_owner", - type: "core::starknet::contract_address::ContractAddress", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "renounce_ownership", - inputs: [], - outputs: [], - state_mutability: "external", - }, - ], - }, - { - type: "enum", - name: "core::bool", - variants: [ - { - name: "False", - type: "()", - }, - { - name: "True", - type: "()", - }, - ], - }, - { - type: "constructor", - name: "constructor", - inputs: [ - { - name: "owner", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "vrf_coordinator", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "dev_mode", - type: "core::bool", - }, - ], - }, - { - type: "struct", - name: "core::array::Span::", - members: [ - { - name: "snapshot", - type: "@core::array::Array::", - }, - ], - }, - { - type: "function", - name: "receive_random_words", - inputs: [ - { - name: "requester_address", - type: "core::starknet::contract_address::ContractAddress", - }, - { - name: "request_id", - type: "core::integer::u64", - }, - { - name: "random_words", - type: "core::array::Span::", - }, - { - name: "_calldata", - type: "core::array::Array::", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "mark_generation_failed", - inputs: [ - { - name: "id", - type: "core::integer::u64", - }, - { - name: "code", - type: "core::felt252", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "function", - name: "set_vrf_coordinator", - inputs: [ - { - name: "addr", - type: "core::starknet::contract_address::ContractAddress", - }, - ], - outputs: [], - state_mutability: "external", - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", - kind: "struct", - members: [ - { - name: "previous_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - { - name: "new_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - ], - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", - kind: "struct", - members: [ - { - name: "previous_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - { - name: "new_owner", - type: "core::starknet::contract_address::ContractAddress", - kind: "key", - }, - ], - }, - { - type: "event", - name: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", - kind: "enum", - variants: [ - { - name: "OwnershipTransferred", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferred", - kind: "nested", - }, - { - name: "OwnershipTransferStarted", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::OwnershipTransferStarted", - kind: "nested", - }, - ], - }, - { - type: "event", - name: "starklotto_adapter_vrf::Randomness::Randomness::GenerationRequested", - kind: "struct", - members: [ - { - name: "id", - type: "core::integer::u64", - kind: "key", - }, - { - name: "requester", - type: "core::starknet::contract_address::ContractAddress", - kind: "data", - }, - { - name: "timestamp", - type: "core::integer::u64", - kind: "data", - }, - { - name: "is_test", - type: "core::bool", - kind: "data", - }, - ], - }, - { - type: "event", - name: "starklotto_adapter_vrf::Randomness::Randomness::GenerationCompleted", - kind: "struct", - members: [ - { - name: "id", - type: "core::integer::u64", - kind: "key", - }, - { - name: "n1", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n2", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n3", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n4", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n5", - type: "core::integer::u8", - kind: "data", - }, - { - name: "timestamp", - type: "core::integer::u64", - kind: "data", - }, - { - name: "is_test", - type: "core::bool", - kind: "data", - }, - ], - }, - { - type: "event", - name: "starklotto_adapter_vrf::Randomness::Randomness::GenerationFailed", - kind: "struct", - members: [ - { - name: "id", - type: "core::integer::u64", - kind: "key", - }, - { - name: "code", - type: "core::felt252", - kind: "data", - }, - { - name: "timestamp", - type: "core::integer::u64", - kind: "data", - }, - ], - }, - { - type: "event", - name: "starklotto_adapter_vrf::Randomness::Randomness::TestGeneration", - kind: "struct", - members: [ - { - name: "id", - type: "core::integer::u64", - kind: "key", - }, - { - name: "n1", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n2", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n3", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n4", - type: "core::integer::u8", - kind: "data", - }, - { - name: "n5", - type: "core::integer::u8", - kind: "data", - }, - { - name: "timestamp", - type: "core::integer::u64", - kind: "data", - }, - ], - }, - { - type: "event", - name: "starklotto_adapter_vrf::Randomness::Randomness::Event", - kind: "enum", - variants: [ - { - name: "OwnableEvent", - type: "openzeppelin_access::ownable::ownable::OwnableComponent::Event", - kind: "flat", - }, - { - name: "GenerationRequested", - type: "starklotto_adapter_vrf::Randomness::Randomness::GenerationRequested", - kind: "nested", - }, - { - name: "GenerationCompleted", - type: "starklotto_adapter_vrf::Randomness::Randomness::GenerationCompleted", - kind: "nested", - }, - { - name: "GenerationFailed", - type: "starklotto_adapter_vrf::Randomness::Randomness::GenerationFailed", - kind: "nested", - }, - { - name: "TestGeneration", - type: "starklotto_adapter_vrf::Randomness::Randomness::TestGeneration", - kind: "nested", - }, - ], - }, - ], - classHash: - "0x1a5be748810b5e77913c3ec2d68967a24cb0390bc0bdb4fda03742ab7cf8b77", - }, - }, sepolia: { Randomness: { address: - "0x3d8a08f250a2101978023f3f86b002bf94fda19ba6e7b213e79ae058c031627", + "0x2e91ef979c67ef901846fed17a9d72c9c745536266d01962339076bd7717714", abi: [ { type: "impl", diff --git a/packages/nextjs/public/sw.js b/packages/nextjs/public/sw.js index cc7af33..87c1f3c 100644 --- a/packages/nextjs/public/sw.js +++ b/packages/nextjs/public/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const n=(n,a)=>(n=new URL(n+".js",a).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(a,i)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let c={};const o=e=>n(e,t),r={module:{uri:t},exports:c,require:o};s[t]=Promise.all(a.map((e=>r[e]||o(e)))).then((e=>(i(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"24cba94d9309176532e78cb1d62f704b"},{url:"/_next/static/D1doUzJOrfW3xxpsnpoPs/_buildManifest.js",revision:"51da8d50ab8ae1c1afafe38c7e424e4e"},{url:"/_next/static/D1doUzJOrfW3xxpsnpoPs/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/141-d196c46095c0e291.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/145-06c74ecb1424b1e8.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/2f0b94e8-734829800d3eb38b.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/473f56c0-0933f1e2ac7ad0b5.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/4bd1b696-48a906261550a4c5.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/658-e54429557207cf0c.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/668-61b1540c76186c47.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/684-3cf479aafee24c45.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/70646a03-d8bbffbaf77fafd0.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/850-839837f3488a9814.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/929-7d9534372e77efc8.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/94-3076be7aeedb9512.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/972.0f900fee228de7ed.js",revision:"0f900fee228de7ed"},{url:"/_next/static/chunks/app/_not-found/page-04d3b5ab1d5bc6de.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/api/price/route-6c0ab67fce666a7b.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/configure/page-2501fcf559af4c9f.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/debug/page-834fa7470eeeb7b6.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/debug/randomness/page-b7fd465125e2745d.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/layout-ae9670c6ab3ddb7b.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/app/page-9f25e9a14f8c04f9.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/e6909d18-d7c7e73117910c02.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/framework-859199dea06580b0.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/main-a106802aa546c841.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/main-app-58ca74d35777be74.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/pages/_app-da15c11dea942c36.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/pages/_error-cc3f077a18ea1793.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-8a51ae7d91979afc.js",revision:"D1doUzJOrfW3xxpsnpoPs"},{url:"/_next/static/css/7fbd5887a52e6553.css",revision:"7fbd5887a52e6553"},{url:"/blast-icon-color.svg",revision:"d949ffbc94b7c50e2e4fcf2b1daf1607"},{url:"/debug-icon.svg",revision:"62ce54a2ddb8d11cb25c891c9adbdbea"},{url:"/debug-image.png",revision:"34c4ca2676dd59ff24d6338faa1af371"},{url:"/explorer-icon.svg",revision:"f6413b9b86d870f77edeb18891f6b3d5"},{url:"/gradient-s.svg",revision:"1966c9867618efad27716a8591d9ade0"},{url:"/logo.ico",revision:"0359e607e29a3d3b08095d84a9d25c39"},{url:"/logo.svg",revision:"a497d49f3c5cf63fe06eda59345d5ec1"},{url:"/manifest.json",revision:"004abf8d9f1b515402e5ee94bf8f3567"},{url:"/rpc-version.png",revision:"cf97fd668cfa1221bec0210824978027"},{url:"/scaffold-config.png",revision:"1ebfc244c31732dc4273fe292bd07596"},{url:"/sn-symbol-gradient.png",revision:"908b60a4f6b92155b8ea38a009fa7081"},{url:"/starkcompass-icon.svg",revision:"f8853deea695e7491b012b31a0e6ed82"},{url:"/voyager-icon.svg",revision:"06663dd5ba2c49423225a8e3893b45fe"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:n,state:a})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const s=e.pathname;return!s.startsWith("/api/auth/")&&!!s.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); +if(!self.define){let e,n={};const s=(s,a)=>(s=new URL(s+".js",a).href,n[s]||new Promise((n=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=n,document.head.appendChild(e)}else e=s,importScripts(s),n()})).then((()=>{let e=n[s];if(!e)throw new Error(`Module ${s} didn’t register its module`);return e})));self.define=(a,i)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(n[t])return;let c={};const r=e=>s(e,t),o={module:{uri:t},exports:c,require:r};n[t]=Promise.all(a.map((e=>o[e]||r(e)))).then((e=>(i(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"7045f79c0757532d4b5f7cd4855d5649"},{url:"/_next/static/a7-nNL44ILHpMXjO8yznh/_buildManifest.js",revision:"51da8d50ab8ae1c1afafe38c7e424e4e"},{url:"/_next/static/a7-nNL44ILHpMXjO8yznh/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/141-d196c46095c0e291.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/145-06c74ecb1424b1e8.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/2f0b94e8-734829800d3eb38b.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/473f56c0-0933f1e2ac7ad0b5.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/4bd1b696-48a906261550a4c5.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/658-e54429557207cf0c.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/668-61b1540c76186c47.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/684-3cf479aafee24c45.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/70646a03-d8bbffbaf77fafd0.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/850-9f08a3c50b278e3d.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/929-7d9534372e77efc8.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/94-3076be7aeedb9512.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/972.0f900fee228de7ed.js",revision:"0f900fee228de7ed"},{url:"/_next/static/chunks/app/_not-found/page-04d3b5ab1d5bc6de.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/api/price/route-6c0ab67fce666a7b.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/configure/page-2501fcf559af4c9f.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/debug/page-6bf2130703b290b9.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/debug/randomness/page-b7fd465125e2745d.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/layout-3f1d79a9df2a4a83.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/page-9f25e9a14f8c04f9.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/e6909d18-d7c7e73117910c02.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/framework-859199dea06580b0.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/main-a106802aa546c841.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/main-app-58ca74d35777be74.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/pages/_app-da15c11dea942c36.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/pages/_error-cc3f077a18ea1793.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-8a51ae7d91979afc.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/css/9edad75ea06915e9.css",revision:"9edad75ea06915e9"},{url:"/blast-icon-color.svg",revision:"d949ffbc94b7c50e2e4fcf2b1daf1607"},{url:"/debug-icon.svg",revision:"62ce54a2ddb8d11cb25c891c9adbdbea"},{url:"/debug-image.png",revision:"34c4ca2676dd59ff24d6338faa1af371"},{url:"/explorer-icon.svg",revision:"f6413b9b86d870f77edeb18891f6b3d5"},{url:"/gradient-s.svg",revision:"1966c9867618efad27716a8591d9ade0"},{url:"/logo.ico",revision:"0359e607e29a3d3b08095d84a9d25c39"},{url:"/logo.svg",revision:"a497d49f3c5cf63fe06eda59345d5ec1"},{url:"/manifest.json",revision:"004abf8d9f1b515402e5ee94bf8f3567"},{url:"/rpc-version.png",revision:"cf97fd668cfa1221bec0210824978027"},{url:"/scaffold-config.png",revision:"1ebfc244c31732dc4273fe292bd07596"},{url:"/sn-symbol-gradient.png",revision:"908b60a4f6b92155b8ea38a009fa7081"},{url:"/starkcompass-icon.svg",revision:"f8853deea695e7491b012b31a0e6ed82"},{url:"/voyager-icon.svg",revision:"06663dd5ba2c49423225a8e3893b45fe"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:n,event:s,state:a})=>n&&"opaqueredirect"===n.type?new Response(n.body,{status:200,statusText:"OK",headers:n.headers}):n}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const n=e.pathname;return!n.startsWith("/api/auth/")&&!!n.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); diff --git a/packages/nextjs/services/web3/provider.ts b/packages/nextjs/services/web3/provider.ts index 318cb28..909a43e 100644 --- a/packages/nextjs/services/web3/provider.ts +++ b/packages/nextjs/services/web3/provider.ts @@ -16,13 +16,6 @@ const containsDevnet = (networks: readonly chains.Chain[]) => { const currentNetwork = scaffoldConfig.targetNetworks[0]; const currentNetworkName = currentNetwork.network; -console.log("🔍 Provider Debug:", { - currentNetworkName, - currentNetworkId: currentNetwork.id, - availableRpcUrls: Object.keys(scaffoldConfig.rpcProviderUrl), - rpcUrlConfig: scaffoldConfig.rpcProviderUrl, -}); - // Get RPC URL for the current network const rpcUrl = scaffoldConfig.rpcProviderUrl[currentNetworkName] || ""; @@ -33,7 +26,6 @@ if (rpcUrl === "") { console.warn( `No RPC Provider URL configured for ${currentNetworkName}. Using public provider.`, ); - console.warn("Available keys:", Object.keys(scaffoldConfig.rpcProviderUrl)); } const provider = From 5c86ef6f3390ec7868cf53b86dda2d009d0fb3d7 Mon Sep 17 00:00:00 2001 From: David Melendez Date: Sun, 12 Oct 2025 21:30:29 -0600 Subject: [PATCH 4/6] Remove specific account verification from RandomnessComponent to streamline error handling and improve code clarity. --- .../_components/contract/RandomnessComponent.tsx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx index 0b61430..b20bbc4 100644 --- a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx +++ b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx @@ -89,17 +89,6 @@ export const RandomnessComponent = ({ return; } - // 🚨 SPECIFIC VERIFICATION: Detect problematic account - if ( - account?.address === - "0x0297fd6c19289a017d50b1b65a07ea4db27596a8fade85c6b9622a3f9a24d2a9" - ) { - notification.error( - "A problematic account has been detected. Try reconnecting your wallet or use a different account.", - ); - return; - } - if (!seed || isNaN(Number(seed))) { notification.error("Please enter a valid seed (integer number)"); return; From 8fdd91eca5641228ec785c4ce4c78bb68978de75 Mon Sep 17 00:00:00 2001 From: David Melendez Date: Sun, 12 Oct 2025 21:37:41 -0600 Subject: [PATCH 5/6] run yarn format --- .../contract/RandomnessComponent.tsx | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx index b20bbc4..125209c 100644 --- a/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx +++ b/packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx @@ -27,7 +27,6 @@ interface RandomnessComponentProps { onSuccess?: (txHash: string, generationId: string) => void; } - export const RandomnessComponent = ({ contractName, contractAddress, @@ -106,7 +105,7 @@ export const RandomnessComponent = ({ // For now, we're forcing dev mode (devnet_generate) for all environments including testnet. // Once the production VRF integration is stable, uncomment the conditional logic below // and remove the forced dev mode implementation. - + // TEMPORARY: Always use devnet_generate regardless of network const seedHex = num.toHex(seedValue); @@ -303,12 +302,17 @@ export const RandomnessComponent = ({

- Genera 5 números aleatorios únicos en el rango [1,40] usando la función de desarrollo devnet_generate. + Genera 5 números aleatorios únicos en el rango [1,40] usando la + función de desarrollo{" "} + devnet_generate + .

- +

- ℹ️ Nota: El modo de producción con VRF está temporalmente deshabilitado. Por ahora, se usa generación local para pruebas. + ℹ️ Nota: El modo de producción con VRF está + temporalmente deshabilitado. Por ahora, se usa generación local para + pruebas.

@@ -321,7 +325,10 @@ export const RandomnessComponent = ({ Red: {targetNetwork.name}

- Función: devnet_generate(seed) + Función:{" "} + + devnet_generate(seed) +

@@ -393,8 +400,6 @@ export const RandomnessComponent = ({ )} - - {/* Transaction result */} {txHash && (
@@ -423,20 +428,29 @@ export const RandomnessComponent = ({ {/* Additional information */}
-

💡 Cómo funciona:

+

+ 💡 Cómo funciona: +

  1. - 1. Llama directamente a devnet_generate(seed) + 1. Llama directamente a{" "} + + devnet_generate(seed) +
  2. - 2. El contrato genera 5 números únicos usando un algoritmo LCG local + 2. El contrato genera 5 números únicos usando un algoritmo LCG + local
  3. - 3. Los números se generan inmediatamente sin depender de oráculos externos + 3. Los números se generan inmediatamente sin depender de oráculos + externos
  4. 4. Los números se almacenan y pueden consultarse con{" "} - get_generation_numbers(id) + + get_generation_numbers(id) +
From 41f57fb56f7a9defc5f85aac4e0bfc74c2a38257 Mon Sep 17 00:00:00 2001 From: David Melendez Date: Sun, 12 Oct 2025 22:00:30 -0600 Subject: [PATCH 6/6] run yarn format --- packages/nextjs/public/sw.js | 389 +++++- packages/nextjs/public/workbox-4754cb34.js | 1320 +++++++++++++++++++- 2 files changed, 1707 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/public/sw.js b/packages/nextjs/public/sw.js index 87c1f3c..919d2d7 100644 --- a/packages/nextjs/public/sw.js +++ b/packages/nextjs/public/sw.js @@ -1 +1,388 @@ -if(!self.define){let e,n={};const s=(s,a)=>(s=new URL(s+".js",a).href,n[s]||new Promise((n=>{if("document"in self){const e=document.createElement("script");e.src=s,e.onload=n,document.head.appendChild(e)}else e=s,importScripts(s),n()})).then((()=>{let e=n[s];if(!e)throw new Error(`Module ${s} didn’t register its module`);return e})));self.define=(a,i)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(n[t])return;let c={};const r=e=>s(e,t),o={module:{uri:t},exports:c,require:r};n[t]=Promise.all(a.map((e=>o[e]||r(e)))).then((e=>(i(...e),c)))}}define(["./workbox-4754cb34"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"7045f79c0757532d4b5f7cd4855d5649"},{url:"/_next/static/a7-nNL44ILHpMXjO8yznh/_buildManifest.js",revision:"51da8d50ab8ae1c1afafe38c7e424e4e"},{url:"/_next/static/a7-nNL44ILHpMXjO8yznh/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/141-d196c46095c0e291.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/145-06c74ecb1424b1e8.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/2f0b94e8-734829800d3eb38b.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/473f56c0-0933f1e2ac7ad0b5.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/4bd1b696-48a906261550a4c5.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/658-e54429557207cf0c.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/668-61b1540c76186c47.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/684-3cf479aafee24c45.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/70646a03-d8bbffbaf77fafd0.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/850-9f08a3c50b278e3d.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/929-7d9534372e77efc8.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/94-3076be7aeedb9512.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/972.0f900fee228de7ed.js",revision:"0f900fee228de7ed"},{url:"/_next/static/chunks/app/_not-found/page-04d3b5ab1d5bc6de.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/api/price/route-6c0ab67fce666a7b.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/configure/page-2501fcf559af4c9f.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/debug/page-6bf2130703b290b9.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/debug/randomness/page-b7fd465125e2745d.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/layout-3f1d79a9df2a4a83.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/app/page-9f25e9a14f8c04f9.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/e6909d18-d7c7e73117910c02.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/framework-859199dea06580b0.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/main-a106802aa546c841.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/main-app-58ca74d35777be74.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/pages/_app-da15c11dea942c36.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/pages/_error-cc3f077a18ea1793.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-8a51ae7d91979afc.js",revision:"a7-nNL44ILHpMXjO8yznh"},{url:"/_next/static/css/9edad75ea06915e9.css",revision:"9edad75ea06915e9"},{url:"/blast-icon-color.svg",revision:"d949ffbc94b7c50e2e4fcf2b1daf1607"},{url:"/debug-icon.svg",revision:"62ce54a2ddb8d11cb25c891c9adbdbea"},{url:"/debug-image.png",revision:"34c4ca2676dd59ff24d6338faa1af371"},{url:"/explorer-icon.svg",revision:"f6413b9b86d870f77edeb18891f6b3d5"},{url:"/gradient-s.svg",revision:"1966c9867618efad27716a8591d9ade0"},{url:"/logo.ico",revision:"0359e607e29a3d3b08095d84a9d25c39"},{url:"/logo.svg",revision:"a497d49f3c5cf63fe06eda59345d5ec1"},{url:"/manifest.json",revision:"004abf8d9f1b515402e5ee94bf8f3567"},{url:"/rpc-version.png",revision:"cf97fd668cfa1221bec0210824978027"},{url:"/scaffold-config.png",revision:"1ebfc244c31732dc4273fe292bd07596"},{url:"/sn-symbol-gradient.png",revision:"908b60a4f6b92155b8ea38a009fa7081"},{url:"/starkcompass-icon.svg",revision:"f8853deea695e7491b012b31a0e6ed82"},{url:"/voyager-icon.svg",revision:"06663dd5ba2c49423225a8e3893b45fe"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:n,event:s,state:a})=>n&&"opaqueredirect"===n.type?new Response(n.body,{status:200,statusText:"OK",headers:n.headers}):n}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:json|xml|csv)$/i,new e.NetworkFirst({cacheName:"static-data-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;const n=e.pathname;return!n.startsWith("/api/auth/")&&!!n.startsWith("/api/")}),new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>{if(!(self.origin===e.origin))return!1;return!e.pathname.startsWith("/api/")}),new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute((({url:e})=>!(self.origin===e.origin)),new e.NetworkFirst({cacheName:"cross-origin",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:3600})]}),"GET")})); +if (!self.define) { + let e, + n = {}; + const s = (s, a) => ( + (s = new URL(s + ".js", a).href), + n[s] || + new Promise((n) => { + if ("document" in self) { + const e = document.createElement("script"); + (e.src = s), (e.onload = n), document.head.appendChild(e); + } else (e = s), importScripts(s), n(); + }).then(() => { + let e = n[s]; + if (!e) throw new Error(`Module ${s} didn’t register its module`); + return e; + }) + ); + self.define = (a, i) => { + const t = + e || + ("document" in self ? document.currentScript.src : "") || + location.href; + if (n[t]) return; + let c = {}; + const r = (e) => s(e, t), + o = { module: { uri: t }, exports: c, require: r }; + n[t] = Promise.all(a.map((e) => o[e] || r(e))).then((e) => (i(...e), c)); + }; +} +define(["./workbox-4754cb34"], function (e) { + "use strict"; + importScripts(), + self.skipWaiting(), + e.clientsClaim(), + e.precacheAndRoute( + [ + { + url: "/_next/app-build-manifest.json", + revision: "7045f79c0757532d4b5f7cd4855d5649", + }, + { + url: "/_next/static/a7-nNL44ILHpMXjO8yznh/_buildManifest.js", + revision: "51da8d50ab8ae1c1afafe38c7e424e4e", + }, + { + url: "/_next/static/a7-nNL44ILHpMXjO8yznh/_ssgManifest.js", + revision: "b6652df95db52feb4daf4eca35380933", + }, + { + url: "/_next/static/chunks/141-d196c46095c0e291.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/145-06c74ecb1424b1e8.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/2f0b94e8-734829800d3eb38b.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/473f56c0-0933f1e2ac7ad0b5.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/4bd1b696-48a906261550a4c5.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/658-e54429557207cf0c.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/668-61b1540c76186c47.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/684-3cf479aafee24c45.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/70646a03-d8bbffbaf77fafd0.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/850-9f08a3c50b278e3d.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/929-7d9534372e77efc8.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/94-3076be7aeedb9512.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/972.0f900fee228de7ed.js", + revision: "0f900fee228de7ed", + }, + { + url: "/_next/static/chunks/app/_not-found/page-04d3b5ab1d5bc6de.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/app/api/price/route-6c0ab67fce666a7b.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/app/configure/page-2501fcf559af4c9f.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/app/debug/page-6bf2130703b290b9.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/app/debug/randomness/page-b7fd465125e2745d.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/app/layout-3f1d79a9df2a4a83.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/app/page-9f25e9a14f8c04f9.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/e6909d18-d7c7e73117910c02.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/framework-859199dea06580b0.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/main-a106802aa546c841.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/main-app-58ca74d35777be74.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/pages/_app-da15c11dea942c36.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/pages/_error-cc3f077a18ea1793.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/chunks/polyfills-42372ed130431b0a.js", + revision: "846118c33b2c0e922d7b3a7676f81f6f", + }, + { + url: "/_next/static/chunks/webpack-8a51ae7d91979afc.js", + revision: "a7-nNL44ILHpMXjO8yznh", + }, + { + url: "/_next/static/css/9edad75ea06915e9.css", + revision: "9edad75ea06915e9", + }, + { + url: "/blast-icon-color.svg", + revision: "d949ffbc94b7c50e2e4fcf2b1daf1607", + }, + { + url: "/debug-icon.svg", + revision: "62ce54a2ddb8d11cb25c891c9adbdbea", + }, + { + url: "/debug-image.png", + revision: "34c4ca2676dd59ff24d6338faa1af371", + }, + { + url: "/explorer-icon.svg", + revision: "f6413b9b86d870f77edeb18891f6b3d5", + }, + { + url: "/gradient-s.svg", + revision: "1966c9867618efad27716a8591d9ade0", + }, + { url: "/logo.ico", revision: "0359e607e29a3d3b08095d84a9d25c39" }, + { url: "/logo.svg", revision: "a497d49f3c5cf63fe06eda59345d5ec1" }, + { url: "/manifest.json", revision: "004abf8d9f1b515402e5ee94bf8f3567" }, + { + url: "/rpc-version.png", + revision: "cf97fd668cfa1221bec0210824978027", + }, + { + url: "/scaffold-config.png", + revision: "1ebfc244c31732dc4273fe292bd07596", + }, + { + url: "/sn-symbol-gradient.png", + revision: "908b60a4f6b92155b8ea38a009fa7081", + }, + { + url: "/starkcompass-icon.svg", + revision: "f8853deea695e7491b012b31a0e6ed82", + }, + { + url: "/voyager-icon.svg", + revision: "06663dd5ba2c49423225a8e3893b45fe", + }, + ], + { ignoreURLParametersMatching: [] }, + ), + e.cleanupOutdatedCaches(), + e.registerRoute( + "/", + new e.NetworkFirst({ + cacheName: "start-url", + plugins: [ + { + cacheWillUpdate: async ({ + request: e, + response: n, + event: s, + state: a, + }) => + n && "opaqueredirect" === n.type + ? new Response(n.body, { + status: 200, + statusText: "OK", + headers: n.headers, + }) + : n, + }, + ], + }), + "GET", + ), + e.registerRoute( + /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i, + new e.CacheFirst({ + cacheName: "google-fonts-webfonts", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 31536e3 }), + ], + }), + "GET", + ), + e.registerRoute( + /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i, + new e.StaleWhileRevalidate({ + cacheName: "google-fonts-stylesheets", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 604800 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i, + new e.StaleWhileRevalidate({ + cacheName: "static-font-assets", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 4, maxAgeSeconds: 604800 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i, + new e.StaleWhileRevalidate({ + cacheName: "static-image-assets", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 64, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\/_next\/image\?url=.+$/i, + new e.StaleWhileRevalidate({ + cacheName: "next-image", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 64, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:mp3|wav|ogg)$/i, + new e.CacheFirst({ + cacheName: "static-audio-assets", + plugins: [ + new e.RangeRequestsPlugin(), + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:mp4)$/i, + new e.CacheFirst({ + cacheName: "static-video-assets", + plugins: [ + new e.RangeRequestsPlugin(), + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:js)$/i, + new e.StaleWhileRevalidate({ + cacheName: "static-js-assets", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:css|less)$/i, + new e.StaleWhileRevalidate({ + cacheName: "static-style-assets", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\/_next\/data\/.+\/.+\.json$/i, + new e.StaleWhileRevalidate({ + cacheName: "next-data", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + /\.(?:json|xml|csv)$/i, + new e.NetworkFirst({ + cacheName: "static-data-assets", + plugins: [ + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + ({ url: e }) => { + if (!(self.origin === e.origin)) return !1; + const n = e.pathname; + return !n.startsWith("/api/auth/") && !!n.startsWith("/api/"); + }, + new e.NetworkFirst({ + cacheName: "apis", + networkTimeoutSeconds: 10, + plugins: [ + new e.ExpirationPlugin({ maxEntries: 16, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + ({ url: e }) => { + if (!(self.origin === e.origin)) return !1; + return !e.pathname.startsWith("/api/"); + }, + new e.NetworkFirst({ + cacheName: "others", + networkTimeoutSeconds: 10, + plugins: [ + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 86400 }), + ], + }), + "GET", + ), + e.registerRoute( + ({ url: e }) => !(self.origin === e.origin), + new e.NetworkFirst({ + cacheName: "cross-origin", + networkTimeoutSeconds: 10, + plugins: [ + new e.ExpirationPlugin({ maxEntries: 32, maxAgeSeconds: 3600 }), + ], + }), + "GET", + ); +}); diff --git a/packages/nextjs/public/workbox-4754cb34.js b/packages/nextjs/public/workbox-4754cb34.js index 5cd8247..3f04c68 100644 --- a/packages/nextjs/public/workbox-4754cb34.js +++ b/packages/nextjs/public/workbox-4754cb34.js @@ -1 +1,1319 @@ -define(["exports"],(function(t){"use strict";try{self["workbox:core:6.5.4"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:6.5.4"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class r{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class i extends r{constructor(t,e,s){super((({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)}),e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",(t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)}))}addCacheListener(){self.addEventListener("message",(t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map((e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})})));t.waitUntil(s),t.ports&&t.ports[0]&&s.then((()=>t.ports[0].postMessage(!0)))}}))}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=i&&i.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:r})}catch(t){c=Promise.reject(t)}const h=i&&i.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch((async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:r})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n}))),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const r=this.t.get(s.method)||[];for(const i of r){let r;const a=i.match({url:t,sameOrigin:e,request:s,event:n});if(a)return r=a,(Array.isArray(r)&&0===r.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(r=void 0),{route:i,params:r}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);function h(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new r((({url:t})=>t.href===s.href),e,n)}else if(t instanceof RegExp)a=new i(t,e,n);else if("function"==typeof t)a=new r(t,e,n);else{if(!(t instanceof r))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}try{self["workbox:strategies:6.5.4"]&&_()}catch(t){}const u={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null},l={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},f=t=>[l.prefix,t,l.suffix].filter((t=>t&&t.length>0)).join("-"),w=t=>t||f(l.precache),d=t=>t||f(l.runtime);function p(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class y{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}const g=new Set;function m(t){return"string"==typeof t?new Request(t):t}class v{constructor(t,e){this.h={},Object.assign(this,e),this.event=e.event,this.u=t,this.l=new y,this.p=[],this.m=[...t.plugins],this.v=new Map;for(const t of this.m)this.v.set(t,{});this.event.waitUntil(this.l.promise)}async fetch(t){const{event:e}=this;let n=m(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this.u.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:i,response:t});return t}catch(t){throw r&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:r.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=m(t);let s;const{cacheName:n,matchOptions:r}=this.u,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},r),{cacheName:n});s=await caches.match(i,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:n,matchOptions:r,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(t,e){const n=m(t);var r;await(r=0,new Promise((t=>setTimeout(t,r))));const i=await this.getCacheKey(n,"write");if(!e)throw new s("cache-put-with-no-response",{url:(a=i.url,new URL(String(a),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var a;const o=await this.R(e);if(!o)return!1;const{cacheName:c,matchOptions:h}=this.u,u=await self.caches.open(c),l=this.hasCallback("cacheDidUpdate"),f=l?await async function(t,e,s,n){const r=p(e.url,s);if(e.url===r)return t.match(e,n);const i=Object.assign(Object.assign({},n),{ignoreSearch:!0}),a=await t.keys(e,i);for(const e of a)if(r===p(e.url,s))return t.match(e,n)}(u,i.clone(),["__WB_REVISION__"],h):null;try{await u.put(i,l?o.clone():o)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await async function(){for(const t of g)await t()}(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:c,oldResponse:f,newResponse:o.clone(),request:i,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.h[s]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=m(await t({mode:e,request:n,event:this.event,params:this.params}));this.h[s]=n}return this.h[s]}hasCallback(t){for(const e of this.u.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this.u.plugins)if("function"==typeof e[t]){const s=this.v.get(e),n=n=>{const r=Object.assign(Object.assign({},n),{state:s});return e[t](r)};yield n}}waitUntil(t){return this.p.push(t),t}async doneWaiting(){let t;for(;t=this.p.shift();)await t}destroy(){this.l.resolve(null)}async R(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class R{constructor(t={}){this.cacheName=d(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,n="params"in t?t.params:void 0,r=new v(this,{event:e,request:s,params:n}),i=this.q(r,s,e);return[i,this.D(i,r,s,e)]}async q(t,e,n){let r;await t.runCallbacks("handlerWillStart",{event:n,request:e});try{if(r=await this.U(e,t),!r||"error"===r.type)throw new s("no-response",{url:e.url})}catch(s){if(s instanceof Error)for(const i of t.iterateCallbacks("handlerDidError"))if(r=await i({error:s,event:n,request:e}),r)break;if(!r)throw s}for(const s of t.iterateCallbacks("handlerWillRespond"))r=await s({event:n,request:e,response:r});return r}async D(t,e,s,n){let r,i;try{r=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:n,request:s,response:r}),await e.doneWaiting()}catch(t){t instanceof Error&&(i=t)}if(await e.runCallbacks("handlerDidComplete",{event:n,request:s,response:r,error:i}),e.destroy(),i)throw i}}function b(t){t.then((()=>{}))}function q(){return q=Object.assign?Object.assign.bind():function(t){for(var e=1;e(t[e]=s,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function O(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(U||(U=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(B(this),e),k(x.get(this))}:function(...e){return k(t.apply(B(this),e))}:function(e,...s){const n=t.call(B(this),e,...s);return I.set(n,e.sort?e.sort():[e]),k(n)}}function T(t){return"function"==typeof t?O(t):(t instanceof IDBTransaction&&function(t){if(L.has(t))return;const e=new Promise(((e,s)=>{const n=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),n()},i=()=>{s(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));L.set(t,e)}(t),e=t,(D||(D=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,N):t);var e}function k(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,s)=>{const n=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(k(t.result)),n()},i=()=>{s(t.error),n()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&x.set(e,t)})).catch((()=>{})),E.set(e,t),e}(t);if(C.has(t))return C.get(t);const e=T(t);return e!==t&&(C.set(t,e),E.set(e,t)),e}const B=t=>E.get(t);const P=["get","getKey","getAll","getAllKeys","count"],M=["put","add","delete","clear"],W=new Map;function j(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(W.get(e))return W.get(e);const s=e.replace(/FromIndex$/,""),n=e!==s,r=M.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!r&&!P.includes(s))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let a=i.store;return n&&(a=a.index(e.shift())),(await Promise.all([a[s](...e),r&&i.done]))[0]};return W.set(e,i),i}N=(t=>q({},t,{get:(e,s,n)=>j(e,s)||t.get(e,s,n),has:(e,s)=>!!j(e,s)||t.has(e,s)}))(N);try{self["workbox:expiration:6.5.4"]&&_()}catch(t){}const S="cache-entries",K=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class A{constructor(t){this._=null,this.L=t}I(t){const e=t.createObjectStore(S,{keyPath:"id"});e.createIndex("cacheName","cacheName",{unique:!1}),e.createIndex("timestamp","timestamp",{unique:!1})}C(t){this.I(t),this.L&&function(t,{blocked:e}={}){const s=indexedDB.deleteDatabase(t);e&&s.addEventListener("blocked",(t=>e(t.oldVersion,t))),k(s).then((()=>{}))}(this.L)}async setTimestamp(t,e){const s={url:t=K(t),timestamp:e,cacheName:this.L,id:this.N(t)},n=(await this.getDb()).transaction(S,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(t){const e=await this.getDb(),s=await e.get(S,this.N(t));return null==s?void 0:s.timestamp}async expireEntries(t,e){const s=await this.getDb();let n=await s.transaction(S).store.index("timestamp").openCursor(null,"prev");const r=[];let i=0;for(;n;){const s=n.value;s.cacheName===this.L&&(t&&s.timestamp=e?r.push(n.value):i++),n=await n.continue()}const a=[];for(const t of r)await s.delete(S,t.id),a.push(t.url);return a}N(t){return this.L+"|"+K(t)}async getDb(){return this._||(this._=await function(t,e,{blocked:s,upgrade:n,blocking:r,terminated:i}={}){const a=indexedDB.open(t,e),o=k(a);return n&&a.addEventListener("upgradeneeded",(t=>{n(k(a.result),t.oldVersion,t.newVersion,k(a.transaction),t)})),s&&a.addEventListener("blocked",(t=>s(t.oldVersion,t.newVersion,t))),o.then((t=>{i&&t.addEventListener("close",(()=>i())),r&&t.addEventListener("versionchange",(t=>r(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),o}("workbox-expiration",1,{upgrade:this.C.bind(this)})),this._}}class F{constructor(t,e={}){this.O=!1,this.T=!1,this.k=e.maxEntries,this.B=e.maxAgeSeconds,this.P=e.matchOptions,this.L=t,this.M=new A(t)}async expireEntries(){if(this.O)return void(this.T=!0);this.O=!0;const t=this.B?Date.now()-1e3*this.B:0,e=await this.M.expireEntries(t,this.k),s=await self.caches.open(this.L);for(const t of e)await s.delete(t,this.P);this.O=!1,this.T&&(this.T=!1,b(this.expireEntries()))}async updateTimestamp(t){await this.M.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.B){const e=await this.M.getTimestamp(t),s=Date.now()-1e3*this.B;return void 0===e||er||e&&e<0)throw new s("range-not-satisfiable",{size:r,end:n,start:e});let i,a;return void 0!==e&&void 0!==n?(i=e,a=n+1):void 0!==e&&void 0===n?(i=e,a=r):void 0!==n&&void 0===e&&(i=r-n,a=r),{start:i,end:a}}(i,r.start,r.end),o=i.slice(a.start,a.end),c=o.size,h=new Response(o,{status:206,statusText:"Partial Content",headers:e.headers});return h.headers.set("Content-Length",String(c)),h.headers.set("Content-Range",`bytes ${a.start}-${a.end-1}/${i.size}`),h}catch(t){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}function $(t,e){const s=e();return t.waitUntil(s),s}try{self["workbox:precaching:6.5.4"]&&_()}catch(t){}function z(t){if(!t)throw new s("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location.href);return{cacheKey:e.href,url:e.href}}const{revision:e,url:n}=t;if(!n)throw new s("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location.href);return{cacheKey:t.href,url:t.href}}const r=new URL(n,location.href),i=new URL(n,location.href);return r.searchParams.set("__WB_REVISION__",e),{cacheKey:r.href,url:i.href}}class G{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:t,state:e})=>{e&&(e.originalRequest=t)},this.cachedResponseWillBeUsed=async({event:t,state:e,cachedResponse:s})=>{if("install"===t.type&&e&&e.originalRequest&&e.originalRequest instanceof Request){const t=e.originalRequest.url;s?this.notUpdatedURLs.push(t):this.updatedURLs.push(t)}return s}}}class V{constructor({precacheController:t}){this.cacheKeyWillBeUsed=async({request:t,params:e})=>{const s=(null==e?void 0:e.cacheKey)||this.W.getCacheKeyForURL(t.url);return s?new Request(s,{headers:t.headers}):t},this.W=t}}let J,Q;async function X(t,e){let n=null;if(t.url){n=new URL(t.url).origin}if(n!==self.location.origin)throw new s("cross-origin-copy-response",{origin:n});const r=t.clone(),i={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},a=e?e(i):i,o=function(){if(void 0===J){const t=new Response("");if("body"in t)try{new Response(t.body),J=!0}catch(t){J=!1}J=!1}return J}()?r.body:await r.blob();return new Response(o,a)}class Y extends R{constructor(t={}){t.cacheName=w(t.cacheName),super(t),this.j=!1!==t.fallbackToNetwork,this.plugins.push(Y.copyRedirectedCacheableResponsesPlugin)}async U(t,e){const s=await e.cacheMatch(t);return s||(e.event&&"install"===e.event.type?await this.S(t,e):await this.K(t,e))}async K(t,e){let n;const r=e.params||{};if(!this.j)throw new s("missing-precache-entry",{cacheName:this.cacheName,url:t.url});{const s=r.integrity,i=t.integrity,a=!i||i===s;n=await e.fetch(new Request(t,{integrity:"no-cors"!==t.mode?i||s:void 0})),s&&a&&"no-cors"!==t.mode&&(this.A(),await e.cachePut(t,n.clone()))}return n}async S(t,e){this.A();const n=await e.fetch(t);if(!await e.cachePut(t,n.clone()))throw new s("bad-precaching-response",{url:t.url,status:n.status});return n}A(){let t=null,e=0;for(const[s,n]of this.plugins.entries())n!==Y.copyRedirectedCacheableResponsesPlugin&&(n===Y.defaultPrecacheCacheabilityPlugin&&(t=s),n.cacheWillUpdate&&e++);0===e?this.plugins.push(Y.defaultPrecacheCacheabilityPlugin):e>1&&null!==t&&this.plugins.splice(t,1)}}Y.defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:t})=>!t||t.status>=400?null:t},Y.copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:t})=>t.redirected?await X(t):t};class Z{constructor({cacheName:t,plugins:e=[],fallbackToNetwork:s=!0}={}){this.F=new Map,this.H=new Map,this.$=new Map,this.u=new Y({cacheName:w(t),plugins:[...e,new V({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this.u}precache(t){this.addToCacheList(t),this.G||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this.G=!0)}addToCacheList(t){const e=[];for(const n of t){"string"==typeof n?e.push(n):n&&void 0===n.revision&&e.push(n.url);const{cacheKey:t,url:r}=z(n),i="string"!=typeof n&&n.revision?"reload":"default";if(this.F.has(r)&&this.F.get(r)!==t)throw new s("add-to-cache-list-conflicting-entries",{firstEntry:this.F.get(r),secondEntry:t});if("string"!=typeof n&&n.integrity){if(this.$.has(t)&&this.$.get(t)!==n.integrity)throw new s("add-to-cache-list-conflicting-integrities",{url:r});this.$.set(t,n.integrity)}if(this.F.set(r,t),this.H.set(r,i),e.length>0){const t=`Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(t)}}}install(t){return $(t,(async()=>{const e=new G;this.strategy.plugins.push(e);for(const[e,s]of this.F){const n=this.$.get(s),r=this.H.get(e),i=new Request(e,{integrity:n,cache:r,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:s},request:i,event:t}))}const{updatedURLs:s,notUpdatedURLs:n}=e;return{updatedURLs:s,notUpdatedURLs:n}}))}activate(t){return $(t,(async()=>{const t=await self.caches.open(this.strategy.cacheName),e=await t.keys(),s=new Set(this.F.values()),n=[];for(const r of e)s.has(r.url)||(await t.delete(r),n.push(r.url));return{deletedURLs:n}}))}getURLsToCacheKeys(){return this.F}getCachedURLs(){return[...this.F.keys()]}getCacheKeyForURL(t){const e=new URL(t,location.href);return this.F.get(e.href)}getIntegrityForCacheKey(t){return this.$.get(t)}async matchPrecache(t){const e=t instanceof Request?t.url:t,s=this.getCacheKeyForURL(e);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(t){const e=this.getCacheKeyForURL(t);if(!e)throw new s("non-precached-url",{url:t});return s=>(s.request=new Request(t),s.params=Object.assign({cacheKey:e},s.params),this.strategy.handle(s))}}const tt=()=>(Q||(Q=new Z),Q);class et extends r{constructor(t,e){super((({request:s})=>{const n=t.getURLsToCacheKeys();for(const r of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:r}={}){const i=new URL(t,location.href);i.hash="",yield i.href;const a=function(t,e=[]){for(const s of[...t.searchParams.keys()])e.some((t=>t.test(s)))&&t.searchParams.delete(s);return t}(i,e);if(yield a.href,s&&a.pathname.endsWith("/")){const t=new URL(a.href);t.pathname+=s,yield t.href}if(n){const t=new URL(a.href);t.pathname+=".html",yield t.href}if(r){const t=r({url:i});for(const e of t)yield e.href}}(s.url,e)){const e=n.get(r);if(e){return{cacheKey:e,integrity:t.getIntegrityForCacheKey(e)}}}}),t.strategy)}}t.CacheFirst=class extends R{async U(t,e){let n,r=await e.cacheMatch(t);if(!r)try{r=await e.fetchAndCachePut(t)}catch(t){t instanceof Error&&(n=t)}if(!r)throw new s("no-response",{url:t.url,error:n});return r}},t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:s,cachedResponse:n})=>{if(!n)return null;const r=this.V(n),i=this.J(s);b(i.expireEntries());const a=i.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(t){}return r?n:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const s=this.J(t);await s.updateTimestamp(e.url),await s.expireEntries()},this.X=t,this.B=t.maxAgeSeconds,this.Y=new Map,t.purgeOnQuotaError&&function(t){g.add(t)}((()=>this.deleteCacheAndMetadata()))}J(t){if(t===d())throw new s("expire-custom-caches-only");let e=this.Y.get(t);return e||(e=new F(t,this.X),this.Y.set(t,e)),e}V(t){if(!this.B)return!0;const e=this.Z(t);if(null===e)return!0;return e>=Date.now()-1e3*this.B}Z(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),s=new Date(e).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[t,e]of this.Y)await self.caches.delete(t),await e.delete();this.Y=new Map}},t.NetworkFirst=class extends R{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u),this.tt=t.networkTimeoutSeconds||0}async U(t,e){const n=[],r=[];let i;if(this.tt){const{id:s,promise:a}=this.et({request:t,logs:n,handler:e});i=s,r.push(a)}const a=this.st({timeoutId:i,request:t,logs:n,handler:e});r.push(a);const o=await e.waitUntil((async()=>await e.waitUntil(Promise.race(r))||await a)());if(!o)throw new s("no-response",{url:t.url});return o}et({request:t,logs:e,handler:s}){let n;return{promise:new Promise((e=>{n=setTimeout((async()=>{e(await s.cacheMatch(t))}),1e3*this.tt)})),id:n}}async st({timeoutId:t,request:e,logs:s,handler:n}){let r,i;try{i=await n.fetchAndCachePut(e)}catch(t){t instanceof Error&&(r=t)}return t&&clearTimeout(t),!r&&i||(i=await n.cacheMatch(e)),i}},t.RangeRequestsPlugin=class{constructor(){this.cachedResponseWillBeUsed=async({request:t,cachedResponse:e})=>e&&t.headers.has("range")?await H(t,e):e}},t.StaleWhileRevalidate=class extends R{constructor(t={}){super(t),this.plugins.some((t=>"cacheWillUpdate"in t))||this.plugins.unshift(u)}async U(t,e){const n=e.fetchAndCachePut(t).catch((()=>{}));e.waitUntil(n);let r,i=await e.cacheMatch(t);if(i);else try{i=await n}catch(t){t instanceof Error&&(r=t)}if(!i)throw new s("no-response",{url:t.url,error:r});return i}},t.cleanupOutdatedCaches=function(){self.addEventListener("activate",(t=>{const e=w();t.waitUntil((async(t,e="-precache-")=>{const s=(await self.caches.keys()).filter((s=>s.includes(e)&&s.includes(self.registration.scope)&&s!==t));return await Promise.all(s.map((t=>self.caches.delete(t)))),s})(e).then((t=>{})))}))},t.clientsClaim=function(){self.addEventListener("activate",(()=>self.clients.claim()))},t.precacheAndRoute=function(t,e){!function(t){tt().precache(t)}(t),function(t){const e=tt();h(new et(e,t))}(e)},t.registerRoute=h})); +define(["exports"], function (t) { + "use strict"; + try { + self["workbox:core:6.5.4"] && _(); + } catch (t) {} + const e = (t, ...e) => { + let s = t; + return e.length > 0 && (s += ` :: ${JSON.stringify(e)}`), s; + }; + class s extends Error { + constructor(t, s) { + super(e(t, s)), (this.name = t), (this.details = s); + } + } + try { + self["workbox:routing:6.5.4"] && _(); + } catch (t) {} + const n = (t) => (t && "object" == typeof t ? t : { handle: t }); + class r { + constructor(t, e, s = "GET") { + (this.handler = n(e)), (this.match = t), (this.method = s); + } + setCatchHandler(t) { + this.catchHandler = n(t); + } + } + class i extends r { + constructor(t, e, s) { + super( + ({ url: e }) => { + const s = t.exec(e.href); + if (s && (e.origin === location.origin || 0 === s.index)) + return s.slice(1); + }, + e, + s, + ); + } + } + class a { + constructor() { + (this.t = new Map()), (this.i = new Map()); + } + get routes() { + return this.t; + } + addFetchListener() { + self.addEventListener("fetch", (t) => { + const { request: e } = t, + s = this.handleRequest({ request: e, event: t }); + s && t.respondWith(s); + }); + } + addCacheListener() { + self.addEventListener("message", (t) => { + if (t.data && "CACHE_URLS" === t.data.type) { + const { payload: e } = t.data, + s = Promise.all( + e.urlsToCache.map((e) => { + "string" == typeof e && (e = [e]); + const s = new Request(...e); + return this.handleRequest({ request: s, event: t }); + }), + ); + t.waitUntil(s), + t.ports && t.ports[0] && s.then(() => t.ports[0].postMessage(!0)); + } + }); + } + handleRequest({ request: t, event: e }) { + const s = new URL(t.url, location.href); + if (!s.protocol.startsWith("http")) return; + const n = s.origin === location.origin, + { params: r, route: i } = this.findMatchingRoute({ + event: e, + request: t, + sameOrigin: n, + url: s, + }); + let a = i && i.handler; + const o = t.method; + if ((!a && this.i.has(o) && (a = this.i.get(o)), !a)) return; + let c; + try { + c = a.handle({ url: s, request: t, event: e, params: r }); + } catch (t) { + c = Promise.reject(t); + } + const h = i && i.catchHandler; + return ( + c instanceof Promise && + (this.o || h) && + (c = c.catch(async (n) => { + if (h) + try { + return await h.handle({ + url: s, + request: t, + event: e, + params: r, + }); + } catch (t) { + t instanceof Error && (n = t); + } + if (this.o) return this.o.handle({ url: s, request: t, event: e }); + throw n; + })), + c + ); + } + findMatchingRoute({ url: t, sameOrigin: e, request: s, event: n }) { + const r = this.t.get(s.method) || []; + for (const i of r) { + let r; + const a = i.match({ url: t, sameOrigin: e, request: s, event: n }); + if (a) + return ( + (r = a), + ((Array.isArray(r) && 0 === r.length) || + (a.constructor === Object && 0 === Object.keys(a).length) || + "boolean" == typeof a) && + (r = void 0), + { route: i, params: r } + ); + } + return {}; + } + setDefaultHandler(t, e = "GET") { + this.i.set(e, n(t)); + } + setCatchHandler(t) { + this.o = n(t); + } + registerRoute(t) { + this.t.has(t.method) || this.t.set(t.method, []), + this.t.get(t.method).push(t); + } + unregisterRoute(t) { + if (!this.t.has(t.method)) + throw new s("unregister-route-but-not-found-with-method", { + method: t.method, + }); + const e = this.t.get(t.method).indexOf(t); + if (!(e > -1)) throw new s("unregister-route-route-not-registered"); + this.t.get(t.method).splice(e, 1); + } + } + let o; + const c = () => ( + o || ((o = new a()), o.addFetchListener(), o.addCacheListener()), o + ); + function h(t, e, n) { + let a; + if ("string" == typeof t) { + const s = new URL(t, location.href); + a = new r(({ url: t }) => t.href === s.href, e, n); + } else if (t instanceof RegExp) a = new i(t, e, n); + else if ("function" == typeof t) a = new r(t, e, n); + else { + if (!(t instanceof r)) + throw new s("unsupported-route-type", { + moduleName: "workbox-routing", + funcName: "registerRoute", + paramName: "capture", + }); + a = t; + } + return c().registerRoute(a), a; + } + try { + self["workbox:strategies:6.5.4"] && _(); + } catch (t) {} + const u = { + cacheWillUpdate: async ({ response: t }) => + 200 === t.status || 0 === t.status ? t : null, + }, + l = { + googleAnalytics: "googleAnalytics", + precache: "precache-v2", + prefix: "workbox", + runtime: "runtime", + suffix: "undefined" != typeof registration ? registration.scope : "", + }, + f = (t) => + [l.prefix, t, l.suffix].filter((t) => t && t.length > 0).join("-"), + w = (t) => t || f(l.precache), + d = (t) => t || f(l.runtime); + function p(t, e) { + const s = new URL(t); + for (const t of e) s.searchParams.delete(t); + return s.href; + } + class y { + constructor() { + this.promise = new Promise((t, e) => { + (this.resolve = t), (this.reject = e); + }); + } + } + const g = new Set(); + function m(t) { + return "string" == typeof t ? new Request(t) : t; + } + class v { + constructor(t, e) { + (this.h = {}), + Object.assign(this, e), + (this.event = e.event), + (this.u = t), + (this.l = new y()), + (this.p = []), + (this.m = [...t.plugins]), + (this.v = new Map()); + for (const t of this.m) this.v.set(t, {}); + this.event.waitUntil(this.l.promise); + } + async fetch(t) { + const { event: e } = this; + let n = m(t); + if ( + "navigate" === n.mode && + e instanceof FetchEvent && + e.preloadResponse + ) { + const t = await e.preloadResponse; + if (t) return t; + } + const r = this.hasCallback("fetchDidFail") ? n.clone() : null; + try { + for (const t of this.iterateCallbacks("requestWillFetch")) + n = await t({ request: n.clone(), event: e }); + } catch (t) { + if (t instanceof Error) + throw new s("plugin-error-request-will-fetch", { + thrownErrorMessage: t.message, + }); + } + const i = n.clone(); + try { + let t; + t = await fetch( + n, + "navigate" === n.mode ? void 0 : this.u.fetchOptions, + ); + for (const s of this.iterateCallbacks("fetchDidSucceed")) + t = await s({ event: e, request: i, response: t }); + return t; + } catch (t) { + throw ( + (r && + (await this.runCallbacks("fetchDidFail", { + error: t, + event: e, + originalRequest: r.clone(), + request: i.clone(), + })), + t) + ); + } + } + async fetchAndCachePut(t) { + const e = await this.fetch(t), + s = e.clone(); + return this.waitUntil(this.cachePut(t, s)), e; + } + async cacheMatch(t) { + const e = m(t); + let s; + const { cacheName: n, matchOptions: r } = this.u, + i = await this.getCacheKey(e, "read"), + a = Object.assign(Object.assign({}, r), { cacheName: n }); + s = await caches.match(i, a); + for (const t of this.iterateCallbacks("cachedResponseWillBeUsed")) + s = + (await t({ + cacheName: n, + matchOptions: r, + cachedResponse: s, + request: i, + event: this.event, + })) || void 0; + return s; + } + async cachePut(t, e) { + const n = m(t); + var r; + await ((r = 0), new Promise((t) => setTimeout(t, r))); + const i = await this.getCacheKey(n, "write"); + if (!e) + throw new s("cache-put-with-no-response", { + url: + ((a = i.url), + new URL(String(a), location.href).href.replace( + new RegExp(`^${location.origin}`), + "", + )), + }); + var a; + const o = await this.R(e); + if (!o) return !1; + const { cacheName: c, matchOptions: h } = this.u, + u = await self.caches.open(c), + l = this.hasCallback("cacheDidUpdate"), + f = l + ? await (async function (t, e, s, n) { + const r = p(e.url, s); + if (e.url === r) return t.match(e, n); + const i = Object.assign(Object.assign({}, n), { + ignoreSearch: !0, + }), + a = await t.keys(e, i); + for (const e of a) if (r === p(e.url, s)) return t.match(e, n); + })(u, i.clone(), ["__WB_REVISION__"], h) + : null; + try { + await u.put(i, l ? o.clone() : o); + } catch (t) { + if (t instanceof Error) + throw ( + ("QuotaExceededError" === t.name && + (await (async function () { + for (const t of g) await t(); + })()), + t) + ); + } + for (const t of this.iterateCallbacks("cacheDidUpdate")) + await t({ + cacheName: c, + oldResponse: f, + newResponse: o.clone(), + request: i, + event: this.event, + }); + return !0; + } + async getCacheKey(t, e) { + const s = `${t.url} | ${e}`; + if (!this.h[s]) { + let n = t; + for (const t of this.iterateCallbacks("cacheKeyWillBeUsed")) + n = m( + await t({ + mode: e, + request: n, + event: this.event, + params: this.params, + }), + ); + this.h[s] = n; + } + return this.h[s]; + } + hasCallback(t) { + for (const e of this.u.plugins) if (t in e) return !0; + return !1; + } + async runCallbacks(t, e) { + for (const s of this.iterateCallbacks(t)) await s(e); + } + *iterateCallbacks(t) { + for (const e of this.u.plugins) + if ("function" == typeof e[t]) { + const s = this.v.get(e), + n = (n) => { + const r = Object.assign(Object.assign({}, n), { state: s }); + return e[t](r); + }; + yield n; + } + } + waitUntil(t) { + return this.p.push(t), t; + } + async doneWaiting() { + let t; + for (; (t = this.p.shift()); ) await t; + } + destroy() { + this.l.resolve(null); + } + async R(t) { + let e = t, + s = !1; + for (const t of this.iterateCallbacks("cacheWillUpdate")) + if ( + ((e = + (await t({ + request: this.request, + response: e, + event: this.event, + })) || void 0), + (s = !0), + !e) + ) + break; + return s || (e && 200 !== e.status && (e = void 0)), e; + } + } + class R { + constructor(t = {}) { + (this.cacheName = d(t.cacheName)), + (this.plugins = t.plugins || []), + (this.fetchOptions = t.fetchOptions), + (this.matchOptions = t.matchOptions); + } + handle(t) { + const [e] = this.handleAll(t); + return e; + } + handleAll(t) { + t instanceof FetchEvent && (t = { event: t, request: t.request }); + const e = t.event, + s = "string" == typeof t.request ? new Request(t.request) : t.request, + n = "params" in t ? t.params : void 0, + r = new v(this, { event: e, request: s, params: n }), + i = this.q(r, s, e); + return [i, this.D(i, r, s, e)]; + } + async q(t, e, n) { + let r; + await t.runCallbacks("handlerWillStart", { event: n, request: e }); + try { + if (((r = await this.U(e, t)), !r || "error" === r.type)) + throw new s("no-response", { url: e.url }); + } catch (s) { + if (s instanceof Error) + for (const i of t.iterateCallbacks("handlerDidError")) + if (((r = await i({ error: s, event: n, request: e })), r)) break; + if (!r) throw s; + } + for (const s of t.iterateCallbacks("handlerWillRespond")) + r = await s({ event: n, request: e, response: r }); + return r; + } + async D(t, e, s, n) { + let r, i; + try { + r = await t; + } catch (i) {} + try { + await e.runCallbacks("handlerDidRespond", { + event: n, + request: s, + response: r, + }), + await e.doneWaiting(); + } catch (t) { + t instanceof Error && (i = t); + } + if ( + (await e.runCallbacks("handlerDidComplete", { + event: n, + request: s, + response: r, + error: i, + }), + e.destroy(), + i) + ) + throw i; + } + } + function b(t) { + t.then(() => {}); + } + function q() { + return ( + (q = Object.assign + ? Object.assign.bind() + : function (t) { + for (var e = 1; e < arguments.length; e++) { + var s = arguments[e]; + for (var n in s) ({}).hasOwnProperty.call(s, n) && (t[n] = s[n]); + } + return t; + }), + q.apply(null, arguments) + ); + } + let D, U; + const x = new WeakMap(), + L = new WeakMap(), + I = new WeakMap(), + C = new WeakMap(), + E = new WeakMap(); + let N = { + get(t, e, s) { + if (t instanceof IDBTransaction) { + if ("done" === e) return L.get(t); + if ("objectStoreNames" === e) return t.objectStoreNames || I.get(t); + if ("store" === e) + return s.objectStoreNames[1] + ? void 0 + : s.objectStore(s.objectStoreNames[0]); + } + return k(t[e]); + }, + set: (t, e, s) => ((t[e] = s), !0), + has: (t, e) => + (t instanceof IDBTransaction && ("done" === e || "store" === e)) || + e in t, + }; + function O(t) { + return t !== IDBDatabase.prototype.transaction || + "objectStoreNames" in IDBTransaction.prototype + ? ( + U || + (U = [ + IDBCursor.prototype.advance, + IDBCursor.prototype.continue, + IDBCursor.prototype.continuePrimaryKey, + ]) + ).includes(t) + ? function (...e) { + return t.apply(B(this), e), k(x.get(this)); + } + : function (...e) { + return k(t.apply(B(this), e)); + } + : function (e, ...s) { + const n = t.call(B(this), e, ...s); + return I.set(n, e.sort ? e.sort() : [e]), k(n); + }; + } + function T(t) { + return "function" == typeof t + ? O(t) + : (t instanceof IDBTransaction && + (function (t) { + if (L.has(t)) return; + const e = new Promise((e, s) => { + const n = () => { + t.removeEventListener("complete", r), + t.removeEventListener("error", i), + t.removeEventListener("abort", i); + }, + r = () => { + e(), n(); + }, + i = () => { + s(t.error || new DOMException("AbortError", "AbortError")), + n(); + }; + t.addEventListener("complete", r), + t.addEventListener("error", i), + t.addEventListener("abort", i); + }); + L.set(t, e); + })(t), + (e = t), + ( + D || + (D = [ + IDBDatabase, + IDBObjectStore, + IDBIndex, + IDBCursor, + IDBTransaction, + ]) + ).some((t) => e instanceof t) + ? new Proxy(t, N) + : t); + var e; + } + function k(t) { + if (t instanceof IDBRequest) + return (function (t) { + const e = new Promise((e, s) => { + const n = () => { + t.removeEventListener("success", r), + t.removeEventListener("error", i); + }, + r = () => { + e(k(t.result)), n(); + }, + i = () => { + s(t.error), n(); + }; + t.addEventListener("success", r), t.addEventListener("error", i); + }); + return ( + e + .then((e) => { + e instanceof IDBCursor && x.set(e, t); + }) + .catch(() => {}), + E.set(e, t), + e + ); + })(t); + if (C.has(t)) return C.get(t); + const e = T(t); + return e !== t && (C.set(t, e), E.set(e, t)), e; + } + const B = (t) => E.get(t); + const P = ["get", "getKey", "getAll", "getAllKeys", "count"], + M = ["put", "add", "delete", "clear"], + W = new Map(); + function j(t, e) { + if (!(t instanceof IDBDatabase) || e in t || "string" != typeof e) return; + if (W.get(e)) return W.get(e); + const s = e.replace(/FromIndex$/, ""), + n = e !== s, + r = M.includes(s); + if ( + !(s in (n ? IDBIndex : IDBObjectStore).prototype) || + (!r && !P.includes(s)) + ) + return; + const i = async function (t, ...e) { + const i = this.transaction(t, r ? "readwrite" : "readonly"); + let a = i.store; + return ( + n && (a = a.index(e.shift())), + (await Promise.all([a[s](...e), r && i.done]))[0] + ); + }; + return W.set(e, i), i; + } + N = ((t) => + q({}, t, { + get: (e, s, n) => j(e, s) || t.get(e, s, n), + has: (e, s) => !!j(e, s) || t.has(e, s), + }))(N); + try { + self["workbox:expiration:6.5.4"] && _(); + } catch (t) {} + const S = "cache-entries", + K = (t) => { + const e = new URL(t, location.href); + return (e.hash = ""), e.href; + }; + class A { + constructor(t) { + (this._ = null), (this.L = t); + } + I(t) { + const e = t.createObjectStore(S, { keyPath: "id" }); + e.createIndex("cacheName", "cacheName", { unique: !1 }), + e.createIndex("timestamp", "timestamp", { unique: !1 }); + } + C(t) { + this.I(t), + this.L && + (function (t, { blocked: e } = {}) { + const s = indexedDB.deleteDatabase(t); + e && s.addEventListener("blocked", (t) => e(t.oldVersion, t)), + k(s).then(() => {}); + })(this.L); + } + async setTimestamp(t, e) { + const s = { + url: (t = K(t)), + timestamp: e, + cacheName: this.L, + id: this.N(t), + }, + n = (await this.getDb()).transaction(S, "readwrite", { + durability: "relaxed", + }); + await n.store.put(s), await n.done; + } + async getTimestamp(t) { + const e = await this.getDb(), + s = await e.get(S, this.N(t)); + return null == s ? void 0 : s.timestamp; + } + async expireEntries(t, e) { + const s = await this.getDb(); + let n = await s + .transaction(S) + .store.index("timestamp") + .openCursor(null, "prev"); + const r = []; + let i = 0; + for (; n; ) { + const s = n.value; + s.cacheName === this.L && + ((t && s.timestamp < t) || (e && i >= e) ? r.push(n.value) : i++), + (n = await n.continue()); + } + const a = []; + for (const t of r) await s.delete(S, t.id), a.push(t.url); + return a; + } + N(t) { + return this.L + "|" + K(t); + } + async getDb() { + return ( + this._ || + (this._ = await (function ( + t, + e, + { blocked: s, upgrade: n, blocking: r, terminated: i } = {}, + ) { + const a = indexedDB.open(t, e), + o = k(a); + return ( + n && + a.addEventListener("upgradeneeded", (t) => { + n( + k(a.result), + t.oldVersion, + t.newVersion, + k(a.transaction), + t, + ); + }), + s && + a.addEventListener("blocked", (t) => + s(t.oldVersion, t.newVersion, t), + ), + o + .then((t) => { + i && t.addEventListener("close", () => i()), + r && + t.addEventListener("versionchange", (t) => + r(t.oldVersion, t.newVersion, t), + ); + }) + .catch(() => {}), + o + ); + })("workbox-expiration", 1, { upgrade: this.C.bind(this) })), + this._ + ); + } + } + class F { + constructor(t, e = {}) { + (this.O = !1), + (this.T = !1), + (this.k = e.maxEntries), + (this.B = e.maxAgeSeconds), + (this.P = e.matchOptions), + (this.L = t), + (this.M = new A(t)); + } + async expireEntries() { + if (this.O) return void (this.T = !0); + this.O = !0; + const t = this.B ? Date.now() - 1e3 * this.B : 0, + e = await this.M.expireEntries(t, this.k), + s = await self.caches.open(this.L); + for (const t of e) await s.delete(t, this.P); + (this.O = !1), this.T && ((this.T = !1), b(this.expireEntries())); + } + async updateTimestamp(t) { + await this.M.setTimestamp(t, Date.now()); + } + async isURLExpired(t) { + if (this.B) { + const e = await this.M.getTimestamp(t), + s = Date.now() - 1e3 * this.B; + return void 0 === e || e < s; + } + return !1; + } + async delete() { + (this.T = !1), await this.M.expireEntries(1 / 0); + } + } + try { + self["workbox:range-requests:6.5.4"] && _(); + } catch (t) {} + async function H(t, e) { + try { + if (206 === e.status) return e; + const n = t.headers.get("range"); + if (!n) throw new s("no-range-header"); + const r = (function (t) { + const e = t.trim().toLowerCase(); + if (!e.startsWith("bytes=")) + throw new s("unit-must-be-bytes", { normalizedRangeHeader: e }); + if (e.includes(",")) + throw new s("single-range-only", { normalizedRangeHeader: e }); + const n = /(\d*)-(\d*)/.exec(e); + if (!n || (!n[1] && !n[2])) + throw new s("invalid-range-values", { normalizedRangeHeader: e }); + return { + start: "" === n[1] ? void 0 : Number(n[1]), + end: "" === n[2] ? void 0 : Number(n[2]), + }; + })(n), + i = await e.blob(), + a = (function (t, e, n) { + const r = t.size; + if ((n && n > r) || (e && e < 0)) + throw new s("range-not-satisfiable", { size: r, end: n, start: e }); + let i, a; + return ( + void 0 !== e && void 0 !== n + ? ((i = e), (a = n + 1)) + : void 0 !== e && void 0 === n + ? ((i = e), (a = r)) + : void 0 !== n && void 0 === e && ((i = r - n), (a = r)), + { start: i, end: a } + ); + })(i, r.start, r.end), + o = i.slice(a.start, a.end), + c = o.size, + h = new Response(o, { + status: 206, + statusText: "Partial Content", + headers: e.headers, + }); + return ( + h.headers.set("Content-Length", String(c)), + h.headers.set( + "Content-Range", + `bytes ${a.start}-${a.end - 1}/${i.size}`, + ), + h + ); + } catch (t) { + return new Response("", { + status: 416, + statusText: "Range Not Satisfiable", + }); + } + } + function $(t, e) { + const s = e(); + return t.waitUntil(s), s; + } + try { + self["workbox:precaching:6.5.4"] && _(); + } catch (t) {} + function z(t) { + if (!t) throw new s("add-to-cache-list-unexpected-type", { entry: t }); + if ("string" == typeof t) { + const e = new URL(t, location.href); + return { cacheKey: e.href, url: e.href }; + } + const { revision: e, url: n } = t; + if (!n) throw new s("add-to-cache-list-unexpected-type", { entry: t }); + if (!e) { + const t = new URL(n, location.href); + return { cacheKey: t.href, url: t.href }; + } + const r = new URL(n, location.href), + i = new URL(n, location.href); + return ( + r.searchParams.set("__WB_REVISION__", e), + { cacheKey: r.href, url: i.href } + ); + } + class G { + constructor() { + (this.updatedURLs = []), + (this.notUpdatedURLs = []), + (this.handlerWillStart = async ({ request: t, state: e }) => { + e && (e.originalRequest = t); + }), + (this.cachedResponseWillBeUsed = async ({ + event: t, + state: e, + cachedResponse: s, + }) => { + if ( + "install" === t.type && + e && + e.originalRequest && + e.originalRequest instanceof Request + ) { + const t = e.originalRequest.url; + s ? this.notUpdatedURLs.push(t) : this.updatedURLs.push(t); + } + return s; + }); + } + } + class V { + constructor({ precacheController: t }) { + (this.cacheKeyWillBeUsed = async ({ request: t, params: e }) => { + const s = + (null == e ? void 0 : e.cacheKey) || this.W.getCacheKeyForURL(t.url); + return s ? new Request(s, { headers: t.headers }) : t; + }), + (this.W = t); + } + } + let J, Q; + async function X(t, e) { + let n = null; + if (t.url) { + n = new URL(t.url).origin; + } + if (n !== self.location.origin) + throw new s("cross-origin-copy-response", { origin: n }); + const r = t.clone(), + i = { + headers: new Headers(r.headers), + status: r.status, + statusText: r.statusText, + }, + a = e ? e(i) : i, + o = (function () { + if (void 0 === J) { + const t = new Response(""); + if ("body" in t) + try { + new Response(t.body), (J = !0); + } catch (t) { + J = !1; + } + J = !1; + } + return J; + })() + ? r.body + : await r.blob(); + return new Response(o, a); + } + class Y extends R { + constructor(t = {}) { + (t.cacheName = w(t.cacheName)), + super(t), + (this.j = !1 !== t.fallbackToNetwork), + this.plugins.push(Y.copyRedirectedCacheableResponsesPlugin); + } + async U(t, e) { + const s = await e.cacheMatch(t); + return ( + s || + (e.event && "install" === e.event.type + ? await this.S(t, e) + : await this.K(t, e)) + ); + } + async K(t, e) { + let n; + const r = e.params || {}; + if (!this.j) + throw new s("missing-precache-entry", { + cacheName: this.cacheName, + url: t.url, + }); + { + const s = r.integrity, + i = t.integrity, + a = !i || i === s; + (n = await e.fetch( + new Request(t, { integrity: "no-cors" !== t.mode ? i || s : void 0 }), + )), + s && + a && + "no-cors" !== t.mode && + (this.A(), await e.cachePut(t, n.clone())); + } + return n; + } + async S(t, e) { + this.A(); + const n = await e.fetch(t); + if (!(await e.cachePut(t, n.clone()))) + throw new s("bad-precaching-response", { + url: t.url, + status: n.status, + }); + return n; + } + A() { + let t = null, + e = 0; + for (const [s, n] of this.plugins.entries()) + n !== Y.copyRedirectedCacheableResponsesPlugin && + (n === Y.defaultPrecacheCacheabilityPlugin && (t = s), + n.cacheWillUpdate && e++); + 0 === e + ? this.plugins.push(Y.defaultPrecacheCacheabilityPlugin) + : e > 1 && null !== t && this.plugins.splice(t, 1); + } + } + (Y.defaultPrecacheCacheabilityPlugin = { + cacheWillUpdate: async ({ response: t }) => + !t || t.status >= 400 ? null : t, + }), + (Y.copyRedirectedCacheableResponsesPlugin = { + cacheWillUpdate: async ({ response: t }) => + t.redirected ? await X(t) : t, + }); + class Z { + constructor({ + cacheName: t, + plugins: e = [], + fallbackToNetwork: s = !0, + } = {}) { + (this.F = new Map()), + (this.H = new Map()), + (this.$ = new Map()), + (this.u = new Y({ + cacheName: w(t), + plugins: [...e, new V({ precacheController: this })], + fallbackToNetwork: s, + })), + (this.install = this.install.bind(this)), + (this.activate = this.activate.bind(this)); + } + get strategy() { + return this.u; + } + precache(t) { + this.addToCacheList(t), + this.G || + (self.addEventListener("install", this.install), + self.addEventListener("activate", this.activate), + (this.G = !0)); + } + addToCacheList(t) { + const e = []; + for (const n of t) { + "string" == typeof n + ? e.push(n) + : n && void 0 === n.revision && e.push(n.url); + const { cacheKey: t, url: r } = z(n), + i = "string" != typeof n && n.revision ? "reload" : "default"; + if (this.F.has(r) && this.F.get(r) !== t) + throw new s("add-to-cache-list-conflicting-entries", { + firstEntry: this.F.get(r), + secondEntry: t, + }); + if ("string" != typeof n && n.integrity) { + if (this.$.has(t) && this.$.get(t) !== n.integrity) + throw new s("add-to-cache-list-conflicting-integrities", { + url: r, + }); + this.$.set(t, n.integrity); + } + if ((this.F.set(r, t), this.H.set(r, i), e.length > 0)) { + const t = `Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`; + console.warn(t); + } + } + } + install(t) { + return $(t, async () => { + const e = new G(); + this.strategy.plugins.push(e); + for (const [e, s] of this.F) { + const n = this.$.get(s), + r = this.H.get(e), + i = new Request(e, { + integrity: n, + cache: r, + credentials: "same-origin", + }); + await Promise.all( + this.strategy.handleAll({ + params: { cacheKey: s }, + request: i, + event: t, + }), + ); + } + const { updatedURLs: s, notUpdatedURLs: n } = e; + return { updatedURLs: s, notUpdatedURLs: n }; + }); + } + activate(t) { + return $(t, async () => { + const t = await self.caches.open(this.strategy.cacheName), + e = await t.keys(), + s = new Set(this.F.values()), + n = []; + for (const r of e) s.has(r.url) || (await t.delete(r), n.push(r.url)); + return { deletedURLs: n }; + }); + } + getURLsToCacheKeys() { + return this.F; + } + getCachedURLs() { + return [...this.F.keys()]; + } + getCacheKeyForURL(t) { + const e = new URL(t, location.href); + return this.F.get(e.href); + } + getIntegrityForCacheKey(t) { + return this.$.get(t); + } + async matchPrecache(t) { + const e = t instanceof Request ? t.url : t, + s = this.getCacheKeyForURL(e); + if (s) { + return (await self.caches.open(this.strategy.cacheName)).match(s); + } + } + createHandlerBoundToURL(t) { + const e = this.getCacheKeyForURL(t); + if (!e) throw new s("non-precached-url", { url: t }); + return (s) => ( + (s.request = new Request(t)), + (s.params = Object.assign({ cacheKey: e }, s.params)), + this.strategy.handle(s) + ); + } + } + const tt = () => (Q || (Q = new Z()), Q); + class et extends r { + constructor(t, e) { + super(({ request: s }) => { + const n = t.getURLsToCacheKeys(); + for (const r of (function* ( + t, + { + ignoreURLParametersMatching: e = [/^utm_/, /^fbclid$/], + directoryIndex: s = "index.html", + cleanURLs: n = !0, + urlManipulation: r, + } = {}, + ) { + const i = new URL(t, location.href); + (i.hash = ""), yield i.href; + const a = (function (t, e = []) { + for (const s of [...t.searchParams.keys()]) + e.some((t) => t.test(s)) && t.searchParams.delete(s); + return t; + })(i, e); + if ((yield a.href, s && a.pathname.endsWith("/"))) { + const t = new URL(a.href); + (t.pathname += s), yield t.href; + } + if (n) { + const t = new URL(a.href); + (t.pathname += ".html"), yield t.href; + } + if (r) { + const t = r({ url: i }); + for (const e of t) yield e.href; + } + })(s.url, e)) { + const e = n.get(r); + if (e) { + return { cacheKey: e, integrity: t.getIntegrityForCacheKey(e) }; + } + } + }, t.strategy); + } + } + (t.CacheFirst = class extends R { + async U(t, e) { + let n, + r = await e.cacheMatch(t); + if (!r) + try { + r = await e.fetchAndCachePut(t); + } catch (t) { + t instanceof Error && (n = t); + } + if (!r) throw new s("no-response", { url: t.url, error: n }); + return r; + } + }), + (t.ExpirationPlugin = class { + constructor(t = {}) { + (this.cachedResponseWillBeUsed = async ({ + event: t, + request: e, + cacheName: s, + cachedResponse: n, + }) => { + if (!n) return null; + const r = this.V(n), + i = this.J(s); + b(i.expireEntries()); + const a = i.updateTimestamp(e.url); + if (t) + try { + t.waitUntil(a); + } catch (t) {} + return r ? n : null; + }), + (this.cacheDidUpdate = async ({ cacheName: t, request: e }) => { + const s = this.J(t); + await s.updateTimestamp(e.url), await s.expireEntries(); + }), + (this.X = t), + (this.B = t.maxAgeSeconds), + (this.Y = new Map()), + t.purgeOnQuotaError && + (function (t) { + g.add(t); + })(() => this.deleteCacheAndMetadata()); + } + J(t) { + if (t === d()) throw new s("expire-custom-caches-only"); + let e = this.Y.get(t); + return e || ((e = new F(t, this.X)), this.Y.set(t, e)), e; + } + V(t) { + if (!this.B) return !0; + const e = this.Z(t); + if (null === e) return !0; + return e >= Date.now() - 1e3 * this.B; + } + Z(t) { + if (!t.headers.has("date")) return null; + const e = t.headers.get("date"), + s = new Date(e).getTime(); + return isNaN(s) ? null : s; + } + async deleteCacheAndMetadata() { + for (const [t, e] of this.Y) + await self.caches.delete(t), await e.delete(); + this.Y = new Map(); + } + }), + (t.NetworkFirst = class extends R { + constructor(t = {}) { + super(t), + this.plugins.some((t) => "cacheWillUpdate" in t) || + this.plugins.unshift(u), + (this.tt = t.networkTimeoutSeconds || 0); + } + async U(t, e) { + const n = [], + r = []; + let i; + if (this.tt) { + const { id: s, promise: a } = this.et({ + request: t, + logs: n, + handler: e, + }); + (i = s), r.push(a); + } + const a = this.st({ timeoutId: i, request: t, logs: n, handler: e }); + r.push(a); + const o = await e.waitUntil( + (async () => (await e.waitUntil(Promise.race(r))) || (await a))(), + ); + if (!o) throw new s("no-response", { url: t.url }); + return o; + } + et({ request: t, logs: e, handler: s }) { + let n; + return { + promise: new Promise((e) => { + n = setTimeout(async () => { + e(await s.cacheMatch(t)); + }, 1e3 * this.tt); + }), + id: n, + }; + } + async st({ timeoutId: t, request: e, logs: s, handler: n }) { + let r, i; + try { + i = await n.fetchAndCachePut(e); + } catch (t) { + t instanceof Error && (r = t); + } + return ( + t && clearTimeout(t), (!r && i) || (i = await n.cacheMatch(e)), i + ); + } + }), + (t.RangeRequestsPlugin = class { + constructor() { + this.cachedResponseWillBeUsed = async ({ + request: t, + cachedResponse: e, + }) => (e && t.headers.has("range") ? await H(t, e) : e); + } + }), + (t.StaleWhileRevalidate = class extends R { + constructor(t = {}) { + super(t), + this.plugins.some((t) => "cacheWillUpdate" in t) || + this.plugins.unshift(u); + } + async U(t, e) { + const n = e.fetchAndCachePut(t).catch(() => {}); + e.waitUntil(n); + let r, + i = await e.cacheMatch(t); + if (i); + else + try { + i = await n; + } catch (t) { + t instanceof Error && (r = t); + } + if (!i) throw new s("no-response", { url: t.url, error: r }); + return i; + } + }), + (t.cleanupOutdatedCaches = function () { + self.addEventListener("activate", (t) => { + const e = w(); + t.waitUntil( + (async (t, e = "-precache-") => { + const s = (await self.caches.keys()).filter( + (s) => + s.includes(e) && s.includes(self.registration.scope) && s !== t, + ); + return await Promise.all(s.map((t) => self.caches.delete(t))), s; + })(e).then((t) => {}), + ); + }); + }), + (t.clientsClaim = function () { + self.addEventListener("activate", () => self.clients.claim()); + }), + (t.precacheAndRoute = function (t, e) { + !(function (t) { + tt().precache(t); + })(t), + (function (t) { + const e = tt(); + h(new et(e, t)); + })(e); + }), + (t.registerRoute = h); +});