@ryuzaki13/react-foundation-lib 1.2.5 → 1.2.7
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/dist/array/index.js +1 -1
- package/dist/chunks/{array-BBSjoTRy.js → array-D-_yMMUK.js} +2 -2
- package/dist/chunks/{array-BBSjoTRy.js.map → array-D-_yMMUK.js.map} +1 -1
- package/dist/chunks/{formatters--mhLir82.js → formatters-ShRrKmg6.js} +67 -71
- package/dist/chunks/{formatters--mhLir82.js.map → formatters-ShRrKmg6.js.map} +1 -1
- package/dist/chunks/{odata-service-DnPlNGpU.js → odata-service-B5w4YBao.js} +13 -17
- package/dist/chunks/{odata-service-DnPlNGpU.js.map → odata-service-B5w4YBao.js.map} +1 -1
- package/dist/chunks/{validate-nWY_Mla5.js → validate-BzjCBUqb.js} +14 -18
- package/dist/chunks/{validate-nWY_Mla5.js.map → validate-BzjCBUqb.js.map} +1 -1
- package/dist/error-report/index.js +2 -2
- package/dist/excel/index.js +3 -3
- package/dist/excel/index.js.map +1 -1
- package/dist/formatters/index.js +4 -4
- package/dist/hooks/index.js +82 -81
- package/dist/hooks/index.js.map +1 -1
- package/dist/media/index.js +2 -1
- package/dist/media/index.js.map +1 -1
- package/dist/number-scale/index.js +1 -1
- package/dist/number-scale/index.js.map +1 -1
- package/dist/odata-service/index.js +1 -1
- package/dist/pwa/index.js +1 -1
- package/dist/pwa/index.js.map +1 -1
- package/dist/pwa/sw-cache-policy.js +3 -3
- package/dist/pwa/sw-cache-policy.js.map +1 -1
- package/dist/query-client/index.js +5 -5
- package/dist/query-client/index.js.map +1 -1
- package/dist/range-output/index.js +1 -1
- package/dist/range-output/index.js.map +1 -1
- package/dist/table/index.js +3 -3
- package/dist/table/index.js.map +1 -1
- package/dist/tree-table/index.js +1 -1
- package/package.json +33 -33
- package/src/docs/browserAndReact.mdx +150 -0
- package/src/docs/filesAndExcel.mdx +163 -0
- package/src/docs/formatters-runtime.mdx +455 -0
- package/src/docs/formatters.mdx +363 -0
- package/src/docs/odataAndTables.mdx +178 -0
- package/src/docs/pureUtilities.mdx +96 -0
- package/src/docs/runtimeAndState.mdx +155 -0
- package/src/foundationLib.mdx +105 -0
- package/src/file/file.mdx +0 -6
- package/src/formatters/date/date.mdx +0 -6
- package/src/formatters/number/number.mdx +0 -6
- package/src/formatters/valueState/valueState.mdx +0 -6
- package/src/formulas/formulas.mdx +0 -6
- package/src/pwa/pwa.mdx +0 -6
- package/src/query-client/queryClient.mdx +0 -6
package/dist/array/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "../chunks/array-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "../chunks/array-D-_yMMUK.js";
|
|
2
2
|
export { d as addUnique, a as appendMissingIds, e as arrayDeduplicate, l as arrayGroupBy, f as arrayGroupByToArray, t as arrayToMap, o as arrayUniqueBy, m as arraysEqual, n as filterAndDeduplicateIds, p as moveArrayItem, c as moveArrayItemByIndex, r as moveItem, u as normalizeObjects, s as normalizeStringArray, i as pickExistingMapValues };
|
|
@@ -49,7 +49,7 @@ function u(e, t) {
|
|
|
49
49
|
let n = /* @__PURE__ */ new Set();
|
|
50
50
|
return e.filter((e) => {
|
|
51
51
|
let r = String(e[t]);
|
|
52
|
-
return n.has(r)
|
|
52
|
+
return !n.has(r) && (n.add(r), !0);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function d(e) {
|
|
@@ -143,4 +143,4 @@ function S(e, t, n) {
|
|
|
143
143
|
//#endregion
|
|
144
144
|
export { e as _, d as a, t as b, c, f as d, g as f, n as g, m as h, p as i, u as l, v as m, x as n, s as o, _ as p, y as r, l as s, S as t, h as u, o as v, i as x, r as y };
|
|
145
145
|
|
|
146
|
-
//# sourceMappingURL=array-
|
|
146
|
+
//# sourceMappingURL=array-D-_yMMUK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-BBSjoTRy.js","names":[],"sources":["../../src/formatters/strings/normalizeText.ts","../../src/array/array.ts","../../src/array/reorder.ts"],"sourcesContent":["export function normalizeText(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : undefined;\n}\n\nexport function normalizeTextWithFallback(value: unknown, fallback = \"\") {\n\treturn normalizeText(value) ?? fallback;\n}\n\nexport function normalizeRequiredText(value: unknown) {\n\treturn normalizeTextWithFallback(value);\n}\n\nexport function normalizeTextToLower(value: unknown): string {\n\tconst normalized = normalizeText(value);\n\treturn normalized ? normalized.toLowerCase() : \"\";\n}\n\nexport function toSafeString(value: unknown): string {\n\treturn value == null ? \"\" : String(value);\n}\n\nconst STRING_SPACES_PATTERN = /[\\s\\u00a0\\u202f]+/gu;\n\n/**\n * Нормализует пользовательский текст: убирает пробелы по краям\n * и сворачивает любые подряд идущие пробельные символы в один обычный пробел.\n */\nexport function normalizeTextSpaces(value: unknown): string {\n\treturn normalizeRequiredText(value).replace(STRING_SPACES_PATTERN, \" \");\n}\n","import { normalizeText } from \"../formatters/strings\";\n\nexport function arrayGroupBy<T>(array: readonly T[], key: keyof T): Record<string, T[]> {\n\treturn array.reduce<Record<string, T[]>>((acc, item) => {\n\t\tconst groupKey = String(item[key]);\n\t\t(acc[groupKey] ||= []).push(item);\n\t\treturn acc;\n\t}, {});\n}\n\nexport function arrayToMap<T>(array: readonly T[], key: keyof T): Record<string, T> {\n\treturn array.reduce<Record<string, T>>((acc, item) => {\n\t\tconst groupKey = String(item[key]);\n\t\tif (!acc[groupKey]) {\n\t\t\tacc[groupKey] = item;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function arrayGroupByToArray<T>(array: readonly T[], key: keyof T): Array<{ key: string; items: T[] }> {\n\tconst grouped = array.reduce<Record<string, T[]>>((acc, item) => {\n\t\tconst groupKey = String(item[key]);\n\t\t(acc[groupKey] ||= []).push(item);\n\t\treturn acc;\n\t}, {});\n\n\treturn Object.entries(grouped).map(([key, items]) => ({\n\t\tkey,\n\t\titems\n\t}));\n}\n\nexport function arrayUniqueBy<T>(array: readonly T[], key: keyof T): T[] {\n\tconst seen = new Set<string>();\n\treturn array.filter((item) => {\n\t\tconst value = String(item[key]);\n\t\tif (seen.has(value)) return false;\n\t\tseen.add(value);\n\t\treturn true;\n\t});\n}\n\n/**\n * Удаляет дубликаты из массива с сохранением первого вхождения.\n *\n * Нужна для нормализации списков примитивных значений перед передачей\n * в кеш-ключи, SQL-запросы и другие слои, где повторные элементы не несут смысла.\n */\nexport function arrayDeduplicate<T>(array: readonly T[]): T[] {\n\tconst out: T[] = [];\n\tconst seen = new Set<T>();\n\n\tfor (const item of array) {\n\t\tif (seen.has(item)) continue;\n\n\t\tseen.add(item);\n\t\tout.push(item);\n\t}\n\n\treturn out;\n}\n\n/**\n * Фильтрует массив идентификаторов: оставляет только присутствующие в `allowedIds`,\n * удаляет дубликаты, исключает пустые строки.\n *\n * Зачем: унификация нормализации пользовательских списков ID\n * (grouped columns, locked visible columns и т.п.) перед вычислением layout.\n */\nexport function filterAndDeduplicateIds<TId extends string>(ids: readonly string[] | undefined, allowedIds: readonly TId[]): TId[] {\n\tconst known = new Map<string, TId>(allowedIds.map((id) => [id, id]));\n\tconst out: TId[] = [];\n\tconst seen = new Set<string>();\n\n\tfor (const id of ids ?? []) {\n\t\tif (!id || seen.has(id)) continue;\n\t\tconst knownId = known.get(id);\n\t\tif (!knownId) continue;\n\t\tseen.add(id);\n\t\tout.push(knownId);\n\t}\n\n\treturn out;\n}\n\nexport function appendMissingIds<TId extends string>(baseIds: readonly TId[], idsToAppend: readonly TId[]): TId[] {\n\tconst out = [...baseIds];\n\tconst seen = new Set(baseIds);\n\n\tfor (const id of idsToAppend) {\n\t\tif (!id || seen.has(id)) continue;\n\t\tseen.add(id);\n\t\tout.push(id);\n\t}\n\n\treturn out;\n}\n\nexport function pickExistingMapValues<TKey, TValue>(keys: readonly TKey[], valuesByKey: ReadonlyMap<TKey, TValue>): TValue[] {\n\tconst out: TValue[] = [];\n\n\tfor (const key of keys) {\n\t\tconst value = valuesByKey.get(key);\n\n\t\tif (value !== undefined) {\n\t\t\tout.push(value);\n\t\t}\n\t}\n\n\treturn out;\n}\n\nexport function arraysEqual<T>(left: readonly T[], right: readonly T[]): boolean {\n\tif (left.length !== right.length) return false;\n\n\tfor (let index = 0; index < left.length; index++) {\n\t\tif (left[index] !== right[index]) return false;\n\t}\n\n\treturn true;\n}\n\nexport function moveItem<T>(items: readonly T[], from: number, to: number): T[] {\n\tif (from === to) return [...items];\n\tif (from < 0 || to < 0 || from >= items.length || to >= items.length) return [...items];\n\n\tconst next = [...items];\n\tconst [item] = next.splice(from, 1);\n\tif (item === undefined) return [...items];\n\tnext.splice(to, 0, item);\n\n\treturn next;\n}\n\nexport function normalizeObjects<T, K extends keyof T, O = T>(\n\titems: readonly T[] | undefined,\n\tkey: K,\n\tcopyist?: ((item: T, key: T[K]) => O) | false\n): O[] | undefined {\n\tif (!items) return undefined;\n\n\tconst out: O[] = [];\n\tconst seen = new Set<T[K]>();\n\tconst copyFn = (() => {\n\t\tif (typeof copyist === \"boolean\" && copyist === false) {\n\t\t\treturn (item: T): O => item as unknown as O;\n\t\t}\n\t\tif (typeof copyist === \"function\") {\n\t\t\treturn copyist;\n\t\t}\n\t\treturn (item: T): O => ({ ...item }) as unknown as O;\n\t})();\n\n\tfor (const item of items) {\n\t\tconst normalizedKey = normalizeText(item[key]) as T[K];\n\t\tif (!normalizedKey || seen.has(normalizedKey)) continue;\n\t\tseen.add(normalizedKey);\n\t\tout.push(copyFn(item, normalizedKey));\n\t}\n\n\treturn out.length ? out : undefined;\n}\n\nexport function normalizeStringArray(items: readonly string[] | undefined): string[] | undefined {\n\tif (!items?.length) return undefined;\n\n\tconst out: string[] = [];\n\tconst seen = new Set<string>();\n\n\tfor (const item of items) {\n\t\tconst value = item.trim();\n\t\tif (!value || seen.has(value)) continue;\n\n\t\tseen.add(value);\n\t\tout.push(value);\n\t}\n\n\treturn out.length ? out : undefined;\n}\n\nexport function addUnique(target: string[], seen: Set<string>, fieldId: string | undefined): void {\n\tconst normalizedId = fieldId?.trim();\n\tif (!normalizedId || seen.has(normalizedId)) return;\n\tseen.add(normalizedId);\n\ttarget.push(normalizedId);\n}\n","export type ReorderAction = \"start\" | \"end\" | \"up\" | \"down\";\n\nfunction resolveTargetIndex(args: { index: number; size: number; action: ReorderAction }): number {\n\tconst { index, size, action } = args;\n\n\tswitch (action) {\n\t\tcase \"start\":\n\t\t\treturn 0;\n\t\tcase \"end\":\n\t\t\treturn size - 1;\n\t\tcase \"up\":\n\t\t\treturn index - 1;\n\t\tcase \"down\":\n\t\t\treturn index + 1;\n\t}\n}\n\n/**\n * Перемещает элемент списка по одному из предопределённых действий.\n */\nexport function moveArrayItemByIndex<T>(items: readonly T[], index: number, action: ReorderAction): T[] {\n\tconst nextItems = [...items];\n\tif (index < 0 || index >= nextItems.length) return nextItems;\n\n\tconst targetIndex = resolveTargetIndex({\n\t\tindex,\n\t\tsize: nextItems.length,\n\t\taction\n\t});\n\tif (targetIndex < 0 || targetIndex >= nextItems.length || targetIndex === index) return nextItems;\n\n\tconst [item] = nextItems.splice(index, 1);\n\n\tif (item === undefined) return nextItems;\n\n\tnextItems.splice(targetIndex, 0, item);\n\treturn nextItems;\n}\n\n/**\n * Перемещает элемент списка из одного индекса в другой.\n */\nexport function moveArrayItem<T>(items: readonly T[], fromIndex: number, toIndex: number): T[] {\n\tconst nextItems = [...items];\n\n\tif (fromIndex < 0 || fromIndex >= nextItems.length || toIndex < 0 || toIndex >= nextItems.length || fromIndex === toIndex) {\n\t\treturn nextItems;\n\t}\n\n\tconst [item] = nextItems.splice(fromIndex, 1);\n\n\tif (item === undefined) {\n\t\treturn nextItems;\n\t}\n\n\tnextItems.splice(toInd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AO,EAAI,SAAS,IAAM,KAAA;AAC3B;AAEA,SAAgB,EAAU,GAAkB,GAAmB,GAAmC;CACjG,IAAM,IAAe,GAAS,KAAK;CAC/B,CAAC,KAAgB,EAAK,IAAI,CAAY,MAC1C,EAAK,IAAI,CAAY,GACrB,EAAO,KAAK,CAAY;AACzB;;;ACxLA,SAAS,EAAmB,GAAsE;CACjG,IAAM,EAAE,UAAO,SAAM,cAAW;CAEhC,QAAQ,GAAR;EACC,KAAK,SACJ,OAAO;EACR,KAAK,OACJ,OAAO,IAAO;EACf,KAAK,MACJ,OAAO,IAAQ;EAChB,KAAK,QACJ,OAAO,IAAQ;CACjB;AACD;AAKA,SAAgB,EAAwB,GAAqB,GAAe,GAA4B;CACvG,IAAM,IAAY,CAAC,GAAG,CAAK;CAC3B,IAAI,IAAQ,KAAK,KAAS,EAAU,QAAQ,OAAO;CAEnD,IAAM,IAAc,EAAmB;EACtC;EACA,MAAM,EAAU;EAChB;CACD,CAAC;CACD,IAAI,IAAc,KAAK,KAAe,EAAU,UAAU,MAAgB,GAAO,OAAO;CAExF,IAAM,CAAC,KAAQ,EAAU,OAAO,GAAO,CAAC;CAKxC,OAHI,MAAS,KAAA,KAEb,EAAU,OAAO,GAAa,GAAG,CAAI,GAFN;AAIhC;AAKA,SAAgB,EAAiB,GAAqB,GAAmB,GAAsB;CAC9F,IAAM,IAAY,CAAC,GAAG,CAAK;CAE3B,IAAI,IAAY,KAAK,KAAa,EAAU,UAAU,IAAU,KAAK,KAAW,EAAU,UAAU,MAAc,GACjH,OAAO;CAGR,IAAM,CAAC,KAAQ,EAAU,OAAO,GAAW,CAAC;CAO5C,OALI,MAAS,KAAA,KAIb,EAAU,OAAO,GAAS,GAAG,CAAI,GAHzB;AAKT"}
|
|
1
|
+
{"version":3,"file":"array-D-_yMMUK.js","names":[],"sources":["../../src/formatters/strings/normalizeText.ts","../../src/array/array.ts","../../src/array/reorder.ts"],"sourcesContent":["export function normalizeText(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : undefined;\n}\n\nexport function normalizeTextWithFallback(value: unknown, fallback = \"\") {\n\treturn normalizeText(value) ?? fallback;\n}\n\nexport function normalizeRequiredText(value: unknown) {\n\treturn normalizeTextWithFallback(value);\n}\n\nexport function normalizeTextToLower(value: unknown): string {\n\tconst normalized = normalizeText(value);\n\treturn normalized ? normalized.toLowerCase() : \"\";\n}\n\nexport function toSafeString(value: unknown): string {\n\treturn value == null ? \"\" : String(value);\n}\n\nconst STRING_SPACES_PATTERN = /[\\s\\u00a0\\u202f]+/gu;\n\n/**\n * Нормализует пользовательский текст: убирает пробелы по краям\n * и сворачивает любые подряд идущие пробельные символы в один обычный пробел.\n */\nexport function normalizeTextSpaces(value: unknown): string {\n\treturn normalizeRequiredText(value).replace(STRING_SPACES_PATTERN, \" \");\n}\n","import { normalizeText } from \"../formatters/strings\";\n\nexport function arrayGroupBy<T>(array: readonly T[], key: keyof T): Record<string, T[]> {\n\treturn array.reduce<Record<string, T[]>>((acc, item) => {\n\t\tconst groupKey = String(item[key]);\n\t\t(acc[groupKey] ||= []).push(item);\n\t\treturn acc;\n\t}, {});\n}\n\nexport function arrayToMap<T>(array: readonly T[], key: keyof T): Record<string, T> {\n\treturn array.reduce<Record<string, T>>((acc, item) => {\n\t\tconst groupKey = String(item[key]);\n\t\tif (!acc[groupKey]) {\n\t\t\tacc[groupKey] = item;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function arrayGroupByToArray<T>(array: readonly T[], key: keyof T): Array<{ key: string; items: T[] }> {\n\tconst grouped = array.reduce<Record<string, T[]>>((acc, item) => {\n\t\tconst groupKey = String(item[key]);\n\t\t(acc[groupKey] ||= []).push(item);\n\t\treturn acc;\n\t}, {});\n\n\treturn Object.entries(grouped).map(([key, items]) => ({\n\t\tkey,\n\t\titems\n\t}));\n}\n\nexport function arrayUniqueBy<T>(array: readonly T[], key: keyof T): T[] {\n\tconst seen = new Set<string>();\n\treturn array.filter((item) => {\n\t\tconst value = String(item[key]);\n\t\tif (seen.has(value)) return false;\n\t\tseen.add(value);\n\t\treturn true;\n\t});\n}\n\n/**\n * Удаляет дубликаты из массива с сохранением первого вхождения.\n *\n * Нужна для нормализации списков примитивных значений перед передачей\n * в кеш-ключи, SQL-запросы и другие слои, где повторные элементы не несут смысла.\n */\nexport function arrayDeduplicate<T>(array: readonly T[]): T[] {\n\tconst out: T[] = [];\n\tconst seen = new Set<T>();\n\n\tfor (const item of array) {\n\t\tif (seen.has(item)) continue;\n\n\t\tseen.add(item);\n\t\tout.push(item);\n\t}\n\n\treturn out;\n}\n\n/**\n * Фильтрует массив идентификаторов: оставляет только присутствующие в `allowedIds`,\n * удаляет дубликаты, исключает пустые строки.\n *\n * Зачем: унификация нормализации пользовательских списков ID\n * (grouped columns, locked visible columns и т.п.) перед вычислением layout.\n */\nexport function filterAndDeduplicateIds<TId extends string>(ids: readonly string[] | undefined, allowedIds: readonly TId[]): TId[] {\n\tconst known = new Map<string, TId>(allowedIds.map((id) => [id, id]));\n\tconst out: TId[] = [];\n\tconst seen = new Set<string>();\n\n\tfor (const id of ids ?? []) {\n\t\tif (!id || seen.has(id)) continue;\n\t\tconst knownId = known.get(id);\n\t\tif (!knownId) continue;\n\t\tseen.add(id);\n\t\tout.push(knownId);\n\t}\n\n\treturn out;\n}\n\nexport function appendMissingIds<TId extends string>(baseIds: readonly TId[], idsToAppend: readonly TId[]): TId[] {\n\tconst out = [...baseIds];\n\tconst seen = new Set(baseIds);\n\n\tfor (const id of idsToAppend) {\n\t\tif (!id || seen.has(id)) continue;\n\t\tseen.add(id);\n\t\tout.push(id);\n\t}\n\n\treturn out;\n}\n\nexport function pickExistingMapValues<TKey, TValue>(keys: readonly TKey[], valuesByKey: ReadonlyMap<TKey, TValue>): TValue[] {\n\tconst out: TValue[] = [];\n\n\tfor (const key of keys) {\n\t\tconst value = valuesByKey.get(key);\n\n\t\tif (value !== undefined) {\n\t\t\tout.push(value);\n\t\t}\n\t}\n\n\treturn out;\n}\n\nexport function arraysEqual<T>(left: readonly T[], right: readonly T[]): boolean {\n\tif (left.length !== right.length) return false;\n\n\tfor (let index = 0; index < left.length; index++) {\n\t\tif (left[index] !== right[index]) return false;\n\t}\n\n\treturn true;\n}\n\nexport function moveItem<T>(items: readonly T[], from: number, to: number): T[] {\n\tif (from === to) return [...items];\n\tif (from < 0 || to < 0 || from >= items.length || to >= items.length) return [...items];\n\n\tconst next = [...items];\n\tconst [item] = next.splice(from, 1);\n\tif (item === undefined) return [...items];\n\tnext.splice(to, 0, item);\n\n\treturn next;\n}\n\nexport function normalizeObjects<T, K extends keyof T, O = T>(\n\titems: readonly T[] | undefined,\n\tkey: K,\n\tcopyist?: ((item: T, key: T[K]) => O) | false\n): O[] | undefined {\n\tif (!items) return undefined;\n\n\tconst out: O[] = [];\n\tconst seen = new Set<T[K]>();\n\tconst copyFn = (() => {\n\t\tif (typeof copyist === \"boolean\" && copyist === false) {\n\t\t\treturn (item: T): O => item as unknown as O;\n\t\t}\n\t\tif (typeof copyist === \"function\") {\n\t\t\treturn copyist;\n\t\t}\n\t\treturn (item: T): O => ({ ...item }) as unknown as O;\n\t})();\n\n\tfor (const item of items) {\n\t\tconst normalizedKey = normalizeText(item[key]) as T[K];\n\t\tif (!normalizedKey || seen.has(normalizedKey)) continue;\n\t\tseen.add(normalizedKey);\n\t\tout.push(copyFn(item, normalizedKey));\n\t}\n\n\treturn out.length ? out : undefined;\n}\n\nexport function normalizeStringArray(items: readonly string[] | undefined): string[] | undefined {\n\tif (!items?.length) return undefined;\n\n\tconst out: string[] = [];\n\tconst seen = new Set<string>();\n\n\tfor (const item of items) {\n\t\tconst value = item.trim();\n\t\tif (!value || seen.has(value)) continue;\n\n\t\tseen.add(value);\n\t\tout.push(value);\n\t}\n\n\treturn out.length ? out : undefined;\n}\n\nexport function addUnique(target: string[], seen: Set<string>, fieldId: string | undefined): void {\n\tconst normalizedId = fieldId?.trim();\n\tif (!normalizedId || seen.has(normalizedId)) return;\n\tseen.add(normalizedId);\n\ttarget.push(normalizedId);\n}\n","export type ReorderAction = \"start\" | \"end\" | \"up\" | \"down\";\n\nfunction resolveTargetIndex(args: { index: number; size: number; action: ReorderAction }): number {\n\tconst { index, size, action } = args;\n\n\tswitch (action) {\n\t\tcase \"start\":\n\t\t\treturn 0;\n\t\tcase \"end\":\n\t\t\treturn size - 1;\n\t\tcase \"up\":\n\t\t\treturn index - 1;\n\t\tcase \"down\":\n\t\t\treturn index + 1;\n\t}\n}\n\n/**\n * Перемещает элемент списка по одному из предопределённых действий.\n */\nexport function moveArrayItemByIndex<T>(items: readonly T[], index: number, action: ReorderAction): T[] {\n\tconst nextItems = [...items];\n\tif (index < 0 || index >= nextItems.length) return nextItems;\n\n\tconst targetIndex = resolveTargetIndex({\n\t\tindex,\n\t\tsize: nextItems.length,\n\t\taction\n\t});\n\tif (targetIndex < 0 || targetIndex >= nextItems.length || targetIndex === index) return nextItems;\n\n\tconst [item] = nextItems.splice(index, 1);\n\n\tif (item === undefined) return nextItems;\n\n\tnextItems.splice(targetIndex, 0, item);\n\treturn nextItems;\n}\n\n/**\n * Перемещает элемент списка из одного индекса в другой.\n */\nexport function moveArrayItem<T>(items: readonly T[], fromIndex: number, toIndex: number): T[] {\n\tconst nextItems = [...items];\n\n\tif (fromIndex < 0 || fromIndex >= nextItems.length || toIndex < 0 || toIndex >= nextItems.length || fromIndex === toIndex) {\n\t\treturn nextItems;\n\t}\n\n\tconst [item] = nextItems.splice(fromIndex, 1);\n\n\tif (item === undefined) {\n\t\treturn nextItems;\n\t}\n\n\tnextItems.splice(toIndex, 0, item);\n\treturn nextItems;\n}\n"],"mappings":";AAAA,SAAgB,EAAc,GAAoC;CACjE,IAAI,OAAO,KAAU,UAAU;CAE/B,IAAM,IAAa,EAAM,KAAK;CAC9B,OAAO,EAAW,SAAS,IAAI,IAAa,KAAA;AAC7C;AAEA,SAAgB,EAA0B,GAAgB,IAAW,IAAI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EAAmB,GAAsE;CACjG,IAAM,EAAE,UAAO,SAAM,cAAW;CAEhC,QAAQ,GAAR;EACC,KAAK,SACJ,OAAO;EACR,KAAK,OACJ,OAAO,IAAO;EACf,KAAK,MACJ,OAAO,IAAQ;EAChB,KAAK,QACJ,OAAO,IAAQ;CACjB;AACD;AAKA,SAAgB,EAAwB,GAAqB,GAAe,GAA4B;CACvG,IAAM,IAAY,CAAC,GAAG,CAAK;CAC3B,IAAI,IAAQ,KAAK,KAAS,EAAU,QAAQ,OAAO;CAEnD,IAAM,IAAc,EAAmB;EACtC;EACA,MAAM,EAAU;EAChB;CACD,CAAC;CACD,IAAI,IAAc,KAAK,KAAe,EAAU,UAAU,MAAgB,GAAO,OAAO;CAExF,IAAM,CAAC,KAAQ,EAAU,OAAO,GAAO,CAAC;CAKxC,OAHI,MAAS,KAAA,KAEb,EAAU,OAAO,GAAa,GAAG,CAAI,GAFN;AAIhC;AAKA,SAAgB,EAAiB,GAAqB,GAAmB,GAAsB;CAC9F,IAAM,IAAY,CAAC,GAAG,CAAK;CAE3B,IAAI,IAAY,KAAK,KAAa,EAAU,UAAU,IAAU,KAAK,KAAW,EAAU,UAAU,MAAc,GACjH,OAAO;CAGR,IAAM,CAAC,KAAQ,EAAU,OAAO,GAAW,CAAC;CAO5C,OALI,MAAS,KAAA,KAIb,EAAU,OAAO,GAAS,GAAG,CAAI,GAHzB;AAKT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as e, r as t, x as n } from "./array-
|
|
1
|
+
import { _ as e, r as t, x as n } from "./array-D-_yMMUK.js";
|
|
2
2
|
import { i as r } from "./isRecord-DXDTW-jA.js";
|
|
3
3
|
import { uuidv4 as i } from "../crypto/index.js";
|
|
4
|
-
import { Nt as a, mt as o } from "./odata-service-
|
|
4
|
+
import { Nt as a, mt as o } from "./odata-service-B5w4YBao.js";
|
|
5
5
|
import { R as s, k as c, n as l } from "./dateUtils-B5V5aXB-.js";
|
|
6
|
-
import { c as u, d, h as f, l as p, n as ee, o as te, t as m, u as ne } from "./validate-
|
|
6
|
+
import { c as u, d, h as f, l as p, n as ee, o as te, t as m, u as ne } from "./validate-BzjCBUqb.js";
|
|
7
7
|
import { t as re } from "./string-comparison-BKT7PXmq.js";
|
|
8
8
|
import { isSafe as ie } from "../validators/index.js";
|
|
9
9
|
import { compileTableFormula as ae } from "../formulas/index.js";
|
|
@@ -169,7 +169,7 @@ function Ee(e, t = {}) {
|
|
|
169
169
|
}
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/formatters/date/dateRange.ts
|
|
172
|
-
var De =
|
|
172
|
+
var De = 864e5;
|
|
173
173
|
function S(e) {
|
|
174
174
|
return e instanceof Date && Number.isFinite(e.getTime());
|
|
175
175
|
}
|
|
@@ -256,7 +256,7 @@ function He(e) {
|
|
|
256
256
|
let t = M(e);
|
|
257
257
|
return {
|
|
258
258
|
start: t,
|
|
259
|
-
end: x(t,
|
|
259
|
+
end: x(t, 5)
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
function Ue(e) {
|
|
@@ -361,17 +361,17 @@ function at(e, t) {
|
|
|
361
361
|
groupingSize: e.groupingSize
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function ot(e, t, n, r, i) {
|
|
365
365
|
let a = n.units[t];
|
|
366
366
|
if (!a) return i(e, r);
|
|
367
367
|
let o = e / a.value, s = n.maxDecimals ?? nt(o), c = tt(o, s, n.roundingMode);
|
|
368
|
-
return c >= 1e3 && t > 0 ?
|
|
368
|
+
return c >= 1e3 && t > 0 ? ot(e, t - 1, n, r, i) : `${i(c, at(r, rt(c, s)))}${n.suffixSeparator}${a.suffix}`;
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function st(e) {
|
|
371
371
|
let { minCompactValue: t = F.minCompactValue, roundingMode: n = F.roundingMode, suffixSeparator: r = F.suffixSeparator, maxDecimals: i, units: a = Qe } = e.options, o = Math.abs(e.value);
|
|
372
372
|
if (o < t) return e.formatPlainNumber(e.value, e.preset);
|
|
373
373
|
let s = it(o, a);
|
|
374
|
-
return s === -1 ? e.formatPlainNumber(e.value, e.preset) : `${e.value < 0 ? "-" : ""}${
|
|
374
|
+
return s === -1 ? e.formatPlainNumber(e.value, e.preset) : `${e.value < 0 ? "-" : ""}${ot(o, s, {
|
|
375
375
|
roundingMode: n,
|
|
376
376
|
suffixSeparator: r,
|
|
377
377
|
maxDecimals: i,
|
|
@@ -380,112 +380,112 @@ function ot(e) {
|
|
|
380
380
|
}
|
|
381
381
|
//#endregion
|
|
382
382
|
//#region src/formatters/number/isZeroValue.ts
|
|
383
|
-
function
|
|
383
|
+
function I(e) {
|
|
384
384
|
let t = a(e);
|
|
385
|
-
return typeof t == "number" ? t === 0 : typeof t == "bigint"
|
|
385
|
+
return typeof t == "number" ? t === 0 : typeof t == "bigint" && t === 0n;
|
|
386
386
|
}
|
|
387
387
|
//#endregion
|
|
388
388
|
//#region src/formatters/number/formatNumber.ts
|
|
389
|
-
var
|
|
390
|
-
function
|
|
389
|
+
var L = /* @__PURE__ */ new Map();
|
|
390
|
+
function ct(e, t) {
|
|
391
391
|
if (t === 0) return Math.trunc(e);
|
|
392
392
|
let n = 10 ** t;
|
|
393
393
|
return Math.trunc(e * n) / n;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
let n = `${e}:${+!!t}`, r =
|
|
395
|
+
function R(e, t) {
|
|
396
|
+
let n = `${e}:${+!!t}`, r = L.get(n);
|
|
397
397
|
return r || (r = new Intl.NumberFormat("ru-RU", {
|
|
398
398
|
minimumFractionDigits: e,
|
|
399
399
|
maximumFractionDigits: e,
|
|
400
400
|
useGrouping: t
|
|
401
|
-
}),
|
|
401
|
+
}), L.set(n, r)), r;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function lt(e) {
|
|
404
404
|
return e.groupingSize === 3 && (e.groupingSeparator === ne.groupingSeparator || !e.grouping) && (e.decimalSeparator === "," || e.decimals === 0);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
return
|
|
406
|
+
function ut(e, t, n) {
|
|
407
|
+
return R(t, n).format(e);
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
let n =
|
|
409
|
+
function dt(e, t) {
|
|
410
|
+
let n = R(t.decimals, t.grouping).formatToParts(e), r = "";
|
|
411
411
|
for (let e of n) e.type === "group" ? r += t.groupingSeparator : e.type === "decimal" ? r += t.decimalSeparator : r += e.value;
|
|
412
412
|
return r;
|
|
413
413
|
}
|
|
414
|
-
function
|
|
415
|
-
let n =
|
|
414
|
+
function ft(e, t) {
|
|
415
|
+
let n = R(t.decimals, !1).format(e), r = n.indexOf(","), i = r === -1 ? n : n.slice(0, r), a = r === -1 ? null : n.slice(r + 1), o = i.startsWith("-"), s = o ? i.slice(1) : i, c = t.groupingSize, l = [];
|
|
416
416
|
for (let e = s.length; e > 0; e -= c) l.unshift(s.slice(Math.max(0, e - c), e));
|
|
417
417
|
let u = (o ? "-" : "") + l.join(t.groupingSeparator);
|
|
418
418
|
return a !== null && (u += t.decimalSeparator + a), u;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
return
|
|
420
|
+
function z(e, t) {
|
|
421
|
+
return lt(t) ? ut(e, t.decimals, t.grouping) : t.groupingSize === 3 || !t.grouping ? dt(e, t) : ft(e, t);
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function B(e, t) {
|
|
424
424
|
if (typeof e == "string" && e.trim() === "") return "0";
|
|
425
425
|
let n = Number(e);
|
|
426
426
|
if (!Number.isFinite(n)) return "0";
|
|
427
427
|
let r = f(t);
|
|
428
|
-
return r.compact ?
|
|
428
|
+
return r.compact ? st({
|
|
429
429
|
value: n,
|
|
430
430
|
preset: r,
|
|
431
431
|
options: r.compact,
|
|
432
|
-
formatPlainNumber:
|
|
433
|
-
}) :
|
|
434
|
-
}
|
|
435
|
-
function ft(e) {
|
|
436
|
-
return V(e, p.integer);
|
|
432
|
+
formatPlainNumber: z
|
|
433
|
+
}) : z(n, r);
|
|
437
434
|
}
|
|
438
435
|
function pt(e) {
|
|
439
|
-
return
|
|
436
|
+
return B(e, p.integer);
|
|
440
437
|
}
|
|
441
438
|
function mt(e) {
|
|
442
|
-
return
|
|
439
|
+
return B(e, p.currency);
|
|
443
440
|
}
|
|
444
441
|
function ht(e) {
|
|
445
|
-
return
|
|
442
|
+
return B(e, p.decimal);
|
|
446
443
|
}
|
|
447
444
|
function gt(e) {
|
|
448
|
-
return
|
|
445
|
+
return B(e, p.decimal2);
|
|
449
446
|
}
|
|
450
447
|
function _t(e) {
|
|
451
|
-
return
|
|
448
|
+
return B(e, p.decimal3);
|
|
452
449
|
}
|
|
453
450
|
function vt(e) {
|
|
454
|
-
return
|
|
451
|
+
return B(e, p.percent);
|
|
455
452
|
}
|
|
456
453
|
function yt(e) {
|
|
457
|
-
return
|
|
454
|
+
return B(e, p.price);
|
|
458
455
|
}
|
|
459
456
|
function bt(e) {
|
|
460
|
-
return
|
|
457
|
+
return B(e, p.tonnage);
|
|
461
458
|
}
|
|
462
459
|
function xt(e) {
|
|
463
|
-
return
|
|
460
|
+
return I(e) ? "" : B(e, p.integer);
|
|
464
461
|
}
|
|
465
462
|
function St(e) {
|
|
466
|
-
return
|
|
463
|
+
return I(e) ? "" : B(e, p.currency);
|
|
467
464
|
}
|
|
468
465
|
function Ct(e) {
|
|
469
|
-
return
|
|
466
|
+
return I(e) ? "" : B(e, p.decimal);
|
|
470
467
|
}
|
|
471
468
|
function wt(e) {
|
|
472
|
-
return
|
|
469
|
+
return I(e) ? "" : B(e, p.decimal2);
|
|
473
470
|
}
|
|
474
471
|
function Tt(e) {
|
|
475
|
-
return
|
|
472
|
+
return I(e) ? "" : B(e, p.decimal3);
|
|
476
473
|
}
|
|
477
474
|
function Et(e) {
|
|
478
|
-
return
|
|
475
|
+
return I(e) ? "" : B(e, p.percent);
|
|
479
476
|
}
|
|
480
477
|
function Dt(e) {
|
|
481
|
-
return
|
|
478
|
+
return I(e) ? "" : B(e, p.price);
|
|
479
|
+
}
|
|
480
|
+
function Ot(e) {
|
|
481
|
+
return I(e) ? "" : B(e, p.tonnage);
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
|
|
483
|
+
function kt() {
|
|
484
|
+
L.clear();
|
|
485
485
|
}
|
|
486
486
|
//#endregion
|
|
487
487
|
//#region src/formatters/normalizeLeadingZeros.ts
|
|
488
|
-
function
|
|
488
|
+
function V(e, t) {
|
|
489
489
|
let n = typeof e == "number" ? e : Number(e);
|
|
490
490
|
if (!Number.isFinite(n)) return e;
|
|
491
491
|
let r = String(n);
|
|
@@ -592,7 +592,6 @@ function Mt(e) {
|
|
|
592
592
|
...e,
|
|
593
593
|
config: G(e.config)
|
|
594
594
|
};
|
|
595
|
-
default:
|
|
596
595
|
}
|
|
597
596
|
throw Error(`Недопустимый тип '${e?.type}' для шага FormatterPipeline`);
|
|
598
597
|
}
|
|
@@ -618,7 +617,6 @@ function Nt(e, t) {
|
|
|
618
617
|
position: { ...t },
|
|
619
618
|
config: G(e.config)
|
|
620
619
|
};
|
|
621
|
-
default:
|
|
622
620
|
}
|
|
623
621
|
throw Error(`Недопустимый тип '${e?.type}' для шага FormatterPipeline`);
|
|
624
622
|
}
|
|
@@ -810,7 +808,7 @@ function X(e, t, r) {
|
|
|
810
808
|
let i = o(t.type);
|
|
811
809
|
if (i === "number") {
|
|
812
810
|
let t = r?.numberPresetName?.trim();
|
|
813
|
-
return
|
|
811
|
+
return B(e, t && d(t) ? t : rn.number);
|
|
814
812
|
}
|
|
815
813
|
if (i === "date") {
|
|
816
814
|
let t = r?.datePresetName?.trim(), n = t && s(t) ? t : rn.date;
|
|
@@ -858,7 +856,7 @@ function sn(e) {
|
|
|
858
856
|
let r = t.value, a = "none", s = !1, l = !0, d = "left", f;
|
|
859
857
|
for (let i of n) switch (i.type) {
|
|
860
858
|
case "normalizeLeadingZeros":
|
|
861
|
-
r =
|
|
859
|
+
r = V(r, i.config?.fixed);
|
|
862
860
|
break;
|
|
863
861
|
case "rowBasedOverride":
|
|
864
862
|
if (!on(t, i.config.mode)) break;
|
|
@@ -886,9 +884,7 @@ function sn(e) {
|
|
|
886
884
|
if (!o) break;
|
|
887
885
|
a = Vt(o, r), s = i.config.icon?.enabled ?? !1, l = i.config.icon?.showValue ?? !0, d = i.config.icon?.position ?? "left", f = s ? an(a) : void 0;
|
|
888
886
|
break;
|
|
889
|
-
case "typedValueFormat":
|
|
890
|
-
r = X(r, e.column, i.config);
|
|
891
|
-
break;
|
|
887
|
+
case "typedValueFormat": r = X(r, e.column, i.config);
|
|
892
888
|
}
|
|
893
889
|
return {
|
|
894
890
|
value: r,
|
|
@@ -926,7 +922,7 @@ function un(e) {
|
|
|
926
922
|
return e === void 0 ? !0 : r(e) ? ln(e.numberPresetName) && ln(e.datePresetName) : !1;
|
|
927
923
|
}
|
|
928
924
|
function dn(e) {
|
|
929
|
-
return r(e) ? e.mode === "field" ? typeof e.fieldKey == "string" && Q(e.fallbackToRaw) : e.mode === "formula"
|
|
925
|
+
return r(e) ? e.mode === "field" ? typeof e.fieldKey == "string" && Q(e.fallbackToRaw) : e.mode === "formula" && typeof e.formulaId == "string" && (e.dependencyIds === void 0 || Array.isArray(e.dependencyIds) && e.dependencyIds.every((e) => typeof e == "string")) && Q(e.fallbackToRaw) : !1;
|
|
930
926
|
}
|
|
931
927
|
function fn(e) {
|
|
932
928
|
return typeof e == "number" || r(e) && typeof e.value == "number" && (e.boundary === void 0 || e.boundary === "lower" || e.boundary === "upper");
|
|
@@ -934,28 +930,28 @@ function fn(e) {
|
|
|
934
930
|
function pn(e) {
|
|
935
931
|
if (!r(e) || !r(e.resolver)) return !1;
|
|
936
932
|
let { resolver: t, icon: n } = e;
|
|
937
|
-
return n === void 0 || r(n) && Q(n.enabled) && Q(n.showValue) && (n.position === void 0 || n.position === "left" || n.position === "right") ? t.kind === "fixed" ? r(t.entries) && Object.values(t.entries).every(Z) && (t.fallbackState === void 0 || Z(t.fallbackState)) : t.kind === "threshold"
|
|
933
|
+
return n === void 0 || r(n) && Q(n.enabled) && Q(n.showValue) && (n.position === void 0 || n.position === "left" || n.position === "right") ? t.kind === "fixed" ? r(t.entries) && Object.values(t.entries).every(Z) && (t.fallbackState === void 0 || Z(t.fallbackState)) : t.kind === "threshold" && Array.isArray(t.thresholds) && t.thresholds.every(fn) && Array.isArray(t.states) && t.states.every(Z) && (t.invalidState === void 0 || Z(t.invalidState)) : !1;
|
|
938
934
|
}
|
|
939
935
|
function mn(e) {
|
|
940
|
-
return !r(e) || typeof e.id != "string" ? !1 : e.type === "normalizeLeadingZeros" ? e.config === void 0 || r(e.config) && (e.config.fixed === void 0 || typeof e.config.fixed == "number") : e.type === "rowBasedOverride" ? dn(e.config) : e.type === "resolveValueState" ? pn(e.config) : e.type === "typedValueFormat"
|
|
941
|
-
}
|
|
942
|
-
function $(e) {
|
|
943
|
-
return r(e) && Array.isArray(e.steps) && e.steps.every(mn);
|
|
936
|
+
return !r(e) || typeof e.id != "string" ? !1 : e.type === "normalizeLeadingZeros" ? e.config === void 0 || r(e.config) && (e.config.fixed === void 0 || typeof e.config.fixed == "number") : e.type === "rowBasedOverride" ? dn(e.config) : e.type === "resolveValueState" ? pn(e.config) : e.type === "typedValueFormat" && un(e.config);
|
|
944
937
|
}
|
|
945
938
|
function hn(e) {
|
|
946
|
-
return r(e) &&
|
|
939
|
+
return r(e) && Array.isArray(e.steps) && e.steps.every(mn);
|
|
947
940
|
}
|
|
948
941
|
function gn(e) {
|
|
949
|
-
return
|
|
942
|
+
return r(e) && typeof e.x == "number" && typeof e.y == "number";
|
|
950
943
|
}
|
|
951
944
|
function _n(e) {
|
|
952
|
-
return r(e)
|
|
945
|
+
return !r(e) || typeof e.id != "string" || !gn(e.position) ? !1 : e.type === "source" || e.type === "sink" || mn(e);
|
|
953
946
|
}
|
|
954
947
|
function vn(e) {
|
|
955
|
-
return r(e) &&
|
|
948
|
+
return r(e) && typeof e.id == "string" && typeof e.source == "string" && typeof e.target == "string";
|
|
949
|
+
}
|
|
950
|
+
function $(e) {
|
|
951
|
+
return r(e) && Array.isArray(e.nodes) && e.nodes.every(_n) && Array.isArray(e.edges) && e.edges.every(vn);
|
|
956
952
|
}
|
|
957
953
|
function yn(e) {
|
|
958
|
-
return r(e) && e.version === 1 && (e.plan === void 0 ||
|
|
954
|
+
return r(e) && e.version === 1 && (e.plan === void 0 || hn(e.plan)) && (e.graph === void 0 || $(e.graph)) && (hn(e.plan) || $(e.graph));
|
|
959
955
|
}
|
|
960
956
|
function bn(e) {
|
|
961
957
|
if (yn(e) && m(e).ok) return Lt(e);
|
|
@@ -1177,7 +1173,7 @@ function Fn(e, t, n) {
|
|
|
1177
1173
|
};
|
|
1178
1174
|
}
|
|
1179
1175
|
function In(e, t, n) {
|
|
1180
|
-
return t.shouldRenderEmpty || n.emptyWhenZero &&
|
|
1176
|
+
return t.shouldRenderEmpty || n.emptyWhenZero && I(t.value) ? {
|
|
1181
1177
|
...e,
|
|
1182
1178
|
value: ""
|
|
1183
1179
|
} : e;
|
|
@@ -1229,6 +1225,6 @@ function Hn(e, t) {
|
|
|
1229
1225
|
}
|
|
1230
1226
|
}
|
|
1231
1227
|
//#endregion
|
|
1232
|
-
export {
|
|
1228
|
+
export { ct as $, G as A, Ee as At, gt as B, b as Bt, Vt as C, Oe as Ct, Nt as D, Ae as Dt, Mt as E, ke as Et, kt as F, g as Ft, pt as G, fe as Gt, _t as H, he as Ht, B as I, v as It, Et as J, ce as Jt, xt as K, ue as Kt, mt as L, _ as Lt, H as M, x as Mt, V as N, _e as Nt, Lt as O, w as Ot, At as P, ve as Pt, Ot as Q, St as R, y as Rt, Wt as S, je as St, zt as T, T as Tt, Tt as U, me as Ut, wt as V, ye as Vt, Ct as W, de as Wt, Dt as X, oe as Xt, yt as Y, se as Yt, bt as Z, Bt as _, j as _t, Rn as a, Ye as at, Ut as b, Ge as bt, wn as c, A as ct, sn as d, Ue as dt, I as et, X as f, He as ft, Jt as g, Ke as gt, Yt as h, Ve as ht, Ln as i, qe as it, W as j, Te as jt, U as k, we as kt, Cn as l, Re as lt, tn as m, Be as mt, Bn as n, Ze as nt, zn as o, Xe as ot, nn as p, M as pt, vt as q, le as qt, Vn as r, Je as rt, kn as s, ze as st, Hn as t, P as tt, bn as u, N as ut, Y as v, We as vt, Rt as w, S as wt, J as x, C as xt, Ht as y, k as yt, ht as z, ge as zt };
|
|
1233
1229
|
|
|
1234
|
-
//# sourceMappingURL=formatters
|
|
1230
|
+
//# sourceMappingURL=formatters-ShRrKmg6.js.map
|