Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1'use strict';2 3Object.defineProperty(exports, '__esModule', { value: true });4 5var ast = /*#__PURE__*/Object.freeze({6 __proto__: null7});8 9const latestEcmaVersion = 2025;10 11let largeIdStartRanges = undefined;12let largeIdContinueRanges = undefined;13function isIdStart(cp) {14 if (cp < 0x41)15 return false;16 if (cp < 0x5b)17 return true;18 if (cp < 0x61)19 return false;20 if (cp < 0x7b)21 return true;22 return isLargeIdStart(cp);23}24function isIdContinue(cp) {25 if (cp < 0x30)26 return false;27 if (cp < 0x3a)28 return true;29 if (cp < 0x41)30 return false;31 if (cp < 0x5b)32 return true;33 if (cp === 0x5f)34 return true;35 if (cp < 0x61)36 return false;37 if (cp < 0x7b)38 return true;39 return isLargeIdStart(cp) || isLargeIdContinue(cp);40}41function isLargeIdStart(cp) {42 return isInRange(cp, largeIdStartRanges !== null && largeIdStartRanges !== void 0 ? largeIdStartRanges : (largeIdStartRanges = initLargeIdStartRanges()));43}44function isLargeIdContinue(cp) {45 return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? largeIdContinueRanges : (largeIdContinueRanges = initLargeIdContinueRanges()));46}47function initLargeIdStartRanges() {48 return restoreRanges("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 3 0 7 14 20 q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 6 n 2 6 h 15 1n 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 2 1 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 v 2 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 h c 2u 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 29 l g 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 7 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 7 p 13 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 5 1l s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 5k w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 o 17 79 i g 0 2 c 2 x 3h 0 28 pl 2v 32 i 5f 219 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r x o 3 o 19 22 6 0 1v c 1t 1 2 0 f 4 a 5p1 16 v 2q 36 6pq 3 2 6 2 1 2 82 g 0 u 2 3 0 f 3 9 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9f 3 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1f9 u 7 5 7a 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 5s u 2 2 2 1 2 6 3 4 a 1 69 6 2 3 2 1 2 e 2 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyn x 3dp 3 4gd 3 5rk g h9 1wj f1 15v 3t6 6 6jt");49}50function initLargeIdContinueRanges() {51 return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 0 21 a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 2 h 2 6 b 1 3 9 i 2 1l 0 2 6 3 1 3 2 a 0 b 1 3 9 f 0 3 2 1l 0 2 4 5 1 3 2 4 0 l b 4 0 c 2 1l 0 2 7 2 2 2 2 l 1 3 9 b 5 2 2 1l 0 2 6 3 1 3 2 8 2 b 1 3 9 j 0 1o 4 4 2 2 3 a 0 f 9 h 4 1k 0 2 6 2 2 2 3 8 1 c 1 3 9 i 2 1l 0 2 6 2 2 2 3 8 1 c 1 3 9 4 0 d 3 1k 1 2 6 2 2 2 3 a 0 b 1 3 9 i 2 1z 0 5 5 2 0 2 7 7 9 3 1 1q 0 3 6 d 7 2 9 2g 0 3 8 c 6 2 9 1r 1 7 9 c 0 2 0 2 0 5 1 1e j 2 1 6 a 2 z a 0 2t j 2 9 d 3 5 2 2 2 3 6 4 3 e b 2 e jk 2 a 8 pt 3 t 2 u 1 v 1 1t v a 0 3 9 y 2 2 a 40 0 3b b 5 b b 9 3l a 1p 4 1m 9 2 s 3 a 7 9 n d 2 u 3 b l 4 1c g c 9 i 8 d 2 v c 3 9 19 d 1d j 9 9 7 9 3b 2 2 k 5 0 7 0 3 2 5j 1r el 1 1e 1 k 0 3g c 5 0 4 b 2db 2 3y 0 2p v ff 5 2y 1 2p 0 n51 9 1y 0 5 9 x 1 29 1 7l 0 4 0 5 0 o 4 5 0 2c 1 1f h b 9 7 h e a t 7 q c 19 3 1c d g 9 c 0 b 9 1c d d 0 9 1 3 9 y 2 1f 0 2 2 3 1 6 1 2 0 16 4 6 1 6l 7 2 1 3 9 fmt 0 ki f h f 4 1 p 2 5d 9 12 0 12 0 ig 0 6b 0 46 4 86 9 120 2 2 1 6 3 15 2 5 0 4m 1 fy 3 9 9 7 9 w 4 8u 1 26 5 1z a 1e 3 3f 2 1i e w a 3 1 b 3 1a a 8 0 1a 9 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 3 0 4e b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 1w 8 2 0 3 0 2 3 2 4 2 0 f 1 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f 5j 7 3t 9 1i 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 1j 9 7e 3 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 6h 0 3 0 8 1 6 0 d7 6 32 6 6 9 3o7 9 gvt3 6n");52}53function isInRange(cp, ranges) {54 let l = 0, r = (ranges.length / 2) | 0, i = 0, min = 0, max = 0;55 while (l < r) {56 i = ((l + r) / 2) | 0;57 min = ranges[2 * i];58 max = ranges[2 * i + 1];59 if (cp < min) {60 r = i;61 }62 else if (cp > max) {63 l = i + 1;64 }65 else {66 return true;67 }68 }69 return false;70}71function restoreRanges(data) {72 let last = 0;73 return data.split(" ").map((s) => (last += parseInt(s, 36) | 0));74}75 76class DataSet {77 constructor(raw2018, raw2019, raw2020, raw2021, raw2022, raw2023, raw2024, raw2025, raw2026) {78 this._raw2018 = raw2018;79 this._raw2019 = raw2019;80 this._raw2020 = raw2020;81 this._raw2021 = raw2021;82 this._raw2022 = raw2022;83 this._raw2023 = raw2023;84 this._raw2024 = raw2024;85 this._raw2025 = raw2025;86 this._raw2026 = raw2026;87 }88 get es2018() {89 var _a;90 return ((_a = this._set2018) !== null && _a !== void 0 ? _a : (this._set2018 = new Set(this._raw2018.split(" "))));91 }92 get es2019() {93 var _a;94 return ((_a = this._set2019) !== null && _a !== void 0 ? _a : (this._set2019 = new Set(this._raw2019.split(" "))));95 }96 get es2020() {97 var _a;98 return ((_a = this._set2020) !== null && _a !== void 0 ? _a : (this._set2020 = new Set(this._raw2020.split(" "))));99 }100 get es2021() {101 var _a;102 return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" "))));103 }104 get es2022() {105 var _a;106 return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" "))));107 }108 get es2023() {109 var _a;110 return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" "))));111 }112 get es2024() {113 var _a;114 return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" "))));115 }116 get es2025() {117 var _a;118 return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.split(" "))));119 }120 get es2026() {121 var _a;122 return ((_a = this._set2026) !== null && _a !== void 0 ? _a : (this._set2026 = new Set(this._raw2026.split(" "))));123 }124}125const gcNameSet = new Set(["General_Category", "gc"]);126const scNameSet = new Set(["Script", "Script_Extensions", "sc", "scx"]);127const gcValueSets = new DataSet("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct", "", "", "", "", "", "", "", "");128const scValueSets = new DataSet("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy", "Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo", "Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho", "Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", "", "", "");129const binPropertySets = new DataSet("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space", "Extended_Pictographic", "", "EBase EComp EMod EPres ExtPict", "", "", "", "", "");130const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", "", "");131function isValidUnicodeProperty(version, name, value) {132 if (gcNameSet.has(name)) {133 return version >= 2018 && gcValueSets.es2018.has(value);134 }135 if (scNameSet.has(name)) {136 return ((version >= 2018 && scValueSets.es2018.has(value)) ||137 (version >= 2019 && scValueSets.es2019.has(value)) ||138 (version >= 2020 && scValueSets.es2020.has(value)) ||139 (version >= 2021 && scValueSets.es2021.has(value)) ||140 (version >= 2022 && scValueSets.es2022.has(value)) ||141 (version >= 2023 && scValueSets.es2023.has(value)));142 }143 return false;144}145function isValidLoneUnicodeProperty(version, value) {146 return ((version >= 2018 && binPropertySets.es2018.has(value)) ||147 (version >= 2019 && binPropertySets.es2019.has(value)) ||148 (version >= 2021 && binPropertySets.es2021.has(value)));149}150function isValidLoneUnicodePropertyOfString(version, value) {151 return version >= 2024 && binPropertyOfStringsSets.es2024.has(value);152}153 154const BACKSPACE = 0x08;155const CHARACTER_TABULATION = 0x09;156const LINE_FEED = 0x0a;157const LINE_TABULATION = 0x0b;158const FORM_FEED = 0x0c;159const CARRIAGE_RETURN = 0x0d;160const EXCLAMATION_MARK = 0x21;161const NUMBER_SIGN = 0x23;162const DOLLAR_SIGN = 0x24;163const PERCENT_SIGN = 0x25;164const AMPERSAND = 0x26;165const LEFT_PARENTHESIS = 0x28;166const RIGHT_PARENTHESIS = 0x29;167const ASTERISK = 0x2a;168const PLUS_SIGN = 0x2b;169const COMMA = 0x2c;170const HYPHEN_MINUS = 0x2d;171const FULL_STOP = 0x2e;172const SOLIDUS = 0x2f;173const DIGIT_ZERO = 0x30;174const DIGIT_ONE = 0x31;175const DIGIT_SEVEN = 0x37;176const DIGIT_NINE = 0x39;177const COLON = 0x3a;178const SEMICOLON = 0x3b;179const LESS_THAN_SIGN = 0x3c;180const EQUALS_SIGN = 0x3d;181const GREATER_THAN_SIGN = 0x3e;182const QUESTION_MARK = 0x3f;183const COMMERCIAL_AT = 0x40;184const LATIN_CAPITAL_LETTER_A = 0x41;185const LATIN_CAPITAL_LETTER_B = 0x42;186const LATIN_CAPITAL_LETTER_D = 0x44;187const LATIN_CAPITAL_LETTER_F = 0x46;188const LATIN_CAPITAL_LETTER_P = 0x50;189const LATIN_CAPITAL_LETTER_S = 0x53;190const LATIN_CAPITAL_LETTER_W = 0x57;191const LATIN_CAPITAL_LETTER_Z = 0x5a;192const LOW_LINE = 0x5f;193const LATIN_SMALL_LETTER_A = 0x61;194const LATIN_SMALL_LETTER_B = 0x62;195const LATIN_SMALL_LETTER_C = 0x63;196const LATIN_SMALL_LETTER_D = 0x64;197const LATIN_SMALL_LETTER_F = 0x66;198const LATIN_SMALL_LETTER_G = 0x67;199const LATIN_SMALL_LETTER_I = 0x69;200const LATIN_SMALL_LETTER_K = 0x6b;201const LATIN_SMALL_LETTER_M = 0x6d;202const LATIN_SMALL_LETTER_N = 0x6e;203const LATIN_SMALL_LETTER_P = 0x70;204const LATIN_SMALL_LETTER_Q = 0x71;205const LATIN_SMALL_LETTER_R = 0x72;206const LATIN_SMALL_LETTER_S = 0x73;207const LATIN_SMALL_LETTER_T = 0x74;208const LATIN_SMALL_LETTER_U = 0x75;209const LATIN_SMALL_LETTER_V = 0x76;210const LATIN_SMALL_LETTER_W = 0x77;211const LATIN_SMALL_LETTER_X = 0x78;212const LATIN_SMALL_LETTER_Y = 0x79;213const LATIN_SMALL_LETTER_Z = 0x7a;214const LEFT_SQUARE_BRACKET = 0x5b;215const REVERSE_SOLIDUS = 0x5c;216const RIGHT_SQUARE_BRACKET = 0x5d;217const CIRCUMFLEX_ACCENT = 0x5e;218const GRAVE_ACCENT = 0x60;219const LEFT_CURLY_BRACKET = 0x7b;220const VERTICAL_LINE = 0x7c;221const RIGHT_CURLY_BRACKET = 0x7d;222const TILDE = 0x7e;223const ZERO_WIDTH_NON_JOINER = 0x200c;224const ZERO_WIDTH_JOINER = 0x200d;225const LINE_SEPARATOR = 0x2028;226const PARAGRAPH_SEPARATOR = 0x2029;227const MIN_CODE_POINT = 0x00;228const MAX_CODE_POINT = 0x10ffff;229function isLatinLetter(code) {230 return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) ||231 (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z));232}233function isDecimalDigit(code) {234 return code >= DIGIT_ZERO && code <= DIGIT_NINE;235}236function isOctalDigit(code) {237 return code >= DIGIT_ZERO && code <= DIGIT_SEVEN;238}239function isHexDigit(code) {240 return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) ||241 (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) ||242 (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F));243}244function isLineTerminator(code) {245 return (code === LINE_FEED ||246 code === CARRIAGE_RETURN ||247 code === LINE_SEPARATOR ||248 code === PARAGRAPH_SEPARATOR);249}250function isValidUnicode(code) {251 return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT;252}253function digitToInt(code) {254 if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) {255 return code - LATIN_SMALL_LETTER_A + 10;256 }257 if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) {258 return code - LATIN_CAPITAL_LETTER_A + 10;259 }260 return code - DIGIT_ZERO;261}262function isLeadSurrogate(code) {263 return code >= 0xd800 && code <= 0xdbff;264}265function isTrailSurrogate(code) {266 return code >= 0xdc00 && code <= 0xdfff;267}268function combineSurrogatePair(lead, trail) {269 return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000;270}271 272class GroupSpecifiersAsES2018 {273 constructor() {274 this.groupName = new Set();275 }276 clear() {277 this.groupName.clear();278 }279 isEmpty() {280 return !this.groupName.size;281 }282 hasInPattern(name) {283 return this.groupName.has(name);284 }285 hasInScope(name) {286 return this.hasInPattern(name);287 }288 addToScope(name) {289 this.groupName.add(name);290 }291 enterDisjunction() {292 }293 enterAlternative() {294 }295 leaveDisjunction() {296 }297}298class BranchID {299 constructor(parent, base) {300 this.parent = parent;301 this.base = base !== null && base !== void 0 ? base : this;302 }303 separatedFrom(other) {304 var _a, _b;305 if (this.base === other.base && this !== other) {306 return true;307 }308 if (other.parent && this.separatedFrom(other.parent)) {309 return true;310 }311 return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false;312 }313 child() {314 return new BranchID(this, null);315 }316 sibling() {317 return new BranchID(this.parent, this.base);318 }319}320class GroupSpecifiersAsES2025 {321 constructor() {322 this.branchID = new BranchID(null, null);323 this.groupNames = new Map();324 }325 clear() {326 this.branchID = new BranchID(null, null);327 this.groupNames.clear();328 }329 isEmpty() {330 return !this.groupNames.size;331 }332 enterDisjunction() {333 this.branchID = this.branchID.child();334 }335 enterAlternative(index) {336 if (index === 0) {337 return;338 }339 this.branchID = this.branchID.sibling();340 }341 leaveDisjunction() {342 this.branchID = this.branchID.parent;343 }344 hasInPattern(name) {345 return this.groupNames.has(name);346 }347 hasInScope(name) {348 const branches = this.groupNames.get(name);349 if (!branches) {350 return false;351 }352 for (const branch of branches) {353 if (!branch.separatedFrom(this.branchID)) {354 return true;355 }356 }357 return false;358 }359 addToScope(name) {360 const branches = this.groupNames.get(name);361 if (branches) {362 branches.push(this.branchID);363 return;364 }365 this.groupNames.set(name, [this.branchID]);366 }367}368 369const legacyImpl = {370 at(s, end, i) {371 return i < end ? s.charCodeAt(i) : -1;372 },373 width(c) {374 return 1;375 },376};377const unicodeImpl = {378 at(s, end, i) {379 return i < end ? s.codePointAt(i) : -1;380 },381 width(c) {382 return c > 0xffff ? 2 : 1;383 },384};385class Reader {386 constructor() {387 this._impl = legacyImpl;388 this._s = "";389 this._i = 0;390 this._end = 0;391 this._cp1 = -1;392 this._w1 = 1;393 this._cp2 = -1;394 this._w2 = 1;395 this._cp3 = -1;396 this._w3 = 1;397 this._cp4 = -1;398 }399 get source() {400 return this._s;401 }402 get index() {403 return this._i;404 }405 get currentCodePoint() {406 return this._cp1;407 }408 get nextCodePoint() {409 return this._cp2;410 }411 get nextCodePoint2() {412 return this._cp3;413 }414 get nextCodePoint3() {415 return this._cp4;416 }417 reset(source, start, end, uFlag) {418 this._impl = uFlag ? unicodeImpl : legacyImpl;419 this._s = source;420 this._end = end;421 this.rewind(start);422 }423 rewind(index) {424 const impl = this._impl;425 this._i = index;426 this._cp1 = impl.at(this._s, this._end, index);427 this._w1 = impl.width(this._cp1);428 this._cp2 = impl.at(this._s, this._end, index + this._w1);429 this._w2 = impl.width(this._cp2);430 this._cp3 = impl.at(this._s, this._end, index + this._w1 + this._w2);431 this._w3 = impl.width(this._cp3);432 this._cp4 = impl.at(this._s, this._end, index + this._w1 + this._w2 + this._w3);433 }434 advance() {435 if (this._cp1 !== -1) {436 const impl = this._impl;437 this._i += this._w1;438 this._cp1 = this._cp2;439 this._w1 = this._w2;440 this._cp2 = this._cp3;441 this._w2 = impl.width(this._cp2);442 this._cp3 = this._cp4;443 this._w3 = impl.width(this._cp3);444 this._cp4 = impl.at(this._s, this._end, this._i + this._w1 + this._w2 + this._w3);445 }446 }447 eat(cp) {448 if (this._cp1 === cp) {449 this.advance();450 return true;451 }452 return false;453 }454 eat2(cp1, cp2) {455 if (this._cp1 === cp1 && this._cp2 === cp2) {456 this.advance();457 this.advance();458 return true;459 }460 return false;461 }462 eat3(cp1, cp2, cp3) {463 if (this._cp1 === cp1 && this._cp2 === cp2 && this._cp3 === cp3) {464 this.advance();465 this.advance();466 this.advance();467 return true;468 }469 return false;470 }471}472 473class RegExpSyntaxError extends SyntaxError {474 constructor(message, index) {475 super(message);476 this.index = index;477 }478}479function newRegExpSyntaxError(srcCtx, flags, index, message) {480 let source = "";481 if (srcCtx.kind === "literal") {482 const literal = srcCtx.source.slice(srcCtx.start, srcCtx.end);483 if (literal) {484 source = `: ${literal}`;485 }486 }487 else if (srcCtx.kind === "pattern") {488 const pattern = srcCtx.source.slice(srcCtx.start, srcCtx.end);489 const flagsText = `${flags.unicode ? "u" : ""}${flags.unicodeSets ? "v" : ""}`;490 source = `: /${pattern}/${flagsText}`;491 }492 return new RegExpSyntaxError(`Invalid regular expression${source}: ${message}`, index);493}494 495const SYNTAX_CHARACTER = new Set([496 CIRCUMFLEX_ACCENT,497 DOLLAR_SIGN,498 REVERSE_SOLIDUS,499 FULL_STOP,500 ASTERISK,501 PLUS_SIGN,502 QUESTION_MARK,503 LEFT_PARENTHESIS,504 RIGHT_PARENTHESIS,505 LEFT_SQUARE_BRACKET,506 RIGHT_SQUARE_BRACKET,507 LEFT_CURLY_BRACKET,508 RIGHT_CURLY_BRACKET,509 VERTICAL_LINE,510]);511const CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER = new Set([512 AMPERSAND,513 EXCLAMATION_MARK,514 NUMBER_SIGN,515 DOLLAR_SIGN,516 PERCENT_SIGN,517 ASTERISK,518 PLUS_SIGN,519 COMMA,520 FULL_STOP,521 COLON,522 SEMICOLON,523 LESS_THAN_SIGN,524 EQUALS_SIGN,525 GREATER_THAN_SIGN,526 QUESTION_MARK,527 COMMERCIAL_AT,528 CIRCUMFLEX_ACCENT,529 GRAVE_ACCENT,530 TILDE,531]);532const CLASS_SET_SYNTAX_CHARACTER = new Set([533 LEFT_PARENTHESIS,534 RIGHT_PARENTHESIS,535 LEFT_SQUARE_BRACKET,536 RIGHT_SQUARE_BRACKET,537 LEFT_CURLY_BRACKET,538 RIGHT_CURLY_BRACKET,539 SOLIDUS,540 HYPHEN_MINUS,541 REVERSE_SOLIDUS,542 VERTICAL_LINE,543]);544const CLASS_SET_RESERVED_PUNCTUATOR = new Set([545 AMPERSAND,546 HYPHEN_MINUS,547 EXCLAMATION_MARK,548 NUMBER_SIGN,549 PERCENT_SIGN,550 COMMA,551 COLON,552 SEMICOLON,553 LESS_THAN_SIGN,554 EQUALS_SIGN,555 GREATER_THAN_SIGN,556 COMMERCIAL_AT,557 GRAVE_ACCENT,558 TILDE,559]);560const FLAG_PROP_TO_CODEPOINT = {561 global: LATIN_SMALL_LETTER_G,562 ignoreCase: LATIN_SMALL_LETTER_I,563 multiline: LATIN_SMALL_LETTER_M,564 unicode: LATIN_SMALL_LETTER_U,565 sticky: LATIN_SMALL_LETTER_Y,566 dotAll: LATIN_SMALL_LETTER_S,567 hasIndices: LATIN_SMALL_LETTER_D,568 unicodeSets: LATIN_SMALL_LETTER_V,569};570const FLAG_CODEPOINT_TO_PROP = Object.fromEntries(Object.entries(FLAG_PROP_TO_CODEPOINT).map(([k, v]) => [v, k]));571function isSyntaxCharacter(cp) {572 return SYNTAX_CHARACTER.has(cp);573}574function isClassSetReservedDoublePunctuatorCharacter(cp) {575 return CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER.has(cp);576}577function isClassSetSyntaxCharacter(cp) {578 return CLASS_SET_SYNTAX_CHARACTER.has(cp);579}580function isClassSetReservedPunctuator(cp) {581 return CLASS_SET_RESERVED_PUNCTUATOR.has(cp);582}583function isIdentifierStartChar(cp) {584 return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE;585}586function isIdentifierPartChar(cp) {587 return (isIdContinue(cp) ||588 cp === DOLLAR_SIGN ||589 cp === ZERO_WIDTH_NON_JOINER ||590 cp === ZERO_WIDTH_JOINER);591}592function isUnicodePropertyNameCharacter(cp) {593 return isLatinLetter(cp) || cp === LOW_LINE;594}595function isUnicodePropertyValueCharacter(cp) {596 return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp);597}598function isRegularExpressionModifier(ch) {599 return (ch === LATIN_SMALL_LETTER_I ||600 ch === LATIN_SMALL_LETTER_M ||601 ch === LATIN_SMALL_LETTER_S);602}603class RegExpValidator {604 constructor(options) {605 this._reader = new Reader();606 this._unicodeMode = false;607 this._unicodeSetsMode = false;608 this._nFlag = false;609 this._lastIntValue = 0;610 this._lastRange = {611 min: 0,612 max: Number.POSITIVE_INFINITY,613 };614 this._lastStrValue = "";615 this._lastAssertionIsQuantifiable = false;616 this._numCapturingParens = 0;617 this._backreferenceNames = new Set();618 this._srcCtx = null;619 this._options = options !== null && options !== void 0 ? options : {};620 this._groupSpecifiers =621 this.ecmaVersion >= 2025622 ? new GroupSpecifiersAsES2025()623 : new GroupSpecifiersAsES2018();624 }625 validateLiteral(source, start = 0, end = source.length) {626 this._srcCtx = { source, start, end, kind: "literal" };627 this._unicodeSetsMode = this._unicodeMode = this._nFlag = false;628 this.reset(source, start, end);629 this.onLiteralEnter(start);630 if (this.eat(SOLIDUS) && this.eatRegExpBody() && this.eat(SOLIDUS)) {631 const flagStart = this.index;632 const unicode = source.includes("u", flagStart);633 const unicodeSets = source.includes("v", flagStart);634 this.validateFlagsInternal(source, flagStart, end);635 this.validatePatternInternal(source, start + 1, flagStart - 1, {636 unicode,637 unicodeSets,638 });639 }640 else if (start >= end) {641 this.raise("Empty");642 }643 else {644 const c = String.fromCodePoint(this.currentCodePoint);645 this.raise(`Unexpected character '${c}'`);646 }647 this.onLiteralLeave(start, end);648 }649 validateFlags(source, start = 0, end = source.length) {650 this._srcCtx = { source, start, end, kind: "flags" };651 this.validateFlagsInternal(source, start, end);652 }653 validatePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) {654 this._srcCtx = { source, start, end, kind: "pattern" };655 this.validatePatternInternal(source, start, end, uFlagOrFlags);656 }657 validatePatternInternal(source, start = 0, end = source.length, uFlagOrFlags = undefined) {658 const mode = this._parseFlagsOptionToMode(uFlagOrFlags, end);659 this._unicodeMode = mode.unicodeMode;660 this._nFlag = mode.nFlag;661 this._unicodeSetsMode = mode.unicodeSetsMode;662 this.reset(source, start, end);663 this.consumePattern();664 if (!this._nFlag &&665 this.ecmaVersion >= 2018 &&666 !this._groupSpecifiers.isEmpty()) {667 this._nFlag = true;668 this.rewind(start);669 this.consumePattern();670 }671 }672 validateFlagsInternal(source, start, end) {673 const flags = this.parseFlags(source, start, end);674 this.onRegExpFlags(start, end, flags);675 }676 _parseFlagsOptionToMode(uFlagOrFlags, sourceEnd) {677 let unicode = false;678 let unicodeSets = false;679 if (uFlagOrFlags && this.ecmaVersion >= 2015) {680 if (typeof uFlagOrFlags === "object") {681 unicode = Boolean(uFlagOrFlags.unicode);682 if (this.ecmaVersion >= 2024) {683 unicodeSets = Boolean(uFlagOrFlags.unicodeSets);684 }685 }686 else {687 unicode = uFlagOrFlags;688 }689 }690 if (unicode && unicodeSets) {691 this.raise("Invalid regular expression flags", {692 index: sourceEnd + 1,693 unicode,694 unicodeSets,695 });696 }697 const unicodeMode = unicode || unicodeSets;698 const nFlag = (unicode && this.ecmaVersion >= 2018) ||699 unicodeSets ||700 Boolean(this._options.strict && this.ecmaVersion >= 2023);701 const unicodeSetsMode = unicodeSets;702 return { unicodeMode, nFlag, unicodeSetsMode };703 }704 get strict() {705 return Boolean(this._options.strict) || this._unicodeMode;706 }707 get ecmaVersion() {708 var _a;709 return (_a = this._options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion;710 }711 onLiteralEnter(start) {712 if (this._options.onLiteralEnter) {713 this._options.onLiteralEnter(start);714 }715 }716 onLiteralLeave(start, end) {717 if (this._options.onLiteralLeave) {718 this._options.onLiteralLeave(start, end);719 }720 }721 onRegExpFlags(start, end, flags) {722 if (this._options.onRegExpFlags) {723 this._options.onRegExpFlags(start, end, flags);724 }725 if (this._options.onFlags) {726 this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.hasIndices);727 }728 }729 onPatternEnter(start) {730 if (this._options.onPatternEnter) {731 this._options.onPatternEnter(start);732 }733 }734 onPatternLeave(start, end) {735 if (this._options.onPatternLeave) {736 this._options.onPatternLeave(start, end);737 }738 }739 onDisjunctionEnter(start) {740 if (this._options.onDisjunctionEnter) {741 this._options.onDisjunctionEnter(start);742 }743 }744 onDisjunctionLeave(start, end) {745 if (this._options.onDisjunctionLeave) {746 this._options.onDisjunctionLeave(start, end);747 }748 }749 onAlternativeEnter(start, index) {750 if (this._options.onAlternativeEnter) {751 this._options.onAlternativeEnter(start, index);752 }753 }754 onAlternativeLeave(start, end, index) {755 if (this._options.onAlternativeLeave) {756 this._options.onAlternativeLeave(start, end, index);757 }758 }759 onGroupEnter(start) {760 if (this._options.onGroupEnter) {761 this._options.onGroupEnter(start);762 }763 }764 onGroupLeave(start, end) {765 if (this._options.onGroupLeave) {766 this._options.onGroupLeave(start, end);767 }768 }769 onModifiersEnter(start) {770 if (this._options.onModifiersEnter) {771 this._options.onModifiersEnter(start);772 }773 }774 onModifiersLeave(start, end) {775 if (this._options.onModifiersLeave) {776 this._options.onModifiersLeave(start, end);777 }778 }779 onAddModifiers(start, end, flags) {780 if (this._options.onAddModifiers) {781 this._options.onAddModifiers(start, end, flags);782 }783 }784 onRemoveModifiers(start, end, flags) {785 if (this._options.onRemoveModifiers) {786 this._options.onRemoveModifiers(start, end, flags);787 }788 }789 onCapturingGroupEnter(start, name) {790 if (this._options.onCapturingGroupEnter) {791 this._options.onCapturingGroupEnter(start, name);792 }793 }794 onCapturingGroupLeave(start, end, name) {795 if (this._options.onCapturingGroupLeave) {796 this._options.onCapturingGroupLeave(start, end, name);797 }798 }799 onQuantifier(start, end, min, max, greedy) {800 if (this._options.onQuantifier) {801 this._options.onQuantifier(start, end, min, max, greedy);802 }803 }804 onLookaroundAssertionEnter(start, kind, negate) {805 if (this._options.onLookaroundAssertionEnter) {806 this._options.onLookaroundAssertionEnter(start, kind, negate);807 }808 }809 onLookaroundAssertionLeave(start, end, kind, negate) {810 if (this._options.onLookaroundAssertionLeave) {811 this._options.onLookaroundAssertionLeave(start, end, kind, negate);812 }813 }814 onEdgeAssertion(start, end, kind) {815 if (this._options.onEdgeAssertion) {816 this._options.onEdgeAssertion(start, end, kind);817 }818 }819 onWordBoundaryAssertion(start, end, kind, negate) {820 if (this._options.onWordBoundaryAssertion) {821 this._options.onWordBoundaryAssertion(start, end, kind, negate);822 }823 }824 onAnyCharacterSet(start, end, kind) {825 if (this._options.onAnyCharacterSet) {826 this._options.onAnyCharacterSet(start, end, kind);827 }828 }829 onEscapeCharacterSet(start, end, kind, negate) {830 if (this._options.onEscapeCharacterSet) {831 this._options.onEscapeCharacterSet(start, end, kind, negate);832 }833 }834 onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings) {835 if (this._options.onUnicodePropertyCharacterSet) {836 this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings);837 }838 }839 onCharacter(start, end, value) {840 if (this._options.onCharacter) {841 this._options.onCharacter(start, end, value);842 }843 }844 onBackreference(start, end, ref) {845 if (this._options.onBackreference) {846 this._options.onBackreference(start, end, ref);847 }848 }849 onCharacterClassEnter(start, negate, unicodeSets) {850 if (this._options.onCharacterClassEnter) {851 this._options.onCharacterClassEnter(start, negate, unicodeSets);852 }853 }854 onCharacterClassLeave(start, end, negate) {855 if (this._options.onCharacterClassLeave) {856 this._options.onCharacterClassLeave(start, end, negate);857 }858 }859 onCharacterClassRange(start, end, min, max) {860 if (this._options.onCharacterClassRange) {861 this._options.onCharacterClassRange(start, end, min, max);862 }863 }864 onClassIntersection(start, end) {865 if (this._options.onClassIntersection) {866 this._options.onClassIntersection(start, end);867 }868 }869 onClassSubtraction(start, end) {870 if (this._options.onClassSubtraction) {871 this._options.onClassSubtraction(start, end);872 }873 }874 onClassStringDisjunctionEnter(start) {875 if (this._options.onClassStringDisjunctionEnter) {876 this._options.onClassStringDisjunctionEnter(start);877 }878 }879 onClassStringDisjunctionLeave(start, end) {880 if (this._options.onClassStringDisjunctionLeave) {881 this._options.onClassStringDisjunctionLeave(start, end);882 }883 }884 onStringAlternativeEnter(start, index) {885 if (this._options.onStringAlternativeEnter) {886 this._options.onStringAlternativeEnter(start, index);887 }888 }889 onStringAlternativeLeave(start, end, index) {890 if (this._options.onStringAlternativeLeave) {891 this._options.onStringAlternativeLeave(start, end, index);892 }893 }894 get index() {895 return this._reader.index;896 }897 get currentCodePoint() {898 return this._reader.currentCodePoint;899 }900 get nextCodePoint() {901 return this._reader.nextCodePoint;902 }903 get nextCodePoint2() {904 return this._reader.nextCodePoint2;905 }906 get nextCodePoint3() {907 return this._reader.nextCodePoint3;908 }909 reset(source, start, end) {910 this._reader.reset(source, start, end, this._unicodeMode);911 }912 rewind(index) {913 this._reader.rewind(index);914 }915 advance() {916 this._reader.advance();917 }918 eat(cp) {919 return this._reader.eat(cp);920 }921 eat2(cp1, cp2) {922 return this._reader.eat2(cp1, cp2);923 }924 eat3(cp1, cp2, cp3) {925 return this._reader.eat3(cp1, cp2, cp3);926 }927 raise(message, context) {928 var _a, _b, _c;929 throw newRegExpSyntaxError(this._srcCtx, {930 unicode: (_a = context === null || context === void 0 ? void 0 : context.unicode) !== null && _a !== void 0 ? _a : (this._unicodeMode && !this._unicodeSetsMode),931 unicodeSets: (_b = context === null || context === void 0 ? void 0 : context.unicodeSets) !== null && _b !== void 0 ? _b : this._unicodeSetsMode,932 }, (_c = context === null || context === void 0 ? void 0 : context.index) !== null && _c !== void 0 ? _c : this.index, message);933 }934 eatRegExpBody() {935 const start = this.index;936 let inClass = false;937 let escaped = false;938 for (;;) {939 const cp = this.currentCodePoint;940 if (cp === -1 || isLineTerminator(cp)) {941 const kind = inClass ? "character class" : "regular expression";942 this.raise(`Unterminated ${kind}`);943 }944 if (escaped) {945 escaped = false;946 }947 else if (cp === REVERSE_SOLIDUS) {948 escaped = true;949 }950 else if (cp === LEFT_SQUARE_BRACKET) {951 inClass = true;952 }953 else if (cp === RIGHT_SQUARE_BRACKET) {954 inClass = false;955 }956 else if ((cp === SOLIDUS && !inClass) ||957 (cp === ASTERISK && this.index === start)) {958 break;959 }960 this.advance();961 }962 return this.index !== start;963 }964 consumePattern() {965 const start = this.index;966 this._numCapturingParens = this.countCapturingParens();967 this._groupSpecifiers.clear();968 this._backreferenceNames.clear();969 this.onPatternEnter(start);970 this.consumeDisjunction();971 const cp = this.currentCodePoint;972 if (this.currentCodePoint !== -1) {973 if (cp === RIGHT_PARENTHESIS) {974 this.raise("Unmatched ')'");975 }976 if (cp === REVERSE_SOLIDUS) {977 this.raise("\\ at end of pattern");978 }979 if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) {980 this.raise("Lone quantifier brackets");981 }982 const c = String.fromCodePoint(cp);983 this.raise(`Unexpected character '${c}'`);984 }985 for (const name of this._backreferenceNames) {986 if (!this._groupSpecifiers.hasInPattern(name)) {987 this.raise("Invalid named capture referenced");988 }989 }990 this.onPatternLeave(start, this.index);991 }992 countCapturingParens() {993 const start = this.index;994 let inClass = false;995 let escaped = false;996 let count = 0;997 let cp = 0;998 while ((cp = this.currentCodePoint) !== -1) {999 if (escaped) {1000 escaped = false;1001 }1002 else if (cp === REVERSE_SOLIDUS) {1003 escaped = true;1004 }1005 else if (cp === LEFT_SQUARE_BRACKET) {1006 inClass = true;1007 }1008 else if (cp === RIGHT_SQUARE_BRACKET) {1009 inClass = false;1010 }1011 else if (cp === LEFT_PARENTHESIS &&1012 !inClass &&1013 (this.nextCodePoint !== QUESTION_MARK ||1014 (this.nextCodePoint2 === LESS_THAN_SIGN &&1015 this.nextCodePoint3 !== EQUALS_SIGN &&1016 this.nextCodePoint3 !== EXCLAMATION_MARK))) {1017 count += 1;1018 }1019 this.advance();1020 }1021 this.rewind(start);1022 return count;1023 }1024 consumeDisjunction() {1025 const start = this.index;1026 let i = 0;1027 this._groupSpecifiers.enterDisjunction();1028 this.onDisjunctionEnter(start);1029 do {1030 this.consumeAlternative(i++);1031 } while (this.eat(VERTICAL_LINE));1032 if (this.consumeQuantifier(true)) {1033 this.raise("Nothing to repeat");1034 }1035 if (this.eat(LEFT_CURLY_BRACKET)) {1036 this.raise("Lone quantifier brackets");1037 }1038 this.onDisjunctionLeave(start, this.index);1039 this._groupSpecifiers.leaveDisjunction();1040 }1041 consumeAlternative(i) {1042 const start = this.index;1043 this._groupSpecifiers.enterAlternative(i);1044 this.onAlternativeEnter(start, i);1045 while (this.currentCodePoint !== -1 && this.consumeTerm()) {1046 }1047 this.onAlternativeLeave(start, this.index, i);1048 }1049 consumeTerm() {1050 if (this._unicodeMode || this.strict) {1051 return (this.consumeAssertion() ||1052 (this.consumeAtom() && this.consumeOptionalQuantifier()));1053 }1054 return ((this.consumeAssertion() &&1055 (!this._lastAssertionIsQuantifiable ||1056 this.consumeOptionalQuantifier())) ||1057 (this.consumeExtendedAtom() && this.consumeOptionalQuantifier()));1058 }1059 consumeOptionalQuantifier() {1060 this.consumeQuantifier();1061 return true;1062 }1063 consumeAssertion() {1064 const start = this.index;1065 this._lastAssertionIsQuantifiable = false;1066 if (this.eat(CIRCUMFLEX_ACCENT)) {1067 this.onEdgeAssertion(start, this.index, "start");1068 return true;1069 }1070 if (this.eat(DOLLAR_SIGN)) {1071 this.onEdgeAssertion(start, this.index, "end");1072 return true;1073 }1074 if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) {1075 this.onWordBoundaryAssertion(start, this.index, "word", true);1076 return true;1077 }1078 if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) {1079 this.onWordBoundaryAssertion(start, this.index, "word", false);1080 return true;1081 }1082 if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) {1083 const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN);1084 let negate = false;1085 if (this.eat(EQUALS_SIGN) ||1086 (negate = this.eat(EXCLAMATION_MARK))) {1087 const kind = lookbehind ? "lookbehind" : "lookahead";1088 this.onLookaroundAssertionEnter(start, kind, negate);1089 this.consumeDisjunction();1090 if (!this.eat(RIGHT_PARENTHESIS)) {1091 this.raise("Unterminated group");1092 }1093 this._lastAssertionIsQuantifiable = !lookbehind && !this.strict;1094 this.onLookaroundAssertionLeave(start, this.index, kind, negate);1095 return true;1096 }1097 this.rewind(start);1098 }1099 return false;1100 }1101 consumeQuantifier(noConsume = false) {1102 const start = this.index;1103 let min = 0;1104 let max = 0;1105 let greedy = false;1106 if (this.eat(ASTERISK)) {1107 min = 0;1108 max = Number.POSITIVE_INFINITY;1109 }1110 else if (this.eat(PLUS_SIGN)) {1111 min = 1;1112 max = Number.POSITIVE_INFINITY;1113 }1114 else if (this.eat(QUESTION_MARK)) {1115 min = 0;1116 max = 1;1117 }1118 else if (this.eatBracedQuantifier(noConsume)) {1119 ({ min, max } = this._lastRange);1120 }1121 else {1122 return false;1123 }1124 greedy = !this.eat(QUESTION_MARK);1125 if (!noConsume) {1126 this.onQuantifier(start, this.index, min, max, greedy);1127 }1128 return true;1129 }1130 eatBracedQuantifier(noError) {1131 const start = this.index;1132 if (this.eat(LEFT_CURLY_BRACKET)) {1133 if (this.eatDecimalDigits()) {1134 const min = this._lastIntValue;1135 let max = min;1136 if (this.eat(COMMA)) {1137 max = this.eatDecimalDigits()1138 ? this._lastIntValue1139 : Number.POSITIVE_INFINITY;1140 }1141 if (this.eat(RIGHT_CURLY_BRACKET)) {1142 if (!noError && max < min) {1143 this.raise("numbers out of order in {} quantifier");1144 }1145 this._lastRange = { min, max };1146 return true;1147 }1148 }1149 if (!noError && (this._unicodeMode || this.strict)) {1150 this.raise("Incomplete quantifier");1151 }1152 this.rewind(start);1153 }1154 return false;1155 }1156 consumeAtom() {1157 return (this.consumePatternCharacter() ||1158 this.consumeDot() ||1159 this.consumeReverseSolidusAtomEscape() ||1160 Boolean(this.consumeCharacterClass()) ||1161 this.consumeCapturingGroup() ||1162 this.consumeUncapturingGroup());1163 }1164 consumeDot() {1165 if (this.eat(FULL_STOP)) {1166 this.onAnyCharacterSet(this.index - 1, this.index, "any");1167 return true;1168 }1169 return false;1170 }1171 consumeReverseSolidusAtomEscape() {1172 const start = this.index;1173 if (this.eat(REVERSE_SOLIDUS)) {1174 if (this.consumeAtomEscape()) {1175 return true;1176 }1177 this.rewind(start);1178 }1179 return false;1180 }1181 consumeUncapturingGroup() {1182 const start = this.index;1183 if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) {1184 this.onGroupEnter(start);1185 if (this.ecmaVersion >= 2025) {1186 this.consumeModifiers();1187 }1188 if (!this.eat(COLON)) {1189 this.rewind(start + 1);1190 this.raise("Invalid group");1191 }1192 this.consumeDisjunction();1193 if (!this.eat(RIGHT_PARENTHESIS)) {1194 this.raise("Unterminated group");1195 }1196 this.onGroupLeave(start, this.index);1197 return true;1198 }1199 return false;1200 }