;of element.querySelectorAll(this.selector)){var location=expandURL(link[“href”]);if(this.shouldPreload(location)&&(null===(null===(void 0!==context?context:void 0)!==void 0?context:void 0)result=this.prefetch(location,context),null==result||(0,result)))return}}shouldPreload(location){return!this.snapshotCache.has(location)&&!this.delegate.navigator.locationWithActionIsSamePage(location,”advance”)}prefetch(location,context){var _a=new turbo.BasicFetch(“prefetch”,location),{signal:signal}=context;return Promise.race([_a.fetch({signal:signal}),function wait(durationInMilliseconds){return new Promise(resolve=>setTimeout(resolve,durationInMilliseconds))}(this.delegate.timer(this.delegate.prefetchTimeout))]).then(response=>!response.ok&&_a.abort(),(function didPrefetchSucceed(response,_a,lastPrefetchAt){null===(void 0!==response?response:void 0)?void 0:void 0// if(!response.ok){_a.abort()}var snapshot=streamMessageToSnapshot(response),didPrefetchSucceed=null!=snapshot;return didPrefetchSucceed&&(lastPrefetchAt.set(location.href,Date.now()),snapshot!=null&&snapshot.clone()),didPrefetchSucceed}(response,_a,this.prefetches)))}streamMessageToSnapshot(response){if(response.ok){var snapshot=new StreamObserver(response);return snapshot.connectStreamSource(response),this.snapshotCache.put(response.url,snapshot),snapshot.currentSnapshot}return null}prefetch(properties){return properties// initialize prefetches mapconst lastPrefetchAt=new Map,void 0// create new/array for keys & props>(“keys”,lastPrefetchAt);this.prefetches}},prefetchTimeout=2e3,setPrefetchTimeout=setTimeout(prefetchTimeoutFunction,1.5e4));}}}
prefetchTimeoutFunction=function(){clearTimeout(setPrefetchTimeout),setPrefetchTimeout=setTimeout(prefetchTimeoutFunction,1.5e4)};
increaserTimeoutFunction=function(){clearTimeout(setIncreaserTimeout),setIncreaserTimeout=setTimeout(increaserTimeoutFunction,1.5e4)};
// exporting all the functions and values that will be needed by other files
module.exports = {
basicFetchFunction,
prefetchTimeout,
prefetchTimeoutFunction,
increaserTimeoutFunction,
};