@verbb/plugin-kit-web 2.0.5 → 2.0.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.0.6 - 2026-07-21
6
+
7
+ ### Changed
8
+ - Released alongside the other `@verbb/plugin-kit-*` packages to keep versions aligned.
9
+
5
10
  ## 2.0.5 - 2026-07-21
6
11
 
7
12
  ### Added
@@ -829,10 +829,20 @@ getDecoder(decode_data_xml_default);
829
829
  function decodeHTML(str, mode = DecodingMode.Legacy) {
830
830
  return htmlDecoder(str, mode);
831
831
  }
832
+ /**
833
+ * Decodes an HTML string, requiring all entities to be terminated by a semicolon.
834
+ *
835
+ * @param str The string to decode.
836
+ * @returns The decoded string.
837
+ */
838
+ function decodeHTMLStrict(str) {
839
+ return htmlDecoder(str, DecodingMode.Strict);
840
+ }
832
841
  //#endregion
833
842
  //#region ../node_modules/markdown-it/lib/common/utils.mjs
834
843
  var utils_exports = /* @__PURE__ */ __exportAll({
835
844
  arrayReplaceAt: () => arrayReplaceAt,
845
+ asciiTrim: () => asciiTrim,
836
846
  assign: () => assign$1,
837
847
  escapeHtml: () => escapeHtml,
838
848
  escapeRE: () => escapeRE$1,
@@ -840,6 +850,7 @@ var utils_exports = /* @__PURE__ */ __exportAll({
840
850
  has: () => has,
841
851
  isMdAsciiPunct: () => isMdAsciiPunct,
842
852
  isPunctChar: () => isPunctChar,
853
+ isPunctCharCode: () => isPunctCharCode,
843
854
  isSpace: () => isSpace,
844
855
  isString: () => isString$1,
845
856
  isValidEntityCode: () => isValidEntityCode,
@@ -962,6 +973,9 @@ function isWhiteSpace(code) {
962
973
  function isPunctChar(ch) {
963
974
  return regex_default$2.test(ch) || regex_default$1.test(ch);
964
975
  }
976
+ function isPunctCharCode(code) {
977
+ return isPunctChar(fromCodePoint(code));
978
+ }
965
979
  function isMdAsciiPunct(ch) {
966
980
  switch (ch) {
967
981
  case 33:
@@ -1001,9 +1015,21 @@ function isMdAsciiPunct(ch) {
1001
1015
  }
1002
1016
  function normalizeReference(str) {
1003
1017
  str = str.trim().replace(/\s+/g, " ");
1004
- if ("ẞ".toLowerCase() === "Ṿ") str = str.replace(/ẞ/g, "ß");
1018
+ if ("ẞ".toLowerCase() === "Ṿ")
1019
+ /* c8 ignore next 2 */
1020
+ str = str.replace(/ẞ/g, "ß");
1005
1021
  return str.toLowerCase().toUpperCase();
1006
1022
  }
1023
+ function isAsciiTrimmable(c) {
1024
+ return c === 32 || c === 9 || c === 10 || c === 13;
1025
+ }
1026
+ function asciiTrim(str) {
1027
+ let start = 0;
1028
+ for (; start < str.length; start++) if (!isAsciiTrimmable(str.charCodeAt(start))) break;
1029
+ let end = str.length - 1;
1030
+ for (; end >= start; end--) if (!isAsciiTrimmable(str.charCodeAt(end))) break;
1031
+ return str.slice(start, end + 1);
1032
+ }
1007
1033
  var lib = {
1008
1034
  mdurl: mdurl_exports,
1009
1035
  ucmicro: uc_micro_exports
@@ -1946,21 +1972,37 @@ function replace(state) {
1946
1972
  var QUOTE_TEST_RE = /['"]/;
1947
1973
  var QUOTE_RE = /['"]/g;
1948
1974
  var APOSTROPHE = "’";
1949
- function replaceAt(str, index, ch) {
1950
- return str.slice(0, index) + ch + str.slice(index + 1);
1975
+ function addReplacement(replacements, tokenIdx, pos, ch) {
1976
+ if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
1977
+ replacements[tokenIdx].push({
1978
+ pos,
1979
+ ch
1980
+ });
1981
+ }
1982
+ function applyReplacements(str, replacements) {
1983
+ let result = "";
1984
+ let lastPos = 0;
1985
+ replacements.sort((a, b) => a.pos - b.pos);
1986
+ for (let i = 0; i < replacements.length; i++) {
1987
+ const replacement = replacements[i];
1988
+ result += str.slice(lastPos, replacement.pos) + replacement.ch;
1989
+ lastPos = replacement.pos + 1;
1990
+ }
1991
+ return result + str.slice(lastPos);
1951
1992
  }
1952
1993
  function process_inlines(tokens, state) {
1953
1994
  let j;
1954
1995
  const stack = [];
1996
+ const replacements = {};
1955
1997
  for (let i = 0; i < tokens.length; i++) {
1956
1998
  const token = tokens[i];
1957
1999
  const thisLevel = tokens[i].level;
1958
2000
  for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
1959
2001
  stack.length = j + 1;
1960
2002
  if (token.type !== "text") continue;
1961
- let text = token.content;
2003
+ const text = token.content;
1962
2004
  let pos = 0;
1963
- let max = text.length;
2005
+ const max = text.length;
1964
2006
  OUTER: while (pos < max) {
1965
2007
  QUOTE_RE.lastIndex = pos;
1966
2008
  const t = QUOTE_RE.exec(text);
@@ -1985,8 +2027,8 @@ function process_inlines(tokens, state) {
1985
2027
  nextChar = tokens[j].content.charCodeAt(0);
1986
2028
  break;
1987
2029
  }
1988
- const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
1989
- const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
2030
+ const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
2031
+ const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
1990
2032
  const isLastWhiteSpace = isWhiteSpace(lastChar);
1991
2033
  const isNextWhiteSpace = isWhiteSpace(nextChar);
1992
2034
  if (isNextWhiteSpace) canOpen = false;
@@ -2005,7 +2047,7 @@ function process_inlines(tokens, state) {
2005
2047
  canClose = isNextPunctChar;
2006
2048
  }
2007
2049
  if (!canOpen && !canClose) {
2008
- if (isSingle) token.content = replaceAt(token.content, t.index, APOSTROPHE);
2050
+ if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
2009
2051
  continue;
2010
2052
  }
2011
2053
  if (canClose) for (j = stack.length - 1; j >= 0; j--) {
@@ -2022,12 +2064,8 @@ function process_inlines(tokens, state) {
2022
2064
  openQuote = state.md.options.quotes[0];
2023
2065
  closeQuote = state.md.options.quotes[1];
2024
2066
  }
2025
- token.content = replaceAt(token.content, t.index, closeQuote);
2026
- tokens[item.token].content = replaceAt(tokens[item.token].content, item.pos, openQuote);
2027
- pos += closeQuote.length - 1;
2028
- if (item.token === i) pos += openQuote.length - 1;
2029
- text = token.content;
2030
- max = text.length;
2067
+ addReplacement(replacements, i, t.index, closeQuote);
2068
+ addReplacement(replacements, item.token, item.pos, openQuote);
2031
2069
  stack.length = j;
2032
2070
  continue OUTER;
2033
2071
  }
@@ -2038,9 +2076,12 @@ function process_inlines(tokens, state) {
2038
2076
  single: isSingle,
2039
2077
  level: thisLevel
2040
2078
  });
2041
- else if (canClose && isSingle) token.content = replaceAt(token.content, t.index, APOSTROPHE);
2079
+ else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
2042
2080
  }
2043
2081
  }
2082
+ Object.keys(replacements).forEach(function(tokenIdx) {
2083
+ tokens[tokenIdx].content = applyReplacements(tokens[tokenIdx].content, replacements[tokenIdx]);
2084
+ });
2044
2085
  }
2045
2086
  function smartquotes(state) {
2046
2087
  if (!state.md.options.typographer) return;
@@ -2954,8 +2995,11 @@ function html_block(state, startLine, endLine, silent) {
2954
2995
  if (i === HTML_SEQUENCES.length) return false;
2955
2996
  if (silent) return HTML_SEQUENCES[i][2];
2956
2997
  let nextLine = startLine + 1;
2998
+ const endsOnBlankLine = HTML_SEQUENCES[i][1].test("");
2957
2999
  if (!HTML_SEQUENCES[i][1].test(lineText)) for (; nextLine < endLine; nextLine++) {
2958
- if (state.sCount[nextLine] < state.blkIndent) break;
3000
+ if (state.sCount[nextLine] < state.blkIndent) {
3001
+ if (endsOnBlankLine || !state.isEmpty(nextLine)) break;
3002
+ }
2959
3003
  pos = state.bMarks[nextLine] + state.tShift[nextLine];
2960
3004
  max = state.eMarks[nextLine];
2961
3005
  lineText = state.src.slice(pos, max);
@@ -2994,7 +3038,7 @@ function heading(state, startLine, endLine, silent) {
2994
3038
  token_o.markup = "########".slice(0, level);
2995
3039
  token_o.map = [startLine, state.line];
2996
3040
  const token_i = state.push("inline", "", 0);
2997
- token_i.content = state.src.slice(pos, max).trim();
3041
+ token_i.content = asciiTrim(state.src.slice(pos, max));
2998
3042
  token_i.map = [startLine, state.line];
2999
3043
  token_i.children = [];
3000
3044
  const token_c = state.push("heading_close", "h" + String(level), -1);
@@ -3036,8 +3080,11 @@ function lheading(state, startLine, endLine) {
3036
3080
  }
3037
3081
  if (terminate) break;
3038
3082
  }
3039
- if (!level) return false;
3040
- const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
3083
+ if (!level) {
3084
+ state.parentType = oldParentType;
3085
+ return false;
3086
+ }
3087
+ const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
3041
3088
  state.line = nextLine + 1;
3042
3089
  const token_o = state.push("heading_open", "h" + String(level), 1);
3043
3090
  token_o.markup = String.fromCharCode(marker);
@@ -3068,7 +3115,7 @@ function paragraph(state, startLine, endLine) {
3068
3115
  }
3069
3116
  if (terminate) break;
3070
3117
  }
3071
- const content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
3118
+ const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
3072
3119
  state.line = nextLine;
3073
3120
  const token_o = state.push("paragraph_open", "p", 1);
3074
3121
  token_o.map = [startLine, state.line];
@@ -3263,13 +3310,28 @@ StateInline.prototype.push = function(type, tag, nesting) {
3263
3310
  StateInline.prototype.scanDelims = function(start, canSplitWord) {
3264
3311
  const max = this.posMax;
3265
3312
  const marker = this.src.charCodeAt(start);
3266
- const lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 32;
3313
+ let lastChar;
3314
+ if (start === 0) lastChar = 32;
3315
+ else if (start === 1) {
3316
+ lastChar = this.src.charCodeAt(0);
3317
+ if ((lastChar & 63488) === 55296) lastChar = 65533;
3318
+ } else {
3319
+ lastChar = this.src.charCodeAt(start - 1);
3320
+ if ((lastChar & 64512) === 56320) {
3321
+ const highSurr = this.src.charCodeAt(start - 2);
3322
+ lastChar = (highSurr & 64512) === 55296 ? 65536 + (highSurr - 55296 << 10) + (lastChar - 56320) : 65533;
3323
+ } else if ((lastChar & 64512) === 55296) lastChar = 65533;
3324
+ }
3267
3325
  let pos = start;
3268
3326
  while (pos < max && this.src.charCodeAt(pos) === marker) pos++;
3269
3327
  const count = pos - start;
3270
- const nextChar = pos < max ? this.src.charCodeAt(pos) : 32;
3271
- const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
3272
- const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
3328
+ let nextChar = pos < max ? this.src.charCodeAt(pos) : 32;
3329
+ if ((nextChar & 64512) === 55296) {
3330
+ const lowSurr = this.src.charCodeAt(pos + 1);
3331
+ nextChar = (lowSurr & 64512) === 56320 ? 65536 + (nextChar - 55296 << 10) + (lowSurr - 56320) : 65533;
3332
+ } else if ((nextChar & 64512) === 56320) nextChar = 65533;
3333
+ const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
3334
+ const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
3273
3335
  const isLastWhiteSpace = isWhiteSpace(lastChar);
3274
3336
  const isNextWhiteSpace = isWhiteSpace(nextChar);
3275
3337
  const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
@@ -3405,6 +3467,16 @@ function escape(state, silent) {
3405
3467
  state.pos = pos;
3406
3468
  return true;
3407
3469
  }
3470
+ if (ch1 === 32) {
3471
+ if (!silent) {
3472
+ const token = state.push("text_special", "", 0);
3473
+ token.content = "\\";
3474
+ token.markup = "\\";
3475
+ token.info = "escape";
3476
+ }
3477
+ state.pos = pos;
3478
+ return true;
3479
+ }
3408
3480
  let escapedStr = state.src[pos];
3409
3481
  if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max) {
3410
3482
  const ch2 = state.src.charCodeAt(pos + 1);
@@ -3865,7 +3937,7 @@ function entity(state, silent) {
3865
3937
  } else {
3866
3938
  const match = state.src.slice(pos).match(NAMED_RE);
3867
3939
  if (match) {
3868
- const decoded = decodeHTML(match[0]);
3940
+ const decoded = decodeHTMLStrict(match[0]);
3869
3941
  if (decoded !== match[0]) {
3870
3942
  if (!silent) {
3871
3943
  const token = state.push("text_special", "", 0);
@@ -4081,28 +4153,28 @@ function re_default(opts) {
4081
4153
  ].join("|");
4082
4154
  re.src_ZCc = [re.src_Z, re.src_Cc].join("|");
4083
4155
  const text_separators = "[><|]";
4084
- re.src_pseudo_letter = "(?:(?!" + text_separators + "|" + re.src_ZPCc + ")" + re.src_Any + ")";
4156
+ re.src_pseudo_letter = `(?:(?!${text_separators}|${re.src_ZPCc})${re.src_Any})`;
4085
4157
  re.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
4086
- re.src_auth = "(?:(?:(?!" + re.src_ZCc + "|[@/\\[\\]()]).)+@)?";
4158
+ re.src_auth = `(?:(?:(?!${re.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`;
4087
4159
  re.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?";
4088
- re.src_host_terminator = "(?=$|" + text_separators + "|" + re.src_ZPCc + ")(?!" + (opts["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + re.src_ZPCc + "))";
4089
- re.src_path = "(?:[/?#](?:(?!" + re.src_ZCc + "|[><|]|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!" + re.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + re.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + re.src_ZCc + "|[}]).)*\\}|\\\"(?:(?!" + re.src_ZCc + "|[\"]).)+\\\"|\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|\\'(?=" + re.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + re.src_ZCc + "|[.]|$)|" + (opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + ",(?!" + re.src_ZCc + "|$)|;(?!" + re.src_ZCc + "|$)|\\!+(?!" + re.src_ZCc + "|[!]|$)|\\?(?!" + re.src_ZCc + "|[?]|$))+|\\/)?";
4090
- re.src_email_name = "[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\\"\\.a-zA-Z0-9_]*";
4160
+ re.src_host_terminator = `(?=$|${text_separators}|${re.src_ZPCc})(?!${opts["---"] ? "-(?!--)|" : "-|"}_|:\\d|\\.-|\\.(?!$|${re.src_ZPCc}))`;
4161
+ re.src_path = `(?:[/?#](?:(?!${re.src_ZCc}|${text_separators}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${re.src_ZCc}|\\]).)*\\]|\\((?:(?!${re.src_ZCc}|[)]).)*\\)|\\{(?:(?!${re.src_ZCc}|[}]).)*\\}|\\"(?:(?!${re.src_ZCc}|["]).)+\\"|\\'(?:(?!${re.src_ZCc}|[']).)+\\'|\\'(?=${re.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${re.src_ZCc}|[.]|$)|` + (opts["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + `,(?!${re.src_ZCc}|$)|;(?!${re.src_ZCc}|$)|\\!+(?!${re.src_ZCc}|[!]|$)|\\?(?!${re.src_ZCc}|[?]|$))+|\\/)?`;
4162
+ re.src_email_name = "[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\\"\\.a-zA-Z0-9_]{0,63}";
4091
4163
  re.src_xn = "xn--[a-z0-9\\-]{1,59}";
4092
- re.src_domain_root = "(?:" + re.src_xn + "|" + re.src_pseudo_letter + "{1,63})";
4093
- re.src_domain = "(?:" + re.src_xn + "|(?:" + re.src_pseudo_letter + ")|(?:" + re.src_pseudo_letter + "(?:-|" + re.src_pseudo_letter + "){0,61}" + re.src_pseudo_letter + "))";
4094
- re.src_host = "(?:(?:(?:(?:" + re.src_domain + ")\\.)*" + re.src_domain + "))";
4095
- re.tpl_host_fuzzy = "(?:" + re.src_ip4 + "|(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%)))";
4096
- re.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%))";
4164
+ re.src_domain_root = "(?:" + re.src_xn + `|${re.src_pseudo_letter}{1,63})`;
4165
+ re.src_domain = "(?:" + re.src_xn + `|(?:${re.src_pseudo_letter})|(?:${re.src_pseudo_letter}(?:-|${re.src_pseudo_letter}){0,61}${re.src_pseudo_letter}))`;
4166
+ re.src_host = `(?:(?:(?:(?:${re.src_domain})\\.)*${re.src_domain}))`;
4167
+ re.tpl_host_fuzzy = "(?:" + re.src_ip4 + `|(?:(?:(?:${re.src_domain})\\.)+(?:%TLDS%)))`;
4168
+ re.tpl_host_no_ip_fuzzy = `(?:(?:(?:${re.src_domain})\\.)+(?:%TLDS%))`;
4097
4169
  re.src_host_strict = re.src_host + re.src_host_terminator;
4098
4170
  re.tpl_host_fuzzy_strict = re.tpl_host_fuzzy + re.src_host_terminator;
4099
4171
  re.src_host_port_strict = re.src_host + re.src_port + re.src_host_terminator;
4100
4172
  re.tpl_host_port_fuzzy_strict = re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
4101
4173
  re.tpl_host_port_no_ip_fuzzy_strict = re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
4102
- re.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + re.src_ZPCc + "|>|$))";
4103
- re.tpl_email_fuzzy = "(^|" + text_separators + "|\"|\\(|" + re.src_ZCc + ")(" + re.src_email_name + "@" + re.tpl_host_fuzzy_strict + ")";
4104
- re.tpl_link_fuzzy = "(^|(?![.:/\\-_@])(?:[$+<=>^`||]|" + re.src_ZPCc + "))((?![$+<=>^`||])" + re.tpl_host_port_fuzzy_strict + re.src_path + ")";
4105
- re.tpl_link_no_ip_fuzzy = "(^|(?![.:/\\-_@])(?:[$+<=>^`||]|" + re.src_ZPCc + "))((?![$+<=>^`||])" + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ")";
4174
+ re.tpl_host_fuzzy_test = `localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${re.src_ZPCc}|>|$))`;
4175
+ re.tpl_email_fuzzy = `(^|${text_separators}|"|\\(|${re.src_ZCc})(${re.src_email_name}@${re.tpl_host_fuzzy_strict})`;
4176
+ re.tpl_link_fuzzy = `(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${re.src_ZPCc}))((?![$+<=>^\`|\uff5c])${re.tpl_host_port_fuzzy_strict}${re.src_path})`;
4177
+ re.tpl_link_no_ip_fuzzy = `(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${re.src_ZPCc}))((?![$+<=>^\`|\uff5c])${re.tpl_host_port_no_ip_fuzzy_strict}${re.src_path})`;
4106
4178
  return re;
4107
4179
  }
4108
4180
  //#endregion
@@ -4147,7 +4219,7 @@ function isOptionsObj(obj) {
4147
4219
  var defaultSchemas = {
4148
4220
  "http:": { validate: function(text, pos, self) {
4149
4221
  const tail = text.slice(pos);
4150
- if (!self.re.http) self.re.http = new RegExp("^\\/\\/" + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, "i");
4222
+ if (!self.re.http) self.re.http = new RegExp(`^\\/\\/${self.re.src_auth}${self.re.src_host_port_strict}${self.re.src_path}`, "i");
4151
4223
  if (self.re.http.test(tail)) return tail.match(self.re.http)[0].length;
4152
4224
  return 0;
4153
4225
  } },
@@ -4155,7 +4227,7 @@ var defaultSchemas = {
4155
4227
  "ftp:": "http:",
4156
4228
  "//": { validate: function(text, pos, self) {
4157
4229
  const tail = text.slice(pos);
4158
- if (!self.re.no_http) self.re.no_http = new RegExp("^" + self.re.src_auth + "(?:localhost|(?:(?:" + self.re.src_domain + ")\\.)+" + self.re.src_domain_root + ")" + self.re.src_port + self.re.src_host_terminator + self.re.src_path, "i");
4230
+ if (!self.re.no_http) self.re.no_http = new RegExp("^" + self.re.src_auth + `(?:localhost|(?:(?:${self.re.src_domain})\\.)+${self.re.src_domain_root})` + self.re.src_port + self.re.src_host_terminator + self.re.src_path, "i");
4159
4231
  if (self.re.no_http.test(tail)) {
4160
4232
  if (pos >= 3 && text[pos - 3] === ":") return 0;
4161
4233
  if (pos >= 3 && text[pos - 3] === "/") return 0;
@@ -4165,17 +4237,13 @@ var defaultSchemas = {
4165
4237
  } },
4166
4238
  "mailto:": { validate: function(text, pos, self) {
4167
4239
  const tail = text.slice(pos);
4168
- if (!self.re.mailto) self.re.mailto = new RegExp("^" + self.re.src_email_name + "@" + self.re.src_host_strict, "i");
4240
+ if (!self.re.mailto) self.re.mailto = new RegExp(`^${self.re.src_email_name}@${self.re.src_host_strict}`, "i");
4169
4241
  if (self.re.mailto.test(tail)) return tail.match(self.re.mailto)[0].length;
4170
4242
  return 0;
4171
4243
  } }
4172
4244
  };
4173
4245
  var tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
4174
4246
  var tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");
4175
- function resetScanCache(self) {
4176
- self.__index__ = -1;
4177
- self.__text_cache__ = "";
4178
- }
4179
4247
  function createValidator(re) {
4180
4248
  return function(text, pos) {
4181
4249
  const tail = text.slice(pos);
@@ -4199,13 +4267,16 @@ function compile(self) {
4199
4267
  return tpl.replace("%TLDS%", re.src_tlds);
4200
4268
  }
4201
4269
  re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), "i");
4270
+ re.email_fuzzy_global = RegExp(untpl(re.tpl_email_fuzzy), "ig");
4202
4271
  re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), "i");
4272
+ re.link_fuzzy_global = RegExp(untpl(re.tpl_link_fuzzy), "ig");
4203
4273
  re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
4274
+ re.link_no_ip_fuzzy_global = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "ig");
4204
4275
  re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
4205
4276
  const aliases = [];
4206
4277
  self.__compiled__ = {};
4207
4278
  function schemaError(name, val) {
4208
- throw new Error("(LinkifyIt) Invalid schema \"" + name + "\": " + val);
4279
+ throw new Error(`(LinkifyIt) Invalid schema "${name}": ${val}`);
4209
4280
  }
4210
4281
  Object.keys(self.__schemas__).forEach(function(name) {
4211
4282
  const val = self.__schemas__[name];
@@ -4242,62 +4313,54 @@ function compile(self) {
4242
4313
  const slist = Object.keys(self.__compiled__).filter(function(name) {
4243
4314
  return name.length > 0 && self.__compiled__[name];
4244
4315
  }).map(escapeRE).join("|");
4245
- self.re.schema_test = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "i");
4246
- self.re.schema_search = RegExp("(^|(?!_)(?:[><|]|" + re.src_ZPCc + "))(" + slist + ")", "ig");
4247
- self.re.schema_at_start = RegExp("^" + self.re.schema_search.source, "i");
4248
- self.re.pretest = RegExp("(" + self.re.schema_test.source + ")|(" + self.re.host_fuzzy_test.source + ")|@", "i");
4249
- resetScanCache(self);
4316
+ self.re.schema_test = RegExp(`(^|(?!_)(?:[><\uff5c]|${re.src_ZPCc}))(${slist})`, "i");
4317
+ self.re.schema_search = RegExp(`(^|(?!_)(?:[><\uff5c]|${re.src_ZPCc}))(${slist})`, "ig");
4318
+ self.re.schema_at_start = RegExp(`^${self.re.schema_search.source}`, "i");
4319
+ self.re.pretest = RegExp(`(${self.re.schema_test.source})|(${self.re.host_fuzzy_test.source})|@`, "i");
4250
4320
  }
4251
4321
  /**
4252
4322
  * class Match
4253
4323
  *
4254
4324
  * Match result. Single element of array, returned by [[LinkifyIt#match]]
4255
4325
  **/
4256
- function Match(self, shift) {
4257
- const start = self.__index__;
4258
- const end = self.__last_index__;
4259
- const text = self.__text_cache__.slice(start, end);
4326
+ function Match(text, schema, index, lastIndex) {
4327
+ const raw = text.slice(index, lastIndex);
4260
4328
  /**
4261
4329
  * Match#schema -> String
4262
4330
  *
4263
4331
  * Prefix (protocol) for matched string.
4264
4332
  **/
4265
- this.schema = self.__schema__.toLowerCase();
4333
+ this.schema = schema.toLowerCase();
4266
4334
  /**
4267
4335
  * Match#index -> Number
4268
4336
  *
4269
4337
  * First position of matched string.
4270
4338
  **/
4271
- this.index = start + shift;
4339
+ this.index = index;
4272
4340
  /**
4273
4341
  * Match#lastIndex -> Number
4274
4342
  *
4275
4343
  * Next position after matched string.
4276
4344
  **/
4277
- this.lastIndex = end + shift;
4345
+ this.lastIndex = lastIndex;
4278
4346
  /**
4279
4347
  * Match#raw -> String
4280
4348
  *
4281
4349
  * Matched string.
4282
4350
  **/
4283
- this.raw = text;
4351
+ this.raw = raw;
4284
4352
  /**
4285
4353
  * Match#text -> String
4286
4354
  *
4287
4355
  * Notmalized text of matched string.
4288
4356
  **/
4289
- this.text = text;
4357
+ this.text = raw;
4290
4358
  /**
4291
4359
  * Match#url -> String
4292
4360
  *
4293
4361
  * Normalized url of matched string.
4294
4362
  **/
4295
- this.url = text;
4296
- }
4297
- function createMatch(self, shift) {
4298
- const match = new Match(self, shift);
4299
- self.__compiled__[match.schema].normalize(match, self);
4300
- return match;
4363
+ this.url = raw;
4301
4364
  }
4302
4365
  /**
4303
4366
  * class LinkifyIt
@@ -4345,10 +4408,6 @@ function LinkifyIt(schemas, options) {
4345
4408
  }
4346
4409
  }
4347
4410
  this.__opts__ = assign({}, defaultOptions, options);
4348
- this.__index__ = -1;
4349
- this.__last_index__ = -1;
4350
- this.__schema__ = "";
4351
- this.__text_cache__ = "";
4352
4411
  this.__schemas__ = assign({}, defaultSchemas, schemas);
4353
4412
  this.__compiled__ = {};
4354
4413
  this.__tlds__ = tlds_default;
@@ -4384,53 +4443,24 @@ LinkifyIt.prototype.set = function set(options) {
4384
4443
  * Searches linkifiable pattern and returns `true` on success or `false` on fail.
4385
4444
  **/
4386
4445
  LinkifyIt.prototype.test = function test(text) {
4387
- this.__text_cache__ = text;
4388
- this.__index__ = -1;
4389
4446
  if (!text.length) return false;
4390
- let m, ml, me, len, shift, next, re, tld_pos, at_pos;
4447
+ let m, re;
4391
4448
  if (this.re.schema_test.test(text)) {
4392
4449
  re = this.re.schema_search;
4393
4450
  re.lastIndex = 0;
4394
- while ((m = re.exec(text)) !== null) {
4395
- len = this.testSchemaAt(text, m[2], re.lastIndex);
4396
- if (len) {
4397
- this.__schema__ = m[2];
4398
- this.__index__ = m.index + m[1].length;
4399
- this.__last_index__ = m.index + m[0].length + len;
4400
- break;
4401
- }
4402
- }
4451
+ while ((m = re.exec(text)) !== null) if (this.testSchemaAt(text, m[2], re.lastIndex)) return true;
4403
4452
  }
4404
4453
  if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
4405
- tld_pos = text.search(this.re.host_fuzzy_test);
4406
- if (tld_pos >= 0) {
4407
- if (this.__index__ < 0 || tld_pos < this.__index__) {
4408
- if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
4409
- shift = ml.index + ml[1].length;
4410
- if (this.__index__ < 0 || shift < this.__index__) {
4411
- this.__schema__ = "";
4412
- this.__index__ = shift;
4413
- this.__last_index__ = ml.index + ml[0].length;
4414
- }
4415
- }
4416
- }
4454
+ if (text.search(this.re.host_fuzzy_test) >= 0) {
4455
+ if (text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy) !== null) return true;
4417
4456
  }
4418
4457
  }
4419
4458
  if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
4420
- at_pos = text.indexOf("@");
4421
- if (at_pos >= 0) {
4422
- if ((me = text.match(this.re.email_fuzzy)) !== null) {
4423
- shift = me.index + me[1].length;
4424
- next = me.index + me[0].length;
4425
- if (this.__index__ < 0 || shift < this.__index__ || shift === this.__index__ && next > this.__last_index__) {
4426
- this.__schema__ = "mailto:";
4427
- this.__index__ = shift;
4428
- this.__last_index__ = next;
4429
- }
4430
- }
4459
+ if (text.indexOf("@") >= 0) {
4460
+ if (text.match(this.re.email_fuzzy) !== null) return true;
4431
4461
  }
4432
4462
  }
4433
- return this.__index__ >= 0;
4463
+ return false;
4434
4464
  };
4435
4465
  /**
4436
4466
  * LinkifyIt#pretest(text) -> Boolean
@@ -4473,16 +4503,69 @@ LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
4473
4503
  **/
4474
4504
  LinkifyIt.prototype.match = function match(text) {
4475
4505
  const result = [];
4476
- let shift = 0;
4477
- if (this.__index__ >= 0 && this.__text_cache__ === text) {
4478
- result.push(createMatch(this, shift));
4479
- shift = this.__last_index__;
4506
+ const type_schemed = [];
4507
+ const type_fuzzy_link = [];
4508
+ const type_fuzzy_email = [];
4509
+ let m, len, re;
4510
+ function choose(a, b) {
4511
+ if (!a) return b;
4512
+ if (!b) return a;
4513
+ if (a.index !== b.index) return a.index < b.index ? a : b;
4514
+ return a.lastIndex >= b.lastIndex ? a : b;
4480
4515
  }
4481
- let tail = shift ? text.slice(shift) : text;
4482
- while (this.test(tail)) {
4483
- result.push(createMatch(this, shift));
4484
- tail = tail.slice(this.__last_index__);
4485
- shift += this.__last_index__;
4516
+ if (!text.length) return null;
4517
+ if (this.re.schema_test.test(text)) {
4518
+ re = this.re.schema_search;
4519
+ re.lastIndex = 0;
4520
+ while ((m = re.exec(text)) !== null) {
4521
+ len = this.testSchemaAt(text, m[2], re.lastIndex);
4522
+ if (len) type_schemed.push({
4523
+ schema: m[2],
4524
+ index: m.index + m[1].length,
4525
+ lastIndex: m.index + m[0].length + len
4526
+ });
4527
+ }
4528
+ }
4529
+ if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
4530
+ re = this.__opts__.fuzzyIP ? this.re.link_fuzzy_global : this.re.link_no_ip_fuzzy_global;
4531
+ re.lastIndex = 0;
4532
+ while ((m = re.exec(text)) !== null) type_fuzzy_link.push({
4533
+ schema: "",
4534
+ index: m.index + m[1].length,
4535
+ lastIndex: m.index + m[0].length
4536
+ });
4537
+ }
4538
+ if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
4539
+ re = this.re.email_fuzzy_global;
4540
+ re.lastIndex = 0;
4541
+ while ((m = re.exec(text)) !== null) type_fuzzy_email.push({
4542
+ schema: "mailto:",
4543
+ index: m.index + m[1].length,
4544
+ lastIndex: m.index + m[0].length
4545
+ });
4546
+ }
4547
+ const indexes = [
4548
+ 0,
4549
+ 0,
4550
+ 0
4551
+ ];
4552
+ let lastIndex = 0;
4553
+ for (;;) {
4554
+ const candidates = [
4555
+ type_schemed[indexes[0]],
4556
+ type_fuzzy_email[indexes[1]],
4557
+ type_fuzzy_link[indexes[2]]
4558
+ ];
4559
+ const candidate = choose(choose(candidates[0], candidates[1]), candidates[2]);
4560
+ if (!candidate) break;
4561
+ if (candidate === candidates[0]) indexes[0]++;
4562
+ else if (candidate === candidates[1]) indexes[1]++;
4563
+ else indexes[2]++;
4564
+ if (candidate.index < lastIndex) continue;
4565
+ const match = new Match(text, candidate.schema, candidate.index, candidate.lastIndex);
4566
+ this.__compiled__[match.schema].normalize(match, this);
4567
+ result.push(match);
4568
+ lastIndex = candidate.lastIndex;
4486
4569
  }
4487
4570
  if (result.length) return result;
4488
4571
  return null;
@@ -4494,17 +4577,14 @@ LinkifyIt.prototype.match = function match(text) {
4494
4577
  * of the string, and null otherwise.
4495
4578
  **/
4496
4579
  LinkifyIt.prototype.matchAtStart = function matchAtStart(text) {
4497
- this.__text_cache__ = text;
4498
- this.__index__ = -1;
4499
4580
  if (!text.length) return null;
4500
4581
  const m = this.re.schema_at_start.exec(text);
4501
4582
  if (!m) return null;
4502
4583
  const len = this.testSchemaAt(text, m[2], m[0].length);
4503
4584
  if (!len) return null;
4504
- this.__schema__ = m[2];
4505
- this.__index__ = m.index + m[1].length;
4506
- this.__last_index__ = m.index + m[0].length + len;
4507
- return createMatch(this, 0);
4585
+ const match = new Match(text, m[2], m.index + m[1].length, m.index + m[0].length + len);
4586
+ this.__compiled__[match.schema].normalize(match, this);
4587
+ return match;
4508
4588
  };
4509
4589
  /** chainable
4510
4590
  * LinkifyIt#tlds(list [, keepOld]) -> this
@@ -4541,8 +4621,8 @@ LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
4541
4621
  * Default normalizer (if schema does not define it's own).
4542
4622
  **/
4543
4623
  LinkifyIt.prototype.normalize = function normalize(match) {
4544
- if (!match.schema) match.url = "http://" + match.url;
4545
- if (match.schema === "mailto:" && !/^mailto:/i.test(match.url)) match.url = "mailto:" + match.url;
4624
+ if (!match.schema) match.url = `http://${match.url}`;
4625
+ if (match.schema === "mailto:" && !/^mailto:/i.test(match.url)) match.url = `mailto:${match.url}`;
4546
4626
  };
4547
4627
  /**
4548
4628
  * LinkifyIt#onCompile()
@@ -5228,7 +5308,7 @@ function MarkdownIt(presetName, options) {
5228
5308
  * ```javascript
5229
5309
  * var md = require('markdown-it')()
5230
5310
  * .set({ html: true, breaks: true })
5231
- * .set({ typographer, true });
5311
+ * .set({ typographer: true });
5232
5312
  * ```
5233
5313
  *
5234
5314
  * __Note:__ To achieve the best possible performance, don't modify a
@@ -2,12 +2,12 @@ import { c as r, l as n, m as i, p as b, s as e, u as t } from "../../chunks/lit
2
2
  import { c as __decorate, i as PkFormAssociatedElement, n as formControlStyles } from "../../chunks/pk-base-BlxAYXJD.js";
3
3
  import { t as MirrorValidator } from "../../chunks/mirror-validator-DEz3BsbN.js";
4
4
  import { T as EditorState, _ as highlightActiveLine, a as html, b as keymap, c as closeBracketsKeymap, d as defaultHighlightStyle, f as indentOnInput, g as drawSelection, h as EditorView, i as json, l as css, m as syntaxHighlighting, n as history, o as javascript, p as indentUnit, r as historyKeymap, s as closeBrackets, t as defaultKeymap, u as bracketMatching, v as highlightActiveLineGutter, w as Compartment, x as lineNumbers, y as highlightSpecialChars } from "../../chunks/codemirror-CHXb-wYU.js";
5
- //#region node_modules/@verbb/plugin-kit-codemirror-core/dist/constants.js
5
+ //#region ../plugin-kit-codemirror-core/dist/constants.js
6
6
  function computeCodeEditorMinHeight(rows = 12) {
7
7
  return `${Math.max(Number(rows) || 12, 4) * 18 + 12}px`;
8
8
  }
9
9
  //#endregion
10
- //#region node_modules/@verbb/plugin-kit-codemirror-core/dist/languages.js
10
+ //#region ../plugin-kit-codemirror-core/dist/languages.js
11
11
  function languageUsesSyntaxHelpers(language) {
12
12
  return language !== "text";
13
13
  }
@@ -21,7 +21,7 @@ function createLanguageExtension(language) {
21
21
  }
22
22
  }
23
23
  //#endregion
24
- //#region node_modules/@verbb/plugin-kit-codemirror-core/dist/theme.js
24
+ //#region ../plugin-kit-codemirror-core/dist/theme.js
25
25
  /** Editor content surface — matches @uiw/react-codemirror default light theme. */
26
26
  var CODE_EDITOR_SURFACE_BG = "#ffffff";
27
27
  /** Gutter strip beside line numbers. */
@@ -71,7 +71,7 @@ var codeEditorTheme = EditorView.theme({
71
71
  ".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection": { backgroundColor: `rgba(59, 130, 246, 0.35) !important` }
72
72
  });
73
73
  //#endregion
74
- //#region node_modules/@verbb/plugin-kit-codemirror-core/dist/extensions.js
74
+ //#region ../plugin-kit-codemirror-core/dist/extensions.js
75
75
  function createEditorSetupExtensions(language, showLineNumbers) {
76
76
  const usesSyntaxHelpers = languageUsesSyntaxHelpers(language);
77
77
  const extensions = [
@@ -118,7 +118,7 @@ function createCodeEditorExtensions({ language = "html", tabSize = 4, lineNumber
118
118
  return extensions;
119
119
  }
120
120
  //#endregion
121
- //#region node_modules/@verbb/plugin-kit-codemirror-core/dist/host.js
121
+ //#region ../plugin-kit-codemirror-core/dist/host.js
122
122
  var CodeMirrorHost = class {
123
123
  view = null;
124
124
  editableCompartment = new Compartment();
@@ -1,2 +1,2 @@
1
- import { t as PkField } from "../../chunks/pk-field-CUySYljn.js";
1
+ import { t as PkField } from "../../chunks/pk-field-BbKmQmTF.js";
2
2
  export { PkField };
@@ -9,7 +9,7 @@ import "../../chunks/pk-input-CXE7_rTQ.js";
9
9
  import { M as posToDOMRect, j as getMarkRange, k as Editor } from "../../chunks/tiptap-_LAjdgeV.js";
10
10
  import { A as createTiptapExtensions, D as getFatalTiptapContentError, O as normalizeContentArray, S as openCraftElementLinkSelector, _ as getLinkOpenInNewTab, a as getToolbarGroupDefaultIcon, b as getCraftLinkOptions, c as isFormattingToolbarPreset, d as parseToolbarConfig, f as runToolbarButton, g as getLinkEditState, h as applyLinkToEditor, i as createVariableTagDomNodeView, k as valueToContent, l as isHeadingsOnlyToolbarPreset, m as isTiptapButtonActive, o as getToolbarGroupMenuItems, p as toolbarIncludesButton, r as tiptapProseMirrorStyles, s as getToolbarGroupTriggerState, u as isToolbarButtonActive, v as getSelectedText, x as getLinkOptionsElementSiteId, y as unsetLinkFromEditor } from "../../chunks/tiptap.styles-CDjt6Iz4.js";
11
11
  import { n as renderIconHtml } from "../../chunks/render-BCU9WDSk.js";
12
- import "../../chunks/pk-field-CUySYljn.js";
12
+ import "../../chunks/pk-field-BbKmQmTF.js";
13
13
  import "../../chunks/pk-dialog-CP1YT85H.js";
14
14
  import "../../chunks/pk-dropdown-item-DkZRcPJ5.js";
15
15
  import "../../chunks/pk-dropdown-menu-CajQAobW.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbb/plugin-kit-web",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Plugin Kit web components (shadow DOM, Craft design system)",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -936,18 +936,18 @@
936
936
  },
937
937
  "peerDependencies": {
938
938
  "@floating-ui/dom": "^1.7.3",
939
- "@verbb/plugin-kit-core": "^2.0.5",
940
- "@verbb/plugin-kit-icons": "^2.0.5",
939
+ "@verbb/plugin-kit-core": "^2.0.6",
940
+ "@verbb/plugin-kit-icons": "^2.0.6",
941
941
  "lit": "^3.3.0"
942
942
  },
943
943
  "license": "MIT",
944
944
  "dependencies": {
945
945
  "@floating-ui/dom": "^1.7.3",
946
946
  "@tiptap/core": "^3.22.4",
947
- "@verbb/plugin-kit-codemirror-core": "2.0.5",
948
- "@verbb/plugin-kit-core": "^2.0.5",
949
- "@verbb/plugin-kit-icons": "^2.0.5",
950
- "@verbb/plugin-kit-tiptap-core": "^2.0.5",
947
+ "@verbb/plugin-kit-codemirror-core": "2.0.6",
948
+ "@verbb/plugin-kit-core": "^2.0.6",
949
+ "@verbb/plugin-kit-icons": "^2.0.6",
950
+ "@verbb/plugin-kit-tiptap-core": "^2.0.6",
951
951
  "composed-offset-position": "^0.0.6",
952
952
  "lit": "^3.3.0"
953
953
  },