{"ast":null,"code":"// src/utils.ts\nvar isServer = typeof window === \"undefined\" || \"Deno\" in globalThis;\nfunction noop() {\n return void 0;\n}\nfunction functionalUpdate(updater, input) {\n return typeof updater === \"function\" ? updater(input) : updater;\n}\nfunction isValidTimeout(value) {\n return typeof value === \"number\" && value >= 0 && value !== Infinity;\n}\nfunction timeUntilStale(updatedAt, staleTime) {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);\n}\nfunction resolveStaleTime(staleTime, query) {\n return typeof staleTime === \"function\" ? staleTime(query) : staleTime;\n}\nfunction resolveEnabled(enabled, query) {\n return typeof enabled === \"function\" ? enabled(query) : enabled;\n}\nfunction matchQuery(filters, query) {\n const {\n type = \"all\",\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale\n } = filters;\n if (queryKey) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false;\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false;\n }\n }\n if (type !== \"all\") {\n const isActive = query.isActive();\n if (type === \"active\" && !isActive) {\n return false;\n }\n if (type === \"inactive\" && isActive) {\n return false;\n }\n }\n if (typeof stale === \"boolean\" && query.isStale() !== stale) {\n return false;\n }\n if (fetchStatus && fetchStatus !== query.state.fetchStatus) {\n return false;\n }\n if (predicate && !predicate(query)) {\n return false;\n }\n return true;\n}\nfunction matchMutation(filters, mutation) {\n const {\n exact,\n status,\n predicate,\n mutationKey\n } = filters;\n if (mutationKey) {\n if (!mutation.options.mutationKey) {\n return false;\n }\n if (exact) {\n if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {\n return false;\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false;\n }\n }\n if (status && mutation.state.status !== status) {\n return false;\n }\n if (predicate && !predicate(mutation)) {\n return false;\n }\n return true;\n}\nfunction hashQueryKeyByOptions(queryKey, options) {\n const hashFn = options?.queryKeyHashFn || hashKey;\n return hashFn(queryKey);\n}\nfunction hashKey(queryKey) {\n return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {\n result[key] = val[key];\n return result;\n }, {}) : val);\n}\nfunction partialMatchKey(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (a && b && typeof a === \"object\" && typeof b === \"object\") {\n return !Object.keys(b).some(key => !partialMatchKey(a[key], b[key]));\n }\n return false;\n}\nfunction replaceEqualDeep(a, b) {\n if (a === b) {\n return a;\n }\n const array = isPlainArray(a) && isPlainArray(b);\n if (array || isPlainObject(a) && isPlainObject(b)) {\n const aItems = array ? a : Object.keys(a);\n const aSize = aItems.length;\n const bItems = array ? b : Object.keys(b);\n const bSize = bItems.length;\n const copy = array ? [] : {};\n let equalItems = 0;\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i];\n if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {\n copy[key] = void 0;\n equalItems++;\n } else {\n copy[key] = replaceEqualDeep(a[key], b[key]);\n if (copy[key] === a[key] && a[key] !== void 0) {\n equalItems++;\n }\n }\n }\n return aSize === bSize && equalItems === aSize ? a : copy;\n }\n return b;\n}\nfunction shallowEqualObjects(a, b) {\n if (!b || Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false;\n }\n }\n return true;\n}\nfunction isPlainArray(value) {\n return Array.isArray(value) && value.length === Object.keys(value).length;\n}\nfunction isPlainObject(o) {\n if (!hasObjectPrototype(o)) {\n return false;\n }\n const ctor = o.constructor;\n if (ctor === void 0) {\n return true;\n }\n const prot = ctor.prototype;\n if (!hasObjectPrototype(prot)) {\n return false;\n }\n if (!prot.hasOwnProperty(\"isPrototypeOf\")) {\n return false;\n }\n if (Object.getPrototypeOf(o) !== Object.prototype) {\n return false;\n }\n return true;\n}\nfunction hasObjectPrototype(o) {\n return Object.prototype.toString.call(o) === \"[object Object]\";\n}\nfunction sleep(timeout) {\n return new Promise(resolve => {\n setTimeout(resolve, timeout);\n });\n}\nfunction replaceData(prevData, data, options) {\n if (typeof options.structuralSharing === \"function\") {\n return options.structuralSharing(prevData, data);\n } else if (options.structuralSharing !== false) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n return replaceEqualDeep(prevData, data);\n } catch (error) {\n console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`);\n }\n }\n return replaceEqualDeep(prevData, data);\n }\n return data;\n}\nfunction keepPreviousData(previousData) {\n return previousData;\n}\nfunction addToEnd(items, item, max = 0) {\n const newItems = [...items, item];\n return max && newItems.length > max ? newItems.slice(1) : newItems;\n}\nfunction addToStart(items, item, max = 0) {\n const newItems = [item, ...items];\n return max && newItems.length > max ? newItems.slice(0, -1) : newItems;\n}\nvar skipToken = Symbol();\nfunction ensureQueryFn(options, fetchOptions) {\n if (process.env.NODE_ENV !== \"production\") {\n if (options.queryFn === skipToken) {\n console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`);\n }\n }\n if (!options.queryFn && fetchOptions?.initialPromise) {\n return () => fetchOptions.initialPromise;\n }\n if (!options.queryFn || options.queryFn === skipToken) {\n return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));\n }\n return options.queryFn;\n}\nexport { addToEnd, addToStart, ensureQueryFn, functionalUpdate, hashKey, hashQueryKeyByOptions, isPlainArray, isPlainObject, isServer, isValidTimeout, keepPreviousData, matchMutation, matchQuery, noop, partialMatchKey, replaceData, replaceEqualDeep, resolveEnabled, resolveStaleTime, shallowEqualObjects, skipToken, sleep, timeUntilStale };","map":{"version":3,"names":["isServer","window","globalThis","noop","functionalUpdate","updater","input","isValidTimeout","value","Infinity","timeUntilStale","updatedAt","staleTime","Math","max","Date","now","resolveStaleTime","query","resolveEnabled","enabled","matchQuery","filters","type","exact","fetchStatus","predicate","queryKey","stale","queryHash","hashQueryKeyByOptions","options","partialMatchKey","isActive","isStale","state","matchMutation","mutation","status","mutationKey","hashKey","hashFn","queryKeyHashFn","JSON","stringify","_","val","isPlainObject","Object","keys","sort","reduce","result","key","a","b","some","replaceEqualDeep","array","isPlainArray","aItems","aSize","length","bItems","bSize","copy","equalItems","i","includes","shallowEqualObjects","Array","isArray","o","hasObjectPrototype","ctor","constructor","prot","prototype","hasOwnProperty","getPrototypeOf","toString","call","sleep","timeout","Promise","resolve","setTimeout","replaceData","prevData","data","structuralSharing","process","env","NODE_ENV","error","console","keepPreviousData","previousData","addToEnd","items","item","newItems","slice","addToStart","skipToken","Symbol","ensureQueryFn","fetchOptions","queryFn","initialPromise","reject","Error"],"sources":["/Users/shoofle/Projects/the-forest/client/node_modules/@tanstack/query-core/src/utils.ts"],"sourcesContent":["import type {\n DefaultError,\n Enabled,\n FetchStatus,\n MutationKey,\n MutationStatus,\n QueryFunction,\n QueryKey,\n QueryOptions,\n StaleTime,\n} from './types'\nimport type { Mutation } from './mutation'\nimport type { FetchOptions, Query } from './query'\n\n// TYPES\n\nexport interface QueryFilters {\n /**\n * Filter to active queries, inactive queries or all queries\n */\n type?: QueryTypeFilter\n /**\n * Match query key exactly\n */\n exact?: boolean\n /**\n * Include queries matching this predicate function\n */\n predicate?: (query: Query) => boolean\n /**\n * Include queries matching this query key\n */\n queryKey?: QueryKey\n /**\n * Include or exclude stale queries\n */\n stale?: boolean\n /**\n * Include queries matching their fetchStatus\n */\n fetchStatus?: FetchStatus\n}\n\nexport interface MutationFilters {\n /**\n * Match mutation key exactly\n */\n exact?: boolean\n /**\n * Include mutations matching this predicate function\n */\n predicate?: (mutation: Mutation) => boolean\n /**\n * Include mutations matching this mutation key\n */\n mutationKey?: MutationKey\n /**\n * Filter by mutation status\n */\n status?: MutationStatus\n}\n\nexport type Updater = TOutput | ((input: TInput) => TOutput)\n\nexport type QueryTypeFilter = 'all' | 'active' | 'inactive'\n\n// UTILS\n\nexport const isServer = typeof window === 'undefined' || 'Deno' in globalThis\n\nexport function noop(): undefined {\n return undefined\n}\n\nexport function functionalUpdate(\n updater: Updater,\n input: TInput,\n): TOutput {\n return typeof updater === 'function'\n ? (updater as (_: TInput) => TOutput)(input)\n : updater\n}\n\nexport function isValidTimeout(value: unknown): value is number {\n return typeof value === 'number' && value >= 0 && value !== Infinity\n}\n\nexport function timeUntilStale(updatedAt: number, staleTime?: number): number {\n return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0)\n}\n\nexport function resolveStaleTime<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n staleTime: undefined | StaleTime,\n query: Query,\n): number | undefined {\n return typeof staleTime === 'function' ? staleTime(query) : staleTime\n}\n\nexport function resolveEnabled<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n enabled: undefined | Enabled,\n query: Query,\n): boolean | undefined {\n return typeof enabled === 'function' ? enabled(query) : enabled\n}\n\nexport function matchQuery(\n filters: QueryFilters,\n query: Query,\n): boolean {\n const {\n type = 'all',\n exact,\n fetchStatus,\n predicate,\n queryKey,\n stale,\n } = filters\n\n if (queryKey) {\n if (exact) {\n if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {\n return false\n }\n } else if (!partialMatchKey(query.queryKey, queryKey)) {\n return false\n }\n }\n\n if (type !== 'all') {\n const isActive = query.isActive()\n if (type === 'active' && !isActive) {\n return false\n }\n if (type === 'inactive' && isActive) {\n return false\n }\n }\n\n if (typeof stale === 'boolean' && query.isStale() !== stale) {\n return false\n }\n\n if (fetchStatus && fetchStatus !== query.state.fetchStatus) {\n return false\n }\n\n if (predicate && !predicate(query)) {\n return false\n }\n\n return true\n}\n\nexport function matchMutation(\n filters: MutationFilters,\n mutation: Mutation,\n): boolean {\n const { exact, status, predicate, mutationKey } = filters\n if (mutationKey) {\n if (!mutation.options.mutationKey) {\n return false\n }\n if (exact) {\n if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {\n return false\n }\n } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {\n return false\n }\n }\n\n if (status && mutation.state.status !== status) {\n return false\n }\n\n if (predicate && !predicate(mutation)) {\n return false\n }\n\n return true\n}\n\nexport function hashQueryKeyByOptions(\n queryKey: TQueryKey,\n options?: Pick, 'queryKeyHashFn'>,\n): string {\n const hashFn = options?.queryKeyHashFn || hashKey\n return hashFn(queryKey)\n}\n\n/**\n * Default query & mutation keys hash function.\n * Hashes the value into a stable hash.\n */\nexport function hashKey(queryKey: QueryKey | MutationKey): string {\n return JSON.stringify(queryKey, (_, val) =>\n isPlainObject(val)\n ? Object.keys(val)\n .sort()\n .reduce((result, key) => {\n result[key] = val[key]\n return result\n }, {} as any)\n : val,\n )\n}\n\n/**\n * Checks if key `b` partially matches with key `a`.\n */\nexport function partialMatchKey(a: QueryKey, b: QueryKey): boolean\nexport function partialMatchKey(a: any, b: any): boolean {\n if (a === b) {\n return true\n }\n\n if (typeof a !== typeof b) {\n return false\n }\n\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n return !Object.keys(b).some((key) => !partialMatchKey(a[key], b[key]))\n }\n\n return false\n}\n\n/**\n * This function returns `a` if `b` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between JSON values for example.\n */\nexport function replaceEqualDeep(a: unknown, b: T): T\nexport function replaceEqualDeep(a: any, b: any): any {\n if (a === b) {\n return a\n }\n\n const array = isPlainArray(a) && isPlainArray(b)\n\n if (array || (isPlainObject(a) && isPlainObject(b))) {\n const aItems = array ? a : Object.keys(a)\n const aSize = aItems.length\n const bItems = array ? b : Object.keys(b)\n const bSize = bItems.length\n const copy: any = array ? [] : {}\n\n let equalItems = 0\n\n for (let i = 0; i < bSize; i++) {\n const key = array ? i : bItems[i]\n if (\n ((!array && aItems.includes(key)) || array) &&\n a[key] === undefined &&\n b[key] === undefined\n ) {\n copy[key] = undefined\n equalItems++\n } else {\n copy[key] = replaceEqualDeep(a[key], b[key])\n if (copy[key] === a[key] && a[key] !== undefined) {\n equalItems++\n }\n }\n }\n\n return aSize === bSize && equalItems === aSize ? a : copy\n }\n\n return b\n}\n\n/**\n * Shallow compare objects.\n */\nexport function shallowEqualObjects>(\n a: T,\n b: T | undefined,\n): boolean {\n if (!b || Object.keys(a).length !== Object.keys(b).length) {\n return false\n }\n\n for (const key in a) {\n if (a[key] !== b[key]) {\n return false\n }\n }\n\n return true\n}\n\nexport function isPlainArray(value: unknown) {\n return Array.isArray(value) && value.length === Object.keys(value).length\n}\n\n// Copied from: https://github.com/jonschlinkert/is-plain-object\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport function isPlainObject(o: any): o is Object {\n if (!hasObjectPrototype(o)) {\n return false\n }\n\n // If has no constructor\n const ctor = o.constructor\n if (ctor === undefined) {\n return true\n }\n\n // If has modified prototype\n const prot = ctor.prototype\n if (!hasObjectPrototype(prot)) {\n return false\n }\n\n // If constructor does not have an Object-specific method\n if (!prot.hasOwnProperty('isPrototypeOf')) {\n return false\n }\n\n // Handles Objects created by Object.create()\n if (Object.getPrototypeOf(o) !== Object.prototype) {\n return false\n }\n\n // Most likely a plain Object\n return true\n}\n\nfunction hasObjectPrototype(o: any): boolean {\n return Object.prototype.toString.call(o) === '[object Object]'\n}\n\nexport function sleep(timeout: number): Promise {\n return new Promise((resolve) => {\n setTimeout(resolve, timeout)\n })\n}\n\nexport function replaceData<\n TData,\n TOptions extends QueryOptions,\n>(prevData: TData | undefined, data: TData, options: TOptions): TData {\n if (typeof options.structuralSharing === 'function') {\n return options.structuralSharing(prevData, data) as TData\n } else if (options.structuralSharing !== false) {\n if (process.env.NODE_ENV !== 'production') {\n try {\n return replaceEqualDeep(prevData, data)\n } catch (error) {\n console.error(\n `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`,\n )\n }\n }\n // Structurally share data between prev and new data if needed\n return replaceEqualDeep(prevData, data)\n }\n return data\n}\n\nexport function keepPreviousData(\n previousData: T | undefined,\n): T | undefined {\n return previousData\n}\n\nexport function addToEnd(items: Array, item: T, max = 0): Array {\n const newItems = [...items, item]\n return max && newItems.length > max ? newItems.slice(1) : newItems\n}\n\nexport function addToStart(items: Array, item: T, max = 0): Array {\n const newItems = [item, ...items]\n return max && newItems.length > max ? newItems.slice(0, -1) : newItems\n}\n\nexport const skipToken = Symbol()\nexport type SkipToken = typeof skipToken\n\nexport function ensureQueryFn<\n TQueryFnData = unknown,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: {\n queryFn?: QueryFunction | SkipToken\n queryHash?: string\n },\n fetchOptions?: FetchOptions,\n): QueryFunction {\n if (process.env.NODE_ENV !== 'production') {\n if (options.queryFn === skipToken) {\n console.error(\n `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`,\n )\n }\n }\n\n // if we attempt to retry a fetch that was triggered from an initialPromise\n // when we don't have a queryFn yet, we can't retry, so we just return the already rejected initialPromise\n // if an observer has already mounted, we will be able to retry with that queryFn\n if (!options.queryFn && fetchOptions?.initialPromise) {\n return () => fetchOptions.initialPromise!\n }\n\n if (!options.queryFn || options.queryFn === skipToken) {\n return () =>\n Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`))\n }\n\n return options.queryFn\n}\n"],"mappings":";AAoEO,IAAMA,QAAA,GAAW,OAAOC,MAAA,KAAW,eAAe,UAAUC,UAAA;AAE5D,SAASC,KAAA,EAAkB;EAChC,OAAO;AACT;AAEO,SAASC,iBACdC,OAAA,EACAC,KAAA,EACS;EACT,OAAO,OAAOD,OAAA,KAAY,aACrBA,OAAA,CAAmCC,KAAK,IACzCD,OAAA;AACN;AAEO,SAASE,eAAeC,KAAA,EAAiC;EAC9D,OAAO,OAAOA,KAAA,KAAU,YAAYA,KAAA,IAAS,KAAKA,KAAA,KAAUC,QAAA;AAC9D;AAEO,SAASC,eAAeC,SAAA,EAAmBC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