@iaforged/context-code 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (()=>{var t,e,s=Object.defineProperty,a=Object.defineProperties,i=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,a)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,__spreadValues=(t,e)=>{for(var s in e||(e={}))r.call(e,s)&&__defNormalProp(t,s,e[s]);if(n)for(var s of n(e))h.call(e,s)&&__defNormalProp(t,s,e[s]);return t},__spreadProps=(t,e)=>a(t,i(e)),__publicField=(t,e,s)=>(__defNormalProp(t,"symbol"!=typeof e?e+"":e,s),s),o=class{constructor(t,e){__publicField(this,"original"),__publicField(this,"cacheNamePrefix"),this.original=t,this.cacheNamePrefix=e}delete(t){return this.original.delete(`${this.cacheNamePrefix}:${t}`)}has(t){return this.original.has(`${this.cacheNamePrefix}:${t}`)}async keys(){const t=`${this.cacheNamePrefix}:`;return(await this.original.keys()).filter(e=>e.startsWith(t)).map(e=>e.slice(t.length))}match(t,e){return this.original.match(t,e)}async open(t){const e=await this.original.open(`${this.cacheNamePrefix}:${t}`);return Object.assign(e,{name:t})}},c=class{constructor(t,e){__publicField(this,"table"),__publicField(this,"key"),this.table=t,this.key=e}},l=class{constructor(t,e,s,a){__publicField(this,"name"),__publicField(this,"cache"),__publicField(this,"adapter"),__publicField(this,"cacheQueryOptions"),__publicField(this,"cacheName"),this.name=t,this.cache=e,this.adapter=s,this.cacheQueryOptions=a,this.cacheName=this.cache.name}request(t){return this.adapter.newRequest("/"+t)}delete(t){return this.cache.delete(this.request(t),this.cacheQueryOptions)}keys(){return this.cache.keys().then(t=>t.map(t=>t.url.slice(1)))}read(t){return this.cache.match(this.request(t),this.cacheQueryOptions).then(e=>void 0===e?Promise.reject(new c(this.name,t)):e.json())}write(t,e){return this.cache.put(this.request(t),this.adapter.newResponse(JSON.stringify(e)))}};(e=t||(t={}))[e.NOT_CACHED=0]="NOT_CACHED",e[e.CACHED_BUT_UNUSED=1]="CACHED_BUT_UNUSED",e[e.CACHED=2]="CACHED";var u=class extends Error{constructor(){super(...arguments),__publicField(this,"isCritical",!0)}};function errorToString(t){return t instanceof Error?`${t.message}\n${t.stack}`:`${t}`}var d,p,g=class extends u{constructor(){super(...arguments),__publicField(this,"isUnrecoverableState",!0)}};function sha1(t){const e=t,s=function(t,e){const s=t.length+3>>>2,a=[];for(let i=0;i<s;i++)a[i]=wordAt(t,4*i,e);return a}(e,d.Big);return _sha1(s,8*e.length)}function sha1Binary(t){const e=function(t,e){const s=t.byteLength+3>>>2,a=[],i=new Uint8Array(t);for(let t=0;t<s;t++)a[t]=wordAt(i,4*t,e);return a}(t,d.Big);return _sha1(e,8*t.byteLength)}function _sha1(t,e){const s=[];let[a,i,n,r,h]=[1732584193,4023233417,2562383102,271733878,3285377520];t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(let e=0;e<t.length;e+=16){const[o,c,l,u,d]=[a,i,n,r,h];for(let o=0;o<80;o++){s[o]=o<16?t[e+o]:rol32(s[o-3]^s[o-8]^s[o-14]^s[o-16],1);const[c,l]=fk(o,i,n,r),u=[rol32(a,5),c,h,l,s[o]].reduce(add32);[h,r,n,i,a]=[r,n,rol32(i,30),a,u]}[a,i,n,r,h]=[add32(a,o),add32(i,c),add32(n,l),add32(r,u),add32(h,d)]}return function(t){let e="";for(let s=0;s<t.length;s++){const a=byteAt(t,s);e+=(a>>>4).toString(16)+(15&a).toString(16)}return e.toLowerCase()}(function(t){return t.reduce((t,e)=>t+function(t){let e="";for(let s=0;s<4;s++)e+=String.fromCharCode(t>>>8*(3-s)&255);return e}(e),"")}([a,i,n,r,h]))}function add32(t,e){return function(t,e){const s=(65535&t)+(65535&e),a=(t>>>16)+(e>>>16)+(s>>>16);return[a>>>16,a<<16|65535&s]}(t,e)[1]}function rol32(t,e){return t<<e|t>>>32-e}function fk(t,e,s,a){return t<20?[e&s|~e&a,1518500249]:t<40?[e^s^a,1859775393]:t<60?[e&s|e&a|s&a,2400959708]:[e^s^a,3395469782]}function byteAt(t,e){return"string"==typeof t?e>=t.length?0:255&t.charCodeAt(e):e>=t.byteLength?0:255&t[e]}function wordAt(t,e,s){let a=0;if(s===d.Big)for(let s=0;s<4;s++)a+=byteAt(t,e+s)<<24-8*s;else for(let s=0;s<4;s++)a+=byteAt(t,e+s)<<8*s;return a}(p=d||(d={}))[p.Little=0]="Little",p[p.Big=1]="Big";var w=class{constructor(t,e,s,a,i,n,r){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"idle"),__publicField(this,"config"),__publicField(this,"hashes"),__publicField(this,"db"),__publicField(this,"inFlightRequests",new Map),__publicField(this,"urls",[]),__publicField(this,"patterns",[]),__publicField(this,"cache"),__publicField(this,"name"),__publicField(this,"metadata"),this.scope=t,this.adapter=e,this.idle=s,this.config=a,this.hashes=i,this.db=n,this.name=a.name,this.urls=a.urls.map(t=>e.normalizeUrl(t)),this.patterns=a.patterns.map(t=>new RegExp(t)),this.cache=e.caches.open(`${r}:${a.name}:cache`),this.metadata=this.db.open(`${r}:${a.name}:meta`,a.cacheQueryOptions)}async cacheStatus(e){const s=await this.cache,a=await this.metadata,i=this.adapter.newRequest(e);if(void 0===await s.match(i,this.config.cacheQueryOptions))return t.NOT_CACHED;try{if(!(await a.read(i.url)).used)return t.CACHED_BUT_UNUSED}catch(t){}return t.CACHED}async getCacheNames(){const[t,e]=await Promise.all([this.cache,this.metadata]);return[t.name,e.cacheName]}async handleFetch(t,e){const s=this.adapter.normalizeUrl(t.url);if(-1!==this.urls.indexOf(s)||this.patterns.some(t=>t.test(s))){const e=await this.cache;let a;try{a=await e.match(t,this.config.cacheQueryOptions)}catch(t){throw new u(`Cache is throwing while looking for a match: ${t}`)}if(void 0!==a)return this.hashes.has(s)||await this.needToRevalidate(t,a)&&this.idle.schedule(`revalidate(${e.name}): ${t.url}`,async()=>{await this.fetchAndCacheOnce(t)}),a;return(await this.fetchAndCacheOnce(this.newRequestWithMetadata(t.url,t))).clone()}return null}async needToRevalidate(t,e){if(e.headers.has("Cache-Control")){const s=e.headers.get("Cache-Control").split(",").map(t=>t.trim()).map(t=>t.split("="));s.forEach(t=>t[0]=t[0].toLowerCase());const a=s.find(t=>"max-age"===t[0]),i=a?a[1]:void 0;if(!i)return!0;try{const s=1e3*parseInt(i);let a;try{const e=await this.metadata;a=(await e.read(t.url)).ts}catch(t){const s=e.headers.get("Date");if(null===s)return!0;a=Date.parse(s)}const n=this.adapter.time-a;return n<0||n>s}catch(t){return!0}}else{if(!e.headers.has("Expires"))return!0;{const t=e.headers.get("Expires");try{return this.adapter.time>Date.parse(t)}catch(t){return!0}}}}async fetchFromCacheOnly(t){const e=await this.cache,s=await this.metadata,a=this.adapter.newRequest(t),i=await e.match(a,this.config.cacheQueryOptions);if(void 0===i)return null;let n;try{n=await s.read(a.url)}catch(t){}return{response:i,metadata:n}}async unhashedResources(){const t=await this.cache;return(await t.keys()).map(t=>this.adapter.normalizeUrl(t.url)).filter(t=>!this.hashes.has(t))}async fetchAndCacheOnce(t,e=!0){if(this.inFlightRequests.has(t.url))return this.inFlightRequests.get(t.url);const s=this.fetchFromNetwork(t);this.inFlightRequests.set(t.url,s);try{const a=await s;if(!a.ok)throw new Error(`Response not Ok (fetchAndCacheOnce): request for ${t.url} returned response ${a.status} ${a.statusText}`);try{const s=await this.cache;if(await s.put(t,a.clone()),!this.hashes.has(this.adapter.normalizeUrl(t.url))){const s={ts:this.adapter.time,used:e},a=await this.metadata;await a.write(t.url,s)}return a}catch(e){throw new u(`Failed to update the caches for request to '${t.url}' (fetchAndCacheOnce): ${errorToString(e)}`)}}finally{this.inFlightRequests.delete(t.url)}}async fetchFromNetwork(t,e=3){const s=await this.cacheBustedFetchFromNetwork(t);if(s.redirected&&s.url){if(0===e)throw new u(`Response hit redirect limit (fetchFromNetwork): request redirected too many times, next is ${s.url}`);return this.fetchFromNetwork(this.newRequestWithMetadata(s.url,t),e-1)}return s}async cacheBustedFetchFromNetwork(t){const e=this.adapter.normalizeUrl(t.url);if(this.hashes.has(e)){const s=this.hashes.get(e);let a=await this.safeFetch(t),i=a.ok;if(i){i=sha1Binary(await a.clone().arrayBuffer())!==s}if(i){const e=this.newRequestWithMetadata(this.cacheBust(t.url),t);if(a=await this.safeFetch(e),a.ok){const e=sha1Binary(await a.clone().arrayBuffer());if(s!==e)throw new u(`Hash mismatch (cacheBustedFetchFromNetwork): ${t.url}: expected ${s}, got ${e} (after cache busting)`)}}if(!a.ok&&404===a.status)throw new g(`Failed to retrieve hashed resource from the server. (AssetGroup: ${this.config.name} | URL: ${e})`);return a}return this.safeFetch(t)}async maybeUpdate(t,e,s){const a=this.adapter.normalizeUrl(e.url);if(this.hashes.has(a)){const i=this.hashes.get(a),n=await t.lookupResourceWithHash(a,i);if(null!==n)return await s.put(e,n),!0}return!1}newRequestWithMetadata(t,e){return this.adapter.newRequest(t,{headers:e.headers})}cacheBust(t){return t+(-1===t.indexOf("?")?"?":"&")+"ngsw-cache-bust="+Math.random()}async safeFetch(t){try{return await this.scope.fetch(t)}catch(t){return this.adapter.newResponse("",{status:504,statusText:"Gateway Timeout"})}}},f=class extends w{async initializeFully(t){const e=await this.cache;if(await this.urls.reduce(async(s,a)=>{await s;const i=this.adapter.newRequest(a);let n=!1;try{n=void 0!==await e.match(i,this.config.cacheQueryOptions)}catch(t){throw new u(`Cache is throwing while looking for a match in a PrefetchAssetGroup: ${t}`)}n||void 0!==t&&await this.maybeUpdate(t,i,e)||await this.fetchAndCacheOnce(i,!1)},Promise.resolve()),void 0!==t){const s=await this.metadata;await(await t.previouslyCachedResources()).filter(t=>-1!==this.urls.indexOf(t)||this.patterns.some(e=>e.test(t))).reduce(async(a,i)=>{await a;const n=this.adapter.newRequest(i);if(void 0!==await e.match(n,this.config.cacheQueryOptions))return;const r=await t.lookupResourceWithoutHash(i);null!==r&&void 0!==r.metadata&&(await e.put(n,r.response),await s.write(n.url,__spreadProps(__spreadValues({},r.metadata),{used:!1})))},Promise.resolve())}}},m=class extends w{async initializeFully(e){if(void 0===e)return;const s=await this.cache;await this.urls.reduce(async(a,i)=>{await a;const n=this.adapter.newRequest(i);let r=!1;try{r=void 0!==await s.match(n,this.config.cacheQueryOptions)}catch(t){throw new u(`Cache is throwing while looking for a match in a LazyAssetGroup: ${t}`)}if(r)return;const h=await this.maybeUpdate(e,n,s);if("prefetch"===this.config.updateMode&&!h){if(await e.recentCacheStatus(i)!==t.CACHED)return;await this.fetchAndCacheOnce(n,!1)}},Promise.resolve())}},y=class{constructor(t){__publicField(this,"state"),void 0===t&&(t={head:null,tail:null,map:{},count:0}),this.state=t}get size(){return this.state.count}pop(){if(null===this.state.tail)return null;const t=this.state.tail;return this.remove(t),t}remove(t){const e=this.state.map[t];if(void 0===e)return!1;if(this.state.head===t){if(null===e.next)return this.state.head=null,this.state.tail=null,this.state.map={},this.state.count=0,!0;const s=this.state.map[e.next];return s.previous=null,this.state.head=s.url,e.next=null,delete this.state.map[t],this.state.count--,!0}return this.state.map[e.previous].next=e.next,null!==e.next?this.state.map[e.next].previous=e.previous:this.state.tail=e.previous,e.next=null,e.previous=null,delete this.state.map[t],this.state.count--,!0}accessed(t){if(this.state.head===t)return;const e=this.state.map[t]||{url:t,next:null,previous:null};void 0!==this.state.map[t]&&this.remove(t),null!==this.state.head&&(this.state.map[this.state.head].previous=t),e.next=this.state.head,this.state.head=t,null===this.state.tail&&(this.state.tail=t),this.state.map[t]=e,this.state.count++}},v=class{constructor(t,e,s,a,i,n){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"config"),__publicField(this,"db"),__publicField(this,"debugHandler"),__publicField(this,"patterns"),__publicField(this,"cache"),__publicField(this,"_lru",null),__publicField(this,"lruTable"),__publicField(this,"ageTable"),this.scope=t,this.adapter=e,this.config=s,this.db=a,this.debugHandler=i,this.patterns=s.patterns.map(t=>new RegExp(t)),this.cache=e.caches.open(`${n}:${s.name}:cache`),this.lruTable=this.db.open(`${n}:${s.name}:lru`,s.cacheQueryOptions),this.ageTable=this.db.open(`${n}:${s.name}:age`,s.cacheQueryOptions)}async lru(){if(null===this._lru){const t=await this.lruTable;try{this._lru=new y(await t.read("lru"))}catch(t){this._lru=new y}}return this._lru}async syncLru(){if(null===this._lru)return;const t=await this.lruTable;try{return t.write("lru",this._lru.state)}catch(t){this.debugHandler.log(t,`DataGroup(${this.config.name}@${this.config.version}).syncLru()`)}}async handleFetch(t,e){if(!this.patterns.some(e=>e.test(t.url)))return null;const s=await this.lru();switch(t.method){case"OPTIONS":return null;case"GET":case"HEAD":switch(this.config.strategy){case"freshness":return this.handleFetchWithFreshness(t,e,s);case"performance":return this.handleFetchWithPerformance(t,e,s);default:throw new Error(`Unknown strategy: ${this.config.strategy}`)}default:return s.remove(t.url)&&await this.clearCacheForUrl(t.url),await this.syncLru(),this.safeFetch(t)}}async handleFetchWithPerformance(t,e,s){var a;const i=null!=(a=this.config.cacheOpaqueResponses)&&a;let n=null;const r=await this.loadFromCache(t,s);if(null!==r&&(n=r.res,void 0!==this.config.refreshAheadMs&&r.age>=this.config.refreshAheadMs&&e.waitUntil(this.safeCacheResponse(t,this.safeFetch(t),s,i))),null!==n)return n;const[h,o]=this.networkFetchWithTimeout(t);return n=await h,void 0===n?(n=this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"}),e.waitUntil(this.safeCacheResponse(t,o,s,i))):await this.safeCacheResponse(t,n,s,i),n}async handleFetchWithFreshness(t,e,s){var a;const i=null==(a=this.config.cacheOpaqueResponses)||a,[n,r]=this.networkFetchWithTimeout(t);let h;try{h=await n}catch(t){h=void 0}if(void 0===h){e.waitUntil(this.safeCacheResponse(t,r,s,i));const a=await this.loadFromCache(t,s);h=null!==a?a.res:null}else await this.safeCacheResponse(t,h,s,i);return null!==h?h:r}networkFetchWithTimeout(t){if(void 0!==this.config.timeoutMs){const e=this.scope.fetch(t),s=(async()=>{try{return await e}catch(t){return this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"})}})(),a=(async()=>{try{return await e}catch(t){return}})(),i=this.adapter.timeout(this.config.timeoutMs);return[Promise.race([a,i]),s]}{const e=this.safeFetch(t);return[e,e]}}async safeCacheResponse(t,e,s,a){try{const i=await e;try{await this.cacheResponse(t,i,s,a)}catch(e){this.debugHandler.log(e,`DataGroup(${this.config.name}@${this.config.version}).safeCacheResponse(${t.url}, status: ${i.status})`)}}catch(t){}}async loadFromCache(t,e){const s=await this.cache;let a=await s.match(t,this.config.cacheQueryOptions);if(void 0!==a){try{const s=await this.ageTable,i=this.adapter.time-(await s.read(t.url)).age;if(i<=this.config.maxAge)return e.accessed(t.url),{res:a,age:i}}catch(t){}e.remove(t.url),await this.clearCacheForUrl(t.url),await this.syncLru()}return null}async cacheResponse(t,e,s,a=!1){if(!(e.ok||a&&"opaque"===e.type))return;if(s.size>=this.config.maxSize){const t=s.pop();null!==t&&await this.clearCacheForUrl(t)}s.accessed(t.url),await(await this.cache).put(t,e.clone());const i=await this.ageTable;await i.write(t.url,{age:this.adapter.time}),await this.syncLru()}async cleanup(){await Promise.all([this.cache.then(t=>this.adapter.caches.delete(t.name)),this.ageTable.then(t=>this.db.delete(t.name)),this.lruTable.then(t=>this.db.delete(t.name))])}async getCacheNames(){const[t,e,s]=await Promise.all([this.cache,this.ageTable,this.lruTable]);return[t.name,e.cacheName,s.cacheName]}async clearCacheForUrl(t){const[e,s]=await Promise.all([this.cache,this.ageTable]);await Promise.all([e.delete(this.adapter.newRequest(t,{method:"GET"}),this.config.cacheQueryOptions),e.delete(this.adapter.newRequest(t,{method:"HEAD"}),this.config.cacheQueryOptions),s.delete(t)])}async safeFetch(t){try{return this.scope.fetch(t)}catch(t){return this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"})}}},b=class{constructor(t,e,s,a,i,n,r){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"database"),__publicField(this,"debugHandler"),__publicField(this,"manifest"),__publicField(this,"manifestHash"),__publicField(this,"hashTable",new Map),__publicField(this,"assetGroups"),__publicField(this,"dataGroups"),__publicField(this,"navigationUrls"),__publicField(this,"indexUrl"),__publicField(this,"_okay",!0),this.scope=t,this.adapter=e,this.database=s,this.debugHandler=i,this.manifest=n,this.manifestHash=r,this.indexUrl=this.adapter.normalizeUrl(this.manifest.index),Object.keys(n.hashTable).forEach(t=>{this.hashTable.set(e.normalizeUrl(t),n.hashTable[t])});const h=`${r}:assets`;this.assetGroups=(n.assetGroups||[]).map(i=>{switch(i.installMode){case"prefetch":return new f(t,e,a,i,this.hashTable,s,h);case"lazy":return new m(t,e,a,i,this.hashTable,s,h)}}),this.dataGroups=(n.dataGroups||[]).map(a=>new v(t,e,a,s,i,`${a.version}:data`));const o=n.navigationUrls.filter(t=>t.positive),c=n.navigationUrls.filter(t=>!t.positive);this.navigationUrls={include:o.map(t=>new RegExp(t.regex)),exclude:c.map(t=>new RegExp(t.regex))}}get okay(){return this._okay}async initializeFully(t){try{await this.assetGroups.reduce(async(e,s)=>(await e,s.initializeFully(t)),Promise.resolve())}catch(t){throw this._okay=!1,t}}async handleFetch(t,e){const s=await this.assetGroups.reduce(async(s,a)=>{const i=await s;return null!==i?i:a.handleFetch(t,e)},Promise.resolve(null));if(null!==s)return s;const a=await this.dataGroups.reduce(async(s,a)=>{const i=await s;return null!==i?i:a.handleFetch(t,e)},Promise.resolve(null));if(null!==a)return a;if(this.adapter.normalizeUrl(t.url)!==this.indexUrl&&this.isNavigationRequest(t)){if("freshness"===this.manifest.navigationRequestStrategy)try{return await this.scope.fetch(t)}catch(t){}return this.handleFetch(this.adapter.newRequest(this.indexUrl),e)}return null}isNavigationRequest(t){if("GET"!==t.method||"navigate"!==t.mode)return!1;if(!this.acceptsTextHtml(t))return!1;const e=this.scope.registration.scope.replace(/\/$/,""),s=(t.url.startsWith(e)?t.url.slice(e.length):t.url).replace(/[?#].*$/,"");return this.navigationUrls.include.some(t=>t.test(s))&&!this.navigationUrls.exclude.some(t=>t.test(s))}async lookupResourceWithHash(t,e){if(!this.hashTable.has(t))return null;if(this.hashTable.get(t)!==e)return null;const s=await this.lookupResourceWithoutHash(t);return s&&s.response}lookupResourceWithoutHash(t){return this.assetGroups.reduce(async(e,s)=>{const a=await e;return null!==a?a:s.fetchFromCacheOnly(t)},Promise.resolve(null))}previouslyCachedResources(){return this.assetGroups.reduce(async(t,e)=>(await t).concat(await e.unhashedResources()),Promise.resolve([]))}async recentCacheStatus(e){return this.assetGroups.reduce(async(s,a)=>{const i=await s;if(i===t.CACHED)return i;const n=await a.cacheStatus(e);return n===t.NOT_CACHED?i:n},Promise.resolve(t.NOT_CACHED))}async getCacheNames(){const t=await Promise.all([...this.assetGroups.map(t=>t.getCacheNames()),...this.dataGroups.map(t=>t.getCacheNames())]);return[].concat(...t)}get appData(){return this.manifest.appData||null}acceptsTextHtml(t){const e=t.headers.get("Accept");if(null===e)return!1;return e.split(",").some(t=>"text/html"===t.trim().toLowerCase())}},C=class{constructor(t,e){__publicField(this,"driver"),__publicField(this,"adapter"),__publicField(this,"debugLogA",[]),__publicField(this,"debugLogB",[]),this.driver=t,this.adapter=e}async handleFetch(t){const[e,s,a]=await Promise.all([this.driver.debugState(),this.driver.debugVersions(),this.driver.debugIdleState()]),i=`NGSW Debug Info:\n\nDriver version: 19.2.22\nDriver state: ${e.state} (${e.why})\nLatest manifest hash: ${e.latestHash||"none"}\nLast update check: ${this.since(e.lastUpdateCheck)}`,n=s.map(t=>`=== Version ${t.hash} ===\n\nClients: ${t.clients.join(", ")}`).join("\n\n"),r=`=== Idle Task Queue ===\nLast update tick: ${this.since(a.lastTrigger)}\nLast update run: ${this.since(a.lastRun)}\nTask queue:\n${a.queue.map(t=>" * "+t).join("\n")}\n\nDebug log:\n${this.formatDebugLog(this.debugLogB)}\n${this.formatDebugLog(this.debugLogA)}\n`;return this.adapter.newResponse(`${i}\n\n${n}\n\n${r}`,{headers:this.adapter.newHeaders({"Content-Type":"text/plain"})})}since(t){if(null===t)return"never";let e=this.adapter.time-t;const s=Math.floor(e/864e5);e%=864e5;const a=Math.floor(e/36e5);e%=36e5;const i=Math.floor(e/6e4);e%=6e4;const n=Math.floor(e/1e3),r=e%1e3;return(s>0?`${s}d`:"")+(a>0?`${a}h`:"")+(i>0?`${i}m`:"")+(n>0?`${n}s`:"")+(r>0?`${r}u`:"")}log(t,e=""){100===this.debugLogA.length&&(this.debugLogB=this.debugLogA,this.debugLogA=[]),"string"!=typeof t&&(t=this.errorToString(t)),this.debugLogA.push({value:t,time:this.adapter.time,context:e})}errorToString(t){return`${t.name}(${t.message}, ${t.stack})`}formatDebugLog(t){return t.map(t=>`[${this.since(t.time)}] ${t.value} ${t.context}`).join("\n")}},A=class{constructor(t,e,s,a){__publicField(this,"adapter"),__publicField(this,"delay"),__publicField(this,"maxDelay"),__publicField(this,"debug"),__publicField(this,"queue",[]),__publicField(this,"scheduled",null),__publicField(this,"empty",Promise.resolve()),__publicField(this,"emptyResolve",null),__publicField(this,"lastTrigger",null),__publicField(this,"lastRun",null),__publicField(this,"oldestScheduledAt",null),this.adapter=t,this.delay=e,this.maxDelay=s,this.debug=a}async trigger(){var t;if(this.lastTrigger=this.adapter.time,0===this.queue.length)return;null!==this.scheduled&&(this.scheduled.cancel=!0);const e={cancel:!1};this.scheduled=e;const s=this.adapter.time,a=Math.max(0,(null!=(t=this.oldestScheduledAt)?t:s)+this.maxDelay-s),i=Math.min(a,this.delay);await this.adapter.timeout(i),e.cancel||(this.scheduled=null,await this.execute())}async execute(){for(this.lastRun=this.adapter.time;this.queue.length>0;){const t=this.queue;this.queue=[],await t.reduce(async(t,e)=>{await t;try{await e.run()}catch(t){this.debug.log(t,`while running idle task ${e.desc}`)}},Promise.resolve())}null!==this.emptyResolve&&(this.emptyResolve(),this.emptyResolve=null),this.empty=Promise.resolve(),this.oldestScheduledAt=null}schedule(t,e){this.queue.push({desc:t,run:e}),null===this.emptyResolve&&(this.empty=new Promise(t=>{this.emptyResolve=t})),null===this.oldestScheduledAt&&(this.oldestScheduledAt=this.adapter.time)}get size(){return this.queue.length}get taskDescriptions(){return this.queue.map(t=>t.desc)}};function hashManifest(t){return sha1(JSON.stringify(t))}var E,R,$=["actions","badge","body","data","dir","icon","image","lang","renotify","requireInteraction","silent","tag","timestamp","title","vibrate"];(R=E||(E={}))[R.NORMAL=0]="NORMAL",R[R.EXISTING_CLIENTS_ONLY=1]="EXISTING_CLIENTS_ONLY",R[R.SAFE_MODE=2]="SAFE_MODE";var T=self,k=new class{constructor(t,e){__publicField(this,"scopeUrl"),__publicField(this,"caches"),__publicField(this,"origin"),this.scopeUrl=t;const s=this.parseUrl(this.scopeUrl);this.origin=s.origin,this.caches=new o(e,`ngsw:${s.path}`)}newRequest(t,e){return new Request(t,e)}newResponse(t,e){return new Response(t,e)}newHeaders(t){return new Headers(t)}isClient(t){return t instanceof Client}get time(){return Date.now()}normalizeUrl(t){const e=this.parseUrl(t,this.scopeUrl);return e.origin===this.origin?e.path:t}parseUrl(t,e){const s=e?new URL(t,e):new URL(t);return{origin:s.origin,path:s.pathname,search:s.search}}timeout(t){return new Promise(e=>{setTimeout(()=>e(),t)})}}(T.registration.scope,self.caches);new class{constructor(t,e,s){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"db"),__publicField(this,"state",E.NORMAL),__publicField(this,"stateMessage","(nominal)"),__publicField(this,"initialized",null),__publicField(this,"clientVersionMap",new Map),__publicField(this,"versions",new Map),__publicField(this,"latestHash",null),__publicField(this,"lastUpdateCheck",null),__publicField(this,"scheduledNavUpdateCheck",!1),__publicField(this,"loggedInvalidOnlyIfCachedRequest",!1),__publicField(this,"ngswStatePath"),__publicField(this,"idle"),__publicField(this,"debugger"),__publicField(this,"controlTable"),this.scope=t,this.adapter=e,this.db=s,this.controlTable=this.db.open("control"),this.ngswStatePath=this.adapter.parseUrl("ngsw/state",this.scope.registration.scope).path,this.scope.addEventListener("install",t=>{t.waitUntil(this.scope.skipWaiting())}),this.scope.addEventListener("activate",t=>{t.waitUntil((async()=>{await this.scope.clients.claim()})()),null!==this.scope.registration.active&&this.scope.registration.active.postMessage({action:"INITIALIZE"})}),this.scope.addEventListener("fetch",t=>this.onFetch(t)),this.scope.addEventListener("message",t=>this.onMessage(t)),this.scope.addEventListener("push",t=>this.onPush(t)),this.scope.addEventListener("notificationclick",t=>this.onClick(t)),this.debugger=new C(this,this.adapter),this.idle=new A(this.adapter,5e3,3e4,this.debugger)}onFetch(t){const e=t.request,s=this.scope.registration.scope,a=this.adapter.parseUrl(e.url,s);e.headers.has("ngsw-bypass")||/[?&]ngsw-bypass(?:[=&]|$)/i.test(a.search)||(a.path!==this.ngswStatePath?this.state!==E.SAFE_MODE?a.origin.startsWith("http:")&&s.startsWith("https:")?this.debugger.log(`Ignoring passive mixed content request: Driver.fetch(${e.url})`):"only-if-cached"!==e.cache||"same-origin"===e.mode?t.respondWith(this.handleFetch(t)):this.loggedInvalidOnlyIfCachedRequest||(this.loggedInvalidOnlyIfCachedRequest=!0,this.debugger.log("Ignoring invalid request: 'only-if-cached' can be set only with 'same-origin' mode",`Driver.fetch(${e.url}, cache: ${e.cache}, mode: ${e.mode})`)):t.waitUntil(this.idle.trigger()):t.respondWith(this.debugger.handleFetch(e)))}onMessage(t){if(this.state===E.SAFE_MODE)return;const e=t.data;e&&e.action&&t.waitUntil((async()=>{if("INITIALIZE"===e.action)return this.ensureInitialized(t);this.adapter.isClient(t.source)&&(await this.ensureInitialized(t),await this.handleMessage(e,t.source))})())}onPush(t){t.data&&t.waitUntil(this.handlePush(t.data.json()))}onClick(t){t.waitUntil(this.handleClick(t.notification,t.action))}async ensureInitialized(t){if(null!==this.initialized)return this.initialized;try{this.initialized=this.initialize(),await this.initialized}catch(t){throw this.state=E.SAFE_MODE,this.stateMessage=`Initialization failed due to error: ${errorToString(t)}`,t}finally{t.waitUntil(this.idle.trigger())}}async handleMessage(t,e){if(function(t){return"CHECK_FOR_UPDATES"===t.action}(t)){const s=this.checkForUpdate();await this.completeOperation(e,s,t.nonce)}else if(function(t){return"ACTIVATE_UPDATE"===t.action}(t)){const s=this.updateClient(e);await this.completeOperation(e,s,t.nonce)}}async handlePush(t){if(await this.broadcast({type:"PUSH",data:t}),!t.notification||!t.notification.title)return;const e=t.notification;let s={};$.filter(t=>e.hasOwnProperty(t)).forEach(t=>s[t]=e[t]),await this.scope.registration.showNotification(e.title,s)}async handleClick(t,e){var s,a,i;t.close();const n={};$.filter(e=>e in t).forEach(e=>n[e]=t[e]);const r=""===e||void 0===e?"default":e,h=null==(a=null==(s=null==t?void 0:t.data)?void 0:s.onActionClick)?void 0:a[r],o=new URL(null!=(i=null==h?void 0:h.url)?i:"",this.scope.registration.scope).href;switch(null==h?void 0:h.operation){case"openWindow":await this.scope.clients.openWindow(o);break;case"focusLastFocusedOrOpen":{let t=await this.getLastFocusedMatchingClient(this.scope);t?await(null==t?void 0:t.focus()):await this.scope.clients.openWindow(o);break}case"navigateLastFocusedOrOpen":{let t=await this.getLastFocusedMatchingClient(this.scope);t?(t=await t.navigate(o),await(null==t?void 0:t.focus())):await this.scope.clients.openWindow(o);break}case"sendRequest":await this.scope.fetch(o)}await this.broadcast({type:"NOTIFICATION_CLICK",data:{action:e,notification:n}})}async getLastFocusedMatchingClient(t){return(await t.clients.matchAll({type:"window"}))[0]}async completeOperation(t,e,s){const a={type:"OPERATION_COMPLETED",nonce:s};try{t.postMessage(__spreadProps(__spreadValues({},a),{result:await e}))}catch(e){t.postMessage(__spreadProps(__spreadValues({},a),{error:e.toString()}))}}async updateClient(t){const e=this.clientVersionMap.get(t.id);if(e===this.latestHash)return!1;let s;if(void 0!==e){const t=this.versions.get(e);s=this.mergeHashWithAppData(t.manifest,e)}this.clientVersionMap.set(t.id,this.latestHash),await this.sync();this.versions.get(this.latestHash);return!0}async handleFetch(t){try{await this.ensureInitialized(t)}catch(e){return this.safeFetch(t.request)}"navigate"!==t.request.mode||this.scheduledNavUpdateCheck||(this.scheduledNavUpdateCheck=!0,this.idle.schedule("check-updates-on-navigation",async()=>{this.scheduledNavUpdateCheck=!1,await this.checkForUpdate()}));const e=await this.assignVersion(t),s=void 0===(null==e?void 0:e.manifest.applicationMaxAge)||this.adapter.time-e.manifest.timestamp<e.manifest.applicationMaxAge;let a=null;try{if(null!==e&&s)try{a=await e.handleFetch(t.request,t)}catch(s){if(s.isUnrecoverableState&&await this.notifyClientsAboutUnrecoverableState(e,s.message),s.isCritical)return this.debugger.log(s,`Driver.handleFetch(version: ${e.manifestHash})`),await this.versionFailed(e,s),this.safeFetch(t.request);throw s}return null===a?this.safeFetch(t.request):a}finally{t.waitUntil(this.idle.trigger())}}async initialize(){const t=await this.controlTable;let e,s,a;try{if([e,s,a]=await Promise.all([t.read("manifests"),t.read("assignments"),t.read("latest")]),!this.versions.has(a.latest)&&!e.hasOwnProperty(a.latest))throw this.debugger.log(`Missing manifest for latest version hash ${a.latest}`,"initialize: read from DB"),new Error(`Missing manifest for latest hash ${a.latest}`);this.idle.schedule("init post-load (update)",async()=>{await this.checkForUpdate()})}catch(i){const n=await this.fetchLatestManifest(),r=hashManifest(n);e={[r]:n},s={},a={latest:r},await Promise.all([t.write("manifests",e),t.write("assignments",s),t.write("latest",a)])}if(this.idle.schedule("init post-load (cleanup)",async()=>{await this.cleanupCaches()}),Object.keys(e).forEach(t=>{const s=e[t];this.versions.has(t)||this.versions.set(t,new b(this.scope,this.adapter,this.db,this.idle,this.debugger,s,t))}),Object.keys(s).forEach(t=>{const e=s[t];this.versions.has(e)?this.clientVersionMap.set(t,e):(this.clientVersionMap.set(t,a.latest),this.debugger.log(`Unknown version ${e} mapped for client ${t}, using latest instead`,"initialize: map assignments"))}),this.latestHash=a.latest,!this.versions.has(a.latest))throw new Error(`Invariant violated (initialize): latest hash ${a.latest} has no known manifest`);await Promise.all(Object.keys(e).map(async t=>{try{await this.scheduleInitialization(this.versions.get(t))}catch(e){this.debugger.log(e,`initialize: schedule init of ${t}`)}}))}lookupVersionByHash(t,e="lookupVersionByHash"){if(!this.versions.has(t))throw new Error(`Invariant violated (${e}): want AppVersion for ${t} but not loaded`);return this.versions.get(t)}async assignVersion(t){const e="worker"===t.request.destination&&t.resultingClientId&&t.clientId,s=e?t.clientId:t.resultingClientId||t.clientId;if(s){if(this.clientVersionMap.has(s)){const a=this.clientVersionMap.get(s);let i=this.lookupVersionByHash(a,"assignVersion");if(this.state===E.NORMAL&&a!==this.latestHash&&i.isNavigationRequest(t.request)){if(null===this.latestHash)throw new Error("Invariant violated (assignVersion): latestHash was null");const t=await this.scope.clients.get(s);t&&await this.updateClient(t),i=this.lookupVersionByHash(this.latestHash,"assignVersion")}if(e)if(this.clientVersionMap.has(t.resultingClientId)){if(this.clientVersionMap.get(t.resultingClientId)!==a)throw new Error(`Version mismatch between worker client ${t.resultingClientId} and requesting client ${s}`)}else this.clientVersionMap.set(t.resultingClientId,a),await this.sync();return i}if(this.state!==E.NORMAL)return null;if(null===this.latestHash)throw new Error("Invariant violated (assignVersion): latestHash was null");if(e)if(this.clientVersionMap.has(t.resultingClientId)){if(this.clientVersionMap.get(t.resultingClientId)!==this.latestHash)throw new Error(`Version mismatch between worker client ${t.resultingClientId} and requesting client ${s}`)}else this.clientVersionMap.set(t.resultingClientId,this.latestHash);return this.clientVersionMap.set(s,this.latestHash),await this.sync(),this.lookupVersionByHash(this.latestHash,"assignVersion")}if(this.state!==E.NORMAL)return null;if(null===this.latestHash)throw new Error("Invariant violated (assignVersion): latestHash was null");return this.lookupVersionByHash(this.latestHash,"assignVersion")}async fetchLatestManifest(t=!1){const e=await this.safeFetch(this.adapter.newRequest("ngsw.json?ngsw-cache-bust="+Math.random()));if(!e.ok){if(404===e.status)await this.deleteAllCaches(),await this.scope.registration.unregister();else if((503===e.status||504===e.status)&&t)return null;throw new Error(`Manifest fetch failed! (status: ${e.status})`)}return this.lastUpdateCheck=this.adapter.time,e.json()}async deleteAllCaches(){const t=await this.adapter.caches.keys();await Promise.all(t.map(t=>this.adapter.caches.delete(t)))}async scheduleInitialization(t){const initialize=async()=>{try{await t.initializeFully()}catch(e){this.debugger.log(e,`initializeFully for ${t.manifestHash}`),await this.versionFailed(t,e)}};if(this.scope.registration.scope.indexOf("://localhost")>-1)return initialize();this.idle.schedule(`initialization(${t.manifestHash})`,initialize)}async versionFailed(t,e){const s=Array.from(this.versions.entries()).find(([e,s])=>s===t);if(void 0===s)return;const a=s[0];this.latestHash===a&&(this.state=E.EXISTING_CLIENTS_ONLY,this.stateMessage=`Degraded due to: ${errorToString(e)}`)}async setupUpdate(t,e){try{const s=new b(this.scope,this.adapter,this.db,this.idle,this.debugger,t,e);if(1!==t.configVersion)throw await this.deleteAllCaches(),await this.scope.registration.unregister(),new Error(`Invalid config version: expected 1, got ${t.configVersion}.`);await s.initializeFully(this),this.versions.set(e,s),this.latestHash=e,this.state===E.EXISTING_CLIENTS_ONLY&&(this.state=E.NORMAL,this.stateMessage="(nominal)"),await this.sync(),await this.notifyClientsAboutVersionReady(t,e)}catch(s){throw await this.notifyClientsAboutVersionInstallationFailed(t,e,s),s}}async checkForUpdate(){let t="(unknown)";try{const e=await this.fetchLatestManifest(!0);return null===e?(this.debugger.log("Check for update aborted. (Client or server offline.)"),!1):(t=hashManifest(e),this.versions.has(t)?(await this.notifyClientsAboutNoNewVersionDetected(e,t),!1):(await this.notifyClientsAboutVersionDetected(e,t),await this.setupUpdate(e,t),!0))}catch(e){return this.debugger.log(e,`Error occurred while updating to manifest ${t}`),this.state=E.EXISTING_CLIENTS_ONLY,this.stateMessage=`Degraded due to failed initialization: ${errorToString(e)}`,!1}}async sync(){const t=await this.controlTable,e={};this.versions.forEach((t,s)=>{e[s]=t.manifest});const s={};this.clientVersionMap.forEach((t,e)=>{s[e]=t});const a={latest:this.latestHash};await Promise.all([t.write("manifests",e),t.write("assignments",s),t.write("latest",a)])}async cleanupCaches(){try{const t=new Set((await this.scope.clients.matchAll()).map(t=>t.id)),e=Array.from(this.clientVersionMap.keys());e.filter(e=>!t.has(e)).forEach(t=>this.clientVersionMap.delete(t));const s=new Set(this.clientVersionMap.values());Array.from(this.versions.keys()).filter(t=>!s.has(t)&&t!==this.latestHash).forEach(t=>this.versions.delete(t)),await this.sync();const a=await this.adapter.caches.keys(),i=new Set(await this.getCacheNames()),n=a.filter(t=>!i.has(t));await Promise.all(n.map(t=>this.adapter.caches.delete(t)))}catch(t){this.debugger.log(t,"cleanupCaches")}}lookupResourceWithHash(t,e){return Array.from(this.versions.values()).reduce(async(s,a)=>null!==await s?s:a.lookupResourceWithHash(t,e),Promise.resolve(null))}async lookupResourceWithoutHash(t){await this.initialized;const e=this.versions.get(this.latestHash);return e?e.lookupResourceWithoutHash(t):null}async previouslyCachedResources(){await this.initialized;const t=this.versions.get(this.latestHash);return t?t.previouslyCachedResources():[]}async recentCacheStatus(e){const s=this.versions.get(this.latestHash);return s?s.recentCacheStatus(e):t.NOT_CACHED}mergeHashWithAppData(t,e){return{hash:e,appData:t.appData}}async notifyClientsAboutUnrecoverableState(t,e){const s=Array.from(this.versions.entries()).find(([e,s])=>s===t);if(void 0===s)return;const a=s[0],i=Array.from(this.clientVersionMap.entries()).filter(([t,e])=>e===a).map(([t])=>t);await Promise.all(i.map(async t=>{const s=await this.scope.clients.get(t);s&&s.postMessage({type:"UNRECOVERABLE_STATE",reason:e})}))}async notifyClientsAboutVersionInstallationFailed(t,e,s){await this.initialized;const a=await this.scope.clients.matchAll();await Promise.all(a.map(async a=>{a.postMessage({type:"VERSION_INSTALLATION_FAILED",version:this.mergeHashWithAppData(t,e),error:errorToString(s)})}))}async notifyClientsAboutNoNewVersionDetected(t,e){await this.initialized;const s=await this.scope.clients.matchAll();await Promise.all(s.map(async s=>{s.postMessage({type:"NO_NEW_VERSION_DETECTED",version:this.mergeHashWithAppData(t,e)})}))}async notifyClientsAboutVersionDetected(t,e){await this.initialized;const s=await this.scope.clients.matchAll();await Promise.all(s.map(async s=>{void 0!==this.clientVersionMap.get(s.id)&&s.postMessage({type:"VERSION_DETECTED",version:this.mergeHashWithAppData(t,e)})}))}async notifyClientsAboutVersionReady(t,e){await this.initialized;const s=await this.scope.clients.matchAll();await Promise.all(s.map(async s=>{const a=this.clientVersionMap.get(s.id);if(void 0===a)return;if(a===this.latestHash)return;const i=this.versions.get(a),n={type:"VERSION_READY",currentVersion:this.mergeHashWithAppData(i.manifest,a),latestVersion:this.mergeHashWithAppData(t,e)};s.postMessage(n)}))}async broadcast(t){(await this.scope.clients.matchAll()).forEach(e=>{e.postMessage(t)})}async debugState(){return{state:E[this.state],why:this.stateMessage,latestHash:this.latestHash,lastUpdateCheck:this.lastUpdateCheck}}async debugVersions(){return Array.from(this.versions.keys()).map(t=>{const e=this.versions.get(t),s=Array.from(this.clientVersionMap.entries()).filter(([e,s])=>s===t).map(([t,e])=>t);return{hash:t,manifest:e.manifest,clients:s,status:""}})}async debugIdleState(){return{queue:this.idle.taskDescriptions,lastTrigger:this.idle.lastTrigger,lastRun:this.idle.lastRun}}async safeFetch(t){try{return await this.scope.fetch(t)}catch(e){return this.debugger.log(e,`Driver.fetch(${t.url})`),this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"})}}async getCacheNames(){const t=await this.controlTable,e=Array.from(this.versions.values()),s=await Promise.all(e.map(t=>t.getCacheNames()));return[t.cacheName].concat(...s)}}(T,k,new class{constructor(t){__publicField(this,"adapter"),__publicField(this,"cacheNamePrefix","db"),__publicField(this,"tables",new Map),this.adapter=t}delete(t){return this.tables.has(t)&&this.tables.delete(t),this.adapter.caches.delete(`${this.cacheNamePrefix}:${t}`)}async list(){const t=`${this.cacheNamePrefix}:`;return(await this.adapter.caches.keys()).filter(e=>e.startsWith(t)).map(e=>e.slice(t.length))}async open(t,e){if(!this.tables.has(t)){const s=await this.adapter.caches.open(`${this.cacheNamePrefix}:${t}`),a=new l(t,s,this.adapter,e);this.tables.set(t,a)}return this.tables.get(t)}}(k))})();
1
+ (()=>{var t,e,s=Object.defineProperty,a=Object.defineProperties,i=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,a)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,__spreadValues=(t,e)=>{for(var s in e||(e={}))r.call(e,s)&&__defNormalProp(t,s,e[s]);if(n)for(var s of n(e))h.call(e,s)&&__defNormalProp(t,s,e[s]);return t},__spreadProps=(t,e)=>a(t,i(e)),__publicField=(t,e,s)=>(__defNormalProp(t,"symbol"!=typeof e?e+"":e,s),s),o=class{constructor(t,e){__publicField(this,"original"),__publicField(this,"cacheNamePrefix"),this.original=t,this.cacheNamePrefix=e}delete(t){return this.original.delete(`${this.cacheNamePrefix}:${t}`)}has(t){return this.original.has(`${this.cacheNamePrefix}:${t}`)}async keys(){const t=`${this.cacheNamePrefix}:`;return(await this.original.keys()).filter(e=>e.startsWith(t)).map(e=>e.slice(t.length))}match(t,e){return this.original.match(t,e)}async open(t){const e=await this.original.open(`${this.cacheNamePrefix}:${t}`);return Object.assign(e,{name:t})}},c=class{constructor(t,e){__publicField(this,"table"),__publicField(this,"key"),this.table=t,this.key=e}},l=class{constructor(t,e,s,a){__publicField(this,"name"),__publicField(this,"cache"),__publicField(this,"adapter"),__publicField(this,"cacheQueryOptions"),__publicField(this,"cacheName"),this.name=t,this.cache=e,this.adapter=s,this.cacheQueryOptions=a,this.cacheName=this.cache.name}request(t){return this.adapter.newRequest("/"+t)}delete(t){return this.cache.delete(this.request(t),this.cacheQueryOptions)}keys(){return this.cache.keys().then(t=>t.map(t=>t.url.slice(1)))}read(t){return this.cache.match(this.request(t),this.cacheQueryOptions).then(e=>void 0===e?Promise.reject(new c(this.name,t)):e.json())}write(t,e){return this.cache.put(this.request(t),this.adapter.newResponse(JSON.stringify(e)))}};(e=t||(t={}))[e.NOT_CACHED=0]="NOT_CACHED",e[e.CACHED_BUT_UNUSED=1]="CACHED_BUT_UNUSED",e[e.CACHED=2]="CACHED";var u=class extends Error{constructor(){super(...arguments),__publicField(this,"isCritical",!0)}};function errorToString(t){return t instanceof Error?`${t.message}\n${t.stack}`:`${t}`}var d,p,g=class extends u{constructor(){super(...arguments),__publicField(this,"isUnrecoverableState",!0)}};function sha1Binary(t){const e=function(t,e){const s=t.byteLength+3>>>2,a=[],i=new Uint8Array(t);for(let t=0;t<s;t++)a[t]=wordAt(i,4*t,e);return a}(t,d.Big);return _sha1(e,8*t.byteLength)}function _sha1(t,e){const s=[];let[a,i,n,r,h]=[1732584193,4023233417,2562383102,271733878,3285377520];t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(let e=0;e<t.length;e+=16){const[o,c,l,u,d]=[a,i,n,r,h];for(let o=0;o<80;o++){s[o]=o<16?t[e+o]:rol32(s[o-3]^s[o-8]^s[o-14]^s[o-16],1);const[c,l]=fk(o,i,n,r),u=[rol32(a,5),c,h,l,s[o]].reduce(add32);[h,r,n,i,a]=[r,n,rol32(i,30),a,u]}[a,i,n,r,h]=[add32(a,o),add32(i,c),add32(n,l),add32(r,u),add32(h,d)]}return function(t){let e="";for(let s=0;s<t.length;s++){const a=byteAt(t,s);e+=(a>>>4).toString(16)+(15&a).toString(16)}return e.toLowerCase()}(function(t){return t.reduce((t,e)=>t+function(t){let e="";for(let s=0;s<4;s++)e+=String.fromCharCode(t>>>8*(3-s)&255);return e}(e),"")}([a,i,n,r,h]))}function add32(t,e){return function(t,e){const s=(65535&t)+(65535&e),a=(t>>>16)+(e>>>16)+(s>>>16);return[a>>>16,a<<16|65535&s]}(t,e)[1]}function rol32(t,e){return t<<e|t>>>32-e}function fk(t,e,s,a){return t<20?[e&s|~e&a,1518500249]:t<40?[e^s^a,1859775393]:t<60?[e&s|e&a|s&a,2400959708]:[e^s^a,3395469782]}function byteAt(t,e){return"string"==typeof t?e>=t.length?0:255&t.charCodeAt(e):e>=t.byteLength?0:255&t[e]}function wordAt(t,e,s){let a=0;if(s===d.Big)for(let s=0;s<4;s++)a+=byteAt(t,e+s)<<24-8*s;else for(let s=0;s<4;s++)a+=byteAt(t,e+s)<<8*s;return a}(p=d||(d={}))[p.Little=0]="Little",p[p.Big=1]="Big";var w=class{constructor(t,e,s,a,i,n,r){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"idle"),__publicField(this,"config"),__publicField(this,"hashes"),__publicField(this,"db"),__publicField(this,"inFlightRequests",new Map),__publicField(this,"urls",[]),__publicField(this,"patterns",[]),__publicField(this,"cache"),__publicField(this,"name"),__publicField(this,"metadata"),this.scope=t,this.adapter=e,this.idle=s,this.config=a,this.hashes=i,this.db=n,this.name=a.name,this.urls=a.urls.map(t=>e.normalizeUrl(t)),this.patterns=a.patterns.map(t=>new RegExp(t)),this.cache=e.caches.open(`${r}:${a.name}:cache`),this.metadata=this.db.open(`${r}:${a.name}:meta`,a.cacheQueryOptions)}async cacheStatus(e){const s=await this.cache,a=await this.metadata,i=this.adapter.newRequest(e);if(void 0===await s.match(i,this.config.cacheQueryOptions))return t.NOT_CACHED;try{if(!(await a.read(i.url)).used)return t.CACHED_BUT_UNUSED}catch(t){}return t.CACHED}async getCacheNames(){const[t,e]=await Promise.all([this.cache,this.metadata]);return[t.name,e.cacheName]}async handleFetch(t,e){const s=this.adapter.normalizeUrl(t.url);if(-1!==this.urls.indexOf(s)||this.patterns.some(t=>t.test(s))){const e=await this.cache;let a;try{a=await e.match(t,this.config.cacheQueryOptions)}catch(t){throw new u(`Cache is throwing while looking for a match: ${t}`)}return void 0!==a?(this.hashes.has(s)||await this.needToRevalidate(t,a)&&this.idle.schedule(`revalidate(${e.name}): ${t.url}`,async()=>{await this.fetchAndCacheOnce(t)}),a):(await this.fetchAndCacheOnce(this.newRequestWithMetadata(t.url,t))).clone()}return null}async needToRevalidate(t,e){if(e.headers.has("Cache-Control")){const s=e.headers.get("Cache-Control").split(",").map(t=>t.trim()).map(t=>t.split("="));s.forEach(t=>t[0]=t[0].toLowerCase());const a=s.find(t=>"max-age"===t[0]),i=a?a[1]:void 0;if(!i)return!0;try{const s=1e3*parseInt(i);let a;try{const e=await this.metadata;a=(await e.read(t.url)).ts}catch(t){const s=e.headers.get("Date");if(null===s)return!0;a=Date.parse(s)}const n=this.adapter.time-a;return n<0||n>s}catch(t){return!0}}else{if(!e.headers.has("Expires"))return!0;{const s=e.headers.get("Expires");try{return this.adapter.time>Date.parse(s)}catch(t){return!0}}}}async fetchFromCacheOnly(t){const e=await this.cache,s=await this.metadata,a=this.adapter.newRequest(t),i=await e.match(a,this.config.cacheQueryOptions);if(void 0===i)return null;let n;try{n=await s.read(a.url)}catch(t){}return{response:i,metadata:n}}async unhashedResources(){const t=await this.cache;return(await t.keys()).map(t=>this.adapter.normalizeUrl(t.url)).filter(t=>!this.hashes.has(t))}async fetchAndCacheOnce(t,e=!0){if(this.inFlightRequests.has(t.url))return this.inFlightRequests.get(t.url);const s=this.fetchFromNetwork(t);this.inFlightRequests.set(t.url,s);try{const a=await s;if(!a.ok)throw new Error(`Response not Ok (fetchAndCacheOnce): request for ${t.url} returned response ${a.status} ${a.statusText}`);try{const s=await this.cache;if(await s.put(t,a.clone()),!this.hashes.has(this.adapter.normalizeUrl(t.url))){const s={ts:this.adapter.time,used:e},a=await this.metadata;await a.write(t.url,s)}return a}catch(e){throw new u(`Failed to update the caches for request to '${t.url}' (fetchAndCacheOnce): ${errorToString(e)}`)}}finally{this.inFlightRequests.delete(t.url)}}async fetchFromNetwork(t,e=3){const s=await this.cacheBustedFetchFromNetwork(t);if(s.redirected&&s.url){if(0===e)throw new u(`Response hit redirect limit (fetchFromNetwork): request redirected too many times, next is ${s.url}`);return this.fetchFromNetwork(this.newRequestWithMetadata(s.url,t),e-1)}return s}async cacheBustedFetchFromNetwork(t){const e=this.adapter.normalizeUrl(t.url);if(this.hashes.has(e)){const s=this.hashes.get(e);let a=await this.safeFetch(t),i=a.ok;if(i&&(i=sha1Binary(await a.clone().arrayBuffer())!==s),i){const e=this.newRequestWithMetadata(this.cacheBust(t.url),t);if(a=await this.safeFetch(e),a.ok){const e=sha1Binary(await a.clone().arrayBuffer());if(s!==e)throw new u(`Hash mismatch (cacheBustedFetchFromNetwork): ${t.url}: expected ${s}, got ${e} (after cache busting)`)}}if(!a.ok&&404===a.status)throw new g(`Failed to retrieve hashed resource from the server. (AssetGroup: ${this.config.name} | URL: ${e})`);return a}return this.safeFetch(t)}async maybeUpdate(t,e,s){const a=this.adapter.normalizeUrl(e.url);if(this.hashes.has(a)){const i=this.hashes.get(a),n=await t.lookupResourceWithHash(a,i);if(null!==n)return await s.put(e,n),!0}return!1}newRequestWithMetadata(t,e){return this.adapter.newRequest(t,{headers:e.headers})}cacheBust(t){return t+(-1===t.indexOf("?")?"?":"&")+"ngsw-cache-bust="+Math.random()}async safeFetch(t){try{return await this.scope.fetch(t)}catch(t){return this.adapter.newResponse("",{status:504,statusText:"Gateway Timeout"})}}},f=class extends w{async initializeFully(t){const e=await this.cache;if(await this.urls.reduce(async(s,a)=>{await s;const i=this.adapter.newRequest(a);let n=!1;try{n=void 0!==await e.match(i,this.config.cacheQueryOptions)}catch(t){throw new u(`Cache is throwing while looking for a match in a PrefetchAssetGroup: ${t}`)}n||void 0!==t&&await this.maybeUpdate(t,i,e)||await this.fetchAndCacheOnce(i,!1)},Promise.resolve()),void 0!==t){const s=await this.metadata;await(await t.previouslyCachedResources()).filter(t=>-1!==this.urls.indexOf(t)||this.patterns.some(e=>e.test(t))).reduce(async(a,i)=>{await a;const n=this.adapter.newRequest(i);if(void 0!==await e.match(n,this.config.cacheQueryOptions))return;const r=await t.lookupResourceWithoutHash(i);null!==r&&void 0!==r.metadata&&(await e.put(n,r.response),await s.write(n.url,__spreadProps(__spreadValues({},r.metadata),{used:!1})))},Promise.resolve())}}},m=class extends w{async initializeFully(e){if(void 0===e)return;const s=await this.cache;await this.urls.reduce(async(a,i)=>{await a;const n=this.adapter.newRequest(i);let r=!1;try{r=void 0!==await s.match(n,this.config.cacheQueryOptions)}catch(t){throw new u(`Cache is throwing while looking for a match in a LazyAssetGroup: ${t}`)}if(r)return;const h=await this.maybeUpdate(e,n,s);if("prefetch"===this.config.updateMode&&!h){if(await e.recentCacheStatus(i)!==t.CACHED)return;await this.fetchAndCacheOnce(n,!1)}},Promise.resolve())}},y=class{constructor(t){__publicField(this,"state"),void 0===t&&(t={head:null,tail:null,map:{},count:0}),this.state=t}get size(){return this.state.count}pop(){if(null===this.state.tail)return null;const t=this.state.tail;return this.remove(t),t}remove(t){const e=this.state.map[t];if(void 0===e)return!1;if(this.state.head===t){if(null===e.next)return this.state.head=null,this.state.tail=null,this.state.map={},this.state.count=0,!0;const s=this.state.map[e.next];return s.previous=null,this.state.head=s.url,e.next=null,delete this.state.map[t],this.state.count--,!0}return this.state.map[e.previous].next=e.next,null!==e.next?this.state.map[e.next].previous=e.previous:this.state.tail=e.previous,e.next=null,e.previous=null,delete this.state.map[t],this.state.count--,!0}accessed(t){if(this.state.head===t)return;const e=this.state.map[t]||{url:t,next:null,previous:null};void 0!==this.state.map[t]&&this.remove(t),null!==this.state.head&&(this.state.map[this.state.head].previous=t),e.next=this.state.head,this.state.head=t,null===this.state.tail&&(this.state.tail=t),this.state.map[t]=e,this.state.count++}},v=class{constructor(t,e,s,a,i,n){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"config"),__publicField(this,"db"),__publicField(this,"debugHandler"),__publicField(this,"patterns"),__publicField(this,"cache"),__publicField(this,"_lru",null),__publicField(this,"lruTable"),__publicField(this,"ageTable"),this.scope=t,this.adapter=e,this.config=s,this.db=a,this.debugHandler=i,this.patterns=s.patterns.map(t=>new RegExp(t)),this.cache=e.caches.open(`${n}:${s.name}:cache`),this.lruTable=this.db.open(`${n}:${s.name}:lru`,s.cacheQueryOptions),this.ageTable=this.db.open(`${n}:${s.name}:age`,s.cacheQueryOptions)}async lru(){if(null===this._lru){const t=await this.lruTable;try{this._lru=new y(await t.read("lru"))}catch(t){this._lru=new y}}return this._lru}async syncLru(){if(null===this._lru)return;const t=await this.lruTable;try{return t.write("lru",this._lru.state)}catch(t){this.debugHandler.log(t,`DataGroup(${this.config.name}@${this.config.version}).syncLru()`)}}async handleFetch(t,e){if(!this.patterns.some(e=>e.test(t.url)))return null;const s=await this.lru();switch(t.method){case"OPTIONS":return null;case"GET":case"HEAD":switch(this.config.strategy){case"freshness":return this.handleFetchWithFreshness(t,e,s);case"performance":return this.handleFetchWithPerformance(t,e,s);default:throw new Error(`Unknown strategy: ${this.config.strategy}`)}default:return s.remove(t.url)&&await this.clearCacheForUrl(t.url),await this.syncLru(),this.safeFetch(t)}}async handleFetchWithPerformance(t,e,s){var a;const i=null!=(a=this.config.cacheOpaqueResponses)&&a;let n=null;const r=await this.loadFromCache(t,s);if(null!==r&&(n=r.res,void 0!==this.config.refreshAheadMs&&r.age>=this.config.refreshAheadMs&&e.waitUntil(this.safeCacheResponse(t,this.safeFetch(t),s,i))),null!==n)return n;const[h,o]=this.networkFetchWithTimeout(t);return n=await h,void 0===n?(n=this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"}),e.waitUntil(this.safeCacheResponse(t,o,s,i))):await this.safeCacheResponse(t,n,s,i),n}async handleFetchWithFreshness(t,e,s){var a;const i=null==(a=this.config.cacheOpaqueResponses)||a,[n,r]=this.networkFetchWithTimeout(t);let h;try{h=await n}catch(t){h=void 0}if(void 0===h){e.waitUntil(this.safeCacheResponse(t,r,s,i));const a=await this.loadFromCache(t,s);h=null!==a?a.res:null}else await this.safeCacheResponse(t,h,s,i);return null!==h?h:r}networkFetchWithTimeout(t){if(void 0!==this.config.timeoutMs){const e=this.scope.fetch(t),s=(async()=>{try{return await e}catch(t){return this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"})}})(),a=(async()=>{try{return await e}catch(t){return}})(),i=this.adapter.timeout(this.config.timeoutMs);return[Promise.race([a,i]),s]}{const e=this.safeFetch(t);return[e,e]}}async safeCacheResponse(t,e,s,a){try{const i=await e;try{await this.cacheResponse(t,i,s,a)}catch(e){this.debugHandler.log(e,`DataGroup(${this.config.name}@${this.config.version}).safeCacheResponse(${t.url}, status: ${i.status})`)}}catch(t){}}async loadFromCache(t,e){const s=await this.cache;let a=await s.match(t,this.config.cacheQueryOptions);if(void 0!==a){try{const s=await this.ageTable,i=this.adapter.time-(await s.read(t.url)).age;if(i<=this.config.maxAge)return e.accessed(t.url),{res:a,age:i}}catch(t){}e.remove(t.url),await this.clearCacheForUrl(t.url),await this.syncLru()}return null}async cacheResponse(t,e,s,a=!1){if(!(e.ok||a&&"opaque"===e.type))return;if(s.size>=this.config.maxSize){const t=s.pop();null!==t&&await this.clearCacheForUrl(t)}s.accessed(t.url),await(await this.cache).put(t,e.clone());const i=await this.ageTable;await i.write(t.url,{age:this.adapter.time}),await this.syncLru()}async cleanup(){await Promise.all([this.cache.then(t=>this.adapter.caches.delete(t.name)),this.ageTable.then(t=>this.db.delete(t.name)),this.lruTable.then(t=>this.db.delete(t.name))])}async getCacheNames(){const[t,e,s]=await Promise.all([this.cache,this.ageTable,this.lruTable]);return[t.name,e.cacheName,s.cacheName]}async clearCacheForUrl(t){const[e,s]=await Promise.all([this.cache,this.ageTable]);await Promise.all([e.delete(this.adapter.newRequest(t,{method:"GET"}),this.config.cacheQueryOptions),e.delete(this.adapter.newRequest(t,{method:"HEAD"}),this.config.cacheQueryOptions),s.delete(t)])}async safeFetch(t){try{return this.scope.fetch(t)}catch(t){return this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"})}}},b=class{constructor(t,e,s,a,i,n,r){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"database"),__publicField(this,"debugHandler"),__publicField(this,"manifest"),__publicField(this,"manifestHash"),__publicField(this,"hashTable",new Map),__publicField(this,"assetGroups"),__publicField(this,"dataGroups"),__publicField(this,"navigationUrls"),__publicField(this,"indexUrl"),__publicField(this,"_okay",!0),this.scope=t,this.adapter=e,this.database=s,this.debugHandler=i,this.manifest=n,this.manifestHash=r,this.indexUrl=this.adapter.normalizeUrl(this.manifest.index),Object.keys(n.hashTable).forEach(t=>{this.hashTable.set(e.normalizeUrl(t),n.hashTable[t])});const h=`${r}:assets`;this.assetGroups=(n.assetGroups||[]).map(i=>{switch(i.installMode){case"prefetch":return new f(t,e,a,i,this.hashTable,s,h);case"lazy":return new m(t,e,a,i,this.hashTable,s,h)}}),this.dataGroups=(n.dataGroups||[]).map(a=>new v(t,e,a,s,i,`${a.version}:data`));const o=n.navigationUrls.filter(t=>t.positive),c=n.navigationUrls.filter(t=>!t.positive);this.navigationUrls={include:o.map(t=>new RegExp(t.regex)),exclude:c.map(t=>new RegExp(t.regex))}}get okay(){return this._okay}async initializeFully(t){try{await this.assetGroups.reduce(async(e,s)=>(await e,s.initializeFully(t)),Promise.resolve())}catch(t){throw this._okay=!1,t}}async handleFetch(t,e){const s=await this.assetGroups.reduce(async(s,a)=>{const i=await s;return null!==i?i:a.handleFetch(t,e)},Promise.resolve(null));if(null!==s)return s;const a=await this.dataGroups.reduce(async(s,a)=>{const i=await s;return null!==i?i:a.handleFetch(t,e)},Promise.resolve(null));if(null!==a)return a;if(this.adapter.normalizeUrl(t.url)!==this.indexUrl&&this.isNavigationRequest(t)){if("freshness"===this.manifest.navigationRequestStrategy)try{return await this.scope.fetch(t)}catch(t){}return this.handleFetch(this.adapter.newRequest(this.indexUrl),e)}return null}isNavigationRequest(t){if("GET"!==t.method||"navigate"!==t.mode)return!1;if(!this.acceptsTextHtml(t))return!1;const e=this.scope.registration.scope.replace(/\/$/,""),s=(t.url.startsWith(e)?t.url.slice(e.length):t.url).replace(/[?#].*$/,"");return this.navigationUrls.include.some(t=>t.test(s))&&!this.navigationUrls.exclude.some(t=>t.test(s))}async lookupResourceWithHash(t,e){if(!this.hashTable.has(t))return null;if(this.hashTable.get(t)!==e)return null;const s=await this.lookupResourceWithoutHash(t);return s&&s.response}lookupResourceWithoutHash(t){return this.assetGroups.reduce(async(e,s)=>{const a=await e;return null!==a?a:s.fetchFromCacheOnly(t)},Promise.resolve(null))}previouslyCachedResources(){return this.assetGroups.reduce(async(t,e)=>(await t).concat(await e.unhashedResources()),Promise.resolve([]))}async recentCacheStatus(e){return this.assetGroups.reduce(async(s,a)=>{const i=await s;if(i===t.CACHED)return i;const n=await a.cacheStatus(e);return n===t.NOT_CACHED?i:n},Promise.resolve(t.NOT_CACHED))}async getCacheNames(){const t=await Promise.all([...this.assetGroups.map(t=>t.getCacheNames()),...this.dataGroups.map(t=>t.getCacheNames())]);return[].concat(...t)}get appData(){return this.manifest.appData||null}acceptsTextHtml(t){const e=t.headers.get("Accept");return null!==e&&e.split(",").some(t=>"text/html"===t.trim().toLowerCase())}},C=class{constructor(t,e){__publicField(this,"driver"),__publicField(this,"adapter"),__publicField(this,"debugLogA",[]),__publicField(this,"debugLogB",[]),this.driver=t,this.adapter=e}async handleFetch(t){const[e,s,a]=await Promise.all([this.driver.debugState(),this.driver.debugVersions(),this.driver.debugIdleState()]),i=`NGSW Debug Info:\n\nDriver version: 19.2.22\nDriver state: ${e.state} (${e.why})\nLatest manifest hash: ${e.latestHash||"none"}\nLast update check: ${this.since(e.lastUpdateCheck)}`,n=s.map(t=>`=== Version ${t.hash} ===\n\nClients: ${t.clients.join(", ")}`).join("\n\n"),r=`=== Idle Task Queue ===\nLast update tick: ${this.since(a.lastTrigger)}\nLast update run: ${this.since(a.lastRun)}\nTask queue:\n${a.queue.map(t=>" * "+t).join("\n")}\n\nDebug log:\n${this.formatDebugLog(this.debugLogB)}\n${this.formatDebugLog(this.debugLogA)}\n`;return this.adapter.newResponse(`${i}\n\n${n}\n\n${r}`,{headers:this.adapter.newHeaders({"Content-Type":"text/plain"})})}since(t){if(null===t)return"never";let e=this.adapter.time-t;const s=Math.floor(e/864e5);e%=864e5;const a=Math.floor(e/36e5);e%=36e5;const i=Math.floor(e/6e4);e%=6e4;const n=Math.floor(e/1e3),r=e%1e3;return(s>0?`${s}d`:"")+(a>0?`${a}h`:"")+(i>0?`${i}m`:"")+(n>0?`${n}s`:"")+(r>0?`${r}u`:"")}log(t,e=""){100===this.debugLogA.length&&(this.debugLogB=this.debugLogA,this.debugLogA=[]),"string"!=typeof t&&(t=this.errorToString(t)),this.debugLogA.push({value:t,time:this.adapter.time,context:e})}errorToString(t){return`${t.name}(${t.message}, ${t.stack})`}formatDebugLog(t){return t.map(t=>`[${this.since(t.time)}] ${t.value} ${t.context}`).join("\n")}},A=class{constructor(t,e,s,a){__publicField(this,"adapter"),__publicField(this,"delay"),__publicField(this,"maxDelay"),__publicField(this,"debug"),__publicField(this,"queue",[]),__publicField(this,"scheduled",null),__publicField(this,"empty",Promise.resolve()),__publicField(this,"emptyResolve",null),__publicField(this,"lastTrigger",null),__publicField(this,"lastRun",null),__publicField(this,"oldestScheduledAt",null),this.adapter=t,this.delay=e,this.maxDelay=s,this.debug=a}async trigger(){var t;if(this.lastTrigger=this.adapter.time,0===this.queue.length)return;null!==this.scheduled&&(this.scheduled.cancel=!0);const e={cancel:!1};this.scheduled=e;const s=this.adapter.time,a=Math.max(0,(null!=(t=this.oldestScheduledAt)?t:s)+this.maxDelay-s),i=Math.min(a,this.delay);await this.adapter.timeout(i),e.cancel||(this.scheduled=null,await this.execute())}async execute(){for(this.lastRun=this.adapter.time;this.queue.length>0;){const t=this.queue;this.queue=[],await t.reduce(async(t,e)=>{await t;try{await e.run()}catch(t){this.debug.log(t,`while running idle task ${e.desc}`)}},Promise.resolve())}null!==this.emptyResolve&&(this.emptyResolve(),this.emptyResolve=null),this.empty=Promise.resolve(),this.oldestScheduledAt=null}schedule(t,e){this.queue.push({desc:t,run:e}),null===this.emptyResolve&&(this.empty=new Promise(t=>{this.emptyResolve=t})),null===this.oldestScheduledAt&&(this.oldestScheduledAt=this.adapter.time)}get size(){return this.queue.length}get taskDescriptions(){return this.queue.map(t=>t.desc)}};function hashManifest(t){return function(t){const e=t,s=function(t,e){const s=t.length+3>>>2,a=[];for(let i=0;i<s;i++)a[i]=wordAt(t,4*i,e);return a}(e,d.Big);return _sha1(s,8*e.length)}(JSON.stringify(t))}var E,R,$=["actions","badge","body","data","dir","icon","image","lang","renotify","requireInteraction","silent","tag","timestamp","title","vibrate"];(R=E||(E={}))[R.NORMAL=0]="NORMAL",R[R.EXISTING_CLIENTS_ONLY=1]="EXISTING_CLIENTS_ONLY",R[R.SAFE_MODE=2]="SAFE_MODE";var T=self,k=new class{constructor(t,e){__publicField(this,"scopeUrl"),__publicField(this,"caches"),__publicField(this,"origin"),this.scopeUrl=t;const s=this.parseUrl(this.scopeUrl);this.origin=s.origin,this.caches=new o(e,`ngsw:${s.path}`)}newRequest(t,e){return new Request(t,e)}newResponse(t,e){return new Response(t,e)}newHeaders(t){return new Headers(t)}isClient(t){return t instanceof Client}get time(){return Date.now()}normalizeUrl(t){const e=this.parseUrl(t,this.scopeUrl);return e.origin===this.origin?e.path:t}parseUrl(t,e){const s=e?new URL(t,e):new URL(t);return{origin:s.origin,path:s.pathname,search:s.search}}timeout(t){return new Promise(e=>{setTimeout(()=>e(),t)})}}(T.registration.scope,self.caches);new class{constructor(t,e,s){__publicField(this,"scope"),__publicField(this,"adapter"),__publicField(this,"db"),__publicField(this,"state",E.NORMAL),__publicField(this,"stateMessage","(nominal)"),__publicField(this,"initialized",null),__publicField(this,"clientVersionMap",new Map),__publicField(this,"versions",new Map),__publicField(this,"latestHash",null),__publicField(this,"lastUpdateCheck",null),__publicField(this,"scheduledNavUpdateCheck",!1),__publicField(this,"loggedInvalidOnlyIfCachedRequest",!1),__publicField(this,"ngswStatePath"),__publicField(this,"idle"),__publicField(this,"debugger"),__publicField(this,"controlTable"),this.scope=t,this.adapter=e,this.db=s,this.controlTable=this.db.open("control"),this.ngswStatePath=this.adapter.parseUrl("ngsw/state",this.scope.registration.scope).path,this.scope.addEventListener("install",t=>{t.waitUntil(this.scope.skipWaiting())}),this.scope.addEventListener("activate",t=>{t.waitUntil((async()=>{await this.scope.clients.claim()})()),null!==this.scope.registration.active&&this.scope.registration.active.postMessage({action:"INITIALIZE"})}),this.scope.addEventListener("fetch",t=>this.onFetch(t)),this.scope.addEventListener("message",t=>this.onMessage(t)),this.scope.addEventListener("push",t=>this.onPush(t)),this.scope.addEventListener("notificationclick",t=>this.onClick(t)),this.debugger=new C(this,this.adapter),this.idle=new A(this.adapter,5e3,3e4,this.debugger)}onFetch(t){const e=t.request,s=this.scope.registration.scope,a=this.adapter.parseUrl(e.url,s);e.headers.has("ngsw-bypass")||/[?&]ngsw-bypass(?:[=&]|$)/i.test(a.search)||(a.path!==this.ngswStatePath?this.state!==E.SAFE_MODE?a.origin.startsWith("http:")&&s.startsWith("https:")?this.debugger.log(`Ignoring passive mixed content request: Driver.fetch(${e.url})`):"only-if-cached"!==e.cache||"same-origin"===e.mode?t.respondWith(this.handleFetch(t)):this.loggedInvalidOnlyIfCachedRequest||(this.loggedInvalidOnlyIfCachedRequest=!0,this.debugger.log("Ignoring invalid request: 'only-if-cached' can be set only with 'same-origin' mode",`Driver.fetch(${e.url}, cache: ${e.cache}, mode: ${e.mode})`)):t.waitUntil(this.idle.trigger()):t.respondWith(this.debugger.handleFetch(e)))}onMessage(t){if(this.state===E.SAFE_MODE)return;const e=t.data;e&&e.action&&t.waitUntil((async()=>{if("INITIALIZE"===e.action)return this.ensureInitialized(t);this.adapter.isClient(t.source)&&(await this.ensureInitialized(t),await this.handleMessage(e,t.source))})())}onPush(t){t.data&&t.waitUntil(this.handlePush(t.data.json()))}onClick(t){t.waitUntil(this.handleClick(t.notification,t.action))}async ensureInitialized(t){if(null!==this.initialized)return this.initialized;try{this.initialized=this.initialize(),await this.initialized}catch(t){throw this.state=E.SAFE_MODE,this.stateMessage=`Initialization failed due to error: ${errorToString(t)}`,t}finally{t.waitUntil(this.idle.trigger())}}async handleMessage(t,e){if(function(t){return"CHECK_FOR_UPDATES"===t.action}(t)){const s=this.checkForUpdate();await this.completeOperation(e,s,t.nonce)}else if(function(t){return"ACTIVATE_UPDATE"===t.action}(t)){const s=this.updateClient(e);await this.completeOperation(e,s,t.nonce)}}async handlePush(t){if(await this.broadcast({type:"PUSH",data:t}),!t.notification||!t.notification.title)return;const e=t.notification;let s={};$.filter(t=>e.hasOwnProperty(t)).forEach(t=>s[t]=e[t]),await this.scope.registration.showNotification(e.title,s)}async handleClick(t,e){var s,a,i;t.close();const n={};$.filter(e=>e in t).forEach(e=>n[e]=t[e]);const r=""===e||void 0===e?"default":e,h=null==(a=null==(s=null==t?void 0:t.data)?void 0:s.onActionClick)?void 0:a[r],o=new URL(null!=(i=null==h?void 0:h.url)?i:"",this.scope.registration.scope).href;switch(null==h?void 0:h.operation){case"openWindow":await this.scope.clients.openWindow(o);break;case"focusLastFocusedOrOpen":{let t=await this.getLastFocusedMatchingClient(this.scope);t?await(null==t?void 0:t.focus()):await this.scope.clients.openWindow(o);break}case"navigateLastFocusedOrOpen":{let t=await this.getLastFocusedMatchingClient(this.scope);t?(t=await t.navigate(o),await(null==t?void 0:t.focus())):await this.scope.clients.openWindow(o);break}case"sendRequest":await this.scope.fetch(o)}await this.broadcast({type:"NOTIFICATION_CLICK",data:{action:e,notification:n}})}async getLastFocusedMatchingClient(t){return(await t.clients.matchAll({type:"window"}))[0]}async completeOperation(t,e,s){const a={type:"OPERATION_COMPLETED",nonce:s};try{t.postMessage(__spreadProps(__spreadValues({},a),{result:await e}))}catch(e){t.postMessage(__spreadProps(__spreadValues({},a),{error:e.toString()}))}}async updateClient(t){const e=this.clientVersionMap.get(t.id);if(e===this.latestHash)return!1;let s;if(void 0!==e){const t=this.versions.get(e);s=this.mergeHashWithAppData(t.manifest,e)}return this.clientVersionMap.set(t.id,this.latestHash),await this.sync(),this.versions.get(this.latestHash),!0}async handleFetch(t){try{await this.ensureInitialized(t)}catch(e){return this.safeFetch(t.request)}"navigate"!==t.request.mode||this.scheduledNavUpdateCheck||(this.scheduledNavUpdateCheck=!0,this.idle.schedule("check-updates-on-navigation",async()=>{this.scheduledNavUpdateCheck=!1,await this.checkForUpdate()}));const e=await this.assignVersion(t),s=void 0===(null==e?void 0:e.manifest.applicationMaxAge)||this.adapter.time-e.manifest.timestamp<e.manifest.applicationMaxAge;let a=null;try{if(null!==e&&s)try{a=await e.handleFetch(t.request,t)}catch(s){if(s.isUnrecoverableState&&await this.notifyClientsAboutUnrecoverableState(e,s.message),s.isCritical)return this.debugger.log(s,`Driver.handleFetch(version: ${e.manifestHash})`),await this.versionFailed(e,s),this.safeFetch(t.request);throw s}return null===a?this.safeFetch(t.request):a}finally{t.waitUntil(this.idle.trigger())}}async initialize(){const t=await this.controlTable;let e,s,a;try{if([e,s,a]=await Promise.all([t.read("manifests"),t.read("assignments"),t.read("latest")]),!this.versions.has(a.latest)&&!e.hasOwnProperty(a.latest))throw this.debugger.log(`Missing manifest for latest version hash ${a.latest}`,"initialize: read from DB"),new Error(`Missing manifest for latest hash ${a.latest}`);this.idle.schedule("init post-load (update)",async()=>{await this.checkForUpdate()})}catch(i){const n=await this.fetchLatestManifest(),r=hashManifest(n);e={[r]:n},s={},a={latest:r},await Promise.all([t.write("manifests",e),t.write("assignments",s),t.write("latest",a)])}if(this.idle.schedule("init post-load (cleanup)",async()=>{await this.cleanupCaches()}),Object.keys(e).forEach(t=>{const s=e[t];this.versions.has(t)||this.versions.set(t,new b(this.scope,this.adapter,this.db,this.idle,this.debugger,s,t))}),Object.keys(s).forEach(t=>{const e=s[t];this.versions.has(e)?this.clientVersionMap.set(t,e):(this.clientVersionMap.set(t,a.latest),this.debugger.log(`Unknown version ${e} mapped for client ${t}, using latest instead`,"initialize: map assignments"))}),this.latestHash=a.latest,!this.versions.has(a.latest))throw new Error(`Invariant violated (initialize): latest hash ${a.latest} has no known manifest`);await Promise.all(Object.keys(e).map(async t=>{try{await this.scheduleInitialization(this.versions.get(t))}catch(e){this.debugger.log(e,`initialize: schedule init of ${t}`)}}))}lookupVersionByHash(t,e="lookupVersionByHash"){if(!this.versions.has(t))throw new Error(`Invariant violated (${e}): want AppVersion for ${t} but not loaded`);return this.versions.get(t)}async assignVersion(t){const e="worker"===t.request.destination&&t.resultingClientId&&t.clientId,s=e?t.clientId:t.resultingClientId||t.clientId;if(s){if(this.clientVersionMap.has(s)){const a=this.clientVersionMap.get(s);let i=this.lookupVersionByHash(a,"assignVersion");if(this.state===E.NORMAL&&a!==this.latestHash&&i.isNavigationRequest(t.request)){if(null===this.latestHash)throw new Error("Invariant violated (assignVersion): latestHash was null");const t=await this.scope.clients.get(s);t&&await this.updateClient(t),i=this.lookupVersionByHash(this.latestHash,"assignVersion")}if(e)if(this.clientVersionMap.has(t.resultingClientId)){if(this.clientVersionMap.get(t.resultingClientId)!==a)throw new Error(`Version mismatch between worker client ${t.resultingClientId} and requesting client ${s}`)}else this.clientVersionMap.set(t.resultingClientId,a),await this.sync();return i}if(this.state!==E.NORMAL)return null;if(null===this.latestHash)throw new Error("Invariant violated (assignVersion): latestHash was null");if(e)if(this.clientVersionMap.has(t.resultingClientId)){if(this.clientVersionMap.get(t.resultingClientId)!==this.latestHash)throw new Error(`Version mismatch between worker client ${t.resultingClientId} and requesting client ${s}`)}else this.clientVersionMap.set(t.resultingClientId,this.latestHash);return this.clientVersionMap.set(s,this.latestHash),await this.sync(),this.lookupVersionByHash(this.latestHash,"assignVersion")}if(this.state!==E.NORMAL)return null;if(null===this.latestHash)throw new Error("Invariant violated (assignVersion): latestHash was null");return this.lookupVersionByHash(this.latestHash,"assignVersion")}async fetchLatestManifest(t=!1){const e=await this.safeFetch(this.adapter.newRequest("ngsw.json?ngsw-cache-bust="+Math.random()));if(!e.ok){if(404===e.status)await this.deleteAllCaches(),await this.scope.registration.unregister();else if((503===e.status||504===e.status)&&t)return null;throw new Error(`Manifest fetch failed! (status: ${e.status})`)}return this.lastUpdateCheck=this.adapter.time,e.json()}async deleteAllCaches(){const t=await this.adapter.caches.keys();await Promise.all(t.map(t=>this.adapter.caches.delete(t)))}async scheduleInitialization(t){const initialize=async()=>{try{await t.initializeFully()}catch(e){this.debugger.log(e,`initializeFully for ${t.manifestHash}`),await this.versionFailed(t,e)}};if(this.scope.registration.scope.indexOf("://localhost")>-1)return initialize();this.idle.schedule(`initialization(${t.manifestHash})`,initialize)}async versionFailed(t,e){const s=Array.from(this.versions.entries()).find(([e,s])=>s===t);if(void 0===s)return;const a=s[0];this.latestHash===a&&(this.state=E.EXISTING_CLIENTS_ONLY,this.stateMessage=`Degraded due to: ${errorToString(e)}`)}async setupUpdate(t,e){try{const s=new b(this.scope,this.adapter,this.db,this.idle,this.debugger,t,e);if(1!==t.configVersion)throw await this.deleteAllCaches(),await this.scope.registration.unregister(),new Error(`Invalid config version: expected 1, got ${t.configVersion}.`);await s.initializeFully(this),this.versions.set(e,s),this.latestHash=e,this.state===E.EXISTING_CLIENTS_ONLY&&(this.state=E.NORMAL,this.stateMessage="(nominal)"),await this.sync(),await this.notifyClientsAboutVersionReady(t,e)}catch(s){throw await this.notifyClientsAboutVersionInstallationFailed(t,e,s),s}}async checkForUpdate(){let t="(unknown)";try{const e=await this.fetchLatestManifest(!0);return null===e?(this.debugger.log("Check for update aborted. (Client or server offline.)"),!1):(t=hashManifest(e),this.versions.has(t)?(await this.notifyClientsAboutNoNewVersionDetected(e,t),!1):(await this.notifyClientsAboutVersionDetected(e,t),await this.setupUpdate(e,t),!0))}catch(e){return this.debugger.log(e,`Error occurred while updating to manifest ${t}`),this.state=E.EXISTING_CLIENTS_ONLY,this.stateMessage=`Degraded due to failed initialization: ${errorToString(e)}`,!1}}async sync(){const t=await this.controlTable,e={};this.versions.forEach((t,s)=>{e[s]=t.manifest});const s={};this.clientVersionMap.forEach((t,e)=>{s[e]=t});const a={latest:this.latestHash};await Promise.all([t.write("manifests",e),t.write("assignments",s),t.write("latest",a)])}async cleanupCaches(){try{const t=new Set((await this.scope.clients.matchAll()).map(t=>t.id));Array.from(this.clientVersionMap.keys()).filter(e=>!t.has(e)).forEach(t=>this.clientVersionMap.delete(t));const e=new Set(this.clientVersionMap.values());Array.from(this.versions.keys()).filter(t=>!e.has(t)&&t!==this.latestHash).forEach(t=>this.versions.delete(t)),await this.sync();const s=await this.adapter.caches.keys(),a=new Set(await this.getCacheNames()),i=s.filter(t=>!a.has(t));await Promise.all(i.map(t=>this.adapter.caches.delete(t)))}catch(t){this.debugger.log(t,"cleanupCaches")}}lookupResourceWithHash(t,e){return Array.from(this.versions.values()).reduce(async(s,a)=>null!==await s?s:a.lookupResourceWithHash(t,e),Promise.resolve(null))}async lookupResourceWithoutHash(t){await this.initialized;const e=this.versions.get(this.latestHash);return e?e.lookupResourceWithoutHash(t):null}async previouslyCachedResources(){await this.initialized;const t=this.versions.get(this.latestHash);return t?t.previouslyCachedResources():[]}async recentCacheStatus(e){const s=this.versions.get(this.latestHash);return s?s.recentCacheStatus(e):t.NOT_CACHED}mergeHashWithAppData(t,e){return{hash:e,appData:t.appData}}async notifyClientsAboutUnrecoverableState(t,e){const s=Array.from(this.versions.entries()).find(([e,s])=>s===t);if(void 0===s)return;const a=s[0],i=Array.from(this.clientVersionMap.entries()).filter(([t,e])=>e===a).map(([t])=>t);await Promise.all(i.map(async t=>{const s=await this.scope.clients.get(t);s&&s.postMessage({type:"UNRECOVERABLE_STATE",reason:e})}))}async notifyClientsAboutVersionInstallationFailed(t,e,s){await this.initialized;const a=await this.scope.clients.matchAll();await Promise.all(a.map(async a=>{a.postMessage({type:"VERSION_INSTALLATION_FAILED",version:this.mergeHashWithAppData(t,e),error:errorToString(s)})}))}async notifyClientsAboutNoNewVersionDetected(t,e){await this.initialized;const s=await this.scope.clients.matchAll();await Promise.all(s.map(async s=>{s.postMessage({type:"NO_NEW_VERSION_DETECTED",version:this.mergeHashWithAppData(t,e)})}))}async notifyClientsAboutVersionDetected(t,e){await this.initialized;const s=await this.scope.clients.matchAll();await Promise.all(s.map(async s=>{void 0!==this.clientVersionMap.get(s.id)&&s.postMessage({type:"VERSION_DETECTED",version:this.mergeHashWithAppData(t,e)})}))}async notifyClientsAboutVersionReady(t,e){await this.initialized;const s=await this.scope.clients.matchAll();await Promise.all(s.map(async s=>{const a=this.clientVersionMap.get(s.id);if(void 0===a)return;if(a===this.latestHash)return;const i=this.versions.get(a),n={type:"VERSION_READY",currentVersion:this.mergeHashWithAppData(i.manifest,a),latestVersion:this.mergeHashWithAppData(t,e)};s.postMessage(n)}))}async broadcast(t){(await this.scope.clients.matchAll()).forEach(e=>{e.postMessage(t)})}async debugState(){return{state:E[this.state],why:this.stateMessage,latestHash:this.latestHash,lastUpdateCheck:this.lastUpdateCheck}}async debugVersions(){return Array.from(this.versions.keys()).map(t=>{const e=this.versions.get(t),s=Array.from(this.clientVersionMap.entries()).filter(([e,s])=>s===t).map(([t,e])=>t);return{hash:t,manifest:e.manifest,clients:s,status:""}})}async debugIdleState(){return{queue:this.idle.taskDescriptions,lastTrigger:this.idle.lastTrigger,lastRun:this.idle.lastRun}}async safeFetch(t){try{return await this.scope.fetch(t)}catch(e){return this.debugger.log(e,`Driver.fetch(${t.url})`),this.adapter.newResponse(null,{status:504,statusText:"Gateway Timeout"})}}async getCacheNames(){const t=await this.controlTable,e=Array.from(this.versions.values()),s=await Promise.all(e.map(t=>t.getCacheNames()));return[t.cacheName].concat(...s)}}(T,k,new class{constructor(t){__publicField(this,"adapter"),__publicField(this,"cacheNamePrefix","db"),__publicField(this,"tables",new Map),this.adapter=t}delete(t){return this.tables.has(t)&&this.tables.delete(t),this.adapter.caches.delete(`${this.cacheNamePrefix}:${t}`)}async list(){const t=`${this.cacheNamePrefix}:`;return(await this.adapter.caches.keys()).filter(e=>e.startsWith(t)).map(e=>e.slice(t.length))}async open(t,e){if(!this.tables.has(t)){const s=await this.adapter.caches.open(`${this.cacheNamePrefix}:${t}`),a=new l(t,s,this.adapter,e);this.tables.set(t,a)}return this.tables.get(t)}}(k))})();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "configVersion": 1,
3
- "timestamp": 1779549349781,
3
+ "timestamp": 1779720503140,
4
4
  "index": "./index.html",
5
5
  "assetGroups": [
6
6
  {
@@ -1 +1 @@
1
- var t=globalThis;function te(o){return(t.__Zone_symbol_prefix||"__zone_symbol__")+o}var o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,u=Object.getPrototypeOf,h=Object.create,_=Array.prototype.slice,k="addEventListener",v="removeEventListener",E=te(k),w=te(v),S="true",Z="false",P=te("");function Ve(t,o){return Zone.current.wrap(t,o)}function xe(t,o,s,u,h){return Zone.current.scheduleMacroTask(t,o,s,u,h)}var O=te,j=typeof window<"u",R=j?window:void 0,N=j&&R||globalThis;function Fe(t,o){for(let s=t.length-1;s>=0;s--)"function"==typeof t[s]&&(t[s]=Ve(t[s],o+"_"+s));return t}function et(t){return!t||!1!==t.writable&&!("function"==typeof t.get&&typeof t.set>"u")}var F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,G=!("nw"in N)&&typeof N.process<"u"&&"[object process]"===N.process.toString(),B=!G&&!F&&!(!j||!R.HTMLElement),U=typeof N.process<"u"&&"[object process]"===N.process.toString()&&!F&&!(!j||!R.HTMLElement),V={},X=O("enable_beforeunload"),Xe=function(t){if(!(t=t||N.event))return;let o=V[t.type];o||(o=V[t.type]=O("ON_PROPERTY"+t.type));let s,u=this||t.target||N,h=u[o];if(B&&u===R&&"error"===t.type){let o=t;s=h&&h.call(this,o.message,o.filename,o.lineno,o.colno,o.error),!0===s&&t.preventDefault()}else s=h&&h.apply(this,arguments),"beforeunload"===t.type&&N[X]&&"string"==typeof s?t.returnValue=s:null!=s&&!s&&t.preventDefault();return s};function Ye(t,u,h){let _=o(t,u);if(!_&&h&&o(h,u)&&(_={enumerable:!0,configurable:!0}),!_||!_.configurable)return;let k=O("on"+u+"patched");if(t.hasOwnProperty(k)&&t[k])return;delete _.writable,delete _.value;let v=_.get,E=_.set,w=u.slice(2),S=V[w];S||(S=V[w]=O("ON_PROPERTY"+w)),_.set=function(o){let s=this;!s&&t===N&&(s=N),s&&("function"==typeof s[S]&&s.removeEventListener(w,Xe),E?.call(s,null),s[S]=o,"function"==typeof o&&s.addEventListener(w,Xe,!1))},_.get=function(){let o=this;if(!o&&t===N&&(o=N),!o)return null;let s=o[S];if(s)return s;if(v){let t=v.call(this);if(t)return _.set.call(this,t),"function"==typeof o.removeAttribute&&o.removeAttribute(u),t}return null},s(t,u,_),t[k]=!0}function rt(t,o,s){if(o)for(let u=0;u<o.length;u++)Ye(t,"on"+o[u],s);else{let o=[];for(let s in t)"on"==s.slice(0,2)&&o.push(s);for(let u=0;u<o.length;u++)Ye(t,o[u],s)}}var Y=O("originalInstance");function ye(t){let o=N[t];if(!o)return;N[O(t)]=o,N[t]=function(){let s=Fe(arguments,t);switch(s.length){case 0:this[Y]=new o;break;case 1:this[Y]=new o(s[0]);break;case 2:this[Y]=new o(s[0],s[1]);break;case 3:this[Y]=new o(s[0],s[1],s[2]);break;case 4:this[Y]=new o(s[0],s[1],s[2],s[3]);break;default:throw new Error("Arg list too long.")}},fe(N[t],o);let u,h=new o(function(){});for(u in h)"XMLHttpRequest"===t&&"responseBlob"===u||function(o){"function"==typeof h[o]?N[t].prototype[o]=function(){return this[Y][o].apply(this[Y],arguments)}:s(N[t].prototype,o,{set:function(s){"function"==typeof s?(this[Y][o]=Ve(s,t+"."+o),fe(this[Y][o],s)):this[Y][o]=s},get:function(){return this[Y][o]}})}(u);for(u in o)"prototype"!==u&&o.hasOwnProperty(u)&&(N[t][u]=o[u])}function ue(t,s,h){let _=t;for(;_&&!_.hasOwnProperty(s);)_=u(_);!_&&t[s]&&(_=t);let k=O(s),v=null;if(_&&(!(v=_[k])||!_.hasOwnProperty(k))){if(v=_[k]=_[s],et(_&&o(_,s))){let t=h(v,k,s);_[s]=function(){return t(this,arguments)},fe(_[s],v)}}return v}function mt(t,o,s){let u=null;function c(t){let o=t.data;return o.args[o.cbIdx]=function(){t.invoke.apply(this,arguments)},u.apply(o.target,o.args),t}u=ue(t,o,t=>function(o,u){let h=s(o,u);return h.cbIdx>=0&&"function"==typeof u[h.cbIdx]?xe(h.name,u[h.cbIdx],h,c):t.apply(o,u)})}function fe(t,o){t[O("OriginalDelegate")]=o}var K=!1,ee=!1;function yt(){if(K)return ee;K=!0;try{let t=R.navigator.userAgent;(-1!==t.indexOf("MSIE ")||-1!==t.indexOf("Trident/")||-1!==t.indexOf("Edge/"))&&(ee=!0)}catch{}return ee}function Je(t){return"function"==typeof t}function Ke(t){return"number"==typeof t}var ne={useG:!0},re={},oe={},ae=new RegExp("^"+P+"(\\w+)(true|false)$"),le=O("propagationStopped");function ct(t,o){let s=(o?o(t):t)+Z,u=(o?o(t):t)+S,h=P+s,_=P+u;re[t]={},re[t][Z]=h,re[t][S]=_}function vt(t,o,s,h){let _=h&&h.add||k,E=h&&h.rm||v,w=h&&h.listeners||"eventListeners",j=h&&h.rmAll||"removeAllListeners",R=O(_),N="."+_+":",F="prependListener",B="."+F+":",L=function(t,o,s){if(t.isRemoved)return;let u,h=t.callback;"object"==typeof h&&h.handleEvent&&(t.callback=t=>h.handleEvent(t),t.originalDelegate=h);try{t.invoke(t,o,[s])}catch(t){u=t}let _=t.options;if(_&&"object"==typeof _&&_.once){let u=t.originalDelegate?t.originalDelegate:t.callback;o[E].call(o,s.type,u,_)}return u};function H(s,u,h){if(!(u=u||t.event))return;let _=s||u.target||t,k=_[re[u.type][h?S:Z]];if(k){let t=[];if(1===k.length){let o=L(k[0],_,u);o&&t.push(o)}else{let o=k.slice();for(let s=0;s<o.length&&(!u||!0!==u[le]);s++){let h=L(o[s],_,u);h&&t.push(h)}}if(1===t.length)throw t[0];for(let s=0;s<t.length;s++){let u=t[s];o.nativeScheduleMicroTask(()=>{throw u})}}}let z=function(t){return H(this,t,!1)},$=function(t){return H(this,t,!0)};function J(o,s){if(!o)return!1;let h=!0;s&&void 0!==s.useG&&(h=s.useG);let k=s&&s.vh,v=!0;s&&void 0!==s.chkDup&&(v=s.chkDup);let U=!1;s&&void 0!==s.rt&&(U=s.rt);let V=o;for(;V&&!V.hasOwnProperty(_);)V=u(V);if(!V&&o[_]&&(V=o),!V||V[R])return!1;let X,Y=s&&s.eventNameToString,K={},ee=V[R]=V[_],le=V[O(E)]=V[E],se=V[O(w)]=V[w],ce=V[O(j)]=V[j];s&&s.prepend&&(X=V[O(s.prepend)]=V[s.prepend]);let he=h?function(t){if(!K.isExisting)return ee.call(K.target,K.eventName,K.capture?$:z,K.options)}:function(t){return ee.call(K.target,K.eventName,t.invoke,K.options)},pe=h?function(t){if(!t.isRemoved){let o,s=re[t.eventName];s&&(o=s[t.capture?S:Z]);let u=o&&t.target[o];if(u)for(let s=0;s<u.length;s++)if(u[s]===t){u.splice(s,1),t.isRemoved=!0,t.removeAbortListener&&(t.removeAbortListener(),t.removeAbortListener=null),0===u.length&&(t.allRemoved=!0,t.target[o]=null);break}}if(t.allRemoved)return le.call(t.target,t.eventName,t.capture?$:z,t.options)}:function(t){return le.call(t.target,t.eventName,t.invoke,t.options)},_e=s?.diff||function(t,o){let s=typeof o;return"function"===s&&t.callback===o||"object"===s&&t.originalDelegate===o},de=Zone[O("UNPATCHED_EVENTS")],ge=t[O("PASSIVE_EVENTS")];let l=function(o,u,_,E,w=!1,P=!1){return function(){let O=this||t,j=arguments[0];s&&s.transferEventName&&(j=s.transferEventName(j));let R=arguments[1];if(!R)return o.apply(this,arguments);if(G&&"uncaughtException"===j)return o.apply(this,arguments);let N=!1;if("function"!=typeof R){if(!R.handleEvent)return o.apply(this,arguments);N=!0}if(k&&!k(o,R,O,arguments))return;let F=!!ge&&-1!==ge.indexOf(j),B=function(t){if("object"==typeof t&&null!==t){let o={...t};return t.signal&&(o.signal=t.signal),o}return t}(function(t,o){return o?"boolean"==typeof t?{capture:t,passive:!0}:t?"object"==typeof t&&!1!==t.passive?{...t,passive:!0}:t:{passive:!0}:t}(arguments[2],F)),U=B?.signal;if(U?.aborted)return;if(de)for(let t=0;t<de.length;t++)if(j===de[t])return F?o.call(O,j,R,B):o.apply(this,arguments);let V=!!B&&("boolean"==typeof B||B.capture),X=!(!B||"object"!=typeof B)&&B.once,ee=Zone.current,ae=re[j];ae||(ct(j,Y),ae=re[j]);let le=ae[V?S:Z],se=O[le],ce=!1;if(se){if(ce=!0,v)for(let t=0;t<se.length;t++)if(_e(se[t],R))return}else se=O[le]=[];let he,pe=O.constructor.name,Te=oe[pe];Te&&(he=Te[j]),he||(he=pe+u+(Y?Y(j):j)),K.options=B,X&&(K.options.once=!1),K.target=O,K.capture=V,K.eventName=j,K.isExisting=ce;let me=h?ne:void 0;me&&(me.taskData=K),U&&(K.options.signal=void 0);let ve=ee.scheduleEventTask(he,R,me,_,E);if(U){K.options.signal=U;let ie=()=>ve.zone.cancelTask(ve);o.call(U,"abort",ie,{once:!0}),ve.removeAbortListener=()=>U.removeEventListener("abort",ie)}return K.target=null,me&&(me.taskData=null),X&&(K.options.once=!0),"boolean"!=typeof ve.options&&(ve.options=B),ve.target=O,ve.capture=V,ve.eventName=j,N&&(ve.originalDelegate=R),P?se.unshift(ve):se.push(ve),w?O:void 0}};return V[_]=l(ee,N,he,pe,U),X&&(V[F]=l(X,B,function(t){return X.call(K.target,K.eventName,t.invoke,K.options)},pe,U,!0)),V[E]=function(){let o=this||t,u=arguments[0];s&&s.transferEventName&&(u=s.transferEventName(u));let h=arguments[2],_=!!h&&("boolean"==typeof h||h.capture),v=arguments[1];if(!v)return le.apply(this,arguments);if(k&&!k(le,v,o,arguments))return;let E,w=re[u];w&&(E=w[_?S:Z]);let O=E&&o[E];if(O)for(let t=0;t<O.length;t++){let s=O[t];if(_e(s,v)){if(O.splice(t,1),s.isRemoved=!0,0===O.length&&(s.allRemoved=!0,o[E]=null,!_&&"string"==typeof u)){o[P+"ON_PROPERTY"+u]=null}return s.zone.cancelTask(s),U?o:void 0}}return le.apply(this,arguments)},V[w]=function(){let o=this||t,u=arguments[0];s&&s.transferEventName&&(u=s.transferEventName(u));let h=[],_=at(o,Y?Y(u):u);for(let t=0;t<_.length;t++){let o=_[t],s=o.originalDelegate?o.originalDelegate:o.callback;h.push(s)}return h},V[j]=function(){let o=this||t,u=arguments[0];if(u){s&&s.transferEventName&&(u=s.transferEventName(u));let t=re[u];if(t){let s=t[Z],h=t[S],_=o[s],k=o[h];if(_){let t=_.slice();for(let o=0;o<t.length;o++){let s=t[o],h=s.originalDelegate?s.originalDelegate:s.callback;this[E].call(this,u,h,s.options)}}if(k){let t=k.slice();for(let o=0;o<t.length;o++){let s=t[o],h=s.originalDelegate?s.originalDelegate:s.callback;this[E].call(this,u,h,s.options)}}}}else{let t=Object.keys(o);for(let o=0;o<t.length;o++){let s=t[o],u=ae.exec(s),h=u&&u[1];h&&"removeListener"!==h&&this[j].call(this,h)}this[j].call(this,"removeListener")}if(U)return this},fe(V[_],ee),fe(V[E],le),ce&&fe(V[j],ce),se&&fe(V[w],se),!0}let U=[];for(let t=0;t<s.length;t++)U[t]=J(s[t],h);return U}function at(t,o){if(!o){let s=[];for(let u in t){let h=ae.exec(u),_=h&&h[1];if(_&&(!o||_===o)){let o=t[u];if(o)for(let t=0;t<o.length;t++)s.push(o[t])}}return s}let s=re[o];s||(ct(o),s=re[o]);let u=t[s[Z]],h=t[s[S]];return u?h?u.concat(h):u.slice():h?h.slice():[]}function bt(t,o){let s=t.Event;s&&s.prototype&&o.patchMethod(s.prototype,"stopImmediatePropagation",t=>function(o,s){o[le]=!0,t&&t.apply(o,s)})}var se=O("zoneTask");function ke(t,o,s,u){let h=null,_=null;s+=u;let k={};function T(o){let s=o.data;s.args[0]=function(){return o.invoke.apply(this,arguments)};let u=h.apply(t,s.args);return Ke(u)?s.handleId=u:(s.handle=u,s.isRefreshable=Je(u.refresh)),o}function y(o){let{handle:s,handleId:u}=o.data;return _.call(t,s??u)}h=ue(t,o+=u,s=>function(h,_){if(Je(_[0])){let t={isRefreshable:!1,isPeriodic:"Interval"===u,delay:"Timeout"===u||"Interval"===u?_[1]||0:void 0,args:_},s=_[0];_[0]=function(){try{return s.apply(this,arguments)}finally{let{handle:o,handleId:s,isPeriodic:u,isRefreshable:h}=t;!u&&!h&&(s?delete k[s]:o&&(o[se]=null))}};let h=xe(o,_[0],t,T,y);if(!h)return h;let{handleId:v,handle:E,isRefreshable:w,isPeriodic:S}=h.data;if(v)k[v]=h;else if(E&&(E[se]=h,w&&!S)){let t=E.refresh;E.refresh=function(){let{zone:o,state:s}=h;return"notScheduled"===s?(h._state="scheduled",o._updateTaskCount(h,1)):"running"===s&&(h._state="scheduling"),t.call(this)}}return E??v??h}return s.apply(t,_)}),_=ue(t,s,o=>function(s,u){let h,_=u[0];Ke(_)?(h=k[_],delete k[_]):(h=_?.[se],h?_[se]=null:h=_),h?.type?h.cancelFn&&h.zone.cancelTask(h):o.apply(t,u)})}function lt(t,o,s){if(!s||0===s.length)return o;let u=s.filter(o=>o.target===t);if(0===u.length)return o;let h=u[0].ignoreProperties;return o.filter(t=>-1===h.indexOf(t))}function Qe(t,o,s,u){if(!t)return;rt(t,lt(t,o,s),u)}function Ie(t){return Object.getOwnPropertyNames(t).filter(t=>t.startsWith("on")&&t.length>2).map(t=>t.substring(2))}function Ot(t){t.__load_patch("ZoneAwarePromise",(t,o,s)=>{let u=Object.getOwnPropertyDescriptor,h=Object.defineProperty;let _=s.symbol,k=[],v=!1!==t[_("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],E=_("Promise"),w=_("then");s.onUnhandledError=t=>{if(s.showUncaughtError()){let o=t&&t.rejection;o?console.error("Unhandled Promise rejection:",o instanceof Error?o.message:o,"; Zone:",t.zone.name,"; Task:",t.task&&t.task.source,"; Value:",o,o instanceof Error?o.stack:void 0):console.error(t)}},s.microtaskDrainDone=()=>{for(;k.length;){let t=k.shift();try{t.zone.runGuarded(()=>{throw t.throwOriginal?t.rejection:t})}catch(t){z(t)}}};let S=_("unhandledPromiseRejectionHandler");function z(t){s.onUnhandledError(t);try{let s=o[S];"function"==typeof s&&s.call(this,t)}catch{}}function $(t){return t&&"function"==typeof t.then}function J(t){return t}function q(t){return M.reject(t)}let Z=_("state"),P=_("value"),O=_("finally"),j=_("parentPromiseValue"),R=_("parentPromiseState"),N=null,F=!0,G=!1;function b(t,o){return s=>{try{I(t,o,s)}catch(o){I(t,!1,o)}}}let D=function(){let t=!1;return function(o){return function(){t||(t=!0,o.apply(null,arguments))}}},B="Promise resolved with itself",U=_("currentTaskTrace");function I(t,u,_){let E=D();if(t===_)throw new TypeError(B);if(t[Z]===N){let w=null;try{("object"==typeof _||"function"==typeof _)&&(w=_&&_.then)}catch(o){return E(()=>{I(t,!1,o)})(),t}if(u!==G&&_ instanceof M&&_.hasOwnProperty(Z)&&_.hasOwnProperty(P)&&_[Z]!==N)i(_),I(t,_[Z],_[P]);else if(u!==G&&"function"==typeof w)try{w.call(_,E(b(t,u)),E(b(t,!1)))}catch(o){E(()=>{I(t,!1,o)})()}else{t[Z]=u;let E=t[P];if(t[P]=_,t[O]===O&&u===F&&(t[Z]=t[R],t[P]=t[j]),u===G&&_ instanceof Error){let t=o.currentTask&&o.currentTask.data&&o.currentTask.data.__creationTrace__;t&&h(_,U,{configurable:!0,enumerable:!1,writable:!0,value:t})}for(let o=0;o<E.length;)r(t,E[o++],E[o++],E[o++],E[o++]);if(0==E.length&&u==G){t[Z]=0;let u=_;try{throw new Error("Uncaught (in promise): "+function(t){if(t&&t.toString===Object.prototype.toString)return(t.constructor&&t.constructor.name||"")+": "+JSON.stringify(t);return t?t.toString():Object.prototype.toString.call(t)}(_)+(_&&_.stack?"\n"+_.stack:""))}catch(t){u=t}v&&(u.throwOriginal=!0),u.rejection=_,u.promise=t,u.zone=o.current,u.task=o.currentTask,k.push(u),s.scheduleMicroTask()}}}return t}let V=_("rejectionHandledHandler");function i(t){if(0===t[Z]){try{let s=o[V];s&&"function"==typeof s&&s.call(this,{rejection:t[P],promise:t})}catch{}t[Z]=G;for(let o=0;o<k.length;o++)t===k[o].promise&&k.splice(o,1)}}function r(t,o,s,u,h){i(t);let _=t[Z],k=_?"function"==typeof u?u:J:"function"==typeof h?h:q;o.scheduleMicroTask("Promise.then",()=>{try{let u=t[P],h=!!s&&O===s[O];h&&(s[j]=u,s[R]=_);let v=o.run(k,void 0,h&&k!==q&&k!==J?[]:[u]);I(s,!0,v)}catch(t){I(s,!1,t)}},s)}let x=function(){},X=t.AggregateError;class M{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(t){return t instanceof M?t:I(new this(null),F,t)}static reject(t){return I(new this(null),G,t)}static withResolvers(){let t={};return t.promise=new M((o,s)=>{t.resolve=o,t.reject=s}),t}static any(t){if(!t||"function"!=typeof t[Symbol.iterator])return Promise.reject(new X([],"All promises were rejected"));let o=[],s=0;try{for(let u of t)s++,o.push(M.resolve(u))}catch{return Promise.reject(new X([],"All promises were rejected"))}if(0===s)return Promise.reject(new X([],"All promises were rejected"));let u=!1,h=[];return new M((t,_)=>{for(let k=0;k<o.length;k++)o[k].then(o=>{u||(u=!0,t(o))},t=>{h.push(t),s--,0===s&&(u=!0,_(new X(h,"All promises were rejected")))})})}static race(t){let o,s,u=new this((t,u)=>{o=t,s=u});function C(t){o(t)}function m(t){s(t)}for(let o of t)$(o)||(o=this.resolve(o)),o.then(C,m);return u}static all(t){return M.allWithCallback(t)}static allSettled(t){return(this&&this.prototype instanceof M?this:M).allWithCallback(t,{thenCallback:t=>({status:"fulfilled",value:t}),errorCallback:t=>({status:"rejected",reason:t})})}static allWithCallback(t,o){let s,u,h=new this((t,o)=>{s=t,u=o}),_=2,k=0,v=[];for(let h of t){$(h)||(h=this.resolve(h));let t=k;try{h.then(u=>{v[t]=o?o.thenCallback(u):u,_--,0===_&&s(v)},h=>{o?(v[t]=o.errorCallback(h),_--,0===_&&s(v)):u(h)})}catch(t){u(t)}_++,k++}return _-=2,0===_&&s(v),h}constructor(t){let o=this;if(!(o instanceof M))throw new Error("Must be an instanceof Promise.");o[Z]=N,o[P]=[];try{let s=D();t&&t(s(b(o,F)),s(b(o,G)))}catch(t){I(o,!1,t)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return M}then(t,s){let u=this.constructor?.[Symbol.species];(!u||"function"!=typeof u)&&(u=this.constructor||M);let h=new u(x),_=o.current;return this[Z]==N?this[P].push(_,h,t,s):r(this,_,h,t,s),h}catch(t){return this.then(null,t)}finally(t){let s=this.constructor?.[Symbol.species];(!s||"function"!=typeof s)&&(s=M);let u=new s(x);u[O]=O;let h=o.current;return this[Z]==N?this[P].push(h,u,t,t):r(this,h,u,t,t),u}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;let Y=t[E]=t.Promise;t.Promise=M;let K=_("thenPatched");function Q(t){let o=t.prototype,s=u(o,"then");if(s&&(!1===s.writable||!s.configurable))return;let h=o.then;o[w]=h,t.prototype.then=function(t,o){return new M((t,o)=>{h.call(this,t,o)}).then(t,o)},t[K]=!0}return s.patchThen=Q,Y&&(Q(Y),ue(t,"fetch",t=>function(t){return function(o,s){let u=t.apply(o,s);if(u instanceof M)return u;let h=u.constructor;return h[K]||Q(h),u}}(t))),Promise[o.__symbol__("uncaughtPromiseErrors")]=k,M})}function Zt(t,o,s,u,h){let _=Zone.__symbol__(u);if(o[_])return;let k=o[_]=o[u];o[u]=function(_,v,E){return v&&v.prototype&&h.forEach(function(o){let h=`${s}.${u}::`+o,_=v.prototype;try{if(_.hasOwnProperty(o)){let s=t.ObjectGetOwnPropertyDescriptor(_,o);s&&s.value?(s.value=t.wrapWithCurrentZone(s.value,h),t._redefineProperty(v.prototype,o,s)):_[o]&&(_[o]=t.wrapWithCurrentZone(_[o],h))}else _[o]&&(_[o]=t.wrapWithCurrentZone(_[o],h))}catch{}}),k.call(o,_,v,E)},t.attachOriginToPatched(o[u],k)}var ce,he=function(){let o=globalThis,s=!0===o[te("forceDuplicateZoneCheck")];if(o.Zone&&(s||"function"!=typeof o.Zone.__symbol__))throw new Error("Zone already loaded.");return o.Zone??=function(){let o=t.performance;function n(t){o&&o.mark&&o.mark(t)}function a(t,s){o&&o.measure&&o.measure(t,s)}n("Zone");class e{static __symbol__=te;static assertZonePatched(){if(t.Promise!==B.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=e.current;for(;t.parent;)t=t.parent;return t}static get current(){return V.zone}static get currentTask(){return X}static __load_patch(o,s,u=!1){if(B.hasOwnProperty(o)){let s=!0===t[te("forceDuplicateZoneCheck")];if(!u&&s)throw Error("Already loaded patch: "+o)}else if(!t["__Zone_disable_"+o]){let u="Zone:"+o;n(u),B[o]=s(t,e,U),a(u,u)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(t,o){this._parent=t,this._name=o?o.name||"unnamed":"<root>",this._properties=o&&o.properties||{},this._zoneDelegate=new f(this,this._parent&&this._parent._zoneDelegate,o)}get(t){let o=this.getZoneWith(t);if(o)return o._properties[t]}getZoneWith(t){let o=this;for(;o;){if(o._properties.hasOwnProperty(t))return o;o=o._parent}return null}fork(t){if(!t)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,t)}wrap(t,o){if("function"!=typeof t)throw new Error("Expecting function got: "+t);let s=this._zoneDelegate.intercept(this,t,o),u=this;return function(){return u.runGuarded(s,this,arguments,o)}}run(t,o,s,u){V={parent:V,zone:this};try{return this._zoneDelegate.invoke(this,t,o,s,u)}finally{V=V.parent}}runGuarded(t,o=null,s,u){V={parent:V,zone:this};try{try{return this._zoneDelegate.invoke(this,t,o,s,u)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{V=V.parent}}runTask(t,o,s){if(t.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(t.zone||w).name+"; Execution: "+this.name+")");let u=t,{type:h,data:{isPeriodic:_=!1,isRefreshable:k=!1}={}}=t;if(t.state===S&&(h===G||h===F))return;let v=t.state!=O;v&&u._transitionTo(O,P);let E=X;X=u,V={parent:V,zone:this};try{h==F&&t.data&&!_&&!k&&(t.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,u,o,s)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{let o=t.state;if(o!==S&&o!==R)if(h==G||_||k&&o===Z)v&&u._transitionTo(P,O,Z);else{let t=u._zoneDelegates;this._updateTaskCount(u,-1),v&&u._transitionTo(S,O,S),k&&(u._zoneDelegates=t)}V=V.parent,X=E}}scheduleTask(t){if(t.zone&&t.zone!==this){let o=this;for(;o;){if(o===t.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${t.zone.name}`);o=o.parent}}t._transitionTo(Z,S);let o=[];t._zoneDelegates=o,t._zone=this;try{t=this._zoneDelegate.scheduleTask(this,t)}catch(o){throw t._transitionTo(R,Z,S),this._zoneDelegate.handleError(this,o),o}return t._zoneDelegates===o&&this._updateTaskCount(t,1),t.state==Z&&t._transitionTo(P,Z),t}scheduleMicroTask(t,o,s,u){return this.scheduleTask(new g(N,t,o,s,u,void 0))}scheduleMacroTask(t,o,s,u,h){return this.scheduleTask(new g(F,t,o,s,u,h))}scheduleEventTask(t,o,s,u,h){return this.scheduleTask(new g(G,t,o,s,u,h))}cancelTask(t){if(t.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(t.zone||w).name+"; Execution: "+this.name+")");if(t.state===P||t.state===O){t._transitionTo(j,P,O);try{this._zoneDelegate.cancelTask(this,t)}catch(o){throw t._transitionTo(R,j),this._zoneDelegate.handleError(this,o),o}return this._updateTaskCount(t,-1),t._transitionTo(S,j),t.runCount=-1,t}}_updateTaskCount(t,o){let s=t._zoneDelegates;-1==o&&(t._zoneDelegates=null);for(let u=0;u<s.length;u++)s[u]._updateTaskCount(t.type,o)}}let s={name:"",onHasTask:(t,o,s,u)=>t.hasTask(s,u),onScheduleTask:(t,o,s,u)=>t.scheduleTask(s,u),onInvokeTask:(t,o,s,u,h,_)=>t.invokeTask(s,u,h,_),onCancelTask:(t,o,s,u)=>t.cancelTask(s,u)};class f{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(t,o,u){this._zone=t,this._parentDelegate=o,this._forkZS=u&&(u&&u.onFork?u:o._forkZS),this._forkDlgt=u&&(u.onFork?o:o._forkDlgt),this._forkCurrZone=u&&(u.onFork?this._zone:o._forkCurrZone),this._interceptZS=u&&(u.onIntercept?u:o._interceptZS),this._interceptDlgt=u&&(u.onIntercept?o:o._interceptDlgt),this._interceptCurrZone=u&&(u.onIntercept?this._zone:o._interceptCurrZone),this._invokeZS=u&&(u.onInvoke?u:o._invokeZS),this._invokeDlgt=u&&(u.onInvoke?o:o._invokeDlgt),this._invokeCurrZone=u&&(u.onInvoke?this._zone:o._invokeCurrZone),this._handleErrorZS=u&&(u.onHandleError?u:o._handleErrorZS),this._handleErrorDlgt=u&&(u.onHandleError?o:o._handleErrorDlgt),this._handleErrorCurrZone=u&&(u.onHandleError?this._zone:o._handleErrorCurrZone),this._scheduleTaskZS=u&&(u.onScheduleTask?u:o._scheduleTaskZS),this._scheduleTaskDlgt=u&&(u.onScheduleTask?o:o._scheduleTaskDlgt),this._scheduleTaskCurrZone=u&&(u.onScheduleTask?this._zone:o._scheduleTaskCurrZone),this._invokeTaskZS=u&&(u.onInvokeTask?u:o._invokeTaskZS),this._invokeTaskDlgt=u&&(u.onInvokeTask?o:o._invokeTaskDlgt),this._invokeTaskCurrZone=u&&(u.onInvokeTask?this._zone:o._invokeTaskCurrZone),this._cancelTaskZS=u&&(u.onCancelTask?u:o._cancelTaskZS),this._cancelTaskDlgt=u&&(u.onCancelTask?o:o._cancelTaskDlgt),this._cancelTaskCurrZone=u&&(u.onCancelTask?this._zone:o._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let h=u&&u.onHasTask,_=o&&o._hasTaskZS;(h||_)&&(this._hasTaskZS=h?u:s,this._hasTaskDlgt=o,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,u.onScheduleTask||(this._scheduleTaskZS=s,this._scheduleTaskDlgt=o,this._scheduleTaskCurrZone=this._zone),u.onInvokeTask||(this._invokeTaskZS=s,this._invokeTaskDlgt=o,this._invokeTaskCurrZone=this._zone),u.onCancelTask||(this._cancelTaskZS=s,this._cancelTaskDlgt=o,this._cancelTaskCurrZone=this._zone))}fork(t,o){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,t,o):new e(t,o)}intercept(t,o,s){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,t,o,s):o}invoke(t,o,s,u,h){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,t,o,s,u,h):o.apply(s,u)}handleError(t,o){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,t,o)}scheduleTask(t,o){let s=o;if(this._scheduleTaskZS)this._hasTaskZS&&s._zoneDelegates.push(this._hasTaskDlgtOwner),s=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,t,o),s||(s=o);else if(o.scheduleFn)o.scheduleFn(o);else{if(o.type!=N)throw new Error("Task is missing scheduleFn.");z(o)}return s}invokeTask(t,o,s,u){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,t,o,s,u):o.callback.apply(s,u)}cancelTask(t,o){let s;if(this._cancelTaskZS)s=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,t,o);else{if(!o.cancelFn)throw Error("Task is not cancelable");s=o.cancelFn(o)}return s}hasTask(t,o){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,t,o)}catch(o){this.handleError(t,o)}}_updateTaskCount(t,o){let s=this._taskCounts,u=s[t],h=s[t]=u+o;if(h<0)throw new Error("More tasks executed then were scheduled.");if(0==u||0==h){let o={microTask:s.microTask>0,macroTask:s.macroTask>0,eventTask:s.eventTask>0,change:t};this.hasTask(this._zone,o)}}}class g{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(o,s,u,h,_,k){if(this.type=o,this.source=s,this.data=h,this.scheduleFn=_,this.cancelFn=k,!u)throw new Error("callback is not defined");this.callback=u;let v=this;o===G&&h&&h.useG?this.invoke=g.invokeTask:this.invoke=function(){return g.invokeTask.call(t,v,this,arguments)}}static invokeTask(t,o,s){t||(t=this),Y++;try{return t.runCount++,t.zone.runTask(t,o,s)}finally{1==Y&&$(),Y--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(S,Z)}_transitionTo(t,o,s){if(this._state!==o&&this._state!==s)throw new Error(`${this.type} '${this.source}': can not transition to '${t}', expecting state '${o}'${s?" or '"+s+"'":""}, was '${this._state}'.`);this._state=t,t==S&&(this._zoneDelegates=null)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let u,h=te("setTimeout"),_=te("Promise"),k=te("then"),v=[],E=!1;function H(o){if(u||t[_]&&(u=t[_].resolve(0)),u){let t=u[k];t||(t=u.then),t.call(u,o)}else t[h](o,0)}function z(t){0===Y&&0===v.length&&H($),t&&v.push(t)}function $(){if(!E){for(E=!0;v.length;){let t=v;v=[];for(let o=0;o<t.length;o++){let s=t[o];try{s.zone.runTask(s,null,null)}catch(t){U.onUnhandledError(t)}}}U.microtaskDrainDone(),E=!1}}let w={name:"NO ZONE"},S="notScheduled",Z="scheduling",P="scheduled",O="running",j="canceling",R="unknown",N="microTask",F="macroTask",G="eventTask",B={},U={symbol:te,currentZoneFrame:()=>V,onUnhandledError:W,microtaskDrainDone:W,scheduleMicroTask:z,showUncaughtError:()=>!e[te("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:W,patchMethod:()=>W,bindArguments:()=>[],patchThen:()=>W,patchMacroTask:()=>W,patchEventPrototype:()=>W,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>W,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>W,wrapWithCurrentZone:()=>W,filterProperties:()=>[],attachOriginToPatched:()=>W,_redefineProperty:()=>W,patchCallbacks:()=>W,nativeScheduleMicroTask:H},V={parent:null,zone:new e(null,null)},X=null,Y=0;function W(){}return a("Zone","Zone"),e}(),o.Zone}();Ot(ce=he),function(t){t.__load_patch("toString",t=>{let o=Function.prototype.toString,s=O("OriginalDelegate"),u=O("Promise"),h=O("Error"),g=function(){if("function"==typeof this){let _=this[s];if(_)return"function"==typeof _?o.call(_):Object.prototype.toString.call(_);if(this===Promise){let s=t[u];if(s)return o.call(s)}if(this===Error){let s=t[h];if(s)return o.call(s)}}return o.call(this)};g[s]=o,Function.prototype.toString=g;let _=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":_.call(this)}})}(ce),function(t){t.__load_patch("util",(t,u,E)=>{let w=Ie(t);E.patchOnProperties=rt,E.patchMethod=ue,E.bindArguments=Fe,E.patchMacroTask=mt;let O=u.__symbol__("BLACK_LISTED_EVENTS"),j=u.__symbol__("UNPATCHED_EVENTS");t[j]&&(t[O]=t[j]),t[O]&&(u[O]=u[j]=t[O]),E.patchEventPrototype=bt,E.patchEventTarget=vt,E.isIEOrEdge=yt,E.ObjectDefineProperty=s,E.ObjectGetOwnPropertyDescriptor=o,E.ObjectCreate=h,E.ArraySlice=_,E.patchClass=ye,E.wrapWithCurrentZone=Ve,E.filterProperties=lt,E.attachOriginToPatched=fe,E._redefineProperty=Object.defineProperty,E.patchCallbacks=Zt,E.getGlobalObjects=()=>({globalSources:oe,zoneSymbolEventNames:re,eventNames:w,isBrowser:B,isMix:U,isNode:G,TRUE_STR:S,FALSE_STR:Z,ZONE_SYMBOL_PREFIX:P,ADD_EVENT_LISTENER_STR:k,REMOVE_EVENT_LISTENER_STR:v})})}(ce),function(t){t.__load_patch("legacy",o=>{let s=o[t.__symbol__("legacyPatch")];s&&s()}),t.__load_patch("timers",t=>{let o="clear";ke(t,"set",o,"Timeout"),ke(t,"set",o,"Interval"),ke(t,"set",o,"Immediate")}),t.__load_patch("requestAnimationFrame",t=>{ke(t,"request","cancel","AnimationFrame"),ke(t,"mozRequest","mozCancel","AnimationFrame"),ke(t,"webkitRequest","webkitCancel","AnimationFrame")}),t.__load_patch("blocking",(t,o)=>{let s=["alert","prompt","confirm"];for(let u=0;u<s.length;u++){ue(t,s[u],(s,u,h)=>function(u,_){return o.current.run(s,t,_,h)})}}),t.__load_patch("EventTarget",(t,o,s)=>{(function(t,o){o.patchEventPrototype(t,o)})(t,s),function(t,o){if(Zone[o.symbol("patchEventTarget")])return;let{eventNames:s,zoneSymbolEventNames:u,TRUE_STR:h,FALSE_STR:_,ZONE_SYMBOL_PREFIX:k}=o.getGlobalObjects();for(let t=0;t<s.length;t++){let o=s[t],v=k+(o+_),E=k+(o+h);u[o]={},u[o][_]=v,u[o][h]=E}let v=t.EventTarget;v&&v.prototype&&o.patchEventTarget(t,o,[v&&v.prototype])}(t,s);let u=t.XMLHttpRequestEventTarget;u&&u.prototype&&s.patchEventTarget(t,s,[u.prototype])}),t.__load_patch("MutationObserver",(t,o,s)=>{ye("MutationObserver"),ye("WebKitMutationObserver")}),t.__load_patch("IntersectionObserver",(t,o,s)=>{ye("IntersectionObserver")}),t.__load_patch("FileReader",(t,o,s)=>{ye("FileReader")}),t.__load_patch("on_property",(t,o,s)=>{!function(t,o){if(G&&!U||Zone[t.symbol("patchEvents")])return;let s=o.__Zone_ignore_on_properties,h=[];if(B){let t=window;h=h.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);let o=[];Qe(t,Ie(t),s&&s.concat(o),u(t))}h=h.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let t=0;t<h.length;t++){let u=o[h[t]];u?.prototype&&Qe(u.prototype,Ie(u.prototype),s)}}(s,t)}),t.__load_patch("customElements",(t,o,s)=>{!function(t,o){let{isBrowser:s,isMix:u}=o.getGlobalObjects();if(!s&&!u||!t.customElements||!("customElements"in t))return;o.patchCallbacks(o,t.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"])}(t,s)}),t.__load_patch("XHR",(t,o)=>{!function(t){let S=t.XMLHttpRequest;if(!S)return;let Z=S.prototype;let P=Z[E],j=Z[w];if(!P){let o=t.XMLHttpRequestEventTarget;if(o){let t=o.prototype;P=t[E],j=t[w]}}let R="readystatechange",N="scheduled";function p(t){let u=t.data,k=u.target;k[_]=!1,k[v]=!1;let S=k[h];P||(P=k[E],j=k[w]),S&&j.call(k,R,S);let Z=k[h]=()=>{if(k.readyState===k.DONE)if(!u.aborted&&k[_]&&t.state===N){let s=k[o.__symbol__("loadfalse")];if(0!==k.status&&s&&s.length>0){let h=t.invoke;t.invoke=function(){let s=k[o.__symbol__("loadfalse")];for(let o=0;o<s.length;o++)s[o]===t&&s.splice(o,1);!u.aborted&&t.state===N&&h.call(t)},s.push(t)}else t.invoke()}else!u.aborted&&!1===k[_]&&(k[v]=!0)};return P.call(k,R,Z),k[s]||(k[s]=t),U.apply(k,u.args),k[_]=!0,t}function d(){}function A(t){let o=t.data;return o.aborted=!0,V.apply(o.target,o.args)}let F=ue(Z,"open",()=>function(t,o){return t[u]=0==o[2],t[k]=o[1],F.apply(t,o)}),G=O("fetchTaskAborting"),B=O("fetchTaskScheduling"),U=ue(Z,"send",()=>function(t,s){if(!0===o.current[B]||t[u])return U.apply(t,s);{let o={target:t,url:t[k],isPeriodic:!1,args:s,aborted:!1},u=xe("XMLHttpRequest.send",d,o,p,A);t&&!0===t[v]&&!o.aborted&&u.state===N&&u.invoke()}}),V=ue(Z,"abort",()=>function(t,u){let h=function(t){return t[s]}(t);if(h&&"string"==typeof h.type){if(null==h.cancelFn||h.data&&h.data.aborted)return;h.zone.cancelTask(h)}else if(!0===o.current[G])return V.apply(t,u)})}(t);let s=O("xhrTask"),u=O("xhrSync"),h=O("xhrListener"),_=O("xhrScheduled"),k=O("xhrURL"),v=O("xhrErrorBeforeScheduled")}),t.__load_patch("geolocation",t=>{t.navigator&&t.navigator.geolocation&&function(t,s){let u=t.constructor.name;for(let h=0;h<s.length;h++){let _=s[h],k=t[_];if(k){if(!et(o(t,_)))continue;t[_]=(t=>{let y=function(){return t.apply(this,Fe(arguments,u+"."+_))};return fe(y,t),y})(k)}}}(t.navigator.geolocation,["getCurrentPosition","watchPosition"])}),t.__load_patch("PromiseRejectionEvent",(t,o)=>{function e(o){return function(s){at(t,o).forEach(u=>{let h=t.PromiseRejectionEvent;if(h){let t=new h(o,{promise:s.promise,reason:s.rejection});u.invoke(t)}})}}t.PromiseRejectionEvent&&(o[O("unhandledPromiseRejectionHandler")]=e("unhandledrejection"),o[O("rejectionHandledHandler")]=e("rejectionhandled"))}),t.__load_patch("queueMicrotask",(t,o,s)=>{!function(t,o){o.patchMethod(t,"queueMicrotask",t=>function(t,o){Zone.current.scheduleMicroTask("queueMicrotask",o[0])})}(t,s)})}(he);
1
+ var t=globalThis;function te(o){return(t.__Zone_symbol_prefix||"__zone_symbol__")+o}var o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,u=Object.getPrototypeOf,h=Object.create,_=Array.prototype.slice,k="addEventListener",v="removeEventListener",E=te(k),w=te(v),S="true",Z="false",P=te("");function Ve(t,o){return Zone.current.wrap(t,o)}function xe(t,o,s,u,h){return Zone.current.scheduleMacroTask(t,o,s,u,h)}var O=te,j=typeof window<"u",R=j?window:void 0,N=j&&R||globalThis;function Fe(t,o){for(let s=t.length-1;s>=0;s--)"function"==typeof t[s]&&(t[s]=Ve(t[s],o+"_"+s));return t}function et(t){return!t||!1!==t.writable&&!("function"==typeof t.get&&typeof t.set>"u")}var F=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,G=!("nw"in N)&&typeof N.process<"u"&&"[object process]"===N.process.toString(),B=!G&&!F&&!(!j||!R.HTMLElement),U=typeof N.process<"u"&&"[object process]"===N.process.toString()&&!F&&!(!j||!R.HTMLElement),V={},X=O("enable_beforeunload"),Xe=function(t){if(!(t=t||N.event))return;let o=V[t.type];o||(o=V[t.type]=O("ON_PROPERTY"+t.type));let s,u=this||t.target||N,h=u[o];if(B&&u===R&&"error"===t.type){let o=t;s=h&&h.call(this,o.message,o.filename,o.lineno,o.colno,o.error),!0===s&&t.preventDefault()}else s=h&&h.apply(this,arguments),"beforeunload"===t.type&&N[X]&&"string"==typeof s?t.returnValue=s:null!=s&&!s&&t.preventDefault();return s};function Ye(t,u,h){let _=o(t,u);if(!_&&h&&o(h,u)&&(_={enumerable:!0,configurable:!0}),!_||!_.configurable)return;let k=O("on"+u+"patched");if(t.hasOwnProperty(k)&&t[k])return;delete _.writable,delete _.value;let v=_.get,E=_.set,w=u.slice(2),S=V[w];S||(S=V[w]=O("ON_PROPERTY"+w)),_.set=function(o){let s=this;!s&&t===N&&(s=N),s&&("function"==typeof s[S]&&s.removeEventListener(w,Xe),E?.call(s,null),s[S]=o,"function"==typeof o&&s.addEventListener(w,Xe,!1))},_.get=function(){let o=this;if(!o&&t===N&&(o=N),!o)return null;let s=o[S];if(s)return s;if(v){let t=v.call(this);if(t)return _.set.call(this,t),"function"==typeof o.removeAttribute&&o.removeAttribute(u),t}return null},s(t,u,_),t[k]=!0}function rt(t,o,s){if(o)for(let u=0;u<o.length;u++)Ye(t,"on"+o[u],s);else{let o=[];for(let s in t)"on"==s.slice(0,2)&&o.push(s);for(let u=0;u<o.length;u++)Ye(t,o[u],s)}}var Y=O("originalInstance");function ye(t){let o=N[t];if(!o)return;N[O(t)]=o,N[t]=function(){let s=Fe(arguments,t);switch(s.length){case 0:this[Y]=new o;break;case 1:this[Y]=new o(s[0]);break;case 2:this[Y]=new o(s[0],s[1]);break;case 3:this[Y]=new o(s[0],s[1],s[2]);break;case 4:this[Y]=new o(s[0],s[1],s[2],s[3]);break;default:throw new Error("Arg list too long.")}},fe(N[t],o);let u,h=new o(function(){});for(u in h)"XMLHttpRequest"===t&&"responseBlob"===u||function(o){"function"==typeof h[o]?N[t].prototype[o]=function(){return this[Y][o].apply(this[Y],arguments)}:s(N[t].prototype,o,{set:function(s){"function"==typeof s?(this[Y][o]=Ve(s,t+"."+o),fe(this[Y][o],s)):this[Y][o]=s},get:function(){return this[Y][o]}})}(u);for(u in o)"prototype"!==u&&o.hasOwnProperty(u)&&(N[t][u]=o[u])}function ue(t,s,h){let _=t;for(;_&&!_.hasOwnProperty(s);)_=u(_);!_&&t[s]&&(_=t);let k=O(s),v=null;if(_&&(!(v=_[k])||!_.hasOwnProperty(k))&&(v=_[k]=_[s],et(_&&o(_,s)))){let t=h(v,k,s);_[s]=function(){return t(this,arguments)},fe(_[s],v)}return v}function mt(t,o,s){let u=null;function c(t){let o=t.data;return o.args[o.cbIdx]=function(){t.invoke.apply(this,arguments)},u.apply(o.target,o.args),t}u=ue(t,o,t=>function(o,u){let h=s(o,u);return h.cbIdx>=0&&"function"==typeof u[h.cbIdx]?xe(h.name,u[h.cbIdx],h,c):t.apply(o,u)})}function fe(t,o){t[O("OriginalDelegate")]=o}var K=!1,ee=!1;function yt(){if(K)return ee;K=!0;try{let t=R.navigator.userAgent;(-1!==t.indexOf("MSIE ")||-1!==t.indexOf("Trident/")||-1!==t.indexOf("Edge/"))&&(ee=!0)}catch{}return ee}function Je(t){return"function"==typeof t}function Ke(t){return"number"==typeof t}var ne={useG:!0},re={},oe={},ae=new RegExp("^"+P+"(\\w+)(true|false)$"),le=O("propagationStopped");function ct(t,o){let s=(o?o(t):t)+Z,u=(o?o(t):t)+S,h=P+s,_=P+u;re[t]={},re[t][Z]=h,re[t][S]=_}function vt(t,o,s,h){let _=h&&h.add||k,E=h&&h.rm||v,w=h&&h.listeners||"eventListeners",j=h&&h.rmAll||"removeAllListeners",R=O(_),N="."+_+":",F="prependListener",B="."+F+":",L=function(t,o,s){if(t.isRemoved)return;let u,h=t.callback;"object"==typeof h&&h.handleEvent&&(t.callback=t=>h.handleEvent(t),t.originalDelegate=h);try{t.invoke(t,o,[s])}catch(t){u=t}let _=t.options;if(_&&"object"==typeof _&&_.once){let u=t.originalDelegate?t.originalDelegate:t.callback;o[E].call(o,s.type,u,_)}return u};function H(s,u,h){if(!(u=u||t.event))return;let _=s||u.target||t,k=_[re[u.type][h?S:Z]];if(k){let t=[];if(1===k.length){let o=L(k[0],_,u);o&&t.push(o)}else{let o=k.slice();for(let s=0;s<o.length&&(!u||!0!==u[le]);s++){let h=L(o[s],_,u);h&&t.push(h)}}if(1===t.length)throw t[0];for(let s=0;s<t.length;s++){let u=t[s];o.nativeScheduleMicroTask(()=>{throw u})}}}let z=function(t){return H(this,t,!1)},$=function(t){return H(this,t,!0)};function J(o,s){if(!o)return!1;let h=!0;s&&void 0!==s.useG&&(h=s.useG);let k=s&&s.vh,v=!0;s&&void 0!==s.chkDup&&(v=s.chkDup);let U=!1;s&&void 0!==s.rt&&(U=s.rt);let V=o;for(;V&&!V.hasOwnProperty(_);)V=u(V);if(!V&&o[_]&&(V=o),!V||V[R])return!1;let X,Y=s&&s.eventNameToString,K={},ee=V[R]=V[_],le=V[O(E)]=V[E],se=V[O(w)]=V[w],ce=V[O(j)]=V[j];s&&s.prepend&&(X=V[O(s.prepend)]=V[s.prepend]);let he=h?function(t){if(!K.isExisting)return ee.call(K.target,K.eventName,K.capture?$:z,K.options)}:function(t){return ee.call(K.target,K.eventName,t.invoke,K.options)},pe=h?function(t){if(!t.isRemoved){let o,s=re[t.eventName];s&&(o=s[t.capture?S:Z]);let u=o&&t.target[o];if(u)for(let s=0;s<u.length;s++)if(u[s]===t){u.splice(s,1),t.isRemoved=!0,t.removeAbortListener&&(t.removeAbortListener(),t.removeAbortListener=null),0===u.length&&(t.allRemoved=!0,t.target[o]=null);break}}if(t.allRemoved)return le.call(t.target,t.eventName,t.capture?$:z,t.options)}:function(t){return le.call(t.target,t.eventName,t.invoke,t.options)},_e=s?.diff||function(t,o){let s=typeof o;return"function"===s&&t.callback===o||"object"===s&&t.originalDelegate===o},de=Zone[O("UNPATCHED_EVENTS")],ge=t[O("PASSIVE_EVENTS")],l=function(o,u,_,E,w=!1,P=!1){return function(){let O=this||t,j=arguments[0];s&&s.transferEventName&&(j=s.transferEventName(j));let R=arguments[1];if(!R)return o.apply(this,arguments);if(G&&"uncaughtException"===j)return o.apply(this,arguments);let N=!1;if("function"!=typeof R){if(!R.handleEvent)return o.apply(this,arguments);N=!0}if(k&&!k(o,R,O,arguments))return;let F=!!ge&&-1!==ge.indexOf(j),B=function(t){if("object"==typeof t&&null!==t){let o={...t};return t.signal&&(o.signal=t.signal),o}return t}(function(t,o){return o?"boolean"==typeof t?{capture:t,passive:!0}:t?"object"==typeof t&&!1!==t.passive?{...t,passive:!0}:t:{passive:!0}:t}(arguments[2],F)),U=B?.signal;if(U?.aborted)return;if(de)for(let t=0;t<de.length;t++)if(j===de[t])return F?o.call(O,j,R,B):o.apply(this,arguments);let V=!!B&&("boolean"==typeof B||B.capture),X=!(!B||"object"!=typeof B)&&B.once,ee=Zone.current,ae=re[j];ae||(ct(j,Y),ae=re[j]);let le=ae[V?S:Z],se=O[le],ce=!1;if(se){if(ce=!0,v)for(let t=0;t<se.length;t++)if(_e(se[t],R))return}else se=O[le]=[];let he,pe=O.constructor.name,Te=oe[pe];Te&&(he=Te[j]),he||(he=pe+u+(Y?Y(j):j)),K.options=B,X&&(K.options.once=!1),K.target=O,K.capture=V,K.eventName=j,K.isExisting=ce;let me=h?ne:void 0;me&&(me.taskData=K),U&&(K.options.signal=void 0);let ve=ee.scheduleEventTask(he,R,me,_,E);if(U){K.options.signal=U;let ie=()=>ve.zone.cancelTask(ve);o.call(U,"abort",ie,{once:!0}),ve.removeAbortListener=()=>U.removeEventListener("abort",ie)}return K.target=null,me&&(me.taskData=null),X&&(K.options.once=!0),"boolean"!=typeof ve.options&&(ve.options=B),ve.target=O,ve.capture=V,ve.eventName=j,N&&(ve.originalDelegate=R),P?se.unshift(ve):se.push(ve),w?O:void 0}};return V[_]=l(ee,N,he,pe,U),X&&(V[F]=l(X,B,function(t){return X.call(K.target,K.eventName,t.invoke,K.options)},pe,U,!0)),V[E]=function(){let o=this||t,u=arguments[0];s&&s.transferEventName&&(u=s.transferEventName(u));let h=arguments[2],_=!!h&&("boolean"==typeof h||h.capture),v=arguments[1];if(!v)return le.apply(this,arguments);if(k&&!k(le,v,o,arguments))return;let E,w=re[u];w&&(E=w[_?S:Z]);let O=E&&o[E];if(O)for(let t=0;t<O.length;t++){let s=O[t];if(_e(s,v))return O.splice(t,1),s.isRemoved=!0,0!==O.length||(s.allRemoved=!0,o[E]=null,_||"string"!=typeof u)||(o[P+"ON_PROPERTY"+u]=null),s.zone.cancelTask(s),U?o:void 0}return le.apply(this,arguments)},V[w]=function(){let o=this||t,u=arguments[0];s&&s.transferEventName&&(u=s.transferEventName(u));let h=[],_=at(o,Y?Y(u):u);for(let t=0;t<_.length;t++){let o=_[t],s=o.originalDelegate?o.originalDelegate:o.callback;h.push(s)}return h},V[j]=function(){let o=this||t,u=arguments[0];if(u){s&&s.transferEventName&&(u=s.transferEventName(u));let t=re[u];if(t){let s=t[Z],h=t[S],_=o[s],k=o[h];if(_){let t=_.slice();for(let o=0;o<t.length;o++){let s=t[o],h=s.originalDelegate?s.originalDelegate:s.callback;this[E].call(this,u,h,s.options)}}if(k){let t=k.slice();for(let o=0;o<t.length;o++){let s=t[o],h=s.originalDelegate?s.originalDelegate:s.callback;this[E].call(this,u,h,s.options)}}}}else{let t=Object.keys(o);for(let o=0;o<t.length;o++){let s=t[o],u=ae.exec(s),h=u&&u[1];h&&"removeListener"!==h&&this[j].call(this,h)}this[j].call(this,"removeListener")}if(U)return this},fe(V[_],ee),fe(V[E],le),ce&&fe(V[j],ce),se&&fe(V[w],se),!0}let U=[];for(let t=0;t<s.length;t++)U[t]=J(s[t],h);return U}function at(t,o){if(!o){let s=[];for(let u in t){let h=ae.exec(u),_=h&&h[1];if(_&&(!o||_===o)){let o=t[u];if(o)for(let t=0;t<o.length;t++)s.push(o[t])}}return s}let s=re[o];s||(ct(o),s=re[o]);let u=t[s[Z]],h=t[s[S]];return u?h?u.concat(h):u.slice():h?h.slice():[]}function bt(t,o){let s=t.Event;s&&s.prototype&&o.patchMethod(s.prototype,"stopImmediatePropagation",t=>function(o,s){o[le]=!0,t&&t.apply(o,s)})}var se=O("zoneTask");function ke(t,o,s,u){let h=null,_=null;s+=u;let k={};function T(o){let s=o.data;s.args[0]=function(){return o.invoke.apply(this,arguments)};let u=h.apply(t,s.args);return Ke(u)?s.handleId=u:(s.handle=u,s.isRefreshable=Je(u.refresh)),o}function y(o){let{handle:s,handleId:u}=o.data;return _.call(t,s??u)}h=ue(t,o+=u,s=>function(h,_){if(Je(_[0])){let t={isRefreshable:!1,isPeriodic:"Interval"===u,delay:"Timeout"===u||"Interval"===u?_[1]||0:void 0,args:_},s=_[0];_[0]=function(){try{return s.apply(this,arguments)}finally{let{handle:o,handleId:s,isPeriodic:u,isRefreshable:h}=t;!u&&!h&&(s?delete k[s]:o&&(o[se]=null))}};let h=xe(o,_[0],t,T,y);if(!h)return h;let{handleId:v,handle:E,isRefreshable:w,isPeriodic:S}=h.data;if(v)k[v]=h;else if(E&&(E[se]=h,w&&!S)){let t=E.refresh;E.refresh=function(){let{zone:o,state:s}=h;return"notScheduled"===s?(h._state="scheduled",o._updateTaskCount(h,1)):"running"===s&&(h._state="scheduling"),t.call(this)}}return E??v??h}return s.apply(t,_)}),_=ue(t,s,o=>function(s,u){let h,_=u[0];Ke(_)?(h=k[_],delete k[_]):(h=_?.[se],h?_[se]=null:h=_),h?.type?h.cancelFn&&h.zone.cancelTask(h):o.apply(t,u)})}function lt(t,o,s){if(!s||0===s.length)return o;let u=s.filter(o=>o.target===t);if(0===u.length)return o;let h=u[0].ignoreProperties;return o.filter(t=>-1===h.indexOf(t))}function Qe(t,o,s,u){t&&rt(t,lt(t,o,s),u)}function Ie(t){return Object.getOwnPropertyNames(t).filter(t=>t.startsWith("on")&&t.length>2).map(t=>t.substring(2))}function Zt(t,o,s,u,h){let _=Zone.__symbol__(u);if(o[_])return;let k=o[_]=o[u];o[u]=function(_,v,E){return v&&v.prototype&&h.forEach(function(o){let h=`${s}.${u}::`+o,_=v.prototype;try{if(_.hasOwnProperty(o)){let s=t.ObjectGetOwnPropertyDescriptor(_,o);s&&s.value?(s.value=t.wrapWithCurrentZone(s.value,h),t._redefineProperty(v.prototype,o,s)):_[o]&&(_[o]=t.wrapWithCurrentZone(_[o],h))}else _[o]&&(_[o]=t.wrapWithCurrentZone(_[o],h))}catch{}}),k.call(o,_,v,E)},t.attachOriginToPatched(o[u],k)}var ce,he=function(){let o=globalThis,s=!0===o[te("forceDuplicateZoneCheck")];if(o.Zone&&(s||"function"!=typeof o.Zone.__symbol__))throw new Error("Zone already loaded.");return o.Zone??=function(){let o=t.performance;function n(t){o&&o.mark&&o.mark(t)}function a(t,s){o&&o.measure&&o.measure(t,s)}n("Zone");class e{static __symbol__=te;static assertZonePatched(){if(t.Promise!==B.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=e.current;for(;t.parent;)t=t.parent;return t}static get current(){return V.zone}static get currentTask(){return X}static __load_patch(o,s,u=!1){if(B.hasOwnProperty(o)){let s=!0===t[te("forceDuplicateZoneCheck")];if(!u&&s)throw Error("Already loaded patch: "+o)}else if(!t["__Zone_disable_"+o]){let u="Zone:"+o;n(u),B[o]=s(t,e,U),a(u,u)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(t,o){this._parent=t,this._name=o?o.name||"unnamed":"<root>",this._properties=o&&o.properties||{},this._zoneDelegate=new f(this,this._parent&&this._parent._zoneDelegate,o)}get(t){let o=this.getZoneWith(t);if(o)return o._properties[t]}getZoneWith(t){let o=this;for(;o;){if(o._properties.hasOwnProperty(t))return o;o=o._parent}return null}fork(t){if(!t)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,t)}wrap(t,o){if("function"!=typeof t)throw new Error("Expecting function got: "+t);let s=this._zoneDelegate.intercept(this,t,o),u=this;return function(){return u.runGuarded(s,this,arguments,o)}}run(t,o,s,u){V={parent:V,zone:this};try{return this._zoneDelegate.invoke(this,t,o,s,u)}finally{V=V.parent}}runGuarded(t,o=null,s,u){V={parent:V,zone:this};try{try{return this._zoneDelegate.invoke(this,t,o,s,u)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{V=V.parent}}runTask(t,o,s){if(t.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(t.zone||w).name+"; Execution: "+this.name+")");let u=t,{type:h,data:{isPeriodic:_=!1,isRefreshable:k=!1}={}}=t;if(t.state===S&&(h===G||h===F))return;let v=t.state!=O;v&&u._transitionTo(O,P);let E=X;X=u,V={parent:V,zone:this};try{h==F&&t.data&&!_&&!k&&(t.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,u,o,s)}catch(t){if(this._zoneDelegate.handleError(this,t))throw t}}finally{let o=t.state;if(o!==S&&o!==R)if(h==G||_||k&&o===Z)v&&u._transitionTo(P,O,Z);else{let t=u._zoneDelegates;this._updateTaskCount(u,-1),v&&u._transitionTo(S,O,S),k&&(u._zoneDelegates=t)}V=V.parent,X=E}}scheduleTask(t){if(t.zone&&t.zone!==this){let o=this;for(;o;){if(o===t.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${t.zone.name}`);o=o.parent}}t._transitionTo(Z,S);let o=[];t._zoneDelegates=o,t._zone=this;try{t=this._zoneDelegate.scheduleTask(this,t)}catch(o){throw t._transitionTo(R,Z,S),this._zoneDelegate.handleError(this,o),o}return t._zoneDelegates===o&&this._updateTaskCount(t,1),t.state==Z&&t._transitionTo(P,Z),t}scheduleMicroTask(t,o,s,u){return this.scheduleTask(new g(N,t,o,s,u,void 0))}scheduleMacroTask(t,o,s,u,h){return this.scheduleTask(new g(F,t,o,s,u,h))}scheduleEventTask(t,o,s,u,h){return this.scheduleTask(new g(G,t,o,s,u,h))}cancelTask(t){if(t.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(t.zone||w).name+"; Execution: "+this.name+")");if(t.state===P||t.state===O){t._transitionTo(j,P,O);try{this._zoneDelegate.cancelTask(this,t)}catch(o){throw t._transitionTo(R,j),this._zoneDelegate.handleError(this,o),o}return this._updateTaskCount(t,-1),t._transitionTo(S,j),t.runCount=-1,t}}_updateTaskCount(t,o){let s=t._zoneDelegates;-1==o&&(t._zoneDelegates=null);for(let u=0;u<s.length;u++)s[u]._updateTaskCount(t.type,o)}}let s={name:"",onHasTask:(t,o,s,u)=>t.hasTask(s,u),onScheduleTask:(t,o,s,u)=>t.scheduleTask(s,u),onInvokeTask:(t,o,s,u,h,_)=>t.invokeTask(s,u,h,_),onCancelTask:(t,o,s,u)=>t.cancelTask(s,u)};class f{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(t,o,u){this._zone=t,this._parentDelegate=o,this._forkZS=u&&(u&&u.onFork?u:o._forkZS),this._forkDlgt=u&&(u.onFork?o:o._forkDlgt),this._forkCurrZone=u&&(u.onFork?this._zone:o._forkCurrZone),this._interceptZS=u&&(u.onIntercept?u:o._interceptZS),this._interceptDlgt=u&&(u.onIntercept?o:o._interceptDlgt),this._interceptCurrZone=u&&(u.onIntercept?this._zone:o._interceptCurrZone),this._invokeZS=u&&(u.onInvoke?u:o._invokeZS),this._invokeDlgt=u&&(u.onInvoke?o:o._invokeDlgt),this._invokeCurrZone=u&&(u.onInvoke?this._zone:o._invokeCurrZone),this._handleErrorZS=u&&(u.onHandleError?u:o._handleErrorZS),this._handleErrorDlgt=u&&(u.onHandleError?o:o._handleErrorDlgt),this._handleErrorCurrZone=u&&(u.onHandleError?this._zone:o._handleErrorCurrZone),this._scheduleTaskZS=u&&(u.onScheduleTask?u:o._scheduleTaskZS),this._scheduleTaskDlgt=u&&(u.onScheduleTask?o:o._scheduleTaskDlgt),this._scheduleTaskCurrZone=u&&(u.onScheduleTask?this._zone:o._scheduleTaskCurrZone),this._invokeTaskZS=u&&(u.onInvokeTask?u:o._invokeTaskZS),this._invokeTaskDlgt=u&&(u.onInvokeTask?o:o._invokeTaskDlgt),this._invokeTaskCurrZone=u&&(u.onInvokeTask?this._zone:o._invokeTaskCurrZone),this._cancelTaskZS=u&&(u.onCancelTask?u:o._cancelTaskZS),this._cancelTaskDlgt=u&&(u.onCancelTask?o:o._cancelTaskDlgt),this._cancelTaskCurrZone=u&&(u.onCancelTask?this._zone:o._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let h=u&&u.onHasTask,_=o&&o._hasTaskZS;(h||_)&&(this._hasTaskZS=h?u:s,this._hasTaskDlgt=o,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,u.onScheduleTask||(this._scheduleTaskZS=s,this._scheduleTaskDlgt=o,this._scheduleTaskCurrZone=this._zone),u.onInvokeTask||(this._invokeTaskZS=s,this._invokeTaskDlgt=o,this._invokeTaskCurrZone=this._zone),u.onCancelTask||(this._cancelTaskZS=s,this._cancelTaskDlgt=o,this._cancelTaskCurrZone=this._zone))}fork(t,o){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,t,o):new e(t,o)}intercept(t,o,s){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,t,o,s):o}invoke(t,o,s,u,h){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,t,o,s,u,h):o.apply(s,u)}handleError(t,o){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,t,o)}scheduleTask(t,o){let s=o;if(this._scheduleTaskZS)this._hasTaskZS&&s._zoneDelegates.push(this._hasTaskDlgtOwner),s=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,t,o),s||(s=o);else if(o.scheduleFn)o.scheduleFn(o);else{if(o.type!=N)throw new Error("Task is missing scheduleFn.");z(o)}return s}invokeTask(t,o,s,u){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,t,o,s,u):o.callback.apply(s,u)}cancelTask(t,o){let s;if(this._cancelTaskZS)s=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,t,o);else{if(!o.cancelFn)throw Error("Task is not cancelable");s=o.cancelFn(o)}return s}hasTask(t,o){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,t,o)}catch(o){this.handleError(t,o)}}_updateTaskCount(t,o){let s=this._taskCounts,u=s[t],h=s[t]=u+o;if(h<0)throw new Error("More tasks executed then were scheduled.");if(0==u||0==h){let o={microTask:s.microTask>0,macroTask:s.macroTask>0,eventTask:s.eventTask>0,change:t};this.hasTask(this._zone,o)}}}class g{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(o,s,u,h,_,k){if(this.type=o,this.source=s,this.data=h,this.scheduleFn=_,this.cancelFn=k,!u)throw new Error("callback is not defined");this.callback=u;let v=this;o===G&&h&&h.useG?this.invoke=g.invokeTask:this.invoke=function(){return g.invokeTask.call(t,v,this,arguments)}}static invokeTask(t,o,s){t||(t=this),Y++;try{return t.runCount++,t.zone.runTask(t,o,s)}finally{1==Y&&$(),Y--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(S,Z)}_transitionTo(t,o,s){if(this._state!==o&&this._state!==s)throw new Error(`${this.type} '${this.source}': can not transition to '${t}', expecting state '${o}'${s?" or '"+s+"'":""}, was '${this._state}'.`);this._state=t,t==S&&(this._zoneDelegates=null)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let u,h=te("setTimeout"),_=te("Promise"),k=te("then"),v=[],E=!1;function H(o){if(u||t[_]&&(u=t[_].resolve(0)),u){let t=u[k];t||(t=u.then),t.call(u,o)}else t[h](o,0)}function z(t){0===Y&&0===v.length&&H($),t&&v.push(t)}function $(){if(!E){for(E=!0;v.length;){let t=v;v=[];for(let o=0;o<t.length;o++){let s=t[o];try{s.zone.runTask(s,null,null)}catch(t){U.onUnhandledError(t)}}}U.microtaskDrainDone(),E=!1}}let w={name:"NO ZONE"},S="notScheduled",Z="scheduling",P="scheduled",O="running",j="canceling",R="unknown",N="microTask",F="macroTask",G="eventTask",B={},U={symbol:te,currentZoneFrame:()=>V,onUnhandledError:W,microtaskDrainDone:W,scheduleMicroTask:z,showUncaughtError:()=>!e[te("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:W,patchMethod:()=>W,bindArguments:()=>[],patchThen:()=>W,patchMacroTask:()=>W,patchEventPrototype:()=>W,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>W,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>W,wrapWithCurrentZone:()=>W,filterProperties:()=>[],attachOriginToPatched:()=>W,_redefineProperty:()=>W,patchCallbacks:()=>W,nativeScheduleMicroTask:H},V={parent:null,zone:new e(null,null)},X=null,Y=0;function W(){}return a("Zone","Zone"),e}(),o.Zone}();(ce=he).__load_patch("ZoneAwarePromise",(t,o,s)=>{let u=Object.getOwnPropertyDescriptor,h=Object.defineProperty,_=s.symbol,k=[],v=!1!==t[_("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],E=_("Promise"),w=_("then");s.onUnhandledError=t=>{if(s.showUncaughtError()){let o=t&&t.rejection;o?console.error("Unhandled Promise rejection:",o instanceof Error?o.message:o,"; Zone:",t.zone.name,"; Task:",t.task&&t.task.source,"; Value:",o,o instanceof Error?o.stack:void 0):console.error(t)}},s.microtaskDrainDone=()=>{for(;k.length;){let t=k.shift();try{t.zone.runGuarded(()=>{throw t.throwOriginal?t.rejection:t})}catch(t){z(t)}}};let S=_("unhandledPromiseRejectionHandler");function z(t){s.onUnhandledError(t);try{let s=o[S];"function"==typeof s&&s.call(this,t)}catch{}}function $(t){return t&&"function"==typeof t.then}function J(t){return t}function q(t){return M.reject(t)}let Z=_("state"),P=_("value"),O=_("finally"),j=_("parentPromiseValue"),R=_("parentPromiseState"),N=null,F=!0,G=!1;function b(t,o){return s=>{try{I(t,o,s)}catch(o){I(t,!1,o)}}}let D=function(){let t=!1;return function(o){return function(){t||(t=!0,o.apply(null,arguments))}}},B="Promise resolved with itself",U=_("currentTaskTrace");function I(t,u,_){let E=D();if(t===_)throw new TypeError(B);if(t[Z]===N){let w=null;try{("object"==typeof _||"function"==typeof _)&&(w=_&&_.then)}catch(o){return E(()=>{I(t,!1,o)})(),t}if(u!==G&&_ instanceof M&&_.hasOwnProperty(Z)&&_.hasOwnProperty(P)&&_[Z]!==N)i(_),I(t,_[Z],_[P]);else if(u!==G&&"function"==typeof w)try{w.call(_,E(b(t,u)),E(b(t,!1)))}catch(o){E(()=>{I(t,!1,o)})()}else{t[Z]=u;let E=t[P];if(t[P]=_,t[O]===O&&u===F&&(t[Z]=t[R],t[P]=t[j]),u===G&&_ instanceof Error){let t=o.currentTask&&o.currentTask.data&&o.currentTask.data.__creationTrace__;t&&h(_,U,{configurable:!0,enumerable:!1,writable:!0,value:t})}for(let o=0;o<E.length;)r(t,E[o++],E[o++],E[o++],E[o++]);if(0==E.length&&u==G){t[Z]=0;let u=_;try{throw new Error("Uncaught (in promise): "+function(t){return t&&t.toString===Object.prototype.toString?(t.constructor&&t.constructor.name||"")+": "+JSON.stringify(t):t?t.toString():Object.prototype.toString.call(t)}(_)+(_&&_.stack?"\n"+_.stack:""))}catch(t){u=t}v&&(u.throwOriginal=!0),u.rejection=_,u.promise=t,u.zone=o.current,u.task=o.currentTask,k.push(u),s.scheduleMicroTask()}}}return t}let V=_("rejectionHandledHandler");function i(t){if(0===t[Z]){try{let s=o[V];s&&"function"==typeof s&&s.call(this,{rejection:t[P],promise:t})}catch{}t[Z]=G;for(let o=0;o<k.length;o++)t===k[o].promise&&k.splice(o,1)}}function r(t,o,s,u,h){i(t);let _=t[Z],k=_?"function"==typeof u?u:J:"function"==typeof h?h:q;o.scheduleMicroTask("Promise.then",()=>{try{let u=t[P],h=!!s&&O===s[O];h&&(s[j]=u,s[R]=_);let v=o.run(k,void 0,h&&k!==q&&k!==J?[]:[u]);I(s,!0,v)}catch(t){I(s,!1,t)}},s)}let x=function(){},X=t.AggregateError;class M{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(t){return t instanceof M?t:I(new this(null),F,t)}static reject(t){return I(new this(null),G,t)}static withResolvers(){let t={};return t.promise=new M((o,s)=>{t.resolve=o,t.reject=s}),t}static any(t){if(!t||"function"!=typeof t[Symbol.iterator])return Promise.reject(new X([],"All promises were rejected"));let o=[],s=0;try{for(let u of t)s++,o.push(M.resolve(u))}catch{return Promise.reject(new X([],"All promises were rejected"))}if(0===s)return Promise.reject(new X([],"All promises were rejected"));let u=!1,h=[];return new M((t,_)=>{for(let k=0;k<o.length;k++)o[k].then(o=>{u||(u=!0,t(o))},t=>{h.push(t),s--,0===s&&(u=!0,_(new X(h,"All promises were rejected")))})})}static race(t){let o,s,u=new this((t,u)=>{o=t,s=u});function C(t){o(t)}function m(t){s(t)}for(let o of t)$(o)||(o=this.resolve(o)),o.then(C,m);return u}static all(t){return M.allWithCallback(t)}static allSettled(t){return(this&&this.prototype instanceof M?this:M).allWithCallback(t,{thenCallback:t=>({status:"fulfilled",value:t}),errorCallback:t=>({status:"rejected",reason:t})})}static allWithCallback(t,o){let s,u,h=new this((t,o)=>{s=t,u=o}),_=2,k=0,v=[];for(let h of t){$(h)||(h=this.resolve(h));let E=k;try{h.then(t=>{v[E]=o?o.thenCallback(t):t,_--,0===_&&s(v)},t=>{o?(v[E]=o.errorCallback(t),_--,0===_&&s(v)):u(t)})}catch(t){u(t)}_++,k++}return _-=2,0===_&&s(v),h}constructor(t){let o=this;if(!(o instanceof M))throw new Error("Must be an instanceof Promise.");o[Z]=N,o[P]=[];try{let s=D();t&&t(s(b(o,F)),s(b(o,G)))}catch(t){I(o,!1,t)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return M}then(t,s){let u=this.constructor?.[Symbol.species];(!u||"function"!=typeof u)&&(u=this.constructor||M);let h=new u(x),_=o.current;return this[Z]==N?this[P].push(_,h,t,s):r(this,_,h,t,s),h}catch(t){return this.then(null,t)}finally(t){let s=this.constructor?.[Symbol.species];(!s||"function"!=typeof s)&&(s=M);let u=new s(x);u[O]=O;let h=o.current;return this[Z]==N?this[P].push(h,u,t,t):r(this,h,u,t,t),u}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;let Y=t[E]=t.Promise;t.Promise=M;let K=_("thenPatched");function Q(t){let o=t.prototype,s=u(o,"then");if(s&&(!1===s.writable||!s.configurable))return;let h=o.then;o[w]=h,t.prototype.then=function(t,o){return new M((t,o)=>{h.call(this,t,o)}).then(t,o)},t[K]=!0}return s.patchThen=Q,Y&&(Q(Y),ue(t,"fetch",t=>function(t){return function(o,s){let u=t.apply(o,s);if(u instanceof M)return u;let h=u.constructor;return h[K]||Q(h),u}}(t))),Promise[o.__symbol__("uncaughtPromiseErrors")]=k,M}),ce.__load_patch("toString",t=>{let o=Function.prototype.toString,s=O("OriginalDelegate"),u=O("Promise"),h=O("Error"),g=function(){if("function"==typeof this){let _=this[s];if(_)return"function"==typeof _?o.call(_):Object.prototype.toString.call(_);if(this===Promise){let s=t[u];if(s)return o.call(s)}if(this===Error){let s=t[h];if(s)return o.call(s)}}return o.call(this)};g[s]=o,Function.prototype.toString=g;let _=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":_.call(this)}}),ce.__load_patch("util",(t,u,E)=>{let w=Ie(t);E.patchOnProperties=rt,E.patchMethod=ue,E.bindArguments=Fe,E.patchMacroTask=mt;let O=u.__symbol__("BLACK_LISTED_EVENTS"),j=u.__symbol__("UNPATCHED_EVENTS");t[j]&&(t[O]=t[j]),t[O]&&(u[O]=u[j]=t[O]),E.patchEventPrototype=bt,E.patchEventTarget=vt,E.isIEOrEdge=yt,E.ObjectDefineProperty=s,E.ObjectGetOwnPropertyDescriptor=o,E.ObjectCreate=h,E.ArraySlice=_,E.patchClass=ye,E.wrapWithCurrentZone=Ve,E.filterProperties=lt,E.attachOriginToPatched=fe,E._redefineProperty=Object.defineProperty,E.patchCallbacks=Zt,E.getGlobalObjects=()=>({globalSources:oe,zoneSymbolEventNames:re,eventNames:w,isBrowser:B,isMix:U,isNode:G,TRUE_STR:S,FALSE_STR:Z,ZONE_SYMBOL_PREFIX:P,ADD_EVENT_LISTENER_STR:k,REMOVE_EVENT_LISTENER_STR:v})}),function(t){t.__load_patch("legacy",o=>{let s=o[t.__symbol__("legacyPatch")];s&&s()}),t.__load_patch("timers",t=>{let o="clear";ke(t,"set",o,"Timeout"),ke(t,"set",o,"Interval"),ke(t,"set",o,"Immediate")}),t.__load_patch("requestAnimationFrame",t=>{ke(t,"request","cancel","AnimationFrame"),ke(t,"mozRequest","mozCancel","AnimationFrame"),ke(t,"webkitRequest","webkitCancel","AnimationFrame")}),t.__load_patch("blocking",(t,o)=>{let s=["alert","prompt","confirm"];for(let u=0;u<s.length;u++)ue(t,s[u],(s,u,h)=>function(u,_){return o.current.run(s,t,_,h)})}),t.__load_patch("EventTarget",(t,o,s)=>{(function(t,o){o.patchEventPrototype(t,o)})(t,s),function(t,o){if(Zone[o.symbol("patchEventTarget")])return;let{eventNames:s,zoneSymbolEventNames:u,TRUE_STR:h,FALSE_STR:_,ZONE_SYMBOL_PREFIX:k}=o.getGlobalObjects();for(let t=0;t<s.length;t++){let o=s[t],v=k+(o+_),E=k+(o+h);u[o]={},u[o][_]=v,u[o][h]=E}let v=t.EventTarget;v&&v.prototype&&o.patchEventTarget(t,o,[v&&v.prototype])}(t,s);let u=t.XMLHttpRequestEventTarget;u&&u.prototype&&s.patchEventTarget(t,s,[u.prototype])}),t.__load_patch("MutationObserver",(t,o,s)=>{ye("MutationObserver"),ye("WebKitMutationObserver")}),t.__load_patch("IntersectionObserver",(t,o,s)=>{ye("IntersectionObserver")}),t.__load_patch("FileReader",(t,o,s)=>{ye("FileReader")}),t.__load_patch("on_property",(t,o,s)=>{!function(t,o){if(G&&!U||Zone[t.symbol("patchEvents")])return;let s=o.__Zone_ignore_on_properties,h=[];if(B){let t=window;h=h.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);let o=[];Qe(t,Ie(t),s&&s.concat(o),u(t))}h=h.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let t=0;t<h.length;t++){let u=o[h[t]];u?.prototype&&Qe(u.prototype,Ie(u.prototype),s)}}(s,t)}),t.__load_patch("customElements",(t,o,s)=>{!function(t,o){let{isBrowser:s,isMix:u}=o.getGlobalObjects();(s||u)&&t.customElements&&"customElements"in t&&o.patchCallbacks(o,t.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"])}(t,s)}),t.__load_patch("XHR",(t,o)=>{!function(t){let S=t.XMLHttpRequest;if(!S)return;let Z=S.prototype,P=Z[E],j=Z[w];if(!P){let o=t.XMLHttpRequestEventTarget;if(o){let t=o.prototype;P=t[E],j=t[w]}}let R="readystatechange",N="scheduled";function p(t){let u=t.data,k=u.target;k[_]=!1,k[v]=!1;let S=k[h];P||(P=k[E],j=k[w]),S&&j.call(k,R,S);let Z=k[h]=()=>{if(k.readyState===k.DONE)if(!u.aborted&&k[_]&&t.state===N){let s=k[o.__symbol__("loadfalse")];if(0!==k.status&&s&&s.length>0){let h=t.invoke;t.invoke=function(){let s=k[o.__symbol__("loadfalse")];for(let o=0;o<s.length;o++)s[o]===t&&s.splice(o,1);!u.aborted&&t.state===N&&h.call(t)},s.push(t)}else t.invoke()}else!u.aborted&&!1===k[_]&&(k[v]=!0)};return P.call(k,R,Z),k[s]||(k[s]=t),U.apply(k,u.args),k[_]=!0,t}function d(){}function A(t){let o=t.data;return o.aborted=!0,V.apply(o.target,o.args)}let F=ue(Z,"open",()=>function(t,o){return t[u]=0==o[2],t[k]=o[1],F.apply(t,o)}),G=O("fetchTaskAborting"),B=O("fetchTaskScheduling"),U=ue(Z,"send",()=>function(t,s){if(!0===o.current[B]||t[u])return U.apply(t,s);{let o={target:t,url:t[k],isPeriodic:!1,args:s,aborted:!1},u=xe("XMLHttpRequest.send",d,o,p,A);t&&!0===t[v]&&!o.aborted&&u.state===N&&u.invoke()}}),V=ue(Z,"abort",()=>function(t,u){let h=function(t){return t[s]}(t);if(h&&"string"==typeof h.type){if(null==h.cancelFn||h.data&&h.data.aborted)return;h.zone.cancelTask(h)}else if(!0===o.current[G])return V.apply(t,u)})}(t);let s=O("xhrTask"),u=O("xhrSync"),h=O("xhrListener"),_=O("xhrScheduled"),k=O("xhrURL"),v=O("xhrErrorBeforeScheduled")}),t.__load_patch("geolocation",t=>{t.navigator&&t.navigator.geolocation&&function(t,s){let u=t.constructor.name;for(let h=0;h<s.length;h++){let _=s[h],k=t[_];if(k){if(!et(o(t,_)))continue;t[_]=(t=>{let y=function(){return t.apply(this,Fe(arguments,u+"."+_))};return fe(y,t),y})(k)}}}(t.navigator.geolocation,["getCurrentPosition","watchPosition"])}),t.__load_patch("PromiseRejectionEvent",(t,o)=>{function e(o){return function(s){at(t,o).forEach(u=>{let h=t.PromiseRejectionEvent;if(h){let t=new h(o,{promise:s.promise,reason:s.rejection});u.invoke(t)}})}}t.PromiseRejectionEvent&&(o[O("unhandledPromiseRejectionHandler")]=e("unhandledrejection"),o[O("rejectionHandledHandler")]=e("rejectionhandled"))}),t.__load_patch("queueMicrotask",(t,o,s)=>{!function(t,o){o.patchMethod(t,"queueMicrotask",t=>function(t,o){Zone.current.scheduleMicroTask("queueMicrotask",o[0])})}(t,s)})}(he);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iaforged/context-code",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Context Code es un asistente de desarrollo para la terminal. Puede revisar tu proyecto, editar archivos, ejecutar comandos y apoyarte en tareas reales de programacion.",
5
5
  "author": "Context AI",
6
6
  "license": "MIT",
@@ -17,7 +17,6 @@
17
17
  "context-bootstrap.js",
18
18
  "contextcode-bootstrap.js",
19
19
  "dist/",
20
- "docs/",
21
20
  "README.md",
22
21
  "LICENSE.md"
23
22
  ],
package/docs/BRIDGES.md DELETED
@@ -1,90 +0,0 @@
1
- ## Puentes con mensajería móvil
2
-
3
- Context Code puede conectarse con **Telegram** y **WhatsApp** para que veas y respondas la conversación completa desde tu móvil. Cada mensaje que escribes en la terminal se refleja en el chat, cada respuesta del modelo llega de vuelta, y cada herramienta que ejecuta el asistente (Bash, Read, Edit…) se resume en una línea. También puedes escribir **desde el móvil** y el texto se inyecta al REPL como si lo hubieras tecleado en la terminal — la conversación es la misma, da igual por dónde entres.
4
-
5
- Los dos puentes funcionan de forma independiente: puedes usar solo Telegram, solo WhatsApp, o los dos a la vez.
6
-
7
- ### Qué se sincroniza
8
-
9
- - **De la terminal al móvil:** tus prompts (`👤`), las respuestas de texto del modelo (`🤖`) y una línea por cada tool call (`🔧 Bash: npm test`, `🔧 Read: src/foo.ts`, etc.). No se manda el output crudo de las herramientas para no saturar el chat.
10
- - **Del móvil a la terminal:** cualquier texto que envíes aterriza en la cola de entrada del REPL con la misma prioridad que si lo hubieras escrito en la CLI.
11
- - **Antiduplicado:** si escribes desde el móvil, ese texto no se reenvía de vuelta al mismo canal. El otro canal sí lo recibe (si está activo).
12
- - **Código no sincronizado:** mensajes internos del sistema, salidas de slash commands y otros eventos auxiliares no se envían a los canales.
13
-
14
- ### `/telegram` — Bridge con Telegram
15
-
16
- Usa la [Bot API oficial de Telegram](https://core.telegram.org/bots/api) vía `grammy`. Requiere crear un bot en **@BotFather** y darle al wizard el token.
17
-
18
- Flujo en 3 pasos:
19
-
20
- 1. **Intro** con instrucciones para crear el bot en `@BotFather` (`/newbot`, nombre, username, token).
21
- 2. **Pegar el token** — input con validación de formato `123456789:ABC-...`.
22
- 3. **Iniciar bot** — el bridge queda corriendo.
23
-
24
- Desde el móvil, envía `/start` al bot y ese chat queda registrado como destinatario primario. El bot también responde a `/status`, `/model <nombre>` y `/provider <nombre>` para cambiar proveedor o modelo desde Telegram.
25
-
26
- Comandos dentro de la CLI:
27
-
28
- ```
29
- /telegram # abre el wizard (alias: /tele, /bot)
30
- ```
31
-
32
- El token queda guardado localmente en la config (`~/.context/...`) y nunca sale del equipo.
33
-
34
- ### `/whatsapp` — Bridge con WhatsApp
35
-
36
- Usa **Baileys** (`@whiskeysockets/baileys`) vía WhatsApp Web para vincular una cuenta como dispositivo enlazado. Baileys es **opcional**: solo se carga cuando ejecutas `/whatsapp` por primera vez, así no pesa en la instalación base. El QR se dibuja en la terminal usando el paquete `qrcode`, ya incluido en el proyecto.
37
-
38
- > ⚠️ **Aviso importante.** Baileys es una librería no-oficial. Conectarse por esta vía viola los Términos de Servicio de WhatsApp. Para uso personal en un proyecto privado rara vez pasa nada, pero el número que uses podría ser baneado por WhatsApp en casos extremos. Se recomienda usar un **número dedicado para el bot** (eSIM, número secundario, etc.), no tu WhatsApp personal.
39
-
40
- Flujo en 5 pasos:
41
-
42
- 1. **Intro + aviso de riesgo.**
43
- 2. **Escanear QR** — el wizard dibuja el QR en la terminal. En el móvil del bot: WhatsApp → *Dispositivos Vinculados* → *Vincular un dispositivo* → escaneas.
44
- 3. **Tu número (destinatario primario)** — el número en formato E.164 (`+573001234567`) donde quieres recibir el espejo. También puedes saltar y el primer número que escriba al bot se auto-registra.
45
- 4. **Allowlist de números autorizados** — agregas los números que pueden escribirle al bot. Los mensajes de números fuera de la lista se ignoran en silencio.
46
- 5. **Iniciar bridge** — el bridge queda corriendo.
47
-
48
- Desde el panel de ejecución puedes detener el bridge, gestionar la lista de autorizados o cambiar el destinatario sin reiniciar.
49
-
50
- Comandos dentro de la CLI:
51
-
52
- ```
53
- /whatsapp # abre el wizard (alias: /wa, /whats)
54
- ```
55
-
56
- Las credenciales de sesión de WhatsApp Web se guardan como archivos en `~/.context/whatsapp-auth/` (respetando `CLAUDE_CONFIG_DIR` si está definido), porque Baileys necesita manejar ese directorio de auth. La configuracion lógica del bridge, como destinatario primario, allowlist, identidad vinculada y estado `running`, se guarda en SQLite mediante `secure_storage` en Windows/Linux.
57
-
58
- ### Configuración guardada
59
-
60
- Ambos bridges persisten su configuracion en el storage seguro. En Windows/Linux esto vive cifrado dentro de `~/.context/provider-state.sqlite3`; en macOS se mantiene el backend de keychain/fallback disponible.
61
-
62
- ```jsonc
63
- {
64
- "telegramBot": {
65
- "token": "…",
66
- "allowedUserIds": [123456],
67
- "primaryChatId": 123456,
68
- "isRunning": true
69
- },
70
- "whatsappBot": {
71
- "authDir": "~/.context/whatsapp-auth",
72
- "primaryRecipient": "+573001234567",
73
- "allowedNumbers": ["+573001234567", "+573109876543"],
74
- "selfJid": "573...@s.whatsapp.net",
75
- "selfE164": "+573...",
76
- "running": true
77
- }
78
- }
79
- ```
80
-
81
- Si existe configuracion vieja en el archivo JSON global, se migra automaticamente al leer o actualizar el bridge y se elimina esa clave legacy para evitar dos fuentes de verdad.
82
-
83
- ### Ritmo de envío
84
-
85
- Cada canal usa una cola con throttling para no dispararse contra los rate limits de la plataforma:
86
-
87
- - **Telegram:** 150 ms entre mensajes (~6 msg/s, bien por debajo del límite oficial de 30 msg/s por bot).
88
- - **WhatsApp:** 500 ms entre mensajes (más conservador — Baileys no publica límites formales y enviar demasiado rápido puede disparar shadow-bans).
89
-
90
- Si escribes prompts muy rápido la cola se llena hasta 200 items, y a partir de ahí descarta el más viejo para no crecer sin límite.
package/docs/Contex.md DELETED
@@ -1,70 +0,0 @@
1
- # Contex.md — Instrucciones para Claude
2
-
3
- ## Descripción del Proyecto
4
-
5
- Este proyecto es **Context Code** (`@context-ai/context-code`), una herramienta de línea de comandos que permite a Claude entender bases de código, editar archivos, ejecutar comandos de terminal y gestionar flujos de trabajo completos directamente desde la terminal.
6
-
7
- - **Versión actual:** 2.1.88
8
- - **Binario principal:** `context` (via `cli.js`)
9
- - **Lenguaje:** TypeScript (ES2022, módulos ESM)
10
- - **Runtime:** Node.js >= 18.0.0
11
-
12
- ## Estructura del Proyecto
13
-
14
- ```
15
- src/
16
- assistant/ # Lógica del asistente principal
17
- cli/ # Punto de entrada CLI
18
- commands/ # Definición de comandos disponibles
19
- components/ # Componentes de UI (Ink/React)
20
- context/ # Gestión del contexto de conversación
21
- coordinator/ # Coordinación de tareas y costos
22
- entrypoints/ # Puntos de entrada de la aplicación
23
- hooks/ # Hooks personalizados
24
- plugins/ # Sistema de plugins
25
- query/ # Motor de consultas (QueryEngine)
26
- screens/ # Pantallas de la interfaz
27
- services/ # Servicios externos e internos
28
- skills/ # Habilidades del agente
29
- state/ # Gestión de estado
30
- tasks/ # Sistema de tareas
31
- tools/ # Herramientas disponibles para el agente
32
- utils/ # Utilidades generales
33
- ```
34
-
35
- ## Comandos de Desarrollo
36
-
37
- ```bash
38
- pnpm typecheck # Verificar tipos TypeScript
39
- pnpm build # Compilar el proyecto
40
- pnpm dev:build # Alias de build
41
- pnpm dev:watch # Compilar en modo watch
42
- pnpm dev:run # Ejecutar versión de desarrollo
43
- pnpm start # Ejecutar la versión compilada
44
- ```
45
-
46
- ## Sistema de Proveedores
47
-
48
- El proyecto ya no debe asumirse como proveedor-unico. La capa actual distingue entre proveedor activo y perfil activo:
49
-
50
- - `provider profiles` guardan base URL, ultimo modelo y credenciales cuando aplica.
51
- - `agentName` queda reservado como nombre operativo para futuros subagentes.
52
- - los proveedores visibles ya resuelven perfiles de forma compatible; `ollama` y `zai` fueron la primera migracion completa y el resto usa fallback a la configuracion anterior.
53
- - La configuracion anterior sigue sirviendo como fallback para no romper instalaciones existentes.
54
-
55
- ## Convenciones de Código
56
-
57
- - **TypeScript estricto desactivado** (`strict: false`), pero mantener buenas prácticas de tipado.
58
- - **Módulos ESM** (`"type": "module"`), usar `import`/`export` siempre.
59
- - **Resolución de módulos:** `NodeNext` — incluir extensiones en imports cuando sea necesario.
60
- - **JSX:** `react-jsx` (usado con Ink para la UI de terminal).
61
- - **Sin comentarios innecesarios** en el código a menos que se soliciten explícitamente.
62
- - Mantener cambios **mínimos y enfocados** en la tarea solicitada.
63
- - Respetar el estilo de formato existente (indentación, espacios, etc.).
64
-
65
- ## Notas Importantes
66
-
67
- - No publicar el paquete directamente; el proceso de publicación requiere la variable de entorno `AUTHORIZED`.
68
- - `tsconfig.json` se usa para compilaciones del proyecto y `tsconfig.typecheck.json` para validación de tipos.
69
- - Los archivos de distribución se generan en `dist/`.
70
- - Consultar `RECOVERY_NOTES.md` y `RENAMING_NOTES.md` para contexto histórico del proyecto.
package/docs/LIMITS.md DELETED
@@ -1,37 +0,0 @@
1
- ## Limites y uso por proveedor
2
-
3
- `/limites` (alias `/limits`) consulta cada proveedor configurado y te muestra cuanto has consumido, cuanto te queda y los limites de tu plan, en una sola vista.
4
-
5
- ```sh
6
- /limites
7
- ```
8
-
9
- Que hace:
10
-
11
- 1. Itera sobre todos los `provider profile` que tienes guardados.
12
- 2. Para cada uno, si hay un adapter implementado, llama a su API real en paralelo (con timeout).
13
- 3. Suma a la respuesta el contador local de tokens del CLI: cuantos tokens ha consumido este perfil en la sesion actual y en el historico persistido en SQLite.
14
-
15
- Estado de cada proveedor:
16
-
17
- | Proveedor | Que se consulta |
18
- |----------------|-----------------------------------------------------------------------------------------------------------------------|
19
- | Claude (OAuth) | `GET /api/oauth/usage` -> ventanas (5h/7d/Opus/Sonnet) y extra usage. Reusa el cliente que alimenta a `/usage` |
20
- | Anthropic API | `no-data` — solo headers `anthropic-ratelimit-*` por llamada |
21
- | OpenAI OAuth | `no-data` — Codex/ChatGPT solo exponen rate limits dentro del `TokenCountEvent` de cada respuesta del modelo |
22
- | OpenAI API | `GET /v1/usage` (requiere admin key); si la key no tiene permiso, `no-data` |
23
- | OpenRouter | `GET /api/v1/auth/key` -> creditos, limite, rate limit |
24
- | MiniMax | `GET /v1/token_plan/remains` -> uso por modelo (endpoint reverse-engineered desde MiniMax-AI/cli `mmx quota show`) |
25
- | Z.AI | `GET /api/monitor/usage/quota/limit` -> tokens usados/limite del coding plan |
26
- | Ollama local | Siempre `ok` (ilimitado, corre en tu maquina); cuenta modelos disponibles |
27
- | Ollama Cloud | `no-data` salvo localhost |
28
-
29
- El contador local de tokens funciona para todos los proveedores por igual: se persiste en `~/.context/provider-state.sqlite3` y te permite saber cuanto has gastado aunque el proveedor no exponga API. La cuenta empieza en cero la primera vez que ejecutas `/limites` despues de instalar.
30
-
31
- Comandos relacionados:
32
-
33
- ```sh
34
- /limites # vista interactiva por proveedor
35
- /usage # solo Claude: limites del plan vistos por Settings
36
- /cost # costo de la sesion actual
37
- ```