mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
N°7063 - Forms SDK - Add Symfony forms component
error forms issue
This commit is contained in:
678
node_modules/@orchidjs/unicode-variants/dist/umd/index.js
generated
vendored
Normal file
678
node_modules/@orchidjs/unicode-variants/dist/umd/index.js
generated
vendored
Normal file
@@ -0,0 +1,678 @@
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.diacritics = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* Convert array of strings to a regular expression
|
||||
* ex ['ab','a'] => (?:ab|a)
|
||||
* ex ['a','b'] => [ab]
|
||||
* @param {string[]} chars
|
||||
* @return {string}
|
||||
*/
|
||||
const arrayToPattern = chars => {
|
||||
chars = chars.filter(Boolean);
|
||||
|
||||
if (chars.length < 2) {
|
||||
return chars[0] || '';
|
||||
}
|
||||
|
||||
return maxValueLength(chars) == 1 ? '[' + chars.join('') + ']' : '(?:' + chars.join('|') + ')';
|
||||
};
|
||||
/**
|
||||
* @param {string[]} array
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const sequencePattern = array => {
|
||||
if (!hasDuplicates(array)) {
|
||||
return array.join('');
|
||||
}
|
||||
|
||||
let pattern = '';
|
||||
let prev_char_count = 0;
|
||||
|
||||
const prev_pattern = () => {
|
||||
if (prev_char_count > 1) {
|
||||
pattern += '{' + prev_char_count + '}';
|
||||
}
|
||||
};
|
||||
|
||||
array.forEach((char, i) => {
|
||||
if (char === array[i - 1]) {
|
||||
prev_char_count++;
|
||||
return;
|
||||
}
|
||||
|
||||
prev_pattern();
|
||||
pattern += char;
|
||||
prev_char_count = 1;
|
||||
});
|
||||
prev_pattern();
|
||||
return pattern;
|
||||
};
|
||||
/**
|
||||
* Convert array of strings to a regular expression
|
||||
* ex ['ab','a'] => (?:ab|a)
|
||||
* ex ['a','b'] => [ab]
|
||||
* @param {Set<string>} chars
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const setToPattern = chars => {
|
||||
let array = toArray(chars);
|
||||
return arrayToPattern(array);
|
||||
};
|
||||
/**
|
||||
*
|
||||
* https://stackoverflow.com/questions/7376598/in-javascript-how-do-i-check-if-an-array-has-duplicate-values
|
||||
* @param {any[]} array
|
||||
*/
|
||||
|
||||
const hasDuplicates = array => {
|
||||
return new Set(array).size !== array.length;
|
||||
};
|
||||
/**
|
||||
* https://stackoverflow.com/questions/63006601/why-does-u-throw-an-invalid-escape-error
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const escape_regex = str => {
|
||||
return (str + '').replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu, '\\$1');
|
||||
};
|
||||
/**
|
||||
* Return the max length of array values
|
||||
* @param {string[]} array
|
||||
*
|
||||
*/
|
||||
|
||||
const maxValueLength = array => {
|
||||
return array.reduce((longest, value) => Math.max(longest, unicodeLength(value)), 0);
|
||||
};
|
||||
/**
|
||||
* @param {string} str
|
||||
*/
|
||||
|
||||
const unicodeLength = str => {
|
||||
return toArray(str).length;
|
||||
};
|
||||
/**
|
||||
* @param {any} p
|
||||
* @return {any[]}
|
||||
*/
|
||||
|
||||
const toArray = p => Array.from(p);
|
||||
|
||||
/**
|
||||
* Get all possible combinations of substrings that add up to the given string
|
||||
* https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string
|
||||
* @param {string} input
|
||||
* @return {string[][]}
|
||||
*/
|
||||
const allSubstrings = input => {
|
||||
if (input.length === 1) return [[input]];
|
||||
/** @type {string[][]} */
|
||||
|
||||
let result = [];
|
||||
const start = input.substring(1);
|
||||
const suba = allSubstrings(start);
|
||||
suba.forEach(function (subresult) {
|
||||
let tmp = subresult.slice(0);
|
||||
tmp[0] = input.charAt(0) + tmp[0];
|
||||
result.push(tmp);
|
||||
tmp = subresult.slice(0);
|
||||
tmp.unshift(input.charAt(0));
|
||||
result.push(tmp);
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {{[key:string]:string}} TUnicodeMap
|
||||
* @typedef {{[key:string]:Set<string>}} TUnicodeSets
|
||||
* @typedef {[[number,number]]} TCodePoints
|
||||
* @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj
|
||||
* @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart
|
||||
*/
|
||||
/** @type {TCodePoints} */
|
||||
|
||||
const code_points = [[0, 65535]];
|
||||
const accent_pat = '[\u0300-\u036F\u{b7}\u{2be}\u{2bc}]';
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
exports.unicode_map = void 0;
|
||||
/** @type {RegExp} */
|
||||
|
||||
let multi_char_reg;
|
||||
const max_char_length = 3;
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_convert = {};
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const latin_condensed = {
|
||||
'/': '⁄∕',
|
||||
'0': '߀',
|
||||
"a": "ⱥɐɑ",
|
||||
"aa": "ꜳ",
|
||||
"ae": "æǽǣ",
|
||||
"ao": "ꜵ",
|
||||
"au": "ꜷ",
|
||||
"av": "ꜹꜻ",
|
||||
"ay": "ꜽ",
|
||||
"b": "ƀɓƃ",
|
||||
"c": "ꜿƈȼↄ",
|
||||
"d": "đɗɖᴅƌꮷԁɦ",
|
||||
"e": "ɛǝᴇɇ",
|
||||
"f": "ꝼƒ",
|
||||
"g": "ǥɠꞡᵹꝿɢ",
|
||||
"h": "ħⱨⱶɥ",
|
||||
"i": "ɨı",
|
||||
"j": "ɉȷ",
|
||||
"k": "ƙⱪꝁꝃꝅꞣ",
|
||||
"l": "łƚɫⱡꝉꝇꞁɭ",
|
||||
"m": "ɱɯϻ",
|
||||
"n": "ꞥƞɲꞑᴎлԉ",
|
||||
"o": "øǿɔɵꝋꝍᴑ",
|
||||
"oe": "œ",
|
||||
"oi": "ƣ",
|
||||
"oo": "ꝏ",
|
||||
"ou": "ȣ",
|
||||
"p": "ƥᵽꝑꝓꝕρ",
|
||||
"q": "ꝗꝙɋ",
|
||||
"r": "ɍɽꝛꞧꞃ",
|
||||
"s": "ßȿꞩꞅʂ",
|
||||
"t": "ŧƭʈⱦꞇ",
|
||||
"th": "þ",
|
||||
"tz": "ꜩ",
|
||||
"u": "ʉ",
|
||||
"v": "ʋꝟʌ",
|
||||
"vy": "ꝡ",
|
||||
"w": "ⱳ",
|
||||
"y": "ƴɏỿ",
|
||||
"z": "ƶȥɀⱬꝣ",
|
||||
"hv": "ƕ"
|
||||
};
|
||||
|
||||
for (let latin in latin_condensed) {
|
||||
let unicode = latin_condensed[latin] || '';
|
||||
|
||||
for (let i = 0; i < unicode.length; i++) {
|
||||
let char = unicode.substring(i, i + 1);
|
||||
latin_convert[char] = latin;
|
||||
}
|
||||
}
|
||||
|
||||
const convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');
|
||||
/**
|
||||
* Initialize the unicode_map from the give code point ranges
|
||||
*
|
||||
* @param {TCodePoints=} _code_points
|
||||
*/
|
||||
|
||||
const initialize = _code_points => {
|
||||
if (exports.unicode_map !== undefined) return;
|
||||
exports.unicode_map = generateMap(_code_points || code_points);
|
||||
};
|
||||
/**
|
||||
* Helper method for normalize a string
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
|
||||
* @param {string} str
|
||||
* @param {string} form
|
||||
*/
|
||||
|
||||
const normalize = (str, form = 'NFKD') => str.normalize(form);
|
||||
/**
|
||||
* Remove accents without reordering string
|
||||
* calling str.normalize('NFKD') on \u{594}\u{595}\u{596} becomes \u{596}\u{594}\u{595}
|
||||
* via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const asciifold = str => {
|
||||
return toArray(str).reduce(
|
||||
/**
|
||||
* @param {string} result
|
||||
* @param {string} char
|
||||
*/
|
||||
(result, char) => {
|
||||
return result + _asciifold(char);
|
||||
}, '');
|
||||
};
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const _asciifold = str => {
|
||||
str = normalize(str).toLowerCase().replace(convert_pat, (
|
||||
/** @type {string} */
|
||||
char) => {
|
||||
return latin_convert[char] || '';
|
||||
}); //return str;
|
||||
|
||||
return normalize(str, 'NFC');
|
||||
};
|
||||
/**
|
||||
* Generate a list of unicode variants from the list of code points
|
||||
* @param {TCodePoints} code_points
|
||||
* @yield {TCodePointObj}
|
||||
*/
|
||||
|
||||
function* generator(code_points) {
|
||||
for (const [code_point_min, code_point_max] of code_points) {
|
||||
for (let i = code_point_min; i <= code_point_max; i++) {
|
||||
let composed = String.fromCharCode(i);
|
||||
let folded = asciifold(composed);
|
||||
|
||||
if (folded == composed.toLowerCase()) {
|
||||
continue;
|
||||
} // skip when folded is a string longer than 3 characters long
|
||||
// bc the resulting regex patterns will be long
|
||||
// eg:
|
||||
// folded صلى الله عليه وسلم length 18 code point 65018
|
||||
// folded جل جلاله length 8 code point 65019
|
||||
|
||||
|
||||
if (folded.length > max_char_length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (folded.length == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
yield {
|
||||
folded: folded,
|
||||
composed: composed,
|
||||
code_point: i
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generate a unicode map from the list of code points
|
||||
* @param {TCodePoints} code_points
|
||||
* @return {TUnicodeSets}
|
||||
*/
|
||||
|
||||
const generateSets = code_points => {
|
||||
/** @type {{[key:string]:Set<string>}} */
|
||||
const unicode_sets = {};
|
||||
/**
|
||||
* @param {string} folded
|
||||
* @param {string} to_add
|
||||
*/
|
||||
|
||||
const addMatching = (folded, to_add) => {
|
||||
/** @type {Set<string>} */
|
||||
const folded_set = unicode_sets[folded] || new Set();
|
||||
const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');
|
||||
|
||||
if (to_add.match(patt)) {
|
||||
return;
|
||||
}
|
||||
|
||||
folded_set.add(escape_regex(to_add));
|
||||
unicode_sets[folded] = folded_set;
|
||||
};
|
||||
|
||||
for (let value of generator(code_points)) {
|
||||
addMatching(value.folded, value.folded);
|
||||
addMatching(value.folded, value.composed);
|
||||
}
|
||||
|
||||
return unicode_sets;
|
||||
};
|
||||
/**
|
||||
* Generate a unicode map from the list of code points
|
||||
* ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))
|
||||
*
|
||||
* @param {TCodePoints} code_points
|
||||
* @return {TUnicodeMap}
|
||||
*/
|
||||
|
||||
const generateMap = code_points => {
|
||||
/** @type {TUnicodeSets} */
|
||||
const unicode_sets = generateSets(code_points);
|
||||
/** @type {TUnicodeMap} */
|
||||
|
||||
const unicode_map = {};
|
||||
/** @type {string[]} */
|
||||
|
||||
let multi_char = [];
|
||||
|
||||
for (let folded in unicode_sets) {
|
||||
let set = unicode_sets[folded];
|
||||
|
||||
if (set) {
|
||||
unicode_map[folded] = setToPattern(set);
|
||||
}
|
||||
|
||||
if (folded.length > 1) {
|
||||
multi_char.push(escape_regex(folded));
|
||||
}
|
||||
}
|
||||
|
||||
multi_char.sort((a, b) => b.length - a.length);
|
||||
const multi_char_patt = arrayToPattern(multi_char);
|
||||
multi_char_reg = new RegExp('^' + multi_char_patt, 'u');
|
||||
return unicode_map;
|
||||
};
|
||||
/**
|
||||
* Map each element of an array from it's folded value to all possible unicode matches
|
||||
* @param {string[]} strings
|
||||
* @param {number} min_replacement
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const mapSequence = (strings, min_replacement = 1) => {
|
||||
let chars_replaced = 0;
|
||||
strings = strings.map(str => {
|
||||
if (exports.unicode_map[str]) {
|
||||
chars_replaced += str.length;
|
||||
}
|
||||
|
||||
return exports.unicode_map[str] || str;
|
||||
});
|
||||
|
||||
if (chars_replaced >= min_replacement) {
|
||||
return sequencePattern(strings);
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
/**
|
||||
* Convert a short string and split it into all possible patterns
|
||||
* Keep a pattern only if min_replacement is met
|
||||
*
|
||||
* 'abc'
|
||||
* => [['abc'],['ab','c'],['a','bc'],['a','b','c']]
|
||||
* => ['abc-pattern','ab-c-pattern'...]
|
||||
*
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {number} min_replacement
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
const substringsToPattern = (str, min_replacement = 1) => {
|
||||
min_replacement = Math.max(min_replacement, str.length - 1);
|
||||
return arrayToPattern(allSubstrings(str).map(sub_pat => {
|
||||
return mapSequence(sub_pat, min_replacement);
|
||||
}));
|
||||
};
|
||||
/**
|
||||
* Convert an array of sequences into a pattern
|
||||
* [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)
|
||||
*
|
||||
* @param {Sequence[]} sequences
|
||||
* @param {boolean} all
|
||||
*/
|
||||
|
||||
const sequencesToPattern = (sequences, all = true) => {
|
||||
let min_replacement = sequences.length > 1 ? 1 : 0;
|
||||
return arrayToPattern(sequences.map(sequence => {
|
||||
let seq = [];
|
||||
const len = all ? sequence.length() : sequence.length() - 1;
|
||||
|
||||
for (let j = 0; j < len; j++) {
|
||||
seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));
|
||||
}
|
||||
|
||||
return sequencePattern(seq);
|
||||
}));
|
||||
};
|
||||
/**
|
||||
* Return true if the sequence is already in the sequences
|
||||
* @param {Sequence} needle_seq
|
||||
* @param {Sequence[]} sequences
|
||||
*/
|
||||
|
||||
|
||||
const inSequences = (needle_seq, sequences) => {
|
||||
for (const seq of sequences) {
|
||||
if (seq.start != needle_seq.start || seq.end != needle_seq.end) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (seq.substrs.join('') !== needle_seq.substrs.join('')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let needle_parts = needle_seq.parts;
|
||||
/**
|
||||
* @param {TSequencePart} part
|
||||
*/
|
||||
|
||||
const filter = part => {
|
||||
for (const needle_part of needle_parts) {
|
||||
if (needle_part.start === part.start && needle_part.substr === part.substr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (part.length == 1 || needle_part.length == 1) {
|
||||
continue;
|
||||
} // check for overlapping parts
|
||||
// a = ['::=','==']
|
||||
// b = ['::','===']
|
||||
// a = ['r','sm']
|
||||
// b = ['rs','m']
|
||||
|
||||
|
||||
if (part.start < needle_part.start && part.end > needle_part.start) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (needle_part.start < part.start && needle_part.end > part.start) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
let filtered = seq.parts.filter(filter);
|
||||
|
||||
if (filtered.length > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
class Sequence {
|
||||
constructor() {
|
||||
/** @type {TSequencePart[]} */
|
||||
this.parts = [];
|
||||
/** @type {string[]} */
|
||||
|
||||
this.substrs = [];
|
||||
this.start = 0;
|
||||
this.end = 0;
|
||||
}
|
||||
/**
|
||||
* @param {TSequencePart|undefined} part
|
||||
*/
|
||||
|
||||
|
||||
add(part) {
|
||||
if (part) {
|
||||
this.parts.push(part);
|
||||
this.substrs.push(part.substr);
|
||||
this.start = Math.min(part.start, this.start);
|
||||
this.end = Math.max(part.end, this.end);
|
||||
}
|
||||
}
|
||||
|
||||
last() {
|
||||
return this.parts[this.parts.length - 1];
|
||||
}
|
||||
|
||||
length() {
|
||||
return this.parts.length;
|
||||
}
|
||||
/**
|
||||
* @param {number} position
|
||||
* @param {TSequencePart} last_piece
|
||||
*/
|
||||
|
||||
|
||||
clone(position, last_piece) {
|
||||
let clone = new Sequence();
|
||||
let parts = JSON.parse(JSON.stringify(this.parts));
|
||||
let last_part = parts.pop();
|
||||
|
||||
for (const part of parts) {
|
||||
clone.add(part);
|
||||
}
|
||||
|
||||
let last_substr = last_piece.substr.substring(0, position - last_part.start);
|
||||
let clone_last_len = last_substr.length;
|
||||
clone.add({
|
||||
start: last_part.start,
|
||||
end: last_part.start + clone_last_len,
|
||||
length: clone_last_len,
|
||||
substr: last_substr
|
||||
});
|
||||
return clone;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Expand a regular expression pattern to include unicode variants
|
||||
* eg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/
|
||||
*
|
||||
* Issue:
|
||||
* ﺊﺋ [ 'ﺊ = \\u{fe8a}', 'ﺋ = \\u{fe8b}' ]
|
||||
* becomes: ئئ [ 'ي = \\u{64a}', 'ٔ = \\u{654}', 'ي = \\u{64a}', 'ٔ = \\u{654}' ]
|
||||
*
|
||||
* İIJ = IIJ = ⅡJ
|
||||
*
|
||||
* 1/2/4
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {string|undefined}
|
||||
*/
|
||||
|
||||
|
||||
const getPattern = str => {
|
||||
initialize();
|
||||
str = asciifold(str);
|
||||
let pattern = '';
|
||||
let sequences = [new Sequence()];
|
||||
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
let substr = str.substring(i);
|
||||
let match = substr.match(multi_char_reg);
|
||||
const char = str.substring(i, i + 1);
|
||||
const match_str = match ? match[0] : null; // loop through sequences
|
||||
// add either the char or multi_match
|
||||
|
||||
let overlapping = [];
|
||||
let added_types = new Set();
|
||||
|
||||
for (const sequence of sequences) {
|
||||
const last_piece = sequence.last();
|
||||
|
||||
if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {
|
||||
// if we have a multi match
|
||||
if (match_str) {
|
||||
const len = match_str.length;
|
||||
sequence.add({
|
||||
start: i,
|
||||
end: i + len,
|
||||
length: len,
|
||||
substr: match_str
|
||||
});
|
||||
added_types.add('1');
|
||||
} else {
|
||||
sequence.add({
|
||||
start: i,
|
||||
end: i + 1,
|
||||
length: 1,
|
||||
substr: char
|
||||
});
|
||||
added_types.add('2');
|
||||
}
|
||||
} else if (match_str) {
|
||||
let clone = sequence.clone(i, last_piece);
|
||||
const len = match_str.length;
|
||||
clone.add({
|
||||
start: i,
|
||||
end: i + len,
|
||||
length: len,
|
||||
substr: match_str
|
||||
});
|
||||
overlapping.push(clone);
|
||||
} else {
|
||||
// don't add char
|
||||
// adding would create invalid patterns: 234 => [2,34,4]
|
||||
added_types.add('3');
|
||||
}
|
||||
} // if we have overlapping
|
||||
|
||||
|
||||
if (overlapping.length > 0) {
|
||||
// ['ii','iii'] before ['i','i','iii']
|
||||
overlapping = overlapping.sort((a, b) => {
|
||||
return a.length() - b.length();
|
||||
});
|
||||
|
||||
for (let clone of overlapping) {
|
||||
// don't add if we already have an equivalent sequence
|
||||
if (inSequences(clone, sequences)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sequences.push(clone);
|
||||
}
|
||||
|
||||
continue;
|
||||
} // if we haven't done anything unique
|
||||
// clean up the patterns
|
||||
// helps keep patterns smaller
|
||||
// if str = 'r₨㎧aarss', pattern will be 446 instead of 655
|
||||
|
||||
|
||||
if (i > 0 && added_types.size == 1 && !added_types.has('3')) {
|
||||
pattern += sequencesToPattern(sequences, false);
|
||||
let new_seq = new Sequence();
|
||||
const old_seq = sequences[0];
|
||||
|
||||
if (old_seq) {
|
||||
new_seq.add(old_seq.last());
|
||||
}
|
||||
|
||||
sequences = [new_seq];
|
||||
}
|
||||
}
|
||||
|
||||
pattern += sequencesToPattern(sequences, true);
|
||||
return pattern;
|
||||
};
|
||||
|
||||
exports._asciifold = _asciifold;
|
||||
exports.asciifold = asciifold;
|
||||
exports.code_points = code_points;
|
||||
exports.escape_regex = escape_regex;
|
||||
exports.generateMap = generateMap;
|
||||
exports.generateSets = generateSets;
|
||||
exports.generator = generator;
|
||||
exports.getPattern = getPattern;
|
||||
exports.initialize = initialize;
|
||||
exports.mapSequence = mapSequence;
|
||||
exports.normalize = normalize;
|
||||
exports.substringsToPattern = substringsToPattern;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@orchidjs/unicode-variants/dist/umd/index.js.map
generated
vendored
Normal file
1
node_modules/@orchidjs/unicode-variants/dist/umd/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
57
node_modules/@orchidjs/unicode-variants/dist/umd/index.min.js
generated
vendored
Normal file
57
node_modules/@orchidjs/unicode-variants/dist/umd/index.min.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).diacritics={})}(this,(function(t){"use strict"
|
||||
const e=t=>(t=t.filter(Boolean)).length<2?t[0]||"":1==a(t)?"["+t.join("")+"]":"(?:"+t.join("|")+")",n=t=>{if(!r(t))return t.join("")
|
||||
let e="",n=0
|
||||
const s=()=>{n>1&&(e+="{"+n+"}")}
|
||||
return t.forEach(((r,o)=>{r!==t[o-1]?(s(),e+=r,n=1):n++})),s(),e},s=t=>{let n=i(t)
|
||||
return e(n)},r=t=>new Set(t).size!==t.length,o=t=>(t+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),a=t=>t.reduce(((t,e)=>Math.max(t,l(e))),0),l=t=>i(t).length,i=t=>Array.from(t),u=t=>{if(1===t.length)return[[t]]
|
||||
let e=[]
|
||||
const n=t.substring(1)
|
||||
return u(n).forEach((function(n){let s=n.slice(0)
|
||||
s[0]=t.charAt(0)+s[0],e.push(s),s=n.slice(0),s.unshift(t.charAt(0)),e.push(s)})),e},h=[[0,65535]]
|
||||
let d
|
||||
t.unicode_map=void 0
|
||||
const c={},f={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"}
|
||||
for(let t in f){let e=f[t]||""
|
||||
for(let n=0;n<e.length;n++){let s=e.substring(n,n+1)
|
||||
c[s]=t}}const g=new RegExp(Object.keys(c).join("|")+"|[̀-ͯ·ʾʼ]","gu"),p=e=>{void 0===t.unicode_map&&(t.unicode_map=j(e||h))},b=(t,e="NFKD")=>t.normalize(e),m=t=>i(t).reduce(((t,e)=>t+w(e)),""),w=t=>(t=b(t).toLowerCase().replace(g,(t=>c[t]||"")),b(t,"NFC"))
|
||||
function*y(t){for(const[e,n]of t)for(let t=e;t<=n;t++){let e=String.fromCharCode(t),n=m(e)
|
||||
n!=e.toLowerCase()&&(n.length>3||0!=n.length&&(yield{folded:n,composed:e,code_point:t}))}}const _=t=>{const e={},n=(t,n)=>{const r=e[t]||new Set,a=new RegExp("^"+s(r)+"$","iu")
|
||||
n.match(a)||(r.add(o(n)),e[t]=r)}
|
||||
for(let e of y(t))n(e.folded,e.folded),n(e.folded,e.composed)
|
||||
return e},j=t=>{const n=_(t),r={}
|
||||
let a=[]
|
||||
for(let t in n){let e=n[t]
|
||||
e&&(r[t]=s(e)),t.length>1&&a.push(o(t))}a.sort(((t,e)=>e.length-t.length))
|
||||
const l=e(a)
|
||||
return d=new RegExp("^"+l,"u"),r},x=(e,s=1)=>{let r=0
|
||||
return e=e.map((e=>(t.unicode_map[e]&&(r+=e.length),t.unicode_map[e]||e))),r>=s?n(e):""},S=(t,n=1)=>(n=Math.max(n,t.length-1),e(u(t).map((t=>x(t,n))))),v=(t,s=!0)=>{let r=t.length>1?1:0
|
||||
return e(t.map((t=>{let e=[]
|
||||
const o=s?t.length():t.length()-1
|
||||
for(let n=0;n<o;n++)e.push(S(t.substrs[n]||"",r))
|
||||
return n(e)})))},z=(t,e)=>{for(const n of e){if(n.start!=t.start||n.end!=t.end)continue
|
||||
if(n.substrs.join("")!==t.substrs.join(""))continue
|
||||
let e=t.parts
|
||||
const s=t=>{for(const n of e){if(n.start===t.start&&n.substr===t.substr)return!1
|
||||
if(1!=t.length&&1!=n.length){if(t.start<n.start&&t.end>n.start)return!0
|
||||
if(n.start<t.start&&n.end>t.start)return!0}}return!1}
|
||||
if(!(n.parts.filter(s).length>0))return!0}return!1}
|
||||
class M{constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let n=new M,s=JSON.parse(JSON.stringify(this.parts)),r=s.pop()
|
||||
for(const t of s)n.add(t)
|
||||
let o=e.substr.substring(0,t-r.start),a=o.length
|
||||
return n.add({start:r.start,end:r.start+a,length:a,substr:o}),n}}t._asciifold=w,t.asciifold=m,t.code_points=h,t.escape_regex=o,t.generateMap=j,t.generateSets=_,t.generator=y,t.getPattern=t=>{p(),t=m(t)
|
||||
let e="",n=[new M]
|
||||
for(let s=0;s<t.length;s++){let r=t.substring(s).match(d)
|
||||
const o=t.substring(s,s+1),a=r?r[0]:null
|
||||
let l=[],i=new Set
|
||||
for(const t of n){const e=t.last()
|
||||
if(!e||1==e.length||e.end<=s)if(a){const e=a.length
|
||||
t.add({start:s,end:s+e,length:e,substr:a}),i.add("1")}else t.add({start:s,end:s+1,length:1,substr:o}),i.add("2")
|
||||
else if(a){let n=t.clone(s,e)
|
||||
const r=a.length
|
||||
n.add({start:s,end:s+r,length:r,substr:a}),l.push(n)}else i.add("3")}if(l.length>0){l=l.sort(((t,e)=>t.length()-e.length()))
|
||||
for(let t of l)z(t,n)||n.push(t)}else if(s>0&&1==i.size&&!i.has("3")){e+=v(n,!1)
|
||||
let t=new M
|
||||
const s=n[0]
|
||||
s&&t.add(s.last()),n=[t]}}return e+=v(n,!0),e},t.initialize=p,t.mapSequence=x,t.normalize=b,t.substringsToPattern=S,Object.defineProperty(t,"__esModule",{value:!0})}))
|
||||
//# sourceMappingURL=index.min.js.map
|
||||
1
node_modules/@orchidjs/unicode-variants/dist/umd/index.min.js.map
generated
vendored
Normal file
1
node_modules/@orchidjs/unicode-variants/dist/umd/index.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user