@paulirish/trace_engine 0.0.8 → 0.0.10
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/README.md +4 -4
- package/analyze-trace.mjs +7 -4
- package/core/platform/DevToolsPath.d.ts +32 -0
- package/core/platform/DevToolsPath.js +4 -0
- package/core/platform/DevToolsPath.js.map +7 -0
- package/core/platform/MimeType.js +104 -0
- package/core/platform/MimeType.js.map +7 -0
- package/core/platform/Timing.js +10 -0
- package/core/platform/Timing.js.map +7 -0
- package/core/platform/UIString.d.ts +6 -0
- package/core/platform/UIString.js +2 -0
- package/core/platform/UIString.js.map +7 -0
- package/core/platform/UserVisibleError.d.ts +12 -0
- package/core/platform/UserVisibleError.js +14 -0
- package/core/platform/UserVisibleError.js.map +7 -0
- package/core/platform/array-utilities.d.ts +28 -0
- package/core/platform/array-utilities.js +163 -0
- package/core/platform/array-utilities.js.map +7 -0
- package/core/platform/brand.js +1 -0
- package/core/platform/brand.js.map +7 -0
- package/core/platform/bundle-tsconfig.json +1 -0
- package/core/platform/date-utilities.d.ts +2 -0
- package/core/platform/date-utilities.js +10 -0
- package/core/platform/date-utilities.js.map +7 -0
- package/core/platform/dcheck-tsconfig.json +8 -0
- package/core/platform/dcheck.d.ts +4 -0
- package/core/platform/dcheck.js +5 -0
- package/core/platform/devtools_entrypoint-bundle-tsconfig-tsconfig.json +40 -0
- package/core/platform/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/core/platform/dom-utilities.d.ts +6 -0
- package/core/platform/dom-utilities.js +98 -0
- package/core/platform/dom-utilities.js.map +7 -0
- package/core/platform/keyboard-utilities.d.ts +15 -0
- package/core/platform/keyboard-utilities.js +31 -0
- package/core/platform/keyboard-utilities.js.map +7 -0
- package/core/platform/map-utilities.d.ts +14 -0
- package/core/platform/map-utilities.js +70 -0
- package/core/platform/map-utilities.js.map +7 -0
- package/core/platform/number-utilities.d.ts +15 -0
- package/core/platform/number-utilities.js +71 -0
- package/core/platform/number-utilities.js.map +7 -0
- package/core/platform/platform-tsconfig.json +59 -0
- package/core/platform/platform.d.ts +15 -0
- package/core/platform/platform.js +37 -0
- package/core/platform/platform.js.compressed +0 -0
- package/core/platform/platform.js.hash +1 -0
- package/core/platform/platform.js.map +7 -0
- package/core/platform/platform.prebundle.d.ts +15 -0
- package/core/platform/platform.prebundle.js +50 -0
- package/core/platform/platform.prebundle.js.map +1 -0
- package/core/platform/platform.prebundle.ts +64 -0
- package/core/platform/promise-utilities.js +10 -0
- package/core/platform/promise-utilities.js.map +7 -0
- package/core/platform/set-utilities.d.ts +2 -0
- package/core/platform/set-utilities.js +20 -0
- package/core/platform/set-utilities.js.map +7 -0
- package/core/platform/string-utilities.d.ts +40 -0
- package/core/platform/string-utilities.js +439 -0
- package/core/platform/string-utilities.js.map +7 -0
- package/core/platform/typescript-utilities.d.ts +56 -0
- package/core/platform/typescript-utilities.js +13 -0
- package/core/platform/typescript-utilities.js.map +7 -0
- package/generated/protocol.d.ts +16189 -0
- package/generated/protocol.js +2230 -0
- package/models/cpu_profile/CPUProfileDataModel.js +375 -0
- package/models/cpu_profile/CPUProfileDataModel.js.map +7 -0
- package/models/cpu_profile/ProfileTreeModel.js +90 -0
- package/models/cpu_profile/ProfileTreeModel.js.map +7 -0
- package/models/cpu_profile/bundle-tsconfig.json +1 -0
- package/models/cpu_profile/cpu_profile-tsconfig.json +51 -0
- package/models/cpu_profile/cpu_profile.js +7 -0
- package/models/cpu_profile/cpu_profile.js.map +7 -0
- package/models/cpu_profile/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/EntriesFilter.js +182 -0
- package/models/trace/EntriesFilter.js.map +7 -0
- package/models/trace/LegacyTracingModel.d.ts +1 -0
- package/models/trace/LegacyTracingModel.js +1 -0
- package/models/trace/LegacyTracingModel.js.map +7 -0
- package/models/trace/ModelImpl.js +116 -0
- package/models/trace/ModelImpl.js.map +7 -0
- package/models/trace/Processor.js +179 -0
- package/models/trace/Processor.js.map +7 -0
- package/models/trace/SDKServices.js +104 -0
- package/models/trace/SDKServices.js.map +7 -0
- package/models/trace/TraceProcessor.js +133 -0
- package/models/trace/TraceProcessor.js.map +7 -0
- package/models/trace/TracingManager.d.ts +1 -0
- package/models/trace/TracingManager.js +1 -0
- package/models/trace/TracingManager.js.map +7 -0
- package/models/trace/TreeManipulator.js +85 -0
- package/models/trace/TreeManipulator.js.map +7 -0
- package/models/trace/bundle-tsconfig.json +1 -0
- package/models/trace/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/devtools_entrypoint-legacy-typescript-tsconfig.json +43 -0
- package/models/trace/extras/FetchNodes.js +104 -0
- package/models/trace/extras/FetchNodes.js.map +7 -0
- package/models/trace/extras/FilmStrip.js +37 -0
- package/models/trace/extras/FilmStrip.js.map +7 -0
- package/models/trace/extras/MainThreadActivity.js +61 -0
- package/models/trace/extras/MainThreadActivity.js.map +7 -0
- package/models/trace/extras/Metadata.js +28 -0
- package/models/trace/extras/Metadata.js.map +7 -0
- package/models/trace/extras/bundle-tsconfig.json +1 -0
- package/models/trace/extras/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/extras/extras-tsconfig.json +59 -0
- package/models/trace/extras/extras.d.ts +1 -0
- package/models/trace/extras/extras.js +1 -0
- package/models/trace/extras/extras.js.map +7 -0
- package/models/trace/frames/TimelineFrameModel.js +392 -0
- package/models/trace/frames/TimelineFrameModel.js.map +7 -0
- package/models/trace/frames/bundle-tsconfig.json +1 -0
- package/models/trace/frames/devtools_entrypoint-bundle-typescript-tsconfig.json +43 -0
- package/models/trace/frames/frames-tsconfig.json +58 -0
- package/models/trace/frames/frames.js +5 -0
- package/models/trace/frames/frames.js.map +7 -0
- package/models/trace/handlers/AnimationHandler.js +30 -0
- package/models/trace/handlers/AnimationHandler.js.map +7 -0
- package/models/trace/handlers/AuctionWorkletsHandler.js +106 -0
- package/models/trace/handlers/AuctionWorkletsHandler.js.map +7 -0
- package/models/trace/handlers/FramesHandler.js +388 -0
- package/models/trace/handlers/FramesHandler.js.map +7 -0
- package/models/trace/handlers/GPUHandler.js +50 -0
- package/models/trace/handlers/GPUHandler.js.map +7 -0
- package/models/trace/handlers/InitiatorsHandler.js +133 -0
- package/models/trace/handlers/InitiatorsHandler.js.map +7 -0
- package/models/trace/handlers/InvalidationsHandler.js +98 -0
- package/models/trace/handlers/InvalidationsHandler.js.map +7 -0
- package/models/trace/handlers/LargestImagePaintHandler.js +18 -0
- package/models/trace/handlers/LargestImagePaintHandler.js.map +7 -0
- package/models/trace/handlers/LargestTextPaintHandler.js +18 -0
- package/models/trace/handlers/LargestTextPaintHandler.js.map +7 -0
- package/models/trace/handlers/LayerTreeHandler.js +90 -0
- package/models/trace/handlers/LayerTreeHandler.js.map +7 -0
- package/models/trace/handlers/LayoutShiftsHandler.js +270 -0
- package/models/trace/handlers/LayoutShiftsHandler.js.map +7 -0
- package/models/trace/handlers/MemoryHandler.js +17 -0
- package/models/trace/handlers/MemoryHandler.js.map +7 -0
- package/models/trace/handlers/MetaHandler.js +250 -0
- package/models/trace/handlers/MetaHandler.js.map +7 -0
- package/models/trace/handlers/Migration.js +27 -0
- package/models/trace/handlers/Migration.js.map +7 -0
- package/models/trace/handlers/ModelHandlers.js +22 -0
- package/models/trace/handlers/ModelHandlers.js.map +7 -0
- package/models/trace/handlers/NetworkRequestsHandler.js +237 -0
- package/models/trace/handlers/NetworkRequestsHandler.js.map +7 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js +334 -0
- package/models/trace/handlers/PageLoadMetricsHandler.js.map +7 -0
- package/models/trace/handlers/RendererHandler.js +221 -0
- package/models/trace/handlers/RendererHandler.js.map +7 -0
- package/models/trace/handlers/SamplesHandler.js +178 -0
- package/models/trace/handlers/SamplesHandler.js.map +7 -0
- package/models/trace/handlers/ScreenshotsHandler.js +57 -0
- package/models/trace/handlers/ScreenshotsHandler.js.map +7 -0
- package/models/trace/handlers/Threads.js +77 -0
- package/models/trace/handlers/Threads.js.map +7 -0
- package/models/trace/handlers/UberFramesHandler.js +293 -0
- package/models/trace/handlers/UberFramesHandler.js.map +7 -0
- package/models/trace/handlers/UserInteractionsHandler.js +168 -0
- package/models/trace/handlers/UserInteractionsHandler.js.map +7 -0
- package/models/trace/handlers/UserTimingsHandler.js +97 -0
- package/models/trace/handlers/UserTimingsHandler.js.map +7 -0
- package/models/trace/handlers/WarningsHandler.js +87 -0
- package/models/trace/handlers/WarningsHandler.js.map +7 -0
- package/models/trace/handlers/WorkersHandler.js +50 -0
- package/models/trace/handlers/WorkersHandler.js.map +7 -0
- package/models/trace/handlers/bundle-tsconfig.json +1 -0
- package/models/trace/handlers/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/handlers/handlers-tsconfig.json +79 -0
- package/models/trace/handlers/handlers.js +4 -0
- package/models/trace/handlers/handlers.js.map +7 -0
- package/models/trace/handlers/types.js +18 -0
- package/models/trace/handlers/types.js.map +7 -0
- package/models/trace/helpers/SamplesIntegrator.js +220 -0
- package/models/trace/helpers/SamplesIntegrator.js.map +7 -0
- package/models/trace/helpers/Timing.js +141 -0
- package/models/trace/helpers/Timing.js.map +7 -0
- package/models/trace/helpers/Trace.js +196 -0
- package/models/trace/helpers/Trace.js.map +7 -0
- package/models/trace/helpers/TreeHelpers.js +119 -0
- package/models/trace/helpers/TreeHelpers.js.map +7 -0
- package/models/trace/helpers/bundle-tsconfig.json +1 -0
- package/models/trace/helpers/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/helpers/helpers-tsconfig.json +59 -0
- package/models/trace/helpers/helpers.js +5 -0
- package/models/trace/helpers/helpers.js.map +7 -0
- package/models/trace/legacy-tsconfig.json +1 -0
- package/models/trace/root-causes/LayoutShift.js +370 -0
- package/models/trace/root-causes/LayoutShift.js.map +7 -0
- package/models/trace/root-causes/RootCauses.js +8 -0
- package/models/trace/root-causes/RootCauses.js.map +7 -0
- package/models/trace/root-causes/bundle-tsconfig.json +1 -0
- package/models/trace/root-causes/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/root-causes/root-causes-tsconfig.json +57 -0
- package/models/trace/root-causes/root-causes.js +2 -0
- package/models/trace/root-causes/root-causes.js.map +7 -0
- package/models/trace/sdk_services/DOMNodeLookup.js +41 -0
- package/models/trace/sdk_services/DOMNodeLookup.js.map +7 -0
- package/models/trace/sdk_services/LayoutShifts.js +68 -0
- package/models/trace/sdk_services/LayoutShifts.js.map +7 -0
- package/models/trace/sdk_services/bundle-tsconfig.json +1 -0
- package/models/trace/sdk_services/devtools_entrypoint-bundle-typescript-tsconfig.json +41 -0
- package/models/trace/sdk_services/sdk_services-tsconfig.json +57 -0
- package/models/trace/sdk_services/sdk_services.js +7 -0
- package/models/trace/sdk_services/sdk_services.js.map +7 -0
- package/models/trace/trace-legacy.js +16 -0
- package/models/trace/trace-legacy.js.map +7 -0
- package/models/trace/trace-tsconfig.json +69 -0
- package/models/trace/trace.js +23 -0
- package/models/trace/trace.js.map +7 -0
- package/models/trace/types/Configuration.js +18 -0
- package/models/trace/types/Configuration.js.map +7 -0
- package/models/trace/types/File.js +6 -0
- package/models/trace/types/File.js.map +7 -0
- package/models/trace/types/Timing.js +17 -0
- package/models/trace/types/Timing.js.map +7 -0
- package/models/trace/types/TraceEvents.js +595 -0
- package/models/trace/types/TraceEvents.js.map +7 -0
- package/models/trace/types/bundle-tsconfig.json +1 -0
- package/models/trace/types/devtools_entrypoint-bundle-typescript-tsconfig.json +44 -0
- package/models/trace/types/types-tsconfig.json +47 -0
- package/models/trace/types/types.js +5 -0
- package/models/trace/types/types.js.map +7 -0
- package/models/trace/worker/Processor.js +143 -0
- package/models/trace/worker/Processor.js.map +7 -0
- package/models/trace/worker/Types.js +1 -0
- package/models/trace/worker/Types.js.map +7 -0
- package/models/trace/worker/bundle-tsconfig.json +1 -0
- package/models/trace/worker/devtools_entrypoint-bundle-typescript-tsconfig.json +41 -0
- package/models/trace/worker/devtools_entrypoint-worker_entrypoint-typescript-tsconfig.json +41 -0
- package/models/trace/worker/processor-tsconfig.json +45 -0
- package/models/trace/worker/worker.js +7 -0
- package/models/trace/worker/worker.js.map +7 -0
- package/models/trace/worker/worker_entrypoint-tsconfig.json +1 -0
- package/models/trace/worker/worker_entrypoint.js +36 -0
- package/models/trace/worker/worker_entrypoint.js.map +7 -0
- package/package.json +2 -2
- package/trace.mjs +15 -8
- package/trace.mjs.map +3 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 Google Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Redistribution and use in source and binary forms, with or without
|
|
5
|
+
* modification, are permitted provided that the following conditions are
|
|
6
|
+
* met:
|
|
7
|
+
*
|
|
8
|
+
* * Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* * Redistributions in binary form must reproduce the above
|
|
11
|
+
* copyright notice, this list of conditions and the following disclaimer
|
|
12
|
+
* in the documentation and/or other materials provided with the
|
|
13
|
+
* distribution.
|
|
14
|
+
* * Neither the name of Google Inc. nor the names of its
|
|
15
|
+
* contributors may be used to endorse or promote products derived from
|
|
16
|
+
* this software without specific prior written permission.
|
|
17
|
+
*
|
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
19
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
20
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
21
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
22
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
24
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
25
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
26
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import * as ArrayUtilities from './array-utilities.js';
|
|
32
|
+
import * as DateUtilities from './date-utilities.js';
|
|
33
|
+
import * as DevToolsPath from './DevToolsPath.js';
|
|
34
|
+
import * as DOMUtilities from './dom-utilities.js';
|
|
35
|
+
import * as KeyboardUtilities from './keyboard-utilities.js';
|
|
36
|
+
import * as MapUtilities from './map-utilities.js';
|
|
37
|
+
import * as NumberUtilities from './number-utilities.js';
|
|
38
|
+
import * as SetUtilities from './set-utilities.js';
|
|
39
|
+
import * as StringUtilities from './string-utilities.js';
|
|
40
|
+
import * as TypeScriptUtilities from './typescript-utilities.js';
|
|
41
|
+
import * as UIString from './UIString.js';
|
|
42
|
+
import * as UserVisibleError from './UserVisibleError.js';
|
|
43
|
+
|
|
44
|
+
export {DCHECK} from './dcheck.js';
|
|
45
|
+
/* `assertNotNull` also need to be exposed, as TypeScript does not
|
|
46
|
+
* allow `asserts` functions to be used with qualified access
|
|
47
|
+
* (e.g. `Platform.TypeScriptUtilities.assertNotNull` causes a
|
|
48
|
+
* compiler error)
|
|
49
|
+
*/
|
|
50
|
+
export {assertNever, assertNotNullOrUndefined, assertUnhandled} from './typescript-utilities.js';
|
|
51
|
+
export {
|
|
52
|
+
ArrayUtilities,
|
|
53
|
+
DateUtilities,
|
|
54
|
+
DevToolsPath,
|
|
55
|
+
DOMUtilities,
|
|
56
|
+
KeyboardUtilities,
|
|
57
|
+
MapUtilities,
|
|
58
|
+
NumberUtilities,
|
|
59
|
+
SetUtilities,
|
|
60
|
+
StringUtilities,
|
|
61
|
+
TypeScriptUtilities,
|
|
62
|
+
UIString,
|
|
63
|
+
UserVisibleError,
|
|
64
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../front_end/core/platform/promise-utilities.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright 2023 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * Returns a new pending promise together with it's resolve and reject functions.\n *\n * Polyfill for https://github.com/tc39/proposal-promise-with-resolvers.\n */\nexport function promiseWithResolvers<T = unknown>(): {\n promise: Promise<T>,\n resolve: (value: T|PromiseLike<T>) => void,\n reject: (error?: Error) => void,\n} {\n let resolve!: (value: T|PromiseLike<T>) => void;\n let reject!: (error?: Error) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return {promise, resolve, reject};\n}\n"],
|
|
5
|
+
"mappings": "AASO,uCAIL;AACA,MAAI;AACJ,MAAI;AACJ,QAAM,UAAU,IAAI,QAAW,CAAC,KAAK,QAAQ;AAC3C,cAAU;AACV,aAAS;AAAA;AAEX,SAAO,EAAC,SAAS,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const addAll = function(set, iterable) {
|
|
2
|
+
for (const item of iterable) {
|
|
3
|
+
set.add(item);
|
|
4
|
+
}
|
|
5
|
+
};
|
|
6
|
+
export const isEqual = function(setA, setB) {
|
|
7
|
+
if (setA === setB) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (setA.size !== setB.size) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
for (const item of setA) {
|
|
14
|
+
if (!setB.has(item)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=set-utilities.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../front_end/core/platform/set-utilities.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport const addAll = function<T>(set: Set<T>, iterable: Iterable<T>): void {\n for (const item of iterable) {\n set.add(item);\n }\n};\n\nexport const isEqual = function<T>(setA: Set<T>, setB: Set<T>): boolean {\n if (setA === setB) {\n return true;\n }\n if (setA.size !== setB.size) {\n return false;\n }\n for (const item of setA) {\n if (!setB.has(item)) {\n return false;\n }\n }\n return true;\n};\n"],
|
|
5
|
+
"mappings": "AAIO,aAAM,SAAS,SAAY,KAAa,UAA6B;AAC1E,aAAW,QAAQ,UAAU;AAC3B,QAAI,IAAI;AAAA;AAAA;AAIL,aAAM,UAAU,SAAY,MAAc,MAAuB;AACtE,MAAI,SAAS,MAAM;AACjB,WAAO;AAAA;AAET,MAAI,KAAK,SAAS,KAAK,MAAM;AAC3B,WAAO;AAAA;AAET,aAAW,QAAQ,MAAM;AACvB,QAAI,CAAC,KAAK,IAAI,OAAO;AACnB,aAAO;AAAA;AAAA;AAGX,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const escapeCharacters: (inputString: string, charsToEscape: string) => string;
|
|
2
|
+
export declare const formatAsJSLiteral: (content: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* This implements a subset of the sprintf() function described in the Single UNIX
|
|
5
|
+
* Specification. It supports the %s, %f, %d, and %% formatting specifiers, and
|
|
6
|
+
* understands the %m$d notation to select the m-th parameter for this substitution,
|
|
7
|
+
* as well as the optional precision for %s, %f, and %d.
|
|
8
|
+
*
|
|
9
|
+
* @param fmt format string.
|
|
10
|
+
* @param args parameters to the format string.
|
|
11
|
+
* @returns the formatted output string.
|
|
12
|
+
*/
|
|
13
|
+
export declare const sprintf: (fmt: string, ...args: unknown[]) => string;
|
|
14
|
+
export declare const toBase64: (inputString: string) => string;
|
|
15
|
+
export declare const findIndexesOfSubString: (inputString: string, searchString: string) => number[];
|
|
16
|
+
export declare const findLineEndingIndexes: (inputString: string) => number[];
|
|
17
|
+
export declare const isWhitespace: (inputString: string) => boolean;
|
|
18
|
+
export declare const trimURL: (url: string, baseURLDomain?: string) => string;
|
|
19
|
+
export declare const collapseWhitespace: (inputString: string) => string;
|
|
20
|
+
export declare const reverse: (inputString: string) => string;
|
|
21
|
+
export declare const replaceControlCharacters: (inputString: string) => string;
|
|
22
|
+
export declare const countWtf8Bytes: (inputString: string) => number;
|
|
23
|
+
export declare const stripLineBreaks: (inputStr: string) => string;
|
|
24
|
+
export declare const toTitleCase: (inputStr: string) => string;
|
|
25
|
+
export declare const removeURLFragment: (inputStr: string) => string;
|
|
26
|
+
export declare const regexSpecialCharacters: () => string;
|
|
27
|
+
export declare const filterRegex: (query: string) => RegExp;
|
|
28
|
+
export declare const createSearchRegex: (query: string, caseSensitive: boolean, isRegex: boolean) => RegExp;
|
|
29
|
+
export declare const caseInsensetiveComparator: (a: string, b: string) => number;
|
|
30
|
+
export declare const hashCode: (string?: string) => number;
|
|
31
|
+
export declare const compare: (a: string, b: string) => number;
|
|
32
|
+
export declare const trimMiddle: (str: string, maxLength: number) => string;
|
|
33
|
+
export declare const trimEndWithMaxLength: (str: string, maxLength: number) => string;
|
|
34
|
+
export declare const escapeForRegExp: (str: string) => string;
|
|
35
|
+
export declare const naturalOrderComparator: (a: string, b: string) => number;
|
|
36
|
+
export declare const base64ToSize: (content: string | null) => number;
|
|
37
|
+
export declare const SINGLE_QUOTE = "'";
|
|
38
|
+
export declare const DOUBLE_QUOTE = "\"";
|
|
39
|
+
export declare const findUnclosedCssQuote: (str: string) => string;
|
|
40
|
+
export declare const createPlainTextSearchRegex: (query: string, flags?: string) => RegExp;
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
export const escapeCharacters = (inputString, charsToEscape) => {
|
|
2
|
+
let foundChar = false;
|
|
3
|
+
for (let i = 0; i < charsToEscape.length; ++i) {
|
|
4
|
+
if (inputString.indexOf(charsToEscape.charAt(i)) !== -1) {
|
|
5
|
+
foundChar = true;
|
|
6
|
+
break;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
if (!foundChar) {
|
|
10
|
+
return String(inputString);
|
|
11
|
+
}
|
|
12
|
+
let result = "";
|
|
13
|
+
for (let i = 0; i < inputString.length; ++i) {
|
|
14
|
+
if (charsToEscape.indexOf(inputString.charAt(i)) !== -1) {
|
|
15
|
+
result += "\\";
|
|
16
|
+
}
|
|
17
|
+
result += inputString.charAt(i);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
const toHexadecimal = (charCode, padToLength) => {
|
|
22
|
+
return charCode.toString(16).toUpperCase().padStart(padToLength, "0");
|
|
23
|
+
};
|
|
24
|
+
const escapedReplacements = /* @__PURE__ */ new Map([
|
|
25
|
+
["\b", "\\b"],
|
|
26
|
+
["\f", "\\f"],
|
|
27
|
+
["\n", "\\n"],
|
|
28
|
+
["\r", "\\r"],
|
|
29
|
+
[" ", "\\t"],
|
|
30
|
+
["\v", "\\v"],
|
|
31
|
+
["'", "\\'"],
|
|
32
|
+
["\\", "\\\\"],
|
|
33
|
+
["<!--", "\\x3C!--"],
|
|
34
|
+
["<script", "\\x3Cscript"],
|
|
35
|
+
["<\/script", "\\x3C/script"]
|
|
36
|
+
]);
|
|
37
|
+
export const formatAsJSLiteral = (content) => {
|
|
38
|
+
const patternsToEscape = /(\\|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu;
|
|
39
|
+
const patternsToEscapePlusSingleQuote = /(\\|'|<(?:!--|\/?script))|(\p{Control})|(\p{Surrogate})/gu;
|
|
40
|
+
const escapePattern = (match, pattern, controlChar, loneSurrogate) => {
|
|
41
|
+
if (controlChar) {
|
|
42
|
+
if (escapedReplacements.has(controlChar)) {
|
|
43
|
+
return escapedReplacements.get(controlChar);
|
|
44
|
+
}
|
|
45
|
+
const twoDigitHex = toHexadecimal(controlChar.charCodeAt(0), 2);
|
|
46
|
+
return "\\x" + twoDigitHex;
|
|
47
|
+
}
|
|
48
|
+
if (loneSurrogate) {
|
|
49
|
+
const fourDigitHex = toHexadecimal(loneSurrogate.charCodeAt(0), 4);
|
|
50
|
+
return "\\u" + fourDigitHex;
|
|
51
|
+
}
|
|
52
|
+
if (pattern) {
|
|
53
|
+
return escapedReplacements.get(pattern) || "";
|
|
54
|
+
}
|
|
55
|
+
return match;
|
|
56
|
+
};
|
|
57
|
+
let escapedContent = "";
|
|
58
|
+
let quote = "";
|
|
59
|
+
if (!content.includes("'")) {
|
|
60
|
+
quote = "'";
|
|
61
|
+
escapedContent = content.replaceAll(patternsToEscape, escapePattern);
|
|
62
|
+
} else if (!content.includes('"')) {
|
|
63
|
+
quote = '"';
|
|
64
|
+
escapedContent = content.replaceAll(patternsToEscape, escapePattern);
|
|
65
|
+
} else if (!content.includes("`") && !content.includes("${")) {
|
|
66
|
+
quote = "`";
|
|
67
|
+
escapedContent = content.replaceAll(patternsToEscape, escapePattern);
|
|
68
|
+
} else {
|
|
69
|
+
quote = "'";
|
|
70
|
+
escapedContent = content.replaceAll(patternsToEscapePlusSingleQuote, escapePattern);
|
|
71
|
+
}
|
|
72
|
+
return `${quote}${escapedContent}${quote}`;
|
|
73
|
+
};
|
|
74
|
+
export const sprintf = (fmt, ...args) => {
|
|
75
|
+
let argIndex = 0;
|
|
76
|
+
const RE = /%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g;
|
|
77
|
+
return fmt.replaceAll(RE, (_, index, precision, specifier) => {
|
|
78
|
+
if (specifier === "%") {
|
|
79
|
+
return "%";
|
|
80
|
+
}
|
|
81
|
+
if (index !== void 0) {
|
|
82
|
+
argIndex = parseInt(index, 10) - 1;
|
|
83
|
+
if (argIndex < 0) {
|
|
84
|
+
throw new RangeError(`Invalid parameter index ${argIndex + 1}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (argIndex >= args.length) {
|
|
88
|
+
throw new RangeError(`Expected at least ${argIndex + 1} format parameters, but only ${args.length} where given.`);
|
|
89
|
+
}
|
|
90
|
+
if (specifier === "s") {
|
|
91
|
+
const argValue2 = String(args[argIndex++]);
|
|
92
|
+
if (precision !== void 0) {
|
|
93
|
+
return argValue2.substring(0, Number(precision));
|
|
94
|
+
}
|
|
95
|
+
return argValue2;
|
|
96
|
+
}
|
|
97
|
+
let argValue = Number(args[argIndex++]);
|
|
98
|
+
if (isNaN(argValue)) {
|
|
99
|
+
argValue = 0;
|
|
100
|
+
}
|
|
101
|
+
if (specifier === "d") {
|
|
102
|
+
return String(Math.floor(argValue)).padStart(Number(precision), "0");
|
|
103
|
+
}
|
|
104
|
+
if (precision !== void 0) {
|
|
105
|
+
return argValue.toFixed(Number(precision));
|
|
106
|
+
}
|
|
107
|
+
return String(argValue);
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
export const toBase64 = (inputString) => {
|
|
111
|
+
function encodeBits(b) {
|
|
112
|
+
return b < 26 ? b + 65 : b < 52 ? b + 71 : b < 62 ? b - 4 : b === 62 ? 43 : b === 63 ? 47 : 65;
|
|
113
|
+
}
|
|
114
|
+
const encoder = new TextEncoder();
|
|
115
|
+
const data = encoder.encode(inputString.toString());
|
|
116
|
+
const n = data.length;
|
|
117
|
+
let encoded = "";
|
|
118
|
+
if (n === 0) {
|
|
119
|
+
return encoded;
|
|
120
|
+
}
|
|
121
|
+
let shift;
|
|
122
|
+
let v = 0;
|
|
123
|
+
for (let i = 0; i < n; i++) {
|
|
124
|
+
shift = i % 3;
|
|
125
|
+
v |= data[i] << (16 >>> shift & 24);
|
|
126
|
+
if (shift === 2) {
|
|
127
|
+
encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), encodeBits(v & 63));
|
|
128
|
+
v = 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (shift === 0) {
|
|
132
|
+
encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), 61, 61);
|
|
133
|
+
} else if (shift === 1) {
|
|
134
|
+
encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), 61);
|
|
135
|
+
}
|
|
136
|
+
return encoded;
|
|
137
|
+
};
|
|
138
|
+
export const findIndexesOfSubString = (inputString, searchString) => {
|
|
139
|
+
const matches = [];
|
|
140
|
+
let i = inputString.indexOf(searchString);
|
|
141
|
+
while (i !== -1) {
|
|
142
|
+
matches.push(i);
|
|
143
|
+
i = inputString.indexOf(searchString, i + searchString.length);
|
|
144
|
+
}
|
|
145
|
+
return matches;
|
|
146
|
+
};
|
|
147
|
+
export const findLineEndingIndexes = (inputString) => {
|
|
148
|
+
const endings = findIndexesOfSubString(inputString, "\n");
|
|
149
|
+
endings.push(inputString.length);
|
|
150
|
+
return endings;
|
|
151
|
+
};
|
|
152
|
+
export const isWhitespace = (inputString) => {
|
|
153
|
+
return /^\s*$/.test(inputString);
|
|
154
|
+
};
|
|
155
|
+
export const trimURL = (url, baseURLDomain) => {
|
|
156
|
+
let result = url.replace(/^(https|http|file):\/\//i, "");
|
|
157
|
+
if (baseURLDomain) {
|
|
158
|
+
if (result.toLowerCase().startsWith(baseURLDomain.toLowerCase())) {
|
|
159
|
+
result = result.substr(baseURLDomain.length);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
};
|
|
164
|
+
export const collapseWhitespace = (inputString) => {
|
|
165
|
+
return inputString.replace(/[\s\xA0]+/g, " ");
|
|
166
|
+
};
|
|
167
|
+
export const reverse = (inputString) => {
|
|
168
|
+
return inputString.split("").reverse().join("");
|
|
169
|
+
};
|
|
170
|
+
export const replaceControlCharacters = (inputString) => {
|
|
171
|
+
return inputString.replace(/[\0-\x08\x0B\f\x0E-\x1F\x80-\x9F]/g, "\uFFFD");
|
|
172
|
+
};
|
|
173
|
+
export const countWtf8Bytes = (inputString) => {
|
|
174
|
+
let count = 0;
|
|
175
|
+
for (let i = 0; i < inputString.length; i++) {
|
|
176
|
+
const c = inputString.charCodeAt(i);
|
|
177
|
+
if (c <= 127) {
|
|
178
|
+
count++;
|
|
179
|
+
} else if (c <= 2047) {
|
|
180
|
+
count += 2;
|
|
181
|
+
} else if (c < 55296 || 57343 < c) {
|
|
182
|
+
count += 3;
|
|
183
|
+
} else {
|
|
184
|
+
if (c <= 56319 && i + 1 < inputString.length) {
|
|
185
|
+
const next = inputString.charCodeAt(i + 1);
|
|
186
|
+
if (56320 <= next && next <= 57343) {
|
|
187
|
+
count += 4;
|
|
188
|
+
i++;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
count += 3;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return count;
|
|
196
|
+
};
|
|
197
|
+
export const stripLineBreaks = (inputStr) => {
|
|
198
|
+
return inputStr.replace(/(\r)?\n/g, "");
|
|
199
|
+
};
|
|
200
|
+
const EXTENDED_KEBAB_CASE_REGEXP = /^([a-z0-9]+(?:-[a-z0-9]+)*\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
201
|
+
export const isExtendedKebabCase = (inputStr) => {
|
|
202
|
+
return EXTENDED_KEBAB_CASE_REGEXP.test(inputStr);
|
|
203
|
+
};
|
|
204
|
+
export const toTitleCase = (inputStr) => {
|
|
205
|
+
return inputStr.substring(0, 1).toUpperCase() + inputStr.substring(1);
|
|
206
|
+
};
|
|
207
|
+
export const removeURLFragment = (inputStr) => {
|
|
208
|
+
const url = new URL(inputStr);
|
|
209
|
+
url.hash = "";
|
|
210
|
+
return url.toString();
|
|
211
|
+
};
|
|
212
|
+
const SPECIAL_REGEX_CHARACTERS = "^[]{}()\\.^$*+?|-,";
|
|
213
|
+
export const regexSpecialCharacters = function() {
|
|
214
|
+
return SPECIAL_REGEX_CHARACTERS;
|
|
215
|
+
};
|
|
216
|
+
export const filterRegex = function(query) {
|
|
217
|
+
let regexString = "^(?:.*\\0)?";
|
|
218
|
+
for (let i = 0; i < query.length; ++i) {
|
|
219
|
+
let c = query.charAt(i);
|
|
220
|
+
if (SPECIAL_REGEX_CHARACTERS.indexOf(c) !== -1) {
|
|
221
|
+
c = "\\" + c;
|
|
222
|
+
}
|
|
223
|
+
regexString += "[^\\0" + c + "]*" + c;
|
|
224
|
+
}
|
|
225
|
+
return new RegExp(regexString, "i");
|
|
226
|
+
};
|
|
227
|
+
export const createSearchRegex = function(query, caseSensitive, isRegex, matchWholeWord = false) {
|
|
228
|
+
const regexFlags = caseSensitive ? "g" : "gi";
|
|
229
|
+
let regexObject;
|
|
230
|
+
if (isRegex) {
|
|
231
|
+
try {
|
|
232
|
+
regexObject = new RegExp(query, regexFlags);
|
|
233
|
+
} catch (e) {
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (!regexObject) {
|
|
237
|
+
regexObject = createPlainTextSearchRegex(query, regexFlags);
|
|
238
|
+
}
|
|
239
|
+
if (matchWholeWord && regexObject) {
|
|
240
|
+
regexObject = new RegExp(`\\b${regexObject.source}\\b`, regexFlags);
|
|
241
|
+
}
|
|
242
|
+
return regexObject;
|
|
243
|
+
};
|
|
244
|
+
export const caseInsensetiveComparator = function(a, b) {
|
|
245
|
+
a = a.toUpperCase();
|
|
246
|
+
b = b.toUpperCase();
|
|
247
|
+
if (a === b) {
|
|
248
|
+
return 0;
|
|
249
|
+
}
|
|
250
|
+
return a > b ? 1 : -1;
|
|
251
|
+
};
|
|
252
|
+
export const hashCode = function(string) {
|
|
253
|
+
if (!string) {
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
const p = (1 << 30) * 4 - 5;
|
|
257
|
+
const z = 1345575271;
|
|
258
|
+
const z2 = 1506996573;
|
|
259
|
+
let s = 0;
|
|
260
|
+
let zi = 1;
|
|
261
|
+
for (let i = 0; i < string.length; i++) {
|
|
262
|
+
const xi = string.charCodeAt(i) * z2;
|
|
263
|
+
s = (s + zi * xi) % p;
|
|
264
|
+
zi = zi * z % p;
|
|
265
|
+
}
|
|
266
|
+
s = (s + zi * (p - 1)) % p;
|
|
267
|
+
return Math.abs(s | 0);
|
|
268
|
+
};
|
|
269
|
+
export const compare = (a, b) => {
|
|
270
|
+
if (a > b) {
|
|
271
|
+
return 1;
|
|
272
|
+
}
|
|
273
|
+
if (a < b) {
|
|
274
|
+
return -1;
|
|
275
|
+
}
|
|
276
|
+
return 0;
|
|
277
|
+
};
|
|
278
|
+
export const trimMiddle = (str, maxLength) => {
|
|
279
|
+
if (str.length <= maxLength) {
|
|
280
|
+
return String(str);
|
|
281
|
+
}
|
|
282
|
+
let leftHalf = maxLength >> 1;
|
|
283
|
+
let rightHalf = maxLength - leftHalf - 1;
|
|
284
|
+
if (str.codePointAt(str.length - rightHalf - 1) >= 65536) {
|
|
285
|
+
--rightHalf;
|
|
286
|
+
++leftHalf;
|
|
287
|
+
}
|
|
288
|
+
if (leftHalf > 0 && str.codePointAt(leftHalf - 1) >= 65536) {
|
|
289
|
+
--leftHalf;
|
|
290
|
+
}
|
|
291
|
+
return str.substr(0, leftHalf) + "\u2026" + str.substr(str.length - rightHalf, rightHalf);
|
|
292
|
+
};
|
|
293
|
+
export const trimEndWithMaxLength = (str, maxLength) => {
|
|
294
|
+
if (str.length <= maxLength) {
|
|
295
|
+
return String(str);
|
|
296
|
+
}
|
|
297
|
+
return str.substr(0, maxLength - 1) + "\u2026";
|
|
298
|
+
};
|
|
299
|
+
export const escapeForRegExp = (str) => {
|
|
300
|
+
return escapeCharacters(str, SPECIAL_REGEX_CHARACTERS);
|
|
301
|
+
};
|
|
302
|
+
export const naturalOrderComparator = (a, b) => {
|
|
303
|
+
const chunk = /^\d+|^\D+/;
|
|
304
|
+
let chunka, chunkb, anum, bnum;
|
|
305
|
+
while (true) {
|
|
306
|
+
if (a) {
|
|
307
|
+
if (!b) {
|
|
308
|
+
return 1;
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
if (b) {
|
|
312
|
+
return -1;
|
|
313
|
+
}
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
chunka = a.match(chunk)[0];
|
|
317
|
+
chunkb = b.match(chunk)[0];
|
|
318
|
+
anum = !Number.isNaN(Number(chunka));
|
|
319
|
+
bnum = !Number.isNaN(Number(chunkb));
|
|
320
|
+
if (anum && !bnum) {
|
|
321
|
+
return -1;
|
|
322
|
+
}
|
|
323
|
+
if (bnum && !anum) {
|
|
324
|
+
return 1;
|
|
325
|
+
}
|
|
326
|
+
if (anum && bnum) {
|
|
327
|
+
const diff = Number(chunka) - Number(chunkb);
|
|
328
|
+
if (diff) {
|
|
329
|
+
return diff;
|
|
330
|
+
}
|
|
331
|
+
if (chunka.length !== chunkb.length) {
|
|
332
|
+
if (!Number(chunka) && !Number(chunkb)) {
|
|
333
|
+
return chunka.length - chunkb.length;
|
|
334
|
+
}
|
|
335
|
+
return chunkb.length - chunka.length;
|
|
336
|
+
}
|
|
337
|
+
} else if (chunka !== chunkb) {
|
|
338
|
+
return chunka < chunkb ? -1 : 1;
|
|
339
|
+
}
|
|
340
|
+
a = a.substring(chunka.length);
|
|
341
|
+
b = b.substring(chunkb.length);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
export const base64ToSize = function(content) {
|
|
345
|
+
if (!content) {
|
|
346
|
+
return 0;
|
|
347
|
+
}
|
|
348
|
+
let size = content.length * 3 / 4;
|
|
349
|
+
if (content[content.length - 1] === "=") {
|
|
350
|
+
size--;
|
|
351
|
+
}
|
|
352
|
+
if (content.length > 1 && content[content.length - 2] === "=") {
|
|
353
|
+
size--;
|
|
354
|
+
}
|
|
355
|
+
return size;
|
|
356
|
+
};
|
|
357
|
+
export const SINGLE_QUOTE = "'";
|
|
358
|
+
export const DOUBLE_QUOTE = '"';
|
|
359
|
+
const BACKSLASH = "\\";
|
|
360
|
+
export const findUnclosedCssQuote = function(str) {
|
|
361
|
+
let unmatchedQuote = "";
|
|
362
|
+
for (let i = 0; i < str.length; ++i) {
|
|
363
|
+
const char = str[i];
|
|
364
|
+
if (char === BACKSLASH) {
|
|
365
|
+
i++;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (char === SINGLE_QUOTE || char === DOUBLE_QUOTE) {
|
|
369
|
+
if (unmatchedQuote === char) {
|
|
370
|
+
unmatchedQuote = "";
|
|
371
|
+
} else if (unmatchedQuote === "") {
|
|
372
|
+
unmatchedQuote = char;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return unmatchedQuote;
|
|
377
|
+
};
|
|
378
|
+
export const countUnmatchedLeftParentheses = (str) => {
|
|
379
|
+
let unmatchedCount = 0;
|
|
380
|
+
for (const c of str) {
|
|
381
|
+
if (c === "(") {
|
|
382
|
+
unmatchedCount++;
|
|
383
|
+
} else if (c === ")" && unmatchedCount > 0) {
|
|
384
|
+
unmatchedCount--;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return unmatchedCount;
|
|
388
|
+
};
|
|
389
|
+
export const createPlainTextSearchRegex = function(query, flags) {
|
|
390
|
+
let regex = "";
|
|
391
|
+
for (let i = 0; i < query.length; ++i) {
|
|
392
|
+
const c = query.charAt(i);
|
|
393
|
+
if (regexSpecialCharacters().indexOf(c) !== -1) {
|
|
394
|
+
regex += "\\";
|
|
395
|
+
}
|
|
396
|
+
regex += c;
|
|
397
|
+
}
|
|
398
|
+
return new RegExp(regex, flags || "");
|
|
399
|
+
};
|
|
400
|
+
class LowerCaseStringTag {
|
|
401
|
+
lowerCaseStringTag;
|
|
402
|
+
}
|
|
403
|
+
export const toLowerCaseString = function(input) {
|
|
404
|
+
return input.toLowerCase();
|
|
405
|
+
};
|
|
406
|
+
const WORD = /[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\b)|[A-Za-z][0-9]+[a-z]|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g;
|
|
407
|
+
export const toKebabCase = function(input) {
|
|
408
|
+
return input.match?.(WORD)?.map((w) => w.toLowerCase()).join("-").replaceAll("-.-", ".") || input;
|
|
409
|
+
};
|
|
410
|
+
export function toKebabCaseKeys(settingValue) {
|
|
411
|
+
const result = {};
|
|
412
|
+
for (const [key, value] of Object.entries(settingValue)) {
|
|
413
|
+
result[toKebabCase(key)] = value;
|
|
414
|
+
}
|
|
415
|
+
return result;
|
|
416
|
+
}
|
|
417
|
+
export const replaceLast = function(input, search, replacement) {
|
|
418
|
+
const replacementStartIndex = input.lastIndexOf(search);
|
|
419
|
+
if (replacementStartIndex === -1) {
|
|
420
|
+
return input;
|
|
421
|
+
}
|
|
422
|
+
return input.slice(0, replacementStartIndex) + input.slice(replacementStartIndex).replace(search, replacement);
|
|
423
|
+
};
|
|
424
|
+
export const stringifyWithPrecision = function stringifyWithPrecision2(s, precision = 2) {
|
|
425
|
+
if (precision === 0) {
|
|
426
|
+
return s.toFixed(0);
|
|
427
|
+
}
|
|
428
|
+
const string = s.toFixed(precision).replace(/\.?0*$/, "");
|
|
429
|
+
return string === "-0" ? "0" : string;
|
|
430
|
+
};
|
|
431
|
+
export const concatBase64 = function(lhs, rhs) {
|
|
432
|
+
if (lhs.length === 0 || !lhs.endsWith("=")) {
|
|
433
|
+
return lhs + rhs;
|
|
434
|
+
}
|
|
435
|
+
const lhsLeaveAsIs = lhs.substring(0, lhs.length - 4);
|
|
436
|
+
const lhsToDecode = lhs.substring(lhs.length - 4);
|
|
437
|
+
return lhsLeaveAsIs + window.btoa(window.atob(lhsToDecode) + window.atob(rhs));
|
|
438
|
+
};
|
|
439
|
+
//# sourceMappingURL=string-utilities.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../front_end/core/platform/string-utilities.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) 2020 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nexport const escapeCharacters = (inputString: string, charsToEscape: string): string => {\n let foundChar = false;\n for (let i = 0; i < charsToEscape.length; ++i) {\n if (inputString.indexOf(charsToEscape.charAt(i)) !== -1) {\n foundChar = true;\n break;\n }\n }\n\n if (!foundChar) {\n return String(inputString);\n }\n\n let result = '';\n for (let i = 0; i < inputString.length; ++i) {\n if (charsToEscape.indexOf(inputString.charAt(i)) !== -1) {\n result += '\\\\';\n }\n result += inputString.charAt(i);\n }\n\n return result;\n};\n\nconst toHexadecimal = (charCode: number, padToLength: number): string => {\n return charCode.toString(16).toUpperCase().padStart(padToLength, '0');\n};\n\n// Remember to update the third group in the regexps patternsToEscape and\n// patternsToEscapePlusSingleQuote when adding new entries in this map.\nconst escapedReplacements = new Map([\n ['\\b', '\\\\b'],\n ['\\f', '\\\\f'],\n ['\\n', '\\\\n'],\n ['\\r', '\\\\r'],\n ['\\t', '\\\\t'],\n ['\\v', '\\\\v'],\n ['\\'', '\\\\\\''],\n ['\\\\', '\\\\\\\\'],\n ['<!--', '\\\\x3C!--'],\n ['<script', '\\\\x3Cscript'],\n ['</script', '\\\\x3C/script'],\n]);\n\nexport const formatAsJSLiteral = (content: string): string => {\n const patternsToEscape = /(\\\\|<(?:!--|\\/?script))|(\\p{Control})|(\\p{Surrogate})/gu;\n const patternsToEscapePlusSingleQuote = /(\\\\|'|<(?:!--|\\/?script))|(\\p{Control})|(\\p{Surrogate})/gu;\n const escapePattern = (match: string, pattern: string, controlChar: string, loneSurrogate: string): string => {\n if (controlChar) {\n if (escapedReplacements.has(controlChar)) {\n // @ts-ignore https://github.com/microsoft/TypeScript/issues/13086\n return escapedReplacements.get(controlChar);\n }\n const twoDigitHex = toHexadecimal(controlChar.charCodeAt(0), 2);\n return '\\\\x' + twoDigitHex;\n }\n if (loneSurrogate) {\n const fourDigitHex = toHexadecimal(loneSurrogate.charCodeAt(0), 4);\n return '\\\\u' + fourDigitHex;\n }\n if (pattern) {\n return escapedReplacements.get(pattern) || '';\n }\n return match;\n };\n\n let escapedContent = '';\n let quote = '';\n if (!content.includes('\\'')) {\n quote = '\\'';\n escapedContent = content.replaceAll(patternsToEscape, escapePattern);\n } else if (!content.includes('\"')) {\n quote = '\"';\n escapedContent = content.replaceAll(patternsToEscape, escapePattern);\n } else if (!content.includes('`') && !content.includes('${')) {\n quote = '`';\n escapedContent = content.replaceAll(patternsToEscape, escapePattern);\n } else {\n quote = '\\'';\n escapedContent = content.replaceAll(patternsToEscapePlusSingleQuote, escapePattern);\n }\n return `${quote}${escapedContent}${quote}`;\n};\n\n/**\n * This implements a subset of the sprintf() function described in the Single UNIX\n * Specification. It supports the %s, %f, %d, and %% formatting specifiers, and\n * understands the %m$d notation to select the m-th parameter for this substitution,\n * as well as the optional precision for %s, %f, and %d.\n *\n * @param fmt format string.\n * @param args parameters to the format string.\n * @returns the formatted output string.\n */\nexport const sprintf = (fmt: string, ...args: unknown[]): string => {\n let argIndex = 0;\n const RE = /%(?:(\\d+)\\$)?(?:\\.(\\d*))?([%dfs])/g;\n return fmt.replaceAll(RE, (_: string, index?: string, precision?: string, specifier?: string) => {\n if (specifier === '%') {\n return '%';\n }\n if (index !== undefined) {\n argIndex = parseInt(index, 10) - 1;\n if (argIndex < 0) {\n throw new RangeError(`Invalid parameter index ${argIndex + 1}`);\n }\n }\n if (argIndex >= args.length) {\n throw new RangeError(`Expected at least ${argIndex + 1} format parameters, but only ${args.length} where given.`);\n }\n if (specifier === 's') {\n const argValue = String(args[argIndex++]);\n if (precision !== undefined) {\n return argValue.substring(0, Number(precision));\n }\n return argValue;\n }\n let argValue = Number(args[argIndex++]);\n if (isNaN(argValue)) {\n argValue = 0;\n }\n if (specifier === 'd') {\n return String(Math.floor(argValue)).padStart(Number(precision), '0');\n }\n if (precision !== undefined) {\n return argValue.toFixed(Number(precision));\n }\n return String(argValue);\n });\n};\n\nexport const toBase64 = (inputString: string): string => {\n /* note to the reader: we can't use btoa here because we need to\n * support Unicode correctly. See the test cases for this function and\n * also\n * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem\n */\n\n function encodeBits(b: number): number {\n return b < 26 ? b + 65 : b < 52 ? b + 71 : b < 62 ? b - 4 : b === 62 ? 43 : b === 63 ? 47 : 65;\n }\n const encoder = new TextEncoder();\n const data = encoder.encode(inputString.toString());\n const n = data.length;\n let encoded = '';\n if (n === 0) {\n return encoded;\n }\n let shift;\n let v = 0;\n for (let i = 0; i < n; i++) {\n shift = i % 3;\n v |= data[i] << (16 >>> shift & 24);\n if (shift === 2) {\n encoded += String.fromCharCode(\n encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), encodeBits(v & 63));\n v = 0;\n }\n }\n if (shift === 0) {\n encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), 61, 61);\n } else if (shift === 1) {\n encoded += String.fromCharCode(encodeBits(v >>> 18 & 63), encodeBits(v >>> 12 & 63), encodeBits(v >>> 6 & 63), 61);\n }\n return encoded;\n};\n\nexport const findIndexesOfSubString = (inputString: string, searchString: string): number[] => {\n const matches = [];\n let i = inputString.indexOf(searchString);\n while (i !== -1) {\n matches.push(i);\n i = inputString.indexOf(searchString, i + searchString.length);\n }\n return matches;\n};\n\nexport const findLineEndingIndexes = (inputString: string): number[] => {\n const endings = findIndexesOfSubString(inputString, '\\n');\n endings.push(inputString.length);\n return endings;\n};\n\nexport const isWhitespace = (inputString: string): boolean => {\n return /^\\s*$/.test(inputString);\n};\n\nexport const trimURL = (url: string, baseURLDomain?: string): string => {\n let result = url.replace(/^(https|http|file):\\/\\//i, '');\n if (baseURLDomain) {\n if (result.toLowerCase().startsWith(baseURLDomain.toLowerCase())) {\n result = result.substr(baseURLDomain.length);\n }\n }\n return result;\n};\n\nexport const collapseWhitespace = (inputString: string): string => {\n return inputString.replace(/[\\s\\xA0]+/g, ' ');\n};\n\nexport const reverse = (inputString: string): string => {\n return inputString.split('').reverse().join('');\n};\n\nexport const replaceControlCharacters = (inputString: string): string => {\n // Replace C0 and C1 control character sets with replacement character.\n // Do not replace '\\t', \\n' and '\\r'.\n return inputString.replace(/[\\0-\\x08\\x0B\\f\\x0E-\\x1F\\x80-\\x9F]/g, '\\uFFFD');\n};\n\nexport const countWtf8Bytes = (inputString: string): number => {\n let count = 0;\n for (let i = 0; i < inputString.length; i++) {\n const c = inputString.charCodeAt(i);\n if (c <= 0x7F) {\n count++;\n } else if (c <= 0x07FF) {\n count += 2;\n } else if (c < 0xD800 || 0xDFFF < c) {\n count += 3;\n } else {\n if (c <= 0xDBFF && i + 1 < inputString.length) {\n // The current character is a leading surrogate, and there is a\n // next character.\n const next = inputString.charCodeAt(i + 1);\n if (0xDC00 <= next && next <= 0xDFFF) {\n // The next character is a trailing surrogate, meaning this\n // is a surrogate pair.\n count += 4;\n i++;\n continue;\n }\n }\n count += 3;\n }\n }\n return count;\n};\n\nexport const stripLineBreaks = (inputStr: string): string => {\n return inputStr.replace(/(\\r)?\\n/g, '');\n};\n\nconst EXTENDED_KEBAB_CASE_REGEXP = /^([a-z0-9]+(?:-[a-z0-9]+)*\\.)*[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/**\n * Tests if the `inputStr` is following the extended Kebab Case naming convetion,\n * where words are separated with either a dash (`-`) or a dot (`.`), and all\n * characters must be lower-case alphanumeric.\n *\n * For example, it will yield `true` for `'my.amazing-string.literal'`, but `false`\n * for `'Another.AmazingLiteral'` or '`another_amazing_literal'`.\n *\n * @param inputStr the input string to test.\n * @return `true` if the `inputStr` follows the extended Kebab Case convention.\n */\nexport const isExtendedKebabCase = (inputStr: string): boolean => {\n return EXTENDED_KEBAB_CASE_REGEXP.test(inputStr);\n};\n\nexport const toTitleCase = (inputStr: string): string => {\n return inputStr.substring(0, 1).toUpperCase() + inputStr.substring(1);\n};\n\nexport const removeURLFragment = (inputStr: string): string => {\n const url = new URL(inputStr);\n url.hash = '';\n return url.toString();\n};\n\nconst SPECIAL_REGEX_CHARACTERS = '^[]{}()\\\\.^$*+?|-,';\n\nexport const regexSpecialCharacters = function(): string {\n return SPECIAL_REGEX_CHARACTERS;\n};\n\nexport const filterRegex = function(query: string): RegExp {\n let regexString = '^(?:.*\\\\0)?'; // Start from beginning or after a \\0\n for (let i = 0; i < query.length; ++i) {\n let c = query.charAt(i);\n if (SPECIAL_REGEX_CHARACTERS.indexOf(c) !== -1) {\n c = '\\\\' + c;\n }\n regexString += '[^\\\\0' + c + ']*' + c;\n }\n return new RegExp(regexString, 'i');\n};\n\nexport const createSearchRegex = function(\n query: string, caseSensitive: boolean, isRegex: boolean, matchWholeWord: boolean = false): RegExp {\n const regexFlags = caseSensitive ? 'g' : 'gi';\n let regexObject;\n\n if (isRegex) {\n try {\n regexObject = new RegExp(query, regexFlags);\n } catch (e) {\n // Silent catch.\n }\n }\n\n if (!regexObject) {\n regexObject = createPlainTextSearchRegex(query, regexFlags);\n }\n\n if (matchWholeWord && regexObject) {\n regexObject = new RegExp(`\\\\b${regexObject.source}\\\\b`, regexFlags);\n }\n\n return regexObject;\n};\n\nexport const caseInsensetiveComparator = function(a: string, b: string): number {\n a = a.toUpperCase();\n b = b.toUpperCase();\n if (a === b) {\n return 0;\n }\n return a > b ? 1 : -1;\n};\n\nexport const hashCode = function(string?: string): number {\n if (!string) {\n return 0;\n }\n // Hash algorithm for substrings is described in \"\u00DCber die Komplexit\u00E4t der Multiplikation in\n // eingeschr\u00E4nkten Branchingprogrammmodellen\" by Woelfe.\n // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000\n const p = ((1 << 30) * 4 - 5); // prime: 2^32 - 5\n const z = 0x5033d967; // 32 bits from random.org\n const z2 = 0x59d2f15d; // random odd 32 bit number\n let s = 0;\n let zi = 1;\n for (let i = 0; i < string.length; i++) {\n const xi = string.charCodeAt(i) * z2;\n s = (s + zi * xi) % p;\n zi = (zi * z) % p;\n }\n s = (s + zi * (p - 1)) % p;\n return Math.abs(s | 0);\n};\n\nexport const compare = (a: string, b: string): number => {\n if (a > b) {\n return 1;\n }\n if (a < b) {\n return -1;\n }\n return 0;\n};\n\nexport const trimMiddle = (str: string, maxLength: number): string => {\n if (str.length <= maxLength) {\n return String(str);\n }\n let leftHalf = maxLength >> 1;\n let rightHalf = maxLength - leftHalf - 1;\n if ((str.codePointAt(str.length - rightHalf - 1) as number) >= 0x10000) {\n --rightHalf;\n ++leftHalf;\n }\n if (leftHalf > 0 && (str.codePointAt(leftHalf - 1) as number) >= 0x10000) {\n --leftHalf;\n }\n return str.substr(0, leftHalf) + '\u2026' + str.substr(str.length - rightHalf, rightHalf);\n};\n\nexport const trimEndWithMaxLength = (str: string, maxLength: number): string => {\n if (str.length <= maxLength) {\n return String(str);\n }\n return str.substr(0, maxLength - 1) + '\u2026';\n};\n\nexport const escapeForRegExp = (str: string): string => {\n return escapeCharacters(str, SPECIAL_REGEX_CHARACTERS);\n};\n\nexport const naturalOrderComparator = (a: string, b: string): number => {\n const chunk = /^\\d+|^\\D+/;\n let chunka, chunkb, anum, bnum;\n while (true) {\n if (a) {\n if (!b) {\n return 1;\n }\n } else {\n if (b) {\n return -1;\n }\n return 0;\n }\n chunka = (a.match(chunk) as string[])[0];\n chunkb = (b.match(chunk) as string[])[0];\n anum = !Number.isNaN(Number(chunka));\n bnum = !Number.isNaN(Number(chunkb));\n if (anum && !bnum) {\n return -1;\n }\n if (bnum && !anum) {\n return 1;\n }\n if (anum && bnum) {\n const diff = Number(chunka) - Number(chunkb);\n if (diff) {\n return diff;\n }\n if (chunka.length !== chunkb.length) {\n if (!Number(chunka) && !Number(chunkb)) { // chunks are strings of all 0s (special case)\n return chunka.length - chunkb.length;\n }\n return chunkb.length - chunka.length;\n }\n } else if (chunka !== chunkb) {\n return (chunka < chunkb) ? -1 : 1;\n }\n a = a.substring(chunka.length);\n b = b.substring(chunkb.length);\n }\n};\n\nexport const base64ToSize = function(content: string|null): number {\n if (!content) {\n return 0;\n }\n let size = content.length * 3 / 4;\n if (content[content.length - 1] === '=') {\n size--;\n }\n if (content.length > 1 && content[content.length - 2] === '=') {\n size--;\n }\n return size;\n};\n\nexport const SINGLE_QUOTE = '\\'';\nexport const DOUBLE_QUOTE = '\"';\nconst BACKSLASH = '\\\\';\n\nexport const findUnclosedCssQuote = function(str: string): string {\n let unmatchedQuote = '';\n for (let i = 0; i < str.length; ++i) {\n const char = str[i];\n if (char === BACKSLASH) {\n i++;\n continue;\n }\n if (char === SINGLE_QUOTE || char === DOUBLE_QUOTE) {\n if (unmatchedQuote === char) {\n unmatchedQuote = '';\n } else if (unmatchedQuote === '') {\n unmatchedQuote = char;\n }\n }\n }\n return unmatchedQuote;\n};\n\nexport const countUnmatchedLeftParentheses = (str: string): number => {\n let unmatchedCount = 0;\n for (const c of str) {\n if (c === '(') {\n unmatchedCount++;\n } else if (c === ')' && unmatchedCount > 0) {\n unmatchedCount--;\n }\n }\n return unmatchedCount;\n};\n\nexport const createPlainTextSearchRegex = function(query: string, flags?: string): RegExp {\n // This should be kept the same as the one in StringUtil.cpp.\n let regex = '';\n for (let i = 0; i < query.length; ++i) {\n const c = query.charAt(i);\n if (regexSpecialCharacters().indexOf(c) !== -1) {\n regex += '\\\\';\n }\n regex += c;\n }\n return new RegExp(regex, flags || '');\n};\n\nclass LowerCaseStringTag {\n private lowerCaseStringTag: (string|undefined);\n}\n\nexport type LowerCaseString = string&LowerCaseStringTag;\n\nexport const toLowerCaseString = function(input: string): LowerCaseString {\n return input.toLowerCase() as LowerCaseString;\n};\n\nconst WORD = /[A-Z]{2,}(?=[A-Z0-9][a-z0-9]+|\\b)|[A-Za-z][0-9]+[a-z]|[A-Z]?[a-z]+|[0-9][A-Za-z]+|[A-Z]|[0-9]+|[.]/g;\n// <---1---><-----------2----------> <--------3--------> <-----4----> <------5-----> <-----6----> <7>\n// 1: two or more consecutive uppercase letters. This is useful for identifying acronyms\n// 2: lookahead assertion that matches a word boundary\n// 3: numeronym: single letter followed by number and another letter\n// 4: word starting with an optional uppercase letter\n// 5: single digit followed by word to handle '3D' or '2px' (this might be controverial)\n// 6: single uppercase letter or number\n// 7: a dot character. We extract it into a separate word and remove dashes around it later.\n// This is makes more sense conceptually and allows accounting for all possible word variants.\n// Making dot a part of a word prevent us from handling acronyms or numeronyms after the word\n// correctly without making the RegExp prohibitively complicated.\n// https://regex101.com/r/LtFugp/1\nexport const toKebabCase = function(input: string): Lowercase<string> {\n return (input.match?.(WORD)?.map(w => w.toLowerCase()).join('-').replaceAll('-.-', '.') || input) as\n Lowercase<string>;\n};\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function toKebabCaseKeys(settingValue: {\n [x: string]: any,\n}): {[x: string]: any} {\n const result: {\n [x: string]: any,\n } = {};\n for (const [key, value] of Object.entries(settingValue)) {\n result[toKebabCase(key)] = value;\n }\n return result;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\n// Replaces the last ocurrence of parameter `search` with parameter `replacement` in `input`\nexport const replaceLast = function(input: string, search: string, replacement: string): string {\n const replacementStartIndex = input.lastIndexOf(search);\n if (replacementStartIndex === -1) {\n return input;\n }\n\n return input.slice(0, replacementStartIndex) + input.slice(replacementStartIndex).replace(search, replacement);\n};\n\nexport const stringifyWithPrecision = function stringifyWithPrecision(s: number, precision = 2): string {\n if (precision === 0) {\n return s.toFixed(0);\n }\n const string = s.toFixed(precision).replace(/\\.?0*$/, '');\n return string === '-0' ? '0' : string;\n};\n\n/**\n * Somewhat efficiently concatenates 2 base64 encoded strings.\n */\nexport const concatBase64 = function(lhs: string, rhs: string): string {\n if (lhs.length === 0 || !lhs.endsWith('=')) {\n // Empty string or no padding, we can straight-up concatenate.\n return lhs + rhs;\n }\n const lhsLeaveAsIs = lhs.substring(0, lhs.length - 4);\n const lhsToDecode = lhs.substring(lhs.length - 4);\n return lhsLeaveAsIs + window.btoa(window.atob(lhsToDecode) + window.atob(rhs));\n};\n"],
|
|
5
|
+
"mappings": "AAIO,aAAM,mBAAmB,CAAC,aAAqB,kBAAkC;AACtF,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,cAAc,QAAQ,EAAE,GAAG;AAC7C,QAAI,YAAY,QAAQ,cAAc,OAAO,QAAQ,IAAI;AACvD,kBAAY;AACZ;AAAA;AAAA;AAIJ,MAAI,CAAC,WAAW;AACd,WAAO,OAAO;AAAA;AAGhB,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,EAAE,GAAG;AAC3C,QAAI,cAAc,QAAQ,YAAY,OAAO,QAAQ,IAAI;AACvD,gBAAU;AAAA;AAEZ,cAAU,YAAY,OAAO;AAAA;AAG/B,SAAO;AAAA;AAGT,MAAM,gBAAgB,CAAC,UAAkB,gBAAgC;AACvE,SAAO,SAAS,SAAS,IAAI,cAAc,SAAS,aAAa;AAAA;AAKnE,MAAM,sBAAsB,oBAAI,IAAI;AAAA,EAClC,CAAC,MAAM;AAAA,EACP,CAAC,MAAM;AAAA,EACP,CAAC,MAAM;AAAA,EACP,CAAC,MAAM;AAAA,EACP,CAAC,KAAM;AAAA,EACP,CAAC,MAAM;AAAA,EACP,CAAC,KAAM;AAAA,EACP,CAAC,MAAM;AAAA,EACP,CAAC,QAAQ;AAAA,EACT,CAAC,WAAW;AAAA,EACZ,CAAC,aAAY;AAAA;AAGR,aAAM,oBAAoB,CAAC,YAA4B;AAC5D,QAAM,mBAAmB;AACzB,QAAM,kCAAkC;AACxC,QAAM,gBAAgB,CAAC,OAAe,SAAiB,aAAqB,kBAAkC;AAC5G,QAAI,aAAa;AACf,UAAI,oBAAoB,IAAI,cAAc;AAExC,eAAO,oBAAoB,IAAI;AAAA;AAEjC,YAAM,cAAc,cAAc,YAAY,W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