Unverified Commit 963192a6 authored by next-js-bot[bot]'s avatar next-js-bot[bot] Committed by GitHub

ncc-compiled

parent 5d9aee01
The ISC License
Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
......
(()=>{var t={223:t=>{const e=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const i=typeof AbortController==="function";const s=i?AbortController:class AbortController{constructor(){this.signal=new r}abort(t=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||t;this.signal.aborted=true;this.signal.dispatchEvent({type:"abort",target:this.signal})}};const n=typeof AbortSignal==="function";const h=typeof s.AbortSignal==="function";const r=n?AbortSignal:h?s.AbortController:class AbortSignal{constructor(){this.reason=undefined;this.aborted=false;this._listeners=[]}dispatchEvent(t){if(t.type==="abort"){this.aborted=true;this.onabort(t);this._listeners.forEach((e=>e(t)),this)}}onabort(){}addEventListener(t,e){if(t==="abort"){this._listeners.push(e)}}removeEventListener(t,e){if(t==="abort"){this._listeners=this._listeners.filter((t=>t!==e))}}};const o=new Set;const deprecatedOption=(t,e)=>{const i=`LRU_CACHE_OPTION_${t}`;if(shouldWarn(i)){warn(i,`${t} option`,`options.${e}`,LRUCache)}};const deprecatedMethod=(t,e)=>{const i=`LRU_CACHE_METHOD_${t}`;if(shouldWarn(i)){const{prototype:s}=LRUCache;const{get:n}=Object.getOwnPropertyDescriptor(s,t);warn(i,`${t} method`,`cache.${e}()`,n)}};const deprecatedProperty=(t,e)=>{const i=`LRU_CACHE_PROPERTY_${t}`;if(shouldWarn(i)){const{prototype:s}=LRUCache;const{get:n}=Object.getOwnPropertyDescriptor(s,t);warn(i,`${t} property`,`cache.${e}`,n)}};const emitWarning=(...t)=>{typeof process==="object"&&process&&typeof process.emitWarning==="function"?process.emitWarning(...t):console.error(...t)};const shouldWarn=t=>!o.has(t);const warn=(t,e,i,s)=>{o.add(t);const n=`The ${e} is deprecated. Please use ${i} instead.`;emitWarning(n,"DeprecationWarning",t,s)};const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{constructor(t){if(t===0){return[]}const e=getUintArray(t);this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{constructor(t={}){const{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:r,allowStale:a,dispose:l,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:u,maxSize:d=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:S,fetchContext:y,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:z,ignoreFetchAbort:L}=t;const{length:v,maxAge:x,stale:b}=t instanceof LRUCache?{}:t;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const A=e?getUintArray(e):Array;if(!A){throw new Error("invalid max value: "+e)}this.max=e;this.maxSize=d;this.maxEntrySize=p||this.maxSize;this.sizeCalculation=g||v;if(this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}this.fetchMethod=S||null;if(this.fetchMethod&&typeof this.fetchMethod!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.fetchContext=y;if(!this.fetchMethod&&y!==undefined){throw new TypeError("cannot set fetchContext without fetchMethod")}this.keyMap=new Map;this.keyList=new Array(e).fill(null);this.valList=new Array(e).fill(null);this.next=new A(e);this.prev=new A(e);this.head=0;this.tail=0;this.free=new Stack(e);this.initialFill=1;this.size=0;if(typeof l==="function"){this.dispose=l}if(typeof c==="function"){this.disposeAfter=c;this.disposed=[]}else{this.disposeAfter=null;this.disposed=null}this.noDisposeOnSet=!!f;this.noUpdateTTL=!!u;this.noDeleteOnFetchRejection=!!w;this.allowStaleOnFetchRejection=!!m;this.allowStaleOnFetchAbort=!!z;this.ignoreFetchAbort=!!L;if(this.maxEntrySize!==0){if(this.maxSize!==0){if(!isPosInt(this.maxSize)){throw new TypeError("maxSize must be a positive integer if specified")}}if(!isPosInt(this.maxEntrySize)){throw new TypeError("maxEntrySize must be a positive integer if specified")}this.initializeSizeTracking()}this.allowStale=!!a||!!b;this.noDeleteOnStaleGet=!!_;this.updateAgeOnGet=!!h;this.updateAgeOnHas=!!r;this.ttlResolution=isPosInt(s)||s===0?s:1;this.ttlAutopurge=!!n;this.ttl=i||x||0;if(this.ttl){if(!isPosInt(this.ttl)){throw new TypeError("ttl must be a positive integer if specified")}this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0){throw new TypeError("At least one of max, maxSize, or ttl is required")}if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const t="LRU_CACHE_UNBOUNDED";if(shouldWarn(t)){o.add(t);const e="TTL caching without ttlAutopurge, max, or maxSize can "+"result in unbounded memory consumption.";emitWarning(e,"UnboundedCacheWarning",t,LRUCache)}}if(b){deprecatedOption("stale","allowStale")}if(x){deprecatedOption("maxAge","ttl")}if(v){deprecatedOption("length","sizeCalculation")}}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:false})?Infinity:0}initializeTTLTracking(){this.ttls=new ZeroArray(this.max);this.starts=new ZeroArray(this.max);this.setItemTTL=(t,i,s=e.now())=>{this.starts[t]=i!==0?s:0;this.ttls[t]=i;if(i!==0&&this.ttlAutopurge){const e=setTimeout((()=>{if(this.isStale(t)){this.delete(this.keyList[t])}}),i+1);if(e.unref){e.unref()}}};this.updateItemAge=t=>{this.starts[t]=this.ttls[t]!==0?e.now():0};this.statusTTL=(e,i)=>{if(e){e.ttl=this.ttls[i];e.start=this.starts[i];e.now=t||getNow();e.remainingTTL=e.now+e.ttl-e.start}};let t=0;const getNow=()=>{const i=e.now();if(this.ttlResolution>0){t=i;const e=setTimeout((()=>t=0),this.ttlResolution);if(e.unref){e.unref()}}return i};this.getRemainingTTL=e=>{const i=this.keyMap.get(e);if(i===undefined){return 0}return this.ttls[i]===0||this.starts[i]===0?Infinity:this.starts[i]+this.ttls[i]-(t||getNow())};this.isStale=e=>this.ttls[e]!==0&&this.starts[e]!==0&&(t||getNow())-this.starts[e]>this.ttls[e]}updateItemAge(t){}statusTTL(t,e){}setItemTTL(t,e,i){}isStale(t){return false}initializeSizeTracking(){this.calculatedSize=0;this.sizes=new ZeroArray(this.max);this.removeItemSize=t=>{this.calculatedSize-=this.sizes[t];this.sizes[t]=0};this.requireSize=(t,e,i,s)=>{if(this.isBackgroundFetch(e)){return 0}if(!isPosInt(i)){if(s){if(typeof s!=="function"){throw new TypeError("sizeCalculation must be a function")}i=s(e,t);if(!isPosInt(i)){throw new TypeError("sizeCalculation return invalid (expect positive integer)")}}else{throw new TypeError("invalid size value (must be positive integer). "+"When maxSize or maxEntrySize is used, sizeCalculation or size "+"must be set.")}}return i};this.addItemSize=(t,e,i)=>{this.sizes[t]=e;if(this.maxSize){const e=this.maxSize-this.sizes[t];while(this.calculatedSize>e){this.evict(true)}}this.calculatedSize+=this.sizes[t];if(i){i.entrySize=e;i.totalCalculatedSize=this.calculatedSize}}}removeItemSize(t){}addItemSize(t,e){}requireSize(t,e,i,s){if(i||s){throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}}*indexes({allowStale:t=this.allowStale}={}){if(this.size){for(let e=this.tail;true;){if(!this.isValidIndex(e)){break}if(t||!this.isStale(e)){yield e}if(e===this.head){break}else{e=this.prev[e]}}}}*rindexes({allowStale:t=this.allowStale}={}){if(this.size){for(let e=this.head;true;){if(!this.isValidIndex(e)){break}if(t||!this.isStale(e)){yield e}if(e===this.tail){break}else{e=this.next[e]}}}}isValidIndex(t){return t!==undefined&&this.keyMap.get(this.keyList[t])===t}*entries(){for(const t of this.indexes()){if(this.valList[t]!==undefined&&this.keyList[t]!==undefined&&!this.isBackgroundFetch(this.valList[t])){yield[this.keyList[t],this.valList[t]]}}}*rentries(){for(const t of this.rindexes()){if(this.valList[t]!==undefined&&this.keyList[t]!==undefined&&!this.isBackgroundFetch(this.valList[t])){yield[this.keyList[t],this.valList[t]]}}}*keys(){for(const t of this.indexes()){if(this.keyList[t]!==undefined&&!this.isBackgroundFetch(this.valList[t])){yield this.keyList[t]}}}*rkeys(){for(const t of this.rindexes()){if(this.keyList[t]!==undefined&&!this.isBackgroundFetch(this.valList[t])){yield this.keyList[t]}}}*values(){for(const t of this.indexes()){if(this.valList[t]!==undefined&&!this.isBackgroundFetch(this.valList[t])){yield this.valList[t]}}}*rvalues(){for(const t of this.rindexes()){if(this.valList[t]!==undefined&&!this.isBackgroundFetch(this.valList[t])){yield this.valList[t]}}}[Symbol.iterator](){return this.entries()}find(t,e){for(const i of this.indexes()){const s=this.valList[i];const n=this.isBackgroundFetch(s)?s.__staleWhileFetching:s;if(n===undefined)continue;if(t(n,this.keyList[i],this)){return this.get(this.keyList[i],e)}}}forEach(t,e=this){for(const i of this.indexes()){const s=this.valList[i];const n=this.isBackgroundFetch(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.keyList[i],this)}}rforEach(t,e=this){for(const i of this.rindexes()){const s=this.valList[i];const n=this.isBackgroundFetch(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.keyList[i],this)}}get prune(){deprecatedMethod("prune","purgeStale");return this.purgeStale}purgeStale(){let t=false;for(const e of this.rindexes({allowStale:true})){if(this.isStale(e)){this.delete(this.keyList[e]);t=true}}return t}dump(){const t=[];for(const i of this.indexes({allowStale:true})){const s=this.keyList[i];const n=this.valList[i];const h=this.isBackgroundFetch(n)?n.__staleWhileFetching:n;if(h===undefined)continue;const r={value:h};if(this.ttls){r.ttl=this.ttls[i];const t=e.now()-this.starts[i];r.start=Math.floor(Date.now()-t)}if(this.sizes){r.size=this.sizes[i]}t.unshift([s,r])}return t}load(t){this.clear();for(const[i,s]of t){if(s.start){const t=Date.now()-s.start;s.start=e.now()-t}this.set(i,s.value,s)}}dispose(t,e,i){}set(t,e,{ttl:i=this.ttl,start:s,noDisposeOnSet:n=this.noDisposeOnSet,size:h=0,sizeCalculation:r=this.sizeCalculation,noUpdateTTL:o=this.noUpdateTTL,status:a}={}){h=this.requireSize(t,e,h,r);if(this.maxEntrySize&&h>this.maxEntrySize){if(a){a.set="miss";a.maxEntrySizeExceeded=true}this.delete(t);return this}let l=this.size===0?undefined:this.keyMap.get(t);if(l===undefined){l=this.newIndex();this.keyList[l]=t;this.valList[l]=e;this.keyMap.set(t,l);this.next[this.tail]=l;this.prev[l]=this.tail;this.tail=l;this.size++;this.addItemSize(l,h,a);if(a){a.set="add"}o=false}else{this.moveToTail(l);const i=this.valList[l];if(e!==i){if(this.isBackgroundFetch(i)){i.__abortController.abort(new Error("replaced"))}else{if(!n){this.dispose(i,t,"set");if(this.disposeAfter){this.disposed.push([i,t,"set"])}}}this.removeItemSize(l);this.valList[l]=e;this.addItemSize(l,h,a);if(a){a.set="replace";const t=i&&this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(t!==undefined)a.oldValue=t}}else if(a){a.set="update"}}if(i!==0&&this.ttl===0&&!this.ttls){this.initializeTTLTracking()}if(!o){this.setItemTTL(l,i,s)}this.statusTTL(a,l);if(this.disposeAfter){while(this.disposed.length){this.disposeAfter(...this.disposed.shift())}}return this}newIndex(){if(this.size===0){return this.tail}if(this.size===this.max&&this.max!==0){return this.evict(false)}if(this.free.length!==0){return this.free.pop()}return this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];this.evict(true);return t}}evict(t){const e=this.head;const i=this.keyList[e];const s=this.valList[e];if(this.isBackgroundFetch(s)){s.__abortController.abort(new Error("evicted"))}else{this.dispose(s,i,"evict");if(this.disposeAfter){this.disposed.push([s,i,"evict"])}}this.removeItemSize(e);if(t){this.keyList[e]=null;this.valList[e]=null;this.free.push(e)}this.head=this.next[e];this.keyMap.delete(i);this.size--;return e}has(t,{updateAgeOnHas:e=this.updateAgeOnHas,status:i}={}){const s=this.keyMap.get(t);if(s!==undefined){if(!this.isStale(s)){if(e){this.updateItemAge(s)}if(i)i.has="hit";this.statusTTL(i,s);return true}else if(i){i.has="stale";this.statusTTL(i,s)}}else if(i){i.has="miss"}return false}peek(t,{allowStale:e=this.allowStale}={}){const i=this.keyMap.get(t);if(i!==undefined&&(e||!this.isStale(i))){const t=this.valList[i];return this.isBackgroundFetch(t)?t.__staleWhileFetching:t}}backgroundFetch(t,e,i,n){const h=e===undefined?undefined:this.valList[e];if(this.isBackgroundFetch(h)){return h}const r=new s;if(i.signal){i.signal.addEventListener("abort",(()=>r.abort(i.signal.reason)))}const o={signal:r.signal,options:i,context:n};const cb=(s,n=false)=>{const{aborted:h}=r.signal;const l=i.ignoreFetchAbort&&s!==undefined;if(i.status){if(h&&!n){i.status.fetchAborted=true;i.status.fetchError=r.signal.reason;if(l)i.status.fetchAbortIgnored=true}else{i.status.fetchResolved=true}}if(h&&!l&&!n){return fetchFail(r.signal.reason)}if(this.valList[e]===a){if(s===undefined){if(a.__staleWhileFetching){this.valList[e]=a.__staleWhileFetching}else{this.delete(t)}}else{if(i.status)i.status.fetchUpdated=true;this.set(t,s,o.options)}}return s};const eb=t=>{if(i.status){i.status.fetchRejected=true;i.status.fetchError=t}return fetchFail(t)};const fetchFail=s=>{const{aborted:n}=r.signal;const h=n&&i.allowStaleOnFetchAbort;const o=h||i.allowStaleOnFetchRejection;const l=o||i.noDeleteOnFetchRejection;if(this.valList[e]===a){const i=!l||a.__staleWhileFetching===undefined;if(i){this.delete(t)}else if(!h){this.valList[e]=a.__staleWhileFetching}}if(o){if(i.status&&a.__staleWhileFetching!==undefined){i.status.returnedStale=true}return a.__staleWhileFetching}else if(a.__returned===a){throw s}};const pcall=(e,s)=>{this.fetchMethod(t,h,o).then((t=>e(t)),s);r.signal.addEventListener("abort",(()=>{if(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort){e();if(i.allowStaleOnFetchAbort){e=t=>cb(t,true)}}}))};if(i.status)i.status.fetchDispatched=true;const a=new Promise(pcall).then(cb,eb);a.__abortController=r;a.__staleWhileFetching=h;a.__returned=null;if(e===undefined){this.set(t,a,{...o.options,status:undefined});e=this.keyMap.get(t)}else{this.valList[e]=a}return a}isBackgroundFetch(t){return t&&typeof t==="object"&&typeof t.then==="function"&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||t.__returned===null)}async fetch(t,{allowStale:e=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:r=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:a=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,fetchContext:d=this.fetchContext,forceRefresh:p=false,status:g,signal:S}={}){if(!this.fetchMethod){if(g)g.fetch="get";return this.get(t,{allowStale:e,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:g})}const y={allowStale:e,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:n,noDisposeOnSet:h,size:r,sizeCalculation:o,noUpdateTTL:a,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:u,ignoreFetchAbort:f,status:g,signal:S};let w=this.keyMap.get(t);if(w===undefined){if(g)g.fetch="miss";const e=this.backgroundFetch(t,w,y,d);return e.__returned=e}else{const s=this.valList[w];if(this.isBackgroundFetch(s)){const t=e&&s.__staleWhileFetching!==undefined;if(g){g.fetch="inflight";if(t)g.returnedStale=true}return t?s.__staleWhileFetching:s.__returned=s}const n=this.isStale(w);if(!p&&!n){if(g)g.fetch="hit";this.moveToTail(w);if(i){this.updateItemAge(w)}this.statusTTL(g,w);return s}const h=this.backgroundFetch(t,w,y,d);const r=h.__staleWhileFetching!==undefined;const o=r&&e;if(g){g.fetch=r&&n?"stale":"refresh";if(o&&n)g.returnedStale=true}return o?h.__staleWhileFetching:h.__returned=h}}get(t,{allowStale:e=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:n}={}){const h=this.keyMap.get(t);if(h!==undefined){const r=this.valList[h];const o=this.isBackgroundFetch(r);this.statusTTL(n,h);if(this.isStale(h)){if(n)n.get="stale";if(!o){if(!s){this.delete(t)}if(n)n.returnedStale=e;return e?r:undefined}else{if(n){n.returnedStale=e&&r.__staleWhileFetching!==undefined}return e?r.__staleWhileFetching:undefined}}else{if(n)n.get="hit";if(o){return r.__staleWhileFetching}this.moveToTail(h);if(i){this.updateItemAge(h)}return r}}else if(n){n.get="miss"}}connect(t,e){this.prev[e]=t;this.next[t]=e}moveToTail(t){if(t!==this.tail){if(t===this.head){this.head=this.next[t]}else{this.connect(this.prev[t],this.next[t])}this.connect(this.tail,t);this.tail=t}}get del(){deprecatedMethod("del","delete");return this.delete}delete(t){let e=false;if(this.size!==0){const i=this.keyMap.get(t);if(i!==undefined){e=true;if(this.size===1){this.clear()}else{this.removeItemSize(i);const e=this.valList[i];if(this.isBackgroundFetch(e)){e.__abortController.abort(new Error("deleted"))}else{this.dispose(e,t,"delete");if(this.disposeAfter){this.disposed.push([e,t,"delete"])}}this.keyMap.delete(t);this.keyList[i]=null;this.valList[i]=null;if(i===this.tail){this.tail=this.prev[i]}else if(i===this.head){this.head=this.next[i]}else{this.next[this.prev[i]]=this.next[i];this.prev[this.next[i]]=this.prev[i]}this.size--;this.free.push(i)}}}if(this.disposed){while(this.disposed.length){this.disposeAfter(...this.disposed.shift())}}return e}clear(){for(const t of this.rindexes({allowStale:true})){const e=this.valList[t];if(this.isBackgroundFetch(e)){e.__abortController.abort(new Error("deleted"))}else{const i=this.keyList[t];this.dispose(e,i,"delete");if(this.disposeAfter){this.disposed.push([e,i,"delete"])}}}this.keyMap.clear();this.valList.fill(null);this.keyList.fill(null);if(this.ttls){this.ttls.fill(0);this.starts.fill(0)}if(this.sizes){this.sizes.fill(0)}this.head=0;this.tail=0;this.initialFill=1;this.free.length=0;this.calculatedSize=0;this.size=0;if(this.disposed){while(this.disposed.length){this.disposeAfter(...this.disposed.shift())}}}get reset(){deprecatedMethod("reset","clear");return this.clear}get length(){deprecatedProperty("length","size");return this.size}static get AbortController(){return s}static get AbortSignal(){return r}}t.exports=LRUCache}};var e={};function __nccwpck_require__(i){var s=e[i];if(s!==undefined){return s.exports}var n=e[i]={exports:{}};var h=true;try{t[i](n,n.exports,__nccwpck_require__);h=false}finally{if(h)delete e[i]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(223);module.exports=i})();
\ No newline at end of file
(()=>{var t={939:(t,e,i)=>{"use strict";t.exports=LRUCache;var r=i(570);var n=i(23);var a=i(80);var s=typeof Symbol==="function"&&process.env._nodeLRUCacheForceNoSymbol!=="1";var l;if(s){l=function(t){return Symbol(t)}}else{l=function(t){return"_"+t}}var h=l("max");var o=l("length");var u=l("lengthCalculator");var f=l("allowStale");var p=l("maxAge");var c=l("dispose");var v=l("noDisposeOnSet");var d=l("lruList");var y=l("cache");function naiveLength(){return 1}function LRUCache(t){if(!(this instanceof LRUCache)){return new LRUCache(t)}if(typeof t==="number"){t={max:t}}if(!t){t={}}var e=this[h]=t.max;if(!e||!(typeof e==="number")||e<=0){this[h]=Infinity}var i=t.length||naiveLength;if(typeof i!=="function"){i=naiveLength}this[u]=i;this[f]=t.stale||false;this[p]=t.maxAge||0;this[c]=t.dispose;this[v]=t.noDisposeOnSet||false;this.reset()}Object.defineProperty(LRUCache.prototype,"max",{set:function(t){if(!t||!(typeof t==="number")||t<=0){t=Infinity}this[h]=t;trim(this)},get:function(){return this[h]},enumerable:true});Object.defineProperty(LRUCache.prototype,"allowStale",{set:function(t){this[f]=!!t},get:function(){return this[f]},enumerable:true});Object.defineProperty(LRUCache.prototype,"maxAge",{set:function(t){if(!t||!(typeof t==="number")||t<0){t=0}this[p]=t;trim(this)},get:function(){return this[p]},enumerable:true});Object.defineProperty(LRUCache.prototype,"lengthCalculator",{set:function(t){if(typeof t!=="function"){t=naiveLength}if(t!==this[u]){this[u]=t;this[o]=0;this[d].forEach((function(t){t.length=this[u](t.value,t.key);this[o]+=t.length}),this)}trim(this)},get:function(){return this[u]},enumerable:true});Object.defineProperty(LRUCache.prototype,"length",{get:function(){return this[o]},enumerable:true});Object.defineProperty(LRUCache.prototype,"itemCount",{get:function(){return this[d].length},enumerable:true});LRUCache.prototype.rforEach=function(t,e){e=e||this;for(var i=this[d].tail;i!==null;){var r=i.prev;forEachStep(this,t,i,e);i=r}};function forEachStep(t,e,i,r){var n=i.value;if(isStale(t,n)){del(t,i);if(!t[f]){n=undefined}}if(n){e.call(r,n.value,n.key,t)}}LRUCache.prototype.forEach=function(t,e){e=e||this;for(var i=this[d].head;i!==null;){var r=i.next;forEachStep(this,t,i,e);i=r}};LRUCache.prototype.keys=function(){return this[d].toArray().map((function(t){return t.key}),this)};LRUCache.prototype.values=function(){return this[d].toArray().map((function(t){return t.value}),this)};LRUCache.prototype.reset=function(){if(this[c]&&this[d]&&this[d].length){this[d].forEach((function(t){this[c](t.key,t.value)}),this)}this[y]=new r;this[d]=new a;this[o]=0};LRUCache.prototype.dump=function(){return this[d].map((function(t){if(!isStale(this,t)){return{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}}}),this).toArray().filter((function(t){return t}))};LRUCache.prototype.dumpLru=function(){return this[d]};LRUCache.prototype.inspect=function(t,e){var i="LRUCache {";var r=false;var a=this[f];if(a){i+="\n allowStale: true";r=true}var s=this[h];if(s&&s!==Infinity){if(r){i+=","}i+="\n max: "+n.inspect(s,e);r=true}var l=this[p];if(l){if(r){i+=","}i+="\n maxAge: "+n.inspect(l,e);r=true}var c=this[u];if(c&&c!==naiveLength){if(r){i+=","}i+="\n length: "+n.inspect(this[o],e);r=true}var v=false;this[d].forEach((function(t){if(v){i+=",\n "}else{if(r){i+=",\n"}v=true;i+="\n "}var a=n.inspect(t.key).split("\n").join("\n ");var s={value:t.value};if(t.maxAge!==l){s.maxAge=t.maxAge}if(c!==naiveLength){s.length=t.length}if(isStale(this,t)){s.stale=true}s=n.inspect(s,e).split("\n").join("\n ");i+=a+" => "+s}));if(v||r){i+="\n"}i+="}";return i};LRUCache.prototype.set=function(t,e,i){i=i||this[p];var r=i?Date.now():0;var n=this[u](e,t);if(this[y].has(t)){if(n>this[h]){del(this,this[y].get(t));return false}var a=this[y].get(t);var s=a.value;if(this[c]){if(!this[v]){this[c](t,s.value)}}s.now=r;s.maxAge=i;s.value=e;this[o]+=n-s.length;s.length=n;this.get(t);trim(this);return true}var l=new Entry(t,e,n,r,i);if(l.length>this[h]){if(this[c]){this[c](t,e)}return false}this[o]+=l.length;this[d].unshift(l);this[y].set(t,this[d].head);trim(this);return true};LRUCache.prototype.has=function(t){if(!this[y].has(t))return false;var e=this[y].get(t).value;if(isStale(this,e)){return false}return true};LRUCache.prototype.get=function(t){return get(this,t,true)};LRUCache.prototype.peek=function(t){return get(this,t,false)};LRUCache.prototype.pop=function(){var t=this[d].tail;if(!t)return null;del(this,t);return t.value};LRUCache.prototype.del=function(t){del(this,this[y].get(t))};LRUCache.prototype.load=function(t){this.reset();var e=Date.now();for(var i=t.length-1;i>=0;i--){var r=t[i];var n=r.e||0;if(n===0){this.set(r.k,r.v)}else{var a=n-e;if(a>0){this.set(r.k,r.v,a)}}}};LRUCache.prototype.prune=function(){var t=this;this[y].forEach((function(e,i){get(t,i,false)}))};function get(t,e,i){var r=t[y].get(e);if(r){var n=r.value;if(isStale(t,n)){del(t,r);if(!t[f])n=undefined}else{if(i){t[d].unshiftNode(r)}}if(n)n=n.value}return n}function isStale(t,e){if(!e||!e.maxAge&&!t[p]){return false}var i=false;var r=Date.now()-e.now;if(e.maxAge){i=r>e.maxAge}else{i=t[p]&&r>t[p]}return i}function trim(t){if(t[o]>t[h]){for(var e=t[d].tail;t[o]>t[h]&&e!==null;){var i=e.prev;del(t,e);e=i}}}function del(t,e){if(e){var i=e.value;if(t[c]){t[c](i.key,i.value)}t[o]-=i.length;t[y].delete(i.key);t[d].removeNode(e)}}function Entry(t,e,i,r,n){this.key=t;this.value=e;this.length=i;this.now=r;this.maxAge=n||0}},570:(t,e,i)=>{if(process.env.npm_package_name==="pseudomap"&&process.env.npm_lifecycle_script==="test")process.env.TEST_PSEUDOMAP="true";if(typeof Map==="function"&&!process.env.TEST_PSEUDOMAP){t.exports=Map}else{t.exports=i(196)}},196:t=>{var e=Object.prototype.hasOwnProperty;t.exports=PseudoMap;function PseudoMap(t){if(!(this instanceof PseudoMap))throw new TypeError("Constructor PseudoMap requires 'new'");this.clear();if(t){if(t instanceof PseudoMap||typeof Map==="function"&&t instanceof Map)t.forEach((function(t,e){this.set(e,t)}),this);else if(Array.isArray(t))t.forEach((function(t){this.set(t[0],t[1])}),this);else throw new TypeError("invalid argument")}}PseudoMap.prototype.forEach=function(t,e){e=e||this;Object.keys(this._data).forEach((function(i){if(i!=="size")t.call(e,this._data[i].value,this._data[i].key)}),this)};PseudoMap.prototype.has=function(t){return!!find(this._data,t)};PseudoMap.prototype.get=function(t){var e=find(this._data,t);return e&&e.value};PseudoMap.prototype.set=function(t,e){set(this._data,t,e)};PseudoMap.prototype.delete=function(t){var e=find(this._data,t);if(e){delete this._data[e._index];this._data.size--}};PseudoMap.prototype.clear=function(){var t=Object.create(null);t.size=0;Object.defineProperty(this,"_data",{value:t,enumerable:false,configurable:true,writable:false})};Object.defineProperty(PseudoMap.prototype,"size",{get:function(){return this._data.size},set:function(t){},enumerable:true,configurable:true});PseudoMap.prototype.values=PseudoMap.prototype.keys=PseudoMap.prototype.entries=function(){throw new Error("iterators are not implemented in this version")};function same(t,e){return t===e||t!==t&&e!==e}function Entry(t,e,i){this.key=t;this.value=e;this._index=i}function find(t,i){for(var r=0,n="_"+i,a=n;e.call(t,a);a=n+r++){if(same(t[a].key,i))return t[a]}}function set(t,i,r){for(var n=0,a="_"+i,s=a;e.call(t,s);s=a+n++){if(same(t[s].key,i)){t[s].value=r;return}}t.size++;t[s]=new Entry(i,r,s)}},80:t=>{t.exports=Yallist;Yallist.Node=Node;Yallist.create=Yallist;function Yallist(t){var e=this;if(!(e instanceof Yallist)){e=new Yallist}e.tail=null;e.head=null;e.length=0;if(t&&typeof t.forEach==="function"){t.forEach((function(t){e.push(t)}))}else if(arguments.length>0){for(var i=0,r=arguments.length;i<r;i++){e.push(arguments[i])}}return e}Yallist.prototype.removeNode=function(t){if(t.list!==this){throw new Error("removing node which does not belong to this list")}var e=t.next;var i=t.prev;if(e){e.prev=i}if(i){i.next=e}if(t===this.head){this.head=e}if(t===this.tail){this.tail=i}t.list.length--;t.next=null;t.prev=null;t.list=null};Yallist.prototype.unshiftNode=function(t){if(t===this.head){return}if(t.list){t.list.removeNode(t)}var e=this.head;t.list=this;t.next=e;if(e){e.prev=t}this.head=t;if(!this.tail){this.tail=t}this.length++};Yallist.prototype.pushNode=function(t){if(t===this.tail){return}if(t.list){t.list.removeNode(t)}var e=this.tail;t.list=this;t.prev=e;if(e){e.next=t}this.tail=t;if(!this.head){this.head=t}this.length++};Yallist.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++){push(this,arguments[t])}return this.length};Yallist.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++){unshift(this,arguments[t])}return this.length};Yallist.prototype.pop=function(){if(!this.tail){return undefined}var t=this.tail.value;this.tail=this.tail.prev;if(this.tail){this.tail.next=null}else{this.head=null}this.length--;return t};Yallist.prototype.shift=function(){if(!this.head){return undefined}var t=this.head.value;this.head=this.head.next;if(this.head){this.head.prev=null}else{this.tail=null}this.length--;return t};Yallist.prototype.forEach=function(t,e){e=e||this;for(var i=this.head,r=0;i!==null;r++){t.call(e,i.value,r,this);i=i.next}};Yallist.prototype.forEachReverse=function(t,e){e=e||this;for(var i=this.tail,r=this.length-1;i!==null;r--){t.call(e,i.value,r,this);i=i.prev}};Yallist.prototype.get=function(t){for(var e=0,i=this.head;i!==null&&e<t;e++){i=i.next}if(e===t&&i!==null){return i.value}};Yallist.prototype.getReverse=function(t){for(var e=0,i=this.tail;i!==null&&e<t;e++){i=i.prev}if(e===t&&i!==null){return i.value}};Yallist.prototype.map=function(t,e){e=e||this;var i=new Yallist;for(var r=this.head;r!==null;){i.push(t.call(e,r.value,this));r=r.next}return i};Yallist.prototype.mapReverse=function(t,e){e=e||this;var i=new Yallist;for(var r=this.tail;r!==null;){i.push(t.call(e,r.value,this));r=r.prev}return i};Yallist.prototype.reduce=function(t,e){var i;var r=this.head;if(arguments.length>1){i=e}else if(this.head){r=this.head.next;i=this.head.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var n=0;r!==null;n++){i=t(i,r.value,n);r=r.next}return i};Yallist.prototype.reduceReverse=function(t,e){var i;var r=this.tail;if(arguments.length>1){i=e}else if(this.tail){r=this.tail.prev;i=this.tail.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var n=this.length-1;r!==null;n--){i=t(i,r.value,n);r=r.prev}return i};Yallist.prototype.toArray=function(){var t=new Array(this.length);for(var e=0,i=this.head;i!==null;e++){t[e]=i.value;i=i.next}return t};Yallist.prototype.toArrayReverse=function(){var t=new Array(this.length);for(var e=0,i=this.tail;i!==null;e++){t[e]=i.value;i=i.prev}return t};Yallist.prototype.slice=function(t,e){e=e||this.length;if(e<0){e+=this.length}t=t||0;if(t<0){t+=this.length}var i=new Yallist;if(e<t||e<0){return i}if(t<0){t=0}if(e>this.length){e=this.length}for(var r=0,n=this.head;n!==null&&r<t;r++){n=n.next}for(;n!==null&&r<e;r++,n=n.next){i.push(n.value)}return i};Yallist.prototype.sliceReverse=function(t,e){e=e||this.length;if(e<0){e+=this.length}t=t||0;if(t<0){t+=this.length}var i=new Yallist;if(e<t||e<0){return i}if(t<0){t=0}if(e>this.length){e=this.length}for(var r=this.length,n=this.tail;n!==null&&r>e;r--){n=n.prev}for(;n!==null&&r>t;r--,n=n.prev){i.push(n.value)}return i};Yallist.prototype.reverse=function(){var t=this.head;var e=this.tail;for(var i=t;i!==null;i=i.prev){var r=i.prev;i.prev=i.next;i.next=r}this.head=e;this.tail=t;return this};function push(t,e){t.tail=new Node(e,t.tail,null,t);if(!t.head){t.head=t.tail}t.length++}function unshift(t,e){t.head=new Node(e,null,t.head,t);if(!t.tail){t.tail=t.head}t.length++}function Node(t,e,i,r){if(!(this instanceof Node)){return new Node(t,e,i,r)}this.list=r;this.value=t;if(e){e.next=this;this.prev=e}else{this.prev=null}if(i){i.prev=this;this.next=i}else{this.next=null}}},23:t=>{"use strict";t.exports=require("util")}};var e={};function __nccwpck_require__(i){var r=e[i];if(r!==undefined){return r.exports}var n=e[i]={exports:{}};var a=true;try{t[i](n,n.exports,__nccwpck_require__);a=false}finally{if(a)delete e[i]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(939);module.exports=i})();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment