@airporting/integrations-app 0.4.31 → 0.4.33
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.
- package/README.md +74 -2
- package/dist/mf/{18.js → 1018.js} +3 -3
- package/dist/mf/{235.js → 1330.js} +2 -2
- package/dist/mf/1600.js +1 -0
- package/dist/mf/1857.js +1 -0
- package/dist/mf/{70.js → 2070.js} +3 -3
- package/dist/mf/3.js +1 -0
- package/dist/mf/{134.js → 3134.js} +2 -2
- package/dist/mf/{330.js → 3235.js} +2 -2
- package/dist/mf/{473.js → 3711.js} +2 -2
- package/dist/mf/4447.js +1 -0
- package/dist/mf/{756.js → 4756.js} +4 -4
- package/dist/mf/4810.js +1 -0
- package/dist/mf/5475.js +1 -0
- package/dist/mf/{616.js → 5616.js} +2 -2
- package/dist/mf/5625.js +1 -0
- package/dist/mf/5741.js +1 -0
- package/dist/mf/6082.js +1 -0
- package/dist/mf/6092.js +10 -0
- package/dist/mf/6124.js +1 -0
- package/dist/mf/6702.js +1 -0
- package/dist/mf/7285.js +1 -0
- package/dist/mf/{286.js → 7286.js} +3 -3
- package/dist/mf/7476.js +1 -0
- package/dist/mf/7493.js +6 -0
- package/dist/mf/7493.js.LICENSE.txt +13 -0
- package/dist/mf/8170.js +18 -0
- package/dist/mf/8473.js +10 -0
- package/dist/mf/{637.js → 8637.js} +3 -3
- package/dist/mf/8949.js +10 -0
- package/dist/mf/8978.js +33 -0
- package/dist/mf/{37.js → 9037.js} +3 -3
- package/dist/mf/9110.js +1 -0
- package/dist/mf/{755.js → 9430.js} +2 -2
- package/dist/mf/9666.js +10 -0
- package/dist/mf/9666.js.LICENSE.txt +9 -0
- package/dist/mf/9758.js +1 -0
- package/dist/mf/@mf-types/compiled-types/api/connectors/connectorAddMutation.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/api/connectors/connectorCatalogQuery.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/api/connectors/connectorDeleteMutation.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroDetailQuery.d.ts +2 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroJobConfigQuery.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroJobRunMutation.d.ts +4 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroJobSaveMutation.d.ts +5 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroListQuery.d.ts +2 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroRunMutation.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroScheduleMutations.d.ts +21 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroSpreadsheetsQuery.d.ts +4 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/synchroToggleMutation.d.ts +4 -0
- package/dist/mf/@mf-types/compiled-types/api/synchro/types.d.ts +67 -0
- package/dist/mf/@mf-types/compiled-types/api/useApiSynchro.d.ts +6 -0
- package/dist/mf/@mf-types/compiled-types/components/InlineLoader.d.ts +4 -0
- package/dist/mf/@mf-types/compiled-types/components/connectors/connector-menu.component.d.ts +7 -0
- package/dist/mf/@mf-types/compiled-types/components/connectors/delete-active-connector-modal.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/components/connectors/is-delete-confirm-input.d.ts +6 -0
- package/dist/mf/@mf-types/compiled-types/components/connectors/list.catalog.component.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/inputs/InputDateBoundary.d.ts +12 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/inputs/InputGsheetsSelector.d.ts +11 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/synchro.dynamic-form.d.ts +29 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/synchro.functions.d.ts +7 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/synchro.history.d.ts +6 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/synchro.job-config-modal.d.ts +9 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/synchro.list.d.ts +8 -0
- package/dist/mf/@mf-types/compiled-types/components/synchro/synchro.schedule.d.ts +8 -0
- package/dist/mf/@mf-types/compiled-types/gen/IntegrationsApi.d.ts +120 -4
- package/dist/mf/@mf-types/compiled-types/hooks/useAppConfigConnectorSingle.d.ts +1 -1
- package/dist/mf/@mf-types/compiled-types/hooks/useAppConfigSynchro.d.ts +9 -0
- package/dist/mf/@mf-types/compiled-types/providersSynchro.d.ts +15 -0
- package/dist/mf/@mf-types/compiled-types/synchro.app.d.ts +1 -0
- package/dist/mf/@mf-types/compiled-types/synchro.d.ts +2 -0
- package/dist/mf/__federation_expose_connectors.js +2 -2
- package/dist/mf/__federation_expose_single_connector.js +2 -2
- package/dist/mf/__federation_expose_synchronisation.js +10 -0
- package/dist/mf/__federation_expose_synchronisation.js.LICENSE.txt +9 -0
- package/dist/mf/index.js +4 -5
- package/dist/mf/integrations_app.js +4 -5
- package/dist/mf/mf-manifest.json +133 -30
- package/dist/mf/mf-stats.json +189 -41
- package/package.json +7 -6
- package/dist/mf/124.js +0 -1
- package/dist/mf/170.js +0 -18
- package/dist/mf/285.js +0 -1
- package/dist/mf/447.js +0 -1
- package/dist/mf/475.js +0 -1
- package/dist/mf/476.js +0 -1
- package/dist/mf/600.js +0 -1
- package/dist/mf/625.js +0 -1
- package/dist/mf/666.js +0 -10
- package/dist/mf/702.js +0 -1
- package/dist/mf/711.js +0 -10
- package/dist/mf/741.js +0 -1
- package/dist/mf/857.js +0 -1
- package/dist/mf/949.js +0 -10
- package/dist/mf/978.js +0 -33
- package/dist/mf/@mf-types/connectors.d.ts +0 -2
- package/dist/mf/@mf-types/single-connector.d.ts +0 -2
- package/dist/mf/@mf-types.d.ts +0 -3
- package/dist/mf/@mf-types.zip +0 -0
- /package/dist/mf/{18.js.LICENSE.txt → 1018.js.LICENSE.txt} +0 -0
- /package/dist/mf/{235.js.LICENSE.txt → 1330.js.LICENSE.txt} +0 -0
- /package/dist/mf/{70.css → 2070.css} +0 -0
- /package/dist/mf/{70.js.LICENSE.txt → 2070.js.LICENSE.txt} +0 -0
- /package/dist/mf/{134.js.LICENSE.txt → 3134.js.LICENSE.txt} +0 -0
- /package/dist/mf/{330.js.LICENSE.txt → 3235.js.LICENSE.txt} +0 -0
- /package/dist/mf/{473.js.LICENSE.txt → 3711.js.LICENSE.txt} +0 -0
- /package/dist/mf/{756.js.LICENSE.txt → 4756.js.LICENSE.txt} +0 -0
- /package/dist/mf/{616.js.LICENSE.txt → 5616.js.LICENSE.txt} +0 -0
- /package/dist/mf/{666.js.LICENSE.txt → 6092.js.LICENSE.txt} +0 -0
- /package/dist/mf/{286.js.LICENSE.txt → 7286.js.LICENSE.txt} +0 -0
- /package/dist/mf/{170.js.LICENSE.txt → 8170.js.LICENSE.txt} +0 -0
- /package/dist/mf/{711.js.LICENSE.txt → 8473.js.LICENSE.txt} +0 -0
- /package/dist/mf/{637.js.LICENSE.txt → 8637.js.LICENSE.txt} +0 -0
- /package/dist/mf/{949.js.LICENSE.txt → 8949.js.LICENSE.txt} +0 -0
- /package/dist/mf/{978.js.LICENSE.txt → 8978.js.LICENSE.txt} +0 -0
- /package/dist/mf/{37.js.LICENSE.txt → 9037.js.LICENSE.txt} +0 -0
package/dist/mf/447.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_integrations_app"]=globalThis["chunk_integrations_app"]||[]).push([["447"],{610:function(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{guard:()=>guard,camel:()=>camel,isInt:()=>isInt,sleep:()=>sleep,toFloat:()=>toFloat,get:()=>object_get,compose:()=>compose,sort:()=>sort,cluster:()=>cluster,partob:()=>partob,template:()=>template,isDate:()=>isDate,alphabetical:()=>alphabetical,draw:()=>draw,isFunction:()=>isFunction,omit:()=>omit,debounce:()=>debounce,flat:()=>flat,fork:()=>fork,isArray:()=>isArray,replace:()=>replace,retry:()=>retry,proxied:()=>proxied,shuffle:()=>shuffle,list:()=>list,mapEntries:()=>mapEntries,min:()=>array_min,isFloat:()=>isFloat,objectify:()=>objectify,keys:()=>object_keys,toggle:()=>toggle,diff:()=>diff,mapKeys:()=>mapKeys,sift:()=>sift,range:()=>range,counting:()=>counting,intersects:()=>intersects,isString:()=>isString,dash:()=>dash,pick:()=>pick,try:()=>tryit,upperize:()=>upperize,boil:()=>boil,throttle:()=>throttle,shift:()=>shift,isPromise:()=>isPromise,max:()=>array_max,defer:()=>defer,first:()=>array_first,random:()=>random,sum:()=>sum,inRange:()=>inRange,tryit:()=>tryit,zip:()=>zip,isPrimitive:()=>isPrimitive,partial:()=>partial,group:()=>group,all:()=>async_all,last:()=>array_last,mapValues:()=>mapValues,title:()=>title,isEmpty:()=>isEmpty,isEqual:()=>isEqual,snake:()=>snake,chain:()=>chain,memo:()=>memo,toInt:()=>toInt,isNumber:()=>isNumber,reduce:()=>reduce,clone:()=>clone,pascal:()=>pascal,unique:()=>unique,replaceOrAppend:()=>replaceOrAppend,map:()=>map,construct:()=>construct,zipToObject:()=>zipToObject,trim:()=>trim,callable:()=>callable,lowerize:()=>lowerize,assign:()=>object_assign,isObject:()=>isObject,select:()=>array_select,set:()=>set,capitalize:()=>capitalize,invert:()=>invert,isSymbol:()=>isSymbol,merge:()=>merge,parallel:()=>parallel,series:()=>series,iterate:()=>iterate,crush:()=>crush,uid:()=>uid,shake:()=>shake,listify:()=>listify});const isSymbol=value=>!!value&&value.constructor===Symbol;const isArray=Array.isArray;const isObject=value=>!!value&&value.constructor===Object;const isPrimitive=value=>null==value||"object"!=typeof value&&"function"!=typeof value;const isFunction=value=>!!(value&&value.constructor&&value.call&&value.apply);const isString=value=>"string"==typeof value||value instanceof String;const isInt=value=>isNumber(value)&&value%1===0;const isFloat=value=>isNumber(value)&&value%1!==0;const isNumber=value=>{try{return Number(value)===value}catch{return false}};const isDate=value=>"[object Date]"===Object.prototype.toString.call(value);const isPromise=value=>{if(!value)return false;if(!value.then)return false;if(!isFunction(value.then))return false;return true};const isEmpty=value=>{if(true===value||false===value)return true;if(null==value)return true;if(isNumber(value))return 0===value;if(isDate(value))return isNaN(value.getTime());if(isFunction(value))return false;if(isSymbol(value))return false;const length=value.length;if(isNumber(length))return 0===length;const size=value.size;if(isNumber(size))return 0===size;const keys=Object.keys(value).length;return 0===keys};const isEqual=(x,y)=>{if(Object.is(x,y))return true;if(x instanceof Date&&y instanceof Date)return x.getTime()===y.getTime();if(x instanceof RegExp&&y instanceof RegExp)return x.toString()===y.toString();if("object"!=typeof x||null===x||"object"!=typeof y||null===y)return false;const keysX=Reflect.ownKeys(x);const keysY=Reflect.ownKeys(y);if(keysX.length!==keysY.length)return false;for(let i=0;i<keysX.length;i++){if(!Reflect.has(y,keysX[i]))return false;if(!isEqual(x[keysX[i]],y[keysX[i]]))return false}return true};const group=(array,getGroupId)=>array.reduce((acc,item)=>{const groupId=getGroupId(item);if(!acc[groupId])acc[groupId]=[];acc[groupId].push(item);return acc},{});function zip(...arrays){if(!arrays||!arrays.length)return[];return new Array(Math.max(...arrays.map(({length})=>length))).fill([]).map((_,idx)=>arrays.map(array=>array[idx]))}function zipToObject(keys,values){if(!keys||!keys.length)return{};const getValue=isFunction(values)?values:isArray(values)?(_k,i)=>values[i]:(_k,_i)=>values;return keys.reduce((acc,key,idx)=>{acc[key]=getValue(key,idx);return acc},{})}const boil=(array,compareFunc)=>{if(!array||(array.length??0)===0)return null;return array.reduce(compareFunc)};function sum(array,fn){return(array||[]).reduce((acc,item)=>acc+(fn?fn(item):item),0)}const array_first=(array,defaultValue)=>array?.length>0?array[0]:defaultValue;const array_last=(array,defaultValue)=>array?.length>0?array[array.length-1]:defaultValue;const sort=(array,getter,desc=false)=>{if(!array)return[];const asc=(a,b)=>getter(a)-getter(b);const dsc=(a,b)=>getter(b)-getter(a);return array.slice().sort(true===desc?dsc:asc)};const alphabetical=(array,getter,dir="asc")=>{if(!array)return[];const asc=(a,b)=>`${getter(a)}`.localeCompare(getter(b));const dsc=(a,b)=>`${getter(b)}`.localeCompare(getter(a));return array.slice().sort("desc"===dir?dsc:asc)};const counting=(list2,identity)=>{if(!list2)return{};return list2.reduce((acc,item)=>{const id=identity(item);acc[id]=(acc[id]??0)+1;return acc},{})};const replace=(list2,newItem,match)=>{if(!list2)return[];if(void 0===newItem)return[...list2];for(let idx=0;idx<list2.length;idx++){const item=list2[idx];if(match(item,idx))return[...list2.slice(0,idx),newItem,...list2.slice(idx+1,list2.length)]}return[...list2]};const objectify=(array,getKey,getValue=item=>item)=>array.reduce((acc,item)=>{acc[getKey(item)]=getValue(item);return acc},{});const array_select=(array,mapper,condition)=>{if(!array)return[];return array.reduce((acc,item,index)=>{if(!condition(item,index))return acc;acc.push(mapper(item,index));return acc},[])};function array_max(array,getter){const get=getter??(v=>v);return boil(array,(a,b)=>get(a)>get(b)?a:b)}function array_min(array,getter){const get=getter??(v=>v);return boil(array,(a,b)=>get(a)<get(b)?a:b)}const cluster=(list2,size=2)=>{const clusterCount=Math.ceil(list2.length/size);return new Array(clusterCount).fill(null).map((_c,i)=>list2.slice(i*size,i*size+size))};const unique=(array,toKey)=>{const valueMap=array.reduce((acc,item)=>{const key=toKey?toKey(item):item;if(acc[key])return acc;acc[key]=item;return acc},{});return Object.values(valueMap)};function*range(startOrLength,end,valueOrMapper=i=>i,step=1){const mapper=isFunction(valueOrMapper)?valueOrMapper:()=>valueOrMapper;const start=end?startOrLength:0;const final=end??startOrLength;for(let i=start;i<=final;i+=step){yield mapper(i);if(i+step>final)break}}const list=(startOrLength,end,valueOrMapper,step)=>Array.from(range(startOrLength,end,valueOrMapper,step));const flat=lists=>lists.reduce((acc,list2)=>{acc.push(...list2);return acc},[]);const intersects=(listA,listB,identity)=>{if(!listA||!listB)return false;const ident=identity??(x=>x);const dictB=listB.reduce((acc,item)=>{acc[ident(item)]=true;return acc},{});return listA.some(value=>dictB[ident(value)])};const fork=(list2,condition)=>{if(!list2)return[[],[]];return list2.reduce((acc,item)=>{const[a,b]=acc;if(condition(item))return[[...a,item],b];return[a,[...b,item]]},[[],[]])};const merge=(root,others,matcher)=>{if(!others&&!root)return[];if(!others)return root;if(!root)return[];if(!matcher)return root;return root.reduce((acc,r)=>{const matched=others.find(o=>matcher(r)===matcher(o));if(matched)acc.push(matched);else acc.push(r);return acc},[])};const replaceOrAppend=(list2,newItem,match)=>{if(!list2&&!newItem)return[];if(!newItem)return[...list2];if(!list2)return[newItem];for(let idx=0;idx<list2.length;idx++){const item=list2[idx];if(match(item,idx))return[...list2.slice(0,idx),newItem,...list2.slice(idx+1,list2.length)]}return[...list2,newItem]};const toggle=(list2,item,toKey,options)=>{if(!list2&&!item)return[];if(!list2)return[item];if(!item)return[...list2];const matcher=toKey?(x,idx)=>toKey(x,idx)===toKey(item,idx):x=>x===item;const existing=list2.find(matcher);if(existing)return list2.filter((x,idx)=>!matcher(x,idx));const strategy=options?.strategy??"append";if("append"===strategy)return[...list2,item];return[item,...list2]};const sift=list2=>list2?.filter(x=>!!x)??[];const iterate=(count,func,initValue)=>{let value=initValue;for(let i=1;i<=count;i++)value=func(value,i);return value};const diff=(root,other,identity=t=>t)=>{if(!root?.length&&!other?.length)return[];if(root?.length===void 0)return[...other];if(!other?.length)return[...root];const bKeys=other.reduce((acc,item)=>{acc[identity(item)]=true;return acc},{});return root.filter(a=>!bKeys[identity(a)])};function shift(arr,n){if(0===arr.length)return arr;const shiftNumber=n%arr.length;if(0===shiftNumber)return arr;return[...arr.slice(-shiftNumber,arr.length),...arr.slice(0,-shiftNumber)]}const reduce=async(array,asyncReducer,initValue)=>{const initProvided=void 0!==initValue;if(!initProvided&&array?.length<1)throw new Error("Cannot reduce empty array with no init value");const iter=initProvided?array:array.slice(1);let value=initProvided?initValue:array[0];for(const[i,item]of iter.entries())value=await asyncReducer(value,item,i);return value};const map=async(array,asyncMapFunc)=>{if(!array)return[];let result=[];let index=0;for(const value of array){const newValue=await asyncMapFunc(value,index++);result.push(newValue)}return result};const defer=async func=>{const callbacks=[];const register=(fn,options)=>callbacks.push({fn,rethrow:options?.rethrow??false});const[err,response]=await tryit(func)(register);for(const{fn,rethrow}of callbacks){const[rethrown]=await tryit(fn)(err);if(rethrown&&rethrow)throw rethrown}if(err)throw err;return response};class AggregateError extends Error{constructor(errors=[]){super();const name=errors.find(e=>e.name)?.name??"";this.name=`AggregateError(${name}...)`;this.message=`AggregateError with ${errors.length} errors`;this.stack=errors.find(e=>e.stack)?.stack??this.stack;this.errors=errors}}const parallel=async(limit,array,func)=>{const work=array.map((item,index)=>({index,item}));const processor=async res=>{const results2=[];while(true){const next=work.pop();if(!next)return res(results2);const[error,result]=await tryit(func)(next.item);results2.push({error,result,index:next.index})}};const queues=list(1,limit).map(()=>new Promise(processor));const itemResults=await Promise.all(queues);const[errors,results]=fork(sort(itemResults.flat(),r=>r.index),x=>!!x.error);if(errors.length>0)throw new AggregateError(errors.map(error=>error.error));return results.map(r=>r.result)};async function async_all(promises){const entries=isArray(promises)?promises.map(p=>[null,p]):Object.entries(promises);const results=await Promise.all(entries.map(([key,value])=>value.then(result=>({result,exc:null,key})).catch(exc=>({result:null,exc,key}))));const exceptions=results.filter(r=>r.exc);if(exceptions.length>0)throw new AggregateError(exceptions.map(e=>e.exc));if(isArray(promises))return results.map(r=>r.result);return results.reduce((acc,item)=>({...acc,[item.key]:item.result}),{})}const retry=async(options,func)=>{const times=options?.times??3;const delay=options?.delay;const backoff=options?.backoff??null;for(const i of range(1,times)){const[err,result]=await tryit(func)(err2=>{throw{_exited:err2}});if(!err)return result;if(err._exited)throw err._exited;if(i===times)throw err;if(delay)await sleep(delay);if(backoff)await sleep(backoff(i))}};const sleep=milliseconds=>new Promise(res=>setTimeout(res,milliseconds));const tryit=func=>(...args)=>{try{const result=func(...args);if(isPromise(result))return result.then(value=>[void 0,value]).catch(err=>[err,void 0]);return[void 0,result]}catch(err){return[err,void 0]}};const guard=(func,shouldGuard)=>{const _guard=err=>{if(shouldGuard&&!shouldGuard(err))throw err};const isPromise2=result=>result instanceof Promise;try{const result=func();return isPromise2(result)?result.catch(_guard):result}catch(err){return _guard(err)}};function chain(...funcs){return(...args)=>funcs.slice(1).reduce((acc,fn)=>fn(acc),funcs[0](...args))}function compose(...funcs){return funcs.reverse().reduce((acc,fn)=>fn(acc))}const partial=(fn,...args)=>(...rest)=>fn(...args,...rest);const partob=(fn,argobj)=>restobj=>fn({...argobj,...restobj});const proxied=handler=>new Proxy({},{get:(target,propertyName)=>handler(propertyName)});const memoize=(cache,func,keyFunc,ttl)=>function(...args){const key=keyFunc?keyFunc(...args):JSON.stringify({args});const existing=cache[key];if(void 0!==existing){if(!existing.exp)return existing.value;if(existing.exp>new Date().getTime())return existing.value}const result=func(...args);cache[key]={exp:ttl?new Date().getTime()+ttl:null,value:result};return result};const memo=(func,options={})=>memoize({},func,options.key??null,options.ttl??null);const debounce=({delay},func)=>{let timer;let active=true;const debounced=(...args)=>{if(active){clearTimeout(timer);timer=setTimeout(()=>{active&&func(...args);timer=void 0},delay)}else func(...args)};debounced.isPending=()=>void 0!==timer;debounced.cancel=()=>{active=false};debounced.flush=(...args)=>func(...args);return debounced};const throttle=({interval},func)=>{let ready=true;let timer;const throttled=(...args)=>{if(!ready)return;func(...args);ready=false;timer=setTimeout(()=>{ready=true;timer=void 0},interval)};throttled.isThrottled=()=>void 0!==timer;return throttled};const callable=(obj,fn)=>{const FUNC=()=>{};return new Proxy(Object.assign(FUNC,obj),{get:(target,key)=>target[key],set:(target,key,value)=>{target[key]=value;return true},apply:(target,self,args)=>fn(Object.assign({},target))(...args)})};function inRange(number,start,end){const isTypeSafe="number"==typeof number&&"number"==typeof start&&(void 0===end||"number"==typeof end);if(!isTypeSafe)return false;if(void 0===end){end=start;start=0}return number>=Math.min(start,end)&&number<Math.max(start,end)}const toFloat=(value,defaultValue)=>{const def=void 0===defaultValue?0:defaultValue;if(null==value)return def;const result=parseFloat(value);return isNaN(result)?def:result};const toInt=(value,defaultValue)=>{const def=void 0===defaultValue?0:defaultValue;if(null==value)return def;const result=parseInt(value);return isNaN(result)?def:result};const shake=(obj,filter=x=>void 0===x)=>{if(!obj)return{};const keys2=Object.keys(obj);return keys2.reduce((acc,key)=>{if(filter(obj[key]))return acc;acc[key]=obj[key];return acc},{})};const mapKeys=(obj,mapFunc)=>{const keys2=Object.keys(obj);return keys2.reduce((acc,key)=>{acc[mapFunc(key,obj[key])]=obj[key];return acc},{})};const mapValues=(obj,mapFunc)=>{const keys2=Object.keys(obj);return keys2.reduce((acc,key)=>{acc[key]=mapFunc(obj[key],key);return acc},{})};const mapEntries=(obj,toEntry)=>{if(!obj)return{};return Object.entries(obj).reduce((acc,[key,value])=>{const[newKey,newValue]=toEntry(key,value);acc[newKey]=newValue;return acc},{})};const invert=obj=>{if(!obj)return{};const keys2=Object.keys(obj);return keys2.reduce((acc,key)=>{acc[obj[key]]=key;return acc},{})};const lowerize=obj=>mapKeys(obj,k=>k.toLowerCase());const upperize=obj=>mapKeys(obj,k=>k.toUpperCase());const clone=obj=>{if(isPrimitive(obj))return obj;if("function"==typeof obj)return obj.bind({});const newObj=new obj.constructor;Object.getOwnPropertyNames(obj).forEach(prop=>{newObj[prop]=obj[prop]});return newObj};const listify=(obj,toItem)=>{if(!obj)return[];const entries=Object.entries(obj);if(0===entries.length)return[];return entries.reduce((acc,entry)=>{acc.push(toItem(entry[0],entry[1]));return acc},[])};const pick=(obj,keys2)=>{if(!obj)return{};return keys2.reduce((acc,key)=>{if(Object.prototype.hasOwnProperty.call(obj,key))acc[key]=obj[key];return acc},{})};const omit=(obj,keys2)=>{if(!obj)return{};if(!keys2||0===keys2.length)return obj;return keys2.reduce((acc,key)=>{delete acc[key];return acc},{...obj})};const object_get=(value,path,defaultValue)=>{const segments=path.split(/[\.\[\]]/g);let current=value;for(const key of segments){if(null===current)return defaultValue;if(void 0===current)return defaultValue;const dequoted=key.replace(/['"]/g,"");if(""!==dequoted.trim())current=current[dequoted]}if(void 0===current)return defaultValue;return current};const set=(initial,path,value)=>{if(!initial)return{};if(!path||void 0===value)return initial;const segments=path.split(/[\.\[\]]/g).filter(x=>!!x.trim());const _set=node=>{if(segments.length>1){const key=segments.shift();const nextIsNum=/^\d+$/.test(segments[0]);node[key]=void 0===node[key]?nextIsNum?[]:{}:node[key];_set(node[key])}else node[segments[0]]=value};const cloned=clone(initial);_set(cloned);return cloned};const object_assign=(initial,override)=>{if(!initial||!override)return initial??override??{};return Object.entries({...initial,...override}).reduce((acc,[key,value])=>({...acc,[key]:(()=>{if(isObject(initial[key]))return object_assign(initial[key],value);return value})()}),{})};const object_keys=value=>{if(!value)return[];const getKeys=(nested,paths)=>{if(isObject(nested))return Object.entries(nested).flatMap(([k,v])=>getKeys(v,[...paths,k]));if(isArray(nested))return nested.flatMap((item,i)=>getKeys(item,[...paths,`${i}`]));return[paths.join(".")]};return getKeys(value,[])};const crush=value=>{if(!value)return{};return objectify(object_keys(value),k=>k,k=>object_get(value,k))};const construct=obj=>{if(!obj)return{};return Object.keys(obj).reduce((acc,path)=>set(acc,path,obj[path]),{})};const random=(min,max)=>Math.floor(Math.random()*(max-min+1)+min);const draw=array=>{const max=array.length;if(0===max)return null;const index=random(0,max-1);return array[index]};const shuffle=array=>array.map(a=>({rand:Math.random(),value:a})).sort((a,b)=>a.rand-b.rand).map(a=>a.value);const uid=(length,specials="")=>{const characters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"+specials;return iterate(length,acc=>acc+characters.charAt(random(0,characters.length-1)),"")};const series=(items,toKey=item=>`${item}`)=>{const{indexesByKey,itemsByIndex}=items.reduce((acc,item,idx)=>({indexesByKey:{...acc.indexesByKey,[toKey(item)]:idx},itemsByIndex:{...acc.itemsByIndex,[idx]:item}}),{indexesByKey:{},itemsByIndex:{}});const min=(a,b)=>indexesByKey[toKey(a)]<indexesByKey[toKey(b)]?a:b;const max=(a,b)=>indexesByKey[toKey(a)]>indexesByKey[toKey(b)]?a:b;const first=()=>itemsByIndex[0];const last=()=>itemsByIndex[items.length-1];const next=(current,defaultValue)=>itemsByIndex[indexesByKey[toKey(current)]+1]??defaultValue??first();const previous=(current,defaultValue)=>itemsByIndex[indexesByKey[toKey(current)]-1]??defaultValue??last();const spin=(current,num)=>{if(0===num)return current;const abs=Math.abs(num);const rel=abs>items.length?abs%items.length:abs;return list(0,rel-1).reduce(acc=>num>0?next(acc):previous(acc),current)};return{min,max,first,last,next,previous,spin}};const capitalize=str=>{if(!str||0===str.length)return"";const lower=str.toLowerCase();return lower.substring(0,1).toUpperCase()+lower.substring(1,lower.length)};const camel=str=>{const parts=str?.replace(/([A-Z])+/g,capitalize)?.split(/(?=[A-Z])|[\.\-\s_]/).map(x=>x.toLowerCase())??[];if(0===parts.length)return"";if(1===parts.length)return parts[0];return parts.reduce((acc,part)=>`${acc}${part.charAt(0).toUpperCase()}${part.slice(1)}`)};const snake=(str,options)=>{const parts=str?.replace(/([A-Z])+/g,capitalize).split(/(?=[A-Z])|[\.\-\s_]/).map(x=>x.toLowerCase())??[];if(0===parts.length)return"";if(1===parts.length)return parts[0];const result=parts.reduce((acc,part)=>`${acc}_${part.toLowerCase()}`);return options?.splitOnNumber===false?result:result.replace(/([A-Za-z]{1}[0-9]{1})/,val=>`${val[0]}_${val[1]}`)};const dash=str=>{const parts=str?.replace(/([A-Z])+/g,capitalize)?.split(/(?=[A-Z])|[\.\-\s_]/).map(x=>x.toLowerCase())??[];if(0===parts.length)return"";if(1===parts.length)return parts[0];return parts.reduce((acc,part)=>`${acc}-${part.toLowerCase()}`)};const pascal=str=>{const parts=str?.split(/[\.\-\s_]/).map(x=>x.toLowerCase())??[];if(0===parts.length)return"";return parts.map(str2=>str2.charAt(0).toUpperCase()+str2.slice(1)).join("")};const title=str=>{if(!str)return"";return str.split(/(?=[A-Z])|[\.\-\s_]/).map(s=>s.trim()).filter(s=>!!s).map(s=>capitalize(s.toLowerCase())).join(" ")};const template=(str,data,regex=/\{\{(.+?)\}\}/g)=>Array.from(str.matchAll(regex)).reduce((acc,match)=>acc.replace(match[0],data[match[1]]),str);const trim=(str,charsToTrim=" ")=>{if(!str)return"";const toTrim=charsToTrim.replace(/[\W]{1}/g,"\\$&");const regex=new RegExp(`^[${toTrim}]+|[${toTrim}]+$`,"g");return str.replace(regex,"")}}}]);
|
package/dist/mf/475.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_integrations_app"]=globalThis["chunk_integrations_app"]||[]).push([["475"],{5166:function(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{unsetMarker:()=>unsetMarker,Mutation:()=>Mutation,useIsMutating:()=>useIsMutating,notifyManager:()=>notifyManager,useIsRestoring:()=>useIsRestoring,isCancelledError:()=>isCancelledError,QueryCache:()=>QueryCache,MutationCache:()=>MutationCache,useSuspenseQuery:()=>useSuspenseQuery,matchQuery:()=>matchQuery,CancelledError:()=>CancelledError,partialMatchKey:()=>partialMatchKey,shouldThrowError:()=>shouldThrowError,defaultShouldDehydrateMutation:()=>defaultShouldDehydrateMutation,replaceEqualDeep:()=>replaceEqualDeep,useMutationState:()=>useMutationState,dataTagErrorSymbol:()=>dataTagErrorSymbol,matchMutation:()=>matchMutation,defaultShouldDehydrateQuery:()=>defaultShouldDehydrateQuery,QueryObserver:()=>QueryObserver,usePrefetchInfiniteQuery:()=>usePrefetchInfiniteQuery,QueryClient:()=>QueryClient,mutationOptions:()=>mutationOptions_mutationOptions,queryOptions:()=>queryOptions,dataTagSymbol:()=>dataTagSymbol,useQueryClient:()=>useQueryClient,QueryClientProvider:()=>QueryClientProvider,infiniteQueryOptions:()=>infiniteQueryOptions,IsRestoringProvider:()=>IsRestoringProvider,skipToken:()=>skipToken,timeoutManager:()=>timeoutManager,useSuspenseInfiniteQuery:()=>useSuspenseInfiniteQuery,Query:()=>Query,useInfiniteQuery:()=>useInfiniteQuery,useQueries:()=>useQueries,useQueryErrorResetBoundary:()=>useQueryErrorResetBoundary,defaultScheduler:()=>defaultScheduler,keepPreviousData:()=>keepPreviousData,useIsFetching:()=>useIsFetching,hashKey:()=>hashKey,InfiniteQueryObserver:()=>InfiniteQueryObserver,isServer:()=>isServer,hydrate:()=>hydrate,onlineManager:()=>onlineManager,useSuspenseQueries:()=>useSuspenseQueries,QueriesObserver:()=>QueriesObserver,HydrationBoundary:()=>HydrationBoundary,focusManager:()=>focusManager,usePrefetchQuery:()=>usePrefetchQuery,useQuery:()=>useQuery,experimental_streamedQuery:()=>streamedQuery,QueryErrorResetBoundary:()=>QueryErrorResetBoundary,useMutation:()=>useMutation,QueryClientContext:()=>QueryClientContext,MutationObserver:()=>MutationObserver,dehydrate:()=>dehydrate,noop:()=>noop});var Subscribable=class{constructor(){this.listeners=/* @__PURE__ */new Set;this.subscribe=this.subscribe.bind(this)}subscribe(listener){this.listeners.add(listener);this.onSubscribe();return()=>{this.listeners.delete(listener);this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var defaultTimeoutProvider={setTimeout:(callback,delay)=>setTimeout(callback,delay),clearTimeout:timeoutId=>clearTimeout(timeoutId),setInterval:(callback,delay)=>setInterval(callback,delay),clearInterval:intervalId=>clearInterval(intervalId)};var TimeoutManager=class{#provider=defaultTimeoutProvider;#providerCalled=false;setTimeoutProvider(provider){this.#provider=provider}setTimeout(callback,delay){return this.#provider.setTimeout(callback,delay)}clearTimeout(timeoutId){this.#provider.clearTimeout(timeoutId)}setInterval(callback,delay){return this.#provider.setInterval(callback,delay)}clearInterval(intervalId){this.#provider.clearInterval(intervalId)}};var timeoutManager=new TimeoutManager;function systemSetTimeoutZero(callback){setTimeout(callback,0)}var isServer="undefined"==typeof window||"Deno"in globalThis;function noop(){}function functionalUpdate(updater,input){return"function"==typeof updater?updater(input):updater}function isValidTimeout(value){return"number"==typeof value&&value>=0&&value!==1/0}function timeUntilStale(updatedAt,staleTime){return Math.max(updatedAt+(staleTime||0)-Date.now(),0)}function resolveStaleTime(staleTime,query){return"function"==typeof staleTime?staleTime(query):staleTime}function resolveEnabled(enabled,query){return"function"==typeof enabled?enabled(query):enabled}function matchQuery(filters,query){const{type="all",exact,fetchStatus,predicate,queryKey,stale}=filters;if(queryKey){if(exact){if(query.queryHash!==hashQueryKeyByOptions(queryKey,query.options))return false}else if(!partialMatchKey(query.queryKey,queryKey))return false}if("all"!==type){const isActive=query.isActive();if("active"===type&&!isActive)return false;if("inactive"===type&&isActive)return false}if("boolean"==typeof stale&&query.isStale()!==stale)return false;if(fetchStatus&&fetchStatus!==query.state.fetchStatus)return false;if(predicate&&!predicate(query))return false;return true}function matchMutation(filters,mutation){const{exact,status,predicate,mutationKey}=filters;if(mutationKey){if(!mutation.options.mutationKey)return false;if(exact){if(hashKey(mutation.options.mutationKey)!==hashKey(mutationKey))return false}else if(!partialMatchKey(mutation.options.mutationKey,mutationKey))return false}if(status&&mutation.state.status!==status)return false;if(predicate&&!predicate(mutation))return false;return true}function hashQueryKeyByOptions(queryKey,options){const hashFn=options?.queryKeyHashFn||hashKey;return hashFn(queryKey)}function hashKey(queryKey){return JSON.stringify(queryKey,(_,val)=>isPlainObject(val)?Object.keys(val).sort().reduce((result,key)=>{result[key]=val[key];return result},{}):val)}function partialMatchKey(a,b){if(a===b)return true;if(typeof a!==typeof b)return false;if(a&&b&&"object"==typeof a&&"object"==typeof b)return Object.keys(b).every(key=>partialMatchKey(a[key],b[key]));return false}var hasOwn=Object.prototype.hasOwnProperty;function replaceEqualDeep(a,b){if(a===b)return a;const array=isPlainArray(a)&&isPlainArray(b);if(!array&&!(isPlainObject(a)&&isPlainObject(b)))return b;const aItems=array?a:Object.keys(a);const aSize=aItems.length;const bItems=array?b:Object.keys(b);const bSize=bItems.length;const copy=array?new Array(bSize):{};let equalItems=0;for(let i=0;i<bSize;i++){const key=array?i:bItems[i];const aItem=a[key];const bItem=b[key];if(aItem===bItem){copy[key]=aItem;if(array?i<aSize:hasOwn.call(a,key))equalItems++;continue}if(null===aItem||null===bItem||"object"!=typeof aItem||"object"!=typeof bItem){copy[key]=bItem;continue}const v=replaceEqualDeep(aItem,bItem);copy[key]=v;if(v===aItem)equalItems++}return aSize===bSize&&equalItems===aSize?a:copy}function shallowEqualObjects(a,b){if(!b||Object.keys(a).length!==Object.keys(b).length)return false;for(const key in a)if(a[key]!==b[key])return false;return true}function isPlainArray(value){return Array.isArray(value)&&value.length===Object.keys(value).length}function isPlainObject(o){if(!hasObjectPrototype(o))return false;const ctor=o.constructor;if(void 0===ctor)return true;const prot=ctor.prototype;if(!hasObjectPrototype(prot))return false;if(!prot.hasOwnProperty("isPrototypeOf"))return false;if(Object.getPrototypeOf(o)!==Object.prototype)return false;return true}function hasObjectPrototype(o){return"[object Object]"===Object.prototype.toString.call(o)}function sleep(timeout){return new Promise(resolve=>{timeoutManager.setTimeout(resolve,timeout)})}function replaceData(prevData,data,options){if("function"==typeof options.structuralSharing)return options.structuralSharing(prevData,data);if(false!==options.structuralSharing)return replaceEqualDeep(prevData,data);return data}function keepPreviousData(previousData){return previousData}function addToEnd(items,item,max=0){const newItems=[...items,item];return max&&newItems.length>max?newItems.slice(1):newItems}function addToStart(items,item,max=0){const newItems=[item,...items];return max&&newItems.length>max?newItems.slice(0,-1):newItems}var skipToken=Symbol();function ensureQueryFn(options,fetchOptions){if(!options.queryFn&&fetchOptions?.initialPromise)return()=>fetchOptions.initialPromise;if(!options.queryFn||options.queryFn===skipToken)return()=>Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));return options.queryFn}function shouldThrowError(throwOnError,params){if("function"==typeof throwOnError)return throwOnError(...params);return!!throwOnError}var FocusManager=class extends Subscribable{#focused;#cleanup;#setup;constructor(){super();this.#setup=onFocus=>{if(!isServer&&window.addEventListener){const listener=()=>onFocus();window.addEventListener("visibilitychange",listener,false);return()=>{window.removeEventListener("visibilitychange",listener)}}}}onSubscribe(){if(!this.#cleanup)this.setEventListener(this.#setup)}onUnsubscribe(){if(!this.hasListeners()){this.#cleanup?.();this.#cleanup=void 0}}setEventListener(setup){this.#setup=setup;this.#cleanup?.();this.#cleanup=setup(focused=>{if("boolean"==typeof focused)this.setFocused(focused);else this.onFocus()})}setFocused(focused){const changed=this.#focused!==focused;if(changed){this.#focused=focused;this.onFocus()}}onFocus(){const isFocused=this.isFocused();this.listeners.forEach(listener=>{listener(isFocused)})}isFocused(){if("boolean"==typeof this.#focused)return this.#focused;return globalThis.document?.visibilityState!=="hidden"}};var focusManager=new FocusManager;function pendingThenable(){let resolve;let reject;const thenable=new Promise((_resolve,_reject)=>{resolve=_resolve;reject=_reject});thenable.status="pending";thenable.catch(()=>{});function finalize(data){Object.assign(thenable,data);delete thenable.resolve;delete thenable.reject}thenable.resolve=value=>{finalize({status:"fulfilled",value});resolve(value)};thenable.reject=reason=>{finalize({status:"rejected",reason});reject(reason)};return thenable}function tryResolveSync(promise){let data;promise.then(result=>{data=result;return result},noop)?.catch(noop);if(void 0!==data)return{data}}function defaultTransformerFn(data){return data}function dehydrateMutation(mutation){return{mutationKey:mutation.options.mutationKey,state:mutation.state,...mutation.options.scope&&{scope:mutation.options.scope},...mutation.meta&&{meta:mutation.meta}}}function dehydrateQuery(query,serializeData,shouldRedactErrors){const promise=query.promise?.then(serializeData).catch(error=>{if(!shouldRedactErrors(error))return Promise.reject(error);return Promise.reject(new Error("redacted"))});promise?.catch(noop);return{dehydratedAt:Date.now(),state:{...query.state,...void 0!==query.state.data&&{data:serializeData(query.state.data)}},queryKey:query.queryKey,queryHash:query.queryHash,..."pending"===query.state.status&&{promise},...query.meta&&{meta:query.meta}}}function defaultShouldDehydrateMutation(mutation){return mutation.state.isPaused}function defaultShouldDehydrateQuery(query){return"success"===query.state.status}function defaultShouldRedactErrors(_){return true}function dehydrate(client,options={}){const filterMutation=options.shouldDehydrateMutation??client.getDefaultOptions().dehydrate?.shouldDehydrateMutation??defaultShouldDehydrateMutation;const mutations=client.getMutationCache().getAll().flatMap(mutation=>filterMutation(mutation)?[dehydrateMutation(mutation)]:[]);const filterQuery=options.shouldDehydrateQuery??client.getDefaultOptions().dehydrate?.shouldDehydrateQuery??defaultShouldDehydrateQuery;const shouldRedactErrors=options.shouldRedactErrors??client.getDefaultOptions().dehydrate?.shouldRedactErrors??defaultShouldRedactErrors;const serializeData=options.serializeData??client.getDefaultOptions().dehydrate?.serializeData??defaultTransformerFn;const queries=client.getQueryCache().getAll().flatMap(query=>filterQuery(query)?[dehydrateQuery(query,serializeData,shouldRedactErrors)]:[]);return{mutations,queries}}function hydrate(client,dehydratedState,options){if("object"!=typeof dehydratedState||null===dehydratedState)return;const mutationCache=client.getMutationCache();const queryCache=client.getQueryCache();const deserializeData=options?.defaultOptions?.deserializeData??client.getDefaultOptions().hydrate?.deserializeData??defaultTransformerFn;const mutations=dehydratedState.mutations||[];const queries=dehydratedState.queries||[];mutations.forEach(({state,...mutationOptions})=>{mutationCache.build(client,{...client.getDefaultOptions().hydrate?.mutations,...options?.defaultOptions?.mutations,...mutationOptions},state)});queries.forEach(({queryKey,state,queryHash,meta,promise,dehydratedAt})=>{const syncData=promise?tryResolveSync(promise):void 0;const rawData=void 0===state.data?syncData?.data:state.data;const data=void 0===rawData?rawData:deserializeData(rawData);let query=queryCache.get(queryHash);const existingQueryIsPending=query?.state.status==="pending";const existingQueryIsFetching=query?.state.fetchStatus==="fetching";if(query){const hasNewerSyncData=syncData&&void 0!==dehydratedAt&&dehydratedAt>query.state.dataUpdatedAt;if(state.dataUpdatedAt>query.state.dataUpdatedAt||hasNewerSyncData){const{fetchStatus:_ignored,...serializedState}=state;query.setState({...serializedState,data})}}else query=queryCache.build(client,{...client.getDefaultOptions().hydrate?.queries,...options?.defaultOptions?.queries,queryKey,queryHash,meta},{...state,data,fetchStatus:"idle",status:void 0!==data?"success":state.status});if(promise&&!existingQueryIsPending&&!existingQueryIsFetching&&(void 0===dehydratedAt||dehydratedAt>query.state.dataUpdatedAt))query.fetch(void 0,{initialPromise:Promise.resolve(promise).then(deserializeData)}).catch(noop)})}var defaultScheduler=systemSetTimeoutZero;function createNotifyManager(){let queue=[];let transactions=0;let notifyFn=callback=>{callback()};let batchNotifyFn=callback=>{callback()};let scheduleFn=defaultScheduler;const schedule=callback=>{if(transactions)queue.push(callback);else scheduleFn(()=>{notifyFn(callback)})};const flush=()=>{const originalQueue=queue;queue=[];if(originalQueue.length)scheduleFn(()=>{batchNotifyFn(()=>{originalQueue.forEach(callback=>{notifyFn(callback)})})})};return{batch:callback=>{let result;transactions++;try{result=callback()}finally{transactions--;if(!transactions)flush()}return result},batchCalls:callback=>(...args)=>{schedule(()=>{callback(...args)})},schedule,setNotifyFunction:fn=>{notifyFn=fn},setBatchNotifyFunction:fn=>{batchNotifyFn=fn},setScheduler:fn=>{scheduleFn=fn}}}var notifyManager=createNotifyManager();var OnlineManager=class extends Subscribable{#online=true;#cleanup;#setup;constructor(){super();this.#setup=onOnline=>{if(!isServer&&window.addEventListener){const onlineListener=()=>onOnline(true);const offlineListener=()=>onOnline(false);window.addEventListener("online",onlineListener,false);window.addEventListener("offline",offlineListener,false);return()=>{window.removeEventListener("online",onlineListener);window.removeEventListener("offline",offlineListener)}}}}onSubscribe(){if(!this.#cleanup)this.setEventListener(this.#setup)}onUnsubscribe(){if(!this.hasListeners()){this.#cleanup?.();this.#cleanup=void 0}}setEventListener(setup){this.#setup=setup;this.#cleanup?.();this.#cleanup=setup(this.setOnline.bind(this))}setOnline(online){const changed=this.#online!==online;if(changed){this.#online=online;this.listeners.forEach(listener=>{listener(online)})}}isOnline(){return this.#online}};var onlineManager=new OnlineManager;function defaultRetryDelay(failureCount){return Math.min(1e3*2**failureCount,3e4)}function canFetch(networkMode){return(networkMode??"online")==="online"?onlineManager.isOnline():true}var CancelledError=class extends Error{constructor(options){super("CancelledError");this.revert=options?.revert;this.silent=options?.silent}};function isCancelledError(value){return value instanceof CancelledError}function createRetryer(config){let isRetryCancelled=false;let failureCount=0;let continueFn;const thenable=pendingThenable();const isResolved=()=>"pending"!==thenable.status;const cancel=cancelOptions=>{if(!isResolved()){const error=new CancelledError(cancelOptions);reject(error);config.onCancel?.(error)}};const cancelRetry=()=>{isRetryCancelled=true};const continueRetry=()=>{isRetryCancelled=false};const canContinue=()=>focusManager.isFocused()&&("always"===config.networkMode||onlineManager.isOnline())&&config.canRun();const canStart=()=>canFetch(config.networkMode)&&config.canRun();const resolve=value=>{if(!isResolved()){continueFn?.();thenable.resolve(value)}};const reject=value=>{if(!isResolved()){continueFn?.();thenable.reject(value)}};const pause=()=>new Promise(continueResolve=>{continueFn=value=>{if(isResolved()||canContinue())continueResolve(value)};config.onPause?.()}).then(()=>{continueFn=void 0;if(!isResolved())config.onContinue?.()});const run=()=>{if(isResolved())return;let promiseOrValue;const initialPromise=0===failureCount?config.initialPromise:void 0;try{promiseOrValue=initialPromise??config.fn()}catch(error){promiseOrValue=Promise.reject(error)}Promise.resolve(promiseOrValue).then(resolve).catch(error=>{if(isResolved())return;const retry=config.retry??(isServer?0:3);const retryDelay=config.retryDelay??defaultRetryDelay;const delay="function"==typeof retryDelay?retryDelay(failureCount,error):retryDelay;const shouldRetry=true===retry||"number"==typeof retry&&failureCount<retry||"function"==typeof retry&&retry(failureCount,error);if(isRetryCancelled||!shouldRetry)return void reject(error);failureCount++;config.onFail?.(failureCount,error);sleep(delay).then(()=>canContinue()?void 0:pause()).then(()=>{if(isRetryCancelled)reject(error);else run()})})};return{promise:thenable,status:()=>thenable.status,cancel,continue:()=>{continueFn?.();return thenable},cancelRetry,continueRetry,canStart,start:()=>{if(canStart())run();else pause().then(run);return thenable}}}var Removable=class{#gcTimeout;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout();if(isValidTimeout(this.gcTime))this.#gcTimeout=timeoutManager.setTimeout(()=>{this.optionalRemove()},this.gcTime)}updateGcTime(newGcTime){this.gcTime=Math.max(this.gcTime||0,newGcTime??(isServer?1/0:3e5))}clearGcTimeout(){if(this.#gcTimeout){timeoutManager.clearTimeout(this.#gcTimeout);this.#gcTimeout=void 0}}};var Query=class extends Removable{#initialState;#revertState;#cache;#client;#retryer;#defaultOptions;#abortSignalConsumed;constructor(config){super();this.#abortSignalConsumed=false;this.#defaultOptions=config.defaultOptions;this.setOptions(config.options);this.observers=[];this.#client=config.client;this.#cache=this.#client.getQueryCache();this.queryKey=config.queryKey;this.queryHash=config.queryHash;this.#initialState=getDefaultState(this.options);this.state=config.state??this.#initialState;this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#retryer?.promise}setOptions(options){this.options={...this.#defaultOptions,...options};this.updateGcTime(this.options.gcTime);if(this.state&&void 0===this.state.data){const defaultState=getDefaultState(this.options);if(void 0!==defaultState.data){this.setData(defaultState.data,{updatedAt:defaultState.dataUpdatedAt,manual:true});this.#initialState=defaultState}}}optionalRemove(){if(!this.observers.length&&"idle"===this.state.fetchStatus)this.#cache.remove(this)}setData(newData,options){const data=replaceData(this.state.data,newData,this.options);this.#dispatch({data,type:"success",dataUpdatedAt:options?.updatedAt,manual:options?.manual});return data}setState(state,setStateOptions){this.#dispatch({type:"setState",state,setStateOptions})}cancel(options){const promise=this.#retryer?.promise;this.#retryer?.cancel(options);return promise?promise.then(noop).catch(noop):Promise.resolve()}destroy(){super.destroy();this.cancel({silent:true})}reset(){this.destroy();this.setState(this.#initialState)}isActive(){return this.observers.some(observer=>false!==resolveEnabled(observer.options.enabled,this))}isDisabled(){if(this.getObserversCount()>0)return!this.isActive();return this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){if(this.getObserversCount()>0)return this.observers.some(observer=>"static"===resolveStaleTime(observer.options.staleTime,this));return false}isStale(){if(this.getObserversCount()>0)return this.observers.some(observer=>observer.getCurrentResult().isStale);return void 0===this.state.data||this.state.isInvalidated}isStaleByTime(staleTime=0){if(void 0===this.state.data)return true;if("static"===staleTime)return false;if(this.state.isInvalidated)return true;return!timeUntilStale(this.state.dataUpdatedAt,staleTime)}onFocus(){const observer=this.observers.find(x=>x.shouldFetchOnWindowFocus());observer?.refetch({cancelRefetch:false});this.#retryer?.continue()}onOnline(){const observer=this.observers.find(x=>x.shouldFetchOnReconnect());observer?.refetch({cancelRefetch:false});this.#retryer?.continue()}addObserver(observer){if(!this.observers.includes(observer)){this.observers.push(observer);this.clearGcTimeout();this.#cache.notify({type:"observerAdded",query:this,observer})}}removeObserver(observer){if(this.observers.includes(observer)){this.observers=this.observers.filter(x=>x!==observer);if(!this.observers.length){if(this.#retryer)if(this.#abortSignalConsumed)this.#retryer.cancel({revert:true});else this.#retryer.cancelRetry();this.scheduleGc()}this.#cache.notify({type:"observerRemoved",query:this,observer})}}getObserversCount(){return this.observers.length}invalidate(){if(!this.state.isInvalidated)this.#dispatch({type:"invalidate"})}async fetch(options,fetchOptions){if("idle"!==this.state.fetchStatus&&this.#retryer?.status()!=="rejected"){if(void 0!==this.state.data&&fetchOptions?.cancelRefetch)this.cancel({silent:true});else if(this.#retryer){this.#retryer.continueRetry();return this.#retryer.promise}}if(options)this.setOptions(options);if(!this.options.queryFn){const observer=this.observers.find(x=>x.options.queryFn);if(observer)this.setOptions(observer.options)}const abortController=new AbortController;const addSignalProperty=object=>{Object.defineProperty(object,"signal",{enumerable:true,get:()=>{this.#abortSignalConsumed=true;return abortController.signal}})};const fetchFn=()=>{const queryFn=ensureQueryFn(this.options,fetchOptions);const createQueryFnContext=()=>{const queryFnContext2={client:this.#client,queryKey:this.queryKey,meta:this.meta};addSignalProperty(queryFnContext2);return queryFnContext2};const queryFnContext=createQueryFnContext();this.#abortSignalConsumed=false;if(this.options.persister)return this.options.persister(queryFn,queryFnContext,this);return queryFn(queryFnContext)};const createFetchContext=()=>{const context2={fetchOptions,options:this.options,queryKey:this.queryKey,client:this.#client,state:this.state,fetchFn};addSignalProperty(context2);return context2};const context=createFetchContext();this.options.behavior?.onFetch(context,this);this.#revertState=this.state;if("idle"===this.state.fetchStatus||this.state.fetchMeta!==context.fetchOptions?.meta)this.#dispatch({type:"fetch",meta:context.fetchOptions?.meta});this.#retryer=createRetryer({initialPromise:fetchOptions?.initialPromise,fn:context.fetchFn,onCancel:error=>{if(error instanceof CancelledError&&error.revert)this.setState({...this.#revertState,fetchStatus:"idle"});abortController.abort()},onFail:(failureCount,error)=>{this.#dispatch({type:"failed",failureCount,error})},onPause:()=>{this.#dispatch({type:"pause"})},onContinue:()=>{this.#dispatch({type:"continue"})},retry:context.options.retry,retryDelay:context.options.retryDelay,networkMode:context.options.networkMode,canRun:()=>true});try{const data=await this.#retryer.start();if(void 0===data)throw new Error(`${this.queryHash} data is undefined`);this.setData(data);this.#cache.config.onSuccess?.(data,this);this.#cache.config.onSettled?.(data,this.state.error,this);return data}catch(error){if(error instanceof CancelledError){if(error.silent)return this.#retryer.promise;else if(error.revert){if(void 0===this.state.data)throw error;return this.state.data}}this.#dispatch({type:"error",error});this.#cache.config.onError?.(error,this);this.#cache.config.onSettled?.(this.state.data,error,this);throw error}finally{this.scheduleGc()}}#dispatch(action){const reducer=state=>{switch(action.type){case"failed":return{...state,fetchFailureCount:action.failureCount,fetchFailureReason:action.error};case"pause":return{...state,fetchStatus:"paused"};case"continue":return{...state,fetchStatus:"fetching"};case"fetch":return{...state,...fetchState(state.data,this.options),fetchMeta:action.meta??null};case"success":const newState={...state,data:action.data,dataUpdateCount:state.dataUpdateCount+1,dataUpdatedAt:action.dataUpdatedAt??Date.now(),error:null,isInvalidated:false,status:"success",...!action.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};this.#revertState=action.manual?newState:void 0;return newState;case"error":const error=action.error;return{...state,error,errorUpdateCount:state.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:state.fetchFailureCount+1,fetchFailureReason:error,fetchStatus:"idle",status:"error"};case"invalidate":return{...state,isInvalidated:true};case"setState":return{...state,...action.state}}};this.state=reducer(this.state);notifyManager.batch(()=>{this.observers.forEach(observer=>{observer.onQueryUpdate()});this.#cache.notify({query:this,type:"updated",action})})}};function fetchState(data,options){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(options.networkMode)?"fetching":"paused",...void 0===data&&{error:null,status:"pending"}}}function getDefaultState(options){const data="function"==typeof options.initialData?options.initialData():options.initialData;const hasData=void 0!==data;const initialDataUpdatedAt=hasData?"function"==typeof options.initialDataUpdatedAt?options.initialDataUpdatedAt():options.initialDataUpdatedAt:0;return{data,dataUpdateCount:0,dataUpdatedAt:hasData?initialDataUpdatedAt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:false,status:hasData?"success":"pending",fetchStatus:"idle"}}var QueryObserver=class extends Subscribable{constructor(client,options){super();this.options=options;this.#client=client;this.#selectError=null;this.#currentThenable=pendingThenable();this.bindMethods();this.setOptions(options)}#client;#currentQuery=void 0;#currentQueryInitialState=void 0;#currentResult=void 0;#currentResultState;#currentResultOptions;#currentThenable;#selectError;#selectFn;#selectResult;#lastQueryWithDefinedData;#staleTimeoutId;#refetchIntervalId;#currentRefetchInterval;#trackedProps=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){if(1===this.listeners.size){this.#currentQuery.addObserver(this);if(shouldFetchOnMount(this.#currentQuery,this.options))this.#executeFetch();else this.updateResult();this.#updateTimers()}}onUnsubscribe(){if(!this.hasListeners())this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(this.#currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(this.#currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set;this.#clearStaleTimeout();this.#clearRefetchInterval();this.#currentQuery.removeObserver(this)}setOptions(options){const prevOptions=this.options;const prevQuery=this.#currentQuery;this.options=this.#client.defaultQueryOptions(options);if(void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof resolveEnabled(this.options.enabled,this.#currentQuery))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#updateQuery();this.#currentQuery.setOptions(this.options);if(prevOptions._defaulted&&!shallowEqualObjects(this.options,prevOptions))this.#client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#currentQuery,observer:this});const mounted=this.hasListeners();if(mounted&&shouldFetchOptionally(this.#currentQuery,prevQuery,this.options,prevOptions))this.#executeFetch();this.updateResult();if(mounted&&(this.#currentQuery!==prevQuery||resolveEnabled(this.options.enabled,this.#currentQuery)!==resolveEnabled(prevOptions.enabled,this.#currentQuery)||resolveStaleTime(this.options.staleTime,this.#currentQuery)!==resolveStaleTime(prevOptions.staleTime,this.#currentQuery)))this.#updateStaleTimeout();const nextRefetchInterval=this.#computeRefetchInterval();if(mounted&&(this.#currentQuery!==prevQuery||resolveEnabled(this.options.enabled,this.#currentQuery)!==resolveEnabled(prevOptions.enabled,this.#currentQuery)||nextRefetchInterval!==this.#currentRefetchInterval))this.#updateRefetchInterval(nextRefetchInterval)}getOptimisticResult(options){const query=this.#client.getQueryCache().build(this.#client,options);const result=this.createResult(query,options);if(shouldAssignObserverCurrentProperties(this,result)){this.#currentResult=result;this.#currentResultOptions=this.options;this.#currentResultState=this.#currentQuery.state}return result}getCurrentResult(){return this.#currentResult}trackResult(result,onPropTracked){return new Proxy(result,{get:(target,key)=>{this.trackProp(key);onPropTracked?.(key);if("promise"===key){this.trackProp("data");if(!this.options.experimental_prefetchInRender&&"pending"===this.#currentThenable.status)this.#currentThenable.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))}return Reflect.get(target,key)}})}trackProp(key){this.#trackedProps.add(key)}getCurrentQuery(){return this.#currentQuery}refetch({...options}={}){return this.fetch({...options})}fetchOptimistic(options){const defaultedOptions=this.#client.defaultQueryOptions(options);const query=this.#client.getQueryCache().build(this.#client,defaultedOptions);return query.fetch().then(()=>this.createResult(query,defaultedOptions))}fetch(fetchOptions){return this.#executeFetch({...fetchOptions,cancelRefetch:fetchOptions.cancelRefetch??true}).then(()=>{this.updateResult();return this.#currentResult})}#executeFetch(fetchOptions){this.#updateQuery();let promise=this.#currentQuery.fetch(this.options,fetchOptions);if(!fetchOptions?.throwOnError)promise=promise.catch(noop);return promise}#updateStaleTimeout(){this.#clearStaleTimeout();const staleTime=resolveStaleTime(this.options.staleTime,this.#currentQuery);if(isServer||this.#currentResult.isStale||!isValidTimeout(staleTime))return;const time=timeUntilStale(this.#currentResult.dataUpdatedAt,staleTime);const timeout=time+1;this.#staleTimeoutId=timeoutManager.setTimeout(()=>{if(!this.#currentResult.isStale)this.updateResult()},timeout)}#computeRefetchInterval(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#currentQuery):this.options.refetchInterval)??false}#updateRefetchInterval(nextInterval){this.#clearRefetchInterval();this.#currentRefetchInterval=nextInterval;if(isServer||false===resolveEnabled(this.options.enabled,this.#currentQuery)||!isValidTimeout(this.#currentRefetchInterval)||0===this.#currentRefetchInterval)return;this.#refetchIntervalId=timeoutManager.setInterval(()=>{if(this.options.refetchIntervalInBackground||focusManager.isFocused())this.#executeFetch()},this.#currentRefetchInterval)}#updateTimers(){this.#updateStaleTimeout();this.#updateRefetchInterval(this.#computeRefetchInterval())}#clearStaleTimeout(){if(this.#staleTimeoutId){timeoutManager.clearTimeout(this.#staleTimeoutId);this.#staleTimeoutId=void 0}}#clearRefetchInterval(){if(this.#refetchIntervalId){timeoutManager.clearInterval(this.#refetchIntervalId);this.#refetchIntervalId=void 0}}createResult(query,options){const prevQuery=this.#currentQuery;const prevOptions=this.options;const prevResult=this.#currentResult;const prevResultState=this.#currentResultState;const prevResultOptions=this.#currentResultOptions;const queryChange=query!==prevQuery;const queryInitialState=queryChange?query.state:this.#currentQueryInitialState;const{state}=query;let newState={...state};let isPlaceholderData=false;let data;if(options._optimisticResults){const mounted=this.hasListeners();const fetchOnMount=!mounted&&shouldFetchOnMount(query,options);const fetchOptionally=mounted&&shouldFetchOptionally(query,prevQuery,options,prevOptions);if(fetchOnMount||fetchOptionally)newState={...newState,...fetchState(state.data,query.options)};if("isRestoring"===options._optimisticResults)newState.fetchStatus="idle"}let{error,errorUpdatedAt,status}=newState;data=newState.data;let skipSelect=false;if(void 0!==options.placeholderData&&void 0===data&&"pending"===status){let placeholderData;if(prevResult?.isPlaceholderData&&options.placeholderData===prevResultOptions?.placeholderData){placeholderData=prevResult.data;skipSelect=true}else placeholderData="function"==typeof options.placeholderData?options.placeholderData(this.#lastQueryWithDefinedData?.state.data,this.#lastQueryWithDefinedData):options.placeholderData;if(void 0!==placeholderData){status="success";data=replaceData(prevResult?.data,placeholderData,options);isPlaceholderData=true}}if(options.select&&void 0!==data&&!skipSelect)if(prevResult&&data===prevResultState?.data&&options.select===this.#selectFn)data=this.#selectResult;else try{this.#selectFn=options.select;data=options.select(data);data=replaceData(prevResult?.data,data,options);this.#selectResult=data;this.#selectError=null}catch(selectError){this.#selectError=selectError}if(this.#selectError){error=this.#selectError;data=this.#selectResult;errorUpdatedAt=Date.now();status="error"}const isFetching="fetching"===newState.fetchStatus;const isPending="pending"===status;const isError="error"===status;const isLoading=isPending&&isFetching;const hasData=void 0!==data;const result={status,fetchStatus:newState.fetchStatus,isPending,isSuccess:"success"===status,isError,isInitialLoading:isLoading,isLoading,data,dataUpdatedAt:newState.dataUpdatedAt,error,errorUpdatedAt,failureCount:newState.fetchFailureCount,failureReason:newState.fetchFailureReason,errorUpdateCount:newState.errorUpdateCount,isFetched:newState.dataUpdateCount>0||newState.errorUpdateCount>0,isFetchedAfterMount:newState.dataUpdateCount>queryInitialState.dataUpdateCount||newState.errorUpdateCount>queryInitialState.errorUpdateCount,isFetching,isRefetching:isFetching&&!isPending,isLoadingError:isError&&!hasData,isPaused:"paused"===newState.fetchStatus,isPlaceholderData,isRefetchError:isError&&hasData,isStale:isStale(query,options),refetch:this.refetch,promise:this.#currentThenable,isEnabled:false!==resolveEnabled(options.enabled,query)};const nextResult=result;if(this.options.experimental_prefetchInRender){const finalizeThenableIfPossible=thenable=>{if("error"===nextResult.status)thenable.reject(nextResult.error);else if(void 0!==nextResult.data)thenable.resolve(nextResult.data)};const recreateThenable=()=>{const pending=this.#currentThenable=nextResult.promise=pendingThenable();finalizeThenableIfPossible(pending)};const prevThenable=this.#currentThenable;switch(prevThenable.status){case"pending":if(query.queryHash===prevQuery.queryHash)finalizeThenableIfPossible(prevThenable);break;case"fulfilled":if("error"===nextResult.status||nextResult.data!==prevThenable.value)recreateThenable();break;case"rejected":if("error"!==nextResult.status||nextResult.error!==prevThenable.reason)recreateThenable();break}}return nextResult}updateResult(){const prevResult=this.#currentResult;const nextResult=this.createResult(this.#currentQuery,this.options);this.#currentResultState=this.#currentQuery.state;this.#currentResultOptions=this.options;if(void 0!==this.#currentResultState.data)this.#lastQueryWithDefinedData=this.#currentQuery;if(shallowEqualObjects(nextResult,prevResult))return;this.#currentResult=nextResult;const shouldNotifyListeners=()=>{if(!prevResult)return true;const{notifyOnChangeProps}=this.options;const notifyOnChangePropsValue="function"==typeof notifyOnChangeProps?notifyOnChangeProps():notifyOnChangeProps;if("all"===notifyOnChangePropsValue||!notifyOnChangePropsValue&&!this.#trackedProps.size)return true;const includedProps=new Set(notifyOnChangePropsValue??this.#trackedProps);if(this.options.throwOnError)includedProps.add("error");return Object.keys(this.#currentResult).some(key=>{const typedKey=key;const changed=this.#currentResult[typedKey]!==prevResult[typedKey];return changed&&includedProps.has(typedKey)})};this.#notify({listeners:shouldNotifyListeners()})}#updateQuery(){const query=this.#client.getQueryCache().build(this.#client,this.options);if(query===this.#currentQuery)return;const prevQuery=this.#currentQuery;this.#currentQuery=query;this.#currentQueryInitialState=query.state;if(this.hasListeners()){prevQuery?.removeObserver(this);query.addObserver(this)}}onQueryUpdate(){this.updateResult();if(this.hasListeners())this.#updateTimers()}#notify(notifyOptions){notifyManager.batch(()=>{if(notifyOptions.listeners)this.listeners.forEach(listener=>{listener(this.#currentResult)});this.#client.getQueryCache().notify({query:this.#currentQuery,type:"observerResultsUpdated"})})}};function shouldLoadOnMount(query,options){return false!==resolveEnabled(options.enabled,query)&&void 0===query.state.data&&!("error"===query.state.status&&false===options.retryOnMount)}function shouldFetchOnMount(query,options){return shouldLoadOnMount(query,options)||void 0!==query.state.data&&shouldFetchOn(query,options,options.refetchOnMount)}function shouldFetchOn(query,options,field){if(false!==resolveEnabled(options.enabled,query)&&"static"!==resolveStaleTime(options.staleTime,query)){const value="function"==typeof field?field(query):field;return"always"===value||false!==value&&isStale(query,options)}return false}function shouldFetchOptionally(query,prevQuery,options,prevOptions){return(query!==prevQuery||false===resolveEnabled(prevOptions.enabled,query))&&(!options.suspense||"error"!==query.state.status)&&isStale(query,options)}function isStale(query,options){return false!==resolveEnabled(options.enabled,query)&&query.isStaleByTime(resolveStaleTime(options.staleTime,query))}function shouldAssignObserverCurrentProperties(observer,optimisticResult){if(!shallowEqualObjects(observer.getCurrentResult(),optimisticResult))return true;return false}function infiniteQueryBehavior(pages){return{onFetch:(context,query)=>{const options=context.options;const direction=context.fetchOptions?.meta?.fetchMore?.direction;const oldPages=context.state.data?.pages||[];const oldPageParams=context.state.data?.pageParams||[];let result={pages:[],pageParams:[]};let currentPage=0;const fetchFn=async()=>{let cancelled=false;const addSignalProperty=object=>{Object.defineProperty(object,"signal",{enumerable:true,get:()=>{if(context.signal.aborted)cancelled=true;else context.signal.addEventListener("abort",()=>{cancelled=true});return context.signal}})};const queryFn=ensureQueryFn(context.options,context.fetchOptions);const fetchPage=async(data,param,previous)=>{if(cancelled)return Promise.reject();if(null==param&&data.pages.length)return Promise.resolve(data);const createQueryFnContext=()=>{const queryFnContext2={client:context.client,queryKey:context.queryKey,pageParam:param,direction:previous?"backward":"forward",meta:context.options.meta};addSignalProperty(queryFnContext2);return queryFnContext2};const queryFnContext=createQueryFnContext();const page=await queryFn(queryFnContext);const{maxPages}=context.options;const addTo=previous?addToStart:addToEnd;return{pages:addTo(data.pages,page,maxPages),pageParams:addTo(data.pageParams,param,maxPages)}};if(direction&&oldPages.length){const previous="backward"===direction;const pageParamFn=previous?getPreviousPageParam:getNextPageParam;const oldData={pages:oldPages,pageParams:oldPageParams};const param=pageParamFn(options,oldData);result=await fetchPage(oldData,param,previous)}else{const remainingPages=pages??oldPages.length;do{const param=0===currentPage?oldPageParams[0]??options.initialPageParam:getNextPageParam(options,result);if(currentPage>0&&null==param)break;result=await fetchPage(result,param);currentPage++}while(currentPage<remainingPages)}return result};if(context.options.persister)context.fetchFn=()=>context.options.persister?.(fetchFn,{client:context.client,queryKey:context.queryKey,meta:context.options.meta,signal:context.signal},query);else context.fetchFn=fetchFn}}}function getNextPageParam(options,{pages,pageParams}){const lastIndex=pages.length-1;return pages.length>0?options.getNextPageParam(pages[lastIndex],pages,pageParams[lastIndex],pageParams):void 0}function getPreviousPageParam(options,{pages,pageParams}){return pages.length>0?options.getPreviousPageParam?.(pages[0],pages,pageParams[0],pageParams):void 0}function hasNextPage(options,data){if(!data)return false;return null!=getNextPageParam(options,data)}function hasPreviousPage(options,data){if(!data||!options.getPreviousPageParam)return false;return null!=getPreviousPageParam(options,data)}var InfiniteQueryObserver=class extends QueryObserver{constructor(client,options){super(client,options)}bindMethods(){super.bindMethods();this.fetchNextPage=this.fetchNextPage.bind(this);this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(options){super.setOptions({...options,behavior:infiniteQueryBehavior()})}getOptimisticResult(options){options.behavior=infiniteQueryBehavior();return super.getOptimisticResult(options)}fetchNextPage(options){return this.fetch({...options,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(options){return this.fetch({...options,meta:{fetchMore:{direction:"backward"}}})}createResult(query,options){const{state}=query;const parentResult=super.createResult(query,options);const{isFetching,isRefetching,isError,isRefetchError}=parentResult;const fetchDirection=state.fetchMeta?.fetchMore?.direction;const isFetchNextPageError=isError&&"forward"===fetchDirection;const isFetchingNextPage=isFetching&&"forward"===fetchDirection;const isFetchPreviousPageError=isError&&"backward"===fetchDirection;const isFetchingPreviousPage=isFetching&&"backward"===fetchDirection;const result={...parentResult,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hasNextPage(options,state.data),hasPreviousPage:hasPreviousPage(options,state.data),isFetchNextPageError,isFetchingNextPage,isFetchPreviousPageError,isFetchingPreviousPage,isRefetchError:isRefetchError&&!isFetchNextPageError&&!isFetchPreviousPageError,isRefetching:isRefetching&&!isFetchingNextPage&&!isFetchingPreviousPage};return result}};var Mutation=class extends Removable{#client;#observers;#mutationCache;#retryer;constructor(config){super();this.#client=config.client;this.mutationId=config.mutationId;this.#mutationCache=config.mutationCache;this.#observers=[];this.state=config.state||mutation_getDefaultState();this.setOptions(config.options);this.scheduleGc()}setOptions(options){this.options=options;this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(observer){if(!this.#observers.includes(observer)){this.#observers.push(observer);this.clearGcTimeout();this.#mutationCache.notify({type:"observerAdded",mutation:this,observer})}}removeObserver(observer){this.#observers=this.#observers.filter(x=>x!==observer);this.scheduleGc();this.#mutationCache.notify({type:"observerRemoved",mutation:this,observer})}optionalRemove(){if(!this.#observers.length)if("pending"===this.state.status)this.scheduleGc();else this.#mutationCache.remove(this)}continue(){return this.#retryer?.continue()??this.execute(this.state.variables)}async execute(variables){const onContinue=()=>{this.#dispatch({type:"continue"})};const mutationFnContext={client:this.#client,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#retryer=createRetryer({fn:()=>{if(!this.options.mutationFn)return Promise.reject(new Error("No mutationFn found"));return this.options.mutationFn(variables,mutationFnContext)},onFail:(failureCount,error)=>{this.#dispatch({type:"failed",failureCount,error})},onPause:()=>{this.#dispatch({type:"pause"})},onContinue,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#mutationCache.canRun(this)});const restored="pending"===this.state.status;const isPaused=!this.#retryer.canStart();try{if(restored)onContinue();else{this.#dispatch({type:"pending",variables,isPaused});await this.#mutationCache.config.onMutate?.(variables,this,mutationFnContext);const context=await this.options.onMutate?.(variables,mutationFnContext);if(context!==this.state.context)this.#dispatch({type:"pending",context,variables,isPaused})}const data=await this.#retryer.start();await this.#mutationCache.config.onSuccess?.(data,variables,this.state.context,this,mutationFnContext);await this.options.onSuccess?.(data,variables,this.state.context,mutationFnContext);await this.#mutationCache.config.onSettled?.(data,null,this.state.variables,this.state.context,this,mutationFnContext);await this.options.onSettled?.(data,null,variables,this.state.context,mutationFnContext);this.#dispatch({type:"success",data});return data}catch(error){try{await this.#mutationCache.config.onError?.(error,variables,this.state.context,this,mutationFnContext);await this.options.onError?.(error,variables,this.state.context,mutationFnContext);await this.#mutationCache.config.onSettled?.(void 0,error,this.state.variables,this.state.context,this,mutationFnContext);await this.options.onSettled?.(void 0,error,variables,this.state.context,mutationFnContext);throw error}finally{this.#dispatch({type:"error",error})}}finally{this.#mutationCache.runNext(this)}}#dispatch(action){const reducer=state=>{switch(action.type){case"failed":return{...state,failureCount:action.failureCount,failureReason:action.error};case"pause":return{...state,isPaused:true};case"continue":return{...state,isPaused:false};case"pending":return{...state,context:action.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:action.isPaused,status:"pending",variables:action.variables,submittedAt:Date.now()};case"success":return{...state,data:action.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:false};case"error":return{...state,data:void 0,error:action.error,failureCount:state.failureCount+1,failureReason:action.error,isPaused:false,status:"error"}}};this.state=reducer(this.state);notifyManager.batch(()=>{this.#observers.forEach(observer=>{observer.onMutationUpdate(action)});this.#mutationCache.notify({mutation:this,type:"updated",action})})}};function mutation_getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:false,status:"idle",variables:void 0,submittedAt:0}}var MutationCache=class extends Subscribable{constructor(config={}){super();this.config=config;this.#mutations=/* @__PURE__ */new Set;this.#scopes=/* @__PURE__ */new Map;this.#mutationId=0}#mutations;#scopes;#mutationId;build(client,options,state){const mutation=new Mutation({client,mutationCache:this,mutationId:++this.#mutationId,options:client.defaultMutationOptions(options),state});this.add(mutation);return mutation}add(mutation){this.#mutations.add(mutation);const scope=scopeFor(mutation);if("string"==typeof scope){const scopedMutations=this.#scopes.get(scope);if(scopedMutations)scopedMutations.push(mutation);else this.#scopes.set(scope,[mutation])}this.notify({type:"added",mutation})}remove(mutation){if(this.#mutations.delete(mutation)){const scope=scopeFor(mutation);if("string"==typeof scope){const scopedMutations=this.#scopes.get(scope);if(scopedMutations){if(scopedMutations.length>1){const index=scopedMutations.indexOf(mutation);if(-1!==index)scopedMutations.splice(index,1)}else if(scopedMutations[0]===mutation)this.#scopes.delete(scope)}}}this.notify({type:"removed",mutation})}canRun(mutation){const scope=scopeFor(mutation);if("string"!=typeof scope)return true;{const mutationsWithSameScope=this.#scopes.get(scope);const firstPendingMutation=mutationsWithSameScope?.find(m=>"pending"===m.state.status);return!firstPendingMutation||firstPendingMutation===mutation}}runNext(mutation){const scope=scopeFor(mutation);if("string"!=typeof scope)return Promise.resolve();{const foundMutation=this.#scopes.get(scope)?.find(m=>m!==mutation&&m.state.isPaused);return foundMutation?.continue()??Promise.resolve()}}clear(){notifyManager.batch(()=>{this.#mutations.forEach(mutation=>{this.notify({type:"removed",mutation})});this.#mutations.clear();this.#scopes.clear()})}getAll(){return Array.from(this.#mutations)}find(filters){const defaultedFilters={exact:true,...filters};return this.getAll().find(mutation=>matchMutation(defaultedFilters,mutation))}findAll(filters={}){return this.getAll().filter(mutation=>matchMutation(filters,mutation))}notify(event){notifyManager.batch(()=>{this.listeners.forEach(listener=>{listener(event)})})}resumePausedMutations(){const pausedMutations=this.getAll().filter(x=>x.state.isPaused);return notifyManager.batch(()=>Promise.all(pausedMutations.map(mutation=>mutation.continue().catch(noop))))}};function scopeFor(mutation){return mutation.options.scope?.id}var MutationObserver=class extends Subscribable{#client;#currentResult=void 0;#currentMutation;#mutateOptions;constructor(client,options){super();this.#client=client;this.setOptions(options);this.bindMethods();this.#updateResult()}bindMethods(){this.mutate=this.mutate.bind(this);this.reset=this.reset.bind(this)}setOptions(options){const prevOptions=this.options;this.options=this.#client.defaultMutationOptions(options);if(!shallowEqualObjects(this.options,prevOptions))this.#client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#currentMutation,observer:this});if(prevOptions?.mutationKey&&this.options.mutationKey&&hashKey(prevOptions.mutationKey)!==hashKey(this.options.mutationKey))this.reset();else if(this.#currentMutation?.state.status==="pending")this.#currentMutation.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners())this.#currentMutation?.removeObserver(this)}onMutationUpdate(action){this.#updateResult();this.#notify(action)}getCurrentResult(){return this.#currentResult}reset(){this.#currentMutation?.removeObserver(this);this.#currentMutation=void 0;this.#updateResult();this.#notify()}mutate(variables,options){this.#mutateOptions=options;this.#currentMutation?.removeObserver(this);this.#currentMutation=this.#client.getMutationCache().build(this.#client,this.options);this.#currentMutation.addObserver(this);return this.#currentMutation.execute(variables)}#updateResult(){const state=this.#currentMutation?.state??mutation_getDefaultState();this.#currentResult={...state,isPending:"pending"===state.status,isSuccess:"success"===state.status,isError:"error"===state.status,isIdle:"idle"===state.status,mutate:this.mutate,reset:this.reset}}#notify(action){notifyManager.batch(()=>{if(this.#mutateOptions&&this.hasListeners()){const variables=this.#currentResult.variables;const onMutateResult=this.#currentResult.context;const context={client:this.#client,meta:this.options.meta,mutationKey:this.options.mutationKey};if(action?.type==="success"){this.#mutateOptions.onSuccess?.(action.data,variables,onMutateResult,context);this.#mutateOptions.onSettled?.(action.data,null,variables,onMutateResult,context)}else if(action?.type==="error"){this.#mutateOptions.onError?.(action.error,variables,onMutateResult,context);this.#mutateOptions.onSettled?.(void 0,action.error,variables,onMutateResult,context)}}this.listeners.forEach(listener=>{listener(this.#currentResult)})})}};function difference(array1,array2){const excludeSet=new Set(array2);return array1.filter(x=>!excludeSet.has(x))}function replaceAt(array,index,value){const copy=array.slice(0);copy[index]=value;return copy}var QueriesObserver=class extends Subscribable{#client;#result;#queries;#options;#observers;#combinedResult;#lastCombine;#lastResult;#observerMatches=[];constructor(client,queries,options){super();this.#client=client;this.#options=options;this.#queries=[];this.#observers=[];this.#result=[];this.setQueries(queries)}onSubscribe(){if(1===this.listeners.size)this.#observers.forEach(observer=>{observer.subscribe(result=>{this.#onUpdate(observer,result)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=/* @__PURE__ */new Set;this.#observers.forEach(observer=>{observer.destroy()})}setQueries(queries,options){this.#queries=queries;this.#options=options;notifyManager.batch(()=>{const prevObservers=this.#observers;const newObserverMatches=this.#findMatchingObservers(this.#queries);this.#observerMatches=newObserverMatches;newObserverMatches.forEach(match=>match.observer.setOptions(match.defaultedQueryOptions));const newObservers=newObserverMatches.map(match=>match.observer);const newResult=newObservers.map(observer=>observer.getCurrentResult());const hasLengthChange=prevObservers.length!==newObservers.length;const hasIndexChange=newObservers.some((observer,index)=>observer!==prevObservers[index]);const hasStructuralChange=hasLengthChange||hasIndexChange;const hasResultChange=hasStructuralChange?true:newResult.some((result,index)=>{const prev=this.#result[index];return!prev||!shallowEqualObjects(result,prev)});if(!hasStructuralChange&&!hasResultChange)return;if(hasStructuralChange)this.#observers=newObservers;this.#result=newResult;if(!this.hasListeners())return;if(hasStructuralChange){difference(prevObservers,newObservers).forEach(observer=>{observer.destroy()});difference(newObservers,prevObservers).forEach(observer=>{observer.subscribe(result=>{this.#onUpdate(observer,result)})})}this.#notify()})}getCurrentResult(){return this.#result}getQueries(){return this.#observers.map(observer=>observer.getCurrentQuery())}getObservers(){return this.#observers}getOptimisticResult(queries,combine){const matches=this.#findMatchingObservers(queries);const result=matches.map(match=>match.observer.getOptimisticResult(match.defaultedQueryOptions));return[result,r=>this.#combineResult(r??result,combine),()=>this.#trackResult(result,matches)]}#trackResult(result,matches){return matches.map((match,index)=>{const observerResult=result[index];return match.defaultedQueryOptions.notifyOnChangeProps?observerResult:match.observer.trackResult(observerResult,accessedProp=>{matches.forEach(m=>{m.observer.trackProp(accessedProp)})})})}#combineResult(input,combine){if(combine){if(!this.#combinedResult||this.#result!==this.#lastResult||combine!==this.#lastCombine){this.#lastCombine=combine;this.#lastResult=this.#result;this.#combinedResult=replaceEqualDeep(this.#combinedResult,combine(input))}return this.#combinedResult}return input}#findMatchingObservers(queries){const prevObserversMap=new Map(this.#observers.map(observer=>[observer.options.queryHash,observer]));const observers=[];queries.forEach(options=>{const defaultedOptions=this.#client.defaultQueryOptions(options);const match=prevObserversMap.get(defaultedOptions.queryHash);if(match)observers.push({defaultedQueryOptions:defaultedOptions,observer:match});else observers.push({defaultedQueryOptions:defaultedOptions,observer:new QueryObserver(this.#client,defaultedOptions)})});return observers}#onUpdate(observer,result){const index=this.#observers.indexOf(observer);if(-1!==index){this.#result=replaceAt(this.#result,index,result);this.#notify()}}#notify(){if(this.hasListeners()){const previousResult=this.#combinedResult;const newTracked=this.#trackResult(this.#result,this.#observerMatches);const newResult=this.#combineResult(newTracked,this.#options?.combine);if(previousResult!==newResult)notifyManager.batch(()=>{this.listeners.forEach(listener=>{listener(this.#result)})})}}};var QueryCache=class extends Subscribable{constructor(config={}){super();this.config=config;this.#queries=/* @__PURE__ */new Map}#queries;build(client,options,state){const queryKey=options.queryKey;const queryHash=options.queryHash??hashQueryKeyByOptions(queryKey,options);let query=this.get(queryHash);if(!query){query=new Query({client,queryKey,queryHash,options:client.defaultQueryOptions(options),state,defaultOptions:client.getQueryDefaults(queryKey)});this.add(query)}return query}add(query){if(!this.#queries.has(query.queryHash)){this.#queries.set(query.queryHash,query);this.notify({type:"added",query})}}remove(query){const queryInMap=this.#queries.get(query.queryHash);if(queryInMap){query.destroy();if(queryInMap===query)this.#queries.delete(query.queryHash);this.notify({type:"removed",query})}}clear(){notifyManager.batch(()=>{this.getAll().forEach(query=>{this.remove(query)})})}get(queryHash){return this.#queries.get(queryHash)}getAll(){return[...this.#queries.values()]}find(filters){const defaultedFilters={exact:true,...filters};return this.getAll().find(query=>matchQuery(defaultedFilters,query))}findAll(filters={}){const queries=this.getAll();return Object.keys(filters).length>0?queries.filter(query=>matchQuery(filters,query)):queries}notify(event){notifyManager.batch(()=>{this.listeners.forEach(listener=>{listener(event)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(query=>{query.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(query=>{query.onOnline()})})}};var QueryClient=class{#queryCache;#mutationCache;#defaultOptions;#queryDefaults;#mutationDefaults;#mountCount;#unsubscribeFocus;#unsubscribeOnline;constructor(config={}){this.#queryCache=config.queryCache||new QueryCache;this.#mutationCache=config.mutationCache||new MutationCache;this.#defaultOptions=config.defaultOptions||{};this.#queryDefaults=/* @__PURE__ */new Map;this.#mutationDefaults=/* @__PURE__ */new Map;this.#mountCount=0}mount(){this.#mountCount++;if(1!==this.#mountCount)return;this.#unsubscribeFocus=focusManager.subscribe(async focused=>{if(focused){await this.resumePausedMutations();this.#queryCache.onFocus()}});this.#unsubscribeOnline=onlineManager.subscribe(async online=>{if(online){await this.resumePausedMutations();this.#queryCache.onOnline()}})}unmount(){this.#mountCount--;if(0!==this.#mountCount)return;this.#unsubscribeFocus?.();this.#unsubscribeFocus=void 0;this.#unsubscribeOnline?.();this.#unsubscribeOnline=void 0}isFetching(filters){return this.#queryCache.findAll({...filters,fetchStatus:"fetching"}).length}isMutating(filters){return this.#mutationCache.findAll({...filters,status:"pending"}).length}getQueryData(queryKey){const options=this.defaultQueryOptions({queryKey});return this.#queryCache.get(options.queryHash)?.state.data}ensureQueryData(options){const defaultedOptions=this.defaultQueryOptions(options);const query=this.#queryCache.build(this,defaultedOptions);const cachedData=query.state.data;if(void 0===cachedData)return this.fetchQuery(options);if(options.revalidateIfStale&&query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime,query)))this.prefetchQuery(defaultedOptions);return Promise.resolve(cachedData)}getQueriesData(filters){return this.#queryCache.findAll(filters).map(({queryKey,state})=>{const data=state.data;return[queryKey,data]})}setQueryData(queryKey,updater,options){const defaultedOptions=this.defaultQueryOptions({queryKey});const query=this.#queryCache.get(defaultedOptions.queryHash);const prevData=query?.state.data;const data=functionalUpdate(updater,prevData);if(void 0===data)return;return this.#queryCache.build(this,defaultedOptions).setData(data,{...options,manual:true})}setQueriesData(filters,updater,options){return notifyManager.batch(()=>this.#queryCache.findAll(filters).map(({queryKey})=>[queryKey,this.setQueryData(queryKey,updater,options)]))}getQueryState(queryKey){const options=this.defaultQueryOptions({queryKey});return this.#queryCache.get(options.queryHash)?.state}removeQueries(filters){const queryCache=this.#queryCache;notifyManager.batch(()=>{queryCache.findAll(filters).forEach(query=>{queryCache.remove(query)})})}resetQueries(filters,options){const queryCache=this.#queryCache;return notifyManager.batch(()=>{queryCache.findAll(filters).forEach(query=>{query.reset()});return this.refetchQueries({type:"active",...filters},options)})}cancelQueries(filters,cancelOptions={}){const defaultedCancelOptions={revert:true,...cancelOptions};const promises=notifyManager.batch(()=>this.#queryCache.findAll(filters).map(query=>query.cancel(defaultedCancelOptions)));return Promise.all(promises).then(noop).catch(noop)}invalidateQueries(filters,options={}){return notifyManager.batch(()=>{this.#queryCache.findAll(filters).forEach(query=>{query.invalidate()});if(filters?.refetchType==="none")return Promise.resolve();return this.refetchQueries({...filters,type:filters?.refetchType??filters?.type??"active"},options)})}refetchQueries(filters,options={}){const fetchOptions={...options,cancelRefetch:options.cancelRefetch??true};const promises=notifyManager.batch(()=>this.#queryCache.findAll(filters).filter(query=>!query.isDisabled()&&!query.isStatic()).map(query=>{let promise=query.fetch(void 0,fetchOptions);if(!fetchOptions.throwOnError)promise=promise.catch(noop);return"paused"===query.state.fetchStatus?Promise.resolve():promise}));return Promise.all(promises).then(noop)}fetchQuery(options){const defaultedOptions=this.defaultQueryOptions(options);if(void 0===defaultedOptions.retry)defaultedOptions.retry=false;const query=this.#queryCache.build(this,defaultedOptions);return query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime,query))?query.fetch(defaultedOptions):Promise.resolve(query.state.data)}prefetchQuery(options){return this.fetchQuery(options).then(noop).catch(noop)}fetchInfiniteQuery(options){options.behavior=infiniteQueryBehavior(options.pages);return this.fetchQuery(options)}prefetchInfiniteQuery(options){return this.fetchInfiniteQuery(options).then(noop).catch(noop)}ensureInfiniteQueryData(options){options.behavior=infiniteQueryBehavior(options.pages);return this.ensureQueryData(options)}resumePausedMutations(){if(onlineManager.isOnline())return this.#mutationCache.resumePausedMutations();return Promise.resolve()}getQueryCache(){return this.#queryCache}getMutationCache(){return this.#mutationCache}getDefaultOptions(){return this.#defaultOptions}setDefaultOptions(options){this.#defaultOptions=options}setQueryDefaults(queryKey,options){this.#queryDefaults.set(hashKey(queryKey),{queryKey,defaultOptions:options})}getQueryDefaults(queryKey){const defaults=[...this.#queryDefaults.values()];const result={};defaults.forEach(queryDefault=>{if(partialMatchKey(queryKey,queryDefault.queryKey))Object.assign(result,queryDefault.defaultOptions)});return result}setMutationDefaults(mutationKey,options){this.#mutationDefaults.set(hashKey(mutationKey),{mutationKey,defaultOptions:options})}getMutationDefaults(mutationKey){const defaults=[...this.#mutationDefaults.values()];const result={};defaults.forEach(queryDefault=>{if(partialMatchKey(mutationKey,queryDefault.mutationKey))Object.assign(result,queryDefault.defaultOptions)});return result}defaultQueryOptions(options){if(options._defaulted)return options;const defaultedOptions={...this.#defaultOptions.queries,...this.getQueryDefaults(options.queryKey),...options,_defaulted:true};if(!defaultedOptions.queryHash)defaultedOptions.queryHash=hashQueryKeyByOptions(defaultedOptions.queryKey,defaultedOptions);if(void 0===defaultedOptions.refetchOnReconnect)defaultedOptions.refetchOnReconnect="always"!==defaultedOptions.networkMode;if(void 0===defaultedOptions.throwOnError)defaultedOptions.throwOnError=!!defaultedOptions.suspense;if(!defaultedOptions.networkMode&&defaultedOptions.persister)defaultedOptions.networkMode="offlineFirst";if(defaultedOptions.queryFn===skipToken)defaultedOptions.enabled=false;return defaultedOptions}defaultMutationOptions(options){if(options?._defaulted)return options;return{...this.#defaultOptions.mutations,...options?.mutationKey&&this.getMutationDefaults(options.mutationKey),...options,_defaulted:true}}clear(){this.#queryCache.clear();this.#mutationCache.clear()}};function streamedQuery({streamFn,refetchMode="reset",reducer=(items,chunk)=>addToEnd(items,chunk),initialValue=[]}){return async context=>{const query=context.client.getQueryCache().find({queryKey:context.queryKey,exact:true});const isRefetch=!!query&&void 0!==query.state.data;if(isRefetch&&"reset"===refetchMode)query.setState({status:"pending",data:void 0,error:null,fetchStatus:"fetching"});let result=initialValue;const stream=await streamFn(context);for await(const chunk of stream){if(context.signal.aborted)break;if(!isRefetch||"replace"!==refetchMode)context.client.setQueryData(context.queryKey,prev=>reducer(void 0===prev?initialValue:prev,chunk));result=reducer(result,chunk)}if(isRefetch&&"replace"===refetchMode&&!context.signal.aborted)context.client.setQueryData(context.queryKey,result);return context.client.getQueryData(context.queryKey)}}var dataTagSymbol=Symbol("dataTagSymbol");var dataTagErrorSymbol=Symbol("dataTagErrorSymbol");var unsetMarker=Symbol("unsetMarker");var index_js_=__webpack_require__(3620);var jsx_runtime=__webpack_require__(4848);"use client";var QueryClientContext=index_js_.createContext(void 0);var useQueryClient=queryClient=>{const client=index_js_.useContext(QueryClientContext);if(queryClient)return queryClient;if(!client)throw new Error("No QueryClient set, use QueryClientProvider to set one");return client};var QueryClientProvider=({client,children})=>{index_js_.useEffect(()=>{client.mount();return()=>{client.unmount()}},[client]);return/* @__PURE__ */(0,jsx_runtime.jsx)(QueryClientContext.Provider,{value:client,children})};"use client";var IsRestoringContext=index_js_.createContext(false);var useIsRestoring=()=>index_js_.useContext(IsRestoringContext);var IsRestoringProvider=IsRestoringContext.Provider;"use client";function createValue(){let isReset=false;return{clearReset:()=>{isReset=false},reset:()=>{isReset=true},isReset:()=>isReset}}var QueryErrorResetBoundaryContext=index_js_.createContext(createValue());var useQueryErrorResetBoundary=()=>index_js_.useContext(QueryErrorResetBoundaryContext);var QueryErrorResetBoundary=({children})=>{const[value]=index_js_.useState(()=>createValue());return/* @__PURE__ */(0,jsx_runtime.jsx)(QueryErrorResetBoundaryContext.Provider,{value,children:"function"==typeof children?children(value):children})};"use client";var ensurePreventErrorBoundaryRetry=(options,errorResetBoundary)=>{if(options.suspense||options.throwOnError||options.experimental_prefetchInRender){if(!errorResetBoundary.isReset())options.retryOnMount=false}};var useClearResetErrorBoundary=errorResetBoundary=>{index_js_.useEffect(()=>{errorResetBoundary.clearReset()},[errorResetBoundary])};var getHasError=({result,errorResetBoundary,throwOnError,query,suspense})=>result.isError&&!errorResetBoundary.isReset()&&!result.isFetching&&query&&(suspense&&void 0===result.data||shouldThrowError(throwOnError,[result.error,query]));var defaultThrowOnError=(_error,query)=>void 0===query.state.data;var ensureSuspenseTimers=defaultedOptions=>{if(defaultedOptions.suspense){const MIN_SUSPENSE_TIME_MS=1e3;const clamp=value=>"static"===value?value:Math.max(value??MIN_SUSPENSE_TIME_MS,MIN_SUSPENSE_TIME_MS);const originalStaleTime=defaultedOptions.staleTime;defaultedOptions.staleTime="function"==typeof originalStaleTime?(...args)=>clamp(originalStaleTime(...args)):clamp(originalStaleTime);if("number"==typeof defaultedOptions.gcTime)defaultedOptions.gcTime=Math.max(defaultedOptions.gcTime,MIN_SUSPENSE_TIME_MS)}};var willFetch=(result,isRestoring)=>result.isLoading&&result.isFetching&&!isRestoring;var shouldSuspend=(defaultedOptions,result)=>defaultedOptions?.suspense&&result.isPending;var fetchOptimistic=(defaultedOptions,observer,errorResetBoundary)=>observer.fetchOptimistic(defaultedOptions).catch(()=>{errorResetBoundary.clearReset()});"use client";function useQueries({queries,...options},queryClient){const client=useQueryClient(queryClient);const isRestoring=useIsRestoring();const errorResetBoundary=useQueryErrorResetBoundary();const defaultedQueries=index_js_.useMemo(()=>queries.map(opts=>{const defaultedOptions=client.defaultQueryOptions(opts);defaultedOptions._optimisticResults=isRestoring?"isRestoring":"optimistic";return defaultedOptions}),[queries,client,isRestoring]);defaultedQueries.forEach(query=>{ensureSuspenseTimers(query);ensurePreventErrorBoundaryRetry(query,errorResetBoundary)});useClearResetErrorBoundary(errorResetBoundary);const[observer]=index_js_.useState(()=>new QueriesObserver(client,defaultedQueries,options));const[optimisticResult,getCombinedResult,trackResult]=observer.getOptimisticResult(defaultedQueries,options.combine);const shouldSubscribe=!isRestoring&&false!==options.subscribed;index_js_.useSyncExternalStore(index_js_.useCallback(onStoreChange=>shouldSubscribe?observer.subscribe(notifyManager.batchCalls(onStoreChange)):noop,[observer,shouldSubscribe]),()=>observer.getCurrentResult(),()=>observer.getCurrentResult());index_js_.useEffect(()=>{observer.setQueries(defaultedQueries,options)},[defaultedQueries,options,observer]);const shouldAtLeastOneSuspend=optimisticResult.some((result,index)=>shouldSuspend(defaultedQueries[index],result));const suspensePromises=shouldAtLeastOneSuspend?optimisticResult.flatMap((result,index)=>{const opts=defaultedQueries[index];if(opts){const queryObserver=new QueryObserver(client,opts);if(shouldSuspend(opts,result))return fetchOptimistic(opts,queryObserver,errorResetBoundary);if(willFetch(result,isRestoring))fetchOptimistic(opts,queryObserver,errorResetBoundary)}return[]}):[];if(suspensePromises.length>0)throw Promise.all(suspensePromises);const firstSingleResultWhichShouldThrow=optimisticResult.find((result,index)=>{const query=defaultedQueries[index];return query&&getHasError({result,errorResetBoundary,throwOnError:query.throwOnError,query:client.getQueryCache().get(query.queryHash),suspense:query.suspense})});if(firstSingleResultWhichShouldThrow?.error)throw firstSingleResultWhichShouldThrow.error;return getCombinedResult(trackResult())}"use client";function useBaseQuery(options,Observer,queryClient){const isRestoring=useIsRestoring();const errorResetBoundary=useQueryErrorResetBoundary();const client=useQueryClient(queryClient);const defaultedOptions=client.defaultQueryOptions(options);client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions);defaultedOptions._optimisticResults=isRestoring?"isRestoring":"optimistic";ensureSuspenseTimers(defaultedOptions);ensurePreventErrorBoundaryRetry(defaultedOptions,errorResetBoundary);useClearResetErrorBoundary(errorResetBoundary);const isNewCacheEntry=!client.getQueryCache().get(defaultedOptions.queryHash);const[observer]=index_js_.useState(()=>new Observer(client,defaultedOptions));const result=observer.getOptimisticResult(defaultedOptions);const shouldSubscribe=!isRestoring&&false!==options.subscribed;index_js_.useSyncExternalStore(index_js_.useCallback(onStoreChange=>{const unsubscribe=shouldSubscribe?observer.subscribe(notifyManager.batchCalls(onStoreChange)):noop;observer.updateResult();return unsubscribe},[observer,shouldSubscribe]),()=>observer.getCurrentResult(),()=>observer.getCurrentResult());index_js_.useEffect(()=>{observer.setOptions(defaultedOptions)},[defaultedOptions,observer]);if(shouldSuspend(defaultedOptions,result))throw fetchOptimistic(defaultedOptions,observer,errorResetBoundary);if(getHasError({result,errorResetBoundary,throwOnError:defaultedOptions.throwOnError,query:client.getQueryCache().get(defaultedOptions.queryHash),suspense:defaultedOptions.suspense}))throw result.error;client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions,result);if(defaultedOptions.experimental_prefetchInRender&&!isServer&&willFetch(result,isRestoring)){const promise=isNewCacheEntry?fetchOptimistic(defaultedOptions,observer,errorResetBoundary):client.getQueryCache().get(defaultedOptions.queryHash)?.promise;promise?.catch(noop).finally(()=>{observer.updateResult()})}return defaultedOptions.notifyOnChangeProps?result:observer.trackResult(result)}"use client";function useQuery(options,queryClient){return useBaseQuery(options,QueryObserver,queryClient)}"use client";function useSuspenseQuery(options,queryClient){return useBaseQuery({...options,enabled:true,suspense:true,throwOnError:defaultThrowOnError,placeholderData:void 0},QueryObserver,queryClient)}"use client";function useSuspenseInfiniteQuery(options,queryClient){return useBaseQuery({...options,enabled:true,suspense:true,throwOnError:defaultThrowOnError},InfiniteQueryObserver,queryClient)}"use client";function useSuspenseQueries(options,queryClient){return useQueries({...options,queries:options.queries.map(query=>({...query,suspense:true,throwOnError:defaultThrowOnError,enabled:true,placeholderData:void 0}))},queryClient)}function usePrefetchQuery(options,queryClient){const client=useQueryClient(queryClient);if(!client.getQueryState(options.queryKey))client.prefetchQuery(options)}function usePrefetchInfiniteQuery(options,queryClient){const client=useQueryClient(queryClient);if(!client.getQueryState(options.queryKey))client.prefetchInfiniteQuery(options)}function queryOptions(options){return options}function infiniteQueryOptions(options){return options}"use client";var HydrationBoundary=({children,options={},state,queryClient})=>{const client=useQueryClient(queryClient);const optionsRef=index_js_.useRef(options);index_js_.useEffect(()=>{optionsRef.current=options});const hydrationQueue=index_js_.useMemo(()=>{if(state){if("object"!=typeof state)return;const queryCache=client.getQueryCache();const queries=state.queries||[];const newQueries=[];const existingQueries=[];for(const dehydratedQuery of queries){const existingQuery=queryCache.get(dehydratedQuery.queryHash);if(existingQuery){const hydrationIsNewer=dehydratedQuery.state.dataUpdatedAt>existingQuery.state.dataUpdatedAt||dehydratedQuery.promise&&"pending"!==existingQuery.state.status&&"fetching"!==existingQuery.state.fetchStatus&&void 0!==dehydratedQuery.dehydratedAt&&dehydratedQuery.dehydratedAt>existingQuery.state.dataUpdatedAt;if(hydrationIsNewer)existingQueries.push(dehydratedQuery)}else newQueries.push(dehydratedQuery)}if(newQueries.length>0)hydrate(client,{queries:newQueries},optionsRef.current);if(existingQueries.length>0)return existingQueries}},[client,state]);index_js_.useEffect(()=>{if(hydrationQueue)hydrate(client,{queries:hydrationQueue},optionsRef.current)},[client,hydrationQueue]);return children};"use client";function useIsFetching(filters,queryClient){const client=useQueryClient(queryClient);const queryCache=client.getQueryCache();return index_js_.useSyncExternalStore(index_js_.useCallback(onStoreChange=>queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),[queryCache]),()=>client.isFetching(filters),()=>client.isFetching(filters))}"use client";function useIsMutating(filters,queryClient){const client=useQueryClient(queryClient);return useMutationState({filters:{...filters,status:"pending"}},client).length}function getResult(mutationCache,options){return mutationCache.findAll(options.filters).map(mutation=>options.select?options.select(mutation):mutation.state)}function useMutationState(options={},queryClient){const mutationCache=useQueryClient(queryClient).getMutationCache();const optionsRef=index_js_.useRef(options);const result=index_js_.useRef(null);if(null===result.current)result.current=getResult(mutationCache,options);index_js_.useEffect(()=>{optionsRef.current=options});return index_js_.useSyncExternalStore(index_js_.useCallback(onStoreChange=>mutationCache.subscribe(()=>{const nextResult=replaceEqualDeep(result.current,getResult(mutationCache,optionsRef.current));if(result.current!==nextResult){result.current=nextResult;notifyManager.schedule(onStoreChange)}}),[mutationCache]),()=>result.current,()=>result.current)}"use client";function useMutation(options,queryClient){const client=useQueryClient(queryClient);const[observer]=index_js_.useState(()=>new MutationObserver(client,options));index_js_.useEffect(()=>{observer.setOptions(options)},[observer,options]);const result=index_js_.useSyncExternalStore(index_js_.useCallback(onStoreChange=>observer.subscribe(notifyManager.batchCalls(onStoreChange)),[observer]),()=>observer.getCurrentResult(),()=>observer.getCurrentResult());const mutate=index_js_.useCallback((variables,mutateOptions)=>{observer.mutate(variables,mutateOptions).catch(noop)},[observer]);if(result.error&&shouldThrowError(observer.options.throwOnError,[result.error]))throw result.error;return{...result,mutate,mutateAsync:result.mutate}}function mutationOptions_mutationOptions(options){return options}"use client";function useInfiniteQuery(options,queryClient){return useBaseQuery(options,InfiniteQueryObserver,queryClient)}}}]);
|
package/dist/mf/476.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_integrations_app"]=globalThis["chunk_integrations_app"]||[]).push([["476"],{9887:function(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{isThursday:()=>isThursday,longFormatters:()=>longFormatters,lastDayOfISOWeek:()=>lastDayOfISOWeek,differenceInYears:()=>differenceInYears,setQuarter:()=>setQuarter_setQuarter,isWeekend:()=>isWeekend,differenceInHours:()=>differenceInHours,setISODay:()=>setISODay_setISODay,getQuarter:()=>getQuarter,isFirstDayOfMonth:()=>isFirstDayOfMonth,differenceInISOWeekYears:()=>differenceInISOWeekYears_differenceInISOWeekYears,quartersToYears:()=>quartersToYears,setDay:()=>setDay,getWeekOfMonth:()=>getWeekOfMonth,lightFormat:()=>lightFormat,addBusinessDays:()=>addBusinessDays_addBusinessDays,subYears:()=>subYears,startOfDay:()=>startOfDay_startOfDay,lastDayOfYear:()=>lastDayOfYear_lastDayOfYear,lastDayOfDecade:()=>lastDayOfDecade_lastDayOfDecade,getDay:()=>getDay,subMonths:()=>subMonths,nextFriday:()=>nextFriday,subMinutes:()=>subMinutes,differenceInCalendarQuarters:()=>differenceInCalendarQuarters,endOfWeek:()=>endOfWeek,max:()=>max,nextMonday:()=>nextMonday,isSameHour:()=>isSameHour,roundToNearestHours:()=>roundToNearestHours_roundToNearestHours,startOfSecond:()=>startOfSecond_startOfSecond,isTomorrow:()=>isTomorrow,hoursToMinutes:()=>hoursToMinutes,endOfSecond:()=>endOfSecond,isToday:()=>isToday,addISOWeekYears:()=>addISOWeekYears,isWednesday:()=>isWednesday,formatDate:()=>format_format,eachQuarterOfInterval:()=>eachQuarterOfInterval,toDate:()=>toDate,formatRFC3339:()=>formatRFC3339_formatRFC3339,isAfter:()=>isAfter,isBefore:()=>isBefore_isBefore,daysToWeeks:()=>daysToWeeks,intlFormatDistance:()=>intlFormatDistance_intlFormatDistance,isSaturday:()=>isSaturday_isSaturday,isLeapYear:()=>isLeapYear_isLeapYear,addSeconds:()=>addSeconds,previousDay:()=>previousDay,previousSaturday:()=>previousSaturday,isPast:()=>isPast_isPast,lastDayOfISOWeekYear:()=>lastDayOfISOWeekYear,endOfHour:()=>endOfHour_endOfHour,formatRelative:()=>formatRelative_formatRelative,subWeeks:()=>subWeeks_subWeeks,startOfMonth:()=>startOfMonth,roundToNearestMinutes:()=>roundToNearestMinutes,closestTo:()=>closestTo_closestTo,startOfHour:()=>startOfHour,getMilliseconds:()=>getMilliseconds_getMilliseconds,getISOWeek:()=>getISOWeek,minutesToHours:()=>minutesToHours,eachHourOfInterval:()=>eachHourOfInterval,startOfISOWeekYear:()=>startOfISOWeekYear,eachWeekendOfYear:()=>eachWeekendOfYear,hoursToMilliseconds:()=>hoursToMilliseconds,eachWeekOfInterval:()=>eachWeekOfInterval,formatRFC7231:()=>formatRFC7231,min:()=>min_min,secondsToHours:()=>secondsToHours,millisecondsToMinutes:()=>millisecondsToMinutes,secondsToMinutes:()=>secondsToMinutes_secondsToMinutes,subDays:()=>subDays_subDays,differenceInCalendarYears:()=>differenceInCalendarYears,startOfQuarter:()=>startOfQuarter,isFriday:()=>isFriday,differenceInMinutes:()=>differenceInMinutes,monthsToQuarters:()=>monthsToQuarters,formatISO:()=>formatISO_formatISO,nextDay:()=>nextDay_nextDay,startOfMinute:()=>startOfMinute_startOfMinute,formatDistanceToNowStrict:()=>formatDistanceToNowStrict,addMonths:()=>addMonths,isSameMinute:()=>isSameMinute_isSameMinute,sub:()=>sub,eachMinuteOfInterval:()=>eachMinuteOfInterval,isThisMinute:()=>isThisMinute,nextSaturday:()=>nextSaturday,previousSunday:()=>previousSunday,setDate:()=>setDate_setDate,transpose:()=>transpose_transpose,formatDistance:()=>formatDistance_formatDistance,previousFriday:()=>previousFriday,setYear:()=>setYear,startOfDecade:()=>startOfDecade,parsers:()=>parsers,isEqual:()=>isEqual,millisecondsToSeconds:()=>millisecondsToSeconds,endOfToday:()=>endOfToday,subQuarters:()=>subQuarters,lightFormatters:()=>lightFormatters,isSameSecond:()=>isSameSecond_isSameSecond,startOfWeek:()=>startOfWeek,differenceInCalendarMonths:()=>differenceInCalendarMonths,differenceInWeeks:()=>differenceInWeeks_differenceInWeeks,endOfMonth:()=>endOfMonth_endOfMonth,getDate:()=>getDate,getDefaultOptions:()=>getDefaultOptions_getDefaultOptions,isThisQuarter:()=>isThisQuarter,isValid:()=>isValid_isValid,nextThursday:()=>nextThursday,getYear:()=>getYear,intervalToDuration:()=>intervalToDuration_intervalToDuration,previousMonday:()=>previousMonday,previousTuesday:()=>previousTuesday,setDayOfYear:()=>setDayOfYear_setDayOfYear,set:()=>set,addQuarters:()=>addQuarters,startOfTomorrow:()=>startOfTomorrow,subHours:()=>subHours,subISOWeekYears:()=>subISOWeekYears,getWeekYear:()=>getWeekYear,addHours:()=>addHours,fromUnixTime:()=>fromUnixTime,startOfToday:()=>startOfToday,getSeconds:()=>getSeconds,subSeconds:()=>subSeconds,isSameYear:()=>isSameYear,addMinutes:()=>addMinutes,isDate:()=>isDate,nextWednesday:()=>nextWednesday,differenceInMonths:()=>differenceInMonths_differenceInMonths,nextTuesday:()=>nextTuesday,parseISO:()=>parseISO,setISOWeekYear:()=>setISOWeekYear,eachDayOfInterval:()=>eachDayOfInterval,isWithinInterval:()=>isWithinInterval_isWithinInterval,getDaysInYear:()=>getDaysInYear,previousThursday:()=>previousThursday,startOfYear:()=>startOfYear,quartersToMonths:()=>quartersToMonths_quartersToMonths,intlFormat:()=>intlFormat,getHours:()=>getHours,isSameQuarter:()=>isSameQuarter,minutesToSeconds:()=>minutesToSeconds_minutesToSeconds,formatISODuration:()=>formatISODuration_formatISODuration,addMilliseconds:()=>addMilliseconds,yearsToQuarters:()=>yearsToQuarters,eachWeekendOfMonth:()=>eachWeekendOfMonth,startOfWeekYear:()=>startOfWeekYear_startOfWeekYear,isMonday:()=>isMonday_isMonday,compareAsc:()=>compareAsc_compareAsc,endOfQuarter:()=>endOfQuarter_endOfQuarter,getMonth:()=>getMonth,addYears:()=>addYears,differenceInQuarters:()=>differenceInQuarters,eachYearOfInterval:()=>eachYearOfInterval,lastDayOfWeek:()=>lastDayOfWeek,parse:()=>parse_parse,milliseconds:()=>milliseconds_milliseconds,endOfTomorrow:()=>endOfTomorrow,subMilliseconds:()=>subMilliseconds,formatDuration:()=>formatDuration,interval:()=>interval_interval,format:()=>format_format,setHours:()=>setHours_setHours,eachWeekendOfInterval:()=>eachWeekendOfInterval,isSameWeek:()=>isSameWeek,isSameISOWeek:()=>isSameISOWeek,closestIndexTo:()=>closestIndexTo,isFuture:()=>isFuture,isSunday:()=>isSunday,getDecade:()=>getDecade,isYesterday:()=>isYesterday,clamp:()=>clamp_clamp,endOfYear:()=>endOfYear_endOfYear,getOverlappingDaysInIntervals:()=>getOverlappingDaysInIntervals_getOverlappingDaysInIntervals,nextSunday:()=>nextSunday,setWeek:()=>setWeek_setWeek,startOfISOWeek:()=>startOfISOWeek,differenceInMilliseconds:()=>differenceInMilliseconds_differenceInMilliseconds,endOfMinute:()=>endOfMinute_endOfMinute,setDefaultOptions:()=>setDefaultOptions_setDefaultOptions,addDays:()=>addDays,isThisYear:()=>isThisYear_isThisYear,addWeeks:()=>addWeeks,formatISO9075:()=>formatISO9075_formatISO9075,endOfISOWeekYear:()=>endOfISOWeekYear,getMinutes:()=>getMinutes,getWeek:()=>getWeek,isThisMonth:()=>isThisMonth_isThisMonth,setWeekYear:()=>setWeekYear,getISODay:()=>getISODay,isLastDayOfMonth:()=>isLastDayOfMonth,setISOWeek:()=>setISOWeek,weeksToDays:()=>weeksToDays,parseJSON:()=>parseJSON,isMatch:()=>isMatch,formatDistanceToNow:()=>formatDistanceToNow,setMilliseconds:()=>setMilliseconds,eachMonthOfInterval:()=>eachMonthOfInterval,add:()=>add,isSameISOWeekYear:()=>isSameISOWeekYear,differenceInCalendarWeeks:()=>differenceInCalendarWeeks,isSameDay:()=>isSameDay,setSeconds:()=>setSeconds,isThisISOWeek:()=>isThisISOWeek,getDaysInMonth:()=>getDaysInMonth,millisecondsToHours:()=>millisecondsToHours_millisecondsToHours,differenceInSeconds:()=>differenceInSeconds_differenceInSeconds,areIntervalsOverlapping:()=>areIntervalsOverlapping,differenceInCalendarDays:()=>differenceInCalendarDays,differenceInCalendarISOWeeks:()=>differenceInCalendarISOWeeks,differenceInCalendarISOWeekYears:()=>differenceInCalendarISOWeekYears,isThisHour:()=>isThisHour,isThisSecond:()=>isThisSecond,lastDayOfQuarter:()=>lastDayOfQuarter,monthsToYears:()=>monthsToYears,subBusinessDays:()=>subBusinessDays,differenceInDays:()=>differenceInDays_differenceInDays,yearsToMonths:()=>yearsToMonths_yearsToMonths,constructNow:()=>constructNow,getISOWeekYear:()=>getISOWeekYear,setMonth:()=>setMonth,endOfDecade:()=>endOfDecade,getUnixTime:()=>getUnixTime,getDayOfYear:()=>getDayOfYear,isExists:()=>isExists_isExists,endOfDay:()=>endOfDay,endOfYesterday:()=>endOfYesterday,isSameMonth:()=>isSameMonth,previousWednesday:()=>previousWednesday,minutesToMilliseconds:()=>minutesToMilliseconds,startOfYesterday:()=>startOfYesterday,formatters:()=>formatters,secondsToMilliseconds:()=>secondsToMilliseconds,yearsToDays:()=>yearsToDays,getISOWeeksInYear:()=>getISOWeeksInYear,isThisWeek:()=>isThisWeek,compareDesc:()=>compareDesc,differenceInBusinessDays:()=>differenceInBusinessDays_differenceInBusinessDays,isTuesday:()=>isTuesday,setMinutes:()=>setMinutes,endOfISOWeek:()=>endOfISOWeek,getTime:()=>getTime,getWeeksInMonth:()=>getWeeksInMonth,constructFrom:()=>constructFrom_constructFrom,hoursToSeconds:()=>hoursToSeconds,formatDistanceStrict:()=>formatDistanceStrict,lastDayOfMonth:()=>lastDayOfMonth_lastDayOfMonth});const daysInYear=365.2425;const millisecondsInWeek=6048e5;const millisecondsInDay=864e5;const millisecondsInHour=36e5;const secondsInHour=3600;const secondsInDay=24*secondsInHour;const secondsInYear=secondsInDay*daysInYear;const secondsInMonth=secondsInYear/12;const secondsInQuarter=3*secondsInMonth;const constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom_constructFrom(date,value){if("function"==typeof date)return date(value);if(date&&"object"==typeof date&&constructFromSymbol in date)return date[constructFromSymbol](value);if(date instanceof Date)return new date.constructor(value);return new Date(value)}function toDate(argument,context){return constructFrom_constructFrom(context||argument,argument)}function addDays(date,amount,options){const _date=toDate(date,options?.in);if(isNaN(amount))return constructFrom_constructFrom(options?.in||date,NaN);if(!amount)return _date;_date.setDate(_date.getDate()+amount);return _date}function addMonths(date,amount,options){const _date=toDate(date,options?.in);if(isNaN(amount))return constructFrom_constructFrom(options?.in||date,NaN);if(!amount)return _date;const dayOfMonth=_date.getDate();const endOfDesiredMonth=constructFrom_constructFrom(options?.in||date,_date.getTime());endOfDesiredMonth.setMonth(_date.getMonth()+amount+1,0);const daysInMonth=endOfDesiredMonth.getDate();if(dayOfMonth>=daysInMonth)return endOfDesiredMonth;_date.setFullYear(endOfDesiredMonth.getFullYear(),endOfDesiredMonth.getMonth(),dayOfMonth);return _date}function add(date,duration,options){const{years=0,months=0,weeks=0,days=0,hours=0,minutes=0,seconds=0}=duration;const _date=toDate(date,options?.in);const dateWithMonths=months||years?addMonths(_date,months+12*years):_date;const dateWithDays=days||weeks?addDays(dateWithMonths,days+7*weeks):dateWithMonths;const minutesToAdd=minutes+60*hours;const secondsToAdd=seconds+60*minutesToAdd;const msToAdd=1e3*secondsToAdd;return constructFrom_constructFrom(options?.in||date,+dateWithDays+msToAdd)}function isSaturday_isSaturday(date,options){return 6===toDate(date,options?.in).getDay()}function isSunday(date,options){return 0===toDate(date,options?.in).getDay()}function isWeekend(date,options){const day=toDate(date,options?.in).getDay();return 0===day||6===day}function addBusinessDays_addBusinessDays(date,amount,options){const _date=toDate(date,options?.in);const startedOnWeekend=isWeekend(_date,options);if(isNaN(amount))return constructFrom_constructFrom(options?.in,NaN);const hours=_date.getHours();const sign=amount<0?-1:1;const fullWeeks=Math.trunc(amount/5);_date.setDate(_date.getDate()+7*fullWeeks);let restDays=Math.abs(amount%5);while(restDays>0){_date.setDate(_date.getDate()+sign);if(!isWeekend(_date,options))restDays-=1}if(startedOnWeekend&&isWeekend(_date,options)&&0!==amount){if(isSaturday_isSaturday(_date,options))_date.setDate(_date.getDate()+(sign<0?2:-1));if(isSunday(_date,options))_date.setDate(_date.getDate()+(sign<0?1:-2))}_date.setHours(hours);return _date}function addMilliseconds(date,amount,options){return constructFrom_constructFrom(options?.in||date,+toDate(date)+amount)}function addHours(date,amount,options){return addMilliseconds(date,amount*millisecondsInHour,options)}let defaultOptions_defaultOptions={};function getDefaultOptions(){return defaultOptions_defaultOptions}function setDefaultOptions(newOptions){defaultOptions_defaultOptions=newOptions}function startOfWeek(date,options){const defaultOptions=getDefaultOptions();const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const _date=toDate(date,options?.in);const day=_date.getDay();const diff=(day<weekStartsOn?7:0)+day-weekStartsOn;_date.setDate(_date.getDate()-diff);_date.setHours(0,0,0,0);return _date}function startOfISOWeek(date,options){return startOfWeek(date,{...options,weekStartsOn:1})}function getISOWeekYear(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const fourthOfJanuaryOfNextYear=constructFrom_constructFrom(_date,0);fourthOfJanuaryOfNextYear.setFullYear(year+1,0,4);fourthOfJanuaryOfNextYear.setHours(0,0,0,0);const startOfNextYear=startOfISOWeek(fourthOfJanuaryOfNextYear);const fourthOfJanuaryOfThisYear=constructFrom_constructFrom(_date,0);fourthOfJanuaryOfThisYear.setFullYear(year,0,4);fourthOfJanuaryOfThisYear.setHours(0,0,0,0);const startOfThisYear=startOfISOWeek(fourthOfJanuaryOfThisYear);if(_date.getTime()>=startOfNextYear.getTime())return year+1;if(_date.getTime()>=startOfThisYear.getTime())return year;return year-1}function getTimezoneOffsetInMilliseconds(date){const _date=toDate(date);const utcDate=new Date(Date.UTC(_date.getFullYear(),_date.getMonth(),_date.getDate(),_date.getHours(),_date.getMinutes(),_date.getSeconds(),_date.getMilliseconds()));utcDate.setUTCFullYear(_date.getFullYear());return date-utcDate}function normalizeDates(context,...dates){const normalize=constructFrom_constructFrom.bind(null,context||dates.find(date=>"object"==typeof date));return dates.map(normalize)}function startOfDay_startOfDay(date,options){const _date=toDate(date,options?.in);_date.setHours(0,0,0,0);return _date}function differenceInCalendarDays(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const laterStartOfDay=startOfDay_startOfDay(laterDate_);const earlierStartOfDay=startOfDay_startOfDay(earlierDate_);const laterTimestamp=laterStartOfDay-getTimezoneOffsetInMilliseconds(laterStartOfDay);const earlierTimestamp=earlierStartOfDay-getTimezoneOffsetInMilliseconds(earlierStartOfDay);return Math.round((laterTimestamp-earlierTimestamp)/millisecondsInDay)}function startOfISOWeekYear(date,options){const year=getISOWeekYear(date,options);const fourthOfJanuary=constructFrom_constructFrom(options?.in||date,0);fourthOfJanuary.setFullYear(year,0,4);fourthOfJanuary.setHours(0,0,0,0);return startOfISOWeek(fourthOfJanuary)}function setISOWeekYear(date,weekYear,options){let _date=toDate(date,options?.in);const diff=differenceInCalendarDays(_date,startOfISOWeekYear(_date,options));const fourthOfJanuary=constructFrom_constructFrom(options?.in||date,0);fourthOfJanuary.setFullYear(weekYear,0,4);fourthOfJanuary.setHours(0,0,0,0);_date=startOfISOWeekYear(fourthOfJanuary);_date.setDate(_date.getDate()+diff);return _date}function addISOWeekYears(date,amount,options){return setISOWeekYear(date,getISOWeekYear(date,options)+amount,options)}function addMinutes(date,amount,options){const _date=toDate(date,options?.in);_date.setTime(_date.getTime()+6e4*amount);return _date}function addQuarters(date,amount,options){return addMonths(date,3*amount,options)}function addSeconds(date,amount,options){return addMilliseconds(date,1e3*amount,options)}function addWeeks(date,amount,options){return addDays(date,7*amount,options)}function addYears(date,amount,options){return addMonths(date,12*amount,options)}function areIntervalsOverlapping(intervalLeft,intervalRight,options){const[leftStartTime,leftEndTime]=[+toDate(intervalLeft.start,options?.in),+toDate(intervalLeft.end,options?.in)].sort((a,b)=>a-b);const[rightStartTime,rightEndTime]=[+toDate(intervalRight.start,options?.in),+toDate(intervalRight.end,options?.in)].sort((a,b)=>a-b);if(options?.inclusive)return leftStartTime<=rightEndTime&&rightStartTime<=leftEndTime;return leftStartTime<rightEndTime&&rightStartTime<leftEndTime}function max(dates,options){let result;let context=options?.in;dates.forEach(date=>{if(!context&&"object"==typeof date)context=constructFrom_constructFrom.bind(null,date);const date_=toDate(date,context);if(!result||result<date_||isNaN(+date_))result=date_});return constructFrom_constructFrom(context,result||NaN)}function min_min(dates,options){let result;let context=options?.in;dates.forEach(date=>{if(!context&&"object"==typeof date)context=constructFrom_constructFrom.bind(null,date);const date_=toDate(date,context);if(!result||result>date_||isNaN(+date_))result=date_});return constructFrom_constructFrom(context,result||NaN)}function clamp_clamp(date,interval,options){const[date_,start,end]=normalizeDates(options?.in,date,interval.start,interval.end);return min_min([max([date_,start],options),end],options)}function closestIndexTo(dateToCompare,dates){const timeToCompare=+toDate(dateToCompare);if(isNaN(timeToCompare))return NaN;let result;let minDistance;dates.forEach((date,index)=>{const date_=toDate(date);if(isNaN(+date_)){result=NaN;minDistance=NaN;return}const distance=Math.abs(timeToCompare-date_);if(null==result||distance<minDistance){result=index;minDistance=distance}});return result}function closestTo_closestTo(dateToCompare,dates,options){const[dateToCompare_,...dates_]=normalizeDates(options?.in,dateToCompare,...dates);const index=closestIndexTo(dateToCompare_,dates_);if("number"==typeof index&&isNaN(index))return constructFrom_constructFrom(dateToCompare_,NaN);if(void 0!==index)return dates_[index]}function compareAsc_compareAsc(dateLeft,dateRight){const diff=toDate(dateLeft)-toDate(dateRight);if(diff<0)return -1;if(diff>0)return 1;return diff}function compareDesc(dateLeft,dateRight){const diff=toDate(dateLeft)-toDate(dateRight);if(diff>0)return -1;if(diff<0)return 1;return diff}function constructNow(date){return constructFrom_constructFrom(date,Date.now())}function daysToWeeks(days){const result=Math.trunc(days/7);return 0===result?0:result}function isSameDay(laterDate,earlierDate,options){const[dateLeft_,dateRight_]=normalizeDates(options?.in,laterDate,earlierDate);return+startOfDay_startOfDay(dateLeft_)===+startOfDay_startOfDay(dateRight_)}function isDate(value){return value instanceof Date||"object"==typeof value&&"[object Date]"===Object.prototype.toString.call(value)}function isValid_isValid(date){return!(!isDate(date)&&"number"!=typeof date||isNaN(+toDate(date)))}function differenceInBusinessDays_differenceInBusinessDays(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);if(!isValid_isValid(laterDate_)||!isValid_isValid(earlierDate_))return NaN;const diff=differenceInCalendarDays(laterDate_,earlierDate_);const sign=diff<0?-1:1;const weeks=Math.trunc(diff/7);let result=5*weeks;let movingDate=addDays(earlierDate_,7*weeks);while(!isSameDay(laterDate_,movingDate)){result+=isWeekend(movingDate,options)?0:sign;movingDate=addDays(movingDate,sign)}return 0===result?0:result}function differenceInCalendarISOWeekYears(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);return getISOWeekYear(laterDate_,options)-getISOWeekYear(earlierDate_,options)}function differenceInCalendarISOWeeks(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const startOfISOWeekLeft=startOfISOWeek(laterDate_);const startOfISOWeekRight=startOfISOWeek(earlierDate_);const timestampLeft=startOfISOWeekLeft-getTimezoneOffsetInMilliseconds(startOfISOWeekLeft);const timestampRight=startOfISOWeekRight-getTimezoneOffsetInMilliseconds(startOfISOWeekRight);return Math.round((timestampLeft-timestampRight)/millisecondsInWeek)}function differenceInCalendarMonths(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const yearsDiff=laterDate_.getFullYear()-earlierDate_.getFullYear();const monthsDiff=laterDate_.getMonth()-earlierDate_.getMonth();return 12*yearsDiff+monthsDiff}function getQuarter(date,options){const _date=toDate(date,options?.in);const quarter=Math.trunc(_date.getMonth()/3)+1;return quarter}function differenceInCalendarQuarters(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const yearsDiff=laterDate_.getFullYear()-earlierDate_.getFullYear();const quartersDiff=getQuarter(laterDate_)-getQuarter(earlierDate_);return 4*yearsDiff+quartersDiff}function differenceInCalendarWeeks(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const laterStartOfWeek=startOfWeek(laterDate_,options);const earlierStartOfWeek=startOfWeek(earlierDate_,options);const laterTimestamp=laterStartOfWeek-getTimezoneOffsetInMilliseconds(laterStartOfWeek);const earlierTimestamp=earlierStartOfWeek-getTimezoneOffsetInMilliseconds(earlierStartOfWeek);return Math.round((laterTimestamp-earlierTimestamp)/millisecondsInWeek)}function differenceInCalendarYears(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);return laterDate_.getFullYear()-earlierDate_.getFullYear()}function differenceInDays_differenceInDays(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const sign=compareLocalAsc(laterDate_,earlierDate_);const difference=Math.abs(differenceInCalendarDays(laterDate_,earlierDate_));laterDate_.setDate(laterDate_.getDate()-sign*difference);const isLastDayNotFull=Number(compareLocalAsc(laterDate_,earlierDate_)===-sign);const result=sign*(difference-isLastDayNotFull);return 0===result?0:result}function compareLocalAsc(laterDate,earlierDate){const diff=laterDate.getFullYear()-earlierDate.getFullYear()||laterDate.getMonth()-earlierDate.getMonth()||laterDate.getDate()-earlierDate.getDate()||laterDate.getHours()-earlierDate.getHours()||laterDate.getMinutes()-earlierDate.getMinutes()||laterDate.getSeconds()-earlierDate.getSeconds()||laterDate.getMilliseconds()-earlierDate.getMilliseconds();if(diff<0)return -1;if(diff>0)return 1;return diff}function getRoundingMethod(method){return number=>{const round=method?Math[method]:Math.trunc;const result=round(number);return 0===result?0:result}}function differenceInHours(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const diff=(laterDate_-earlierDate_)/millisecondsInHour;return getRoundingMethod(options?.roundingMethod)(diff)}function subISOWeekYears(date,amount,options){return addISOWeekYears(date,-amount,options)}function differenceInISOWeekYears_differenceInISOWeekYears(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const sign=compareAsc_compareAsc(laterDate_,earlierDate_);const diff=Math.abs(differenceInCalendarISOWeekYears(laterDate_,earlierDate_,options));const adjustedDate=subISOWeekYears(laterDate_,sign*diff,options);const isLastISOWeekYearNotFull=Number(compareAsc_compareAsc(adjustedDate,earlierDate_)===-sign);const result=sign*(diff-isLastISOWeekYearNotFull);return 0===result?0:result}function differenceInMilliseconds_differenceInMilliseconds(laterDate,earlierDate){return toDate(laterDate)-toDate(earlierDate)}function differenceInMinutes(dateLeft,dateRight,options){const diff=differenceInMilliseconds_differenceInMilliseconds(dateLeft,dateRight)/6e4;return getRoundingMethod(options?.roundingMethod)(diff)}function endOfDay(date,options){const _date=toDate(date,options?.in);_date.setHours(23,59,59,999);return _date}function endOfMonth_endOfMonth(date,options){const _date=toDate(date,options?.in);const month=_date.getMonth();_date.setFullYear(_date.getFullYear(),month+1,0);_date.setHours(23,59,59,999);return _date}function isLastDayOfMonth(date,options){const _date=toDate(date,options?.in);return+endOfDay(_date,options)===+endOfMonth_endOfMonth(_date,options)}function differenceInMonths_differenceInMonths(laterDate,earlierDate,options){const[laterDate_,workingLaterDate,earlierDate_]=normalizeDates(options?.in,laterDate,laterDate,earlierDate);const sign=compareAsc_compareAsc(workingLaterDate,earlierDate_);const difference=Math.abs(differenceInCalendarMonths(workingLaterDate,earlierDate_));if(difference<1)return 0;if(1===workingLaterDate.getMonth()&&workingLaterDate.getDate()>27)workingLaterDate.setDate(30);workingLaterDate.setMonth(workingLaterDate.getMonth()-sign*difference);let isLastMonthNotFull=compareAsc_compareAsc(workingLaterDate,earlierDate_)===-sign;if(isLastDayOfMonth(laterDate_)&&1===difference&&1===compareAsc_compareAsc(laterDate_,earlierDate_))isLastMonthNotFull=false;const result=sign*(difference-isLastMonthNotFull);return 0===result?0:result}function differenceInQuarters(laterDate,earlierDate,options){const diff=differenceInMonths_differenceInMonths(laterDate,earlierDate,options)/3;return getRoundingMethod(options?.roundingMethod)(diff)}function differenceInSeconds_differenceInSeconds(laterDate,earlierDate,options){const diff=differenceInMilliseconds_differenceInMilliseconds(laterDate,earlierDate)/1e3;return getRoundingMethod(options?.roundingMethod)(diff)}function differenceInWeeks_differenceInWeeks(laterDate,earlierDate,options){const diff=differenceInDays_differenceInDays(laterDate,earlierDate,options)/7;return getRoundingMethod(options?.roundingMethod)(diff)}function differenceInYears(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);const sign=compareAsc_compareAsc(laterDate_,earlierDate_);const diff=Math.abs(differenceInCalendarYears(laterDate_,earlierDate_));laterDate_.setFullYear(1584);earlierDate_.setFullYear(1584);const partial=compareAsc_compareAsc(laterDate_,earlierDate_)===-sign;const result=sign*(diff-partial);return 0===result?0:result}function normalizeInterval(context,interval){const[start,end]=normalizeDates(context,interval.start,interval.end);return{start,end}}function eachDayOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);let reversed=+start>+end;const endTime=reversed?+start:+end;const date=reversed?end:start;date.setHours(0,0,0,0);let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+date<=endTime){dates.push(constructFrom_constructFrom(start,date));date.setDate(date.getDate()+step);date.setHours(0,0,0,0)}return reversed?dates.reverse():dates}function eachHourOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);let reversed=+start>+end;const endTime=reversed?+start:+end;const date=reversed?end:start;date.setMinutes(0,0,0);let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+date<=endTime){dates.push(constructFrom_constructFrom(start,date));date.setHours(date.getHours()+step)}return reversed?dates.reverse():dates}function eachMinuteOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);start.setSeconds(0,0);let reversed=+start>+end;const endTime=reversed?+start:+end;let date=reversed?end:start;let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+date<=endTime){dates.push(constructFrom_constructFrom(start,date));date=addMinutes(date,step)}return reversed?dates.reverse():dates}function eachMonthOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);let reversed=+start>+end;const endTime=reversed?+start:+end;const date=reversed?end:start;date.setHours(0,0,0,0);date.setDate(1);let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+date<=endTime){dates.push(constructFrom_constructFrom(start,date));date.setMonth(date.getMonth()+step)}return reversed?dates.reverse():dates}function startOfQuarter(date,options){const _date=toDate(date,options?.in);const currentMonth=_date.getMonth();const month=currentMonth-currentMonth%3;_date.setMonth(month,1);_date.setHours(0,0,0,0);return _date}function eachQuarterOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);let reversed=+start>+end;const endTime=reversed?+startOfQuarter(start):+startOfQuarter(end);let date=reversed?startOfQuarter(end):startOfQuarter(start);let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+date<=endTime){dates.push(constructFrom_constructFrom(start,date));date=addQuarters(date,step)}return reversed?dates.reverse():dates}function eachWeekOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);let reversed=+start>+end;const startDateWeek=reversed?startOfWeek(end,options):startOfWeek(start,options);const endDateWeek=reversed?startOfWeek(start,options):startOfWeek(end,options);startDateWeek.setHours(15);endDateWeek.setHours(15);const endTime=+endDateWeek.getTime();let currentDate=startDateWeek;let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+currentDate<=endTime){currentDate.setHours(0);dates.push(constructFrom_constructFrom(start,currentDate));currentDate=addWeeks(currentDate,step);currentDate.setHours(15)}return reversed?dates.reverse():dates}function eachWeekendOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);const dateInterval=eachDayOfInterval({start,end},options);const weekends=[];let index=0;while(index<dateInterval.length){const date=dateInterval[index++];if(isWeekend(date))weekends.push(constructFrom_constructFrom(start,date))}return weekends}function startOfMonth(date,options){const _date=toDate(date,options?.in);_date.setDate(1);_date.setHours(0,0,0,0);return _date}function eachWeekendOfMonth(date,options){const start=startOfMonth(date,options);const end=endOfMonth_endOfMonth(date,options);return eachWeekendOfInterval({start,end},options)}function endOfYear_endOfYear(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();_date.setFullYear(year+1,0,0);_date.setHours(23,59,59,999);return _date}function startOfYear(date,options){const date_=toDate(date,options?.in);date_.setFullYear(date_.getFullYear(),0,1);date_.setHours(0,0,0,0);return date_}function eachWeekendOfYear(date,options){const start=startOfYear(date,options);const end=endOfYear_endOfYear(date,options);return eachWeekendOfInterval({start,end},options)}function eachYearOfInterval(interval,options){const{start,end}=normalizeInterval(options?.in,interval);let reversed=+start>+end;const endTime=reversed?+start:+end;const date=reversed?end:start;date.setHours(0,0,0,0);date.setMonth(0,1);let step=options?.step??1;if(!step)return[];if(step<0){step=-step;reversed=!reversed}const dates=[];while(+date<=endTime){dates.push(constructFrom_constructFrom(start,date));date.setFullYear(date.getFullYear()+step)}return reversed?dates.reverse():dates}function endOfDecade(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const decade=9+10*Math.floor(year/10);_date.setFullYear(decade,11,31);_date.setHours(23,59,59,999);return _date}function endOfHour_endOfHour(date,options){const _date=toDate(date,options?.in);_date.setMinutes(59,59,999);return _date}function endOfWeek(date,options){const defaultOptions=getDefaultOptions();const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const _date=toDate(date,options?.in);const day=_date.getDay();const diff=(day<weekStartsOn?-7:0)+6-(day-weekStartsOn);_date.setDate(_date.getDate()+diff);_date.setHours(23,59,59,999);return _date}function endOfISOWeek(date,options){return endOfWeek(date,{...options,weekStartsOn:1})}function endOfISOWeekYear(date,options){const year=getISOWeekYear(date,options);const fourthOfJanuaryOfNextYear=constructFrom_constructFrom(options?.in||date,0);fourthOfJanuaryOfNextYear.setFullYear(year+1,0,4);fourthOfJanuaryOfNextYear.setHours(0,0,0,0);const _date=startOfISOWeek(fourthOfJanuaryOfNextYear,options);_date.setMilliseconds(_date.getMilliseconds()-1);return _date}function endOfMinute_endOfMinute(date,options){const _date=toDate(date,options?.in);_date.setSeconds(59,999);return _date}function endOfQuarter_endOfQuarter(date,options){const _date=toDate(date,options?.in);const currentMonth=_date.getMonth();const month=currentMonth-currentMonth%3+3;_date.setMonth(month,0);_date.setHours(23,59,59,999);return _date}function endOfSecond(date,options){const _date=toDate(date,options?.in);_date.setMilliseconds(999);return _date}function endOfToday(options){return endOfDay(Date.now(),options)}function endOfTomorrow(options){const now=constructNow(options?.in);const year=now.getFullYear();const month=now.getMonth();const day=now.getDate();const date=constructNow(options?.in);date.setFullYear(year,month,day+1);date.setHours(23,59,59,999);return options?.in?options.in(date):date}function endOfYesterday(options){const now=constructNow(options?.in);const date=constructFrom_constructFrom(options?.in,0);date.setFullYear(now.getFullYear(),now.getMonth(),now.getDate()-1);date.setHours(23,59,59,999);return date}const formatDistanceLocale={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};const formatDistance=(token,count,options)=>{let result;const tokenValue=formatDistanceLocale[token];result="string"==typeof tokenValue?tokenValue:1===count?tokenValue.one:tokenValue.other.replace("{{count}}",count.toString());if(options?.addSuffix)if(options.comparison&&options.comparison>0)return"in "+result;else return result+" ago";return result};function buildFormatLongFn(args){return (options={})=>{const width=options.width?String(options.width):args.defaultWidth;const format=args.formats[width]||args.formats[args.defaultWidth];return format}}const dateFormats={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"};const timeFormats={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"};const dateTimeFormats={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"};const formatLong_formatLong={date:buildFormatLongFn({formats:dateFormats,defaultWidth:"full"}),time:buildFormatLongFn({formats:timeFormats,defaultWidth:"full"}),dateTime:buildFormatLongFn({formats:dateTimeFormats,defaultWidth:"full"})};const formatRelativeLocale={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};const formatRelative=(token,_date,_baseDate,_options)=>formatRelativeLocale[token];function buildLocalizeFn(args){return(value,options)=>{const context=options?.context?String(options.context):"standalone";let valuesArray;if("formatting"===context&&args.formattingValues){const defaultWidth=args.defaultFormattingWidth||args.defaultWidth;const width=options?.width?String(options.width):defaultWidth;valuesArray=args.formattingValues[width]||args.formattingValues[defaultWidth]}else{const defaultWidth=args.defaultWidth;const width=options?.width?String(options.width):args.defaultWidth;valuesArray=args.values[width]||args.values[defaultWidth]}const index=args.argumentCallback?args.argumentCallback(value):value;return valuesArray[index]}}const eraValues={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]};const quarterValues={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]};const monthValues={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]};const dayValues={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]};const dayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}};const formattingDayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}};const ordinalNumber=(dirtyNumber,_options)=>{const number=Number(dirtyNumber);const rem100=number%100;if(rem100>20||rem100<10)switch(rem100%10){case 1:return number+"st";case 2:return number+"nd";case 3:return number+"rd"}return number+"th"};const localize_localize={ordinalNumber,era:buildLocalizeFn({values:eraValues,defaultWidth:"wide"}),quarter:buildLocalizeFn({values:quarterValues,defaultWidth:"wide",argumentCallback:quarter=>quarter-1}),month:buildLocalizeFn({values:monthValues,defaultWidth:"wide"}),day:buildLocalizeFn({values:dayValues,defaultWidth:"wide"}),dayPeriod:buildLocalizeFn({values:dayPeriodValues,defaultWidth:"wide",formattingValues:formattingDayPeriodValues,defaultFormattingWidth:"wide"})};function buildMatchFn(args){return(string,options={})=>{const width=options.width;const matchPattern=width&&args.matchPatterns[width]||args.matchPatterns[args.defaultMatchWidth];const matchResult=string.match(matchPattern);if(!matchResult)return null;const matchedString=matchResult[0];const parsePatterns=width&&args.parsePatterns[width]||args.parsePatterns[args.defaultParseWidth];const key=Array.isArray(parsePatterns)?findIndex(parsePatterns,pattern=>pattern.test(matchedString)):findKey(parsePatterns,pattern=>pattern.test(matchedString));let value;value=args.valueCallback?args.valueCallback(key):key;value=options.valueCallback?options.valueCallback(value):value;const rest=string.slice(matchedString.length);return{value,rest}}}function findKey(object,predicate){for(const key in object)if(Object.prototype.hasOwnProperty.call(object,key)&&predicate(object[key]))return key}function findIndex(array,predicate){for(let key=0;key<array.length;key++)if(predicate(array[key]))return key}function buildMatchPatternFn(args){return(string,options={})=>{const matchResult=string.match(args.matchPattern);if(!matchResult)return null;const matchedString=matchResult[0];const parseResult=string.match(args.parsePattern);if(!parseResult)return null;let value=args.valueCallback?args.valueCallback(parseResult[0]):parseResult[0];value=options.valueCallback?options.valueCallback(value):value;const rest=string.slice(matchedString.length);return{value,rest}}}const matchOrdinalNumberPattern=/^(\d+)(th|st|nd|rd)?/i;const parseOrdinalNumberPattern=/\d+/i;const matchEraPatterns={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i};const parseEraPatterns={any:[/^b/i,/^(a|c)/i]};const matchQuarterPatterns={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i};const parseQuarterPatterns={any:[/1/i,/2/i,/3/i,/4/i]};const matchMonthPatterns={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i};const parseMonthPatterns={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]};const matchDayPatterns={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i};const parseDayPatterns={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]};const matchDayPeriodPatterns={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i};const parseDayPeriodPatterns={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}};const match_match={ordinalNumber:buildMatchPatternFn({matchPattern:matchOrdinalNumberPattern,parsePattern:parseOrdinalNumberPattern,valueCallback:value=>parseInt(value,10)}),era:buildMatchFn({matchPatterns:matchEraPatterns,defaultMatchWidth:"wide",parsePatterns:parseEraPatterns,defaultParseWidth:"any"}),quarter:buildMatchFn({matchPatterns:matchQuarterPatterns,defaultMatchWidth:"wide",parsePatterns:parseQuarterPatterns,defaultParseWidth:"any",valueCallback:index=>index+1}),month:buildMatchFn({matchPatterns:matchMonthPatterns,defaultMatchWidth:"wide",parsePatterns:parseMonthPatterns,defaultParseWidth:"any"}),day:buildMatchFn({matchPatterns:matchDayPatterns,defaultMatchWidth:"wide",parsePatterns:parseDayPatterns,defaultParseWidth:"any"}),dayPeriod:buildMatchFn({matchPatterns:matchDayPeriodPatterns,defaultMatchWidth:"any",parsePatterns:parseDayPeriodPatterns,defaultParseWidth:"any"})};const enUS={code:"en-US",formatDistance:formatDistance,formatLong:formatLong_formatLong,formatRelative:formatRelative,localize:localize_localize,match:match_match,options:{weekStartsOn:0,firstWeekContainsDate:1}};function getDayOfYear(date,options){const _date=toDate(date,options?.in);const diff=differenceInCalendarDays(_date,startOfYear(_date));const dayOfYear=diff+1;return dayOfYear}function getISOWeek(date,options){const _date=toDate(date,options?.in);const diff=startOfISOWeek(_date)-startOfISOWeekYear(_date);return Math.round(diff/millisecondsInWeek)+1}function getWeekYear(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const defaultOptions=getDefaultOptions();const firstWeekContainsDate=options?.firstWeekContainsDate??options?.locale?.options?.firstWeekContainsDate??defaultOptions.firstWeekContainsDate??defaultOptions.locale?.options?.firstWeekContainsDate??1;const firstWeekOfNextYear=constructFrom_constructFrom(options?.in||date,0);firstWeekOfNextYear.setFullYear(year+1,0,firstWeekContainsDate);firstWeekOfNextYear.setHours(0,0,0,0);const startOfNextYear=startOfWeek(firstWeekOfNextYear,options);const firstWeekOfThisYear=constructFrom_constructFrom(options?.in||date,0);firstWeekOfThisYear.setFullYear(year,0,firstWeekContainsDate);firstWeekOfThisYear.setHours(0,0,0,0);const startOfThisYear=startOfWeek(firstWeekOfThisYear,options);if(+_date>=+startOfNextYear)return year+1;if(+_date>=+startOfThisYear)return year;return year-1}function startOfWeekYear_startOfWeekYear(date,options){const defaultOptions=getDefaultOptions();const firstWeekContainsDate=options?.firstWeekContainsDate??options?.locale?.options?.firstWeekContainsDate??defaultOptions.firstWeekContainsDate??defaultOptions.locale?.options?.firstWeekContainsDate??1;const year=getWeekYear(date,options);const firstWeek=constructFrom_constructFrom(options?.in||date,0);firstWeek.setFullYear(year,0,firstWeekContainsDate);firstWeek.setHours(0,0,0,0);const _date=startOfWeek(firstWeek,options);return _date}function getWeek(date,options){const _date=toDate(date,options?.in);const diff=startOfWeek(_date,options)-startOfWeekYear_startOfWeekYear(_date,options);return Math.round(diff/millisecondsInWeek)+1}function addLeadingZeros(number,targetLength){const sign=number<0?"-":"";const output=Math.abs(number).toString().padStart(targetLength,"0");return sign+output}const lightFormatters={y(date,token){const signedYear=date.getFullYear();const year=signedYear>0?signedYear:1-signedYear;return addLeadingZeros("yy"===token?year%100:year,token.length)},M(date,token){const month=date.getMonth();return"M"===token?String(month+1):addLeadingZeros(month+1,2)},d(date,token){return addLeadingZeros(date.getDate(),token.length)},a(date,token){const dayPeriodEnumValue=date.getHours()/12>=1?"pm":"am";switch(token){case"a":case"aa":return dayPeriodEnumValue.toUpperCase();case"aaa":return dayPeriodEnumValue;case"aaaaa":return dayPeriodEnumValue[0];case"aaaa":default:return"am"===dayPeriodEnumValue?"a.m.":"p.m."}},h(date,token){return addLeadingZeros(date.getHours()%12||12,token.length)},H(date,token){return addLeadingZeros(date.getHours(),token.length)},m(date,token){return addLeadingZeros(date.getMinutes(),token.length)},s(date,token){return addLeadingZeros(date.getSeconds(),token.length)},S(date,token){const numberOfDigits=token.length;const milliseconds=date.getMilliseconds();const fractionalSeconds=Math.trunc(milliseconds*Math.pow(10,numberOfDigits-3));return addLeadingZeros(fractionalSeconds,token.length)}};const dayPeriodEnum={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"};const formatters={G:function(date,token,localize){const era=date.getFullYear()>0?1:0;switch(token){case"G":case"GG":case"GGG":return localize.era(era,{width:"abbreviated"});case"GGGGG":return localize.era(era,{width:"narrow"});case"GGGG":default:return localize.era(era,{width:"wide"})}},y:function(date,token,localize){if("yo"===token){const signedYear=date.getFullYear();const year=signedYear>0?signedYear:1-signedYear;return localize.ordinalNumber(year,{unit:"year"})}return lightFormatters.y(date,token)},Y:function(date,token,localize,options){const signedWeekYear=getWeekYear(date,options);const weekYear=signedWeekYear>0?signedWeekYear:1-signedWeekYear;if("YY"===token){const twoDigitYear=weekYear%100;return addLeadingZeros(twoDigitYear,2)}if("Yo"===token)return localize.ordinalNumber(weekYear,{unit:"year"});return addLeadingZeros(weekYear,token.length)},R:function(date,token){const isoWeekYear=getISOWeekYear(date);return addLeadingZeros(isoWeekYear,token.length)},u:function(date,token){const year=date.getFullYear();return addLeadingZeros(year,token.length)},Q:function(date,token,localize){const quarter=Math.ceil((date.getMonth()+1)/3);switch(token){case"Q":return String(quarter);case"QQ":return addLeadingZeros(quarter,2);case"Qo":return localize.ordinalNumber(quarter,{unit:"quarter"});case"QQQ":return localize.quarter(quarter,{width:"abbreviated",context:"formatting"});case"QQQQQ":return localize.quarter(quarter,{width:"narrow",context:"formatting"});case"QQQQ":default:return localize.quarter(quarter,{width:"wide",context:"formatting"})}},q:function(date,token,localize){const quarter=Math.ceil((date.getMonth()+1)/3);switch(token){case"q":return String(quarter);case"qq":return addLeadingZeros(quarter,2);case"qo":return localize.ordinalNumber(quarter,{unit:"quarter"});case"qqq":return localize.quarter(quarter,{width:"abbreviated",context:"standalone"});case"qqqqq":return localize.quarter(quarter,{width:"narrow",context:"standalone"});case"qqqq":default:return localize.quarter(quarter,{width:"wide",context:"standalone"})}},M:function(date,token,localize){const month=date.getMonth();switch(token){case"M":case"MM":return lightFormatters.M(date,token);case"Mo":return localize.ordinalNumber(month+1,{unit:"month"});case"MMM":return localize.month(month,{width:"abbreviated",context:"formatting"});case"MMMMM":return localize.month(month,{width:"narrow",context:"formatting"});case"MMMM":default:return localize.month(month,{width:"wide",context:"formatting"})}},L:function(date,token,localize){const month=date.getMonth();switch(token){case"L":return String(month+1);case"LL":return addLeadingZeros(month+1,2);case"Lo":return localize.ordinalNumber(month+1,{unit:"month"});case"LLL":return localize.month(month,{width:"abbreviated",context:"standalone"});case"LLLLL":return localize.month(month,{width:"narrow",context:"standalone"});case"LLLL":default:return localize.month(month,{width:"wide",context:"standalone"})}},w:function(date,token,localize,options){const week=getWeek(date,options);if("wo"===token)return localize.ordinalNumber(week,{unit:"week"});return addLeadingZeros(week,token.length)},I:function(date,token,localize){const isoWeek=getISOWeek(date);if("Io"===token)return localize.ordinalNumber(isoWeek,{unit:"week"});return addLeadingZeros(isoWeek,token.length)},d:function(date,token,localize){if("do"===token)return localize.ordinalNumber(date.getDate(),{unit:"date"});return lightFormatters.d(date,token)},D:function(date,token,localize){const dayOfYear=getDayOfYear(date);if("Do"===token)return localize.ordinalNumber(dayOfYear,{unit:"dayOfYear"});return addLeadingZeros(dayOfYear,token.length)},E:function(date,token,localize){const dayOfWeek=date.getDay();switch(token){case"E":case"EE":case"EEE":return localize.day(dayOfWeek,{width:"abbreviated",context:"formatting"});case"EEEEE":return localize.day(dayOfWeek,{width:"narrow",context:"formatting"});case"EEEEEE":return localize.day(dayOfWeek,{width:"short",context:"formatting"});case"EEEE":default:return localize.day(dayOfWeek,{width:"wide",context:"formatting"})}},e:function(date,token,localize,options){const dayOfWeek=date.getDay();const localDayOfWeek=(dayOfWeek-options.weekStartsOn+8)%7||7;switch(token){case"e":return String(localDayOfWeek);case"ee":return addLeadingZeros(localDayOfWeek,2);case"eo":return localize.ordinalNumber(localDayOfWeek,{unit:"day"});case"eee":return localize.day(dayOfWeek,{width:"abbreviated",context:"formatting"});case"eeeee":return localize.day(dayOfWeek,{width:"narrow",context:"formatting"});case"eeeeee":return localize.day(dayOfWeek,{width:"short",context:"formatting"});case"eeee":default:return localize.day(dayOfWeek,{width:"wide",context:"formatting"})}},c:function(date,token,localize,options){const dayOfWeek=date.getDay();const localDayOfWeek=(dayOfWeek-options.weekStartsOn+8)%7||7;switch(token){case"c":return String(localDayOfWeek);case"cc":return addLeadingZeros(localDayOfWeek,token.length);case"co":return localize.ordinalNumber(localDayOfWeek,{unit:"day"});case"ccc":return localize.day(dayOfWeek,{width:"abbreviated",context:"standalone"});case"ccccc":return localize.day(dayOfWeek,{width:"narrow",context:"standalone"});case"cccccc":return localize.day(dayOfWeek,{width:"short",context:"standalone"});case"cccc":default:return localize.day(dayOfWeek,{width:"wide",context:"standalone"})}},i:function(date,token,localize){const dayOfWeek=date.getDay();const isoDayOfWeek=0===dayOfWeek?7:dayOfWeek;switch(token){case"i":return String(isoDayOfWeek);case"ii":return addLeadingZeros(isoDayOfWeek,token.length);case"io":return localize.ordinalNumber(isoDayOfWeek,{unit:"day"});case"iii":return localize.day(dayOfWeek,{width:"abbreviated",context:"formatting"});case"iiiii":return localize.day(dayOfWeek,{width:"narrow",context:"formatting"});case"iiiiii":return localize.day(dayOfWeek,{width:"short",context:"formatting"});case"iiii":default:return localize.day(dayOfWeek,{width:"wide",context:"formatting"})}},a:function(date,token,localize){const hours=date.getHours();const dayPeriodEnumValue=hours/12>=1?"pm":"am";switch(token){case"a":case"aa":return localize.dayPeriod(dayPeriodEnumValue,{width:"abbreviated",context:"formatting"});case"aaa":return localize.dayPeriod(dayPeriodEnumValue,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return localize.dayPeriod(dayPeriodEnumValue,{width:"narrow",context:"formatting"});case"aaaa":default:return localize.dayPeriod(dayPeriodEnumValue,{width:"wide",context:"formatting"})}},b:function(date,token,localize){const hours=date.getHours();let dayPeriodEnumValue;dayPeriodEnumValue=12===hours?dayPeriodEnum.noon:0===hours?dayPeriodEnum.midnight:hours/12>=1?"pm":"am";switch(token){case"b":case"bb":return localize.dayPeriod(dayPeriodEnumValue,{width:"abbreviated",context:"formatting"});case"bbb":return localize.dayPeriod(dayPeriodEnumValue,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return localize.dayPeriod(dayPeriodEnumValue,{width:"narrow",context:"formatting"});case"bbbb":default:return localize.dayPeriod(dayPeriodEnumValue,{width:"wide",context:"formatting"})}},B:function(date,token,localize){const hours=date.getHours();let dayPeriodEnumValue;dayPeriodEnumValue=hours>=17?dayPeriodEnum.evening:hours>=12?dayPeriodEnum.afternoon:hours>=4?dayPeriodEnum.morning:dayPeriodEnum.night;switch(token){case"B":case"BB":case"BBB":return localize.dayPeriod(dayPeriodEnumValue,{width:"abbreviated",context:"formatting"});case"BBBBB":return localize.dayPeriod(dayPeriodEnumValue,{width:"narrow",context:"formatting"});case"BBBB":default:return localize.dayPeriod(dayPeriodEnumValue,{width:"wide",context:"formatting"})}},h:function(date,token,localize){if("ho"===token){let hours=date.getHours()%12;if(0===hours)hours=12;return localize.ordinalNumber(hours,{unit:"hour"})}return lightFormatters.h(date,token)},H:function(date,token,localize){if("Ho"===token)return localize.ordinalNumber(date.getHours(),{unit:"hour"});return lightFormatters.H(date,token)},K:function(date,token,localize){const hours=date.getHours()%12;if("Ko"===token)return localize.ordinalNumber(hours,{unit:"hour"});return addLeadingZeros(hours,token.length)},k:function(date,token,localize){let hours=date.getHours();if(0===hours)hours=24;if("ko"===token)return localize.ordinalNumber(hours,{unit:"hour"});return addLeadingZeros(hours,token.length)},m:function(date,token,localize){if("mo"===token)return localize.ordinalNumber(date.getMinutes(),{unit:"minute"});return lightFormatters.m(date,token)},s:function(date,token,localize){if("so"===token)return localize.ordinalNumber(date.getSeconds(),{unit:"second"});return lightFormatters.s(date,token)},S:function(date,token){return lightFormatters.S(date,token)},X:function(date,token,_localize){const timezoneOffset=date.getTimezoneOffset();if(0===timezoneOffset)return"Z";switch(token){case"X":return formatTimezoneWithOptionalMinutes(timezoneOffset);case"XXXX":case"XX":return formatTimezone(timezoneOffset);case"XXXXX":case"XXX":default:return formatTimezone(timezoneOffset,":")}},x:function(date,token,_localize){const timezoneOffset=date.getTimezoneOffset();switch(token){case"x":return formatTimezoneWithOptionalMinutes(timezoneOffset);case"xxxx":case"xx":return formatTimezone(timezoneOffset);case"xxxxx":case"xxx":default:return formatTimezone(timezoneOffset,":")}},O:function(date,token,_localize){const timezoneOffset=date.getTimezoneOffset();switch(token){case"O":case"OO":case"OOO":return"GMT"+formatTimezoneShort(timezoneOffset,":");case"OOOO":default:return"GMT"+formatTimezone(timezoneOffset,":")}},z:function(date,token,_localize){const timezoneOffset=date.getTimezoneOffset();switch(token){case"z":case"zz":case"zzz":return"GMT"+formatTimezoneShort(timezoneOffset,":");case"zzzz":default:return"GMT"+formatTimezone(timezoneOffset,":")}},t:function(date,token,_localize){const timestamp=Math.trunc(date/1e3);return addLeadingZeros(timestamp,token.length)},T:function(date,token,_localize){return addLeadingZeros(+date,token.length)}};function formatTimezoneShort(offset,delimiter=""){const sign=offset>0?"-":"+";const absOffset=Math.abs(offset);const hours=Math.trunc(absOffset/60);const minutes=absOffset%60;if(0===minutes)return sign+String(hours);return sign+String(hours)+delimiter+addLeadingZeros(minutes,2)}function formatTimezoneWithOptionalMinutes(offset,delimiter){if(offset%60===0){const sign=offset>0?"-":"+";return sign+addLeadingZeros(Math.abs(offset)/60,2)}return formatTimezone(offset,delimiter)}function formatTimezone(offset,delimiter=""){const sign=offset>0?"-":"+";const absOffset=Math.abs(offset);const hours=addLeadingZeros(Math.trunc(absOffset/60),2);const minutes=addLeadingZeros(absOffset%60,2);return sign+hours+delimiter+minutes}const dateLongFormatter=(pattern,formatLong)=>{switch(pattern){case"P":return formatLong.date({width:"short"});case"PP":return formatLong.date({width:"medium"});case"PPP":return formatLong.date({width:"long"});case"PPPP":default:return formatLong.date({width:"full"})}};const timeLongFormatter=(pattern,formatLong)=>{switch(pattern){case"p":return formatLong.time({width:"short"});case"pp":return formatLong.time({width:"medium"});case"ppp":return formatLong.time({width:"long"});case"pppp":default:return formatLong.time({width:"full"})}};const dateTimeLongFormatter=(pattern,formatLong)=>{const matchResult=pattern.match(/(P+)(p+)?/)||[];const datePattern=matchResult[1];const timePattern=matchResult[2];if(!timePattern)return dateLongFormatter(pattern,formatLong);let dateTimeFormat;switch(datePattern){case"P":dateTimeFormat=formatLong.dateTime({width:"short"});break;case"PP":dateTimeFormat=formatLong.dateTime({width:"medium"});break;case"PPP":dateTimeFormat=formatLong.dateTime({width:"long"});break;case"PPPP":default:dateTimeFormat=formatLong.dateTime({width:"full"});break}return dateTimeFormat.replace("{{date}}",dateLongFormatter(datePattern,formatLong)).replace("{{time}}",timeLongFormatter(timePattern,formatLong))};const longFormatters={p:timeLongFormatter,P:dateTimeLongFormatter};const dayOfYearTokenRE=/^D+$/;const weekYearTokenRE=/^Y+$/;const throwTokens=["D","DD","YY","YYYY"];function isProtectedDayOfYearToken(token){return dayOfYearTokenRE.test(token)}function isProtectedWeekYearToken(token){return weekYearTokenRE.test(token)}function warnOrThrowProtectedError(token,format,input){const _message=message(token,format,input);console.warn(_message);if(throwTokens.includes(token))throw new RangeError(_message)}function message(token,format,input){const subject="Y"===token[0]?"years":"days of the month";return`Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const formattingTokensRegExp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;const longFormattingTokensRegExp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;const escapedStringRegExp=/^'([^]*?)'?$/;const doubleQuoteRegExp=/''/g;const unescapedLatinCharacterRegExp=/[a-zA-Z]/;function format_format(date,formatStr,options){const defaultOptions=getDefaultOptions();const locale=options?.locale??defaultOptions.locale??enUS;const firstWeekContainsDate=options?.firstWeekContainsDate??options?.locale?.options?.firstWeekContainsDate??defaultOptions.firstWeekContainsDate??defaultOptions.locale?.options?.firstWeekContainsDate??1;const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const originalDate=toDate(date,options?.in);if(!isValid_isValid(originalDate))throw new RangeError("Invalid time value");let parts=formatStr.match(longFormattingTokensRegExp).map(substring=>{const firstCharacter=substring[0];if("p"===firstCharacter||"P"===firstCharacter){const longFormatter=longFormatters[firstCharacter];return longFormatter(substring,locale.formatLong)}return substring}).join("").match(formattingTokensRegExp).map(substring=>{if("''"===substring)return{isToken:false,value:"'"};const firstCharacter=substring[0];if("'"===firstCharacter)return{isToken:false,value:cleanEscapedString(substring)};if(formatters[firstCharacter])return{isToken:true,value:substring};if(firstCharacter.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+firstCharacter+"`");return{isToken:false,value:substring}});if(locale.localize.preprocessor)parts=locale.localize.preprocessor(originalDate,parts);const formatterOptions={firstWeekContainsDate,weekStartsOn,locale};return parts.map(part=>{if(!part.isToken)return part.value;const token=part.value;if(!options?.useAdditionalWeekYearTokens&&isProtectedWeekYearToken(token)||!options?.useAdditionalDayOfYearTokens&&isProtectedDayOfYearToken(token))warnOrThrowProtectedError(token,formatStr,String(date));const formatter=formatters[token[0]];return formatter(originalDate,token,locale.localize,formatterOptions)}).join("")}function cleanEscapedString(input){const matched=input.match(escapedStringRegExp);if(!matched)return input;return matched[1].replace(doubleQuoteRegExp,"'")}function formatDistance_formatDistance(laterDate,earlierDate,options){const defaultOptions=getDefaultOptions();const locale=options?.locale??defaultOptions.locale??enUS;const minutesInAlmostTwoDays=2520;const comparison=compareAsc_compareAsc(laterDate,earlierDate);if(isNaN(comparison))throw new RangeError("Invalid time value");const localizeOptions=Object.assign({},options,{addSuffix:options?.addSuffix,comparison:comparison});const[laterDate_,earlierDate_]=normalizeDates(options?.in,...comparison>0?[earlierDate,laterDate]:[laterDate,earlierDate]);const seconds=differenceInSeconds_differenceInSeconds(earlierDate_,laterDate_);const offsetInSeconds=(getTimezoneOffsetInMilliseconds(earlierDate_)-getTimezoneOffsetInMilliseconds(laterDate_))/1e3;const minutes=Math.round((seconds-offsetInSeconds)/60);let months;if(minutes<2)if(options?.includeSeconds)if(seconds<5)return locale.formatDistance("lessThanXSeconds",5,localizeOptions);else if(seconds<10)return locale.formatDistance("lessThanXSeconds",10,localizeOptions);else if(seconds<20)return locale.formatDistance("lessThanXSeconds",20,localizeOptions);else if(seconds<40)return locale.formatDistance("halfAMinute",0,localizeOptions);else if(seconds<60)return locale.formatDistance("lessThanXMinutes",1,localizeOptions);else return locale.formatDistance("xMinutes",1,localizeOptions);else if(0===minutes)return locale.formatDistance("lessThanXMinutes",1,localizeOptions);else return locale.formatDistance("xMinutes",minutes,localizeOptions);if(minutes<45)return locale.formatDistance("xMinutes",minutes,localizeOptions);if(minutes<90)return locale.formatDistance("aboutXHours",1,localizeOptions);if(minutes<1440){const hours=Math.round(minutes/60);return locale.formatDistance("aboutXHours",hours,localizeOptions)}if(minutes<minutesInAlmostTwoDays)return locale.formatDistance("xDays",1,localizeOptions);else if(minutes<43200){const days=Math.round(minutes/1440);return locale.formatDistance("xDays",days,localizeOptions)}else if(minutes<86400){months=Math.round(minutes/43200);return locale.formatDistance("aboutXMonths",months,localizeOptions)}months=differenceInMonths_differenceInMonths(earlierDate_,laterDate_);if(months<12){const nearestMonth=Math.round(minutes/43200);return locale.formatDistance("xMonths",nearestMonth,localizeOptions)}{const monthsSinceStartOfYear=months%12;const years=Math.trunc(months/12);if(monthsSinceStartOfYear<3)return locale.formatDistance("aboutXYears",years,localizeOptions);if(monthsSinceStartOfYear<9)return locale.formatDistance("overXYears",years,localizeOptions);return locale.formatDistance("almostXYears",years+1,localizeOptions)}}function formatDistanceStrict(laterDate,earlierDate,options){const defaultOptions=getDefaultOptions();const locale=options?.locale??defaultOptions.locale??enUS;const comparison=compareAsc_compareAsc(laterDate,earlierDate);if(isNaN(comparison))throw new RangeError("Invalid time value");const localizeOptions=Object.assign({},options,{addSuffix:options?.addSuffix,comparison:comparison});const[laterDate_,earlierDate_]=normalizeDates(options?.in,...comparison>0?[earlierDate,laterDate]:[laterDate,earlierDate]);const roundingMethod=getRoundingMethod(options?.roundingMethod??"round");const milliseconds=earlierDate_.getTime()-laterDate_.getTime();const minutes=milliseconds/6e4;const timezoneOffset=getTimezoneOffsetInMilliseconds(earlierDate_)-getTimezoneOffsetInMilliseconds(laterDate_);const dstNormalizedMinutes=(milliseconds-timezoneOffset)/6e4;const defaultUnit=options?.unit;let unit;unit=defaultUnit?defaultUnit:minutes<1?"second":minutes<60?"minute":minutes<1440?"hour":dstNormalizedMinutes<43200?"day":dstNormalizedMinutes<525600?"month":"year";if("second"===unit){const seconds=roundingMethod(milliseconds/1e3);return locale.formatDistance("xSeconds",seconds,localizeOptions)}if("minute"===unit){const roundedMinutes=roundingMethod(minutes);return locale.formatDistance("xMinutes",roundedMinutes,localizeOptions)}if("hour"===unit){const hours=roundingMethod(minutes/60);return locale.formatDistance("xHours",hours,localizeOptions)}if("day"===unit){const days=roundingMethod(dstNormalizedMinutes/1440);return locale.formatDistance("xDays",days,localizeOptions)}if("month"===unit){const months=roundingMethod(dstNormalizedMinutes/43200);return 12===months&&"month"!==defaultUnit?locale.formatDistance("xYears",1,localizeOptions):locale.formatDistance("xMonths",months,localizeOptions)}else{const years=roundingMethod(dstNormalizedMinutes/525600);return locale.formatDistance("xYears",years,localizeOptions)}}function formatDistanceToNow(date,options){return formatDistance_formatDistance(date,constructNow(date),options)}function formatDistanceToNowStrict(date,options){return formatDistanceStrict(date,constructNow(date),options)}const defaultFormat=["years","months","weeks","days","hours","minutes","seconds"];function formatDuration(duration,options){const defaultOptions=getDefaultOptions();const locale=options?.locale??defaultOptions.locale??enUS;const format=options?.format??defaultFormat;const zero=options?.zero??false;const delimiter=options?.delimiter??" ";if(!locale.formatDistance)return"";const result=format.reduce((acc,unit)=>{const token=`x${unit.replace(/(^.)/,m=>m.toUpperCase())}`;const value=duration[unit];if(void 0!==value&&(zero||duration[unit]))return acc.concat(locale.formatDistance(token,value));return acc},[]).join(delimiter);return result}function formatISO_formatISO(date,options){const date_=toDate(date,options?.in);if(isNaN(+date_))throw new RangeError("Invalid time value");const format=options?.format??"extended";const representation=options?.representation??"complete";let result="";let tzOffset="";const dateDelimiter="extended"===format?"-":"";const timeDelimiter="extended"===format?":":"";if("time"!==representation){const day=addLeadingZeros(date_.getDate(),2);const month=addLeadingZeros(date_.getMonth()+1,2);const year=addLeadingZeros(date_.getFullYear(),4);result=`${year}${dateDelimiter}${month}${dateDelimiter}${day}`}if("date"!==representation){const offset=date_.getTimezoneOffset();if(0!==offset){const absoluteOffset=Math.abs(offset);const hourOffset=addLeadingZeros(Math.trunc(absoluteOffset/60),2);const minuteOffset=addLeadingZeros(absoluteOffset%60,2);const sign=offset<0?"+":"-";tzOffset=`${sign}${hourOffset}:${minuteOffset}`}else tzOffset="Z";const hour=addLeadingZeros(date_.getHours(),2);const minute=addLeadingZeros(date_.getMinutes(),2);const second=addLeadingZeros(date_.getSeconds(),2);const separator=""===result?"":"T";const time=[hour,minute,second].join(timeDelimiter);result=`${result}${separator}${time}${tzOffset}`}return result}function formatISO9075_formatISO9075(date,options){const date_=toDate(date,options?.in);if(!isValid_isValid(date_))throw new RangeError("Invalid time value");const format=options?.format??"extended";const representation=options?.representation??"complete";let result="";const dateDelimiter="extended"===format?"-":"";const timeDelimiter="extended"===format?":":"";if("time"!==representation){const day=addLeadingZeros(date_.getDate(),2);const month=addLeadingZeros(date_.getMonth()+1,2);const year=addLeadingZeros(date_.getFullYear(),4);result=`${year}${dateDelimiter}${month}${dateDelimiter}${day}`}if("date"!==representation){const hour=addLeadingZeros(date_.getHours(),2);const minute=addLeadingZeros(date_.getMinutes(),2);const second=addLeadingZeros(date_.getSeconds(),2);const separator=""===result?"":" ";result=`${result}${separator}${hour}${timeDelimiter}${minute}${timeDelimiter}${second}`}return result}function formatISODuration_formatISODuration(duration){const{years=0,months=0,days=0,hours=0,minutes=0,seconds=0}=duration;return`P${years}Y${months}M${days}DT${hours}H${minutes}M${seconds}S`}function formatRFC3339_formatRFC3339(date,options){const date_=toDate(date,options?.in);if(!isValid_isValid(date_))throw new RangeError("Invalid time value");const fractionDigits=options?.fractionDigits??0;const day=addLeadingZeros(date_.getDate(),2);const month=addLeadingZeros(date_.getMonth()+1,2);const year=date_.getFullYear();const hour=addLeadingZeros(date_.getHours(),2);const minute=addLeadingZeros(date_.getMinutes(),2);const second=addLeadingZeros(date_.getSeconds(),2);let fractionalSecond="";if(fractionDigits>0){const milliseconds=date_.getMilliseconds();const fractionalSeconds=Math.trunc(milliseconds*Math.pow(10,fractionDigits-3));fractionalSecond="."+addLeadingZeros(fractionalSeconds,fractionDigits)}let offset="";const tzOffset=date_.getTimezoneOffset();if(0!==tzOffset){const absoluteOffset=Math.abs(tzOffset);const hourOffset=addLeadingZeros(Math.trunc(absoluteOffset/60),2);const minuteOffset=addLeadingZeros(absoluteOffset%60,2);const sign=tzOffset<0?"+":"-";offset=`${sign}${hourOffset}:${minuteOffset}`}else offset="Z";return`${year}-${month}-${day}T${hour}:${minute}:${second}${fractionalSecond}${offset}`}const formatRFC7231_days=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];const formatRFC7231_months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function formatRFC7231(date){const _date=toDate(date);if(!isValid_isValid(_date))throw new RangeError("Invalid time value");const dayName=formatRFC7231_days[_date.getUTCDay()];const dayOfMonth=addLeadingZeros(_date.getUTCDate(),2);const monthName=formatRFC7231_months[_date.getUTCMonth()];const year=_date.getUTCFullYear();const hour=addLeadingZeros(_date.getUTCHours(),2);const minute=addLeadingZeros(_date.getUTCMinutes(),2);const second=addLeadingZeros(_date.getUTCSeconds(),2);return`${dayName}, ${dayOfMonth} ${monthName} ${year} ${hour}:${minute}:${second} GMT`}function formatRelative_formatRelative(date,baseDate,options){const[date_,baseDate_]=normalizeDates(options?.in,date,baseDate);const defaultOptions=getDefaultOptions();const locale=options?.locale??defaultOptions.locale??enUS;const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const diff=differenceInCalendarDays(date_,baseDate_);if(isNaN(diff))throw new RangeError("Invalid time value");let token;token=diff<-6?"other":diff<-1?"lastWeek":diff<0?"yesterday":diff<1?"today":diff<2?"tomorrow":diff<7?"nextWeek":"other";const formatStr=locale.formatRelative(token,date_,baseDate_,{locale,weekStartsOn});return format_format(date_,formatStr,{locale,weekStartsOn})}function fromUnixTime(unixTime,options){return toDate(1e3*unixTime,options?.in)}function getDate(date,options){return toDate(date,options?.in).getDate()}function getDay(date,options){return toDate(date,options?.in).getDay()}function getDaysInMonth(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const monthIndex=_date.getMonth();const lastDayOfMonth=constructFrom_constructFrom(_date,0);lastDayOfMonth.setFullYear(year,monthIndex+1,0);lastDayOfMonth.setHours(0,0,0,0);return lastDayOfMonth.getDate()}function isLeapYear_isLeapYear(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();return year%400===0||year%4===0&&year%100!==0}function getDaysInYear(date,options){const _date=toDate(date,options?.in);if(Number.isNaN(+_date))return NaN;return isLeapYear_isLeapYear(_date)?366:365}function getDecade(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const decade=10*Math.floor(year/10);return decade}function getDefaultOptions_getDefaultOptions(){return Object.assign({},getDefaultOptions())}function getHours(date,options){return toDate(date,options?.in).getHours()}function getISODay(date,options){const day=toDate(date,options?.in).getDay();return 0===day?7:day}function getISOWeeksInYear(date,options){const thisYear=startOfISOWeekYear(date,options);const nextYear=startOfISOWeekYear(addWeeks(thisYear,60));const diff=nextYear-thisYear;return Math.round(diff/millisecondsInWeek)}function getMilliseconds_getMilliseconds(date){return toDate(date).getMilliseconds()}function getMinutes(date,options){return toDate(date,options?.in).getMinutes()}function getMonth(date,options){return toDate(date,options?.in).getMonth()}function getOverlappingDaysInIntervals_getOverlappingDaysInIntervals(intervalLeft,intervalRight){const[leftStart,leftEnd]=[+toDate(intervalLeft.start),+toDate(intervalLeft.end)].sort((a,b)=>a-b);const[rightStart,rightEnd]=[+toDate(intervalRight.start),+toDate(intervalRight.end)].sort((a,b)=>a-b);const isOverlapping=leftStart<rightEnd&&rightStart<leftEnd;if(!isOverlapping)return 0;const overlapLeft=rightStart<leftStart?leftStart:rightStart;const left=overlapLeft-getTimezoneOffsetInMilliseconds(overlapLeft);const overlapRight=rightEnd>leftEnd?leftEnd:rightEnd;const right=overlapRight-getTimezoneOffsetInMilliseconds(overlapRight);return Math.ceil((right-left)/millisecondsInDay)}function getSeconds(date){return toDate(date).getSeconds()}function getTime(date){return+toDate(date)}function getUnixTime(date){return Math.trunc(toDate(date)/1e3)}function getWeekOfMonth(date,options){const defaultOptions=getDefaultOptions();const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const currentDayOfMonth=getDate(toDate(date,options?.in));if(isNaN(currentDayOfMonth))return NaN;const startWeekDay=getDay(startOfMonth(date,options));let lastDayOfFirstWeek=weekStartsOn-startWeekDay;if(lastDayOfFirstWeek<=0)lastDayOfFirstWeek+=7;const remainingDaysAfterFirstWeek=currentDayOfMonth-lastDayOfFirstWeek;return Math.ceil(remainingDaysAfterFirstWeek/7)+1}function lastDayOfMonth_lastDayOfMonth(date,options){const _date=toDate(date,options?.in);const month=_date.getMonth();_date.setFullYear(_date.getFullYear(),month+1,0);_date.setHours(0,0,0,0);return toDate(_date,options?.in)}function getWeeksInMonth(date,options){const contextDate=toDate(date,options?.in);return differenceInCalendarWeeks(lastDayOfMonth_lastDayOfMonth(contextDate,options),startOfMonth(contextDate,options),options)+1}function getYear(date,options){return toDate(date,options?.in).getFullYear()}function hoursToMilliseconds(hours){return Math.trunc(hours*millisecondsInHour)}function hoursToMinutes(hours){return Math.trunc(60*hours)}function hoursToSeconds(hours){return Math.trunc(3600*hours)}function interval_interval(start,end,options){const[_start,_end]=normalizeDates(options?.in,start,end);if(isNaN(+_start))throw new TypeError("Start date is invalid");if(isNaN(+_end))throw new TypeError("End date is invalid");if(options?.assertPositive&&+_start>+_end)throw new TypeError("End date must be after start date");return{start:_start,end:_end}}function intervalToDuration_intervalToDuration(interval,options){const{start,end}=normalizeInterval(options?.in,interval);const duration={};const years=differenceInYears(end,start);if(years)duration.years=years;const remainingMonths=add(start,{years:duration.years});const months=differenceInMonths_differenceInMonths(end,remainingMonths);if(months)duration.months=months;const remainingDays=add(remainingMonths,{months:duration.months});const days=differenceInDays_differenceInDays(end,remainingDays);if(days)duration.days=days;const remainingHours=add(remainingDays,{days:duration.days});const hours=differenceInHours(end,remainingHours);if(hours)duration.hours=hours;const remainingMinutes=add(remainingHours,{hours:duration.hours});const minutes=differenceInMinutes(end,remainingMinutes);if(minutes)duration.minutes=minutes;const remainingSeconds=add(remainingMinutes,{minutes:duration.minutes});const seconds=differenceInSeconds_differenceInSeconds(end,remainingSeconds);if(seconds)duration.seconds=seconds;return duration}function intlFormat(date,formatOrLocale,localeOptions){let formatOptions;if(isFormatOptions(formatOrLocale))formatOptions=formatOrLocale;else localeOptions=formatOrLocale;return new Intl.DateTimeFormat(localeOptions?.locale,formatOptions).format(toDate(date))}function isFormatOptions(opts){return void 0!==opts&&!("locale"in opts)}function intlFormatDistance_intlFormatDistance(laterDate,earlierDate,options){let value=0;let unit;const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);if(options?.unit){unit=options?.unit;if("second"===unit)value=differenceInSeconds_differenceInSeconds(laterDate_,earlierDate_);else if("minute"===unit)value=differenceInMinutes(laterDate_,earlierDate_);else if("hour"===unit)value=differenceInHours(laterDate_,earlierDate_);else if("day"===unit)value=differenceInCalendarDays(laterDate_,earlierDate_);else if("week"===unit)value=differenceInCalendarWeeks(laterDate_,earlierDate_);else if("month"===unit)value=differenceInCalendarMonths(laterDate_,earlierDate_);else if("quarter"===unit)value=differenceInCalendarQuarters(laterDate_,earlierDate_);else if("year"===unit)value=differenceInCalendarYears(laterDate_,earlierDate_)}else{const diffInSeconds=differenceInSeconds_differenceInSeconds(laterDate_,earlierDate_);if(Math.abs(diffInSeconds)<60){value=differenceInSeconds_differenceInSeconds(laterDate_,earlierDate_);unit="second"}else if(Math.abs(diffInSeconds)<3600){value=differenceInMinutes(laterDate_,earlierDate_);unit="minute"}else if(Math.abs(diffInSeconds)<86400&&Math.abs(differenceInCalendarDays(laterDate_,earlierDate_))<1){value=differenceInHours(laterDate_,earlierDate_);unit="hour"}else if(Math.abs(diffInSeconds)<604800&&(value=differenceInCalendarDays(laterDate_,earlierDate_))&&Math.abs(value)<7)unit="day";else if(Math.abs(diffInSeconds)<secondsInMonth){value=differenceInCalendarWeeks(laterDate_,earlierDate_);unit="week"}else if(Math.abs(diffInSeconds)<secondsInQuarter){value=differenceInCalendarMonths(laterDate_,earlierDate_);unit="month"}else if(Math.abs(diffInSeconds)<secondsInYear)if(differenceInCalendarQuarters(laterDate_,earlierDate_)<4){value=differenceInCalendarQuarters(laterDate_,earlierDate_);unit="quarter"}else{value=differenceInCalendarYears(laterDate_,earlierDate_);unit="year"}else{value=differenceInCalendarYears(laterDate_,earlierDate_);unit="year"}}const rtf=new Intl.RelativeTimeFormat(options?.locale,{numeric:"auto",...options});return rtf.format(value,unit)}function isAfter(date,dateToCompare){return+toDate(date)>+toDate(dateToCompare)}function isBefore_isBefore(date,dateToCompare){return+toDate(date)<+toDate(dateToCompare)}function isEqual(leftDate,rightDate){return+toDate(leftDate)===+toDate(rightDate)}function isExists_isExists(year,month,day){const date=new Date(year,month,day);return date.getFullYear()===year&&date.getMonth()===month&&date.getDate()===day}function isFirstDayOfMonth(date,options){return 1===toDate(date,options?.in).getDate()}function isFriday(date,options){return 5===toDate(date,options?.in).getDay()}function isFuture(date){return+toDate(date)>Date.now()}function transpose_transpose(date,constructor){const date_=isConstructor(constructor)?new constructor(0):constructFrom_constructFrom(constructor,0);date_.setFullYear(date.getFullYear(),date.getMonth(),date.getDate());date_.setHours(date.getHours(),date.getMinutes(),date.getSeconds(),date.getMilliseconds());return date_}function isConstructor(constructor){return"function"==typeof constructor&&constructor.prototype?.constructor===constructor}const TIMEZONE_UNIT_PRIORITY=10;class Setter{subPriority=0;validate(_utcDate,_options){return true}}class ValueSetter extends Setter{constructor(value,validateValue,setValue,priority,subPriority){super();this.value=value;this.validateValue=validateValue;this.setValue=setValue;this.priority=priority;if(subPriority)this.subPriority=subPriority}validate(date,options){return this.validateValue(date,this.value,options)}set(date,flags,options){return this.setValue(date,flags,this.value,options)}}class DateTimezoneSetter extends Setter{priority=TIMEZONE_UNIT_PRIORITY;subPriority=-1;constructor(context,reference){super();this.context=context||(date=>constructFrom_constructFrom(reference,date))}set(date,flags){if(flags.timestampIsSet)return date;return constructFrom_constructFrom(date,transpose_transpose(date,this.context))}}class Parser{run(dateString,token,match,options){const result=this.parse(dateString,token,match,options);if(!result)return null;return{setter:new ValueSetter(result.value,this.validate,this.set,this.priority,this.subPriority),rest:result.rest}}validate(_utcDate,_value,_options){return true}}class EraParser extends Parser{priority=140;parse(dateString,token,match){switch(token){case"G":case"GG":case"GGG":return match.era(dateString,{width:"abbreviated"})||match.era(dateString,{width:"narrow"});case"GGGGG":return match.era(dateString,{width:"narrow"});case"GGGG":default:return match.era(dateString,{width:"wide"})||match.era(dateString,{width:"abbreviated"})||match.era(dateString,{width:"narrow"})}}set(date,flags,value){flags.era=value;date.setFullYear(value,0,1);date.setHours(0,0,0,0);return date}incompatibleTokens=["R","u","t","T"]}const numericPatterns={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/};const timezonePatterns={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function mapValue(parseFnResult,mapFn){if(!parseFnResult)return parseFnResult;return{value:mapFn(parseFnResult.value),rest:parseFnResult.rest}}function parseNumericPattern(pattern,dateString){const matchResult=dateString.match(pattern);if(!matchResult)return null;return{value:parseInt(matchResult[0],10),rest:dateString.slice(matchResult[0].length)}}function parseTimezonePattern(pattern,dateString){const matchResult=dateString.match(pattern);if(!matchResult)return null;if("Z"===matchResult[0])return{value:0,rest:dateString.slice(1)};const sign="+"===matchResult[1]?1:-1;const hours=matchResult[2]?parseInt(matchResult[2],10):0;const minutes=matchResult[3]?parseInt(matchResult[3],10):0;const seconds=matchResult[5]?parseInt(matchResult[5],10):0;return{value:sign*(hours*millisecondsInHour+6e4*minutes+1e3*seconds),rest:dateString.slice(matchResult[0].length)}}function parseAnyDigitsSigned(dateString){return parseNumericPattern(numericPatterns.anyDigitsSigned,dateString)}function parseNDigits(n,dateString){switch(n){case 1:return parseNumericPattern(numericPatterns.singleDigit,dateString);case 2:return parseNumericPattern(numericPatterns.twoDigits,dateString);case 3:return parseNumericPattern(numericPatterns.threeDigits,dateString);case 4:return parseNumericPattern(numericPatterns.fourDigits,dateString);default:return parseNumericPattern(new RegExp("^\\d{1,"+n+"}"),dateString)}}function parseNDigitsSigned(n,dateString){switch(n){case 1:return parseNumericPattern(numericPatterns.singleDigitSigned,dateString);case 2:return parseNumericPattern(numericPatterns.twoDigitsSigned,dateString);case 3:return parseNumericPattern(numericPatterns.threeDigitsSigned,dateString);case 4:return parseNumericPattern(numericPatterns.fourDigitsSigned,dateString);default:return parseNumericPattern(new RegExp("^-?\\d{1,"+n+"}"),dateString)}}function dayPeriodEnumToHours(dayPeriod){switch(dayPeriod){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function normalizeTwoDigitYear(twoDigitYear,currentYear){const isCommonEra=currentYear>0;const absCurrentYear=isCommonEra?currentYear:1-currentYear;let result;if(absCurrentYear<=50)result=twoDigitYear||100;else{const rangeEnd=absCurrentYear+50;const rangeEndCentury=100*Math.trunc(rangeEnd/100);const isPreviousCentury=twoDigitYear>=rangeEnd%100;result=twoDigitYear+rangeEndCentury-(isPreviousCentury?100:0)}return isCommonEra?result:1-result}function isLeapYearIndex(year){return year%400===0||year%4===0&&year%100!==0}class YearParser extends Parser{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(dateString,token,match){const valueCallback=year=>({year,isTwoDigitYear:"yy"===token});switch(token){case"y":return mapValue(parseNDigits(4,dateString),valueCallback);case"yo":return mapValue(match.ordinalNumber(dateString,{unit:"year"}),valueCallback);default:return mapValue(parseNDigits(token.length,dateString),valueCallback)}}validate(_date,value){return value.isTwoDigitYear||value.year>0}set(date,flags,value){const currentYear=date.getFullYear();if(value.isTwoDigitYear){const normalizedTwoDigitYear=normalizeTwoDigitYear(value.year,currentYear);date.setFullYear(normalizedTwoDigitYear,0,1);date.setHours(0,0,0,0);return date}const year="era"in flags&&1!==flags.era?1-value.year:value.year;date.setFullYear(year,0,1);date.setHours(0,0,0,0);return date}}class LocalWeekYearParser extends Parser{priority=130;parse(dateString,token,match){const valueCallback=year=>({year,isTwoDigitYear:"YY"===token});switch(token){case"Y":return mapValue(parseNDigits(4,dateString),valueCallback);case"Yo":return mapValue(match.ordinalNumber(dateString,{unit:"year"}),valueCallback);default:return mapValue(parseNDigits(token.length,dateString),valueCallback)}}validate(_date,value){return value.isTwoDigitYear||value.year>0}set(date,flags,value,options){const currentYear=getWeekYear(date,options);if(value.isTwoDigitYear){const normalizedTwoDigitYear=normalizeTwoDigitYear(value.year,currentYear);date.setFullYear(normalizedTwoDigitYear,0,options.firstWeekContainsDate);date.setHours(0,0,0,0);return startOfWeek(date,options)}const year="era"in flags&&1!==flags.era?1-value.year:value.year;date.setFullYear(year,0,options.firstWeekContainsDate);date.setHours(0,0,0,0);return startOfWeek(date,options)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class ISOWeekYearParser extends Parser{priority=130;parse(dateString,token){if("R"===token)return parseNDigitsSigned(4,dateString);return parseNDigitsSigned(token.length,dateString)}set(date,_flags,value){const firstWeekOfYear=constructFrom_constructFrom(date,0);firstWeekOfYear.setFullYear(value,0,4);firstWeekOfYear.setHours(0,0,0,0);return startOfISOWeek(firstWeekOfYear)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class ExtendedYearParser extends Parser{priority=130;parse(dateString,token){if("u"===token)return parseNDigitsSigned(4,dateString);return parseNDigitsSigned(token.length,dateString)}set(date,_flags,value){date.setFullYear(value,0,1);date.setHours(0,0,0,0);return date}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class QuarterParser extends Parser{priority=120;parse(dateString,token,match){switch(token){case"Q":case"QQ":return parseNDigits(token.length,dateString);case"Qo":return match.ordinalNumber(dateString,{unit:"quarter"});case"QQQ":return match.quarter(dateString,{width:"abbreviated",context:"formatting"})||match.quarter(dateString,{width:"narrow",context:"formatting"});case"QQQQQ":return match.quarter(dateString,{width:"narrow",context:"formatting"});case"QQQQ":default:return match.quarter(dateString,{width:"wide",context:"formatting"})||match.quarter(dateString,{width:"abbreviated",context:"formatting"})||match.quarter(dateString,{width:"narrow",context:"formatting"})}}validate(_date,value){return value>=1&&value<=4}set(date,_flags,value){date.setMonth((value-1)*3,1);date.setHours(0,0,0,0);return date}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class StandAloneQuarterParser extends Parser{priority=120;parse(dateString,token,match){switch(token){case"q":case"qq":return parseNDigits(token.length,dateString);case"qo":return match.ordinalNumber(dateString,{unit:"quarter"});case"qqq":return match.quarter(dateString,{width:"abbreviated",context:"standalone"})||match.quarter(dateString,{width:"narrow",context:"standalone"});case"qqqqq":return match.quarter(dateString,{width:"narrow",context:"standalone"});case"qqqq":default:return match.quarter(dateString,{width:"wide",context:"standalone"})||match.quarter(dateString,{width:"abbreviated",context:"standalone"})||match.quarter(dateString,{width:"narrow",context:"standalone"})}}validate(_date,value){return value>=1&&value<=4}set(date,_flags,value){date.setMonth((value-1)*3,1);date.setHours(0,0,0,0);return date}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class MonthParser extends Parser{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(dateString,token,match){const valueCallback=value=>value-1;switch(token){case"M":return mapValue(parseNumericPattern(numericPatterns.month,dateString),valueCallback);case"MM":return mapValue(parseNDigits(2,dateString),valueCallback);case"Mo":return mapValue(match.ordinalNumber(dateString,{unit:"month"}),valueCallback);case"MMM":return match.month(dateString,{width:"abbreviated",context:"formatting"})||match.month(dateString,{width:"narrow",context:"formatting"});case"MMMMM":return match.month(dateString,{width:"narrow",context:"formatting"});case"MMMM":default:return match.month(dateString,{width:"wide",context:"formatting"})||match.month(dateString,{width:"abbreviated",context:"formatting"})||match.month(dateString,{width:"narrow",context:"formatting"})}}validate(_date,value){return value>=0&&value<=11}set(date,_flags,value){date.setMonth(value,1);date.setHours(0,0,0,0);return date}}class StandAloneMonthParser extends Parser{priority=110;parse(dateString,token,match){const valueCallback=value=>value-1;switch(token){case"L":return mapValue(parseNumericPattern(numericPatterns.month,dateString),valueCallback);case"LL":return mapValue(parseNDigits(2,dateString),valueCallback);case"Lo":return mapValue(match.ordinalNumber(dateString,{unit:"month"}),valueCallback);case"LLL":return match.month(dateString,{width:"abbreviated",context:"standalone"})||match.month(dateString,{width:"narrow",context:"standalone"});case"LLLLL":return match.month(dateString,{width:"narrow",context:"standalone"});case"LLLL":default:return match.month(dateString,{width:"wide",context:"standalone"})||match.month(dateString,{width:"abbreviated",context:"standalone"})||match.month(dateString,{width:"narrow",context:"standalone"})}}validate(_date,value){return value>=0&&value<=11}set(date,_flags,value){date.setMonth(value,1);date.setHours(0,0,0,0);return date}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function setWeek_setWeek(date,week,options){const date_=toDate(date,options?.in);const diff=getWeek(date_,options)-week;date_.setDate(date_.getDate()-7*diff);return toDate(date_,options?.in)}class LocalWeekParser extends Parser{priority=100;parse(dateString,token,match){switch(token){case"w":return parseNumericPattern(numericPatterns.week,dateString);case"wo":return match.ordinalNumber(dateString,{unit:"week"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=1&&value<=53}set(date,_flags,value,options){return startOfWeek(setWeek_setWeek(date,value,options),options)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function setISOWeek(date,week,options){const _date=toDate(date,options?.in);const diff=getISOWeek(_date,options)-week;_date.setDate(_date.getDate()-7*diff);return _date}class ISOWeekParser extends Parser{priority=100;parse(dateString,token,match){switch(token){case"I":return parseNumericPattern(numericPatterns.week,dateString);case"Io":return match.ordinalNumber(dateString,{unit:"week"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=1&&value<=53}set(date,_flags,value){return startOfISOWeek(setISOWeek(date,value))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31];const DAYS_IN_MONTH_LEAP_YEAR=[31,29,31,30,31,30,31,31,30,31,30,31];class DateParser extends Parser{priority=90;subPriority=1;parse(dateString,token,match){switch(token){case"d":return parseNumericPattern(numericPatterns.date,dateString);case"do":return match.ordinalNumber(dateString,{unit:"date"});default:return parseNDigits(token.length,dateString)}}validate(date,value){const year=date.getFullYear();const isLeapYear=isLeapYearIndex(year);const month=date.getMonth();if(isLeapYear)return value>=1&&value<=DAYS_IN_MONTH_LEAP_YEAR[month];return value>=1&&value<=DAYS_IN_MONTH[month]}set(date,_flags,value){date.setDate(value);date.setHours(0,0,0,0);return date}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class DayOfYearParser extends Parser{priority=90;subpriority=1;parse(dateString,token,match){switch(token){case"D":case"DD":return parseNumericPattern(numericPatterns.dayOfYear,dateString);case"Do":return match.ordinalNumber(dateString,{unit:"date"});default:return parseNDigits(token.length,dateString)}}validate(date,value){const year=date.getFullYear();const isLeapYear=isLeapYearIndex(year);if(isLeapYear)return value>=1&&value<=366;return value>=1&&value<=365}set(date,_flags,value){date.setMonth(0,value);date.setHours(0,0,0,0);return date}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function setDay(date,day,options){const defaultOptions=getDefaultOptions();const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const date_=toDate(date,options?.in);const currentDay=date_.getDay();const remainder=day%7;const dayIndex=(remainder+7)%7;const delta=7-weekStartsOn;const diff=day<0||day>6?day-(currentDay+delta)%7:(dayIndex+delta)%7-(currentDay+delta)%7;return addDays(date_,diff,options)}class DayParser extends Parser{priority=90;parse(dateString,token,match){switch(token){case"E":case"EE":case"EEE":return match.day(dateString,{width:"abbreviated",context:"formatting"})||match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"});case"EEEEE":return match.day(dateString,{width:"narrow",context:"formatting"});case"EEEEEE":return match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"});case"EEEE":default:return match.day(dateString,{width:"wide",context:"formatting"})||match.day(dateString,{width:"abbreviated",context:"formatting"})||match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"})}}validate(_date,value){return value>=0&&value<=6}set(date,_flags,value,options){date=setDay(date,value,options);date.setHours(0,0,0,0);return date}incompatibleTokens=["D","i","e","c","t","T"]}class LocalDayParser extends Parser{priority=90;parse(dateString,token,match,options){const valueCallback=value=>{const wholeWeekDays=7*Math.floor((value-1)/7);return(value+options.weekStartsOn+6)%7+wholeWeekDays};switch(token){case"e":case"ee":return mapValue(parseNDigits(token.length,dateString),valueCallback);case"eo":return mapValue(match.ordinalNumber(dateString,{unit:"day"}),valueCallback);case"eee":return match.day(dateString,{width:"abbreviated",context:"formatting"})||match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"});case"eeeee":return match.day(dateString,{width:"narrow",context:"formatting"});case"eeeeee":return match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"});case"eeee":default:return match.day(dateString,{width:"wide",context:"formatting"})||match.day(dateString,{width:"abbreviated",context:"formatting"})||match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"})}}validate(_date,value){return value>=0&&value<=6}set(date,_flags,value,options){date=setDay(date,value,options);date.setHours(0,0,0,0);return date}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class StandAloneLocalDayParser extends Parser{priority=90;parse(dateString,token,match,options){const valueCallback=value=>{const wholeWeekDays=7*Math.floor((value-1)/7);return(value+options.weekStartsOn+6)%7+wholeWeekDays};switch(token){case"c":case"cc":return mapValue(parseNDigits(token.length,dateString),valueCallback);case"co":return mapValue(match.ordinalNumber(dateString,{unit:"day"}),valueCallback);case"ccc":return match.day(dateString,{width:"abbreviated",context:"standalone"})||match.day(dateString,{width:"short",context:"standalone"})||match.day(dateString,{width:"narrow",context:"standalone"});case"ccccc":return match.day(dateString,{width:"narrow",context:"standalone"});case"cccccc":return match.day(dateString,{width:"short",context:"standalone"})||match.day(dateString,{width:"narrow",context:"standalone"});case"cccc":default:return match.day(dateString,{width:"wide",context:"standalone"})||match.day(dateString,{width:"abbreviated",context:"standalone"})||match.day(dateString,{width:"short",context:"standalone"})||match.day(dateString,{width:"narrow",context:"standalone"})}}validate(_date,value){return value>=0&&value<=6}set(date,_flags,value,options){date=setDay(date,value,options);date.setHours(0,0,0,0);return date}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function setISODay_setISODay(date,day,options){const date_=toDate(date,options?.in);const currentDay=getISODay(date_,options);const diff=day-currentDay;return addDays(date_,diff,options)}class ISODayParser extends Parser{priority=90;parse(dateString,token,match){const valueCallback=value=>{if(0===value)return 7;return value};switch(token){case"i":case"ii":return parseNDigits(token.length,dateString);case"io":return match.ordinalNumber(dateString,{unit:"day"});case"iii":return mapValue(match.day(dateString,{width:"abbreviated",context:"formatting"})||match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"}),valueCallback);case"iiiii":return mapValue(match.day(dateString,{width:"narrow",context:"formatting"}),valueCallback);case"iiiiii":return mapValue(match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"}),valueCallback);case"iiii":default:return mapValue(match.day(dateString,{width:"wide",context:"formatting"})||match.day(dateString,{width:"abbreviated",context:"formatting"})||match.day(dateString,{width:"short",context:"formatting"})||match.day(dateString,{width:"narrow",context:"formatting"}),valueCallback)}}validate(_date,value){return value>=1&&value<=7}set(date,_flags,value){date=setISODay_setISODay(date,value);date.setHours(0,0,0,0);return date}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class AMPMParser extends Parser{priority=80;parse(dateString,token,match){switch(token){case"a":case"aa":case"aaa":return match.dayPeriod(dateString,{width:"abbreviated",context:"formatting"})||match.dayPeriod(dateString,{width:"narrow",context:"formatting"});case"aaaaa":return match.dayPeriod(dateString,{width:"narrow",context:"formatting"});case"aaaa":default:return match.dayPeriod(dateString,{width:"wide",context:"formatting"})||match.dayPeriod(dateString,{width:"abbreviated",context:"formatting"})||match.dayPeriod(dateString,{width:"narrow",context:"formatting"})}}set(date,_flags,value){date.setHours(dayPeriodEnumToHours(value),0,0,0);return date}incompatibleTokens=["b","B","H","k","t","T"]}class AMPMMidnightParser extends Parser{priority=80;parse(dateString,token,match){switch(token){case"b":case"bb":case"bbb":return match.dayPeriod(dateString,{width:"abbreviated",context:"formatting"})||match.dayPeriod(dateString,{width:"narrow",context:"formatting"});case"bbbbb":return match.dayPeriod(dateString,{width:"narrow",context:"formatting"});case"bbbb":default:return match.dayPeriod(dateString,{width:"wide",context:"formatting"})||match.dayPeriod(dateString,{width:"abbreviated",context:"formatting"})||match.dayPeriod(dateString,{width:"narrow",context:"formatting"})}}set(date,_flags,value){date.setHours(dayPeriodEnumToHours(value),0,0,0);return date}incompatibleTokens=["a","B","H","k","t","T"]}class DayPeriodParser extends Parser{priority=80;parse(dateString,token,match){switch(token){case"B":case"BB":case"BBB":return match.dayPeriod(dateString,{width:"abbreviated",context:"formatting"})||match.dayPeriod(dateString,{width:"narrow",context:"formatting"});case"BBBBB":return match.dayPeriod(dateString,{width:"narrow",context:"formatting"});case"BBBB":default:return match.dayPeriod(dateString,{width:"wide",context:"formatting"})||match.dayPeriod(dateString,{width:"abbreviated",context:"formatting"})||match.dayPeriod(dateString,{width:"narrow",context:"formatting"})}}set(date,_flags,value){date.setHours(dayPeriodEnumToHours(value),0,0,0);return date}incompatibleTokens=["a","b","t","T"]}class Hour1to12Parser extends Parser{priority=70;parse(dateString,token,match){switch(token){case"h":return parseNumericPattern(numericPatterns.hour12h,dateString);case"ho":return match.ordinalNumber(dateString,{unit:"hour"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=1&&value<=12}set(date,_flags,value){const isPM=date.getHours()>=12;if(isPM&&value<12)date.setHours(value+12,0,0,0);else if(isPM||12!==value)date.setHours(value,0,0,0);else date.setHours(0,0,0,0);return date}incompatibleTokens=["H","K","k","t","T"]}class Hour0to23Parser extends Parser{priority=70;parse(dateString,token,match){switch(token){case"H":return parseNumericPattern(numericPatterns.hour23h,dateString);case"Ho":return match.ordinalNumber(dateString,{unit:"hour"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=0&&value<=23}set(date,_flags,value){date.setHours(value,0,0,0);return date}incompatibleTokens=["a","b","h","K","k","t","T"]}class Hour0To11Parser extends Parser{priority=70;parse(dateString,token,match){switch(token){case"K":return parseNumericPattern(numericPatterns.hour11h,dateString);case"Ko":return match.ordinalNumber(dateString,{unit:"hour"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=0&&value<=11}set(date,_flags,value){const isPM=date.getHours()>=12;if(isPM&&value<12)date.setHours(value+12,0,0,0);else date.setHours(value,0,0,0);return date}incompatibleTokens=["h","H","k","t","T"]}class Hour1To24Parser extends Parser{priority=70;parse(dateString,token,match){switch(token){case"k":return parseNumericPattern(numericPatterns.hour24h,dateString);case"ko":return match.ordinalNumber(dateString,{unit:"hour"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=1&&value<=24}set(date,_flags,value){const hours=value<=24?value%24:value;date.setHours(hours,0,0,0);return date}incompatibleTokens=["a","b","h","H","K","t","T"]}class MinuteParser extends Parser{priority=60;parse(dateString,token,match){switch(token){case"m":return parseNumericPattern(numericPatterns.minute,dateString);case"mo":return match.ordinalNumber(dateString,{unit:"minute"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=0&&value<=59}set(date,_flags,value){date.setMinutes(value,0,0);return date}incompatibleTokens=["t","T"]}class SecondParser extends Parser{priority=50;parse(dateString,token,match){switch(token){case"s":return parseNumericPattern(numericPatterns.second,dateString);case"so":return match.ordinalNumber(dateString,{unit:"second"});default:return parseNDigits(token.length,dateString)}}validate(_date,value){return value>=0&&value<=59}set(date,_flags,value){date.setSeconds(value,0);return date}incompatibleTokens=["t","T"]}class FractionOfSecondParser extends Parser{priority=30;parse(dateString,token){const valueCallback=value=>Math.trunc(value*Math.pow(10,-token.length+3));return mapValue(parseNDigits(token.length,dateString),valueCallback)}set(date,_flags,value){date.setMilliseconds(value);return date}incompatibleTokens=["t","T"]}class ISOTimezoneWithZParser extends Parser{priority=10;parse(dateString,token){switch(token){case"X":return parseTimezonePattern(timezonePatterns.basicOptionalMinutes,dateString);case"XX":return parseTimezonePattern(timezonePatterns.basic,dateString);case"XXXX":return parseTimezonePattern(timezonePatterns.basicOptionalSeconds,dateString);case"XXXXX":return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds,dateString);case"XXX":default:return parseTimezonePattern(timezonePatterns.extended,dateString)}}set(date,flags,value){if(flags.timestampIsSet)return date;return constructFrom_constructFrom(date,date.getTime()-getTimezoneOffsetInMilliseconds(date)-value)}incompatibleTokens=["t","T","x"]}class ISOTimezoneParser extends Parser{priority=10;parse(dateString,token){switch(token){case"x":return parseTimezonePattern(timezonePatterns.basicOptionalMinutes,dateString);case"xx":return parseTimezonePattern(timezonePatterns.basic,dateString);case"xxxx":return parseTimezonePattern(timezonePatterns.basicOptionalSeconds,dateString);case"xxxxx":return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds,dateString);case"xxx":default:return parseTimezonePattern(timezonePatterns.extended,dateString)}}set(date,flags,value){if(flags.timestampIsSet)return date;return constructFrom_constructFrom(date,date.getTime()-getTimezoneOffsetInMilliseconds(date)-value)}incompatibleTokens=["t","T","X"]}class TimestampSecondsParser extends Parser{priority=40;parse(dateString){return parseAnyDigitsSigned(dateString)}set(date,_flags,value){return[constructFrom_constructFrom(date,1e3*value),{timestampIsSet:true}]}incompatibleTokens="*"}class TimestampMillisecondsParser extends Parser{priority=20;parse(dateString){return parseAnyDigitsSigned(dateString)}set(date,_flags,value){return[constructFrom_constructFrom(date,value),{timestampIsSet:true}]}incompatibleTokens="*"}const parsers={G:new EraParser,y:new YearParser,Y:new LocalWeekYearParser,R:new ISOWeekYearParser,u:new ExtendedYearParser,Q:new QuarterParser,q:new StandAloneQuarterParser,M:new MonthParser,L:new StandAloneMonthParser,w:new LocalWeekParser,I:new ISOWeekParser,d:new DateParser,D:new DayOfYearParser,E:new DayParser,e:new LocalDayParser,c:new StandAloneLocalDayParser,i:new ISODayParser,a:new AMPMParser,b:new AMPMMidnightParser,B:new DayPeriodParser,h:new Hour1to12Parser,H:new Hour0to23Parser,K:new Hour0To11Parser,k:new Hour1To24Parser,m:new MinuteParser,s:new SecondParser,S:new FractionOfSecondParser,X:new ISOTimezoneWithZParser,x:new ISOTimezoneParser,t:new TimestampSecondsParser,T:new TimestampMillisecondsParser};const parse_formattingTokensRegExp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;const parse_longFormattingTokensRegExp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;const parse_escapedStringRegExp=/^'([^]*?)'?$/;const parse_doubleQuoteRegExp=/''/g;const notWhitespaceRegExp=/\S/;const parse_unescapedLatinCharacterRegExp=/[a-zA-Z]/;function parse_parse(dateStr,formatStr,referenceDate,options){const invalidDate=()=>constructFrom_constructFrom(options?.in||referenceDate,NaN);const defaultOptions=getDefaultOptions_getDefaultOptions();const locale=options?.locale??defaultOptions.locale??enUS;const firstWeekContainsDate=options?.firstWeekContainsDate??options?.locale?.options?.firstWeekContainsDate??defaultOptions.firstWeekContainsDate??defaultOptions.locale?.options?.firstWeekContainsDate??1;const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;if(!formatStr)return dateStr?invalidDate():toDate(referenceDate,options?.in);const subFnOptions={firstWeekContainsDate,weekStartsOn,locale};const setters=[new DateTimezoneSetter(options?.in,referenceDate)];const tokens=formatStr.match(parse_longFormattingTokensRegExp).map(substring=>{const firstCharacter=substring[0];if(firstCharacter in longFormatters){const longFormatter=longFormatters[firstCharacter];return longFormatter(substring,locale.formatLong)}return substring}).join("").match(parse_formattingTokensRegExp);const usedTokens=[];for(let token of tokens){if(!options?.useAdditionalWeekYearTokens&&isProtectedWeekYearToken(token))warnOrThrowProtectedError(token,formatStr,dateStr);if(!options?.useAdditionalDayOfYearTokens&&isProtectedDayOfYearToken(token))warnOrThrowProtectedError(token,formatStr,dateStr);const firstCharacter=token[0];const parser=parsers[firstCharacter];if(parser){const{incompatibleTokens}=parser;if(Array.isArray(incompatibleTokens)){const incompatibleToken=usedTokens.find(usedToken=>incompatibleTokens.includes(usedToken.token)||usedToken.token===firstCharacter);if(incompatibleToken)throw new RangeError(`The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`)}else if("*"===parser.incompatibleTokens&&usedTokens.length>0)throw new RangeError(`The format string mustn't contain \`${token}\` and any other token at the same time`);usedTokens.push({token:firstCharacter,fullToken:token});const parseResult=parser.run(dateStr,token,locale.match,subFnOptions);if(!parseResult)return invalidDate();setters.push(parseResult.setter);dateStr=parseResult.rest}else{if(firstCharacter.match(parse_unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+firstCharacter+"`");if("''"===token)token="'";else if("'"===firstCharacter)token=parse_cleanEscapedString(token);if(0!==dateStr.indexOf(token))return invalidDate();dateStr=dateStr.slice(token.length)}}if(dateStr.length>0&¬WhitespaceRegExp.test(dateStr))return invalidDate();const uniquePrioritySetters=setters.map(setter=>setter.priority).sort((a,b)=>b-a).filter((priority,index,array)=>array.indexOf(priority)===index).map(priority=>setters.filter(setter=>setter.priority===priority).sort((a,b)=>b.subPriority-a.subPriority)).map(setterArray=>setterArray[0]);let date=toDate(referenceDate,options?.in);if(isNaN(+date))return invalidDate();const flags={};for(const setter of uniquePrioritySetters){if(!setter.validate(date,subFnOptions))return invalidDate();const result=setter.set(date,flags,subFnOptions);if(Array.isArray(result)){date=result[0];Object.assign(flags,result[1])}else date=result}return date}function parse_cleanEscapedString(input){return input.match(parse_escapedStringRegExp)[1].replace(parse_doubleQuoteRegExp,"'")}function isMatch(dateStr,formatStr,options){return isValid_isValid(parse_parse(dateStr,formatStr,new Date,options))}function isMonday_isMonday(date,options){return 1===toDate(date,options?.in).getDay()}function isPast_isPast(date){return+toDate(date)<Date.now()}function startOfHour(date,options){const _date=toDate(date,options?.in);_date.setMinutes(0,0,0);return _date}function isSameHour(dateLeft,dateRight,options){const[dateLeft_,dateRight_]=normalizeDates(options?.in,dateLeft,dateRight);return+startOfHour(dateLeft_)===+startOfHour(dateRight_)}function isSameWeek(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);return+startOfWeek(laterDate_,options)===+startOfWeek(earlierDate_,options)}function isSameISOWeek(laterDate,earlierDate,options){return isSameWeek(laterDate,earlierDate,{...options,weekStartsOn:1})}function isSameISOWeekYear(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);return+startOfISOWeekYear(laterDate_)===+startOfISOWeekYear(earlierDate_)}function startOfMinute_startOfMinute(date,options){const date_=toDate(date,options?.in);date_.setSeconds(0,0);return date_}function isSameMinute_isSameMinute(laterDate,earlierDate){return+startOfMinute_startOfMinute(laterDate)===+startOfMinute_startOfMinute(earlierDate)}function isSameMonth(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);return laterDate_.getFullYear()===earlierDate_.getFullYear()&&laterDate_.getMonth()===earlierDate_.getMonth()}function isSameQuarter(laterDate,earlierDate,options){const[dateLeft_,dateRight_]=normalizeDates(options?.in,laterDate,earlierDate);return+startOfQuarter(dateLeft_)===+startOfQuarter(dateRight_)}function startOfSecond_startOfSecond(date,options){const date_=toDate(date,options?.in);date_.setMilliseconds(0);return date_}function isSameSecond_isSameSecond(laterDate,earlierDate){return+startOfSecond_startOfSecond(laterDate)===+startOfSecond_startOfSecond(earlierDate)}function isSameYear(laterDate,earlierDate,options){const[laterDate_,earlierDate_]=normalizeDates(options?.in,laterDate,earlierDate);return laterDate_.getFullYear()===earlierDate_.getFullYear()}function isThisHour(date,options){return isSameHour(toDate(date,options?.in),constructNow(options?.in||date))}function isThisISOWeek(date,options){return isSameISOWeek(constructFrom_constructFrom(options?.in||date,date),constructNow(options?.in||date))}function isThisMinute(date){return isSameMinute_isSameMinute(date,constructNow(date))}function isThisMonth_isThisMonth(date,options){return isSameMonth(constructFrom_constructFrom(options?.in||date,date),constructNow(options?.in||date))}function isThisQuarter(date,options){return isSameQuarter(constructFrom_constructFrom(options?.in||date,date),constructNow(options?.in||date))}function isThisSecond(date){return isSameSecond_isSameSecond(date,constructNow(date))}function isThisWeek(date,options){return isSameWeek(constructFrom_constructFrom(options?.in||date,date),constructNow(options?.in||date),options)}function isThisYear_isThisYear(date,options){return isSameYear(constructFrom_constructFrom(options?.in||date,date),constructNow(options?.in||date))}function isThursday(date,options){return 4===toDate(date,options?.in).getDay()}function isToday(date,options){return isSameDay(constructFrom_constructFrom(options?.in||date,date),constructNow(options?.in||date))}function isTomorrow(date,options){return isSameDay(date,addDays(constructNow(options?.in||date),1),options)}function isTuesday(date,options){return 2===toDate(date,options?.in).getDay()}function isWednesday(date,options){return 3===toDate(date,options?.in).getDay()}function isWithinInterval_isWithinInterval(date,interval,options){const time=+toDate(date,options?.in);const[startTime,endTime]=[+toDate(interval.start,options?.in),+toDate(interval.end,options?.in)].sort((a,b)=>a-b);return time>=startTime&&time<=endTime}function subDays_subDays(date,amount,options){return addDays(date,-amount,options)}function isYesterday(date,options){return isSameDay(constructFrom_constructFrom(options?.in||date,date),subDays_subDays(constructNow(options?.in||date),1))}function lastDayOfDecade_lastDayOfDecade(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const decade=9+10*Math.floor(year/10);_date.setFullYear(decade+1,0,0);_date.setHours(0,0,0,0);return toDate(_date,options?.in)}function lastDayOfWeek(date,options){const defaultOptions=getDefaultOptions();const weekStartsOn=options?.weekStartsOn??options?.locale?.options?.weekStartsOn??defaultOptions.weekStartsOn??defaultOptions.locale?.options?.weekStartsOn??0;const _date=toDate(date,options?.in);const day=_date.getDay();const diff=(day<weekStartsOn?-7:0)+6-(day-weekStartsOn);_date.setHours(0,0,0,0);_date.setDate(_date.getDate()+diff);return _date}function lastDayOfISOWeek(date,options){return lastDayOfWeek(date,{...options,weekStartsOn:1})}function lastDayOfISOWeekYear(date,options){const year=getISOWeekYear(date,options);const fourthOfJanuary=constructFrom_constructFrom(options?.in||date,0);fourthOfJanuary.setFullYear(year+1,0,4);fourthOfJanuary.setHours(0,0,0,0);const date_=startOfISOWeek(fourthOfJanuary,options);date_.setDate(date_.getDate()-1);return date_}function lastDayOfQuarter(date,options){const date_=toDate(date,options?.in);const currentMonth=date_.getMonth();const month=currentMonth-currentMonth%3+3;date_.setMonth(month,0);date_.setHours(0,0,0,0);return date_}function lastDayOfYear_lastDayOfYear(date,options){const date_=toDate(date,options?.in);const year=date_.getFullYear();date_.setFullYear(year+1,0,0);date_.setHours(0,0,0,0);return date_}const lightFormat_formattingTokensRegExp=/(\w)\1*|''|'(''|[^'])+('|$)|./g;const lightFormat_escapedStringRegExp=/^'([^]*?)'?$/;const lightFormat_doubleQuoteRegExp=/''/g;const lightFormat_unescapedLatinCharacterRegExp=/[a-zA-Z]/;function lightFormat(date,formatStr){const date_=toDate(date);if(!isValid_isValid(date_))throw new RangeError("Invalid time value");const tokens=formatStr.match(lightFormat_formattingTokensRegExp);if(!tokens)return"";const result=tokens.map(substring=>{if("''"===substring)return"'";const firstCharacter=substring[0];if("'"===firstCharacter)return lightFormat_cleanEscapedString(substring);const formatter=lightFormatters[firstCharacter];if(formatter)return formatter(date_,substring);if(firstCharacter.match(lightFormat_unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+firstCharacter+"`");return substring}).join("");return result}function lightFormat_cleanEscapedString(input){const matches=input.match(lightFormat_escapedStringRegExp);if(!matches)return input;return matches[1].replace(lightFormat_doubleQuoteRegExp,"'")}function milliseconds_milliseconds({years,months,weeks,days,hours,minutes,seconds}){let totalDays=0;if(years)totalDays+=years*daysInYear;if(months)totalDays+=daysInYear/12*months;if(weeks)totalDays+=7*weeks;if(days)totalDays+=days;let totalSeconds=24*totalDays*3600;if(hours)totalSeconds+=60*hours*60;if(minutes)totalSeconds+=60*minutes;if(seconds)totalSeconds+=seconds;return Math.trunc(1e3*totalSeconds)}function millisecondsToHours_millisecondsToHours(milliseconds){const hours=milliseconds/millisecondsInHour;return Math.trunc(hours)}function millisecondsToMinutes(milliseconds){const minutes=milliseconds/6e4;return Math.trunc(minutes)}function millisecondsToSeconds(milliseconds){const seconds=milliseconds/1e3;return Math.trunc(seconds)}function minutesToHours(minutes){const hours=minutes/60;return Math.trunc(hours)}function minutesToMilliseconds(minutes){return Math.trunc(6e4*minutes)}function minutesToSeconds_minutesToSeconds(minutes){return Math.trunc(60*minutes)}function monthsToQuarters(months){const quarters=months/3;return Math.trunc(quarters)}function monthsToYears(months){const years=months/12;return Math.trunc(years)}function nextDay_nextDay(date,day,options){let delta=day-getDay(date,options);if(delta<=0)delta+=7;return addDays(date,delta,options)}function nextFriday(date,options){return nextDay_nextDay(date,5,options)}function nextMonday(date,options){return nextDay_nextDay(date,1,options)}function nextSaturday(date,options){return nextDay_nextDay(date,6,options)}function nextSunday(date,options){return nextDay_nextDay(date,0,options)}function nextThursday(date,options){return nextDay_nextDay(date,4,options)}function nextTuesday(date,options){return nextDay_nextDay(date,2,options)}function nextWednesday(date,options){return nextDay_nextDay(date,3,options)}function parseISO(argument,options){const invalidDate=()=>constructFrom_constructFrom(options?.in,NaN);const additionalDigits=options?.additionalDigits??2;const dateStrings=splitDateString(argument);let date;if(dateStrings.date){const parseYearResult=parseYear(dateStrings.date,additionalDigits);date=parseDate(parseYearResult.restDateString,parseYearResult.year)}if(!date||isNaN(+date))return invalidDate();const timestamp=+date;let time=0;let offset;if(dateStrings.time){time=parseTime(dateStrings.time);if(isNaN(time))return invalidDate()}if(dateStrings.timezone){offset=parseTimezone(dateStrings.timezone);if(isNaN(offset))return invalidDate()}else{const tmpDate=new Date(timestamp+time);const result=toDate(0,options?.in);result.setFullYear(tmpDate.getUTCFullYear(),tmpDate.getUTCMonth(),tmpDate.getUTCDate());result.setHours(tmpDate.getUTCHours(),tmpDate.getUTCMinutes(),tmpDate.getUTCSeconds(),tmpDate.getUTCMilliseconds());return result}return toDate(timestamp+time+offset,options?.in)}const patterns={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/};const dateRegex=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;const timeRegex=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;const timezoneRegex=/^([+-])(\d{2})(?::?(\d{2}))?$/;function splitDateString(dateString){const dateStrings={};const array=dateString.split(patterns.dateTimeDelimiter);let timeString;if(array.length>2)return dateStrings;if(/:/.test(array[0]))timeString=array[0];else{dateStrings.date=array[0];timeString=array[1];if(patterns.timeZoneDelimiter.test(dateStrings.date)){dateStrings.date=dateString.split(patterns.timeZoneDelimiter)[0];timeString=dateString.substr(dateStrings.date.length,dateString.length)}}if(timeString){const token=patterns.timezone.exec(timeString);if(token){dateStrings.time=timeString.replace(token[1],"");dateStrings.timezone=token[1]}else dateStrings.time=timeString}return dateStrings}function parseYear(dateString,additionalDigits){const regex=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+additionalDigits)+"})|(\\d{2}|[+-]\\d{"+(2+additionalDigits)+"})$)");const captures=dateString.match(regex);if(!captures)return{year:NaN,restDateString:""};const year=captures[1]?parseInt(captures[1]):null;const century=captures[2]?parseInt(captures[2]):null;return{year:null===century?year:100*century,restDateString:dateString.slice((captures[1]||captures[2]).length)}}function parseDate(dateString,year){if(null===year)return new Date(NaN);const captures=dateString.match(dateRegex);if(!captures)return new Date(NaN);const isWeekDate=!!captures[4];const dayOfYear=parseDateUnit(captures[1]);const month=parseDateUnit(captures[2])-1;const day=parseDateUnit(captures[3]);const week=parseDateUnit(captures[4]);const dayOfWeek=parseDateUnit(captures[5])-1;if(isWeekDate){if(!validateWeekDate(year,week,dayOfWeek))return new Date(NaN);return dayOfISOWeekYear(year,week,dayOfWeek)}{const date=new Date(0);if(!validateDate(year,month,day)||!validateDayOfYearDate(year,dayOfYear))return new Date(NaN);date.setUTCFullYear(year,month,Math.max(dayOfYear,day));return date}}function parseDateUnit(value){return value?parseInt(value):1}function parseTime(timeString){const captures=timeString.match(timeRegex);if(!captures)return NaN;const hours=parseTimeUnit(captures[1]);const minutes=parseTimeUnit(captures[2]);const seconds=parseTimeUnit(captures[3]);if(!validateTime(hours,minutes,seconds))return NaN;return hours*millisecondsInHour+6e4*minutes+1e3*seconds}function parseTimeUnit(value){return value&&parseFloat(value.replace(",","."))||0}function parseTimezone(timezoneString){if("Z"===timezoneString)return 0;const captures=timezoneString.match(timezoneRegex);if(!captures)return 0;const sign="+"===captures[1]?-1:1;const hours=parseInt(captures[2]);const minutes=captures[3]&&parseInt(captures[3])||0;if(!validateTimezone(hours,minutes))return NaN;return sign*(hours*millisecondsInHour+6e4*minutes)}function dayOfISOWeekYear(isoWeekYear,week,day){const date=new Date(0);date.setUTCFullYear(isoWeekYear,0,4);const fourthOfJanuaryDay=date.getUTCDay()||7;const diff=(week-1)*7+day+1-fourthOfJanuaryDay;date.setUTCDate(date.getUTCDate()+diff);return date}const daysInMonths=[31,null,31,30,31,30,31,31,30,31,30,31];function parseISO_isLeapYearIndex(year){return year%400===0||year%4===0&&year%100!==0}function validateDate(year,month,date){return month>=0&&month<=11&&date>=1&&date<=(daysInMonths[month]||(parseISO_isLeapYearIndex(year)?29:28))}function validateDayOfYearDate(year,dayOfYear){return dayOfYear>=1&&dayOfYear<=(parseISO_isLeapYearIndex(year)?366:365)}function validateWeekDate(_year,week,day){return week>=1&&week<=53&&day>=0&&day<=6}function validateTime(hours,minutes,seconds){if(24===hours)return 0===minutes&&0===seconds;return seconds>=0&&seconds<60&&minutes>=0&&minutes<60&&hours>=0&&hours<25}function validateTimezone(_hours,minutes){return minutes>=0&&minutes<=59}function parseJSON(dateStr,options){const parts=dateStr.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);if(!parts)return toDate(NaN,options?.in);return toDate(Date.UTC(+parts[1],parts[2]-1,+parts[3],parts[4]-(+parts[9]||0)*("-"==parts[8]?-1:1),parts[5]-(+parts[10]||0)*("-"==parts[8]?-1:1),+parts[6],+((parts[7]||"0")+"00").substring(0,3)),options?.in)}function previousDay(date,day,options){let delta=getDay(date,options)-day;if(delta<=0)delta+=7;return subDays_subDays(date,delta,options)}function previousFriday(date,options){return previousDay(date,5,options)}function previousMonday(date,options){return previousDay(date,1,options)}function previousSaturday(date,options){return previousDay(date,6,options)}function previousSunday(date,options){return previousDay(date,0,options)}function previousThursday(date,options){return previousDay(date,4,options)}function previousTuesday(date,options){return previousDay(date,2,options)}function previousWednesday(date,options){return previousDay(date,3,options)}function quartersToMonths_quartersToMonths(quarters){return Math.trunc(3*quarters)}function quartersToYears(quarters){const years=quarters/4;return Math.trunc(years)}function roundToNearestHours_roundToNearestHours(date,options){const nearestTo=options?.nearestTo??1;if(nearestTo<1||nearestTo>12)return constructFrom_constructFrom(options?.in||date,NaN);const date_=toDate(date,options?.in);const fractionalMinutes=date_.getMinutes()/60;const fractionalSeconds=date_.getSeconds()/60/60;const fractionalMilliseconds=date_.getMilliseconds()/1e3/60/60;const hours=date_.getHours()+fractionalMinutes+fractionalSeconds+fractionalMilliseconds;const method=options?.roundingMethod??"round";const roundingMethod=getRoundingMethod(method);const roundedHours=roundingMethod(hours/nearestTo)*nearestTo;date_.setHours(roundedHours,0,0,0);return date_}function roundToNearestMinutes(date,options){const nearestTo=options?.nearestTo??1;if(nearestTo<1||nearestTo>30)return constructFrom_constructFrom(date,NaN);const date_=toDate(date,options?.in);const fractionalSeconds=date_.getSeconds()/60;const fractionalMilliseconds=date_.getMilliseconds()/1e3/60;const minutes=date_.getMinutes()+fractionalSeconds+fractionalMilliseconds;const method=options?.roundingMethod??"round";const roundingMethod=getRoundingMethod(method);const roundedMinutes=roundingMethod(minutes/nearestTo)*nearestTo;date_.setMinutes(roundedMinutes,0,0);return date_}function secondsToHours(seconds){const hours=seconds/3600;return Math.trunc(hours)}function secondsToMilliseconds(seconds){return 1e3*seconds}function secondsToMinutes_secondsToMinutes(seconds){const minutes=seconds/60;return Math.trunc(minutes)}function setMonth(date,month,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const day=_date.getDate();const midMonth=constructFrom_constructFrom(options?.in||date,0);midMonth.setFullYear(year,month,15);midMonth.setHours(0,0,0,0);const daysInMonth=getDaysInMonth(midMonth);_date.setMonth(month,Math.min(day,daysInMonth));return _date}function set(date,values,options){let _date=toDate(date,options?.in);if(isNaN(+_date))return constructFrom_constructFrom(options?.in||date,NaN);if(null!=values.year)_date.setFullYear(values.year);if(null!=values.month)_date=setMonth(_date,values.month);if(null!=values.date)_date.setDate(values.date);if(null!=values.hours)_date.setHours(values.hours);if(null!=values.minutes)_date.setMinutes(values.minutes);if(null!=values.seconds)_date.setSeconds(values.seconds);if(null!=values.milliseconds)_date.setMilliseconds(values.milliseconds);return _date}function setDate_setDate(date,dayOfMonth,options){const _date=toDate(date,options?.in);_date.setDate(dayOfMonth);return _date}function setDayOfYear_setDayOfYear(date,dayOfYear,options){const date_=toDate(date,options?.in);date_.setMonth(0);date_.setDate(dayOfYear);return date_}function setDefaultOptions_setDefaultOptions(options){const result={};const defaultOptions=getDefaultOptions();for(const property in defaultOptions)if(Object.prototype.hasOwnProperty.call(defaultOptions,property))result[property]=defaultOptions[property];for(const property in options)if(Object.prototype.hasOwnProperty.call(options,property))if(void 0===options[property])delete result[property];else result[property]=options[property];setDefaultOptions(result)}function setHours_setHours(date,hours,options){const _date=toDate(date,options?.in);_date.setHours(hours);return _date}function setMilliseconds(date,milliseconds,options){const _date=toDate(date,options?.in);_date.setMilliseconds(milliseconds);return _date}function setMinutes(date,minutes,options){const date_=toDate(date,options?.in);date_.setMinutes(minutes);return date_}function setQuarter_setQuarter(date,quarter,options){const date_=toDate(date,options?.in);const oldQuarter=Math.trunc(date_.getMonth()/3)+1;const diff=quarter-oldQuarter;return setMonth(date_,date_.getMonth()+3*diff)}function setSeconds(date,seconds,options){const _date=toDate(date,options?.in);_date.setSeconds(seconds);return _date}function setWeekYear(date,weekYear,options){const defaultOptions=getDefaultOptions();const firstWeekContainsDate=options?.firstWeekContainsDate??options?.locale?.options?.firstWeekContainsDate??defaultOptions.firstWeekContainsDate??defaultOptions.locale?.options?.firstWeekContainsDate??1;const diff=differenceInCalendarDays(toDate(date,options?.in),startOfWeekYear_startOfWeekYear(date,options),options);const firstWeek=constructFrom_constructFrom(options?.in||date,0);firstWeek.setFullYear(weekYear,0,firstWeekContainsDate);firstWeek.setHours(0,0,0,0);const date_=startOfWeekYear_startOfWeekYear(firstWeek,options);date_.setDate(date_.getDate()+diff);return date_}function setYear(date,year,options){const date_=toDate(date,options?.in);if(isNaN(+date_))return constructFrom_constructFrom(options?.in||date,NaN);date_.setFullYear(year);return date_}function startOfDecade(date,options){const _date=toDate(date,options?.in);const year=_date.getFullYear();const decade=10*Math.floor(year/10);_date.setFullYear(decade,0,1);_date.setHours(0,0,0,0);return _date}function startOfToday(options){return startOfDay_startOfDay(Date.now(),options)}function startOfTomorrow(options){const now=constructNow(options?.in);const year=now.getFullYear();const month=now.getMonth();const day=now.getDate();const date=constructFrom_constructFrom(options?.in,0);date.setFullYear(year,month,day+1);date.setHours(0,0,0,0);return date}function startOfYesterday(options){const now=constructNow(options?.in);const year=now.getFullYear();const month=now.getMonth();const day=now.getDate();const date=constructNow(options?.in);date.setFullYear(year,month,day-1);date.setHours(0,0,0,0);return date}function subMonths(date,amount,options){return addMonths(date,-amount,options)}function sub(date,duration,options){const{years=0,months=0,weeks=0,days=0,hours=0,minutes=0,seconds=0}=duration;const withoutMonths=subMonths(date,months+12*years,options);const withoutDays=subDays_subDays(withoutMonths,days+7*weeks,options);const minutesToSub=minutes+60*hours;const secondsToSub=seconds+60*minutesToSub;const msToSub=1e3*secondsToSub;return constructFrom_constructFrom(options?.in||date,withoutDays-msToSub)}function subBusinessDays(date,amount,options){return addBusinessDays_addBusinessDays(date,-amount,options)}function subHours(date,amount,options){return addHours(date,-amount,options)}function subMilliseconds(date,amount,options){return addMilliseconds(date,-amount,options)}function subMinutes(date,amount,options){return addMinutes(date,-amount,options)}function subQuarters(date,amount,options){return addQuarters(date,-amount,options)}function subSeconds(date,amount,options){return addSeconds(date,-amount,options)}function subWeeks_subWeeks(date,amount,options){return addWeeks(date,-amount,options)}function subYears(date,amount,options){return addYears(date,-amount,options)}function weeksToDays(weeks){return Math.trunc(7*weeks)}function yearsToDays(years){return Math.trunc(years*daysInYear)}function yearsToMonths_yearsToMonths(years){return Math.trunc(12*years)}function yearsToQuarters(years){return Math.trunc(4*years)}}}]);
|