@catstral/levy-utils 1.0.0

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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +912 -0
  3. package/dist/array/index.d.ts +7 -0
  4. package/dist/array/utils/cluster/index.d.ts +17 -0
  5. package/dist/array/utils/counting/index.d.ts +15 -0
  6. package/dist/array/utils/fork/index.d.ts +14 -0
  7. package/dist/array/utils/list/index.d.ts +65 -0
  8. package/dist/array/utils/select/index.d.ts +14 -0
  9. package/dist/array/utils/sift/index.d.ts +11 -0
  10. package/dist/array/utils/toggle/index.d.ts +34 -0
  11. package/dist/callback/index.d.ts +3 -0
  12. package/dist/callback/utils/chain/index.d.ts +31 -0
  13. package/dist/callback/utils/defer/index.d.ts +9 -0
  14. package/dist/callback/utils/retry/index.d.ts +30 -0
  15. package/dist/error.d.ts +4 -0
  16. package/dist/index.d.ts +8 -0
  17. package/dist/levyUtils.cjs +5 -0
  18. package/dist/levyUtils.js +1198 -0
  19. package/dist/misc/index.d.ts +5 -0
  20. package/dist/misc/utils/compute/index.d.ts +24 -0
  21. package/dist/misc/utils/isEmpty/index.d.ts +19 -0
  22. package/dist/misc/utils/isPrimitive/index.d.ts +18 -0
  23. package/dist/misc/utils/range/index.d.ts +89 -0
  24. package/dist/misc/utils/sleep/index.d.ts +9 -0
  25. package/dist/number/index.d.ts +2 -0
  26. package/dist/number/utils/toFloat/index.d.ts +10 -0
  27. package/dist/number/utils/toInt/index.d.ts +12 -0
  28. package/dist/object/index.d.ts +5 -0
  29. package/dist/object/utils/entries/index.d.ts +7 -0
  30. package/dist/object/utils/isObject/index.d.ts +9 -0
  31. package/dist/object/utils/keys/index.d.ts +4 -0
  32. package/dist/object/utils/omit/index.d.ts +12 -0
  33. package/dist/object/utils/pick/index.d.ts +12 -0
  34. package/dist/string/casing/index.d.ts +11 -0
  35. package/dist/string/casing/internal/splitCasing/index.d.ts +59 -0
  36. package/dist/string/casing/utils/camel/index.d.ts +27 -0
  37. package/dist/string/casing/utils/capitalize/index.d.ts +13 -0
  38. package/dist/string/casing/utils/custom/index.d.ts +42 -0
  39. package/dist/string/casing/utils/http/index.d.ts +27 -0
  40. package/dist/string/casing/utils/kebab/index.d.ts +48 -0
  41. package/dist/string/casing/utils/lower/index.d.ts +13 -0
  42. package/dist/string/casing/utils/pascal/index.d.ts +31 -0
  43. package/dist/string/casing/utils/snake/index.d.ts +48 -0
  44. package/dist/string/casing/utils/title/index.d.ts +27 -0
  45. package/dist/string/casing/utils/uncapitalize/index.d.ts +13 -0
  46. package/dist/string/casing/utils/upper/index.d.ts +13 -0
  47. package/dist/string/index.d.ts +4 -0
  48. package/dist/string/utils/parseUrlParams/index.d.ts +4 -0
  49. package/dist/string/utils/slug/index.d.ts +1 -0
  50. package/dist/string/utils/textDifference/index.d.ts +133 -0
  51. package/dist/types.d.ts +3 -0
  52. package/package.json +63 -0
@@ -0,0 +1,7 @@
1
+ export * from './utils/cluster';
2
+ export * from './utils/counting';
3
+ export * from './utils/fork';
4
+ export * from './utils/list';
5
+ export * from './utils/select';
6
+ export * from './utils/sift';
7
+ export * from './utils/toggle';
@@ -0,0 +1,17 @@
1
+ import { UtilError } from '../../../error';
2
+ export declare class ClusterUtilError extends UtilError {
3
+ readonly util = "cluster";
4
+ }
5
+ /**
6
+ * Clusters a list of items into a list of lists of items limited to a specified size.
7
+ *
8
+ * The time complexity for this is `O(n)` where `n` is the amount of items in the given list.
9
+ *
10
+ * @template T
11
+ * @param {T[]} items The items to cluster
12
+ * @param size The max size for each list
13
+ * @returns {T[][]} An array of arrays with a max size of the specified size
14
+ * @throws {ClusterUtilError} If the cluster size is less then 1
15
+ * @throws {ClusterUtilError} If the given items are not an array
16
+ */
17
+ export declare function cluster<const T>(items: T[], size: number): T[][];
@@ -0,0 +1,15 @@
1
+ import { Key } from '../../../types';
2
+ /**
3
+ * Reduces a list down to an object of keys (specified using the `identity` param)
4
+ * with a number of how many times that identity has been seen.
5
+ *
6
+ * The time complexity for this is `O(n)` where `n` is the amount of items in the list.
7
+ *
8
+ * @template T
9
+ * @template {Key} V
10
+ * @param {T} list The list to count
11
+ * @param {(item: T) => V} identity A function to identify what value to count
12
+ * @returns {Partial<Record<V, number>>} A keyed object with how many times that key showed up.
13
+ * Do note that the keys that didn't show up are not on this object
14
+ */
15
+ export declare function counting<const T, const V extends Key>(list: T[], identity: (item: T) => V): Partial<Record<V, number>>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Returns a tuple of 2 arrays that are constructed from a single list based on a condition given.
3
+ * The first item in the tuple is all the items in the list that pass the specified condition,
4
+ * the second item in the tuple is all the items in the last that did not pass the specified condition.
5
+ *
6
+ * The time complexity for this is `O(n)` where `n` is the amount of items in the given list.
7
+ *
8
+ * @template T
9
+ * @param {T[]} list The given list to fork
10
+ * @param {(item: T) => boolean} condition A callback to compute the condition for each item in the list
11
+ * @returns {[T[], T[]]} A tuple of 2 lists of items split based on the specified condition
12
+ */
13
+ export declare function fork<const T, const V extends T>(list: T[], condition: (item: T) => item is V): [V[], Exclude<T, V>[]];
14
+ export declare function fork<const T>(list: T[], condition: (item: T) => boolean): [T[], T[]];
@@ -0,0 +1,65 @@
1
+ import { UtilError } from '../../../error';
2
+ import { Computable } from '../../../misc/utils/compute';
3
+ export declare class ListUtilError extends UtilError {
4
+ readonly util = "list";
5
+ }
6
+ /**
7
+ * @typedef {Object} ListOptions
8
+ * @template T
9
+ * @prop {T | ((step: number) => T)} [valueMapper] A mapper to map the current step of the list to a given value
10
+ * @prop {number} [step] A number to define the steps that should be used by the list
11
+ */
12
+ export interface ListOptions<T> {
13
+ /**
14
+ * A mapper to map the current step of the list to a given value.
15
+ *
16
+ * @default undefined
17
+ */
18
+ valueMapper?: Computable<T, [step: number]> | undefined;
19
+ /**
20
+ * A number to define the steps that should be used by the list.
21
+ *
22
+ * @default 1
23
+ */
24
+ step?: number;
25
+ }
26
+ /**
27
+ * Returns an array of values from a specified range.
28
+ *
29
+ * If `start` is greater than `end`, the list will traverse negatively (counting down) instead of positively.
30
+ *
31
+ * The time complexity for this is `O(n)` where `n` is the amount of steps needed to construct the result.
32
+ *
33
+ * @example
34
+ * const arr = list(3); // -> [0, 1, 2, 3]
35
+ *
36
+ * @example
37
+ * const arr = list(0, 3); // -> [0, 1, 2, 3]
38
+ *
39
+ * @example
40
+ * const arr = list(3, 0) // -> [3, 2, 1, 0]
41
+ *
42
+ * @example
43
+ * const arr = list(0, 6, { step: 2 }); // -> [0, 2, 4, 6]
44
+ *
45
+ * @example
46
+ * const arr = list(6, 0, { step: -2 }) // -> [6, 4, 2, 0]
47
+ *
48
+ * @example
49
+ * const arr = list(0, 3, { valueMapper: "foo" }) // -> ["foo", "foo", "foo", "foo"]
50
+ *
51
+ * @example
52
+ * const arr = list(0, 3, { valueMapper: (currentStep) => `foo-${currentStep}` }) // -> ["foo-0", "foo-1", "foo-2", "foo-3"]
53
+ *
54
+ * @example
55
+ * const arr = list(0, 6, { step: 2, valueMapper: (currentStep) => `foo-${currentStep}` }) // -> ["foo-0", "foo-2", "foo-4", "foo-6"]
56
+ *
57
+ * @template [T=number]
58
+ * @param {number} startOrLength The start of the list, or if this is the only parameter given, the length of the list (inclusive)
59
+ * @param {number | undefined} [end] The end of the list (inclusive), if this value is not given, the `startOrLength` will be used to determine the end
60
+ * @param {ListOptions<T>} [options] The options used to generate the list (see {@link ListOptions} for more details)
61
+ * @returns {T[]} A list of a specified size (optionally mapped to a specified value)
62
+ * @throws {ListUtilError} If `options.step` is `0`
63
+ * @throws {ListUtilError} If `options.step` is positive while the list traverses negatively (`start` > `end`), or negative while the list traverses positively
64
+ */
65
+ export declare function list<const T = number>(startOrLength: number, end?: number, options?: ListOptions<T>): T[];
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Returns a new list of items based on filtered and mapped values of a given list.
3
+ *
4
+ * The time complexity for this is `O(n)` where `n` is the amount of items in the given list.
5
+ *
6
+ * @template T
7
+ * @template R
8
+ * @param {T[] | readonly T[]} list The list to filter and map values through
9
+ * @param {(item: T, index: number) => boolean} filter A callback to filter out values from the given list
10
+ * @param {(item: T, index: number, originalIndex: number) => R} mapper A mapper to convert the filtered values
11
+ * @returns {R[]} A new list with all filtered and mapped values
12
+ */
13
+ export declare function select<const T, const V extends T, const R>(list: T[] | readonly T[], filter: (item: T, index: number) => item is V, mapper: (item: V, index: number) => R): R[];
14
+ export declare function select<const T, const R>(list: T[] | readonly T[], filter: (item: T, index: number) => boolean, mapper: (item: T, index: number, originalIndex: number) => R): R[];
@@ -0,0 +1,11 @@
1
+ import { Falsy } from '../../../types';
2
+ /**
3
+ * Turns a list of items into another list of items with all the falsy values filtered out of the list.
4
+ *
5
+ * The time complexity for this is `O(n)` where `n` is the amount of items in the list.
6
+ *
7
+ * @template T
8
+ * @param {(T | Falsy)[]} list The list to sift through
9
+ * @returns {T[]} A new list with all the falsy values filtered out
10
+ */
11
+ export declare function sift<const T>(list: (T | Falsy)[]): T[];
@@ -0,0 +1,34 @@
1
+ import { Key } from '../../../types';
2
+ /**
3
+ * @typedef {Object} ToggleOptions
4
+ * @template T
5
+ * @prop {(item: T) => Key} [tokey] A function to turn an item into a key to determine if the value should be toggled
6
+ * @prop {"APPEND" | "PREPEND"} [strategy="APPEND"] The strategy to use when toggling a value
7
+ */
8
+ export interface ToggleOptions<T> {
9
+ /**
10
+ * A function to turn an item into a key to determine if the value should be toggled.
11
+ *
12
+ * @param {T} item The item to turn into a key
13
+ * @returns {Key} A key to identify the item by
14
+ * @default undefined
15
+ */
16
+ toKey?: (item: T) => Key;
17
+ /**
18
+ * The strategy to use when toggling a value.
19
+ * @default "APPEND"
20
+ */
21
+ strategy?: "APPEND" | "PREPEND";
22
+ }
23
+ /**
24
+ * Toggles a value from an array and returns the new array with the value either removed or added.
25
+ *
26
+ * The time complexity for this is `O(n)` where `n` is the amount of items in the list.
27
+ *
28
+ * @template T
29
+ * @param {T[]} list The list to toggle the item from
30
+ * @param {T} itemToToggle The item to toggle from the list
31
+ * @param {ToggleOptions<T>} [options] Options to define how the item should be toggled (see {@link ToggleOptions} for more details)
32
+ * @returns {T[]} A new list with the specified item toggled
33
+ */
34
+ export declare function toggle<const T>(list: T[], itemToToggle: T, options?: ToggleOptions<T>): T[];
@@ -0,0 +1,3 @@
1
+ export * from './utils/chain';
2
+ export * from './utils/defer';
3
+ export * from './utils/retry';
@@ -0,0 +1,31 @@
1
+ export type ChainCallback<V = never> = ((previousValue: V) => unknown) | (() => unknown);
2
+ /**
3
+ * @private
4
+ */
5
+ type _ChainResult<N extends number, T extends ChainCallback[], R extends ChainCallback[], Prev> = N extends R["length"] ? Prev : T extends [infer Current extends ChainCallback<Prev>, ...infer Rest extends ChainCallback[]] ? _ChainResult<N, Rest, [...R, Current], ReturnType<Current>> : never;
6
+ export type ChainResult<T extends ChainCallback[]> = number extends T["length"] ? ReturnType<T[number]> : _ChainResult<T["length"], T, [], undefined>;
7
+ /**
8
+ * @private
9
+ */
10
+ type _Chain<N extends number, T extends ChainCallback[], R extends ChainCallback[], Prev> = N extends R["length"] ? R : T extends [infer Current extends ChainCallback<Prev>, ...infer Rest extends ChainCallback[]] ? _Chain<N, Rest, [...R, Current], ReturnType<Current>> : never;
11
+ export type Chain<T extends ChainCallback[]> = number extends T["length"] ? T : _Chain<T["length"], T, [], undefined>;
12
+ /**
13
+ * Allows chaining many callbacks together with the callback
14
+ * accepting the result of the previous callback as an argument,
15
+ * returning the result of the final callback
16
+ *
17
+ * NOTE: Due to a typescript limitation the arguments of the chained value
18
+ * require a hint in order to infer the argument correctly (it does not allow
19
+ * passing an invalid arugment type however)
20
+ *
21
+ * @example
22
+ * // note the type hint for the argument
23
+ * const result = chain(() => true, (value: boolean) => value ? "true" : "false");
24
+ * // This results in `result` being `"true"`
25
+ *
26
+ * @template {Callback[]} T
27
+ * @param {Chain<T>} callbacks The callbacks to chain together
28
+ * @returns {ChainResult<T>} The returned value of the final chained callback
29
+ */
30
+ export declare function chain<const T extends ChainCallback[]>(...callbacks: Chain<T>): ChainResult<T>;
31
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This will defer a callback to the next execution cycle.
3
+ *
4
+ * The time complexity for this is `O(1)`.
5
+ *
6
+ * @param {Function} callback The callback to defer to the next execution cycle
7
+ * @returns {void}
8
+ */
9
+ export declare function defer(callback: () => void): void;
@@ -0,0 +1,30 @@
1
+ import { UtilError } from '../../../error';
2
+ import { Promisable } from '../../../types';
3
+ export declare class RetryUtilError extends UtilError {
4
+ readonly util = "retry";
5
+ }
6
+ export interface RetryOptions {
7
+ /**
8
+ * Maximum retry attempts is retried.
9
+ *
10
+ * @default 3
11
+ */
12
+ attempts?: number;
13
+ /**
14
+ * Retry delay in milliseconds.
15
+ *
16
+ * @default 1000
17
+ */
18
+ delay?: number;
19
+ /**
20
+ * Whether to use exponential backoff.
21
+ *
22
+ * @default false
23
+ */
24
+ backoff?: boolean;
25
+ /**
26
+ * Callback function on retry.
27
+ */
28
+ onRetry?: (error: unknown, attempt: number) => void;
29
+ }
30
+ export declare function retry<const T>(callback: () => Promisable<T>, options?: RetryOptions): Promise<T>;
@@ -0,0 +1,4 @@
1
+ import type * as utils from ".";
2
+ export declare abstract class UtilError extends Error {
3
+ abstract readonly util: Exclude<keyof typeof utils, `${string}UtilError`>;
4
+ }
@@ -0,0 +1,8 @@
1
+ export * from './array';
2
+ export * from './callback';
3
+ export * from './error';
4
+ export * from './misc';
5
+ export * from './number';
6
+ export * from './object';
7
+ export * from './string';
8
+ export type * from './types';
@@ -0,0 +1,5 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=class extends Error{},u=class extends l{util=`cluster`};function d(e,t){if(t<1)throw new u(`Cluster size cannot be smaller than 1`);if(!Array.isArray(e))throw new u(`Items must be an array`);let n=[[]],r=0;for(let i of e)n[r].length<t?n[r].push(i):(r+=1,n[r]=[i]);return n}function f(e,t){let n={};for(let r of e){let e=t(r);n[e]=(n[e]??0)+1}return n}function p(e,t){let n=[[],[]];for(let r of e)n[+!t(r)].push(r);return n}function m(e){return typeof e==`function`}function h(e,...t){return m(e)?e(...t):e}var g=class extends l{util=`list`};function _(e,t,n){let r=typeof t==`number`?e:0,i=typeof t==`number`?t:e,a=r>i;if(n&&typeof n.step==`number`){if(n.step===0)throw new g(`Step cannot be 0, that would cause the list to become infinite`);if(a&&n.step>0)throw new g(`Given start and end should cause the list to traverse negatively, but step is specified to traverse positively`);if(!a&&n.step<0)throw new g(`Given start and end should cause the list to traverse positively, but step is specified to traverse negatively`)}let o=[];for(;a?r>=i:r<=i;)n?.valueMapper===void 0?o.push(r):o.push(h(n.valueMapper,r)),r+=n?.step??(a?-1:1);return o}function v(e,t,n){let r=[];for(let[i,a]of e.entries())if(t(a,i)){let e=n(a,r.length,i);r.push(e)}return r}function y(e){return e.filter(e=>!!e)}function b(e,t,n){let r=e=>n?.toKey?.(e)??e,i=e.findIndex(e=>r(e)===r(t)),a=[...e];if(i===-1)switch(n?.strategy??`APPEND`){case`APPEND`:a.push(t);break;case`PREPEND`:a.unshift(t)}else a.splice(i,1);return a}function x(...e){let t;for(let n of e)t=n(t);return t}function S(e){setTimeout(()=>{e()},0)}async function C(e){return new Promise(t=>{setTimeout(t,Math.max(e,0))})}var w=class extends l{util=`retry`};async function T(e,t){let n=t?.attempts??3,r=t?.backoff??!1,i=t?.delay??1e3,a=0;for(;;){a+=1;try{return await e()}catch(e){if(a>=n)throw new w(`Callback failed too often, stopping retry loop`,{cause:e});t?.onRetry?.(e,a),await C(i)}r&&(i*=2)}}var E=class extends Error{};function D(e){return typeof e==`function`}function O(e,...t){return D(e)?e(...t):e}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return e==null?!0:typeof e==`string`?e.length===0:k(e)?Object.keys(e).length===0:Array.isArray(e)?e.length===0:!1}function j(e){if(e===null)return!0;switch(typeof e){case`boolean`:case`number`:case`string`:case`symbol`:case`undefined`:return!0;default:return!1}}var M=class extends l{util=`range`};function*N(e,t,n){let r=typeof t==`number`?e:0,i=typeof t==`number`?t:e,a=r>i;if(n&&typeof n.step==`number`){if(n.step===0)throw new M(`Step cannot be 0, that would cause the range to become infinite`);if(a&&n.step>0)throw new M(`Given start and end should cause the range to traverse negatively, but step is specified to traverse positively`);if(!a&&n.step<0)throw new M(`Given start and end should cause the range to traverse positively, but step is specified to traverse negatively`)}for(;a?r>=i:r<=i;)n?.valueMapper===void 0?yield r:yield h(n.valueMapper,r),r+=n?.step??(a?-1:1)}async function ee(e){return new Promise(t=>{setTimeout(t,Math.max(e,0))})}function te(e,t=0){let n;switch(typeof e){case`boolean`:n=+!!e;break;case`number`:case`bigint`:n=Number.parseFloat(e.toString());break;case`string`:n=Number.parseFloat(e);break;default:return t}return Number.isNaN(n)||!Number.isFinite(n)?t:n}function ne(e,t=0){let n=Math.trunc(t),r;switch(typeof e){case`boolean`:r=+!!e;break;case`number`:case`bigint`:r=Number.parseInt(e.toString(),10);break;case`string`:r=Number.parseInt(e,10);break;default:return n}return Number.isNaN(r)||!Number.isFinite(r)?n:r}function re(e){return Object.entries(e)}function ie(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ae(e){return Object.keys(e)}function oe(e,t){let n={...e},r=Array.isArray(t)?t:[t];for(let e of r)delete n[e];return n}function se(e,t){let n={},r=Array.isArray(t)?t:[t];for(let t of r)n[t]=e[t];return n}function ce(e,t){if(t?.parser)return t.parser(e);let n=t?.groupNumbers??!1,r=t?.groupUppercaseLetters??!0,i=[],a=/[A-Z]/,o=/[0-9]/,s=/[\s-_]/,c=``,l=()=>{i.push(c),c=``};for(let t of e.trim()){let e=c.at(-1);if(e===void 0){if(s.test(t))continue;c+=t;continue}if(s.test(t)){l();continue}if(n){if(o.test(t)){if(o.test(e)){c+=t;continue}l(),c+=t;continue}if(o.test(e)){l(),c+=t;continue}}if(a.test(t)){if(r&&a.test(e)){c+=t;continue}l(),c+=t;continue}let u=c.at(-2);r&&a.test(e)&&u!==void 0&&a.test(u)&&(i.push(c.slice(0,-1)),c=e),c+=t}return c.length>0&&l(),i}function P(e,t){let n=ce(e,t),r=n.length-1;return n.reduce((e,n,i)=>(e+=t.transform(n,i),i!==r&&(e+=t.seperator),e),``)}function F(e,t){return P(e,{...t,seperator:``,transform:(e,t)=>t===0?e.toLowerCase():`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`})}function I(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function L(e,t){return P(e,{...t,seperator:`-`,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1).toLowerCase()}`})}function R(e,t){return P(e,{...t,seperator:`-`,transform:e=>t?.screaming?e.toUpperCase():e.toLowerCase()})}function z(e,t){return R(e,{...t,screaming:!0})}function B(e){return e.toLowerCase()}function V(e,t){return P(e,{...t,seperator:``,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`})}function H(e,t){return P(e,{...t,seperator:`_`,transform:e=>t?.screaming?e.toUpperCase():e.toLowerCase()})}function U(e,t){return H(e,{...t,screaming:!0})}function W(e,t){return P(e,{...t,seperator:` `,transform:e=>`${e.slice(0,1).toUpperCase()}${e.slice(1)}`})}function le(e){return`${e.slice(0,1).toLowerCase()}${e.slice(1)}`}function ue(e){return e.toUpperCase()}function de(e,t){let n=new URL(e),r=Object.fromEntries(n.searchParams.entries());if(t){let e={};for(let n in t)e[n]=t[n](r[n]);return e}return r}function fe(e){return e.normalize().toLowerCase().replace(/[^\w ]+/g,``).replace(/ +/g,`-`)}var G=c(o(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
2
+ `,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&amp;`).replace(o,`&lt;`).replace(s,`&gt;`).replace(c,`&para;<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o){if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p)}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
3
+ `),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
4
+ `],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `}n[s+1]=o+encodeURI(this.diffs[s][1])+`
5
+ `}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1),pe=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),me=new Set(`a.abbr.b.bdi.bdo.br.button.cite.code.data.dfn.em.i.img.input.kbd.label.mark.q.rp.rt.ruby.s.samp.select.small.span.strong.sub.sup.textarea.time.u.var.wbr`.split(`.`));function he(e,t){if(e.startsWith(`<!--`,t)){let n=e.indexOf(`-->`,t+4);return n===-1?-1:n+2}let n=null,r=t;for(let i of e.slice(t+1)){if(r+=1,n){i===n&&(n=null);continue}if(i===`"`||i===`'`){n=i;continue}if(i===`>`)return r}return-1}function ge(e){let t=[],n=0;for(;n<e.length;){if(e[n]===`<`){let r=he(e,n);if(r===-1){t.push({kind:`text`,value:e.slice(n)});break}t.push({kind:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}let r=e.indexOf(`<`,n),i=r===-1?e.length:r;t.push({kind:`text`,value:e.slice(n,i)}),n=i}return t}function _e(e){let t=/^<\/?\s*([a-zA-Z][a-zA-Z0-9:-]*)/.exec(e);return t?t[1].toLowerCase():``}function K(e){let t=[],n=[],r=()=>n.length?n[n.length-1].children:t;for(let t of ge(e)){if(t.kind===`text`){t.value&&r().push({kind:`text`,text:t.value});continue}let e=t.value;if(e.startsWith(`<!`)){r().push({kind:`element`,tag:``,openTag:e,closeTag:``,children:[]});continue}let i=_e(e);if(e.startsWith(`</`)){let t=-1;for(let e=n.length-1;e>=0;--e)if(n[e].tag===i){t=e;break}if(t===-1){r().push({kind:`text`,text:e});continue}let a=n[t];for(;n.length>t;)n.pop();a.closeTag=e;continue}let a={kind:`element`,tag:i,openTag:e,closeTag:``,children:[]};r().push(a),!/\/\s*>$/.test(e)&&!pe.has(i)&&n.push(a)}return t}function q(e){return me.has(e)?`INLINE`:`BLOCK`}function J(e){return e.kind===`text`?e.text:`${e.openTag}${e.children.map(J).join(``)}${e.closeTag}`}function Y(e){return e.kind===`text`?`T:${e.text}`:`E:${e.openTag}${e.children.map(Y).join(``)}${e.closeTag}`}function X(e){switch(e){case G.default.DIFF_EQUAL:return`EQUAL`;case G.default.DIFF_INSERT:return`INSERT`;case G.default.DIFF_DELETE:return`DELETE`;default:throw Error(`Got invalid difference marker to determine type`)}}function ve({oldItems:e,newItems:t,key:n}){let r=new Map,i=33,a=()=>{i===55296&&(i=57344);let e=String.fromCharCode(i);return i+=1,e},o=e=>{let t=``;for(let i of e){let e=n(i),o=r.get(e);o===void 0&&(o=a(),r.set(e,o)),t+=o}return t},s=o(e),c=o(t),l=new G.default().diff_main(s,c),u=[],d=0,f=0;for(let[n,r]of l)for(let i of r)n===G.default.DIFF_EQUAL?(u.push({type:`EQUAL`,oldItem:e[d],newItem:t[f]}),d+=1,f+=1):n===G.default.DIFF_DELETE?(u.push({type:`DELETE`,oldItem:e[d]}),d+=1):(u.push({type:`INSERT`,newItem:t[f]}),f+=1);return u}function Z(e,t){let n=new G.default,r=n.diff_main(e,t);return n.diff_cleanupSemantic(r),r.map(([e,t])=>({type:X(e),content:t,context:`INLINE`}))}function Q(e,t){return e.kind===`text`?{type:t,content:e.text,context:`INLINE`}:{type:t,content:J(e),context:q(e.tag)}}function $(e,t){let n=ve({oldItems:e,newItems:t,key:Y}),r=[];for(let e=0;e<n.length;e+=1){let t=n[e];if(t.type===`EQUAL`){r.push(Q(t.oldItem,`EQUAL`));continue}let i=n[e+1];if(t.type===`DELETE`&&i?.type===`INSERT`){let n=t.oldItem,a=i.newItem;if(n.kind===`element`&&a.kind===`element`&&n.tag===a.tag&&n.openTag===a.openTag&&n.closeTag===a.closeTag){r.push({type:`EQUAL`,content:n.openTag,context:q(n.tag)},...$(n.children,a.children)),n.closeTag&&r.push({type:`EQUAL`,content:n.closeTag,context:q(n.tag)}),e+=1;continue}if(n.kind===`text`&&a.kind===`text`){r.push(...Z(n.text,a.text)),e+=1;continue}r.push(Q(n,`DELETE`),Q(a,`INSERT`)),e+=1;continue}if(t.type===`DELETE`){r.push(Q(t.oldItem,`DELETE`));continue}r.push(Q(t.newItem,`INSERT`))}return r}function ye(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.type===n.type&&e.context===n.context){e.content+=n.content;continue}t.push({...n})}return t}function be(e,t,n){let r=n?.htmlAware??!1,i=n?.raw??!1,a=[];if(r){let n=K(e),r=K(t);a.push(...ye($(n,r)))}else{let n=new G.default,r=n.diff_main(e,t);n.diff_cleanupSemantic(r);for(let[e,t]of r)a.push({content:t,type:X(e),context:`UNKNOWN`})}if(!i){let e=``,t=[``,``],i=[``,``],o=[`<span data-diff="insert">`,`</span>`],s=[`<div data-diff="insert">`,`</div>`],c=[`<span data-diff="delete">`,`</span>`],l=[`<div data-diff="delete">`,`</div>`],u=(e,t)=>{let n=t.equal,r=t.insert,i=t.delete;return typeof e.equal==`string`?n=[e.equal,e.equal]:e.equal&&(n=e.equal),typeof e.insert==`string`?r=[e.insert,e.insert]:e.insert&&(r=e.insert),typeof e.delete==`string`?i=[e.delete,e.delete]:e.delete&&(i=e.delete),{equalTags:n,insertTags:r,deleteTags:i}};if(n&&`tags`in n&&n.tags){if(`inlineContext`in n.tags||`blockContext`in n.tags){if(n.tags.inlineContext){let e=u(n.tags.inlineContext,{equal:[``,``],insert:[`<span data-diff="insert">`,`</span>`],delete:[`<span data-diff="delete">`,`</span>`]});t=e.equalTags,o=e.insertTags,c=e.deleteTags}if(n.tags.blockContext){let e=u(n.tags.blockContext,{equal:[``,``],insert:[`<div data-diff="insert">`,`</div>`],delete:[`<div data-diff="delete">`,`</div>`]});i=e.equalTags,s=e.insertTags,l=e.deleteTags}}else if(`equal`in n.tags||`insert`in n.tags||`delete`in n.tags){if(r){let e=u(n.tags,{equal:[``,``],insert:[`<span data-diff="insert">`,`</span>`],delete:[`<span data-diff="delete">`,`</span>`]}),r=u(n.tags,{equal:[``,``],insert:[`<div data-diff="insert">`,`</div>`],delete:[`<div data-diff="delete">`,`</div>`]});t=e.equalTags,i=r.equalTags,o=e.insertTags,s=r.insertTags,c=e.deleteTags,l=r.deleteTags}else{let e=u(n.tags,{equal:[``,``],insert:[`<span data-diff="insert">`,`</span>`],delete:[`<span data-diff="delete">`,`</span>`]});t=e.equalTags,i=e.equalTags,o=e.insertTags,s=e.insertTags,c=e.deleteTags,l=e.deleteTags}}}for(let n of a){let r,a;switch(n.type){case`EQUAL`:switch(n.context){case`BLOCK`:r=i[0],a=i[1];break;case`INLINE`:case`UNKNOWN`:r=t[0],a=t[1]}break;case`INSERT`:switch(n.context){case`BLOCK`:r=s[0],a=s[1];break;case`INLINE`:case`UNKNOWN`:r=o[0],a=o[1]}break;case`DELETE`:switch(n.context){case`BLOCK`:r=l[0],a=l[1];break;case`INLINE`:case`UNKNOWN`:r=c[0],a=c[1]}}e+=`${r}${n.content}${a}`}return e}return a}exports.ClusterUtilError=u,exports.ListUtilError=g,exports.RangeUtilError=M,exports.RetryUtilError=w,exports.UtilError=E,exports.camelCase=F,exports.capitalize=I,exports.chain=x,exports.cluster=d,exports.compute=O,exports.counting=f,exports.customCase=P,exports.defer=S,exports.entries=re,exports.fork=p,exports.httpHeaderCase=L,exports.trainCase=L,exports.isComputation=D,exports.isEmpty=A,exports.isObject=ie,exports.isPrimitive=j,exports.kebabCase=R,exports.keys=ae,exports.list=_,exports.lowerCase=B,exports.omit=oe,exports.parseUrlParams=de,exports.pascalCase=V,exports.pick=se,exports.range=N,exports.retry=T,exports.screamingKebabCase=z,exports.screamingSnakeCase=U,exports.select=v,exports.sift=y,exports.sleep=ee,exports.slug=fe,exports.snakeCase=H,exports.textDifference=be,exports.titleCase=W,exports.toFloat=te,exports.toInt=ne,exports.toggle=b,exports.uncapitalize=le,exports.upperCase=ue;