{"version":3,"file":"scion-toolkit-util.mjs","sources":["../../../../projects/scion/toolkit/util/src/defined.util.ts","../../../../projects/scion/toolkit/util/src/arrays.util.ts","../../../../projects/scion/toolkit/util/src/objects.util.ts","../../../../projects/scion/toolkit/util/src/dictionaries.util.ts","../../../../projects/scion/toolkit/util/src/maps.util.ts","../../../../projects/scion/toolkit/util/src/observables.util.ts","../../../../projects/scion/toolkit/util/src/public_api.ts","../../../../projects/scion/toolkit/util/src/scion-toolkit-util.ts"],"sourcesContent":["/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n *  SPDX-License-Identifier: EPL-2.0\n */\n\n/**\n * Provides utility methods to work with `undefined` values. The value `null` is considered as a defined value.\n *\n * Note: TypeScript 3.7 introduces the `nullish coalescing operator` [1] `(??)`, which is similar to the `Defined` function,\n * but also applies for `null` values.\n *\n * ## Links:\n * [1] https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing\n */\nexport namespace Defined {\n\n  /**\n   * Returns the value if not `undefined`, otherwise \"orElseValue\". The \"orElseValue\" value can be created with a factory function.\n   *\n   * Unlike JavaScript's \"nullish coalescing operator (??)\", the \"orElse\" function only tests for `undefined`, not `null`.\n   */\n  export function orElse<T>(value: T | undefined, orElseValue: T | (() => T)): T {\n    return (value !== undefined ? value : (typeof orElseValue === 'function' ? (orElseValue as (() => T))() : orElseValue)); // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n  }\n\n  /**\n   * Returns the value if not `undefined`, otherwise throws the error created by the passed factory function.\n   */\n  export function orElseThrow<T>(value: T | undefined, orElseThrowFn: () => Error): T {\n    if (value !== undefined) {\n      return value;\n    }\n    throw orElseThrowFn();\n  }\n}\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n *  SPDX-License-Identifier: EPL-2.0\n */\n\nimport {identity} from 'rxjs';\n\n/**\n * Provides array utility methods.\n */\nexport namespace Arrays {\n\n  /**\n   * Returns the value, if an array, or adds it to an array. If `null` or `undefined` is given, by default, returns an empty array.\n   */\n  export function coerce<T>(value: T | T[] | readonly T[] | null | undefined, options?: {coerceNullOrUndefined: true}): NonNullable<T[]>;\n  export function coerce<T>(value: T | T[] | readonly T[] | null | undefined, options: {coerceNullOrUndefined: false}): T[] | null | undefined;\n  export function coerce<T>(value: T | T[] | readonly T[] | null | undefined, options?: {coerceNullOrUndefined?: boolean}): T[] | null | undefined {\n    if (value === null || value === undefined) {\n      if (options?.coerceNullOrUndefined ?? true) {\n        return [];\n      }\n      return value as null | undefined;\n    }\n\n    return Array.isArray(value) ? value : [value as T];\n  }\n\n  /**\n   * Compares items of given arrays for reference equality.\n   *\n   * Use the parameter `exactOrder` to control if the item order must be equal (which is by default) or not.\n   *\n   * @deprecated since version 2.1.0; use {@link Objects.isEqual} instead; API will be removed in version 3.0.0.\n   */\n  export function isEqual(array1: any[] | null | undefined, array2: any[] | null | undefined, options?: {exactOrder?: boolean}): boolean {\n    if (array1 === array2) {\n      return true;\n    }\n    if (!array1 || !array2) {\n      return false;\n    }\n    if (array1.length !== array2.length) {\n      return false;\n    }\n    if (options?.exactOrder ?? true) {\n      return array1.every((item, index) => item === array2[index]);\n    }\n    return array1.every(item => array2.includes(item)) && array2.every(item => array1.includes(item));\n  }\n\n  /**\n   * Removes the specified element from an array, or the elements which satisfy the provided predicate function.\n   * The original array will be changed.\n   *\n   * @param  array - The array from which elements should be removed.\n   * @param  element - The element to be removed, or a predicate function to resolve elements which to be removed.\n   * @param  options - Control if to remove all occurrences of the element. If not specified, all occurrences are removed.\n   * @return the elements removed from the array.\n   */\n  export function remove<T>(array: T[], element: T | ((element: T) => boolean), options?: {firstOnly: boolean}): T[] {\n    const firstOnly = options?.firstOnly ?? false;\n\n    // define a function to resolve the element's index in the original array\n    const indexOfElementFn = ((): () => number => {\n      if (typeof element === 'function') {\n        const predicate = element as (element: T) => boolean;\n        return (): number => array.findIndex(predicate);\n      }\n      else {\n        return (): number => array.indexOf(element);\n      }\n    })();\n\n    const removedElements = [];\n    for (let i = indexOfElementFn(); i !== -1; i = indexOfElementFn()) {\n      removedElements.push(...array.splice(i, 1)); // changes the original array\n      if (firstOnly) {\n        break;\n      }\n    }\n    return removedElements;\n  }\n\n  /**\n   * Removes duplicate items from the array. The original array will not be modified.\n   *\n   * Use the parameter `keySelector` to provide a function for comparing objects.\n   */\n  export function distinct<T>(items: T[] | readonly T[], keySelector: (item: T) => any = identity): T[] {\n    const itemSet = new Set(items.map(keySelector));\n    return items.filter(item => itemSet.delete(keySelector(item)));\n  }\n\n  /**\n   * Intersects the given arrays, returning a new array containing all the elements contained in every array.\n   * Arrays which are `undefined` or `null` are ignored.\n   */\n  export function intersect<T>(...arrays: Array<T[] | readonly T[] | undefined | null>): T[] {\n    const _arrays = arrays.filter(array => array !== undefined && array !== null) as Array<T[]>;\n\n    if (!_arrays.length) {\n      return [];\n    }\n\n    const first = _arrays.pop()!;\n    return _arrays.reduce((intersection, array) => intersection.filter(value => array.includes(value)), [...first]);\n  }\n\n  /**\n   * Returns the last element in the given array, optionally matching the predicate if given.\n   *\n   * Returns `undefined` if no element is found.\n   */\n  export function last<T>(array: T[] | readonly T[] | null | undefined, predicate?: (item: T) => boolean): T | undefined {\n    if (!array?.length) {\n      return undefined;\n    }\n\n    if (!predicate) {\n      return array.at(-1);\n    }\n\n    for (let i = array.length - 1; i >= 0; i--) {\n      if (predicate(array[i]!)) {\n        return array[i];\n      }\n    }\n\n    return undefined;\n  }\n}\n","/*\n * Copyright (c) 2018-2026 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\n/**\n * Provides helper functions for working with objects.\n */\nexport const Objects = {\n\n  /**\n   * Compares two objects for deep equality.\n   *\n   * Supported types: Record, Array, Map, Set, and primitives.\n   *\n   * The property order is ignored when comparing records. The element order in arrays is relevant unless specified otherwise in options.\n   *\n   * @param a - The first object to compare.\n   * @param b - The second object to compare.\n   * @param options - Controls how to compare two objects.\n   * @param options.ignoreArrayOrder - Controls whether to ignore the element order when comparing arrays. By default, the order is not ignored.\n   * @return `true` if objects are equal, false otherwise.\n   */\n  isEqual: (a: unknown, b: unknown, options?: {ignoreArrayOrder?: true}): boolean => {\n    if (a === b) {\n      return true;\n    }\n\n    if (!a || !b) {\n      return false;\n    }\n\n    if (typeof a !== 'object' || typeof b !== 'object') {\n      return false;\n    }\n\n    // Map equality\n    if (a instanceof Map || b instanceof Map) {\n      if (!(a instanceof Map) || !(b instanceof Map)) {\n        return false;\n      }\n\n      if (a.size !== b.size) {\n        return false;\n      }\n\n      return [...a.entries()].every(([key, value]) => b.has(key) && Objects.isEqual(value, b.get(key), options));\n    }\n\n    // Set equality\n    if (a instanceof Set || b instanceof Set) {\n      if (!(a instanceof Set) || !(b instanceof Set)) {\n        return false;\n      }\n\n      if (a.size !== b.size) {\n        return false;\n      }\n\n      return [...a].every(value => [...b].some(other => Objects.isEqual(value, other, options)));\n    }\n\n    // Array equality\n    const ignoreArrayOrder = options?.ignoreArrayOrder ?? false;\n    if (Array.isArray(a) || Array.isArray(b)) {\n      if (!(Array.isArray(a)) || !(Array.isArray(b))) {\n        return false;\n      }\n\n      if (a.length !== b.length) {\n        return false;\n      }\n\n      if (ignoreArrayOrder) {\n        return a.every(value => b.some(other => Objects.isEqual(value, other, options))) && b.every(value => a.some(other => Objects.isEqual(value, other, options)));\n      }\n      else {\n        return a.every((value, index) => Objects.isEqual(value, b[index], options));\n      }\n    }\n\n    // Object literal equality\n    const aKeys = Object.keys(a);\n    const bKeys = Object.keys(b);\n\n    if (aKeys.length !== bKeys.length) {\n      return false;\n    }\n\n    return aKeys.every(key => Objects.isEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key], options));\n  },\n\n  /**\n   * Stringifies given object to matrix notation: a=b;c=d;e=f\n   */\n  toMatrixNotation: (object: Record<string, unknown> | null | undefined): string => {\n    return Object.entries(object ?? {}).map(([key, value]) => `${key}=${value}`).join(';');\n  },\n\n  /**\n   * Like {@link Object.keys}, but preserving the data type of keys.\n   */\n  keys: <T, P extends keyof T>(object: T): P[] => {\n    return Object.keys(object as Record<P, unknown>) as Array<P>;\n  },\n\n  /**\n   * Like {@link Object.values}, but preserving the data type of values and supporting optional properties.\n   */\n  values: <T, P extends keyof T>(object: T): Array<T[P]> => {\n    return Object.values(object as Record<P, T[P]>);\n  },\n\n  /**\n   * Like {@link Object.entries}, but preserving the data type of keys and supporting optional properties.\n   */\n  entries: <T, P extends keyof T>(object: T): Array<[P, T[P]]> => {\n    return Object.entries(object as Record<P, T[P]>) as Array<[P, T[P]]>;\n  },\n} as const;\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n *  SPDX-License-Identifier: EPL-2.0\n */\n\n/**\n * Provides utilities for a dictionary.\n */\nexport namespace Dictionaries {\n\n  /**\n   * Creates a {@link Dictionary} from the given dictionary-like object. If given a `Dictionary`, it is returned. If given `null` or `undefined`, by default, returns an empty {@link Dictionary}.\n   */\n  export function coerce<T = unknown>(dictionaryLike: Dictionary<T> | Map<string, T> | Iterable<[string, T]> | undefined | null, options?: {coerceNullOrUndefined: true}): NonNullable<Dictionary<T>>;\n  export function coerce<T = unknown>(dictionaryLike: Dictionary<T> | Map<string, T> | Iterable<[string, T]> | undefined | null, options: {coerceNullOrUndefined: false}): Dictionary<T> | null | undefined;\n  export function coerce<T = unknown>(dictionaryLike: Dictionary<T> | Map<string, T> | Iterable<[string, T]> | undefined | null, options?: {coerceNullOrUndefined?: boolean}): Dictionary<T> | null | undefined {\n    if (!dictionaryLike) {\n      const orElseEmpty = options?.coerceNullOrUndefined ?? true;\n      return orElseEmpty ? {} : dictionaryLike;\n    }\n\n    if (Symbol.iterator in dictionaryLike) {\n      return Object.fromEntries(dictionaryLike);\n    }\n\n    return dictionaryLike;\n  }\n\n  /**\n   * Returns a new {@link Dictionary} with `undefined` values removed.\n   */\n  export function withoutUndefinedEntries<T = unknown>(object: Dictionary<T | undefined>): Dictionary<T> {\n    return Object.entries(object).reduce<Dictionary<T>>((dictionary, [key, value]) => {\n      if (value !== undefined) {\n        dictionary[key] = value;\n      }\n      return dictionary;\n    }, {});\n  }\n}\n\n/**\n * Represents an object with a variable number of properties, whose keys are not known at development time.\n */\nexport interface Dictionary<T = unknown> {\n  [key: string]: T;\n}\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n *  SPDX-License-Identifier: EPL-2.0\n */\n\nimport {Arrays} from './arrays.util';\nimport {Dictionary} from './dictionaries.util';\n\n/**\n * Provides utilities for {@link Map}.\n */\nexport namespace Maps {\n\n  /**\n   * Creates a {@link Map} from the given map-like object. If given a `Map`, it is returned. If given `null` or `undefined`, by default, returns an empty {@link Map}.\n   */\n  export function coerce<T = unknown>(mapLike: Map<string, T> | Dictionary<T> | Iterable<[string, T]> | undefined | null, options?: {coerceNullOrUndefined: true}): NonNullable<Map<string, T>>;\n  export function coerce<T = unknown>(mapLike: Map<string, T> | Dictionary<T> | Iterable<[string, T]> | undefined | null, options: {coerceNullOrUndefined: false}): Map<string, T> | null | undefined;\n  export function coerce<T = unknown>(mapLike: Map<string, T> | Dictionary<T> | Iterable<[string, T]> | undefined | null, options?: {coerceNullOrUndefined?: boolean}): Map<string, T> | null | undefined {\n    if (!mapLike) {\n      const orElseEmpty = options?.coerceNullOrUndefined ?? true;\n      return orElseEmpty ? new Map() : mapLike;\n    }\n\n    if (mapLike instanceof Map) {\n      return mapLike;\n    }\n\n    if (Symbol.iterator in mapLike) {\n      return new Map(mapLike);\n    }\n\n    return new Map(Object.entries(mapLike));\n  }\n\n  /**\n   * Adds the given value into a {@link Set} in the multi value {@link Map}.\n   */\n  export function addSetValue<K, V>(multiValueMap: Map<K, Set<V>>, key: K, value: V): Map<K, Set<V>> {\n    const values = multiValueMap.get(key) ?? new Set<V>();\n    return multiValueMap.set(key, values.add(value));\n  }\n\n  /**\n   * Removes the given value or values matching the given predicate from the multi {@link Map}.\n   *\n   * @return `true` if the element was removed, or `false` otherwise.\n   */\n  export function removeSetValue<K, V>(multiValueMap: Map<K, Set<V>>, key: K, value: V | PredicateFn<V>): boolean {\n    const values = multiValueMap.get(key) ?? new Set<V>();\n\n    let hasRemoved;\n    if (typeof value === 'function') {\n      const predicateFn = value as PredicateFn<V>;\n      hasRemoved = Array.from(values)\n        .filter(predicateFn)\n        .reduce<boolean>((removed, it) => values.delete(it) || removed, false);\n    }\n    else {\n      hasRemoved = values.delete(value);\n    }\n\n    if (hasRemoved && !values.size) {\n      multiValueMap.delete(key);\n    }\n    return hasRemoved;\n  }\n\n  /**\n   * Adds the given value into an {@link Array} in the multi value {@link Map}.\n   */\n  export function addListValue<K, V>(map: Map<K, V[]>, key: K, value: V): Map<K, V[]> {\n    const values = map.get(key) ?? [];\n    return map.set(key, values.concat(value));\n  }\n\n  /**\n   * Removes the given value or values matching the given predicate from the multi {@link Map}.\n   *\n   * @return `true` if the element was removed, or `false` otherwise.\n   */\n  export function removeListValue<K, V>(multiValueMap: Map<K, V[]>, key: K, value: V | PredicateFn<V>): boolean {\n    const values = multiValueMap.get(key) ?? [];\n    const hasRemoved = Arrays.remove(values, value, {firstOnly: false}).length > 0;\n    if (hasRemoved && !values.length) {\n      multiValueMap.delete(key);\n    }\n    return hasRemoved;\n  }\n}\n\n/**\n * Represents a predicate function which returns `true` or `false`.\n */\nexport type PredicateFn<T> = (value: T) => boolean;\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n *  SPDX-License-Identifier: EPL-2.0\n */\n\nimport {from, Observable, of} from 'rxjs';\n\nexport namespace Observables {\n\n  /**\n   * Creates an `Observable` from the passed value, which will emit the value and then complete,\n   * or, if passing an `Observable`, returns it unchanged. If passing a `Promise`, it is converted\n   * to an `Observable`.\n   */\n  export function coerce<T>(value: T | Observable<T> | Promise<T>): Observable<T> {\n    if (value instanceof Observable) {\n      return value;\n    }\n    if (value instanceof Promise) {\n      return from(value);\n    }\n    return of(value);\n  }\n}\n","/*\n * Copyright (c) 2018-2019 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n *  SPDX-License-Identifier: EPL-2.0\n */\n\n/*\n * Secondary entrypoint: '@scion/toolkit/util'\n * This module does not depend on Angular.\n *\n * @see https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md\n */\nexport {Defined} from './defined.util';\nexport {Arrays} from './arrays.util';\nexport {Objects} from './objects.util';\nexport {Dictionaries, type Dictionary} from './dictionaries.util';\nexport {Maps, type PredicateFn} from './maps.util';\nexport {Observables} from './observables.util';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;AAEH;;;;;;;;AAQG;AACG,IAAW;AAAjB,CAAA,UAAiB,OAAO,EAAA;AAEtB;;;;AAIG;AACH,IAAA,SAAgB,MAAM,CAAI,KAAoB,EAAE,WAA0B,EAAA;AACxE,QAAA,QAAQ,KAAK,KAAK,SAAS,GAAG,KAAK,IAAI,OAAO,WAAW,KAAK,UAAU,GAAI,WAAyB,EAAE,GAAG,WAAW,CAAC,EAAE;IAC1H;AAFgB,IAAA,OAAA,CAAA,MAAM,SAErB;AAED;;AAEG;AACH,IAAA,SAAgB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