PHP 7.4.33
Preview: utils.cjs Size: 8.54 KB
/var/www/gtechmarathon2026.bitkit.dk/httpdocs/node_modules/@tanstack/query-core/build/modern/utils.cjs
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/utils.ts
var utils_exports = {};
__export(utils_exports, {
  addToEnd: () => addToEnd,
  addToStart: () => addToStart,
  ensureQueryFn: () => ensureQueryFn,
  functionalUpdate: () => functionalUpdate,
  hashKey: () => hashKey,
  hashQueryKeyByOptions: () => hashQueryKeyByOptions,
  isPlainArray: () => isPlainArray,
  isPlainObject: () => isPlainObject,
  isServer: () => isServer,
  isValidTimeout: () => isValidTimeout,
  keepPreviousData: () => keepPreviousData,
  matchMutation: () => matchMutation,
  matchQuery: () => matchQuery,
  noop: () => noop,
  partialMatchKey: () => partialMatchKey,
  replaceData: () => replaceData,
  replaceEqualDeep: () => replaceEqualDeep,
  resolveEnabled: () => resolveEnabled,
  resolveStaleTime: () => resolveStaleTime,
  shallowEqualObjects: () => shallowEqualObjects,
  shouldThrowError: () => shouldThrowError,
  skipToken: () => skipToken,
  sleep: () => sleep,
  timeUntilStale: () => timeUntilStale
});
module.exports = __toCommonJS(utils_exports);
var isServer = typeof window === "undefined" || "Deno" in globalThis;
function noop() {
}
function functionalUpdate(updater, input) {
  return typeof updater === "function" ? updater(input) : updater;
}
function isValidTimeout(value) {
  return typeof value === "number" && value >= 0 && value !== Infinity;
}
function timeUntilStale(updatedAt, staleTime) {
  return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
}
function resolveStaleTime(staleTime, query) {
  return typeof staleTime === "function" ? staleTime(query) : staleTime;
}
function resolveEnabled(enabled, query) {
  return typeof enabled === "function" ? 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 (type !== "all") {
    const isActive = query.isActive();
    if (type === "active" && !isActive) {
      return false;
    }
    if (type === "inactive" && isActive) {
      return false;
    }
  }
  if (typeof stale === "boolean" && 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 && typeof a === "object" && typeof b === "object") {
    return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
  }
  return false;
}
function replaceEqualDeep(a, b) {
  if (a === b) {
    return a;
  }
  const array = isPlainArray(a) && isPlainArray(b);
  if (array || isPlainObject(a) && isPlainObject(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 ? [] : {};
    const aItemsSet = new Set(aItems);
    let equalItems = 0;
    for (let i = 0; i < bSize; i++) {
      const key = array ? i : bItems[i];
      if ((!array && aItemsSet.has(key) || array) && a[key] === void 0 && b[key] === void 0) {
        copy[key] = void 0;
        equalItems++;
      } else {
        copy[key] = replaceEqualDeep(a[key], b[key]);
        if (copy[key] === a[key] && a[key] !== void 0) {
          equalItems++;
        }
      }
    }
    return aSize === bSize && equalItems === aSize ? a : copy;
  }
  return b;
}
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 (ctor === void 0) {
    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.prototype.toString.call(o) === "[object Object]";
}
function sleep(timeout) {
  return new Promise((resolve) => {
    setTimeout(resolve, timeout);
  });
}
function replaceData(prevData, data, options) {
  if (typeof options.structuralSharing === "function") {
    return options.structuralSharing(prevData, data);
  } else if (options.structuralSharing !== false) {
    if (process.env.NODE_ENV !== "production") {
      try {
        return replaceEqualDeep(prevData, data);
      } catch (error) {
        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}`
        );
        throw error;
      }
    }
    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 (process.env.NODE_ENV !== "production") {
    if (options.queryFn === skipToken) {
      console.error(
        `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
      );
    }
  }
  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 (typeof throwOnError === "function") {
    return throwOnError(...params);
  }
  return !!throwOnError;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  addToEnd,
  addToStart,
  ensureQueryFn,
  functionalUpdate,
  hashKey,
  hashQueryKeyByOptions,
  isPlainArray,
  isPlainObject,
  isServer,
  isValidTimeout,
  keepPreviousData,
  matchMutation,
  matchQuery,
  noop,
  partialMatchKey,
  replaceData,
  replaceEqualDeep,
  resolveEnabled,
  resolveStaleTime,
  shallowEqualObjects,
  shouldThrowError,
  skipToken,
  sleep,
  timeUntilStale
});
//# sourceMappingURL=utils.cjs.map

Directory Contents

Dirs: 0 × Files: 134
Name Size Perms Modified Actions
2.65 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.35 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
563 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
562 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.56 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.31 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
70.04 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
70.04 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
6.44 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
11.47 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
265 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
262 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
5.26 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
11.42 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
4.33 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.10 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.67 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.67 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.68 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.11 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
5.33 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
8.04 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
744 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
741 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
4.18 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
8.00 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.39 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
6.28 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.31 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.31 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.21 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
6.27 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
7.19 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
13.51 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
170 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
167 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
6.09 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
13.48 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
4.66 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
9.78 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
149 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
146 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.48 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
9.75 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
4.30 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
7.07 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
121 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
118 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.16 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
7.05 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.04 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.70 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.15 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.15 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.93 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.65 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.54 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.93 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
522 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
521 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.45 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.89 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
6.83 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
11.77 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.55 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.55 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
5.69 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
11.75 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
12.71 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
27.12 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
282 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
279 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
11.55 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
27.16 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.53 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
7.75 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
161 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
158 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.36 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
7.73 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
10.82 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
23.29 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
116 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
113 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
9.33 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
23.33 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
17.24 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
33.24 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
118 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
115 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
15.74 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
33.28 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.69 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.46 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
299 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
299 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
686 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.42 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
4.79 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
8.18 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
235 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
232 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.56 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
8.14 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.28 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.72 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.54 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.53 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.22 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.68 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.52 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.07 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
294 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
294 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
522 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.03 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.02 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.77 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.79 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.79 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
961 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
3.72 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
1.32 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
40.32 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.61 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
2.60 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
255 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
40.26 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
8.54 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
16.51 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
674 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
671 B lrw-r--r-- 2025-07-14 06:33:17
Edit Download
6.71 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
16.35 KB lrw-r--r-- 2025-07-14 06:33:17
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).