custom-electron-titlebar 3.2.6 → 3.2.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/.github/FUNDING.yml +1 -0
- package/README.md +15 -24
- package/_config.yml +1 -0
- package/{lib → build}/browser/browser.d.ts +0 -0
- package/{lib → build}/browser/browser.js +0 -0
- package/{lib → build}/browser/browser.js.map +0 -0
- package/{lib → build}/browser/event.d.ts +0 -0
- package/{lib → build}/browser/event.js +2 -1
- package/{lib → build}/browser/event.js.map +1 -1
- package/{lib → build}/browser/iframe.d.ts +0 -0
- package/{lib → build}/browser/iframe.js +0 -0
- package/{lib → build}/browser/iframe.js.map +0 -0
- package/{lib → build}/browser/keyboardEvent.d.ts +0 -0
- package/{lib → build}/browser/keyboardEvent.js +0 -0
- package/{lib → build}/browser/keyboardEvent.js.map +0 -0
- package/{lib → build}/browser/mouseEvent.d.ts +0 -0
- package/{lib → build}/browser/mouseEvent.js +0 -0
- package/{lib → build}/browser/mouseEvent.js.map +0 -0
- package/{lib → build}/common/arrays.d.ts +0 -0
- package/{lib → build}/common/arrays.js +0 -0
- package/{lib → build}/common/arrays.js.map +0 -0
- package/{lib → build}/common/async.d.ts +0 -0
- package/{lib → build}/common/async.js +0 -0
- package/{lib → build}/common/async.js.map +0 -0
- package/{lib → build}/common/charCode.d.ts +0 -0
- package/{lib → build}/common/charCode.js +0 -0
- package/{lib → build}/common/charCode.js.map +0 -0
- package/{lib → build}/common/color.d.ts +0 -0
- package/{lib → build}/common/color.js +0 -0
- package/{lib → build}/common/color.js.map +0 -0
- package/{lib → build}/common/dom.d.ts +0 -0
- package/{lib → build}/common/dom.js +16 -14
- package/build/common/dom.js.map +1 -0
- package/{lib → build}/common/event.d.ts +0 -0
- package/{lib → build}/common/event.js +1 -1
- package/build/common/event.js.map +1 -0
- package/{lib → build}/common/iterator.d.ts +0 -0
- package/{lib → build}/common/iterator.js +0 -0
- package/{lib → build}/common/iterator.js.map +0 -0
- package/{lib → build}/common/keyCodes.d.ts +0 -0
- package/{lib → build}/common/keyCodes.js +0 -0
- package/{lib → build}/common/keyCodes.js.map +0 -0
- package/{lib → build}/common/lifecycle.d.ts +0 -0
- package/{lib → build}/common/lifecycle.js +0 -0
- package/{lib → build}/common/lifecycle.js.map +0 -0
- package/{lib → build}/common/linkedList.d.ts +0 -0
- package/{lib → build}/common/linkedList.js +0 -0
- package/{lib → build}/common/linkedList.js.map +0 -0
- package/{lib → build}/common/platform.d.ts +0 -0
- package/{lib → build}/common/platform.js +0 -0
- package/{lib → build}/common/platform.js.map +0 -0
- package/{lib → build}/index.d.ts +0 -0
- package/{lib → build}/index.js +0 -0
- package/{lib → build}/index.js.map +0 -0
- package/{lib → build}/menu/menu.d.ts +0 -0
- package/{lib → build}/menu/menu.js +38 -38
- package/build/menu/menu.js.map +1 -0
- package/{lib → build}/menu/menuitem.d.ts +10 -2
- package/{lib → build}/menu/menuitem.js +70 -34
- package/build/menu/menuitem.js.map +1 -0
- package/{lib → build}/menubar.d.ts +0 -0
- package/{lib → build}/menubar.js +29 -30
- package/build/menubar.js.map +1 -0
- package/{lib → build}/themebar.d.ts +0 -0
- package/{lib → build}/themebar.js +2 -2
- package/build/themebar.js.map +1 -0
- package/{lib → build}/titlebar.d.ts +0 -0
- package/{lib → build}/titlebar.js +61 -58
- package/build/titlebar.js.map +1 -0
- package/package.json +13 -7
- package/lib/common/dom.js.map +0 -1
- package/lib/common/enableNativeMenuCommands.d.ts +0 -1
- package/lib/common/enableNativeMenuCommands.js +0 -32
- package/lib/common/enableNativeMenuCommands.js.map +0 -1
- package/lib/common/event.js.map +0 -1
- package/lib/main.d.ts +0 -1
- package/lib/main.js +0 -14
- package/lib/main.js.map +0 -1
- package/lib/menu/menu.js.map +0 -1
- package/lib/menu/menuitem.js.map +0 -1
- package/lib/menubar.js.map +0 -1
- package/lib/themebar.js.map +0 -1
- package/lib/titlebar.js.map +0 -1
- package/lib/vs/base/browser/browser.js +0 -150
- package/lib/vs/base/browser/canIUse.js +0 -58
- package/lib/vs/base/browser/codicons.js +0 -37
- package/lib/vs/base/browser/contextmenu.js +0 -9
- package/lib/vs/base/browser/dnd.js +0 -113
- package/lib/vs/base/browser/dom.js +0 -1417
- package/lib/vs/base/browser/event.js +0 -36
- package/lib/vs/base/browser/fastDomNode.js +0 -265
- package/lib/vs/base/browser/formattedTextRenderer.js +0 -248
- package/lib/vs/base/browser/globalMouseMoveMonitor.js +0 -137
- package/lib/vs/base/browser/history.js +0 -9
- package/lib/vs/base/browser/iframe.js +0 -126
- package/lib/vs/base/browser/keyboardEvent.js +0 -599
- package/lib/vs/base/browser/mouseEvent.js +0 -155
- package/lib/vs/base/browser/touch.js +0 -315
- package/lib/vs/base/browser/ui/actionbar/actionViewItems.js +0 -397
- package/lib/vs/base/browser/ui/actionbar/actionbar.js +0 -583
- package/lib/vs/base/browser/ui/checkbox/checkbox.js +0 -251
- package/lib/vs/base/browser/ui/codicons/codiconLabel.js +0 -31
- package/lib/vs/base/browser/ui/codicons/codiconStyles.js +0 -47
- package/lib/vs/base/browser/ui/contextview/contextview.js +0 -367
- package/lib/vs/base/browser/ui/dropdown/dropdown.js +0 -256
- package/lib/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +0 -120
- package/lib/vs/base/browser/ui/keybindingLabel/keybindingLabel.js +0 -118
- package/lib/vs/base/browser/ui/list/list.js +0 -54
- package/lib/vs/base/browser/ui/list/listPaging.js +0 -322
- package/lib/vs/base/browser/ui/list/listView.js +0 -1388
- package/lib/vs/base/browser/ui/list/listWidget.js +0 -1709
- package/lib/vs/base/browser/ui/list/rangeMap.js +0 -223
- package/lib/vs/base/browser/ui/list/rowCache.js +0 -113
- package/lib/vs/base/browser/ui/list/splice.js +0 -23
- package/lib/vs/base/browser/ui/menu/menu.js +0 -1371
- package/lib/vs/base/browser/ui/menu/menubar.js +0 -1139
- package/lib/vs/base/browser/ui/scrollbar/abstractScrollbar.js +0 -278
- package/lib/vs/base/browser/ui/scrollbar/horizontalScrollbar.js +0 -115
- package/lib/vs/base/browser/ui/scrollbar/scrollableElement.js +0 -646
- package/lib/vs/base/browser/ui/scrollbar/scrollableElementOptions.js +0 -9
- package/lib/vs/base/browser/ui/scrollbar/scrollbarArrow.js +0 -106
- package/lib/vs/base/browser/ui/scrollbar/scrollbarState.js +0 -184
- package/lib/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.js +0 -116
- package/lib/vs/base/browser/ui/scrollbar/verticalScrollbar.js +0 -114
- package/lib/vs/base/browser/ui/selectBox/selectBox.js +0 -85
- package/lib/vs/base/browser/ui/selectBox/selectBoxCustom.js +0 -985
- package/lib/vs/base/browser/ui/selectBox/selectBoxNative.js +0 -188
- package/lib/vs/base/browser/ui/toolbar/toolbar.js +0 -206
- package/lib/vs/base/browser/ui/widget.js +0 -69
- package/lib/vs/base/common/actions.js +0 -224
- package/lib/vs/base/common/amd.js +0 -31
- package/lib/vs/base/common/arrays.js +0 -641
- package/lib/vs/base/common/assert.js +0 -21
- package/lib/vs/base/common/async.js +0 -966
- package/lib/vs/base/common/buffer.js +0 -250
- package/lib/vs/base/common/cache.js +0 -40
- package/lib/vs/base/common/cancellation.js +0 -146
- package/lib/vs/base/common/charCode.js +0 -9
- package/lib/vs/base/common/codicon.js +0 -136
- package/lib/vs/base/common/codicons.js +0 -1378
- package/lib/vs/base/common/collections.js +0 -133
- package/lib/vs/base/common/color.js +0 -716
- package/lib/vs/base/common/comparers.js +0 -280
- package/lib/vs/base/common/console.js +0 -142
- package/lib/vs/base/common/date.js +0 -113
- package/lib/vs/base/common/decorators.js +0 -169
- package/lib/vs/base/common/errorMessage.js +0 -93
- package/lib/vs/base/common/errors.js +0 -213
- package/lib/vs/base/common/errorsWithActions.js +0 -28
- package/lib/vs/base/common/event.js +0 -873
- package/lib/vs/base/common/extpath.js +0 -401
- package/lib/vs/base/common/filters.js +0 -948
- package/lib/vs/base/common/functional.js +0 -28
- package/lib/vs/base/common/fuzzyScorer.js +0 -811
- package/lib/vs/base/common/glob.js +0 -696
- package/lib/vs/base/common/hash.js +0 -359
- package/lib/vs/base/common/history.js +0 -116
- package/lib/vs/base/common/htmlContent.js +0 -162
- package/lib/vs/base/common/idGenerator.js +0 -25
- package/lib/vs/base/common/iterator.js +0 -118
- package/lib/vs/base/common/json.js +0 -1624
- package/lib/vs/base/common/jsonEdit.js +0 -272
- package/lib/vs/base/common/jsonErrorMessages.js +0 -69
- package/lib/vs/base/common/jsonFormatter.js +0 -316
- package/lib/vs/base/common/jsonSchema.js +0 -9
- package/lib/vs/base/common/keyCodes.js +0 -591
- package/lib/vs/base/common/keybindingLabels.js +0 -231
- package/lib/vs/base/common/keybindingParser.js +0 -142
- package/lib/vs/base/common/labels.js +0 -430
- package/lib/vs/base/common/lazy.js +0 -71
- package/lib/vs/base/common/lifecycle.js +0 -308
- package/lib/vs/base/common/linkedList.js +0 -152
- package/lib/vs/base/common/linkedText.js +0 -73
- package/lib/vs/base/common/map.js +0 -1108
- package/lib/vs/base/common/marshalling.js +0 -80
- package/lib/vs/base/common/mime.js +0 -321
- package/lib/vs/base/common/navigator.js +0 -50
- package/lib/vs/base/common/network.js +0 -160
- package/lib/vs/base/common/normalization.js +0 -78
- package/lib/vs/base/common/numbers.js +0 -55
- package/lib/vs/base/common/objects.js +0 -268
- package/lib/vs/base/common/paging.js +0 -190
- package/lib/vs/base/common/parsers.js +0 -78
- package/lib/vs/base/common/path.js +0 -1550
- package/lib/vs/base/common/platform.js +0 -245
- package/lib/vs/base/common/process.js +0 -52
- package/lib/vs/base/common/processes.js +0 -32
- package/lib/vs/base/common/range.js +0 -79
- package/lib/vs/base/common/resourceTree.js +0 -185
- package/lib/vs/base/common/resources.js +0 -421
- package/lib/vs/base/common/scanCode.js +0 -1472
- package/lib/vs/base/common/scrollable.js +0 -397
- package/lib/vs/base/common/search.js +0 -55
- package/lib/vs/base/common/sequence.js +0 -64
- package/lib/vs/base/common/severity.js +0 -55
- package/lib/vs/base/common/skipList.js +0 -234
- package/lib/vs/base/common/stopwatch.js +0 -45
- package/lib/vs/base/common/stream.js +0 -418
- package/lib/vs/base/common/strings.js +0 -1283
- package/lib/vs/base/common/styler.js +0 -9
- package/lib/vs/base/common/types.js +0 -296
- package/lib/vs/base/common/uint.js +0 -46
- package/lib/vs/base/common/uri.js +0 -756
- package/lib/vs/base/common/uriIpc.js +0 -154
- package/lib/vs/base/common/uuid.js +0 -70
- package/lib/vs/nls.mock.js +0 -31
- package/lib/vs/platform/actions/browser/menuEntryActionViewItem.js +0 -342
- package/lib/vs/platform/actions/common/actions.js +0 -456
- package/lib/vs/platform/actions/common/menuService.js +0 -194
- package/lib/vs/platform/clipboard/browser/clipboardService.js +0 -99
- package/lib/vs/platform/clipboard/common/clipboardService.js +0 -14
- package/lib/vs/platform/contextkey/common/contextkey.js +0 -1210
- package/lib/vs/platform/contextkey/common/contextkeys.js +0 -23
- package/lib/vs/platform/contextview/browser/contextView.js +0 -15
- package/lib/vs/platform/contextview/browser/contextViewService.js +0 -96
- package/lib/vs/platform/environment/common/argv.js +0 -9
- package/lib/vs/platform/environment/common/environment.js +0 -15
- package/lib/vs/platform/instantiation/common/descriptors.js +0 -25
- package/lib/vs/platform/instantiation/common/extensions.js +0 -26
- package/lib/vs/platform/instantiation/common/graph.js +0 -93
- package/lib/vs/platform/instantiation/common/instantiation.js +0 -84
- package/lib/vs/platform/instantiation/common/instantiationService.js +0 -361
- package/lib/vs/platform/instantiation/common/serviceCollection.js +0 -39
- package/lib/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -73
- package/lib/vs/platform/keybinding/common/keybinding.js +0 -14
- package/lib/vs/platform/keybinding/common/keybindingResolver.js +0 -391
- package/lib/vs/platform/keybinding/common/keybindingsRegistry.js +0 -229
- package/lib/vs/platform/keybinding/common/resolvedKeybindingItem.js +0 -47
- package/lib/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js +0 -160
- package/lib/vs/platform/layout/browser/layoutService.js +0 -14
- package/lib/vs/platform/menubar/common/menubar.js +0 -34
- package/lib/vs/platform/registry/common/platform.js +0 -38
- package/lib/vs/platform/theme/browser/checkbox.js +0 -32
- package/lib/vs/platform/theme/common/colorRegistry.js +0 -1154
- package/lib/vs/platform/theme/common/styler.js +0 -290
- package/lib/vs/platform/theme/common/theme.js +0 -21
- package/lib/vs/platform/theme/common/themeService.js +0 -176
- package/lib/vs/platform/theme/common/tokenClassificationRegistry.js +0 -540
- package/lib/vs/platform/theme/test/common/testThemeService.js +0 -98
|
@@ -1,1283 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.breakBetweenGraphemeBreakType = exports.getGraphemeBreakType = exports.singleLetterHash = exports.getNLines = exports.uppercaseFirstLetter = exports.containsUppercaseCharacter = exports.fuzzyContains = exports.stripUTF8BOM = exports.startsWithUTF8BOM = exports.UTF8_BOM_CHARACTER = exports.removeAnsiEscapeCodes = exports.lcut = exports.isEmojiImprecise = exports.isFullWidthCharacter = exports.containsFullWidthCharacter = exports.containsUnusualLineTerminators = exports.UNUSUAL_LINE_TERMINATORS = exports.isBasicASCII = exports.containsEmoji = exports.containsRTL = exports.decodeUTF8 = exports.encodeUTF8 = exports.getCharContainingOffset = exports.prevCharLength = exports.nextCharLength = exports.getNextCodePoint = exports.computeCodePoint = exports.isLowSurrogate = exports.isHighSurrogate = exports.commonSuffixLength = exports.commonPrefixLength = exports.startsWithIgnoreCase = exports.equalsIgnoreCase = exports.isUpperAsciiLetter = exports.isLowerAsciiLetter = exports.compareSubstringIgnoreCase = exports.compareIgnoreCase = exports.compareSubstring = exports.compare = exports.lastNonWhitespaceIndex = exports.getLeadingWhitespace = exports.firstNonWhitespaceIndex = exports.regExpFlags = exports.regExpContainsBackreference = exports.regExpLeadsToEndlessLoop = exports.createRegExp = exports.stripWildcards = exports.convertSimple2RegExpPattern = exports.rtrim = exports.ltrim = exports.trim = exports.escapeRegExpCharacters = exports.escape = exports.format = exports.isFalsyOrWhitespace = void 0;
|
|
11
|
-
|
|
12
|
-
function isFalsyOrWhitespace(str) {
|
|
13
|
-
if (!str || typeof str !== 'string') {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return str.trim().length === 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
exports.isFalsyOrWhitespace = isFalsyOrWhitespace;
|
|
21
|
-
const _formatRegexp = /{(\d+)}/g;
|
|
22
|
-
/**
|
|
23
|
-
* Helper to produce a string with a variable number of arguments. Insert variable segments
|
|
24
|
-
* into the string using the {n} notation where N is the index of the argument following the string.
|
|
25
|
-
* @param value string to which formatting is applied
|
|
26
|
-
* @param args replacements for {n}-entries
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
function format(value, ...args) {
|
|
30
|
-
if (args.length === 0) {
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return value.replace(_formatRegexp, function (match, group) {
|
|
35
|
-
const idx = parseInt(group, 10);
|
|
36
|
-
return isNaN(idx) || idx < 0 || idx >= args.length ? match : args[idx];
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
exports.format = format;
|
|
41
|
-
/**
|
|
42
|
-
* Converts HTML characters inside the string to use entities instead. Makes the string safe from
|
|
43
|
-
* being used e.g. in HTMLElement.innerHTML.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
function escape(html) {
|
|
47
|
-
return html.replace(/[<>&]/g, function (match) {
|
|
48
|
-
switch (match) {
|
|
49
|
-
case '<':
|
|
50
|
-
return '<';
|
|
51
|
-
|
|
52
|
-
case '>':
|
|
53
|
-
return '>';
|
|
54
|
-
|
|
55
|
-
case '&':
|
|
56
|
-
return '&';
|
|
57
|
-
|
|
58
|
-
default:
|
|
59
|
-
return match;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
exports.escape = escape;
|
|
65
|
-
/**
|
|
66
|
-
* Escapes regular expression characters in a given string
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
function escapeRegExpCharacters(value) {
|
|
70
|
-
return value.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g, '\\$&');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
exports.escapeRegExpCharacters = escapeRegExpCharacters;
|
|
74
|
-
/**
|
|
75
|
-
* Removes all occurrences of needle from the beginning and end of haystack.
|
|
76
|
-
* @param haystack string to trim
|
|
77
|
-
* @param needle the thing to trim (default is a blank)
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
function trim(haystack, needle = ' ') {
|
|
81
|
-
const trimmed = ltrim(haystack, needle);
|
|
82
|
-
return rtrim(trimmed, needle);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
exports.trim = trim;
|
|
86
|
-
/**
|
|
87
|
-
* Removes all occurrences of needle from the beginning of haystack.
|
|
88
|
-
* @param haystack string to trim
|
|
89
|
-
* @param needle the thing to trim
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
function ltrim(haystack, needle) {
|
|
93
|
-
if (!haystack || !needle) {
|
|
94
|
-
return haystack;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const needleLen = needle.length;
|
|
98
|
-
|
|
99
|
-
if (needleLen === 0 || haystack.length === 0) {
|
|
100
|
-
return haystack;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
let offset = 0;
|
|
104
|
-
|
|
105
|
-
while (haystack.indexOf(needle, offset) === offset) {
|
|
106
|
-
offset = offset + needleLen;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return haystack.substring(offset);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
exports.ltrim = ltrim;
|
|
113
|
-
/**
|
|
114
|
-
* Removes all occurrences of needle from the end of haystack.
|
|
115
|
-
* @param haystack string to trim
|
|
116
|
-
* @param needle the thing to trim
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
function rtrim(haystack, needle) {
|
|
120
|
-
if (!haystack || !needle) {
|
|
121
|
-
return haystack;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const needleLen = needle.length,
|
|
125
|
-
haystackLen = haystack.length;
|
|
126
|
-
|
|
127
|
-
if (needleLen === 0 || haystackLen === 0) {
|
|
128
|
-
return haystack;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
let offset = haystackLen,
|
|
132
|
-
idx = -1;
|
|
133
|
-
|
|
134
|
-
while (true) {
|
|
135
|
-
idx = haystack.lastIndexOf(needle, offset - 1);
|
|
136
|
-
|
|
137
|
-
if (idx === -1 || idx + needleLen !== offset) {
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (idx === 0) {
|
|
142
|
-
return '';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
offset = idx;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return haystack.substring(0, offset);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
exports.rtrim = rtrim;
|
|
152
|
-
|
|
153
|
-
function convertSimple2RegExpPattern(pattern) {
|
|
154
|
-
return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
|
|
158
|
-
|
|
159
|
-
function stripWildcards(pattern) {
|
|
160
|
-
return pattern.replace(/\*/g, '');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
exports.stripWildcards = stripWildcards;
|
|
164
|
-
|
|
165
|
-
function createRegExp(searchString, isRegex, options = {}) {
|
|
166
|
-
if (!searchString) {
|
|
167
|
-
throw new Error('Cannot create regex from empty string');
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (!isRegex) {
|
|
171
|
-
searchString = escapeRegExpCharacters(searchString);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (options.wholeWord) {
|
|
175
|
-
if (!/\B/.test(searchString.charAt(0))) {
|
|
176
|
-
searchString = '\\b' + searchString;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (!/\B/.test(searchString.charAt(searchString.length - 1))) {
|
|
180
|
-
searchString = searchString + '\\b';
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
let modifiers = '';
|
|
185
|
-
|
|
186
|
-
if (options.global) {
|
|
187
|
-
modifiers += 'g';
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (!options.matchCase) {
|
|
191
|
-
modifiers += 'i';
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (options.multiline) {
|
|
195
|
-
modifiers += 'm';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (options.unicode) {
|
|
199
|
-
modifiers += 'u';
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return new RegExp(searchString, modifiers);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
exports.createRegExp = createRegExp;
|
|
206
|
-
|
|
207
|
-
function regExpLeadsToEndlessLoop(regexp) {
|
|
208
|
-
// Exit early if it's one of these special cases which are meant to match
|
|
209
|
-
// against an empty string
|
|
210
|
-
if (regexp.source === '^' || regexp.source === '^$' || regexp.source === '$' || regexp.source === '^\\s*$') {
|
|
211
|
-
return false;
|
|
212
|
-
} // We check against an empty string. If the regular expression doesn't advance
|
|
213
|
-
// (e.g. ends in an endless loop) it will match an empty string.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const match = regexp.exec('');
|
|
217
|
-
return !!(match && regexp.lastIndex === 0);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
exports.regExpLeadsToEndlessLoop = regExpLeadsToEndlessLoop;
|
|
221
|
-
|
|
222
|
-
function regExpContainsBackreference(regexpValue) {
|
|
223
|
-
return !!regexpValue.match(/([^\\]|^)(\\\\)*\\\d+/);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
exports.regExpContainsBackreference = regExpContainsBackreference;
|
|
227
|
-
|
|
228
|
-
function regExpFlags(regexp) {
|
|
229
|
-
return (regexp.global ? 'g' : '') + (regexp.ignoreCase ? 'i' : '') + (regexp.multiline ? 'm' : '') + (regexp
|
|
230
|
-
/* standalone editor compilation */
|
|
231
|
-
.unicode ? 'u' : '');
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
exports.regExpFlags = regExpFlags;
|
|
235
|
-
/**
|
|
236
|
-
* Returns first index of the string that is not whitespace.
|
|
237
|
-
* If string is empty or contains only whitespaces, returns -1
|
|
238
|
-
*/
|
|
239
|
-
|
|
240
|
-
function firstNonWhitespaceIndex(str) {
|
|
241
|
-
for (let i = 0, len = str.length; i < len; i++) {
|
|
242
|
-
const chCode = str.charCodeAt(i);
|
|
243
|
-
|
|
244
|
-
if (chCode !== 32
|
|
245
|
-
/* Space */
|
|
246
|
-
&& chCode !== 9
|
|
247
|
-
/* Tab */
|
|
248
|
-
) {
|
|
249
|
-
return i;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return -1;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
exports.firstNonWhitespaceIndex = firstNonWhitespaceIndex;
|
|
257
|
-
/**
|
|
258
|
-
* Returns the leading whitespace of the string.
|
|
259
|
-
* If the string contains only whitespaces, returns entire string
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
|
-
function getLeadingWhitespace(str, start = 0, end = str.length) {
|
|
263
|
-
for (let i = start; i < end; i++) {
|
|
264
|
-
const chCode = str.charCodeAt(i);
|
|
265
|
-
|
|
266
|
-
if (chCode !== 32
|
|
267
|
-
/* Space */
|
|
268
|
-
&& chCode !== 9
|
|
269
|
-
/* Tab */
|
|
270
|
-
) {
|
|
271
|
-
return str.substring(start, i);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return str.substring(start, end);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
exports.getLeadingWhitespace = getLeadingWhitespace;
|
|
279
|
-
/**
|
|
280
|
-
* Returns last index of the string that is not whitespace.
|
|
281
|
-
* If string is empty or contains only whitespaces, returns -1
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
function lastNonWhitespaceIndex(str, startIndex = str.length - 1) {
|
|
285
|
-
for (let i = startIndex; i >= 0; i--) {
|
|
286
|
-
const chCode = str.charCodeAt(i);
|
|
287
|
-
|
|
288
|
-
if (chCode !== 32
|
|
289
|
-
/* Space */
|
|
290
|
-
&& chCode !== 9
|
|
291
|
-
/* Tab */
|
|
292
|
-
) {
|
|
293
|
-
return i;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return -1;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
exports.lastNonWhitespaceIndex = lastNonWhitespaceIndex;
|
|
301
|
-
|
|
302
|
-
function compare(a, b) {
|
|
303
|
-
if (a < b) {
|
|
304
|
-
return -1;
|
|
305
|
-
} else if (a > b) {
|
|
306
|
-
return 1;
|
|
307
|
-
} else {
|
|
308
|
-
return 0;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
exports.compare = compare;
|
|
313
|
-
|
|
314
|
-
function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {
|
|
315
|
-
for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
|
|
316
|
-
let codeA = a.charCodeAt(aStart);
|
|
317
|
-
let codeB = b.charCodeAt(bStart);
|
|
318
|
-
|
|
319
|
-
if (codeA < codeB) {
|
|
320
|
-
return -1;
|
|
321
|
-
} else if (codeA > codeB) {
|
|
322
|
-
return 1;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
const aLen = aEnd - aStart;
|
|
327
|
-
const bLen = bEnd - bStart;
|
|
328
|
-
|
|
329
|
-
if (aLen < bLen) {
|
|
330
|
-
return -1;
|
|
331
|
-
} else if (aLen > bLen) {
|
|
332
|
-
return 1;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return 0;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
exports.compareSubstring = compareSubstring;
|
|
339
|
-
|
|
340
|
-
function compareIgnoreCase(a, b) {
|
|
341
|
-
return compareSubstringIgnoreCase(a, b, 0, a.length, 0, b.length);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
exports.compareIgnoreCase = compareIgnoreCase;
|
|
345
|
-
|
|
346
|
-
function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) {
|
|
347
|
-
for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) {
|
|
348
|
-
let codeA = a.charCodeAt(aStart);
|
|
349
|
-
let codeB = b.charCodeAt(bStart);
|
|
350
|
-
|
|
351
|
-
if (codeA === codeB) {
|
|
352
|
-
// equal
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
const diff = codeA - codeB;
|
|
357
|
-
|
|
358
|
-
if (diff === 32 && isUpperAsciiLetter(codeB)) {
|
|
359
|
-
//codeB =[65-90] && codeA =[97-122]
|
|
360
|
-
continue;
|
|
361
|
-
} else if (diff === -32 && isUpperAsciiLetter(codeA)) {
|
|
362
|
-
//codeB =[97-122] && codeA =[65-90]
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (isLowerAsciiLetter(codeA) && isLowerAsciiLetter(codeB)) {
|
|
367
|
-
//
|
|
368
|
-
return diff;
|
|
369
|
-
} else {
|
|
370
|
-
return compareSubstring(a.toLowerCase(), b.toLowerCase(), aStart, aEnd, bStart, bEnd);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
const aLen = aEnd - aStart;
|
|
375
|
-
const bLen = bEnd - bStart;
|
|
376
|
-
|
|
377
|
-
if (aLen < bLen) {
|
|
378
|
-
return -1;
|
|
379
|
-
} else if (aLen > bLen) {
|
|
380
|
-
return 1;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return 0;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
exports.compareSubstringIgnoreCase = compareSubstringIgnoreCase;
|
|
387
|
-
|
|
388
|
-
function isLowerAsciiLetter(code) {
|
|
389
|
-
return code >= 97
|
|
390
|
-
/* a */
|
|
391
|
-
&& code <= 122
|
|
392
|
-
/* z */
|
|
393
|
-
;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
exports.isLowerAsciiLetter = isLowerAsciiLetter;
|
|
397
|
-
|
|
398
|
-
function isUpperAsciiLetter(code) {
|
|
399
|
-
return code >= 65
|
|
400
|
-
/* A */
|
|
401
|
-
&& code <= 90
|
|
402
|
-
/* Z */
|
|
403
|
-
;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
exports.isUpperAsciiLetter = isUpperAsciiLetter;
|
|
407
|
-
|
|
408
|
-
function isAsciiLetter(code) {
|
|
409
|
-
return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function equalsIgnoreCase(a, b) {
|
|
413
|
-
return a.length === b.length && doEqualsIgnoreCase(a, b);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
exports.equalsIgnoreCase = equalsIgnoreCase;
|
|
417
|
-
|
|
418
|
-
function doEqualsIgnoreCase(a, b, stopAt = a.length) {
|
|
419
|
-
for (let i = 0; i < stopAt; i++) {
|
|
420
|
-
const codeA = a.charCodeAt(i);
|
|
421
|
-
const codeB = b.charCodeAt(i);
|
|
422
|
-
|
|
423
|
-
if (codeA === codeB) {
|
|
424
|
-
continue;
|
|
425
|
-
} // a-z A-Z
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
if (isAsciiLetter(codeA) && isAsciiLetter(codeB)) {
|
|
429
|
-
const diff = Math.abs(codeA - codeB);
|
|
430
|
-
|
|
431
|
-
if (diff !== 0 && diff !== 32) {
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
} // Any other charcode
|
|
435
|
-
else {
|
|
436
|
-
if (String.fromCharCode(codeA).toLowerCase() !== String.fromCharCode(codeB).toLowerCase()) {
|
|
437
|
-
return false;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function startsWithIgnoreCase(str, candidate) {
|
|
446
|
-
const candidateLength = candidate.length;
|
|
447
|
-
|
|
448
|
-
if (candidate.length > str.length) {
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
return doEqualsIgnoreCase(str, candidate, candidateLength);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
exports.startsWithIgnoreCase = startsWithIgnoreCase;
|
|
456
|
-
/**
|
|
457
|
-
* @returns the length of the common prefix of the two strings.
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
function commonPrefixLength(a, b) {
|
|
461
|
-
let i,
|
|
462
|
-
len = Math.min(a.length, b.length);
|
|
463
|
-
|
|
464
|
-
for (i = 0; i < len; i++) {
|
|
465
|
-
if (a.charCodeAt(i) !== b.charCodeAt(i)) {
|
|
466
|
-
return i;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
return len;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
exports.commonPrefixLength = commonPrefixLength;
|
|
474
|
-
/**
|
|
475
|
-
* @returns the length of the common suffix of the two strings.
|
|
476
|
-
*/
|
|
477
|
-
|
|
478
|
-
function commonSuffixLength(a, b) {
|
|
479
|
-
let i,
|
|
480
|
-
len = Math.min(a.length, b.length);
|
|
481
|
-
const aLastIndex = a.length - 1;
|
|
482
|
-
const bLastIndex = b.length - 1;
|
|
483
|
-
|
|
484
|
-
for (i = 0; i < len; i++) {
|
|
485
|
-
if (a.charCodeAt(aLastIndex - i) !== b.charCodeAt(bLastIndex - i)) {
|
|
486
|
-
return i;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
return len;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
exports.commonSuffixLength = commonSuffixLength;
|
|
494
|
-
/**
|
|
495
|
-
* See http://en.wikipedia.org/wiki/Surrogate_pair
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
function isHighSurrogate(charCode) {
|
|
499
|
-
return 0xD800 <= charCode && charCode <= 0xDBFF;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
exports.isHighSurrogate = isHighSurrogate;
|
|
503
|
-
/**
|
|
504
|
-
* See http://en.wikipedia.org/wiki/Surrogate_pair
|
|
505
|
-
*/
|
|
506
|
-
|
|
507
|
-
function isLowSurrogate(charCode) {
|
|
508
|
-
return 0xDC00 <= charCode && charCode <= 0xDFFF;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
exports.isLowSurrogate = isLowSurrogate;
|
|
512
|
-
/**
|
|
513
|
-
* See http://en.wikipedia.org/wiki/Surrogate_pair
|
|
514
|
-
*/
|
|
515
|
-
|
|
516
|
-
function computeCodePoint(highSurrogate, lowSurrogate) {
|
|
517
|
-
return (highSurrogate - 0xD800 << 10) + (lowSurrogate - 0xDC00) + 0x10000;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
exports.computeCodePoint = computeCodePoint;
|
|
521
|
-
/**
|
|
522
|
-
* get the code point that begins at offset `offset`
|
|
523
|
-
*/
|
|
524
|
-
|
|
525
|
-
function getNextCodePoint(str, len, offset) {
|
|
526
|
-
const charCode = str.charCodeAt(offset);
|
|
527
|
-
|
|
528
|
-
if (isHighSurrogate(charCode) && offset + 1 < len) {
|
|
529
|
-
const nextCharCode = str.charCodeAt(offset + 1);
|
|
530
|
-
|
|
531
|
-
if (isLowSurrogate(nextCharCode)) {
|
|
532
|
-
return computeCodePoint(charCode, nextCharCode);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
return charCode;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
exports.getNextCodePoint = getNextCodePoint;
|
|
540
|
-
/**
|
|
541
|
-
* get the code point that ends right before offset `offset`
|
|
542
|
-
*/
|
|
543
|
-
|
|
544
|
-
function getPrevCodePoint(str, offset) {
|
|
545
|
-
const charCode = str.charCodeAt(offset - 1);
|
|
546
|
-
|
|
547
|
-
if (isLowSurrogate(charCode) && offset > 1) {
|
|
548
|
-
const prevCharCode = str.charCodeAt(offset - 2);
|
|
549
|
-
|
|
550
|
-
if (isHighSurrogate(prevCharCode)) {
|
|
551
|
-
return computeCodePoint(prevCharCode, charCode);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
return charCode;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function nextCharLength(str, offset) {
|
|
559
|
-
const graphemeBreakTree = GraphemeBreakTree.getInstance();
|
|
560
|
-
const initialOffset = offset;
|
|
561
|
-
const len = str.length;
|
|
562
|
-
const initialCodePoint = getNextCodePoint(str, len, offset);
|
|
563
|
-
offset += initialCodePoint >= 65536
|
|
564
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
565
|
-
? 2 : 1;
|
|
566
|
-
let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);
|
|
567
|
-
|
|
568
|
-
while (offset < len) {
|
|
569
|
-
const nextCodePoint = getNextCodePoint(str, len, offset);
|
|
570
|
-
const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint);
|
|
571
|
-
|
|
572
|
-
if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
offset += nextCodePoint >= 65536
|
|
577
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
578
|
-
? 2 : 1;
|
|
579
|
-
graphemeBreakType = nextGraphemeBreakType;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
return offset - initialOffset;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
exports.nextCharLength = nextCharLength;
|
|
586
|
-
|
|
587
|
-
function prevCharLength(str, offset) {
|
|
588
|
-
const graphemeBreakTree = GraphemeBreakTree.getInstance();
|
|
589
|
-
const initialOffset = offset;
|
|
590
|
-
const initialCodePoint = getPrevCodePoint(str, offset);
|
|
591
|
-
offset -= initialCodePoint >= 65536
|
|
592
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
593
|
-
? 2 : 1;
|
|
594
|
-
let graphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);
|
|
595
|
-
|
|
596
|
-
while (offset > 0) {
|
|
597
|
-
const prevCodePoint = getPrevCodePoint(str, offset);
|
|
598
|
-
const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint);
|
|
599
|
-
|
|
600
|
-
if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {
|
|
601
|
-
break;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
offset -= prevCodePoint >= 65536
|
|
605
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
606
|
-
? 2 : 1;
|
|
607
|
-
graphemeBreakType = prevGraphemeBreakType;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
return initialOffset - offset;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
exports.prevCharLength = prevCharLength;
|
|
614
|
-
|
|
615
|
-
function _getCharContainingOffset(str, offset) {
|
|
616
|
-
const graphemeBreakTree = GraphemeBreakTree.getInstance();
|
|
617
|
-
const len = str.length;
|
|
618
|
-
const initialOffset = offset;
|
|
619
|
-
const initialCodePoint = getNextCodePoint(str, len, offset);
|
|
620
|
-
const initialGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(initialCodePoint);
|
|
621
|
-
offset += initialCodePoint >= 65536
|
|
622
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
623
|
-
? 2 : 1; // extend to the right
|
|
624
|
-
|
|
625
|
-
let graphemeBreakType = initialGraphemeBreakType;
|
|
626
|
-
|
|
627
|
-
while (offset < len) {
|
|
628
|
-
const nextCodePoint = getNextCodePoint(str, len, offset);
|
|
629
|
-
const nextGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(nextCodePoint);
|
|
630
|
-
|
|
631
|
-
if (breakBetweenGraphemeBreakType(graphemeBreakType, nextGraphemeBreakType)) {
|
|
632
|
-
break;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
offset += nextCodePoint >= 65536
|
|
636
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
637
|
-
? 2 : 1;
|
|
638
|
-
graphemeBreakType = nextGraphemeBreakType;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
const endOffset = offset; // extend to the left
|
|
642
|
-
|
|
643
|
-
offset = initialOffset;
|
|
644
|
-
graphemeBreakType = initialGraphemeBreakType;
|
|
645
|
-
|
|
646
|
-
while (offset > 0) {
|
|
647
|
-
const prevCodePoint = getPrevCodePoint(str, offset);
|
|
648
|
-
const prevGraphemeBreakType = graphemeBreakTree.getGraphemeBreakType(prevCodePoint);
|
|
649
|
-
|
|
650
|
-
if (breakBetweenGraphemeBreakType(prevGraphemeBreakType, graphemeBreakType)) {
|
|
651
|
-
break;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
offset -= prevCodePoint >= 65536
|
|
655
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
656
|
-
? 2 : 1;
|
|
657
|
-
graphemeBreakType = prevGraphemeBreakType;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
return [offset, endOffset];
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
function getCharContainingOffset(str, offset) {
|
|
664
|
-
if (offset > 0 && isLowSurrogate(str.charCodeAt(offset))) {
|
|
665
|
-
return _getCharContainingOffset(str, offset - 1);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
return _getCharContainingOffset(str, offset);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
exports.getCharContainingOffset = getCharContainingOffset;
|
|
672
|
-
/**
|
|
673
|
-
* A manual encoding of `str` to UTF8.
|
|
674
|
-
* Use only in environments which do not offer native conversion methods!
|
|
675
|
-
*/
|
|
676
|
-
|
|
677
|
-
function encodeUTF8(str) {
|
|
678
|
-
const strLen = str.length; // See https://en.wikipedia.org/wiki/UTF-8
|
|
679
|
-
// first loop to establish needed buffer size
|
|
680
|
-
|
|
681
|
-
let neededSize = 0;
|
|
682
|
-
let strOffset = 0;
|
|
683
|
-
|
|
684
|
-
while (strOffset < strLen) {
|
|
685
|
-
const codePoint = getNextCodePoint(str, strLen, strOffset);
|
|
686
|
-
strOffset += codePoint >= 65536
|
|
687
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
688
|
-
? 2 : 1;
|
|
689
|
-
|
|
690
|
-
if (codePoint < 0x0080) {
|
|
691
|
-
neededSize += 1;
|
|
692
|
-
} else if (codePoint < 0x0800) {
|
|
693
|
-
neededSize += 2;
|
|
694
|
-
} else if (codePoint < 0x10000) {
|
|
695
|
-
neededSize += 3;
|
|
696
|
-
} else {
|
|
697
|
-
neededSize += 4;
|
|
698
|
-
}
|
|
699
|
-
} // second loop to actually encode
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
const arr = new Uint8Array(neededSize);
|
|
703
|
-
strOffset = 0;
|
|
704
|
-
let arrOffset = 0;
|
|
705
|
-
|
|
706
|
-
while (strOffset < strLen) {
|
|
707
|
-
const codePoint = getNextCodePoint(str, strLen, strOffset);
|
|
708
|
-
strOffset += codePoint >= 65536
|
|
709
|
-
/* UNICODE_SUPPLEMENTARY_PLANE_BEGIN */
|
|
710
|
-
? 2 : 1;
|
|
711
|
-
|
|
712
|
-
if (codePoint < 0x0080) {
|
|
713
|
-
arr[arrOffset++] = codePoint;
|
|
714
|
-
} else if (codePoint < 0x0800) {
|
|
715
|
-
arr[arrOffset++] = 0b11000000 | (codePoint & 0b00000000000000000000011111000000) >>> 6;
|
|
716
|
-
arr[arrOffset++] = 0b10000000 | (codePoint & 0b00000000000000000000000000111111) >>> 0;
|
|
717
|
-
} else if (codePoint < 0x10000) {
|
|
718
|
-
arr[arrOffset++] = 0b11100000 | (codePoint & 0b00000000000000001111000000000000) >>> 12;
|
|
719
|
-
arr[arrOffset++] = 0b10000000 | (codePoint & 0b00000000000000000000111111000000) >>> 6;
|
|
720
|
-
arr[arrOffset++] = 0b10000000 | (codePoint & 0b00000000000000000000000000111111) >>> 0;
|
|
721
|
-
} else {
|
|
722
|
-
arr[arrOffset++] = 0b11110000 | (codePoint & 0b00000000000111000000000000000000) >>> 18;
|
|
723
|
-
arr[arrOffset++] = 0b10000000 | (codePoint & 0b00000000000000111111000000000000) >>> 12;
|
|
724
|
-
arr[arrOffset++] = 0b10000000 | (codePoint & 0b00000000000000000000111111000000) >>> 6;
|
|
725
|
-
arr[arrOffset++] = 0b10000000 | (codePoint & 0b00000000000000000000000000111111) >>> 0;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
return arr;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
exports.encodeUTF8 = encodeUTF8;
|
|
733
|
-
/**
|
|
734
|
-
* A manual decoding of a UTF8 string.
|
|
735
|
-
* Use only in environments which do not offer native conversion methods!
|
|
736
|
-
*/
|
|
737
|
-
|
|
738
|
-
function decodeUTF8(buffer) {
|
|
739
|
-
// https://en.wikipedia.org/wiki/UTF-8
|
|
740
|
-
const len = buffer.byteLength;
|
|
741
|
-
const result = [];
|
|
742
|
-
let offset = 0;
|
|
743
|
-
|
|
744
|
-
while (offset < len) {
|
|
745
|
-
const v0 = buffer[offset];
|
|
746
|
-
let codePoint;
|
|
747
|
-
|
|
748
|
-
if (v0 >= 0b11110000 && offset + 3 < len) {
|
|
749
|
-
// 4 bytes
|
|
750
|
-
codePoint = (buffer[offset++] & 0b00000111) << 18 >>> 0 | (buffer[offset++] & 0b00111111) << 12 >>> 0 | (buffer[offset++] & 0b00111111) << 6 >>> 0 | (buffer[offset++] & 0b00111111) << 0 >>> 0;
|
|
751
|
-
} else if (v0 >= 0b11100000 && offset + 2 < len) {
|
|
752
|
-
// 3 bytes
|
|
753
|
-
codePoint = (buffer[offset++] & 0b00001111) << 12 >>> 0 | (buffer[offset++] & 0b00111111) << 6 >>> 0 | (buffer[offset++] & 0b00111111) << 0 >>> 0;
|
|
754
|
-
} else if (v0 >= 0b11000000 && offset + 1 < len) {
|
|
755
|
-
// 2 bytes
|
|
756
|
-
codePoint = (buffer[offset++] & 0b00011111) << 6 >>> 0 | (buffer[offset++] & 0b00111111) << 0 >>> 0;
|
|
757
|
-
} else {
|
|
758
|
-
// 1 byte
|
|
759
|
-
codePoint = buffer[offset++];
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
if (codePoint >= 0 && codePoint <= 0xD7FF || codePoint >= 0xE000 && codePoint <= 0xFFFF) {
|
|
763
|
-
// Basic Multilingual Plane
|
|
764
|
-
result.push(String.fromCharCode(codePoint));
|
|
765
|
-
} else if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
|
|
766
|
-
// Supplementary Planes
|
|
767
|
-
const uPrime = codePoint - 0x10000;
|
|
768
|
-
const w1 = 0xD800 + ((uPrime & 0b11111111110000000000) >>> 10);
|
|
769
|
-
const w2 = 0xDC00 + ((uPrime & 0b00000000001111111111) >>> 0);
|
|
770
|
-
result.push(String.fromCharCode(w1));
|
|
771
|
-
result.push(String.fromCharCode(w2));
|
|
772
|
-
} else {
|
|
773
|
-
// illegal code point
|
|
774
|
-
result.push(String.fromCharCode(0xFFFD));
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
return result.join('');
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
exports.decodeUTF8 = decodeUTF8;
|
|
782
|
-
/**
|
|
783
|
-
* Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-rtl-test.js
|
|
784
|
-
*/
|
|
785
|
-
|
|
786
|
-
const CONTAINS_RTL = /(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;
|
|
787
|
-
/**
|
|
788
|
-
* Returns true if `str` contains any Unicode character that is classified as "R" or "AL".
|
|
789
|
-
*/
|
|
790
|
-
|
|
791
|
-
function containsRTL(str) {
|
|
792
|
-
return CONTAINS_RTL.test(str);
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
exports.containsRTL = containsRTL;
|
|
796
|
-
/**
|
|
797
|
-
* Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js
|
|
798
|
-
*/
|
|
799
|
-
|
|
800
|
-
const CONTAINS_EMOJI = /(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;
|
|
801
|
-
|
|
802
|
-
function containsEmoji(str) {
|
|
803
|
-
return CONTAINS_EMOJI.test(str);
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
exports.containsEmoji = containsEmoji;
|
|
807
|
-
const IS_BASIC_ASCII = /^[\t\n\r\x20-\x7E]*$/;
|
|
808
|
-
/**
|
|
809
|
-
* Returns true if `str` contains only basic ASCII characters in the range 32 - 126 (including 32 and 126) or \n, \r, \t
|
|
810
|
-
*/
|
|
811
|
-
|
|
812
|
-
function isBasicASCII(str) {
|
|
813
|
-
return IS_BASIC_ASCII.test(str);
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
exports.isBasicASCII = isBasicASCII;
|
|
817
|
-
exports.UNUSUAL_LINE_TERMINATORS = /[\u2028\u2029]/; // LINE SEPARATOR (LS) or PARAGRAPH SEPARATOR (PS)
|
|
818
|
-
|
|
819
|
-
/**
|
|
820
|
-
* Returns true if `str` contains unusual line terminators, like LS or PS
|
|
821
|
-
*/
|
|
822
|
-
|
|
823
|
-
function containsUnusualLineTerminators(str) {
|
|
824
|
-
return exports.UNUSUAL_LINE_TERMINATORS.test(str);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
exports.containsUnusualLineTerminators = containsUnusualLineTerminators;
|
|
828
|
-
|
|
829
|
-
function containsFullWidthCharacter(str) {
|
|
830
|
-
for (let i = 0, len = str.length; i < len; i++) {
|
|
831
|
-
if (isFullWidthCharacter(str.charCodeAt(i))) {
|
|
832
|
-
return true;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
return false;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
exports.containsFullWidthCharacter = containsFullWidthCharacter;
|
|
840
|
-
|
|
841
|
-
function isFullWidthCharacter(charCode) {
|
|
842
|
-
// Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns
|
|
843
|
-
// http://jrgraphix.net/research/unicode_blocks.php
|
|
844
|
-
// 2E80 — 2EFF CJK Radicals Supplement
|
|
845
|
-
// 2F00 — 2FDF Kangxi Radicals
|
|
846
|
-
// 2FF0 — 2FFF Ideographic Description Characters
|
|
847
|
-
// 3000 — 303F CJK Symbols and Punctuation
|
|
848
|
-
// 3040 — 309F Hiragana
|
|
849
|
-
// 30A0 — 30FF Katakana
|
|
850
|
-
// 3100 — 312F Bopomofo
|
|
851
|
-
// 3130 — 318F Hangul Compatibility Jamo
|
|
852
|
-
// 3190 — 319F Kanbun
|
|
853
|
-
// 31A0 — 31BF Bopomofo Extended
|
|
854
|
-
// 31F0 — 31FF Katakana Phonetic Extensions
|
|
855
|
-
// 3200 — 32FF Enclosed CJK Letters and Months
|
|
856
|
-
// 3300 — 33FF CJK Compatibility
|
|
857
|
-
// 3400 — 4DBF CJK Unified Ideographs Extension A
|
|
858
|
-
// 4DC0 — 4DFF Yijing Hexagram Symbols
|
|
859
|
-
// 4E00 — 9FFF CJK Unified Ideographs
|
|
860
|
-
// A000 — A48F Yi Syllables
|
|
861
|
-
// A490 — A4CF Yi Radicals
|
|
862
|
-
// AC00 — D7AF Hangul Syllables
|
|
863
|
-
// [IGNORE] D800 — DB7F High Surrogates
|
|
864
|
-
// [IGNORE] DB80 — DBFF High Private Use Surrogates
|
|
865
|
-
// [IGNORE] DC00 — DFFF Low Surrogates
|
|
866
|
-
// [IGNORE] E000 — F8FF Private Use Area
|
|
867
|
-
// F900 — FAFF CJK Compatibility Ideographs
|
|
868
|
-
// [IGNORE] FB00 — FB4F Alphabetic Presentation Forms
|
|
869
|
-
// [IGNORE] FB50 — FDFF Arabic Presentation Forms-A
|
|
870
|
-
// [IGNORE] FE00 — FE0F Variation Selectors
|
|
871
|
-
// [IGNORE] FE20 — FE2F Combining Half Marks
|
|
872
|
-
// [IGNORE] FE30 — FE4F CJK Compatibility Forms
|
|
873
|
-
// [IGNORE] FE50 — FE6F Small Form Variants
|
|
874
|
-
// [IGNORE] FE70 — FEFF Arabic Presentation Forms-B
|
|
875
|
-
// FF00 — FFEF Halfwidth and Fullwidth Forms
|
|
876
|
-
// [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]
|
|
877
|
-
// of which FF01 - FF5E fullwidth ASCII of 21 to 7E
|
|
878
|
-
// [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul
|
|
879
|
-
// [IGNORE] FFF0 — FFFF Specials
|
|
880
|
-
charCode = +charCode; // @perf
|
|
881
|
-
|
|
882
|
-
return charCode >= 0x2E80 && charCode <= 0xD7AF || charCode >= 0xF900 && charCode <= 0xFAFF || charCode >= 0xFF01 && charCode <= 0xFF5E;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
exports.isFullWidthCharacter = isFullWidthCharacter;
|
|
886
|
-
/**
|
|
887
|
-
* A fast function (therefore imprecise) to check if code points are emojis.
|
|
888
|
-
* Generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-emoji-test.js
|
|
889
|
-
*/
|
|
890
|
-
|
|
891
|
-
function isEmojiImprecise(x) {
|
|
892
|
-
return x >= 0x1F1E6 && x <= 0x1F1FF || x >= 9728 && x <= 10175 || x >= 127744 && x <= 128591 || x >= 128640 && x <= 128764 || x >= 128992 && x <= 129003 || x >= 129280 && x <= 129535 || x >= 129648 && x <= 129651 || x >= 129656 && x <= 129666 || x >= 129680 && x <= 129685;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
exports.isEmojiImprecise = isEmojiImprecise;
|
|
896
|
-
/**
|
|
897
|
-
* Given a string and a max length returns a shorted version. Shorting
|
|
898
|
-
* happens at favorable positions - such as whitespace or punctuation characters.
|
|
899
|
-
*/
|
|
900
|
-
|
|
901
|
-
function lcut(text, n) {
|
|
902
|
-
if (text.length < n) {
|
|
903
|
-
return text;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
const re = /\b/g;
|
|
907
|
-
let i = 0;
|
|
908
|
-
|
|
909
|
-
while (re.test(text)) {
|
|
910
|
-
if (text.length - re.lastIndex < n) {
|
|
911
|
-
break;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
i = re.lastIndex;
|
|
915
|
-
re.lastIndex += 1;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
return text.substring(i).replace(/^\s/, '');
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
exports.lcut = lcut; // Escape codes
|
|
922
|
-
// http://en.wikipedia.org/wiki/ANSI_escape_code
|
|
923
|
-
|
|
924
|
-
const EL = /\x1B\x5B[12]?K/g; // Erase in line
|
|
925
|
-
|
|
926
|
-
const COLOR_START = /\x1b\[\d+m/g; // Color
|
|
927
|
-
|
|
928
|
-
const COLOR_END = /\x1b\[0?m/g; // Color
|
|
929
|
-
|
|
930
|
-
function removeAnsiEscapeCodes(str) {
|
|
931
|
-
if (str) {
|
|
932
|
-
str = str.replace(EL, '');
|
|
933
|
-
str = str.replace(COLOR_START, '');
|
|
934
|
-
str = str.replace(COLOR_END, '');
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
return str;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
exports.removeAnsiEscapeCodes = removeAnsiEscapeCodes; // -- UTF-8 BOM
|
|
941
|
-
|
|
942
|
-
exports.UTF8_BOM_CHARACTER = String.fromCharCode(65279
|
|
943
|
-
/* UTF8_BOM */
|
|
944
|
-
);
|
|
945
|
-
|
|
946
|
-
function startsWithUTF8BOM(str) {
|
|
947
|
-
return !!(str && str.length > 0 && str.charCodeAt(0) === 65279
|
|
948
|
-
/* UTF8_BOM */
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
exports.startsWithUTF8BOM = startsWithUTF8BOM;
|
|
953
|
-
|
|
954
|
-
function stripUTF8BOM(str) {
|
|
955
|
-
return startsWithUTF8BOM(str) ? str.substr(1) : str;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
exports.stripUTF8BOM = stripUTF8BOM;
|
|
959
|
-
/**
|
|
960
|
-
* Checks if the characters of the provided query string are included in the
|
|
961
|
-
* target string. The characters do not have to be contiguous within the string.
|
|
962
|
-
*/
|
|
963
|
-
|
|
964
|
-
function fuzzyContains(target, query) {
|
|
965
|
-
if (!target || !query) {
|
|
966
|
-
return false; // return early if target or query are undefined
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
if (target.length < query.length) {
|
|
970
|
-
return false; // impossible for query to be contained in target
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
const queryLen = query.length;
|
|
974
|
-
const targetLower = target.toLowerCase();
|
|
975
|
-
let index = 0;
|
|
976
|
-
let lastIndexOf = -1;
|
|
977
|
-
|
|
978
|
-
while (index < queryLen) {
|
|
979
|
-
const indexOf = targetLower.indexOf(query[index], lastIndexOf + 1);
|
|
980
|
-
|
|
981
|
-
if (indexOf < 0) {
|
|
982
|
-
return false;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
lastIndexOf = indexOf;
|
|
986
|
-
index++;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
return true;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
exports.fuzzyContains = fuzzyContains;
|
|
993
|
-
|
|
994
|
-
function containsUppercaseCharacter(target, ignoreEscapedChars = false) {
|
|
995
|
-
if (!target) {
|
|
996
|
-
return false;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
if (ignoreEscapedChars) {
|
|
1000
|
-
target = target.replace(/\\./g, '');
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
return target.toLowerCase() !== target;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
exports.containsUppercaseCharacter = containsUppercaseCharacter;
|
|
1007
|
-
|
|
1008
|
-
function uppercaseFirstLetter(str) {
|
|
1009
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
exports.uppercaseFirstLetter = uppercaseFirstLetter;
|
|
1013
|
-
|
|
1014
|
-
function getNLines(str, n = 1) {
|
|
1015
|
-
if (n === 0) {
|
|
1016
|
-
return '';
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
let idx = -1;
|
|
1020
|
-
|
|
1021
|
-
do {
|
|
1022
|
-
idx = str.indexOf('\n', idx + 1);
|
|
1023
|
-
n--;
|
|
1024
|
-
} while (n > 0 && idx >= 0);
|
|
1025
|
-
|
|
1026
|
-
return idx >= 0 ? str.substr(0, idx) : str;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
exports.getNLines = getNLines;
|
|
1030
|
-
/**
|
|
1031
|
-
* Produces 'a'-'z', followed by 'A'-'Z'... followed by 'a'-'z', etc.
|
|
1032
|
-
*/
|
|
1033
|
-
|
|
1034
|
-
function singleLetterHash(n) {
|
|
1035
|
-
const LETTERS_CNT = 90
|
|
1036
|
-
/* Z */
|
|
1037
|
-
- 65
|
|
1038
|
-
/* A */
|
|
1039
|
-
+ 1;
|
|
1040
|
-
n = n % (2 * LETTERS_CNT);
|
|
1041
|
-
|
|
1042
|
-
if (n < LETTERS_CNT) {
|
|
1043
|
-
return String.fromCharCode(97
|
|
1044
|
-
/* a */
|
|
1045
|
-
+ n);
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
return String.fromCharCode(65
|
|
1049
|
-
/* A */
|
|
1050
|
-
+ n - LETTERS_CNT);
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
exports.singleLetterHash = singleLetterHash; //#region Unicode Grapheme Break
|
|
1054
|
-
|
|
1055
|
-
function getGraphemeBreakType(codePoint) {
|
|
1056
|
-
const graphemeBreakTree = GraphemeBreakTree.getInstance();
|
|
1057
|
-
return graphemeBreakTree.getGraphemeBreakType(codePoint);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
exports.getGraphemeBreakType = getGraphemeBreakType;
|
|
1061
|
-
|
|
1062
|
-
function breakBetweenGraphemeBreakType(breakTypeA, breakTypeB) {
|
|
1063
|
-
// http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules
|
|
1064
|
-
// !!! Let's make the common case a bit faster
|
|
1065
|
-
if (breakTypeA === 0
|
|
1066
|
-
/* Other */
|
|
1067
|
-
) {
|
|
1068
|
-
// see https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakTest-13.0.0d10.html#table
|
|
1069
|
-
return breakTypeB !== 5
|
|
1070
|
-
/* Extend */
|
|
1071
|
-
&& breakTypeB !== 7
|
|
1072
|
-
/* SpacingMark */
|
|
1073
|
-
;
|
|
1074
|
-
} // Do not break between a CR and LF. Otherwise, break before and after controls.
|
|
1075
|
-
// GB3 CR × LF
|
|
1076
|
-
// GB4 (Control | CR | LF) ÷
|
|
1077
|
-
// GB5 ÷ (Control | CR | LF)
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
if (breakTypeA === 2
|
|
1081
|
-
/* CR */
|
|
1082
|
-
) {
|
|
1083
|
-
if (breakTypeB === 3
|
|
1084
|
-
/* LF */
|
|
1085
|
-
) {
|
|
1086
|
-
return false; // GB3
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
if (breakTypeA === 4
|
|
1091
|
-
/* Control */
|
|
1092
|
-
|| breakTypeA === 2
|
|
1093
|
-
/* CR */
|
|
1094
|
-
|| breakTypeA === 3
|
|
1095
|
-
/* LF */
|
|
1096
|
-
) {
|
|
1097
|
-
return true; // GB4
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
if (breakTypeB === 4
|
|
1101
|
-
/* Control */
|
|
1102
|
-
|| breakTypeB === 2
|
|
1103
|
-
/* CR */
|
|
1104
|
-
|| breakTypeB === 3
|
|
1105
|
-
/* LF */
|
|
1106
|
-
) {
|
|
1107
|
-
return true; // GB5
|
|
1108
|
-
} // Do not break Hangul syllable sequences.
|
|
1109
|
-
// GB6 L × (L | V | LV | LVT)
|
|
1110
|
-
// GB7 (LV | V) × (V | T)
|
|
1111
|
-
// GB8 (LVT | T) × T
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
if (breakTypeA === 8
|
|
1115
|
-
/* L */
|
|
1116
|
-
) {
|
|
1117
|
-
if (breakTypeB === 8
|
|
1118
|
-
/* L */
|
|
1119
|
-
|| breakTypeB === 9
|
|
1120
|
-
/* V */
|
|
1121
|
-
|| breakTypeB === 11
|
|
1122
|
-
/* LV */
|
|
1123
|
-
|| breakTypeB === 12
|
|
1124
|
-
/* LVT */
|
|
1125
|
-
) {
|
|
1126
|
-
return false; // GB6
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
if (breakTypeA === 11
|
|
1131
|
-
/* LV */
|
|
1132
|
-
|| breakTypeA === 9
|
|
1133
|
-
/* V */
|
|
1134
|
-
) {
|
|
1135
|
-
if (breakTypeB === 9
|
|
1136
|
-
/* V */
|
|
1137
|
-
|| breakTypeB === 10
|
|
1138
|
-
/* T */
|
|
1139
|
-
) {
|
|
1140
|
-
return false; // GB7
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
if (breakTypeA === 12
|
|
1145
|
-
/* LVT */
|
|
1146
|
-
|| breakTypeA === 10
|
|
1147
|
-
/* T */
|
|
1148
|
-
) {
|
|
1149
|
-
if (breakTypeB === 10
|
|
1150
|
-
/* T */
|
|
1151
|
-
) {
|
|
1152
|
-
return false; // GB8
|
|
1153
|
-
}
|
|
1154
|
-
} // Do not break before extending characters or ZWJ.
|
|
1155
|
-
// GB9 × (Extend | ZWJ)
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
if (breakTypeB === 5
|
|
1159
|
-
/* Extend */
|
|
1160
|
-
|| breakTypeB === 13
|
|
1161
|
-
/* ZWJ */
|
|
1162
|
-
) {
|
|
1163
|
-
return false; // GB9
|
|
1164
|
-
} // The GB9a and GB9b rules only apply to extended grapheme clusters:
|
|
1165
|
-
// Do not break before SpacingMarks, or after Prepend characters.
|
|
1166
|
-
// GB9a × SpacingMark
|
|
1167
|
-
// GB9b Prepend ×
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
if (breakTypeB === 7
|
|
1171
|
-
/* SpacingMark */
|
|
1172
|
-
) {
|
|
1173
|
-
return false; // GB9a
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
if (breakTypeA === 1
|
|
1177
|
-
/* Prepend */
|
|
1178
|
-
) {
|
|
1179
|
-
return false; // GB9b
|
|
1180
|
-
} // Do not break within emoji modifier sequences or emoji zwj sequences.
|
|
1181
|
-
// GB11 \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
if (breakTypeA === 13
|
|
1185
|
-
/* ZWJ */
|
|
1186
|
-
&& breakTypeB === 14
|
|
1187
|
-
/* Extended_Pictographic */
|
|
1188
|
-
) {
|
|
1189
|
-
// Note: we are not implementing the rule entirely here to avoid introducing states
|
|
1190
|
-
return false; // GB11
|
|
1191
|
-
} // GB12 sot (RI RI)* RI × RI
|
|
1192
|
-
// GB13 [^RI] (RI RI)* RI × RI
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
if (breakTypeA === 6
|
|
1196
|
-
/* Regional_Indicator */
|
|
1197
|
-
&& breakTypeB === 6
|
|
1198
|
-
/* Regional_Indicator */
|
|
1199
|
-
) {
|
|
1200
|
-
// Note: we are not implementing the rule entirely here to avoid introducing states
|
|
1201
|
-
return false; // GB12 & GB13
|
|
1202
|
-
} // GB999 Any ÷ Any
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
return true;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
exports.breakBetweenGraphemeBreakType = breakBetweenGraphemeBreakType;
|
|
1209
|
-
|
|
1210
|
-
class GraphemeBreakTree {
|
|
1211
|
-
constructor() {
|
|
1212
|
-
this._data = getGraphemeBreakRawData();
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
static getInstance() {
|
|
1216
|
-
if (!GraphemeBreakTree._INSTANCE) {
|
|
1217
|
-
GraphemeBreakTree._INSTANCE = new GraphemeBreakTree();
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
return GraphemeBreakTree._INSTANCE;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
getGraphemeBreakType(codePoint) {
|
|
1224
|
-
// !!! Let's make 7bit ASCII a bit faster: 0..31
|
|
1225
|
-
if (codePoint < 32) {
|
|
1226
|
-
if (codePoint === 10
|
|
1227
|
-
/* LineFeed */
|
|
1228
|
-
) {
|
|
1229
|
-
return 3
|
|
1230
|
-
/* LF */
|
|
1231
|
-
;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if (codePoint === 13
|
|
1235
|
-
/* CarriageReturn */
|
|
1236
|
-
) {
|
|
1237
|
-
return 2
|
|
1238
|
-
/* CR */
|
|
1239
|
-
;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
return 4
|
|
1243
|
-
/* Control */
|
|
1244
|
-
;
|
|
1245
|
-
} // !!! Let's make 7bit ASCII a bit faster: 32..126
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
if (codePoint < 127) {
|
|
1249
|
-
return 0
|
|
1250
|
-
/* Other */
|
|
1251
|
-
;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
const data = this._data;
|
|
1255
|
-
const nodeCount = data.length / 3;
|
|
1256
|
-
let nodeIndex = 1;
|
|
1257
|
-
|
|
1258
|
-
while (nodeIndex <= nodeCount) {
|
|
1259
|
-
if (codePoint < data[3 * nodeIndex]) {
|
|
1260
|
-
// go left
|
|
1261
|
-
nodeIndex = 2 * nodeIndex;
|
|
1262
|
-
} else if (codePoint > data[3 * nodeIndex + 1]) {
|
|
1263
|
-
// go right
|
|
1264
|
-
nodeIndex = 2 * nodeIndex + 1;
|
|
1265
|
-
} else {
|
|
1266
|
-
// hit
|
|
1267
|
-
return data[3 * nodeIndex + 2];
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
return 0
|
|
1272
|
-
/* Other */
|
|
1273
|
-
;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
GraphemeBreakTree._INSTANCE = null;
|
|
1279
|
-
|
|
1280
|
-
function getGraphemeBreakRawData() {
|
|
1281
|
-
// generated using https://github.com/alexandrudima/unicode-utils/blob/master/generate-grapheme-break.js
|
|
1282
|
-
return JSON.parse('[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]');
|
|
1283
|
-
} //#endregion
|