@marimo-team/islands 0.17.4 → 0.17.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.
Files changed (73) hide show
  1. package/dist/{ConnectedDataExplorerComponent-DY9cADKc.js → ConnectedDataExplorerComponent-BC1bAfWX.js} +4 -4
  2. package/dist/{any-language-editor-Bs2c1bKU.js → any-language-editor-BpWjHMW2.js} +22 -22
  3. package/dist/{dist-DlSZED-1.js → dist-1NPzctn9.js} +2 -2
  4. package/dist/{dist-qGpLTiEi.js → dist-59eZyXwa.js} +3 -3
  5. package/dist/dist-8Gr13wFT.js +6 -0
  6. package/dist/{dist-D4LUTYHc.js → dist-8IZEIZE_.js} +2 -2
  7. package/dist/dist-BA1Ol0Yn.js +6 -0
  8. package/dist/{dist-DzKKEoge.js → dist-BGBHvY7x.js} +3 -3
  9. package/dist/{dist-8v4BI_h_.js → dist-BJKL0WEK.js} +1 -1
  10. package/dist/{dist-B3CNaJau.js → dist-BPwzuLH_.js} +119 -119
  11. package/dist/{dist-D08oiinq.js → dist-BRfGeCYG.js} +77 -77
  12. package/dist/{dist-CxRajUZ6.js → dist-BXNAv-Y6.js} +1 -1
  13. package/dist/{dist-7CqcJssH.js → dist-BZrCuBDi.js} +6 -6
  14. package/dist/{dist-C02gS--y.js → dist-Bevt_gzr.js} +41 -41
  15. package/dist/{dist-DGKjHTv9.js → dist-C1xRKkqR.js} +5 -5
  16. package/dist/{dist-DSDOMDNR.js → dist-C8SV9SiM.js} +4 -4
  17. package/dist/{dist-HKzG1oF6.js → dist-CCFXVP1F.js} +1 -1
  18. package/dist/{dist-BgsDu-bU.js → dist-CLkbwjpG.js} +1 -1
  19. package/dist/{dist-BMhv6XDi.js → dist-CP1MdHH-.js} +27 -27
  20. package/dist/{dist-Dh7gw0Ay.js → dist-CWyLmhAN.js} +2 -2
  21. package/dist/{dist-CXimnGhI.js → dist-C_BPvPwx.js} +2 -2
  22. package/dist/dist-CbNrcsEy.js +10 -0
  23. package/dist/{dist-DiO9ni9a.js → dist-Cba8uTcG.js} +2 -2
  24. package/dist/{dist-C5Ns3q-m.js → dist-Cf1Q6zai.js} +31 -31
  25. package/dist/{dist-_tHnp24J.js → dist-CiMy2-5u.js} +3 -3
  26. package/dist/dist-CkXa7yhd.js +10 -0
  27. package/dist/dist-CoHj7yHI.js +6 -0
  28. package/dist/{dist-XkGsOiy0.js → dist-CqG4DwQn.js} +2 -2
  29. package/dist/{dist-owpR56zn.js → dist-Ct4F6_s2.js} +1 -1
  30. package/dist/{dist-DTNqkRGE.js → dist-DG9oMdD2.js} +3 -3
  31. package/dist/{dist-CawOxmKh.js → dist-DKdtgJ4Q.js} +5 -5
  32. package/dist/{dist-K_AqLCfS.js → dist-DQOkkAzs.js} +3 -3
  33. package/dist/dist-DVuYVZws.js +6 -0
  34. package/dist/{dist-DvsjKDQ4.js → dist-DgnYtm7R.js} +1 -1
  35. package/dist/dist-DjH2J8yO.js +6 -0
  36. package/dist/{dist-DGnWQOnS.js → dist-Djl1P_Vh.js} +3 -3
  37. package/dist/{dist-DbHWFmjZ.js → dist-Kh7kDIJB.js} +1 -1
  38. package/dist/dist-MCqj0bEP.js +12 -0
  39. package/dist/{dist-eSnWVS11.js → dist-k6dhIy0O.js} +3 -3
  40. package/dist/dist-l9YJLCkC.js +6 -0
  41. package/dist/{dist-BYS0EtbC.js → dist-m4uUGntS.js} +2 -2
  42. package/dist/{dist-D_GkrgWD.js → dist-qXlX_Isq.js} +2 -2
  43. package/dist/{dist-CBu8cgzz.js → dist-t5bQPtMZ.js} +43 -45
  44. package/dist/{esm-CQIOyi5v.js → esm-HxIp3fzy.js} +1387 -1435
  45. package/dist/{formats-kyFd0DPJ.js → formats-b5g0iERd.js} +1 -1
  46. package/dist/{glide-data-editor-1bUl_mRe.js → glide-data-editor-hF8NzJm2.js} +2 -2
  47. package/dist/main.js +93 -1074
  48. package/dist/{mermaid-DIjoC4T4.js → mermaid-BAe4A_1z.js} +2 -2
  49. package/dist/{react-vega-DM3e8kar.js → react-vega-BhZaW0DJ.js} +1 -1
  50. package/dist/{react-vega-B9eMrRW1.js → react-vega-C3G6aCB7.js} +1560 -869
  51. package/dist/{spec-rqRnkIf4.js → spec-9eipa51K.js} +1 -1
  52. package/dist/{types-Bt7p5SYB.js → types-O1gHduIo.js} +1 -1
  53. package/dist/{useAsyncData-Dp2V69OV.js → useAsyncData-D8_fNj6a.js} +1 -1
  54. package/dist/{useTheme-D7vlj42b.js → useTheme-BzICL4qs.js} +23 -24
  55. package/dist/{vega-component-C58Jk3ub.js → vega-component-B26vOtT-.js} +4 -4
  56. package/package.json +2 -2
  57. package/src/components/app-config/data-form.tsx +3 -3
  58. package/src/core/codemirror/language/__tests__/markdown.test.ts +36 -13
  59. package/src/core/codemirror/language/__tests__/utils.test.ts +6 -2
  60. package/src/core/codemirror/language/languages/sql/sql.ts +2 -1
  61. package/src/plugins/layout/TexPlugin.tsx +33 -5
  62. package/dist/dist-B9JCXzyv.js +0 -6
  63. package/dist/dist-C6QrJGYr.js +0 -10
  64. package/dist/dist-CFZ32udY.js +0 -6
  65. package/dist/dist-CmgxQNWN.js +0 -10
  66. package/dist/dist-Cr6Cu8sC.js +0 -6
  67. package/dist/dist-NxHLuq7w.js +0 -6
  68. package/dist/dist-S2JcqPPB.js +0 -12
  69. package/dist/dist-hcPlrsR9.js +0 -6
  70. package/dist/dist-poXa8G8m.js +0 -6
  71. package/dist/node-sql-parser-IKID_dZE.js +0 -70437
  72. /package/dist/{esm-CopBBL2y.js → esm-CS8JKDQL.js} +0 -0
  73. /package/dist/{react-plotly-Cs07wkly.js → react-plotly-YQqow0sD.js} +0 -0
@@ -6,27 +6,27 @@ import { t as Check } from "./check-BZnPxXnd.js";
6
6
  import { d as cn, u as Events } from "./button-B8zS4Mtw.js";
7
7
  import { t as require_jsx_runtime } from "./jsx-runtime-CvL6gNI-.js";
8
8
  import { c as Tooltip } from "./error-banner-B7LmpmGT.js";
9
- import { $ as ViewPlugin, A as indentString, At as RangeSet, B as tags, Bt as countColumn, C as foldKeymap, Ct as CharCategory, D as getIndentation, Dt as Facet, E as getIndentUnit, Et as EditorState, F as syntaxHighlighting, Ft as Text, H as NodeProp, Ht as fromCodePoint, I as syntaxTree, It as Transaction, J as parseMixed, Lt as codePointAt, N as matchBrackets, Nt as StateEffect, O as indentNodeProp, Pt as StateField, R as Tag, Rt as codePointSize, S as foldInside, St as ChangeSet, Tt as EditorSelection, Vt as findClusterBreak, X as Direction, Y as Decoration, Z as EditorView, _t as showPanel, a as HighlightStyle, bt as Annotation, ct as highlightActiveLineGutter, dt as keymap, et as WidgetType, f as StreamLanguage, ft as lineNumbers, g as defaultHighlightStyle, gt as runScopeHandlers, h as continuedIndent, ht as rectangularSelection, it as getPanel, j as indentUnit, jt as RangeSetBuilder, k as indentOnInput, kt as Prec, lt as highlightSpecialChars, mt as placeholder, n as ExternalTokenizer, nt as drawSelection, o as IndentContext, p as bracketMatching, pt as logException, r as LRParser, rt as dropCursor, s as LRLanguage, st as highlightActiveLine, t as ContextTracker, tt as crosshairCursor, u as LanguageSupport, ut as hoverTooltip, v as delimitedIndent, w as foldNodeProp, x as foldGutter, xt as ChangeDesc, yt as crelt, z as styleTags, zt as combineConfig } from "./dist-CBu8cgzz.js";
10
- import { a as closeBracketsKeymap, c as completionKeymap, f as snippetCompletion, i as closeBrackets, l as ifNotIn, r as autocompletion, s as completeFromList } from "./dist-D08oiinq.js";
11
- import { i as markdown } from "./dist-C02gS--y.js";
12
- import { n as html, r as htmlCompletionSource } from "./dist-C5Ns3q-m.js";
13
- import { r as cssLanguage, t as css } from "./dist-CxRajUZ6.js";
14
- import { c as typescriptLanguage, n as javascript, r as javascriptLanguage, u as parser$1 } from "./dist-B3CNaJau.js";
15
- import { r as python } from "./dist-D_GkrgWD.js";
9
+ import { $ as WidgetType, A as indentString, B as tags, Bt as fromCodePoint, C as foldKeymap, Ct as EditorSelection, D as getIndentation, Dt as Prec, E as getIndentUnit, F as syntaxHighlighting, Ft as codePointAt, H as NodeProp, I as syntaxTree, It as codePointSize, J as parseMixed, Lt as combineConfig, Mt as StateField, N as matchBrackets, Nt as Text, O as indentNodeProp, Ot as RangeSet, Pt as Transaction, Q as ViewPlugin, R as Tag, Rt as countColumn, S as foldInside, Tt as Facet, X as Direction, Y as Decoration, Z as EditorView, _t as crelt, a as HighlightStyle, at as highlightActiveLine, bt as ChangeSet, ct as hoverTooltip, et as crosshairCursor, f as StreamLanguage, ft as placeholder, g as defaultHighlightStyle, h as continuedIndent, ht as showPanel, j as indentUnit, jt as StateEffect, k as indentOnInput, kt as RangeSetBuilder, lt as keymap, mt as runScopeHandlers, n as ExternalTokenizer, nt as dropCursor, o as IndentContext, ot as highlightActiveLineGutter, p as bracketMatching, pt as rectangularSelection, r as LRParser, rt as getPanel, s as LRLanguage, st as highlightSpecialChars, t as ContextTracker, tt as drawSelection, u as LanguageSupport, ut as lineNumbers, v as delimitedIndent, vt as Annotation, w as foldNodeProp, wt as EditorState, x as foldGutter, xt as CharCategory, yt as ChangeDesc, z as styleTags, zt as findClusterBreak } from "./dist-t5bQPtMZ.js";
10
+ import { a as closeBracketsKeymap, c as completionKeymap, f as snippetCompletion, i as closeBrackets, l as ifNotIn, r as autocompletion, s as completeFromList } from "./dist-BRfGeCYG.js";
11
+ import { i as markdown } from "./dist-Bevt_gzr.js";
12
+ import { n as html, r as htmlCompletionSource } from "./dist-Cf1Q6zai.js";
13
+ import { r as cssLanguage, t as css } from "./dist-BXNAv-Y6.js";
14
+ import { c as typescriptLanguage, n as javascript, r as javascriptLanguage, u as parser$1 } from "./dist-BPwzuLH_.js";
15
+ import { r as python } from "./dist-qXlX_Isq.js";
16
16
  import { t as stex } from "./stex-BmcrV7cx.js";
17
- import { a as PLSQL, f as sql, l as StandardSQL, t as Cassandra } from "./dist-D4LUTYHc.js";
18
- import { t as cpp } from "./dist-owpR56zn.js";
19
- import { t as go } from "./dist-CXimnGhI.js";
20
- import { t as java } from "./dist-DvsjKDQ4.js";
21
- import { t as json } from "./dist-BgsDu-bU.js";
22
- import { t as less } from "./dist-DiO9ni9a.js";
23
- import { n as liquid } from "./dist-DSDOMDNR.js";
24
- import { t as php } from "./dist-XkGsOiy0.js";
25
- import { t as rust } from "./dist-DbHWFmjZ.js";
26
- import { t as sass } from "./dist-DlSZED-1.js";
27
- import { t as wast } from "./dist-HKzG1oF6.js";
28
- import { r as xml } from "./dist-BMhv6XDi.js";
29
- import { t as yaml } from "./dist-8v4BI_h_.js";
17
+ import { a as PLSQL, f as sql, l as StandardSQL, t as Cassandra } from "./dist-8IZEIZE_.js";
18
+ import { t as cpp } from "./dist-Ct4F6_s2.js";
19
+ import { t as go } from "./dist-C_BPvPwx.js";
20
+ import { t as java } from "./dist-DgnYtm7R.js";
21
+ import { t as json } from "./dist-CLkbwjpG.js";
22
+ import { t as less } from "./dist-Cba8uTcG.js";
23
+ import { n as liquid } from "./dist-C8SV9SiM.js";
24
+ import { t as php } from "./dist-CqG4DwQn.js";
25
+ import { t as rust } from "./dist-Kh7kDIJB.js";
26
+ import { t as sass } from "./dist-1NPzctn9.js";
27
+ import { t as wast } from "./dist-CCFXVP1F.js";
28
+ import { r as xml } from "./dist-CP1MdHH-.js";
29
+ import { t as yaml } from "./dist-BJKL0WEK.js";
30
30
  import { t as apl } from "./apl-Css595_H.js";
31
31
  import { t as asciiArmor } from "./asciiarmor-BTCuJwxh.js";
32
32
  import { t as asn1 } from "./asn1-DXjhS5QI.js";
@@ -110,159 +110,159 @@ import { t as xQuery } from "./xquery-BErHIIc-.js";
110
110
  import { t as yacas } from "./yacas-BBBJNs0h.js";
111
111
  import { t as z80 } from "./z80-nG9RRukG.js";
112
112
  import { n as msgenny, r as xu, t as mscgen } from "./mscgen-DWWpdZnb.js";
113
- import { t as vue } from "./dist-DTNqkRGE.js";
113
+ import { t as vue } from "./dist-DG9oMdD2.js";
114
114
  var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime(), 1), import_react = /* @__PURE__ */ __toESM(require_react(), 1), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
115
115
  const CopyClipboardIcon = (e6) => {
116
- let y = (0, import_compiler_runtime.c)(13), { value: b, className: D, tooltip: k, toastTitle: A, ariaLabel: j } = e6, [M, N] = (0, import_react.useState)(false), P;
117
- y[0] !== A || y[1] !== b ? (P = Events.stopPropagation(async (e7) => {
118
- await copyToClipboard(typeof b == "function" ? b(e7) : b).then(() => {
119
- N(true), setTimeout(() => N(false), 2e3), A && toast({ title: A });
116
+ let x = (0, import_compiler_runtime.c)(13), { value: S, className: k, tooltip: j, toastTitle: M, ariaLabel: N } = e6, [P, F] = (0, import_react.useState)(false), I;
117
+ x[0] !== M || x[1] !== S ? (I = Events.stopPropagation(async (e7) => {
118
+ await copyToClipboard(typeof S == "function" ? S(e7) : S).then(() => {
119
+ F(true), setTimeout(() => F(false), 2e3), M && toast({ title: M });
120
120
  });
121
- }), y[0] = A, y[1] = b, y[2] = P) : P = y[2];
122
- let F = P, I = j ?? "Copy to clipboard", L;
123
- y[3] !== D || y[4] !== M ? (L = M ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: cn(D, "text-(--grass-11)") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: D }), y[3] = D, y[4] = M, y[5] = L) : L = y[5];
124
- let R;
125
- y[6] !== F || y[7] !== I || y[8] !== L ? (R = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
121
+ }), x[0] = M, x[1] = S, x[2] = I) : I = x[2];
122
+ let L = I, R = N ?? "Copy to clipboard", z;
123
+ x[3] !== k || x[4] !== P ? (z = P ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: cn(k, "text-(--grass-11)") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: k }), x[3] = k, x[4] = P, x[5] = z) : z = x[5];
124
+ let B;
125
+ x[6] !== L || x[7] !== R || x[8] !== z ? (B = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
126
126
  type: "button",
127
- onClick: F,
128
- "aria-label": I,
129
- children: L
130
- }), y[6] = F, y[7] = I, y[8] = L, y[9] = R) : R = y[9];
131
- let z = R;
132
- if (k === false) return z;
133
- let B = M ? "Copied!" : k ?? "Copy to clipboard", V;
134
- return y[10] !== z || y[11] !== B ? (V = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, {
135
- content: B,
136
- delayDuration: 400,
127
+ onClick: L,
128
+ "aria-label": R,
137
129
  children: z
138
- }), y[10] = z, y[11] = B, y[12] = V) : V = y[12], V;
130
+ }), x[6] = L, x[7] = R, x[8] = z, x[9] = B) : B = x[9];
131
+ let V = B;
132
+ if (j === false) return V;
133
+ let H = P ? "Copied!" : j ?? "Copy to clipboard", U;
134
+ return x[10] !== V || x[11] !== H ? (U = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, {
135
+ content: H,
136
+ delayDuration: 400,
137
+ children: V
138
+ }), x[10] = V, x[11] = H, x[12] = U) : U = x[12], U;
139
139
  };
140
140
  var toggleComment = (e6) => {
141
- let { state: y } = e6, b = y.doc.lineAt(y.selection.main.from), x = getConfig(e6.state, b.from);
142
- return x.line ? toggleLineComment(e6) : x.block ? toggleBlockCommentByLine(e6) : false;
141
+ let { state: x } = e6, S = x.doc.lineAt(x.selection.main.from), C = getConfig(e6.state, S.from);
142
+ return C.line ? toggleLineComment(e6) : C.block ? toggleBlockCommentByLine(e6) : false;
143
143
  };
144
- function command(e6, y) {
145
- return ({ state: b, dispatch: x }) => {
146
- if (b.readOnly) return false;
147
- let S = e6(y, b);
148
- return S ? (x(b.update(S)), true) : false;
144
+ function command(e6, x) {
145
+ return ({ state: S, dispatch: C }) => {
146
+ if (S.readOnly) return false;
147
+ let w = e6(x, S);
148
+ return w ? (C(S.update(w)), true) : false;
149
149
  };
150
150
  }
151
- var toggleLineComment = /* @__PURE__ */ command(changeLineComment, 0), toggleBlockComment = /* @__PURE__ */ command(changeBlockComment, 0), toggleBlockCommentByLine = /* @__PURE__ */ command((e6, y) => changeBlockComment(e6, y, selectedLineRanges(y)), 0);
152
- function getConfig(e6, y) {
153
- let b = e6.languageDataAt("commentTokens", y, 1);
154
- return b.length ? b[0] : {};
151
+ var toggleLineComment = /* @__PURE__ */ command(changeLineComment, 0), toggleBlockComment = /* @__PURE__ */ command(changeBlockComment, 0), toggleBlockCommentByLine = /* @__PURE__ */ command((e6, x) => changeBlockComment(e6, x, selectedLineRanges(x)), 0);
152
+ function getConfig(e6, x) {
153
+ let S = e6.languageDataAt("commentTokens", x, 1);
154
+ return S.length ? S[0] : {};
155
155
  }
156
156
  var SearchMargin = 50;
157
- function findBlockComment(e6, { open: y, close: b }, x, S) {
158
- let C = e6.sliceDoc(x - SearchMargin, x), w = e6.sliceDoc(S, S + SearchMargin), T = /\s*$/.exec(C)[0].length, E = /^\s*/.exec(w)[0].length, D = C.length - T;
159
- if (C.slice(D - y.length, D) == y && w.slice(E, E + b.length) == b) return {
157
+ function findBlockComment(e6, { open: x, close: S }, C, w) {
158
+ let T = e6.sliceDoc(C - SearchMargin, C), E = e6.sliceDoc(w, w + SearchMargin), D = /\s*$/.exec(T)[0].length, O = /^\s*/.exec(E)[0].length, k = T.length - D;
159
+ if (T.slice(k - x.length, k) == x && E.slice(O, O + S.length) == S) return {
160
160
  open: {
161
- pos: x - T,
162
- margin: T && 1
161
+ pos: C - D,
162
+ margin: D && 1
163
163
  },
164
164
  close: {
165
- pos: S + E,
166
- margin: E && 1
165
+ pos: w + O,
166
+ margin: O && 1
167
167
  }
168
168
  };
169
- let O, k;
170
- S - x <= 2 * SearchMargin ? O = k = e6.sliceDoc(x, S) : (O = e6.sliceDoc(x, x + SearchMargin), k = e6.sliceDoc(S - SearchMargin, S));
171
- let A = /^\s*/.exec(O)[0].length, j = /\s*$/.exec(k)[0].length, M = k.length - j - b.length;
172
- return O.slice(A, A + y.length) == y && k.slice(M, M + b.length) == b ? {
169
+ let A, j;
170
+ w - C <= 2 * SearchMargin ? A = j = e6.sliceDoc(C, w) : (A = e6.sliceDoc(C, C + SearchMargin), j = e6.sliceDoc(w - SearchMargin, w));
171
+ let M = /^\s*/.exec(A)[0].length, N = /\s*$/.exec(j)[0].length, P = j.length - N - S.length;
172
+ return A.slice(M, M + x.length) == x && j.slice(P, P + S.length) == S ? {
173
173
  open: {
174
- pos: x + A + y.length,
175
- margin: /\s/.test(O.charAt(A + y.length)) ? 1 : 0
174
+ pos: C + M + x.length,
175
+ margin: /\s/.test(A.charAt(M + x.length)) ? 1 : 0
176
176
  },
177
177
  close: {
178
- pos: S - j - b.length,
179
- margin: /\s/.test(k.charAt(M - 1)) ? 1 : 0
178
+ pos: w - N - S.length,
179
+ margin: /\s/.test(j.charAt(P - 1)) ? 1 : 0
180
180
  }
181
181
  } : null;
182
182
  }
183
183
  function selectedLineRanges(e6) {
184
- let y = [];
185
- for (let b of e6.selection.ranges) {
186
- let x = e6.doc.lineAt(b.from), S = b.to <= x.to ? x : e6.doc.lineAt(b.to);
187
- S.from > x.from && S.from == b.to && (S = b.to == x.to + 1 ? x : e6.doc.lineAt(b.to - 1));
188
- let C = y.length - 1;
189
- C >= 0 && y[C].to > x.from ? y[C].to = S.to : y.push({
190
- from: x.from + /^\s*/.exec(x.text)[0].length,
191
- to: S.to
184
+ let x = [];
185
+ for (let S of e6.selection.ranges) {
186
+ let C = e6.doc.lineAt(S.from), w = S.to <= C.to ? C : e6.doc.lineAt(S.to);
187
+ w.from > C.from && w.from == S.to && (w = S.to == C.to + 1 ? C : e6.doc.lineAt(S.to - 1));
188
+ let T = x.length - 1;
189
+ T >= 0 && x[T].to > C.from ? x[T].to = w.to : x.push({
190
+ from: C.from + /^\s*/.exec(C.text)[0].length,
191
+ to: w.to
192
192
  });
193
193
  }
194
- return y;
194
+ return x;
195
195
  }
196
- function changeBlockComment(e6, y, b = y.selection.ranges) {
197
- let x = b.map((e7) => getConfig(y, e7.from).block);
198
- if (!x.every((e7) => e7)) return null;
199
- let S = b.map((e7, b2) => findBlockComment(y, x[b2], e7.from, e7.to));
200
- if (e6 != 2 && !S.every((e7) => e7)) return { changes: y.changes(b.map((e7, y2) => S[y2] ? [] : [{
196
+ function changeBlockComment(e6, x, S = x.selection.ranges) {
197
+ let C = S.map((e7) => getConfig(x, e7.from).block);
198
+ if (!C.every((e7) => e7)) return null;
199
+ let w = S.map((e7, S2) => findBlockComment(x, C[S2], e7.from, e7.to));
200
+ if (e6 != 2 && !w.every((e7) => e7)) return { changes: x.changes(S.map((e7, x2) => w[x2] ? [] : [{
201
201
  from: e7.from,
202
- insert: x[y2].open + " "
202
+ insert: C[x2].open + " "
203
203
  }, {
204
204
  from: e7.to,
205
- insert: " " + x[y2].close
205
+ insert: " " + C[x2].close
206
206
  }])) };
207
- if (e6 != 1 && S.some((e7) => e7)) {
207
+ if (e6 != 1 && w.some((e7) => e7)) {
208
208
  let e7 = [];
209
- for (let y2 = 0, b2; y2 < S.length; y2++) if (b2 = S[y2]) {
210
- let S2 = x[y2], { open: C, close: w } = b2;
209
+ for (let x2 = 0, S2; x2 < w.length; x2++) if (S2 = w[x2]) {
210
+ let w2 = C[x2], { open: T, close: E } = S2;
211
211
  e7.push({
212
- from: C.pos - S2.open.length,
213
- to: C.pos + C.margin
212
+ from: T.pos - w2.open.length,
213
+ to: T.pos + T.margin
214
214
  }, {
215
- from: w.pos - w.margin,
216
- to: w.pos + S2.close.length
215
+ from: E.pos - E.margin,
216
+ to: E.pos + w2.close.length
217
217
  });
218
218
  }
219
219
  return { changes: e7 };
220
220
  }
221
221
  return null;
222
222
  }
223
- function changeLineComment(e6, y, b = y.selection.ranges) {
224
- let x = [], S = -1;
225
- for (let { from: e7, to: C } of b) {
226
- let b2 = x.length, w = 1e9, T = getConfig(y, e7).line;
227
- if (T) {
228
- for (let b3 = e7; b3 <= C; ) {
229
- let E = y.doc.lineAt(b3);
230
- if (E.from > S && (e7 == C || C > E.from)) {
231
- S = E.from;
232
- let e8 = /^\s*/.exec(E.text)[0].length, y2 = e8 == E.length, b4 = E.text.slice(e8, e8 + T.length) == T ? e8 : -1;
233
- e8 < E.text.length && e8 < w && (w = e8), x.push({
234
- line: E,
235
- comment: b4,
236
- token: T,
223
+ function changeLineComment(e6, x, S = x.selection.ranges) {
224
+ let C = [], w = -1;
225
+ for (let { from: e7, to: T } of S) {
226
+ let S2 = C.length, E = 1e9, D = getConfig(x, e7).line;
227
+ if (D) {
228
+ for (let S3 = e7; S3 <= T; ) {
229
+ let O = x.doc.lineAt(S3);
230
+ if (O.from > w && (e7 == T || T > O.from)) {
231
+ w = O.from;
232
+ let e8 = /^\s*/.exec(O.text)[0].length, x2 = e8 == O.length, S4 = O.text.slice(e8, e8 + D.length) == D ? e8 : -1;
233
+ e8 < O.text.length && e8 < E && (E = e8), C.push({
234
+ line: O,
235
+ comment: S4,
236
+ token: D,
237
237
  indent: e8,
238
- empty: y2,
238
+ empty: x2,
239
239
  single: false
240
240
  });
241
241
  }
242
- b3 = E.to + 1;
242
+ S3 = O.to + 1;
243
243
  }
244
- if (w < 1e9) for (let e8 = b2; e8 < x.length; e8++) x[e8].indent < x[e8].line.text.length && (x[e8].indent = w);
245
- x.length == b2 + 1 && (x[b2].single = true);
244
+ if (E < 1e9) for (let e8 = S2; e8 < C.length; e8++) C[e8].indent < C[e8].line.text.length && (C[e8].indent = E);
245
+ C.length == S2 + 1 && (C[S2].single = true);
246
246
  }
247
247
  }
248
- if (e6 != 2 && x.some((e7) => e7.comment < 0 && (!e7.empty || e7.single))) {
248
+ if (e6 != 2 && C.some((e7) => e7.comment < 0 && (!e7.empty || e7.single))) {
249
249
  let e7 = [];
250
- for (let { line: y2, token: b3, indent: S2, empty: C, single: w } of x) (w || !C) && e7.push({
251
- from: y2.from + S2,
252
- insert: b3 + " "
250
+ for (let { line: x2, token: S3, indent: w2, empty: T, single: E } of C) (E || !T) && e7.push({
251
+ from: x2.from + w2,
252
+ insert: S3 + " "
253
253
  });
254
- let b2 = y.changes(e7);
254
+ let S2 = x.changes(e7);
255
255
  return {
256
- changes: b2,
257
- selection: y.selection.map(b2, 1)
256
+ changes: S2,
257
+ selection: x.selection.map(S2, 1)
258
258
  };
259
- } else if (e6 != 1 && x.some((e7) => e7.comment >= 0)) {
259
+ } else if (e6 != 1 && C.some((e7) => e7.comment >= 0)) {
260
260
  let e7 = [];
261
- for (let { line: y2, comment: b2, token: S2 } of x) if (b2 >= 0) {
262
- let x2 = y2.from + b2, C = x2 + S2.length;
263
- y2.text[C - y2.from] == " " && C++, e7.push({
264
- from: x2,
265
- to: C
261
+ for (let { line: x2, comment: S2, token: w2 } of C) if (S2 >= 0) {
262
+ let C2 = x2.from + S2, T = C2 + w2.length;
263
+ x2.text[T - x2.from] == " " && T++, e7.push({
264
+ from: C2,
265
+ to: T
266
266
  });
267
267
  }
268
268
  return { changes: e7 };
@@ -273,26 +273,26 @@ var fromHistory = /* @__PURE__ */ Annotation.define(), isolateHistory = /* @__PU
273
273
  return combineConfig(e6, {
274
274
  minDepth: 100,
275
275
  newGroupDelay: 500,
276
- joinToEvent: (e7, y) => y
276
+ joinToEvent: (e7, x) => x
277
277
  }, {
278
278
  minDepth: Math.max,
279
279
  newGroupDelay: Math.min,
280
- joinToEvent: (e7, y) => (b, x) => e7(b, x) || y(b, x)
280
+ joinToEvent: (e7, x) => (S, C) => e7(S, C) || x(S, C)
281
281
  });
282
282
  } }), historyField_ = /* @__PURE__ */ StateField.define({
283
283
  create() {
284
284
  return HistoryState.empty;
285
285
  },
286
- update(e6, y) {
287
- let b = y.state.facet(historyConfig), x = y.annotation(fromHistory);
288
- if (x) {
289
- let S2 = HistEvent.fromTransaction(y, x.selection), C2 = x.side, w2 = C2 == 0 ? e6.undone : e6.done;
290
- return w2 = S2 ? updateBranch(w2, w2.length, b.minDepth, S2) : addSelection(w2, y.startState.selection), new HistoryState(C2 == 0 ? x.rest : w2, C2 == 0 ? w2 : x.rest);
286
+ update(e6, x) {
287
+ let S = x.state.facet(historyConfig), C = x.annotation(fromHistory);
288
+ if (C) {
289
+ let w2 = HistEvent.fromTransaction(x, C.selection), T2 = C.side, E2 = T2 == 0 ? e6.undone : e6.done;
290
+ return E2 = w2 ? updateBranch(E2, E2.length, S.minDepth, w2) : addSelection(E2, x.startState.selection), new HistoryState(T2 == 0 ? C.rest : E2, T2 == 0 ? E2 : C.rest);
291
291
  }
292
- let S = y.annotation(isolateHistory);
293
- if ((S == "full" || S == "before") && (e6 = e6.isolate()), y.annotation(Transaction.addToHistory) === false) return y.changes.empty ? e6 : e6.addMapping(y.changes.desc);
294
- let C = HistEvent.fromTransaction(y), w = y.annotation(Transaction.time), T = y.annotation(Transaction.userEvent);
295
- return C ? e6 = e6.addChanges(C, w, T, b, y) : y.selection && (e6 = e6.addSelection(y.startState.selection, w, T, b.newGroupDelay)), (S == "full" || S == "after") && (e6 = e6.isolate()), e6;
292
+ let w = x.annotation(isolateHistory);
293
+ if ((w == "full" || w == "before") && (e6 = e6.isolate()), x.annotation(Transaction.addToHistory) === false) return x.changes.empty ? e6 : e6.addMapping(x.changes.desc);
294
+ let T = HistEvent.fromTransaction(x), E = x.annotation(Transaction.time), D = x.annotation(Transaction.userEvent);
295
+ return T ? e6 = e6.addChanges(T, E, D, S, x) : x.selection && (e6 = e6.addSelection(x.startState.selection, E, D, S.newGroupDelay)), (w == "full" || w == "after") && (e6 = e6.isolate()), e6;
296
296
  },
297
297
  toJSON(e6) {
298
298
  return {
@@ -308,28 +308,28 @@ function history(e6 = {}) {
308
308
  return [
309
309
  historyField_,
310
310
  historyConfig.of(e6),
311
- EditorView.domEventHandlers({ beforeinput(e7, y) {
312
- let b = e7.inputType == "historyUndo" ? undo : e7.inputType == "historyRedo" ? redo : null;
313
- return b ? (e7.preventDefault(), b(y)) : false;
311
+ EditorView.domEventHandlers({ beforeinput(e7, x) {
312
+ let S = e7.inputType == "historyUndo" ? undo : e7.inputType == "historyRedo" ? redo : null;
313
+ return S ? (e7.preventDefault(), S(x)) : false;
314
314
  } })
315
315
  ];
316
316
  }
317
317
  var historyField = historyField_;
318
- function cmd(e6, y) {
319
- return function({ state: b, dispatch: x }) {
320
- if (!y && b.readOnly) return false;
321
- let S = b.field(historyField_, false);
322
- if (!S) return false;
323
- let C = S.pop(e6, b, y);
324
- return C ? (x(C), true) : false;
318
+ function cmd(e6, x) {
319
+ return function({ state: S, dispatch: C }) {
320
+ if (!x && S.readOnly) return false;
321
+ let w = S.field(historyField_, false);
322
+ if (!w) return false;
323
+ let T = w.pop(e6, S, x);
324
+ return T ? (C(T), true) : false;
325
325
  };
326
326
  }
327
327
  var undo = /* @__PURE__ */ cmd(0, false), redo = /* @__PURE__ */ cmd(1, false), undoSelection = /* @__PURE__ */ cmd(0, true), redoSelection = /* @__PURE__ */ cmd(1, true), HistEvent = class e {
328
- constructor(e6, y, b, x, S) {
329
- this.changes = e6, this.effects = y, this.mapped = b, this.startSelection = x, this.selectionsAfter = S;
328
+ constructor(e6, x, S, C, w) {
329
+ this.changes = e6, this.effects = x, this.mapped = S, this.startSelection = C, this.selectionsAfter = w;
330
330
  }
331
- setSelAfter(y) {
332
- return new e(this.changes, this.effects, this.mapped, this.startSelection, y);
331
+ setSelAfter(x) {
332
+ return new e(this.changes, this.effects, this.mapped, this.startSelection, x);
333
333
  }
334
334
  toJSON() {
335
335
  var _a, _b, _c;
@@ -340,111 +340,111 @@ var undo = /* @__PURE__ */ cmd(0, false), redo = /* @__PURE__ */ cmd(1, false),
340
340
  selectionsAfter: this.selectionsAfter.map((e6) => e6.toJSON())
341
341
  };
342
342
  }
343
- static fromJSON(y) {
344
- return new e(y.changes && ChangeSet.fromJSON(y.changes), [], y.mapped && ChangeDesc.fromJSON(y.mapped), y.startSelection && EditorSelection.fromJSON(y.startSelection), y.selectionsAfter.map(EditorSelection.fromJSON));
343
+ static fromJSON(x) {
344
+ return new e(x.changes && ChangeSet.fromJSON(x.changes), [], x.mapped && ChangeDesc.fromJSON(x.mapped), x.startSelection && EditorSelection.fromJSON(x.startSelection), x.selectionsAfter.map(EditorSelection.fromJSON));
345
345
  }
346
- static fromTransaction(y, b) {
347
- let x = none;
348
- for (let e6 of y.startState.facet(invertedEffects)) {
349
- let b2 = e6(y);
350
- b2.length && (x = x.concat(b2));
346
+ static fromTransaction(x, S) {
347
+ let C = none;
348
+ for (let e6 of x.startState.facet(invertedEffects)) {
349
+ let S2 = e6(x);
350
+ S2.length && (C = C.concat(S2));
351
351
  }
352
- return !x.length && y.changes.empty ? null : new e(y.changes.invert(y.startState.doc), x, void 0, b || y.startState.selection, none);
352
+ return !C.length && x.changes.empty ? null : new e(x.changes.invert(x.startState.doc), C, void 0, S || x.startState.selection, none);
353
353
  }
354
- static selection(y) {
355
- return new e(void 0, none, void 0, void 0, y);
354
+ static selection(x) {
355
+ return new e(void 0, none, void 0, void 0, x);
356
356
  }
357
357
  };
358
- function updateBranch(e6, y, b, x) {
359
- let S = y + 1 > b + 20 ? y - b - 1 : 0, C = e6.slice(S, y);
360
- return C.push(x), C;
358
+ function updateBranch(e6, x, S, C) {
359
+ let w = x + 1 > S + 20 ? x - S - 1 : 0, T = e6.slice(w, x);
360
+ return T.push(C), T;
361
361
  }
362
- function isAdjacent(e6, y) {
363
- let b = [], x = false;
364
- return e6.iterChangedRanges((e7, y2) => b.push(e7, y2)), y.iterChangedRanges((e7, y2, S, C) => {
365
- for (let e8 = 0; e8 < b.length; ) {
366
- let y3 = b[e8++], w = b[e8++];
367
- C >= y3 && S <= w && (x = true);
362
+ function isAdjacent(e6, x) {
363
+ let S = [], C = false;
364
+ return e6.iterChangedRanges((e7, x2) => S.push(e7, x2)), x.iterChangedRanges((e7, x2, w, T) => {
365
+ for (let e8 = 0; e8 < S.length; ) {
366
+ let x3 = S[e8++], E = S[e8++];
367
+ T >= x3 && w <= E && (C = true);
368
368
  }
369
- }), x;
369
+ }), C;
370
370
  }
371
- function eqSelectionShape(e6, y) {
372
- return e6.ranges.length == y.ranges.length && e6.ranges.filter((e7, b) => e7.empty != y.ranges[b].empty).length === 0;
371
+ function eqSelectionShape(e6, x) {
372
+ return e6.ranges.length == x.ranges.length && e6.ranges.filter((e7, S) => e7.empty != x.ranges[S].empty).length === 0;
373
373
  }
374
- function conc(e6, y) {
375
- return e6.length ? y.length ? e6.concat(y) : e6 : y;
374
+ function conc(e6, x) {
375
+ return e6.length ? x.length ? e6.concat(x) : e6 : x;
376
376
  }
377
377
  var none = [], MaxSelectionsPerEvent = 200;
378
- function addSelection(e6, y) {
378
+ function addSelection(e6, x) {
379
379
  if (e6.length) {
380
- let b = e6[e6.length - 1], x = b.selectionsAfter.slice(Math.max(0, b.selectionsAfter.length - MaxSelectionsPerEvent));
381
- return x.length && x[x.length - 1].eq(y) ? e6 : (x.push(y), updateBranch(e6, e6.length - 1, 1e9, b.setSelAfter(x)));
382
- } else return [HistEvent.selection([y])];
380
+ let S = e6[e6.length - 1], C = S.selectionsAfter.slice(Math.max(0, S.selectionsAfter.length - MaxSelectionsPerEvent));
381
+ return C.length && C[C.length - 1].eq(x) ? e6 : (C.push(x), updateBranch(e6, e6.length - 1, 1e9, S.setSelAfter(C)));
382
+ } else return [HistEvent.selection([x])];
383
383
  }
384
384
  function popSelection(e6) {
385
- let y = e6[e6.length - 1], b = e6.slice();
386
- return b[e6.length - 1] = y.setSelAfter(y.selectionsAfter.slice(0, y.selectionsAfter.length - 1)), b;
385
+ let x = e6[e6.length - 1], S = e6.slice();
386
+ return S[e6.length - 1] = x.setSelAfter(x.selectionsAfter.slice(0, x.selectionsAfter.length - 1)), S;
387
387
  }
388
- function addMappingToBranch(e6, y) {
388
+ function addMappingToBranch(e6, x) {
389
389
  if (!e6.length) return e6;
390
- let b = e6.length, x = none;
391
- for (; b; ) {
392
- let S = mapEvent(e6[b - 1], y, x);
393
- if (S.changes && !S.changes.empty || S.effects.length) {
394
- let y2 = e6.slice(0, b);
395
- return y2[b - 1] = S, y2;
396
- } else y = S.mapped, b--, x = S.selectionsAfter;
397
- }
398
- return x.length ? [HistEvent.selection(x)] : none;
390
+ let S = e6.length, C = none;
391
+ for (; S; ) {
392
+ let w = mapEvent(e6[S - 1], x, C);
393
+ if (w.changes && !w.changes.empty || w.effects.length) {
394
+ let x2 = e6.slice(0, S);
395
+ return x2[S - 1] = w, x2;
396
+ } else x = w.mapped, S--, C = w.selectionsAfter;
397
+ }
398
+ return C.length ? [HistEvent.selection(C)] : none;
399
399
  }
400
- function mapEvent(e6, y, b) {
401
- let x = conc(e6.selectionsAfter.length ? e6.selectionsAfter.map((e7) => e7.map(y)) : none, b);
402
- if (!e6.changes) return HistEvent.selection(x);
403
- let S = e6.changes.map(y), C = y.mapDesc(e6.changes, true), w = e6.mapped ? e6.mapped.composeDesc(C) : C;
404
- return new HistEvent(S, StateEffect.mapEffects(e6.effects, y), w, e6.startSelection.map(C), x);
400
+ function mapEvent(e6, x, S) {
401
+ let C = conc(e6.selectionsAfter.length ? e6.selectionsAfter.map((e7) => e7.map(x)) : none, S);
402
+ if (!e6.changes) return HistEvent.selection(C);
403
+ let w = e6.changes.map(x), T = x.mapDesc(e6.changes, true), E = e6.mapped ? e6.mapped.composeDesc(T) : T;
404
+ return new HistEvent(w, StateEffect.mapEffects(e6.effects, x), E, e6.startSelection.map(T), C);
405
405
  }
406
406
  var joinableUserEvent = /^(input\.type|delete)($|\.)/, HistoryState = class e2 {
407
- constructor(e6, y, b = 0, x = void 0) {
408
- this.done = e6, this.undone = y, this.prevTime = b, this.prevUserEvent = x;
407
+ constructor(e6, x, S = 0, C = void 0) {
408
+ this.done = e6, this.undone = x, this.prevTime = S, this.prevUserEvent = C;
409
409
  }
410
410
  isolate() {
411
411
  return this.prevTime ? new e2(this.done, this.undone) : this;
412
412
  }
413
- addChanges(y, b, x, S, C) {
414
- let w = this.done, T = w[w.length - 1];
415
- return w = T && T.changes && !T.changes.empty && y.changes && (!x || joinableUserEvent.test(x)) && (!T.selectionsAfter.length && b - this.prevTime < S.newGroupDelay && S.joinToEvent(C, isAdjacent(T.changes, y.changes)) || x == "input.type.compose") ? updateBranch(w, w.length - 1, S.minDepth, new HistEvent(y.changes.compose(T.changes), conc(StateEffect.mapEffects(y.effects, T.changes), T.effects), T.mapped, T.startSelection, none)) : updateBranch(w, w.length, S.minDepth, y), new e2(w, none, b, x);
413
+ addChanges(x, S, C, w, T) {
414
+ let E = this.done, D = E[E.length - 1];
415
+ return E = D && D.changes && !D.changes.empty && x.changes && (!C || joinableUserEvent.test(C)) && (!D.selectionsAfter.length && S - this.prevTime < w.newGroupDelay && w.joinToEvent(T, isAdjacent(D.changes, x.changes)) || C == "input.type.compose") ? updateBranch(E, E.length - 1, w.minDepth, new HistEvent(x.changes.compose(D.changes), conc(StateEffect.mapEffects(x.effects, D.changes), D.effects), D.mapped, D.startSelection, none)) : updateBranch(E, E.length, w.minDepth, x), new e2(E, none, S, C);
416
416
  }
417
- addSelection(y, b, x, S) {
418
- let C = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;
419
- return C.length > 0 && b - this.prevTime < S && x == this.prevUserEvent && x && /^select($|\.)/.test(x) && eqSelectionShape(C[C.length - 1], y) ? this : new e2(addSelection(this.done, y), this.undone, b, x);
417
+ addSelection(x, S, C, w) {
418
+ let T = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;
419
+ return T.length > 0 && S - this.prevTime < w && C == this.prevUserEvent && C && /^select($|\.)/.test(C) && eqSelectionShape(T[T.length - 1], x) ? this : new e2(addSelection(this.done, x), this.undone, S, C);
420
420
  }
421
- addMapping(y) {
422
- return new e2(addMappingToBranch(this.done, y), addMappingToBranch(this.undone, y), this.prevTime, this.prevUserEvent);
421
+ addMapping(x) {
422
+ return new e2(addMappingToBranch(this.done, x), addMappingToBranch(this.undone, x), this.prevTime, this.prevUserEvent);
423
423
  }
424
- pop(e6, y, b) {
425
- let x = e6 == 0 ? this.done : this.undone;
426
- if (x.length == 0) return null;
427
- let S = x[x.length - 1], C = S.selectionsAfter[0] || y.selection;
428
- if (b && S.selectionsAfter.length) return y.update({
429
- selection: S.selectionsAfter[S.selectionsAfter.length - 1],
424
+ pop(e6, x, S) {
425
+ let C = e6 == 0 ? this.done : this.undone;
426
+ if (C.length == 0) return null;
427
+ let w = C[C.length - 1], T = w.selectionsAfter[0] || x.selection;
428
+ if (S && w.selectionsAfter.length) return x.update({
429
+ selection: w.selectionsAfter[w.selectionsAfter.length - 1],
430
430
  annotations: fromHistory.of({
431
431
  side: e6,
432
- rest: popSelection(x),
433
- selection: C
432
+ rest: popSelection(C),
433
+ selection: T
434
434
  }),
435
435
  userEvent: e6 == 0 ? "select.undo" : "select.redo",
436
436
  scrollIntoView: true
437
437
  });
438
- if (S.changes) {
439
- let b2 = x.length == 1 ? none : x.slice(0, x.length - 1);
440
- return S.mapped && (b2 = addMappingToBranch(b2, S.mapped)), y.update({
441
- changes: S.changes,
442
- selection: S.startSelection,
443
- effects: S.effects,
438
+ if (w.changes) {
439
+ let S2 = C.length == 1 ? none : C.slice(0, C.length - 1);
440
+ return w.mapped && (S2 = addMappingToBranch(S2, w.mapped)), x.update({
441
+ changes: w.changes,
442
+ selection: w.startSelection,
443
+ effects: w.effects,
444
444
  annotations: fromHistory.of({
445
445
  side: e6,
446
- rest: b2,
447
- selection: C
446
+ rest: S2,
447
+ selection: T
448
448
  }),
449
449
  filter: false,
450
450
  userEvent: e6 == 0 ? "undo" : "redo",
@@ -483,244 +483,244 @@ var historyKeymap = [
483
483
  preventDefault: true
484
484
  }
485
485
  ];
486
- function updateSel(e6, y) {
487
- return EditorSelection.create(e6.ranges.map(y), e6.mainIndex);
486
+ function updateSel(e6, x) {
487
+ return EditorSelection.create(e6.ranges.map(x), e6.mainIndex);
488
488
  }
489
- function setSel(e6, y) {
489
+ function setSel(e6, x) {
490
490
  return e6.update({
491
- selection: y,
491
+ selection: x,
492
492
  scrollIntoView: true,
493
493
  userEvent: "select"
494
494
  });
495
495
  }
496
- function moveSel({ state: e6, dispatch: y }, b) {
497
- let x = updateSel(e6.selection, b);
498
- return x.eq(e6.selection, true) ? false : (y(setSel(e6, x)), true);
496
+ function moveSel({ state: e6, dispatch: x }, S) {
497
+ let C = updateSel(e6.selection, S);
498
+ return C.eq(e6.selection, true) ? false : (x(setSel(e6, C)), true);
499
499
  }
500
- function rangeEnd(e6, y) {
501
- return EditorSelection.cursor(y ? e6.to : e6.from);
500
+ function rangeEnd(e6, x) {
501
+ return EditorSelection.cursor(x ? e6.to : e6.from);
502
502
  }
503
- function cursorByChar(e6, y) {
504
- return moveSel(e6, (b) => b.empty ? e6.moveByChar(b, y) : rangeEnd(b, y));
503
+ function cursorByChar(e6, x) {
504
+ return moveSel(e6, (S) => S.empty ? e6.moveByChar(S, x) : rangeEnd(S, x));
505
505
  }
506
506
  function ltrAtCursor(e6) {
507
507
  return e6.textDirectionAt(e6.state.selection.main.head) == Direction.LTR;
508
508
  }
509
509
  var cursorCharLeft = (e6) => cursorByChar(e6, !ltrAtCursor(e6)), cursorCharRight = (e6) => cursorByChar(e6, ltrAtCursor(e6));
510
- function cursorByGroup(e6, y) {
511
- return moveSel(e6, (b) => b.empty ? e6.moveByGroup(b, y) : rangeEnd(b, y));
510
+ function cursorByGroup(e6, x) {
511
+ return moveSel(e6, (S) => S.empty ? e6.moveByGroup(S, x) : rangeEnd(S, x));
512
512
  }
513
513
  var cursorGroupLeft = (e6) => cursorByGroup(e6, !ltrAtCursor(e6)), cursorGroupRight = (e6) => cursorByGroup(e6, ltrAtCursor(e6));
514
514
  typeof Intl < "u" && Intl.Segmenter;
515
- function interestingNode(e6, y, b) {
516
- if (y.type.prop(b)) return true;
517
- let x = y.to - y.from;
518
- return x && (x > 2 || /[^\s,.;:]/.test(e6.sliceDoc(y.from, y.to))) || y.firstChild;
515
+ function interestingNode(e6, x, S) {
516
+ if (x.type.prop(S)) return true;
517
+ let C = x.to - x.from;
518
+ return C && (C > 2 || /[^\s,.;:]/.test(e6.sliceDoc(x.from, x.to))) || x.firstChild;
519
519
  }
520
- function moveBySyntax(e6, y, b) {
521
- let x = syntaxTree(e6).resolveInner(y.head), S = b ? NodeProp.closedBy : NodeProp.openedBy;
522
- for (let C2 = y.head; ; ) {
523
- let y2 = b ? x.childAfter(C2) : x.childBefore(C2);
524
- if (!y2) break;
525
- interestingNode(e6, y2, S) ? x = y2 : C2 = b ? y2.to : y2.from;
526
- }
527
- let C = x.type.prop(S), w, T;
528
- return T = C && (w = b ? matchBrackets(e6, x.from, 1) : matchBrackets(e6, x.to, -1)) && w.matched ? b ? w.end.to : w.end.from : b ? x.to : x.from, EditorSelection.cursor(T, b ? -1 : 1);
520
+ function moveBySyntax(e6, x, S) {
521
+ let C = syntaxTree(e6).resolveInner(x.head), w = S ? NodeProp.closedBy : NodeProp.openedBy;
522
+ for (let T2 = x.head; ; ) {
523
+ let x2 = S ? C.childAfter(T2) : C.childBefore(T2);
524
+ if (!x2) break;
525
+ interestingNode(e6, x2, w) ? C = x2 : T2 = S ? x2.to : x2.from;
526
+ }
527
+ let T = C.type.prop(w), E, D;
528
+ return D = T && (E = S ? matchBrackets(e6, C.from, 1) : matchBrackets(e6, C.to, -1)) && E.matched ? S ? E.end.to : E.end.from : S ? C.to : C.from, EditorSelection.cursor(D, S ? -1 : 1);
529
529
  }
530
- var cursorSyntaxLeft = (e6) => moveSel(e6, (y) => moveBySyntax(e6.state, y, !ltrAtCursor(e6))), cursorSyntaxRight = (e6) => moveSel(e6, (y) => moveBySyntax(e6.state, y, ltrAtCursor(e6)));
531
- function cursorByLine(e6, y) {
532
- return moveSel(e6, (b) => {
533
- if (!b.empty) return rangeEnd(b, y);
534
- let x = e6.moveVertically(b, y);
535
- return x.head == b.head ? e6.moveToLineBoundary(b, y) : x;
530
+ var cursorSyntaxLeft = (e6) => moveSel(e6, (x) => moveBySyntax(e6.state, x, !ltrAtCursor(e6))), cursorSyntaxRight = (e6) => moveSel(e6, (x) => moveBySyntax(e6.state, x, ltrAtCursor(e6)));
531
+ function cursorByLine(e6, x) {
532
+ return moveSel(e6, (S) => {
533
+ if (!S.empty) return rangeEnd(S, x);
534
+ let C = e6.moveVertically(S, x);
535
+ return C.head == S.head ? e6.moveToLineBoundary(S, x) : C;
536
536
  });
537
537
  }
538
538
  var cursorLineUp = (e6) => cursorByLine(e6, false), cursorLineDown = (e6) => cursorByLine(e6, true);
539
539
  function pageInfo(e6) {
540
- let y = e6.scrollDOM.clientHeight < e6.scrollDOM.scrollHeight - 2, b = 0, x = 0, S;
541
- if (y) {
542
- for (let y2 of e6.state.facet(EditorView.scrollMargins)) {
543
- let S2 = y2(e6);
544
- (S2 == null ? void 0 : S2.top) && (b = Math.max(S2 == null ? void 0 : S2.top, b)), (S2 == null ? void 0 : S2.bottom) && (x = Math.max(S2 == null ? void 0 : S2.bottom, x));
540
+ let x = e6.scrollDOM.clientHeight < e6.scrollDOM.scrollHeight - 2, S = 0, C = 0, w;
541
+ if (x) {
542
+ for (let x2 of e6.state.facet(EditorView.scrollMargins)) {
543
+ let w2 = x2(e6);
544
+ (w2 == null ? void 0 : w2.top) && (S = Math.max(w2 == null ? void 0 : w2.top, S)), (w2 == null ? void 0 : w2.bottom) && (C = Math.max(w2 == null ? void 0 : w2.bottom, C));
545
545
  }
546
- S = e6.scrollDOM.clientHeight - b - x;
547
- } else S = (e6.dom.ownerDocument.defaultView || window).innerHeight;
546
+ w = e6.scrollDOM.clientHeight - S - C;
547
+ } else w = (e6.dom.ownerDocument.defaultView || window).innerHeight;
548
548
  return {
549
- marginTop: b,
550
- marginBottom: x,
551
- selfScroll: y,
552
- height: Math.max(e6.defaultLineHeight, S - 5)
549
+ marginTop: S,
550
+ marginBottom: C,
551
+ selfScroll: x,
552
+ height: Math.max(e6.defaultLineHeight, w - 5)
553
553
  };
554
554
  }
555
- function cursorByPage(e6, y) {
556
- let b = pageInfo(e6), { state: x } = e6, S = updateSel(x.selection, (x2) => x2.empty ? e6.moveVertically(x2, y, b.height) : rangeEnd(x2, y));
557
- if (S.eq(x.selection)) return false;
558
- let C;
559
- if (b.selfScroll) {
560
- let y2 = e6.coordsAtPos(x.selection.main.head), w = e6.scrollDOM.getBoundingClientRect(), T = w.top + b.marginTop, E = w.bottom - b.marginBottom;
561
- y2 && y2.top > T && y2.bottom < E && (C = EditorView.scrollIntoView(S.main.head, {
555
+ function cursorByPage(e6, x) {
556
+ let S = pageInfo(e6), { state: C } = e6, w = updateSel(C.selection, (C2) => C2.empty ? e6.moveVertically(C2, x, S.height) : rangeEnd(C2, x));
557
+ if (w.eq(C.selection)) return false;
558
+ let T;
559
+ if (S.selfScroll) {
560
+ let x2 = e6.coordsAtPos(C.selection.main.head), E = e6.scrollDOM.getBoundingClientRect(), D = E.top + S.marginTop, O = E.bottom - S.marginBottom;
561
+ x2 && x2.top > D && x2.bottom < O && (T = EditorView.scrollIntoView(w.main.head, {
562
562
  y: "start",
563
- yMargin: y2.top - T
563
+ yMargin: x2.top - D
564
564
  }));
565
565
  }
566
- return e6.dispatch(setSel(x, S), { effects: C }), true;
566
+ return e6.dispatch(setSel(C, w), { effects: T }), true;
567
567
  }
568
568
  var cursorPageUp = (e6) => cursorByPage(e6, false), cursorPageDown = (e6) => cursorByPage(e6, true);
569
- function moveByLineBoundary(e6, y, b) {
570
- let x = e6.lineBlockAt(y.head), S = e6.moveToLineBoundary(y, b);
571
- if (S.head == y.head && S.head != (b ? x.to : x.from) && (S = e6.moveToLineBoundary(y, b, false)), !b && S.head == x.from && x.length) {
572
- let b2 = /^\s*/.exec(e6.state.sliceDoc(x.from, Math.min(x.from + 100, x.to)))[0].length;
573
- b2 && y.head != x.from + b2 && (S = EditorSelection.cursor(x.from + b2));
569
+ function moveByLineBoundary(e6, x, S) {
570
+ let C = e6.lineBlockAt(x.head), w = e6.moveToLineBoundary(x, S);
571
+ if (w.head == x.head && w.head != (S ? C.to : C.from) && (w = e6.moveToLineBoundary(x, S, false)), !S && w.head == C.from && C.length) {
572
+ let S2 = /^\s*/.exec(e6.state.sliceDoc(C.from, Math.min(C.from + 100, C.to)))[0].length;
573
+ S2 && x.head != C.from + S2 && (w = EditorSelection.cursor(C.from + S2));
574
574
  }
575
- return S;
575
+ return w;
576
576
  }
577
- var cursorLineBoundaryForward = (e6) => moveSel(e6, (y) => moveByLineBoundary(e6, y, true)), cursorLineBoundaryBackward = (e6) => moveSel(e6, (y) => moveByLineBoundary(e6, y, false)), cursorLineBoundaryLeft = (e6) => moveSel(e6, (y) => moveByLineBoundary(e6, y, !ltrAtCursor(e6))), cursorLineBoundaryRight = (e6) => moveSel(e6, (y) => moveByLineBoundary(e6, y, ltrAtCursor(e6))), cursorLineStart = (e6) => moveSel(e6, (y) => EditorSelection.cursor(e6.lineBlockAt(y.head).from, 1)), cursorLineEnd = (e6) => moveSel(e6, (y) => EditorSelection.cursor(e6.lineBlockAt(y.head).to, -1));
578
- function toMatchingBracket(e6, y, b) {
579
- let x = false, S = updateSel(e6.selection, (y2) => {
580
- let S2 = matchBrackets(e6, y2.head, -1) || matchBrackets(e6, y2.head, 1) || y2.head > 0 && matchBrackets(e6, y2.head - 1, 1) || y2.head < e6.doc.length && matchBrackets(e6, y2.head + 1, -1);
581
- if (!S2 || !S2.end) return y2;
582
- x = true;
583
- let C = S2.start.from == y2.head ? S2.end.to : S2.end.from;
584
- return b ? EditorSelection.range(y2.anchor, C) : EditorSelection.cursor(C);
577
+ var cursorLineBoundaryForward = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, true)), cursorLineBoundaryBackward = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, false)), cursorLineBoundaryLeft = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, !ltrAtCursor(e6))), cursorLineBoundaryRight = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, ltrAtCursor(e6))), cursorLineStart = (e6) => moveSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).from, 1)), cursorLineEnd = (e6) => moveSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).to, -1));
578
+ function toMatchingBracket(e6, x, S) {
579
+ let C = false, w = updateSel(e6.selection, (x2) => {
580
+ let w2 = matchBrackets(e6, x2.head, -1) || matchBrackets(e6, x2.head, 1) || x2.head > 0 && matchBrackets(e6, x2.head - 1, 1) || x2.head < e6.doc.length && matchBrackets(e6, x2.head + 1, -1);
581
+ if (!w2 || !w2.end) return x2;
582
+ C = true;
583
+ let T = w2.start.from == x2.head ? w2.end.to : w2.end.from;
584
+ return S ? EditorSelection.range(x2.anchor, T) : EditorSelection.cursor(T);
585
585
  });
586
- return x ? (y(setSel(e6, S)), true) : false;
586
+ return C ? (x(setSel(e6, w)), true) : false;
587
587
  }
588
- var cursorMatchingBracket = ({ state: e6, dispatch: y }) => toMatchingBracket(e6, y, false);
589
- function extendSel(e6, y) {
590
- let b = updateSel(e6.state.selection, (e7) => {
591
- let b2 = y(e7);
592
- return EditorSelection.range(e7.anchor, b2.head, b2.goalColumn, b2.bidiLevel || void 0);
588
+ var cursorMatchingBracket = ({ state: e6, dispatch: x }) => toMatchingBracket(e6, x, false);
589
+ function extendSel(e6, x) {
590
+ let S = updateSel(e6.state.selection, (e7) => {
591
+ let S2 = x(e7);
592
+ return EditorSelection.range(e7.anchor, S2.head, S2.goalColumn, S2.bidiLevel || void 0);
593
593
  });
594
- return b.eq(e6.state.selection) ? false : (e6.dispatch(setSel(e6.state, b)), true);
594
+ return S.eq(e6.state.selection) ? false : (e6.dispatch(setSel(e6.state, S)), true);
595
595
  }
596
- function selectByChar(e6, y) {
597
- return extendSel(e6, (b) => e6.moveByChar(b, y));
596
+ function selectByChar(e6, x) {
597
+ return extendSel(e6, (S) => e6.moveByChar(S, x));
598
598
  }
599
599
  var selectCharLeft = (e6) => selectByChar(e6, !ltrAtCursor(e6)), selectCharRight = (e6) => selectByChar(e6, ltrAtCursor(e6));
600
- function selectByGroup(e6, y) {
601
- return extendSel(e6, (b) => e6.moveByGroup(b, y));
600
+ function selectByGroup(e6, x) {
601
+ return extendSel(e6, (S) => e6.moveByGroup(S, x));
602
602
  }
603
- var selectGroupLeft = (e6) => selectByGroup(e6, !ltrAtCursor(e6)), selectGroupRight = (e6) => selectByGroup(e6, ltrAtCursor(e6)), selectSyntaxLeft = (e6) => extendSel(e6, (y) => moveBySyntax(e6.state, y, !ltrAtCursor(e6))), selectSyntaxRight = (e6) => extendSel(e6, (y) => moveBySyntax(e6.state, y, ltrAtCursor(e6)));
604
- function selectByLine(e6, y) {
605
- return extendSel(e6, (b) => e6.moveVertically(b, y));
603
+ var selectGroupLeft = (e6) => selectByGroup(e6, !ltrAtCursor(e6)), selectGroupRight = (e6) => selectByGroup(e6, ltrAtCursor(e6)), selectSyntaxLeft = (e6) => extendSel(e6, (x) => moveBySyntax(e6.state, x, !ltrAtCursor(e6))), selectSyntaxRight = (e6) => extendSel(e6, (x) => moveBySyntax(e6.state, x, ltrAtCursor(e6)));
604
+ function selectByLine(e6, x) {
605
+ return extendSel(e6, (S) => e6.moveVertically(S, x));
606
606
  }
607
607
  var selectLineUp = (e6) => selectByLine(e6, false), selectLineDown = (e6) => selectByLine(e6, true);
608
- function selectByPage(e6, y) {
609
- return extendSel(e6, (b) => e6.moveVertically(b, y, pageInfo(e6).height));
608
+ function selectByPage(e6, x) {
609
+ return extendSel(e6, (S) => e6.moveVertically(S, x, pageInfo(e6).height));
610
610
  }
611
- var selectPageUp = (e6) => selectByPage(e6, false), selectPageDown = (e6) => selectByPage(e6, true), selectLineBoundaryForward = (e6) => extendSel(e6, (y) => moveByLineBoundary(e6, y, true)), selectLineBoundaryBackward = (e6) => extendSel(e6, (y) => moveByLineBoundary(e6, y, false)), selectLineBoundaryLeft = (e6) => extendSel(e6, (y) => moveByLineBoundary(e6, y, !ltrAtCursor(e6))), selectLineBoundaryRight = (e6) => extendSel(e6, (y) => moveByLineBoundary(e6, y, ltrAtCursor(e6))), selectLineStart = (e6) => extendSel(e6, (y) => EditorSelection.cursor(e6.lineBlockAt(y.head).from)), selectLineEnd = (e6) => extendSel(e6, (y) => EditorSelection.cursor(e6.lineBlockAt(y.head).to)), cursorDocStart = ({ state: e6, dispatch: y }) => (y(setSel(e6, { anchor: 0 })), true), cursorDocEnd = ({ state: e6, dispatch: y }) => (y(setSel(e6, { anchor: e6.doc.length })), true), selectDocStart = ({ state: e6, dispatch: y }) => (y(setSel(e6, {
611
+ var selectPageUp = (e6) => selectByPage(e6, false), selectPageDown = (e6) => selectByPage(e6, true), selectLineBoundaryForward = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, true)), selectLineBoundaryBackward = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, false)), selectLineBoundaryLeft = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, !ltrAtCursor(e6))), selectLineBoundaryRight = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, ltrAtCursor(e6))), selectLineStart = (e6) => extendSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).from)), selectLineEnd = (e6) => extendSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).to)), cursorDocStart = ({ state: e6, dispatch: x }) => (x(setSel(e6, { anchor: 0 })), true), cursorDocEnd = ({ state: e6, dispatch: x }) => (x(setSel(e6, { anchor: e6.doc.length })), true), selectDocStart = ({ state: e6, dispatch: x }) => (x(setSel(e6, {
612
612
  anchor: e6.selection.main.anchor,
613
613
  head: 0
614
- })), true), selectDocEnd = ({ state: e6, dispatch: y }) => (y(setSel(e6, {
614
+ })), true), selectDocEnd = ({ state: e6, dispatch: x }) => (x(setSel(e6, {
615
615
  anchor: e6.selection.main.anchor,
616
616
  head: e6.doc.length
617
- })), true), selectAll = ({ state: e6, dispatch: y }) => (y(e6.update({
617
+ })), true), selectAll = ({ state: e6, dispatch: x }) => (x(e6.update({
618
618
  selection: {
619
619
  anchor: 0,
620
620
  head: e6.doc.length
621
621
  },
622
622
  userEvent: "select"
623
- })), true), selectLine = ({ state: e6, dispatch: y }) => {
624
- let b = selectedLineBlocks(e6).map(({ from: y2, to: b2 }) => EditorSelection.range(y2, Math.min(b2 + 1, e6.doc.length)));
625
- return y(e6.update({
626
- selection: EditorSelection.create(b),
623
+ })), true), selectLine = ({ state: e6, dispatch: x }) => {
624
+ let S = selectedLineBlocks(e6).map(({ from: x2, to: S2 }) => EditorSelection.range(x2, Math.min(S2 + 1, e6.doc.length)));
625
+ return x(e6.update({
626
+ selection: EditorSelection.create(S),
627
627
  userEvent: "select"
628
628
  })), true;
629
- }, selectParentSyntax = ({ state: e6, dispatch: y }) => {
630
- let b = updateSel(e6.selection, (y2) => {
631
- let b2 = syntaxTree(e6), x = b2.resolveStack(y2.from, 1);
632
- if (y2.empty) {
633
- let e7 = b2.resolveStack(y2.from, -1);
634
- e7.node.from >= x.node.from && e7.node.to <= x.node.to && (x = e7);
629
+ }, selectParentSyntax = ({ state: e6, dispatch: x }) => {
630
+ let S = updateSel(e6.selection, (x2) => {
631
+ let S2 = syntaxTree(e6), C = S2.resolveStack(x2.from, 1);
632
+ if (x2.empty) {
633
+ let e7 = S2.resolveStack(x2.from, -1);
634
+ e7.node.from >= C.node.from && e7.node.to <= C.node.to && (C = e7);
635
635
  }
636
- for (let e7 = x; e7; e7 = e7.next) {
637
- let { node: b3 } = e7;
638
- if ((b3.from < y2.from && b3.to >= y2.to || b3.to > y2.to && b3.from <= y2.from) && e7.next) return EditorSelection.range(b3.to, b3.from);
636
+ for (let e7 = C; e7; e7 = e7.next) {
637
+ let { node: S3 } = e7;
638
+ if ((S3.from < x2.from && S3.to >= x2.to || S3.to > x2.to && S3.from <= x2.from) && e7.next) return EditorSelection.range(S3.to, S3.from);
639
639
  }
640
- return y2;
640
+ return x2;
641
641
  });
642
- return b.eq(e6.selection) ? false : (y(setSel(e6, b)), true);
642
+ return S.eq(e6.selection) ? false : (x(setSel(e6, S)), true);
643
643
  };
644
- function addCursorVertically(e6, y) {
645
- let { state: b } = e6, x = b.selection, S = b.selection.ranges.slice();
646
- for (let x2 of b.selection.ranges) {
647
- let C = b.doc.lineAt(x2.head);
648
- if (y ? C.to < e6.state.doc.length : C.from > 0) for (let b2 = x2; ; ) {
649
- let x3 = e6.moveVertically(b2, y);
650
- if (x3.head < C.from || x3.head > C.to) {
651
- S.some((e7) => e7.head == x3.head) || S.push(x3);
644
+ function addCursorVertically(e6, x) {
645
+ let { state: S } = e6, C = S.selection, w = S.selection.ranges.slice();
646
+ for (let C2 of S.selection.ranges) {
647
+ let T = S.doc.lineAt(C2.head);
648
+ if (x ? T.to < e6.state.doc.length : T.from > 0) for (let S2 = C2; ; ) {
649
+ let C3 = e6.moveVertically(S2, x);
650
+ if (C3.head < T.from || C3.head > T.to) {
651
+ w.some((e7) => e7.head == C3.head) || w.push(C3);
652
652
  break;
653
- } else if (x3.head == b2.head) break;
654
- else b2 = x3;
653
+ } else if (C3.head == S2.head) break;
654
+ else S2 = C3;
655
655
  }
656
656
  }
657
- return S.length == x.ranges.length ? false : (e6.dispatch(setSel(b, EditorSelection.create(S, S.length - 1))), true);
657
+ return w.length == C.ranges.length ? false : (e6.dispatch(setSel(S, EditorSelection.create(w, w.length - 1))), true);
658
658
  }
659
- var addCursorAbove = (e6) => addCursorVertically(e6, false), addCursorBelow = (e6) => addCursorVertically(e6, true), simplifySelection = ({ state: e6, dispatch: y }) => {
660
- let b = e6.selection, x = null;
661
- return b.ranges.length > 1 ? x = EditorSelection.create([b.main]) : b.main.empty || (x = EditorSelection.create([EditorSelection.cursor(b.main.head)])), x ? (y(setSel(e6, x)), true) : false;
659
+ var addCursorAbove = (e6) => addCursorVertically(e6, false), addCursorBelow = (e6) => addCursorVertically(e6, true), simplifySelection = ({ state: e6, dispatch: x }) => {
660
+ let S = e6.selection, C = null;
661
+ return S.ranges.length > 1 ? C = EditorSelection.create([S.main]) : S.main.empty || (C = EditorSelection.create([EditorSelection.cursor(S.main.head)])), C ? (x(setSel(e6, C)), true) : false;
662
662
  };
663
- function deleteBy(e6, y) {
663
+ function deleteBy(e6, x) {
664
664
  if (e6.state.readOnly) return false;
665
- let b = "delete.selection", { state: x } = e6, S = x.changeByRange((x2) => {
666
- let { from: S2, to: C } = x2;
667
- if (S2 == C) {
668
- let w = y(x2);
669
- w < S2 ? (b = "delete.backward", w = skipAtomic(e6, w, false)) : w > S2 && (b = "delete.forward", w = skipAtomic(e6, w, true)), S2 = Math.min(S2, w), C = Math.max(C, w);
670
- } else S2 = skipAtomic(e6, S2, false), C = skipAtomic(e6, C, true);
671
- return S2 == C ? { range: x2 } : {
665
+ let S = "delete.selection", { state: C } = e6, w = C.changeByRange((C2) => {
666
+ let { from: w2, to: T } = C2;
667
+ if (w2 == T) {
668
+ let E = x(C2);
669
+ E < w2 ? (S = "delete.backward", E = skipAtomic(e6, E, false)) : E > w2 && (S = "delete.forward", E = skipAtomic(e6, E, true)), w2 = Math.min(w2, E), T = Math.max(T, E);
670
+ } else w2 = skipAtomic(e6, w2, false), T = skipAtomic(e6, T, true);
671
+ return w2 == T ? { range: C2 } : {
672
672
  changes: {
673
- from: S2,
674
- to: C
673
+ from: w2,
674
+ to: T
675
675
  },
676
- range: EditorSelection.cursor(S2, S2 < x2.head ? -1 : 1)
676
+ range: EditorSelection.cursor(w2, w2 < C2.head ? -1 : 1)
677
677
  };
678
678
  });
679
- return S.changes.empty ? false : (e6.dispatch(x.update(S, {
679
+ return w.changes.empty ? false : (e6.dispatch(C.update(w, {
680
680
  scrollIntoView: true,
681
- userEvent: b,
682
- effects: b == "delete.selection" ? EditorView.announce.of(x.phrase("Selection deleted")) : void 0
681
+ userEvent: S,
682
+ effects: S == "delete.selection" ? EditorView.announce.of(C.phrase("Selection deleted")) : void 0
683
683
  })), true);
684
684
  }
685
- function skipAtomic(e6, y, b) {
686
- if (e6 instanceof EditorView) for (let x of e6.state.facet(EditorView.atomicRanges).map((y2) => y2(e6))) x.between(y, y, (e7, x2) => {
687
- e7 < y && x2 > y && (y = b ? x2 : e7);
685
+ function skipAtomic(e6, x, S) {
686
+ if (e6 instanceof EditorView) for (let C of e6.state.facet(EditorView.atomicRanges).map((x2) => x2(e6))) C.between(x, x, (e7, C2) => {
687
+ e7 < x && C2 > x && (x = S ? C2 : e7);
688
688
  });
689
- return y;
689
+ return x;
690
690
  }
691
- var deleteByChar = (e6, y, b) => deleteBy(e6, (x) => {
692
- let S = x.from, { state: C } = e6, w = C.doc.lineAt(S), T, E;
693
- if (b && !y && S > w.from && S < w.from + 200 && !/[^ \t]/.test(T = w.text.slice(0, S - w.from))) {
694
- if (T[T.length - 1] == " ") return S - 1;
695
- let e7 = countColumn(T, C.tabSize) % getIndentUnit(C) || getIndentUnit(C);
696
- for (let y2 = 0; y2 < e7 && T[T.length - 1 - y2] == " "; y2++) S--;
697
- E = S;
698
- } else E = findClusterBreak(w.text, S - w.from, y, y) + w.from, E == S && w.number != (y ? C.doc.lines : 1) ? E += y ? 1 : -1 : !y && /[\ufe00-\ufe0f]/.test(w.text.slice(E - w.from, S - w.from)) && (E = findClusterBreak(w.text, E - w.from, false, false) + w.from);
699
- return E;
700
- }), deleteCharBackward = (e6) => deleteByChar(e6, false, true), deleteCharForward = (e6) => deleteByChar(e6, true, false), deleteByGroup = (e6, y) => deleteBy(e6, (b) => {
701
- let x = b.head, { state: S } = e6, C = S.doc.lineAt(x), w = S.charCategorizer(x);
691
+ var deleteByChar = (e6, x, S) => deleteBy(e6, (C) => {
692
+ let w = C.from, { state: T } = e6, E = T.doc.lineAt(w), D, O;
693
+ if (S && !x && w > E.from && w < E.from + 200 && !/[^ \t]/.test(D = E.text.slice(0, w - E.from))) {
694
+ if (D[D.length - 1] == " ") return w - 1;
695
+ let e7 = countColumn(D, T.tabSize) % getIndentUnit(T) || getIndentUnit(T);
696
+ for (let x2 = 0; x2 < e7 && D[D.length - 1 - x2] == " "; x2++) w--;
697
+ O = w;
698
+ } else O = findClusterBreak(E.text, w - E.from, x, x) + E.from, O == w && E.number != (x ? T.doc.lines : 1) ? O += x ? 1 : -1 : !x && /[\ufe00-\ufe0f]/.test(E.text.slice(O - E.from, w - E.from)) && (O = findClusterBreak(E.text, O - E.from, false, false) + E.from);
699
+ return O;
700
+ }), deleteCharBackward = (e6) => deleteByChar(e6, false, true), deleteCharForward = (e6) => deleteByChar(e6, true, false), deleteByGroup = (e6, x) => deleteBy(e6, (S) => {
701
+ let C = S.head, { state: w } = e6, T = w.doc.lineAt(C), E = w.charCategorizer(C);
702
702
  for (let e7 = null; ; ) {
703
- if (x == (y ? C.to : C.from)) {
704
- x == b.head && C.number != (y ? S.doc.lines : 1) && (x += y ? 1 : -1);
703
+ if (C == (x ? T.to : T.from)) {
704
+ C == S.head && T.number != (x ? w.doc.lines : 1) && (C += x ? 1 : -1);
705
705
  break;
706
706
  }
707
- let T = findClusterBreak(C.text, x - C.from, y) + C.from, E = C.text.slice(Math.min(x, T) - C.from, Math.max(x, T) - C.from), D = w(E);
708
- if (e7 != null && D != e7) break;
709
- (E != " " || x != b.head) && (e7 = D), x = T;
710
- }
711
- return x;
712
- }), deleteGroupBackward = (e6) => deleteByGroup(e6, false), deleteGroupForward = (e6) => deleteByGroup(e6, true), deleteToLineEnd = (e6) => deleteBy(e6, (y) => {
713
- let b = e6.lineBlockAt(y.head).to;
714
- return y.head < b ? b : Math.min(e6.state.doc.length, y.head + 1);
715
- }), deleteLineBoundaryBackward = (e6) => deleteBy(e6, (y) => {
716
- let b = e6.moveToLineBoundary(y, false).head;
717
- return y.head > b ? b : Math.max(0, y.head - 1);
718
- }), deleteLineBoundaryForward = (e6) => deleteBy(e6, (y) => {
719
- let b = e6.moveToLineBoundary(y, true).head;
720
- return y.head < b ? b : Math.min(e6.state.doc.length, y.head + 1);
721
- }), splitLine = ({ state: e6, dispatch: y }) => {
707
+ let D = findClusterBreak(T.text, C - T.from, x) + T.from, O = T.text.slice(Math.min(C, D) - T.from, Math.max(C, D) - T.from), k = E(O);
708
+ if (e7 != null && k != e7) break;
709
+ (O != " " || C != S.head) && (e7 = k), C = D;
710
+ }
711
+ return C;
712
+ }), deleteGroupBackward = (e6) => deleteByGroup(e6, false), deleteGroupForward = (e6) => deleteByGroup(e6, true), deleteToLineEnd = (e6) => deleteBy(e6, (x) => {
713
+ let S = e6.lineBlockAt(x.head).to;
714
+ return x.head < S ? S : Math.min(e6.state.doc.length, x.head + 1);
715
+ }), deleteLineBoundaryBackward = (e6) => deleteBy(e6, (x) => {
716
+ let S = e6.moveToLineBoundary(x, false).head;
717
+ return x.head > S ? S : Math.max(0, x.head - 1);
718
+ }), deleteLineBoundaryForward = (e6) => deleteBy(e6, (x) => {
719
+ let S = e6.moveToLineBoundary(x, true).head;
720
+ return x.head < S ? S : Math.min(e6.state.doc.length, x.head + 1);
721
+ }), splitLine = ({ state: e6, dispatch: x }) => {
722
722
  if (e6.readOnly) return false;
723
- let b = e6.changeByRange((e7) => ({
723
+ let S = e6.changeByRange((e7) => ({
724
724
  changes: {
725
725
  from: e7.from,
726
726
  to: e7.to,
@@ -728,203 +728,203 @@ var deleteByChar = (e6, y, b) => deleteBy(e6, (x) => {
728
728
  },
729
729
  range: EditorSelection.cursor(e7.from)
730
730
  }));
731
- return y(e6.update(b, {
731
+ return x(e6.update(S, {
732
732
  scrollIntoView: true,
733
733
  userEvent: "input"
734
734
  })), true;
735
- }, transposeChars = ({ state: e6, dispatch: y }) => {
735
+ }, transposeChars = ({ state: e6, dispatch: x }) => {
736
736
  if (e6.readOnly) return false;
737
- let b = e6.changeByRange((y2) => {
738
- if (!y2.empty || y2.from == 0 || y2.from == e6.doc.length) return { range: y2 };
739
- let b2 = y2.from, x = e6.doc.lineAt(b2), S = b2 == x.from ? b2 - 1 : findClusterBreak(x.text, b2 - x.from, false) + x.from, C = b2 == x.to ? b2 + 1 : findClusterBreak(x.text, b2 - x.from, true) + x.from;
737
+ let S = e6.changeByRange((x2) => {
738
+ if (!x2.empty || x2.from == 0 || x2.from == e6.doc.length) return { range: x2 };
739
+ let S2 = x2.from, C = e6.doc.lineAt(S2), w = S2 == C.from ? S2 - 1 : findClusterBreak(C.text, S2 - C.from, false) + C.from, T = S2 == C.to ? S2 + 1 : findClusterBreak(C.text, S2 - C.from, true) + C.from;
740
740
  return {
741
741
  changes: {
742
- from: S,
743
- to: C,
744
- insert: e6.doc.slice(b2, C).append(e6.doc.slice(S, b2))
742
+ from: w,
743
+ to: T,
744
+ insert: e6.doc.slice(S2, T).append(e6.doc.slice(w, S2))
745
745
  },
746
- range: EditorSelection.cursor(C)
746
+ range: EditorSelection.cursor(T)
747
747
  };
748
748
  });
749
- return b.changes.empty ? false : (y(e6.update(b, {
749
+ return S.changes.empty ? false : (x(e6.update(S, {
750
750
  scrollIntoView: true,
751
751
  userEvent: "move.character"
752
752
  })), true);
753
753
  };
754
754
  function selectedLineBlocks(e6) {
755
- let y = [], b = -1;
756
- for (let x of e6.selection.ranges) {
757
- let S = e6.doc.lineAt(x.from), C = e6.doc.lineAt(x.to);
758
- if (!x.empty && x.to == C.from && (C = e6.doc.lineAt(x.to - 1)), b >= S.number) {
759
- let e7 = y[y.length - 1];
760
- e7.to = C.to, e7.ranges.push(x);
761
- } else y.push({
762
- from: S.from,
763
- to: C.to,
764
- ranges: [x]
755
+ let x = [], S = -1;
756
+ for (let C of e6.selection.ranges) {
757
+ let w = e6.doc.lineAt(C.from), T = e6.doc.lineAt(C.to);
758
+ if (!C.empty && C.to == T.from && (T = e6.doc.lineAt(C.to - 1)), S >= w.number) {
759
+ let e7 = x[x.length - 1];
760
+ e7.to = T.to, e7.ranges.push(C);
761
+ } else x.push({
762
+ from: w.from,
763
+ to: T.to,
764
+ ranges: [C]
765
765
  });
766
- b = C.number + 1;
766
+ S = T.number + 1;
767
767
  }
768
- return y;
768
+ return x;
769
769
  }
770
- function moveLine(e6, y, b) {
770
+ function moveLine(e6, x, S) {
771
771
  if (e6.readOnly) return false;
772
- let x = [], S = [];
773
- for (let y2 of selectedLineBlocks(e6)) {
774
- if (b ? y2.to == e6.doc.length : y2.from == 0) continue;
775
- let C = e6.doc.lineAt(b ? y2.to + 1 : y2.from - 1), w = C.length + 1;
776
- if (b) {
777
- x.push({
778
- from: y2.to,
779
- to: C.to
772
+ let C = [], w = [];
773
+ for (let x2 of selectedLineBlocks(e6)) {
774
+ if (S ? x2.to == e6.doc.length : x2.from == 0) continue;
775
+ let T = e6.doc.lineAt(S ? x2.to + 1 : x2.from - 1), E = T.length + 1;
776
+ if (S) {
777
+ C.push({
778
+ from: x2.to,
779
+ to: T.to
780
780
  }, {
781
- from: y2.from,
782
- insert: C.text + e6.lineBreak
781
+ from: x2.from,
782
+ insert: T.text + e6.lineBreak
783
783
  });
784
- for (let b2 of y2.ranges) S.push(EditorSelection.range(Math.min(e6.doc.length, b2.anchor + w), Math.min(e6.doc.length, b2.head + w)));
784
+ for (let S2 of x2.ranges) w.push(EditorSelection.range(Math.min(e6.doc.length, S2.anchor + E), Math.min(e6.doc.length, S2.head + E)));
785
785
  } else {
786
- x.push({
787
- from: C.from,
788
- to: y2.from
786
+ C.push({
787
+ from: T.from,
788
+ to: x2.from
789
789
  }, {
790
- from: y2.to,
791
- insert: e6.lineBreak + C.text
790
+ from: x2.to,
791
+ insert: e6.lineBreak + T.text
792
792
  });
793
- for (let e7 of y2.ranges) S.push(EditorSelection.range(e7.anchor - w, e7.head - w));
793
+ for (let e7 of x2.ranges) w.push(EditorSelection.range(e7.anchor - E, e7.head - E));
794
794
  }
795
795
  }
796
- return x.length ? (y(e6.update({
797
- changes: x,
796
+ return C.length ? (x(e6.update({
797
+ changes: C,
798
798
  scrollIntoView: true,
799
- selection: EditorSelection.create(S, e6.selection.mainIndex),
799
+ selection: EditorSelection.create(w, e6.selection.mainIndex),
800
800
  userEvent: "move.line"
801
801
  })), true) : false;
802
802
  }
803
- var moveLineUp = ({ state: e6, dispatch: y }) => moveLine(e6, y, false), moveLineDown = ({ state: e6, dispatch: y }) => moveLine(e6, y, true);
804
- function copyLine(e6, y, b) {
803
+ var moveLineUp = ({ state: e6, dispatch: x }) => moveLine(e6, x, false), moveLineDown = ({ state: e6, dispatch: x }) => moveLine(e6, x, true);
804
+ function copyLine(e6, x, S) {
805
805
  if (e6.readOnly) return false;
806
- let x = [];
807
- for (let y2 of selectedLineBlocks(e6)) b ? x.push({
808
- from: y2.from,
809
- insert: e6.doc.slice(y2.from, y2.to) + e6.lineBreak
810
- }) : x.push({
811
- from: y2.to,
812
- insert: e6.lineBreak + e6.doc.slice(y2.from, y2.to)
806
+ let C = [];
807
+ for (let x2 of selectedLineBlocks(e6)) S ? C.push({
808
+ from: x2.from,
809
+ insert: e6.doc.slice(x2.from, x2.to) + e6.lineBreak
810
+ }) : C.push({
811
+ from: x2.to,
812
+ insert: e6.lineBreak + e6.doc.slice(x2.from, x2.to)
813
813
  });
814
- return y(e6.update({
815
- changes: x,
814
+ return x(e6.update({
815
+ changes: C,
816
816
  scrollIntoView: true,
817
817
  userEvent: "input.copyline"
818
818
  })), true;
819
819
  }
820
- var copyLineUp = ({ state: e6, dispatch: y }) => copyLine(e6, y, false), copyLineDown = ({ state: e6, dispatch: y }) => copyLine(e6, y, true), deleteLine = (e6) => {
820
+ var copyLineUp = ({ state: e6, dispatch: x }) => copyLine(e6, x, false), copyLineDown = ({ state: e6, dispatch: x }) => copyLine(e6, x, true), deleteLine = (e6) => {
821
821
  if (e6.state.readOnly) return false;
822
- let { state: y } = e6, b = y.changes(selectedLineBlocks(y).map(({ from: e7, to: b2 }) => (e7 > 0 ? e7-- : b2 < y.doc.length && b2++, {
822
+ let { state: x } = e6, S = x.changes(selectedLineBlocks(x).map(({ from: e7, to: S2 }) => (e7 > 0 ? e7-- : S2 < x.doc.length && S2++, {
823
823
  from: e7,
824
- to: b2
825
- }))), x = updateSel(y.selection, (y2) => {
826
- let b2;
824
+ to: S2
825
+ }))), C = updateSel(x.selection, (x2) => {
826
+ let S2;
827
827
  if (e6.lineWrapping) {
828
- let x2 = e6.lineBlockAt(y2.head), S = e6.coordsAtPos(y2.head, y2.assoc || 1);
829
- S && (b2 = x2.bottom + e6.documentTop - S.bottom + e6.defaultLineHeight / 2);
828
+ let C2 = e6.lineBlockAt(x2.head), w = e6.coordsAtPos(x2.head, x2.assoc || 1);
829
+ w && (S2 = C2.bottom + e6.documentTop - w.bottom + e6.defaultLineHeight / 2);
830
830
  }
831
- return e6.moveVertically(y2, true, b2);
832
- }).map(b);
831
+ return e6.moveVertically(x2, true, S2);
832
+ }).map(S);
833
833
  return e6.dispatch({
834
- changes: b,
835
- selection: x,
834
+ changes: S,
835
+ selection: C,
836
836
  scrollIntoView: true,
837
837
  userEvent: "delete.line"
838
838
  }), true;
839
839
  };
840
- function isBetweenBrackets(e6, y) {
841
- if (/\(\)|\[\]|\{\}/.test(e6.sliceDoc(y - 1, y + 1))) return {
842
- from: y,
843
- to: y
840
+ function isBetweenBrackets(e6, x) {
841
+ if (/\(\)|\[\]|\{\}/.test(e6.sliceDoc(x - 1, x + 1))) return {
842
+ from: x,
843
+ to: x
844
844
  };
845
- let b = syntaxTree(e6).resolveInner(y), x = b.childBefore(y), S = b.childAfter(y), C;
846
- return x && S && x.to <= y && S.from >= y && (C = x.type.prop(NodeProp.closedBy)) && C.indexOf(S.name) > -1 && e6.doc.lineAt(x.to).from == e6.doc.lineAt(S.from).from && !/\S/.test(e6.sliceDoc(x.to, S.from)) ? {
847
- from: x.to,
848
- to: S.from
845
+ let S = syntaxTree(e6).resolveInner(x), C = S.childBefore(x), w = S.childAfter(x), T;
846
+ return C && w && C.to <= x && w.from >= x && (T = C.type.prop(NodeProp.closedBy)) && T.indexOf(w.name) > -1 && e6.doc.lineAt(C.to).from == e6.doc.lineAt(w.from).from && !/\S/.test(e6.sliceDoc(C.to, w.from)) ? {
847
+ from: C.to,
848
+ to: w.from
849
849
  } : null;
850
850
  }
851
851
  var insertNewlineAndIndent = /* @__PURE__ */ newlineAndIndent(false), insertBlankLine = /* @__PURE__ */ newlineAndIndent(true);
852
852
  function newlineAndIndent(e6) {
853
- return ({ state: y, dispatch: b }) => {
854
- if (y.readOnly) return false;
855
- let x = y.changeByRange((b2) => {
856
- let { from: x2, to: S } = b2, C = y.doc.lineAt(x2), w = !e6 && x2 == S && isBetweenBrackets(y, x2);
857
- e6 && (x2 = S = (S <= C.to ? C : y.doc.lineAt(S)).to);
858
- let T = new IndentContext(y, {
859
- simulateBreak: x2,
860
- simulateDoubleBreak: !!w
861
- }), E = getIndentation(T, x2);
862
- for (E ?? (E = countColumn(/^\s*/.exec(y.doc.lineAt(x2).text)[0], y.tabSize)); S < C.to && /\s/.test(C.text[S - C.from]); ) S++;
863
- w ? { from: x2, to: S } = w : x2 > C.from && x2 < C.from + 100 && !/\S/.test(C.text.slice(0, x2)) && (x2 = C.from);
864
- let D = ["", indentString(y, E)];
865
- return w && D.push(indentString(y, T.lineIndent(C.from, -1))), {
853
+ return ({ state: x, dispatch: S }) => {
854
+ if (x.readOnly) return false;
855
+ let C = x.changeByRange((S2) => {
856
+ let { from: C2, to: w } = S2, T = x.doc.lineAt(C2), E = !e6 && C2 == w && isBetweenBrackets(x, C2);
857
+ e6 && (C2 = w = (w <= T.to ? T : x.doc.lineAt(w)).to);
858
+ let D = new IndentContext(x, {
859
+ simulateBreak: C2,
860
+ simulateDoubleBreak: !!E
861
+ }), O = getIndentation(D, C2);
862
+ for (O ?? (O = countColumn(/^\s*/.exec(x.doc.lineAt(C2).text)[0], x.tabSize)); w < T.to && /\s/.test(T.text[w - T.from]); ) w++;
863
+ E ? { from: C2, to: w } = E : C2 > T.from && C2 < T.from + 100 && !/\S/.test(T.text.slice(0, C2)) && (C2 = T.from);
864
+ let k = ["", indentString(x, O)];
865
+ return E && k.push(indentString(x, D.lineIndent(T.from, -1))), {
866
866
  changes: {
867
- from: x2,
868
- to: S,
869
- insert: Text.of(D)
867
+ from: C2,
868
+ to: w,
869
+ insert: Text.of(k)
870
870
  },
871
- range: EditorSelection.cursor(x2 + 1 + D[1].length)
871
+ range: EditorSelection.cursor(C2 + 1 + k[1].length)
872
872
  };
873
873
  });
874
- return b(y.update(x, {
874
+ return S(x.update(C, {
875
875
  scrollIntoView: true,
876
876
  userEvent: "input"
877
877
  })), true;
878
878
  };
879
879
  }
880
- function changeBySelectedLine(e6, y) {
881
- let b = -1;
882
- return e6.changeByRange((x) => {
883
- let S = [];
884
- for (let C2 = x.from; C2 <= x.to; ) {
885
- let w = e6.doc.lineAt(C2);
886
- w.number > b && (x.empty || x.to > w.from) && (y(w, S, x), b = w.number), C2 = w.to + 1;
880
+ function changeBySelectedLine(e6, x) {
881
+ let S = -1;
882
+ return e6.changeByRange((C) => {
883
+ let w = [];
884
+ for (let T2 = C.from; T2 <= C.to; ) {
885
+ let E = e6.doc.lineAt(T2);
886
+ E.number > S && (C.empty || C.to > E.from) && (x(E, w, C), S = E.number), T2 = E.to + 1;
887
887
  }
888
- let C = e6.changes(S);
888
+ let T = e6.changes(w);
889
889
  return {
890
- changes: S,
891
- range: EditorSelection.range(C.mapPos(x.anchor, 1), C.mapPos(x.head, 1))
890
+ changes: w,
891
+ range: EditorSelection.range(T.mapPos(C.anchor, 1), T.mapPos(C.head, 1))
892
892
  };
893
893
  });
894
894
  }
895
- var indentSelection = ({ state: e6, dispatch: y }) => {
895
+ var indentSelection = ({ state: e6, dispatch: x }) => {
896
896
  if (e6.readOnly) return false;
897
- let b = /* @__PURE__ */ Object.create(null), x = new IndentContext(e6, { overrideIndentation: (e7) => b[e7] ?? -1 }), S = changeBySelectedLine(e6, (y2, S2, C) => {
898
- let w = getIndentation(x, y2.from);
899
- if (w == null) return;
900
- /\S/.test(y2.text) || (w = 0);
901
- let T = /^\s*/.exec(y2.text)[0], E = indentString(e6, w);
902
- (T != E || C.from < y2.from + T.length) && (b[y2.from] = w, S2.push({
903
- from: y2.from,
904
- to: y2.from + T.length,
905
- insert: E
897
+ let S = /* @__PURE__ */ Object.create(null), C = new IndentContext(e6, { overrideIndentation: (e7) => S[e7] ?? -1 }), w = changeBySelectedLine(e6, (x2, w2, T) => {
898
+ let E = getIndentation(C, x2.from);
899
+ if (E == null) return;
900
+ /\S/.test(x2.text) || (E = 0);
901
+ let D = /^\s*/.exec(x2.text)[0], O = indentString(e6, E);
902
+ (D != O || T.from < x2.from + D.length) && (S[x2.from] = E, w2.push({
903
+ from: x2.from,
904
+ to: x2.from + D.length,
905
+ insert: O
906
906
  }));
907
907
  });
908
- return S.changes.empty || y(e6.update(S, { userEvent: "indent" })), true;
909
- }, indentMore = ({ state: e6, dispatch: y }) => e6.readOnly ? false : (y(e6.update(changeBySelectedLine(e6, (y2, b) => {
910
- b.push({
911
- from: y2.from,
908
+ return w.changes.empty || x(e6.update(w, { userEvent: "indent" })), true;
909
+ }, indentMore = ({ state: e6, dispatch: x }) => e6.readOnly ? false : (x(e6.update(changeBySelectedLine(e6, (x2, S) => {
910
+ S.push({
911
+ from: x2.from,
912
912
  insert: e6.facet(indentUnit)
913
913
  });
914
- }), { userEvent: "input.indent" })), true), indentLess = ({ state: e6, dispatch: y }) => e6.readOnly ? false : (y(e6.update(changeBySelectedLine(e6, (y2, b) => {
915
- let x = /^\s*/.exec(y2.text)[0];
916
- if (!x) return;
917
- let S = countColumn(x, e6.tabSize), C = 0, w = indentString(e6, Math.max(0, S - getIndentUnit(e6)));
918
- for (; C < x.length && C < w.length && x.charCodeAt(C) == w.charCodeAt(C); ) C++;
919
- b.push({
920
- from: y2.from + C,
921
- to: y2.from + x.length,
922
- insert: w.slice(C)
914
+ }), { userEvent: "input.indent" })), true), indentLess = ({ state: e6, dispatch: x }) => e6.readOnly ? false : (x(e6.update(changeBySelectedLine(e6, (x2, S) => {
915
+ let C = /^\s*/.exec(x2.text)[0];
916
+ if (!C) return;
917
+ let w = countColumn(C, e6.tabSize), T = 0, E = indentString(e6, Math.max(0, w - getIndentUnit(e6)));
918
+ for (; T < C.length && T < E.length && C.charCodeAt(T) == E.charCodeAt(T); ) T++;
919
+ S.push({
920
+ from: x2.from + T,
921
+ to: x2.from + C.length,
922
+ insert: E.slice(T)
923
923
  });
924
- }), { userEvent: "delete.dedent" })), true), toggleTabFocusMode = (e6) => (e6.setTabFocusMode(), true), insertTab = ({ state: e6, dispatch: y }) => e6.selection.ranges.some((e7) => !e7.empty) ? indentMore({
924
+ }), { userEvent: "delete.dedent" })), true), toggleTabFocusMode = (e6) => (e6.setTabFocusMode(), true), insertTab = ({ state: e6, dispatch: x }) => e6.selection.ranges.some((e7) => !e7.empty) ? indentMore({
925
925
  state: e6,
926
- dispatch: y
927
- }) : (y(e6.update(e6.replaceSelection(" "), {
926
+ dispatch: x
927
+ }) : (x(e6.update(e6.replaceSelection(" "), {
928
928
  scrollIntoView: true,
929
929
  userEvent: "input"
930
930
  })), true), emacsStyleKeymap = [
@@ -1229,11 +1229,11 @@ var indentSelection = ({ state: e6, dispatch: y }) => {
1229
1229
  run: indentMore,
1230
1230
  shift: indentLess
1231
1231
  }, basicNormalize = typeof String.prototype.normalize == "function" ? (e6) => e6.normalize("NFKD") : (e6) => e6, SearchCursor = class {
1232
- constructor(e6, y, b = 0, x = e6.length, S, C) {
1233
- this.test = C, this.value = {
1232
+ constructor(e6, x, S = 0, C = e6.length, w, T) {
1233
+ this.test = T, this.value = {
1234
1234
  from: 0,
1235
1235
  to: 0
1236
- }, this.done = false, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e6.iterRange(b, x), this.bufferStart = b, this.normalize = S ? (e7) => S(basicNormalize(e7)) : basicNormalize, this.query = this.normalize(y);
1236
+ }, this.done = false, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e6.iterRange(S, C), this.bufferStart = S, this.normalize = w ? (e7) => w(basicNormalize(e7)) : basicNormalize, this.query = this.normalize(x);
1237
1237
  }
1238
1238
  peek() {
1239
1239
  if (this.bufferPos == this.buffer.length) {
@@ -1250,32 +1250,32 @@ var indentSelection = ({ state: e6, dispatch: y }) => {
1250
1250
  for (; ; ) {
1251
1251
  let e6 = this.peek();
1252
1252
  if (e6 < 0) return this.done = true, this;
1253
- let y = fromCodePoint(e6), b = this.bufferStart + this.bufferPos;
1253
+ let x = fromCodePoint(e6), S = this.bufferStart + this.bufferPos;
1254
1254
  this.bufferPos += codePointSize(e6);
1255
- let x = this.normalize(y);
1256
- if (x.length) for (let e7 = 0, S = b; ; e7++) {
1257
- let C = x.charCodeAt(e7), w = this.match(C, S, this.bufferPos + this.bufferStart);
1258
- if (e7 == x.length - 1) {
1259
- if (w) return this.value = w, this;
1255
+ let C = this.normalize(x);
1256
+ if (C.length) for (let e7 = 0, w = S; ; e7++) {
1257
+ let T = C.charCodeAt(e7), E = this.match(T, w, this.bufferPos + this.bufferStart);
1258
+ if (e7 == C.length - 1) {
1259
+ if (E) return this.value = E, this;
1260
1260
  break;
1261
1261
  }
1262
- S == b && e7 < y.length && y.charCodeAt(e7) == C && S++;
1262
+ w == S && e7 < x.length && x.charCodeAt(e7) == T && w++;
1263
1263
  }
1264
1264
  }
1265
1265
  }
1266
- match(e6, y, b) {
1267
- let x = null;
1268
- for (let y2 = 0; y2 < this.matches.length; y2 += 2) {
1269
- let S = this.matches[y2], C = false;
1270
- this.query.charCodeAt(S) == e6 && (S == this.query.length - 1 ? x = {
1271
- from: this.matches[y2 + 1],
1272
- to: b
1273
- } : (this.matches[y2]++, C = true)), C || (this.matches.splice(y2, 2), y2 -= 2);
1266
+ match(e6, x, S) {
1267
+ let C = null;
1268
+ for (let x2 = 0; x2 < this.matches.length; x2 += 2) {
1269
+ let w = this.matches[x2], T = false;
1270
+ this.query.charCodeAt(w) == e6 && (w == this.query.length - 1 ? C = {
1271
+ from: this.matches[x2 + 1],
1272
+ to: S
1273
+ } : (this.matches[x2]++, T = true)), T || (this.matches.splice(x2, 2), x2 -= 2);
1274
1274
  }
1275
- return this.query.charCodeAt(0) == e6 && (this.query.length == 1 ? x = {
1276
- from: y,
1277
- to: b
1278
- } : this.matches.push(1, y)), x && this.test && !this.test(x.from, x.to, this.buffer, this.bufferStart) && (x = null), x;
1275
+ return this.query.charCodeAt(0) == e6 && (this.query.length == 1 ? C = {
1276
+ from: x,
1277
+ to: S
1278
+ } : this.matches.push(1, x)), C && this.test && !this.test(C.from, C.to, this.buffer, this.bufferStart) && (C = null), C;
1279
1279
  }
1280
1280
  };
1281
1281
  typeof Symbol < "u" && (SearchCursor.prototype[Symbol.iterator] = function() {
@@ -1286,9 +1286,9 @@ var empty = {
1286
1286
  to: -1,
1287
1287
  match: /* @__PURE__ */ /.*/.exec("")
1288
1288
  }, baseFlags = "gm" + (/x/.unicode == null ? "" : "u"), RegExpCursor = class {
1289
- constructor(e6, y, b, x = 0, S = e6.length) {
1290
- if (this.text = e6, this.to = S, this.curLine = "", this.done = false, this.value = empty, /\\[sWDnr]|\n|\r|\[\^/.test(y)) return new MultilineRegExpCursor(e6, y, b, x, S);
1291
- this.re = new RegExp(y, baseFlags + ((b == null ? void 0 : b.ignoreCase) ? "i" : "")), this.test = b == null ? void 0 : b.test, this.iter = e6.iter(), this.curLineStart = e6.lineAt(x).from, this.matchPos = toCharEnd(e6, x), this.getLine(this.curLineStart);
1289
+ constructor(e6, x, S, C = 0, w = e6.length) {
1290
+ if (this.text = e6, this.to = w, this.curLine = "", this.done = false, this.value = empty, /\\[sWDnr]|\n|\r|\[\^/.test(x)) return new MultilineRegExpCursor(e6, x, S, C, w);
1291
+ this.re = new RegExp(x, baseFlags + ((S == null ? void 0 : S.ignoreCase) ? "i" : "")), this.test = S == null ? void 0 : S.test, this.iter = e6.iter(), this.curLineStart = e6.lineAt(C).from, this.matchPos = toCharEnd(e6, C), this.getLine(this.curLineStart);
1292
1292
  }
1293
1293
  getLine(e6) {
1294
1294
  this.iter.next(e6), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
@@ -1299,13 +1299,13 @@ var empty = {
1299
1299
  next() {
1300
1300
  for (let e6 = this.matchPos - this.curLineStart; ; ) {
1301
1301
  this.re.lastIndex = e6;
1302
- let y = this.matchPos <= this.to && this.re.exec(this.curLine);
1303
- if (y) {
1304
- let b = this.curLineStart + y.index, x = b + y[0].length;
1305
- if (this.matchPos = toCharEnd(this.text, x + (b == x ? 1 : 0)), b == this.curLineStart + this.curLine.length && this.nextLine(), (b < x || b > this.value.to) && (!this.test || this.test(b, x, y))) return this.value = {
1306
- from: b,
1307
- to: x,
1308
- match: y
1302
+ let x = this.matchPos <= this.to && this.re.exec(this.curLine);
1303
+ if (x) {
1304
+ let S = this.curLineStart + x.index, C = S + x[0].length;
1305
+ if (this.matchPos = toCharEnd(this.text, C + (S == C ? 1 : 0)), S == this.curLineStart + this.curLine.length && this.nextLine(), (S < C || S > this.value.to) && (!this.test || this.test(S, C, x))) return this.value = {
1306
+ from: S,
1307
+ to: C,
1308
+ match: x
1309
1309
  }, this;
1310
1310
  e6 = this.matchPos - this.curLineStart;
1311
1311
  } else if (this.curLineStart + this.curLine.length < this.to) this.nextLine(), e6 = 0;
@@ -1313,39 +1313,39 @@ var empty = {
1313
1313
  }
1314
1314
  }
1315
1315
  }, flattened = /* @__PURE__ */ new WeakMap(), FlattenedDoc = class e3 {
1316
- constructor(e6, y) {
1317
- this.from = e6, this.text = y;
1316
+ constructor(e6, x) {
1317
+ this.from = e6, this.text = x;
1318
1318
  }
1319
1319
  get to() {
1320
1320
  return this.from + this.text.length;
1321
1321
  }
1322
- static get(y, b, x) {
1323
- let S = flattened.get(y);
1324
- if (!S || S.from >= x || S.to <= b) {
1325
- let S2 = new e3(b, y.sliceString(b, x));
1326
- return flattened.set(y, S2), S2;
1322
+ static get(x, S, C) {
1323
+ let w = flattened.get(x);
1324
+ if (!w || w.from >= C || w.to <= S) {
1325
+ let w2 = new e3(S, x.sliceString(S, C));
1326
+ return flattened.set(x, w2), w2;
1327
1327
  }
1328
- if (S.from == b && S.to == x) return S;
1329
- let { text: C, from: w } = S;
1330
- return w > b && (C = y.sliceString(b, w) + C, w = b), S.to < x && (C += y.sliceString(S.to, x)), flattened.set(y, new e3(w, C)), new e3(b, C.slice(b - w, x - w));
1328
+ if (w.from == S && w.to == C) return w;
1329
+ let { text: T, from: E } = w;
1330
+ return E > S && (T = x.sliceString(S, E) + T, E = S), w.to < C && (T += x.sliceString(w.to, C)), flattened.set(x, new e3(E, T)), new e3(S, T.slice(S - E, C - E));
1331
1331
  }
1332
1332
  }, MultilineRegExpCursor = class {
1333
- constructor(e6, y, b, x, S) {
1334
- this.text = e6, this.to = S, this.done = false, this.value = empty, this.matchPos = toCharEnd(e6, x), this.re = new RegExp(y, baseFlags + ((b == null ? void 0 : b.ignoreCase) ? "i" : "")), this.test = b == null ? void 0 : b.test, this.flat = FlattenedDoc.get(e6, x, this.chunkEnd(x + 5e3));
1333
+ constructor(e6, x, S, C, w) {
1334
+ this.text = e6, this.to = w, this.done = false, this.value = empty, this.matchPos = toCharEnd(e6, C), this.re = new RegExp(x, baseFlags + ((S == null ? void 0 : S.ignoreCase) ? "i" : "")), this.test = S == null ? void 0 : S.test, this.flat = FlattenedDoc.get(e6, C, this.chunkEnd(C + 5e3));
1335
1335
  }
1336
1336
  chunkEnd(e6) {
1337
1337
  return e6 >= this.to ? this.to : this.text.lineAt(e6).to;
1338
1338
  }
1339
1339
  next() {
1340
1340
  for (; ; ) {
1341
- let e6 = this.re.lastIndex = this.matchPos - this.flat.from, y = this.re.exec(this.flat.text);
1342
- if (y && !y[0] && y.index == e6 && (this.re.lastIndex = e6 + 1, y = this.re.exec(this.flat.text)), y) {
1343
- let e7 = this.flat.from + y.index, b = e7 + y[0].length;
1344
- if ((this.flat.to >= this.to || y.index + y[0].length <= this.flat.text.length - 10) && (!this.test || this.test(e7, b, y))) return this.value = {
1341
+ let e6 = this.re.lastIndex = this.matchPos - this.flat.from, x = this.re.exec(this.flat.text);
1342
+ if (x && !x[0] && x.index == e6 && (this.re.lastIndex = e6 + 1, x = this.re.exec(this.flat.text)), x) {
1343
+ let e7 = this.flat.from + x.index, S = e7 + x[0].length;
1344
+ if ((this.flat.to >= this.to || x.index + x[0].length <= this.flat.text.length - 10) && (!this.test || this.test(e7, S, x))) return this.value = {
1345
1345
  from: e7,
1346
- to: b,
1347
- match: y
1348
- }, this.matchPos = toCharEnd(this.text, b + (e7 == b ? 1 : 0)), this;
1346
+ to: S,
1347
+ match: x
1348
+ }, this.matchPos = toCharEnd(this.text, S + (e7 == S ? 1 : 0)), this;
1349
1349
  }
1350
1350
  if (this.flat.to == this.to) return this.done = true, this;
1351
1351
  this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
@@ -1362,26 +1362,26 @@ function validRegExp(e6) {
1362
1362
  return false;
1363
1363
  }
1364
1364
  }
1365
- function toCharEnd(e6, y) {
1366
- if (y >= e6.length) return y;
1367
- let b = e6.lineAt(y), x;
1368
- for (; y < b.to && (x = b.text.charCodeAt(y - b.from)) >= 56320 && x < 57344; ) y++;
1369
- return y;
1365
+ function toCharEnd(e6, x) {
1366
+ if (x >= e6.length) return x;
1367
+ let S = e6.lineAt(x), C;
1368
+ for (; x < S.to && (C = S.text.charCodeAt(x - S.from)) >= 56320 && C < 57344; ) x++;
1369
+ return x;
1370
1370
  }
1371
1371
  function createLineDialog(e6) {
1372
- let y = crelt("input", {
1372
+ let x = crelt("input", {
1373
1373
  class: "cm-textfield",
1374
1374
  name: "line",
1375
1375
  value: String(e6.state.doc.lineAt(e6.state.selection.main.head).number)
1376
- }), b = crelt("form", {
1376
+ }), S = crelt("form", {
1377
1377
  class: "cm-gotoLine",
1378
- onkeydown: (y2) => {
1379
- y2.keyCode == 27 ? (y2.preventDefault(), e6.dispatch({ effects: dialogEffect.of(false) }), e6.focus()) : y2.keyCode == 13 && (y2.preventDefault(), x());
1378
+ onkeydown: (x2) => {
1379
+ x2.keyCode == 27 ? (x2.preventDefault(), e6.dispatch({ effects: dialogEffect.of(false) }), e6.focus()) : x2.keyCode == 13 && (x2.preventDefault(), C());
1380
1380
  },
1381
1381
  onsubmit: (e7) => {
1382
- e7.preventDefault(), x();
1382
+ e7.preventDefault(), C();
1383
1383
  }
1384
- }, crelt("label", e6.state.phrase("Go to line"), ": ", y), " ", crelt("button", {
1384
+ }, crelt("label", e6.state.phrase("Go to line"), ": ", x), " ", crelt("button", {
1385
1385
  class: "cm-button",
1386
1386
  type: "submit"
1387
1387
  }, e6.state.phrase("go")), crelt("button", {
@@ -1392,38 +1392,38 @@ function createLineDialog(e6) {
1392
1392
  "aria-label": e6.state.phrase("close"),
1393
1393
  type: "button"
1394
1394
  }, ["\xD7"]));
1395
- function x() {
1396
- let b2 = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(y.value);
1397
- if (!b2) return;
1398
- let { state: x2 } = e6, S = x2.doc.lineAt(x2.selection.main.head), [, C, w, T, E] = b2, D = T ? +T.slice(1) : 0, O = w ? +w : S.number;
1399
- if (w && E) {
1400
- let e7 = O / 100;
1401
- C && (e7 = e7 * (C == "-" ? -1 : 1) + S.number / x2.doc.lines), O = Math.round(x2.doc.lines * e7);
1402
- } else w && C && (O = O * (C == "-" ? -1 : 1) + S.number);
1403
- let k = x2.doc.line(Math.max(1, Math.min(x2.doc.lines, O))), A = EditorSelection.cursor(k.from + Math.max(0, Math.min(D, k.length)));
1395
+ function C() {
1396
+ let S2 = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(x.value);
1397
+ if (!S2) return;
1398
+ let { state: C2 } = e6, w = C2.doc.lineAt(C2.selection.main.head), [, T, E, D, O] = S2, k = D ? +D.slice(1) : 0, A = E ? +E : w.number;
1399
+ if (E && O) {
1400
+ let e7 = A / 100;
1401
+ T && (e7 = e7 * (T == "-" ? -1 : 1) + w.number / C2.doc.lines), A = Math.round(C2.doc.lines * e7);
1402
+ } else E && T && (A = A * (T == "-" ? -1 : 1) + w.number);
1403
+ let j = C2.doc.line(Math.max(1, Math.min(C2.doc.lines, A))), M = EditorSelection.cursor(j.from + Math.max(0, Math.min(k, j.length)));
1404
1404
  e6.dispatch({
1405
- effects: [dialogEffect.of(false), EditorView.scrollIntoView(A.from, { y: "center" })],
1406
- selection: A
1405
+ effects: [dialogEffect.of(false), EditorView.scrollIntoView(M.from, { y: "center" })],
1406
+ selection: M
1407
1407
  }), e6.focus();
1408
1408
  }
1409
- return { dom: b };
1409
+ return { dom: S };
1410
1410
  }
1411
1411
  var dialogEffect = /* @__PURE__ */ StateEffect.define(), dialogField = /* @__PURE__ */ StateField.define({
1412
1412
  create() {
1413
1413
  return true;
1414
1414
  },
1415
- update(e6, y) {
1416
- for (let b of y.effects) b.is(dialogEffect) && (e6 = b.value);
1415
+ update(e6, x) {
1416
+ for (let S of x.effects) S.is(dialogEffect) && (e6 = S.value);
1417
1417
  return e6;
1418
1418
  },
1419
1419
  provide: (e6) => showPanel.from(e6, (e7) => e7 ? createLineDialog : null)
1420
1420
  }), gotoLine = (e6) => {
1421
- let y = getPanel(e6, createLineDialog);
1422
- if (!y) {
1423
- let b = [dialogEffect.of(true)];
1424
- e6.state.field(dialogField, false) ?? b.push(StateEffect.appendConfig.of([dialogField, baseTheme$1])), e6.dispatch({ effects: b }), y = getPanel(e6, createLineDialog);
1421
+ let x = getPanel(e6, createLineDialog);
1422
+ if (!x) {
1423
+ let S = [dialogEffect.of(true)];
1424
+ e6.state.field(dialogField, false) ?? S.push(StateEffect.appendConfig.of([dialogField, baseTheme$1])), e6.dispatch({ effects: S }), x = getPanel(e6, createLineDialog);
1425
1425
  }
1426
- return y && y.dom.querySelector("input").select(), true;
1426
+ return x && x.dom.querySelector("input").select(), true;
1427
1427
  }, baseTheme$1 = /* @__PURE__ */ EditorView.baseTheme({ ".cm-panel.cm-gotoLine": {
1428
1428
  padding: "2px 6px 4px",
1429
1429
  position: "relative",
@@ -1445,21 +1445,21 @@ var dialogEffect = /* @__PURE__ */ StateEffect.define(), dialogField = /* @__PUR
1445
1445
  wholeWords: false
1446
1446
  }, highlightConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
1447
1447
  return combineConfig(e6, defaultHighlightOptions, {
1448
- highlightWordAroundCursor: (e7, y) => e7 || y,
1448
+ highlightWordAroundCursor: (e7, x) => e7 || x,
1449
1449
  minSelectionLength: Math.min,
1450
1450
  maxMatches: Math.min
1451
1451
  });
1452
1452
  } });
1453
1453
  function highlightSelectionMatches(e6) {
1454
- let y = [defaultTheme, matchHighlighter];
1455
- return e6 && y.push(highlightConfig.of(e6)), y;
1454
+ let x = [defaultTheme, matchHighlighter];
1455
+ return e6 && x.push(highlightConfig.of(e6)), x;
1456
1456
  }
1457
1457
  var matchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch" }), mainMatchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
1458
- function insideWordBoundaries(e6, y, b, x) {
1459
- return (b == 0 || e6(y.sliceDoc(b - 1, b)) != CharCategory.Word) && (x == y.doc.length || e6(y.sliceDoc(x, x + 1)) != CharCategory.Word);
1458
+ function insideWordBoundaries(e6, x, S, C) {
1459
+ return (S == 0 || e6(x.sliceDoc(S - 1, S)) != CharCategory.Word) && (C == x.doc.length || e6(x.sliceDoc(C, C + 1)) != CharCategory.Word);
1460
1460
  }
1461
- function insideWord(e6, y, b, x) {
1462
- return e6(y.sliceDoc(b, b + 1)) == CharCategory.Word && e6(y.sliceDoc(x - 1, x)) == CharCategory.Word;
1461
+ function insideWord(e6, x, S, C) {
1462
+ return e6(x.sliceDoc(S, S + 1)) == CharCategory.Word && e6(x.sliceDoc(C - 1, C)) == CharCategory.Word;
1463
1463
  }
1464
1464
  var matchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
1465
1465
  constructor(e6) {
@@ -1469,64 +1469,64 @@ var matchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
1469
1469
  (e6.selectionSet || e6.docChanged || e6.viewportChanged) && (this.decorations = this.getDeco(e6.view));
1470
1470
  }
1471
1471
  getDeco(e6) {
1472
- let y = e6.state.facet(highlightConfig), { state: b } = e6, x = b.selection;
1473
- if (x.ranges.length > 1) return Decoration.none;
1474
- let S = x.main, C, w = null;
1475
- if (S.empty) {
1476
- if (!y.highlightWordAroundCursor) return Decoration.none;
1477
- let e7 = b.wordAt(S.head);
1472
+ let x = e6.state.facet(highlightConfig), { state: S } = e6, C = S.selection;
1473
+ if (C.ranges.length > 1) return Decoration.none;
1474
+ let w = C.main, T, E = null;
1475
+ if (w.empty) {
1476
+ if (!x.highlightWordAroundCursor) return Decoration.none;
1477
+ let e7 = S.wordAt(w.head);
1478
1478
  if (!e7) return Decoration.none;
1479
- w = b.charCategorizer(S.head), C = b.sliceDoc(e7.from, e7.to);
1479
+ E = S.charCategorizer(w.head), T = S.sliceDoc(e7.from, e7.to);
1480
1480
  } else {
1481
- let e7 = S.to - S.from;
1482
- if (e7 < y.minSelectionLength || e7 > 200) return Decoration.none;
1483
- if (y.wholeWords) {
1484
- if (C = b.sliceDoc(S.from, S.to), w = b.charCategorizer(S.head), !(insideWordBoundaries(w, b, S.from, S.to) && insideWord(w, b, S.from, S.to))) return Decoration.none;
1485
- } else if (C = b.sliceDoc(S.from, S.to), !C) return Decoration.none;
1481
+ let e7 = w.to - w.from;
1482
+ if (e7 < x.minSelectionLength || e7 > 200) return Decoration.none;
1483
+ if (x.wholeWords) {
1484
+ if (T = S.sliceDoc(w.from, w.to), E = S.charCategorizer(w.head), !(insideWordBoundaries(E, S, w.from, w.to) && insideWord(E, S, w.from, w.to))) return Decoration.none;
1485
+ } else if (T = S.sliceDoc(w.from, w.to), !T) return Decoration.none;
1486
1486
  }
1487
- let T = [];
1488
- for (let x2 of e6.visibleRanges) {
1489
- let e7 = new SearchCursor(b.doc, C, x2.from, x2.to);
1487
+ let D = [];
1488
+ for (let C2 of e6.visibleRanges) {
1489
+ let e7 = new SearchCursor(S.doc, T, C2.from, C2.to);
1490
1490
  for (; !e7.next().done; ) {
1491
- let { from: x3, to: C2 } = e7.value;
1492
- if ((!w || insideWordBoundaries(w, b, x3, C2)) && (S.empty && x3 <= S.from && C2 >= S.to ? T.push(mainMatchDeco.range(x3, C2)) : (x3 >= S.to || C2 <= S.from) && T.push(matchDeco.range(x3, C2)), T.length > y.maxMatches)) return Decoration.none;
1491
+ let { from: C3, to: T2 } = e7.value;
1492
+ if ((!E || insideWordBoundaries(E, S, C3, T2)) && (w.empty && C3 <= w.from && T2 >= w.to ? D.push(mainMatchDeco.range(C3, T2)) : (C3 >= w.to || T2 <= w.from) && D.push(matchDeco.range(C3, T2)), D.length > x.maxMatches)) return Decoration.none;
1493
1493
  }
1494
1494
  }
1495
- return Decoration.set(T);
1495
+ return Decoration.set(D);
1496
1496
  }
1497
1497
  }, { decorations: (e6) => e6.decorations }), defaultTheme = /* @__PURE__ */ EditorView.baseTheme({
1498
1498
  ".cm-selectionMatch": { backgroundColor: "#99ff7780" },
1499
1499
  ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
1500
- }), selectWord = ({ state: e6, dispatch: y }) => {
1501
- let { selection: b } = e6, x = EditorSelection.create(b.ranges.map((y2) => e6.wordAt(y2.head) || EditorSelection.cursor(y2.head)), b.mainIndex);
1502
- return x.eq(b) ? false : (y(e6.update({ selection: x })), true);
1500
+ }), selectWord = ({ state: e6, dispatch: x }) => {
1501
+ let { selection: S } = e6, C = EditorSelection.create(S.ranges.map((x2) => e6.wordAt(x2.head) || EditorSelection.cursor(x2.head)), S.mainIndex);
1502
+ return C.eq(S) ? false : (x(e6.update({ selection: C })), true);
1503
1503
  };
1504
- function findNextOccurrence(e6, y) {
1505
- let { main: b, ranges: x } = e6.selection, S = e6.wordAt(b.head), C = S && S.from == b.from && S.to == b.to;
1506
- for (let b2 = false, S2 = new SearchCursor(e6.doc, y, x[x.length - 1].to); ; ) if (S2.next(), S2.done) {
1507
- if (b2) return null;
1508
- S2 = new SearchCursor(e6.doc, y, 0, Math.max(0, x[x.length - 1].from - 1)), b2 = true;
1504
+ function findNextOccurrence(e6, x) {
1505
+ let { main: S, ranges: C } = e6.selection, w = e6.wordAt(S.head), T = w && w.from == S.from && w.to == S.to;
1506
+ for (let S2 = false, w2 = new SearchCursor(e6.doc, x, C[C.length - 1].to); ; ) if (w2.next(), w2.done) {
1507
+ if (S2) return null;
1508
+ w2 = new SearchCursor(e6.doc, x, 0, Math.max(0, C[C.length - 1].from - 1)), S2 = true;
1509
1509
  } else {
1510
- if (b2 && x.some((e7) => e7.from == S2.value.from)) continue;
1511
- if (C) {
1512
- let y2 = e6.wordAt(S2.value.from);
1513
- if (!y2 || y2.from != S2.value.from || y2.to != S2.value.to) continue;
1510
+ if (S2 && C.some((e7) => e7.from == w2.value.from)) continue;
1511
+ if (T) {
1512
+ let x2 = e6.wordAt(w2.value.from);
1513
+ if (!x2 || x2.from != w2.value.from || x2.to != w2.value.to) continue;
1514
1514
  }
1515
- return S2.value;
1515
+ return w2.value;
1516
1516
  }
1517
1517
  }
1518
- var selectNextOccurrence = ({ state: e6, dispatch: y }) => {
1519
- let { ranges: b } = e6.selection;
1520
- if (b.some((e7) => e7.from === e7.to)) return selectWord({
1518
+ var selectNextOccurrence = ({ state: e6, dispatch: x }) => {
1519
+ let { ranges: S } = e6.selection;
1520
+ if (S.some((e7) => e7.from === e7.to)) return selectWord({
1521
1521
  state: e6,
1522
- dispatch: y
1522
+ dispatch: x
1523
1523
  });
1524
- let x = e6.sliceDoc(b[0].from, b[0].to);
1525
- if (e6.selection.ranges.some((y2) => e6.sliceDoc(y2.from, y2.to) != x)) return false;
1526
- let S = findNextOccurrence(e6, x);
1527
- return S ? (y(e6.update({
1528
- selection: e6.selection.addRange(EditorSelection.range(S.from, S.to), false),
1529
- effects: EditorView.scrollIntoView(S.to)
1524
+ let C = e6.sliceDoc(S[0].from, S[0].to);
1525
+ if (e6.selection.ranges.some((x2) => e6.sliceDoc(x2.from, x2.to) != C)) return false;
1526
+ let w = findNextOccurrence(e6, C);
1527
+ return w ? (x(e6.update({
1528
+ selection: e6.selection.addRange(EditorSelection.range(w.from, w.to), false),
1529
+ effects: EditorView.scrollIntoView(w.to)
1530
1530
  })), true) : false;
1531
1531
  }, searchConfigFacet = /* @__PURE__ */ Facet.define({ combine(e6) {
1532
1532
  return combineConfig(e6, {
@@ -1543,7 +1543,7 @@ var selectNextOccurrence = ({ state: e6, dispatch: y }) => {
1543
1543
  this.search = e6.search, this.caseSensitive = !!e6.caseSensitive, this.literal = !!e6.literal, this.regexp = !!e6.regexp, this.replace = e6.replace || "", this.valid = !!this.search && (!this.regexp || validRegExp(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e6.wholeWord;
1544
1544
  }
1545
1545
  unquote(e6) {
1546
- return this.literal ? e6 : e6.replace(/\\([nrt\\])/g, (e7, y) => y == "n" ? "\n" : y == "r" ? "\r" : y == "t" ? " " : "\\");
1546
+ return this.literal ? e6 : e6.replace(/\\([nrt\\])/g, (e7, x) => x == "n" ? "\n" : x == "r" ? "\r" : x == "t" ? " " : "\\");
1547
1547
  }
1548
1548
  eq(e6) {
1549
1549
  return this.search == e6.search && this.replace == e6.replace && this.caseSensitive == e6.caseSensitive && this.regexp == e6.regexp && this.wholeWord == e6.wholeWord;
@@ -1551,267 +1551,267 @@ var selectNextOccurrence = ({ state: e6, dispatch: y }) => {
1551
1551
  create() {
1552
1552
  return this.regexp ? new RegExpQuery(this) : new StringQuery(this);
1553
1553
  }
1554
- getCursor(e6, y = 0, b) {
1555
- let x = e6.doc ? e6 : EditorState.create({ doc: e6 });
1556
- return b ?? (b = x.doc.length), this.regexp ? regexpCursor(this, x, y, b) : stringCursor(this, x, y, b);
1554
+ getCursor(e6, x = 0, S) {
1555
+ let C = e6.doc ? e6 : EditorState.create({ doc: e6 });
1556
+ return S ?? (S = C.doc.length), this.regexp ? regexpCursor(this, C, x, S) : stringCursor(this, C, x, S);
1557
1557
  }
1558
1558
  }, QueryType = class {
1559
1559
  constructor(e6) {
1560
1560
  this.spec = e6;
1561
1561
  }
1562
1562
  };
1563
- function stringCursor(e6, y, b, x) {
1564
- return new SearchCursor(y.doc, e6.unquoted, b, x, e6.caseSensitive ? void 0 : (e7) => e7.toLowerCase(), e6.wholeWord ? stringWordTest(y.doc, y.charCategorizer(y.selection.main.head)) : void 0);
1563
+ function stringCursor(e6, x, S, C) {
1564
+ return new SearchCursor(x.doc, e6.unquoted, S, C, e6.caseSensitive ? void 0 : (e7) => e7.toLowerCase(), e6.wholeWord ? stringWordTest(x.doc, x.charCategorizer(x.selection.main.head)) : void 0);
1565
1565
  }
1566
- function stringWordTest(e6, y) {
1567
- return (b, x, S, C) => ((C > b || C + S.length < x) && (C = Math.max(0, b - 2), S = e6.sliceString(C, Math.min(e6.length, x + 2))), (y(charBefore(S, b - C)) != CharCategory.Word || y(charAfter(S, b - C)) != CharCategory.Word) && (y(charAfter(S, x - C)) != CharCategory.Word || y(charBefore(S, x - C)) != CharCategory.Word));
1566
+ function stringWordTest(e6, x) {
1567
+ return (S, C, w, T) => ((T > S || T + w.length < C) && (T = Math.max(0, S - 2), w = e6.sliceString(T, Math.min(e6.length, C + 2))), (x(charBefore(w, S - T)) != CharCategory.Word || x(charAfter(w, S - T)) != CharCategory.Word) && (x(charAfter(w, C - T)) != CharCategory.Word || x(charBefore(w, C - T)) != CharCategory.Word));
1568
1568
  }
1569
1569
  var StringQuery = class extends QueryType {
1570
1570
  constructor(e6) {
1571
1571
  super(e6);
1572
1572
  }
1573
- nextMatch(e6, y, b) {
1574
- let x = stringCursor(this.spec, e6, b, e6.doc.length).nextOverlapping();
1575
- if (x.done) {
1576
- let b2 = Math.min(e6.doc.length, y + this.spec.unquoted.length);
1577
- x = stringCursor(this.spec, e6, 0, b2).nextOverlapping();
1573
+ nextMatch(e6, x, S) {
1574
+ let C = stringCursor(this.spec, e6, S, e6.doc.length).nextOverlapping();
1575
+ if (C.done) {
1576
+ let S2 = Math.min(e6.doc.length, x + this.spec.unquoted.length);
1577
+ C = stringCursor(this.spec, e6, 0, S2).nextOverlapping();
1578
1578
  }
1579
- return x.done || x.value.from == y && x.value.to == b ? null : x.value;
1580
- }
1581
- prevMatchInRange(e6, y, b) {
1582
- for (let x = b; ; ) {
1583
- let b2 = Math.max(y, x - 1e4 - this.spec.unquoted.length), S = stringCursor(this.spec, e6, b2, x), C = null;
1584
- for (; !S.nextOverlapping().done; ) C = S.value;
1585
- if (C) return C;
1586
- if (b2 == y) return null;
1587
- x -= 1e4;
1579
+ return C.done || C.value.from == x && C.value.to == S ? null : C.value;
1580
+ }
1581
+ prevMatchInRange(e6, x, S) {
1582
+ for (let C = S; ; ) {
1583
+ let S2 = Math.max(x, C - 1e4 - this.spec.unquoted.length), w = stringCursor(this.spec, e6, S2, C), T = null;
1584
+ for (; !w.nextOverlapping().done; ) T = w.value;
1585
+ if (T) return T;
1586
+ if (S2 == x) return null;
1587
+ C -= 1e4;
1588
1588
  }
1589
1589
  }
1590
- prevMatch(e6, y, b) {
1591
- let x = this.prevMatchInRange(e6, 0, y);
1592
- return x || (x = this.prevMatchInRange(e6, Math.max(0, b - this.spec.unquoted.length), e6.doc.length)), x && (x.from != y || x.to != b) ? x : null;
1590
+ prevMatch(e6, x, S) {
1591
+ let C = this.prevMatchInRange(e6, 0, x);
1592
+ return C || (C = this.prevMatchInRange(e6, Math.max(0, S - this.spec.unquoted.length), e6.doc.length)), C && (C.from != x || C.to != S) ? C : null;
1593
1593
  }
1594
1594
  getReplacement(e6) {
1595
1595
  return this.spec.unquote(this.spec.replace);
1596
1596
  }
1597
- matchAll(e6, y) {
1598
- let b = stringCursor(this.spec, e6, 0, e6.doc.length), x = [];
1599
- for (; !b.next().done; ) {
1600
- if (x.length >= y) return null;
1601
- x.push(b.value);
1597
+ matchAll(e6, x) {
1598
+ let S = stringCursor(this.spec, e6, 0, e6.doc.length), C = [];
1599
+ for (; !S.next().done; ) {
1600
+ if (C.length >= x) return null;
1601
+ C.push(S.value);
1602
1602
  }
1603
- return x;
1603
+ return C;
1604
1604
  }
1605
- highlight(e6, y, b, x) {
1606
- let S = stringCursor(this.spec, e6, Math.max(0, y - this.spec.unquoted.length), Math.min(b + this.spec.unquoted.length, e6.doc.length));
1607
- for (; !S.next().done; ) x(S.value.from, S.value.to);
1605
+ highlight(e6, x, S, C) {
1606
+ let w = stringCursor(this.spec, e6, Math.max(0, x - this.spec.unquoted.length), Math.min(S + this.spec.unquoted.length, e6.doc.length));
1607
+ for (; !w.next().done; ) C(w.value.from, w.value.to);
1608
1608
  }
1609
1609
  };
1610
- function regexpCursor(e6, y, b, x) {
1611
- return new RegExpCursor(y.doc, e6.search, {
1610
+ function regexpCursor(e6, x, S, C) {
1611
+ return new RegExpCursor(x.doc, e6.search, {
1612
1612
  ignoreCase: !e6.caseSensitive,
1613
- test: e6.wholeWord ? regexpWordTest(y.charCategorizer(y.selection.main.head)) : void 0
1614
- }, b, x);
1613
+ test: e6.wholeWord ? regexpWordTest(x.charCategorizer(x.selection.main.head)) : void 0
1614
+ }, S, C);
1615
1615
  }
1616
- function charBefore(e6, y) {
1617
- return e6.slice(findClusterBreak(e6, y, false), y);
1616
+ function charBefore(e6, x) {
1617
+ return e6.slice(findClusterBreak(e6, x, false), x);
1618
1618
  }
1619
- function charAfter(e6, y) {
1620
- return e6.slice(y, findClusterBreak(e6, y));
1619
+ function charAfter(e6, x) {
1620
+ return e6.slice(x, findClusterBreak(e6, x));
1621
1621
  }
1622
1622
  function regexpWordTest(e6) {
1623
- return (y, b, x) => !x[0].length || (e6(charBefore(x.input, x.index)) != CharCategory.Word || e6(charAfter(x.input, x.index)) != CharCategory.Word) && (e6(charAfter(x.input, x.index + x[0].length)) != CharCategory.Word || e6(charBefore(x.input, x.index + x[0].length)) != CharCategory.Word);
1623
+ return (x, S, C) => !C[0].length || (e6(charBefore(C.input, C.index)) != CharCategory.Word || e6(charAfter(C.input, C.index)) != CharCategory.Word) && (e6(charAfter(C.input, C.index + C[0].length)) != CharCategory.Word || e6(charBefore(C.input, C.index + C[0].length)) != CharCategory.Word);
1624
1624
  }
1625
1625
  var RegExpQuery = class extends QueryType {
1626
- nextMatch(e6, y, b) {
1627
- let x = regexpCursor(this.spec, e6, b, e6.doc.length).next();
1628
- return x.done && (x = regexpCursor(this.spec, e6, 0, y).next()), x.done ? null : x.value;
1629
- }
1630
- prevMatchInRange(e6, y, b) {
1631
- for (let x = 1; ; x++) {
1632
- let S = Math.max(y, b - x * 1e4), C = regexpCursor(this.spec, e6, S, b), w = null;
1633
- for (; !C.next().done; ) w = C.value;
1634
- if (w && (S == y || w.from > S + 10)) return w;
1635
- if (S == y) return null;
1626
+ nextMatch(e6, x, S) {
1627
+ let C = regexpCursor(this.spec, e6, S, e6.doc.length).next();
1628
+ return C.done && (C = regexpCursor(this.spec, e6, 0, x).next()), C.done ? null : C.value;
1629
+ }
1630
+ prevMatchInRange(e6, x, S) {
1631
+ for (let C = 1; ; C++) {
1632
+ let w = Math.max(x, S - C * 1e4), T = regexpCursor(this.spec, e6, w, S), E = null;
1633
+ for (; !T.next().done; ) E = T.value;
1634
+ if (E && (w == x || E.from > w + 10)) return E;
1635
+ if (w == x) return null;
1636
1636
  }
1637
1637
  }
1638
- prevMatch(e6, y, b) {
1639
- return this.prevMatchInRange(e6, 0, y) || this.prevMatchInRange(e6, b, e6.doc.length);
1638
+ prevMatch(e6, x, S) {
1639
+ return this.prevMatchInRange(e6, 0, x) || this.prevMatchInRange(e6, S, e6.doc.length);
1640
1640
  }
1641
1641
  getReplacement(e6) {
1642
- return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (y, b) => {
1643
- if (b == "&") return e6.match[0];
1644
- if (b == "$") return "$";
1645
- for (let y2 = b.length; y2 > 0; y2--) {
1646
- let x = +b.slice(0, y2);
1647
- if (x > 0 && x < e6.match.length) return e6.match[x] + b.slice(y2);
1642
+ return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (x, S) => {
1643
+ if (S == "&") return e6.match[0];
1644
+ if (S == "$") return "$";
1645
+ for (let x2 = S.length; x2 > 0; x2--) {
1646
+ let C = +S.slice(0, x2);
1647
+ if (C > 0 && C < e6.match.length) return e6.match[C] + S.slice(x2);
1648
1648
  }
1649
- return y;
1649
+ return x;
1650
1650
  });
1651
1651
  }
1652
- matchAll(e6, y) {
1653
- let b = regexpCursor(this.spec, e6, 0, e6.doc.length), x = [];
1654
- for (; !b.next().done; ) {
1655
- if (x.length >= y) return null;
1656
- x.push(b.value);
1652
+ matchAll(e6, x) {
1653
+ let S = regexpCursor(this.spec, e6, 0, e6.doc.length), C = [];
1654
+ for (; !S.next().done; ) {
1655
+ if (C.length >= x) return null;
1656
+ C.push(S.value);
1657
1657
  }
1658
- return x;
1658
+ return C;
1659
1659
  }
1660
- highlight(e6, y, b, x) {
1661
- let S = regexpCursor(this.spec, e6, Math.max(0, y - 250), Math.min(b + 250, e6.doc.length));
1662
- for (; !S.next().done; ) x(S.value.from, S.value.to);
1660
+ highlight(e6, x, S, C) {
1661
+ let w = regexpCursor(this.spec, e6, Math.max(0, x - 250), Math.min(S + 250, e6.doc.length));
1662
+ for (; !w.next().done; ) C(w.value.from, w.value.to);
1663
1663
  }
1664
1664
  }, setSearchQuery = /* @__PURE__ */ StateEffect.define(), togglePanel$1 = /* @__PURE__ */ StateEffect.define(), searchState = /* @__PURE__ */ StateField.define({
1665
1665
  create(e6) {
1666
1666
  return new SearchState(defaultQuery(e6).create(), null);
1667
1667
  },
1668
- update(e6, y) {
1669
- for (let b of y.effects) b.is(setSearchQuery) ? e6 = new SearchState(b.value.create(), e6.panel) : b.is(togglePanel$1) && (e6 = new SearchState(e6.query, b.value ? createSearchPanel : null));
1668
+ update(e6, x) {
1669
+ for (let S of x.effects) S.is(setSearchQuery) ? e6 = new SearchState(S.value.create(), e6.panel) : S.is(togglePanel$1) && (e6 = new SearchState(e6.query, S.value ? createSearchPanel : null));
1670
1670
  return e6;
1671
1671
  },
1672
1672
  provide: (e6) => showPanel.from(e6, (e7) => e7.panel)
1673
1673
  }), SearchState = class {
1674
- constructor(e6, y) {
1675
- this.query = e6, this.panel = y;
1674
+ constructor(e6, x) {
1675
+ this.query = e6, this.panel = x;
1676
1676
  }
1677
1677
  }, matchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch" }), selectedMatchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), searchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
1678
1678
  constructor(e6) {
1679
1679
  this.view = e6, this.decorations = this.highlight(e6.state.field(searchState));
1680
1680
  }
1681
1681
  update(e6) {
1682
- let y = e6.state.field(searchState);
1683
- (y != e6.startState.field(searchState) || e6.docChanged || e6.selectionSet || e6.viewportChanged) && (this.decorations = this.highlight(y));
1684
- }
1685
- highlight({ query: e6, panel: y }) {
1686
- if (!y || !e6.spec.valid) return Decoration.none;
1687
- let { view: b } = this, x = new RangeSetBuilder();
1688
- for (let y2 = 0, S = b.visibleRanges, C = S.length; y2 < C; y2++) {
1689
- let { from: w, to: T } = S[y2];
1690
- for (; y2 < C - 1 && T > S[y2 + 1].from - 500; ) T = S[++y2].to;
1691
- e6.highlight(b.state, w, T, (e7, y3) => {
1692
- let S2 = b.state.selection.ranges.some((b2) => b2.from == e7 && b2.to == y3);
1693
- x.add(e7, y3, S2 ? selectedMatchMark : matchMark);
1682
+ let x = e6.state.field(searchState);
1683
+ (x != e6.startState.field(searchState) || e6.docChanged || e6.selectionSet || e6.viewportChanged) && (this.decorations = this.highlight(x));
1684
+ }
1685
+ highlight({ query: e6, panel: x }) {
1686
+ if (!x || !e6.spec.valid) return Decoration.none;
1687
+ let { view: S } = this, C = new RangeSetBuilder();
1688
+ for (let x2 = 0, w = S.visibleRanges, T = w.length; x2 < T; x2++) {
1689
+ let { from: E, to: D } = w[x2];
1690
+ for (; x2 < T - 1 && D > w[x2 + 1].from - 500; ) D = w[++x2].to;
1691
+ e6.highlight(S.state, E, D, (e7, x3) => {
1692
+ let w2 = S.state.selection.ranges.some((S2) => S2.from == e7 && S2.to == x3);
1693
+ C.add(e7, x3, w2 ? selectedMatchMark : matchMark);
1694
1694
  });
1695
1695
  }
1696
- return x.finish();
1696
+ return C.finish();
1697
1697
  }
1698
1698
  }, { decorations: (e6) => e6.decorations });
1699
1699
  function searchCommand(e6) {
1700
- return (y) => {
1701
- let b = y.state.field(searchState, false);
1702
- return b && b.query.spec.valid ? e6(y, b) : openSearchPanel(y);
1700
+ return (x) => {
1701
+ let S = x.state.field(searchState, false);
1702
+ return S && S.query.spec.valid ? e6(x, S) : openSearchPanel(x);
1703
1703
  };
1704
1704
  }
1705
- var findNext = /* @__PURE__ */ searchCommand((e6, { query: y }) => {
1706
- let { to: b } = e6.state.selection.main, x = y.nextMatch(e6.state, b, b);
1707
- if (!x) return false;
1708
- let S = EditorSelection.single(x.from, x.to), C = e6.state.facet(searchConfigFacet);
1705
+ var findNext = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
1706
+ let { to: S } = e6.state.selection.main, C = x.nextMatch(e6.state, S, S);
1707
+ if (!C) return false;
1708
+ let w = EditorSelection.single(C.from, C.to), T = e6.state.facet(searchConfigFacet);
1709
1709
  return e6.dispatch({
1710
- selection: S,
1711
- effects: [announceMatch(e6, x), C.scrollToMatch(S.main, e6)],
1710
+ selection: w,
1711
+ effects: [announceMatch(e6, C), T.scrollToMatch(w.main, e6)],
1712
1712
  userEvent: "select.search"
1713
1713
  }), selectSearchInput(e6), true;
1714
- }), findPrevious = /* @__PURE__ */ searchCommand((e6, { query: y }) => {
1715
- let { state: b } = e6, { from: x } = b.selection.main, S = y.prevMatch(b, x, x);
1716
- if (!S) return false;
1717
- let C = EditorSelection.single(S.from, S.to), w = e6.state.facet(searchConfigFacet);
1714
+ }), findPrevious = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
1715
+ let { state: S } = e6, { from: C } = S.selection.main, w = x.prevMatch(S, C, C);
1716
+ if (!w) return false;
1717
+ let T = EditorSelection.single(w.from, w.to), E = e6.state.facet(searchConfigFacet);
1718
1718
  return e6.dispatch({
1719
- selection: C,
1720
- effects: [announceMatch(e6, S), w.scrollToMatch(C.main, e6)],
1719
+ selection: T,
1720
+ effects: [announceMatch(e6, w), E.scrollToMatch(T.main, e6)],
1721
1721
  userEvent: "select.search"
1722
1722
  }), selectSearchInput(e6), true;
1723
- }), selectMatches = /* @__PURE__ */ searchCommand((e6, { query: y }) => {
1724
- let b = y.matchAll(e6.state, 1e3);
1725
- return !b || !b.length ? false : (e6.dispatch({
1726
- selection: EditorSelection.create(b.map((e7) => EditorSelection.range(e7.from, e7.to))),
1723
+ }), selectMatches = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
1724
+ let S = x.matchAll(e6.state, 1e3);
1725
+ return !S || !S.length ? false : (e6.dispatch({
1726
+ selection: EditorSelection.create(S.map((e7) => EditorSelection.range(e7.from, e7.to))),
1727
1727
  userEvent: "select.search.matches"
1728
1728
  }), true);
1729
- }), selectSelectionMatches = ({ state: e6, dispatch: y }) => {
1730
- let b = e6.selection;
1731
- if (b.ranges.length > 1 || b.main.empty) return false;
1732
- let { from: x, to: S } = b.main, C = [], w = 0;
1733
- for (let y2 = new SearchCursor(e6.doc, e6.sliceDoc(x, S)); !y2.next().done; ) {
1734
- if (C.length > 1e3) return false;
1735
- y2.value.from == x && (w = C.length), C.push(EditorSelection.range(y2.value.from, y2.value.to));
1736
- }
1737
- return y(e6.update({
1738
- selection: EditorSelection.create(C, w),
1729
+ }), selectSelectionMatches = ({ state: e6, dispatch: x }) => {
1730
+ let S = e6.selection;
1731
+ if (S.ranges.length > 1 || S.main.empty) return false;
1732
+ let { from: C, to: w } = S.main, T = [], E = 0;
1733
+ for (let x2 = new SearchCursor(e6.doc, e6.sliceDoc(C, w)); !x2.next().done; ) {
1734
+ if (T.length > 1e3) return false;
1735
+ x2.value.from == C && (E = T.length), T.push(EditorSelection.range(x2.value.from, x2.value.to));
1736
+ }
1737
+ return x(e6.update({
1738
+ selection: EditorSelection.create(T, E),
1739
1739
  userEvent: "select.search.matches"
1740
1740
  })), true;
1741
- }, replaceNext = /* @__PURE__ */ searchCommand((e6, { query: y }) => {
1742
- let { state: b } = e6, { from: x, to: S } = b.selection.main;
1743
- if (b.readOnly) return false;
1744
- let C = y.nextMatch(b, x, x);
1745
- if (!C) return false;
1746
- let w = C, T = [], E, D, O = [];
1747
- w.from == x && w.to == S && (D = b.toText(y.getReplacement(w)), T.push({
1748
- from: w.from,
1749
- to: w.to,
1750
- insert: D
1751
- }), w = y.nextMatch(b, w.from, w.to), O.push(EditorView.announce.of(b.phrase("replaced match on line $", b.doc.lineAt(x).number) + ".")));
1752
- let k = e6.state.changes(T);
1753
- return w && (E = EditorSelection.single(w.from, w.to).map(k), O.push(announceMatch(e6, w)), O.push(b.facet(searchConfigFacet).scrollToMatch(E.main, e6))), e6.dispatch({
1754
- changes: k,
1755
- selection: E,
1756
- effects: O,
1741
+ }, replaceNext = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
1742
+ let { state: S } = e6, { from: C, to: w } = S.selection.main;
1743
+ if (S.readOnly) return false;
1744
+ let T = x.nextMatch(S, C, C);
1745
+ if (!T) return false;
1746
+ let E = T, D = [], O, k, A = [];
1747
+ E.from == C && E.to == w && (k = S.toText(x.getReplacement(E)), D.push({
1748
+ from: E.from,
1749
+ to: E.to,
1750
+ insert: k
1751
+ }), E = x.nextMatch(S, E.from, E.to), A.push(EditorView.announce.of(S.phrase("replaced match on line $", S.doc.lineAt(C).number) + ".")));
1752
+ let j = e6.state.changes(D);
1753
+ return E && (O = EditorSelection.single(E.from, E.to).map(j), A.push(announceMatch(e6, E)), A.push(S.facet(searchConfigFacet).scrollToMatch(O.main, e6))), e6.dispatch({
1754
+ changes: j,
1755
+ selection: O,
1756
+ effects: A,
1757
1757
  userEvent: "input.replace"
1758
1758
  }), true;
1759
- }), replaceAll = /* @__PURE__ */ searchCommand((e6, { query: y }) => {
1759
+ }), replaceAll = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
1760
1760
  if (e6.state.readOnly) return false;
1761
- let b = y.matchAll(e6.state, 1e9).map((e7) => {
1762
- let { from: b2, to: x2 } = e7;
1761
+ let S = x.matchAll(e6.state, 1e9).map((e7) => {
1762
+ let { from: S2, to: C2 } = e7;
1763
1763
  return {
1764
- from: b2,
1765
- to: x2,
1766
- insert: y.getReplacement(e7)
1764
+ from: S2,
1765
+ to: C2,
1766
+ insert: x.getReplacement(e7)
1767
1767
  };
1768
1768
  });
1769
- if (!b.length) return false;
1770
- let x = e6.state.phrase("replaced $ matches", b.length) + ".";
1769
+ if (!S.length) return false;
1770
+ let C = e6.state.phrase("replaced $ matches", S.length) + ".";
1771
1771
  return e6.dispatch({
1772
- changes: b,
1773
- effects: EditorView.announce.of(x),
1772
+ changes: S,
1773
+ effects: EditorView.announce.of(C),
1774
1774
  userEvent: "input.replace.all"
1775
1775
  }), true;
1776
1776
  });
1777
1777
  function createSearchPanel(e6) {
1778
1778
  return e6.state.facet(searchConfigFacet).createPanel(e6);
1779
1779
  }
1780
- function defaultQuery(e6, y) {
1781
- let b = e6.selection.main, x = b.empty || b.to > b.from + 100 ? "" : e6.sliceDoc(b.from, b.to);
1782
- if (y && !x) return y;
1783
- let S = e6.facet(searchConfigFacet);
1780
+ function defaultQuery(e6, x) {
1781
+ let S = e6.selection.main, C = S.empty || S.to > S.from + 100 ? "" : e6.sliceDoc(S.from, S.to);
1782
+ if (x && !C) return x;
1783
+ let w = e6.facet(searchConfigFacet);
1784
1784
  return new SearchQuery({
1785
- search: (y == null ? void 0 : y.literal) ?? S.literal ? x : x.replace(/\n/g, "\\n"),
1786
- caseSensitive: (y == null ? void 0 : y.caseSensitive) ?? S.caseSensitive,
1787
- literal: (y == null ? void 0 : y.literal) ?? S.literal,
1788
- regexp: (y == null ? void 0 : y.regexp) ?? S.regexp,
1789
- wholeWord: (y == null ? void 0 : y.wholeWord) ?? S.wholeWord
1785
+ search: (x == null ? void 0 : x.literal) ?? w.literal ? C : C.replace(/\n/g, "\\n"),
1786
+ caseSensitive: (x == null ? void 0 : x.caseSensitive) ?? w.caseSensitive,
1787
+ literal: (x == null ? void 0 : x.literal) ?? w.literal,
1788
+ regexp: (x == null ? void 0 : x.regexp) ?? w.regexp,
1789
+ wholeWord: (x == null ? void 0 : x.wholeWord) ?? w.wholeWord
1790
1790
  });
1791
1791
  }
1792
1792
  function getSearchInput(e6) {
1793
- let y = getPanel(e6, createSearchPanel);
1794
- return y && y.dom.querySelector("[main-field]");
1793
+ let x = getPanel(e6, createSearchPanel);
1794
+ return x && x.dom.querySelector("[main-field]");
1795
1795
  }
1796
1796
  function selectSearchInput(e6) {
1797
- let y = getSearchInput(e6);
1798
- y && y == e6.root.activeElement && y.select();
1797
+ let x = getSearchInput(e6);
1798
+ x && x == e6.root.activeElement && x.select();
1799
1799
  }
1800
1800
  var openSearchPanel = (e6) => {
1801
- let y = e6.state.field(searchState, false);
1802
- if (y && y.panel) {
1803
- let b = getSearchInput(e6);
1804
- if (b && b != e6.root.activeElement) {
1805
- let x = defaultQuery(e6.state, y.query.spec);
1806
- x.valid && e6.dispatch({ effects: setSearchQuery.of(x) }), b.focus(), b.select();
1801
+ let x = e6.state.field(searchState, false);
1802
+ if (x && x.panel) {
1803
+ let S = getSearchInput(e6);
1804
+ if (S && S != e6.root.activeElement) {
1805
+ let C = defaultQuery(e6.state, x.query.spec);
1806
+ C.valid && e6.dispatch({ effects: setSearchQuery.of(C) }), S.focus(), S.select();
1807
1807
  }
1808
- } else e6.dispatch({ effects: [togglePanel$1.of(true), y ? setSearchQuery.of(defaultQuery(e6.state, y.query.spec)) : StateEffect.appendConfig.of(searchExtensions)] });
1808
+ } else e6.dispatch({ effects: [togglePanel$1.of(true), x ? setSearchQuery.of(defaultQuery(e6.state, x.query.spec)) : StateEffect.appendConfig.of(searchExtensions)] });
1809
1809
  return true;
1810
1810
  }, closeSearchPanel = (e6) => {
1811
- let y = e6.state.field(searchState, false);
1812
- if (!y || !y.panel) return false;
1813
- let b = getPanel(e6, createSearchPanel);
1814
- return b && b.dom.contains(e6.root.activeElement) && e6.focus(), e6.dispatch({ effects: togglePanel$1.of(false) }), true;
1811
+ let x = e6.state.field(searchState, false);
1812
+ if (!x || !x.panel) return false;
1813
+ let S = getPanel(e6, createSearchPanel);
1814
+ return S && S.dom.contains(e6.root.activeElement) && e6.focus(), e6.dispatch({ effects: togglePanel$1.of(false) }), true;
1815
1815
  }, searchKeymap = [
1816
1816
  {
1817
1817
  key: "Mod-f",
@@ -1853,9 +1853,9 @@ var openSearchPanel = (e6) => {
1853
1853
  ], SearchPanel = class {
1854
1854
  constructor(e6) {
1855
1855
  this.view = e6;
1856
- let y = this.query = e6.state.field(searchState).query.spec;
1856
+ let x = this.query = e6.state.field(searchState).query.spec;
1857
1857
  this.commit = this.commit.bind(this), this.searchField = crelt("input", {
1858
- value: y.search,
1858
+ value: x.search,
1859
1859
  placeholder: phrase(e6, "Find"),
1860
1860
  "aria-label": phrase(e6, "Find"),
1861
1861
  class: "cm-textfield",
@@ -1865,7 +1865,7 @@ var openSearchPanel = (e6) => {
1865
1865
  onchange: this.commit,
1866
1866
  onkeyup: this.commit
1867
1867
  }), this.replaceField = crelt("input", {
1868
- value: y.replace,
1868
+ value: x.replace,
1869
1869
  placeholder: phrase(e6, "Replace"),
1870
1870
  "aria-label": phrase(e6, "Replace"),
1871
1871
  class: "cm-textfield",
@@ -1877,45 +1877,45 @@ var openSearchPanel = (e6) => {
1877
1877
  type: "checkbox",
1878
1878
  name: "case",
1879
1879
  form: "",
1880
- checked: y.caseSensitive,
1880
+ checked: x.caseSensitive,
1881
1881
  onchange: this.commit
1882
1882
  }), this.reField = crelt("input", {
1883
1883
  type: "checkbox",
1884
1884
  name: "re",
1885
1885
  form: "",
1886
- checked: y.regexp,
1886
+ checked: x.regexp,
1887
1887
  onchange: this.commit
1888
1888
  }), this.wordField = crelt("input", {
1889
1889
  type: "checkbox",
1890
1890
  name: "word",
1891
1891
  form: "",
1892
- checked: y.wholeWord,
1892
+ checked: x.wholeWord,
1893
1893
  onchange: this.commit
1894
1894
  });
1895
- function b(e7, y2, b2) {
1895
+ function S(e7, x2, S2) {
1896
1896
  return crelt("button", {
1897
1897
  class: "cm-button",
1898
1898
  name: e7,
1899
- onclick: y2,
1899
+ onclick: x2,
1900
1900
  type: "button"
1901
- }, b2);
1901
+ }, S2);
1902
1902
  }
1903
1903
  this.dom = crelt("div", {
1904
1904
  onkeydown: (e7) => this.keydown(e7),
1905
1905
  class: "cm-search"
1906
1906
  }, [
1907
1907
  this.searchField,
1908
- b("next", () => findNext(e6), [phrase(e6, "next")]),
1909
- b("prev", () => findPrevious(e6), [phrase(e6, "previous")]),
1910
- b("select", () => selectMatches(e6), [phrase(e6, "all")]),
1908
+ S("next", () => findNext(e6), [phrase(e6, "next")]),
1909
+ S("prev", () => findPrevious(e6), [phrase(e6, "previous")]),
1910
+ S("select", () => selectMatches(e6), [phrase(e6, "all")]),
1911
1911
  crelt("label", null, [this.caseField, phrase(e6, "match case")]),
1912
1912
  crelt("label", null, [this.reField, phrase(e6, "regexp")]),
1913
1913
  crelt("label", null, [this.wordField, phrase(e6, "by word")]),
1914
1914
  ...e6.state.readOnly ? [] : [
1915
1915
  crelt("br"),
1916
1916
  this.replaceField,
1917
- b("replace", () => replaceNext(e6), [phrase(e6, "replace")]),
1918
- b("replaceAll", () => replaceAll(e6), [phrase(e6, "replace all")])
1917
+ S("replace", () => replaceNext(e6), [phrase(e6, "replace")]),
1918
+ S("replaceAll", () => replaceAll(e6), [phrase(e6, "replace all")])
1919
1919
  ],
1920
1920
  crelt("button", {
1921
1921
  name: "close",
@@ -1939,7 +1939,7 @@ var openSearchPanel = (e6) => {
1939
1939
  runScopeHandlers(this.view, e6, "search-panel") ? e6.preventDefault() : e6.keyCode == 13 && e6.target == this.searchField ? (e6.preventDefault(), (e6.shiftKey ? findPrevious : findNext)(this.view)) : e6.keyCode == 13 && e6.target == this.replaceField && (e6.preventDefault(), replaceNext(this.view));
1940
1940
  }
1941
1941
  update(e6) {
1942
- for (let y of e6.transactions) for (let e7 of y.effects) e7.is(setSearchQuery) && !e7.value.eq(this.query) && this.setQuery(e7.value);
1942
+ for (let x of e6.transactions) for (let e7 of x.effects) e7.is(setSearchQuery) && !e7.value.eq(this.query) && this.setQuery(e7.value);
1943
1943
  }
1944
1944
  setQuery(e6) {
1945
1945
  this.query = e6, this.searchField.value = e6.search, this.replaceField.value = e6.replace, this.caseField.checked = e6.caseSensitive, this.reField.checked = e6.regexp, this.wordField.checked = e6.wholeWord;
@@ -1954,25 +1954,25 @@ var openSearchPanel = (e6) => {
1954
1954
  return this.view.state.facet(searchConfigFacet).top;
1955
1955
  }
1956
1956
  };
1957
- function phrase(e6, y) {
1958
- return e6.state.phrase(y);
1957
+ function phrase(e6, x) {
1958
+ return e6.state.phrase(x);
1959
1959
  }
1960
1960
  var AnnounceMargin = 30, Break = /[\s\.,:;?!]/;
1961
- function announceMatch(e6, { from: y, to: b }) {
1962
- let x = e6.state.doc.lineAt(y), S = e6.state.doc.lineAt(b).to, C = Math.max(x.from, y - AnnounceMargin), w = Math.min(S, b + AnnounceMargin), T = e6.state.sliceDoc(C, w);
1963
- if (C != x.from) {
1964
- for (let e7 = 0; e7 < AnnounceMargin; e7++) if (!Break.test(T[e7 + 1]) && Break.test(T[e7])) {
1965
- T = T.slice(e7);
1961
+ function announceMatch(e6, { from: x, to: S }) {
1962
+ let C = e6.state.doc.lineAt(x), w = e6.state.doc.lineAt(S).to, T = Math.max(C.from, x - AnnounceMargin), E = Math.min(w, S + AnnounceMargin), D = e6.state.sliceDoc(T, E);
1963
+ if (T != C.from) {
1964
+ for (let e7 = 0; e7 < AnnounceMargin; e7++) if (!Break.test(D[e7 + 1]) && Break.test(D[e7])) {
1965
+ D = D.slice(e7);
1966
1966
  break;
1967
1967
  }
1968
1968
  }
1969
- if (w != S) {
1970
- for (let e7 = T.length - 1; e7 > T.length - AnnounceMargin; e7--) if (!Break.test(T[e7 - 1]) && Break.test(T[e7])) {
1971
- T = T.slice(0, e7);
1969
+ if (E != w) {
1970
+ for (let e7 = D.length - 1; e7 > D.length - AnnounceMargin; e7--) if (!Break.test(D[e7 - 1]) && Break.test(D[e7])) {
1971
+ D = D.slice(0, e7);
1972
1972
  break;
1973
1973
  }
1974
1974
  }
1975
- return EditorView.announce.of(`${e6.state.phrase("current match")}. ${T} ${e6.state.phrase("on line")} ${x.number}.`);
1975
+ return EditorView.announce.of(`${e6.state.phrase("current match")}. ${D} ${e6.state.phrase("on line")} ${C.number}.`);
1976
1976
  }
1977
1977
  var baseTheme$2 = /* @__PURE__ */ EditorView.baseTheme({
1978
1978
  ".cm-panel.cm-search": {
@@ -2004,129 +2004,129 @@ var baseTheme$2 = /* @__PURE__ */ EditorView.baseTheme({
2004
2004
  /* @__PURE__ */ Prec.low(searchHighlighter),
2005
2005
  baseTheme$2
2006
2006
  ], SelectedDiagnostic = class {
2007
- constructor(e6, y, b) {
2008
- this.from = e6, this.to = y, this.diagnostic = b;
2007
+ constructor(e6, x, S) {
2008
+ this.from = e6, this.to = x, this.diagnostic = S;
2009
2009
  }
2010
2010
  }, LintState = class e4 {
2011
- constructor(e6, y, b) {
2012
- this.diagnostics = e6, this.panel = y, this.selected = b;
2011
+ constructor(e6, x, S) {
2012
+ this.diagnostics = e6, this.panel = x, this.selected = S;
2013
2013
  }
2014
- static init(y, b, x) {
2015
- let S = x.facet(lintConfig).markerFilter;
2016
- S && (y = S(y, x));
2017
- let C = y.slice().sort((e6, y2) => e6.from - y2.from || e6.to - y2.to), w = new RangeSetBuilder(), T = [], E = 0, D = x.doc.iter(), O = 0;
2014
+ static init(x, S, C) {
2015
+ let w = C.facet(lintConfig).markerFilter;
2016
+ w && (x = w(x, C));
2017
+ let T = x.slice().sort((e6, x2) => e6.from - x2.from || e6.to - x2.to), E = new RangeSetBuilder(), D = [], O = 0, k = C.doc.iter(), A = 0;
2018
2018
  for (let e6 = 0; ; ) {
2019
- let y2 = e6 == C.length ? null : C[e6];
2020
- if (!y2 && !T.length) break;
2021
- let b2, x2;
2022
- for (T.length ? (b2 = E, x2 = T.reduce((e7, y3) => Math.min(e7, y3.to), y2 && y2.from > b2 ? y2.from : 1e8)) : (b2 = y2.from, x2 = y2.to, T.push(y2), e6++); e6 < C.length; ) {
2023
- let y3 = C[e6];
2024
- if (y3.from == b2 && (y3.to > y3.from || y3.to == b2)) T.push(y3), e6++, x2 = Math.min(y3.to, x2);
2019
+ let x2 = e6 == T.length ? null : T[e6];
2020
+ if (!x2 && !D.length) break;
2021
+ let S2, C2;
2022
+ for (D.length ? (S2 = O, C2 = D.reduce((e7, x3) => Math.min(e7, x3.to), x2 && x2.from > S2 ? x2.from : 1e8)) : (S2 = x2.from, C2 = x2.to, D.push(x2), e6++); e6 < T.length; ) {
2023
+ let x3 = T[e6];
2024
+ if (x3.from == S2 && (x3.to > x3.from || x3.to == S2)) D.push(x3), e6++, C2 = Math.min(x3.to, C2);
2025
2025
  else {
2026
- x2 = Math.min(y3.from, x2);
2026
+ C2 = Math.min(x3.from, C2);
2027
2027
  break;
2028
2028
  }
2029
2029
  }
2030
- let S2 = false;
2031
- if (T.some((e7) => e7.from == b2 && e7.to == x2) && (S2 = b2 == x2, !S2 && x2 - b2 < 10)) {
2032
- let e7 = b2 - (O + D.value.length);
2033
- e7 > 0 && (D.next(e7), O = b2);
2034
- for (let e8 = b2; ; ) {
2035
- if (e8 >= x2) {
2036
- S2 = true;
2030
+ let w2 = false;
2031
+ if (D.some((e7) => e7.from == S2 && e7.to == C2) && (w2 = S2 == C2, !w2 && C2 - S2 < 10)) {
2032
+ let e7 = S2 - (A + k.value.length);
2033
+ e7 > 0 && (k.next(e7), A = S2);
2034
+ for (let e8 = S2; ; ) {
2035
+ if (e8 >= C2) {
2036
+ w2 = true;
2037
2037
  break;
2038
2038
  }
2039
- if (!D.lineBreak && O + D.value.length > e8) break;
2040
- e8 = O + D.value.length, O += D.value.length, D.next();
2039
+ if (!k.lineBreak && A + k.value.length > e8) break;
2040
+ e8 = A + k.value.length, A += k.value.length, k.next();
2041
2041
  }
2042
2042
  }
2043
- let k2 = maxSeverity(T);
2044
- if (S2) w.add(b2, b2, Decoration.widget({
2045
- widget: new DiagnosticWidget(k2),
2046
- diagnostics: T.slice()
2043
+ let j2 = maxSeverity(D);
2044
+ if (w2) E.add(S2, S2, Decoration.widget({
2045
+ widget: new DiagnosticWidget(j2),
2046
+ diagnostics: D.slice()
2047
2047
  }));
2048
2048
  else {
2049
- let e7 = T.reduce((e8, y3) => y3.markClass ? e8 + " " + y3.markClass : e8, "");
2050
- w.add(b2, x2, Decoration.mark({
2051
- class: "cm-lintRange cm-lintRange-" + k2 + e7,
2052
- diagnostics: T.slice(),
2053
- inclusiveEnd: T.some((e8) => e8.to > x2)
2049
+ let e7 = D.reduce((e8, x3) => x3.markClass ? e8 + " " + x3.markClass : e8, "");
2050
+ E.add(S2, C2, Decoration.mark({
2051
+ class: "cm-lintRange cm-lintRange-" + j2 + e7,
2052
+ diagnostics: D.slice(),
2053
+ inclusiveEnd: D.some((e8) => e8.to > C2)
2054
2054
  }));
2055
2055
  }
2056
- E = x2;
2057
- for (let e7 = 0; e7 < T.length; e7++) T[e7].to <= E && T.splice(e7--, 1);
2056
+ O = C2;
2057
+ for (let e7 = 0; e7 < D.length; e7++) D[e7].to <= O && D.splice(e7--, 1);
2058
2058
  }
2059
- let k = w.finish();
2060
- return new e4(k, b, findDiagnostic(k));
2059
+ let j = E.finish();
2060
+ return new e4(j, S, findDiagnostic(j));
2061
2061
  }
2062
2062
  };
2063
- function findDiagnostic(e6, y = null, b = 0) {
2064
- let x = null;
2065
- return e6.between(b, 1e9, (e7, b2, { spec: S }) => {
2066
- if (!(y && S.diagnostics.indexOf(y) < 0)) if (!x) x = new SelectedDiagnostic(e7, b2, y || S.diagnostics[0]);
2067
- else if (S.diagnostics.indexOf(x.diagnostic) < 0) return false;
2068
- else x = new SelectedDiagnostic(x.from, b2, x.diagnostic);
2069
- }), x;
2063
+ function findDiagnostic(e6, x = null, S = 0) {
2064
+ let C = null;
2065
+ return e6.between(S, 1e9, (e7, S2, { spec: w }) => {
2066
+ if (!(x && w.diagnostics.indexOf(x) < 0)) if (!C) C = new SelectedDiagnostic(e7, S2, x || w.diagnostics[0]);
2067
+ else if (w.diagnostics.indexOf(C.diagnostic) < 0) return false;
2068
+ else C = new SelectedDiagnostic(C.from, S2, C.diagnostic);
2069
+ }), C;
2070
2070
  }
2071
- function hideTooltip(e6, y) {
2072
- let b = y.pos, x = y.end || b, S = e6.state.facet(lintConfig).hideOn(e6, b, x);
2073
- if (S != null) return S;
2074
- let C = e6.startState.doc.lineAt(y.pos);
2075
- return !!(e6.effects.some((e7) => e7.is(setDiagnosticsEffect)) || e6.changes.touchesRange(C.from, Math.max(C.to, x)));
2071
+ function hideTooltip(e6, x) {
2072
+ let S = x.pos, C = x.end || S, w = e6.state.facet(lintConfig).hideOn(e6, S, C);
2073
+ if (w != null) return w;
2074
+ let T = e6.startState.doc.lineAt(x.pos);
2075
+ return !!(e6.effects.some((e7) => e7.is(setDiagnosticsEffect)) || e6.changes.touchesRange(T.from, Math.max(T.to, C)));
2076
2076
  }
2077
- function maybeEnableLint(e6, y) {
2078
- return e6.field(lintState, false) ? y : y.concat(StateEffect.appendConfig.of(lintExtensions));
2077
+ function maybeEnableLint(e6, x) {
2078
+ return e6.field(lintState, false) ? x : x.concat(StateEffect.appendConfig.of(lintExtensions));
2079
2079
  }
2080
- function setDiagnostics(e6, y) {
2081
- return { effects: maybeEnableLint(e6, [setDiagnosticsEffect.of(y)]) };
2080
+ function setDiagnostics(e6, x) {
2081
+ return { effects: maybeEnableLint(e6, [setDiagnosticsEffect.of(x)]) };
2082
2082
  }
2083
2083
  var setDiagnosticsEffect = /* @__PURE__ */ StateEffect.define(), togglePanel = /* @__PURE__ */ StateEffect.define(), movePanelSelection = /* @__PURE__ */ StateEffect.define(), lintState = /* @__PURE__ */ StateField.define({
2084
2084
  create() {
2085
2085
  return new LintState(Decoration.none, null, null);
2086
2086
  },
2087
- update(e6, y) {
2088
- if (y.docChanged && e6.diagnostics.size) {
2089
- let b = e6.diagnostics.map(y.changes), x = null, S = e6.panel;
2087
+ update(e6, x) {
2088
+ if (x.docChanged && e6.diagnostics.size) {
2089
+ let S = e6.diagnostics.map(x.changes), C = null, w = e6.panel;
2090
2090
  if (e6.selected) {
2091
- let S2 = y.changes.mapPos(e6.selected.from, 1);
2092
- x = findDiagnostic(b, e6.selected.diagnostic, S2) || findDiagnostic(b, null, S2);
2091
+ let w2 = x.changes.mapPos(e6.selected.from, 1);
2092
+ C = findDiagnostic(S, e6.selected.diagnostic, w2) || findDiagnostic(S, null, w2);
2093
2093
  }
2094
- !b.size && S && y.state.facet(lintConfig).autoPanel && (S = null), e6 = new LintState(b, S, x);
2094
+ !S.size && w && x.state.facet(lintConfig).autoPanel && (w = null), e6 = new LintState(S, w, C);
2095
2095
  }
2096
- for (let b of y.effects) if (b.is(setDiagnosticsEffect)) {
2097
- let x = y.state.facet(lintConfig).autoPanel ? b.value.length ? LintPanel.open : null : e6.panel;
2098
- e6 = LintState.init(b.value, x, y.state);
2099
- } else b.is(togglePanel) ? e6 = new LintState(e6.diagnostics, b.value ? LintPanel.open : null, e6.selected) : b.is(movePanelSelection) && (e6 = new LintState(e6.diagnostics, e6.panel, b.value));
2096
+ for (let S of x.effects) if (S.is(setDiagnosticsEffect)) {
2097
+ let C = x.state.facet(lintConfig).autoPanel ? S.value.length ? LintPanel.open : null : e6.panel;
2098
+ e6 = LintState.init(S.value, C, x.state);
2099
+ } else S.is(togglePanel) ? e6 = new LintState(e6.diagnostics, S.value ? LintPanel.open : null, e6.selected) : S.is(movePanelSelection) && (e6 = new LintState(e6.diagnostics, e6.panel, S.value));
2100
2100
  return e6;
2101
2101
  },
2102
2102
  provide: (e6) => [showPanel.from(e6, (e7) => e7.panel), EditorView.decorations.from(e6, (e7) => e7.diagnostics)]
2103
2103
  }), activeMark = /* @__PURE__ */ Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
2104
- function lintTooltip(e6, y, b) {
2105
- let { diagnostics: x } = e6.state.field(lintState), S, C = -1, w = -1;
2106
- x.between(y - (b < 0 ? 1 : 0), y + (b > 0 ? 1 : 0), (e7, x2, { spec: T2 }) => {
2107
- if (y >= e7 && y <= x2 && (e7 == x2 || (y > e7 || b > 0) && (y < x2 || b < 0))) return S = T2.diagnostics, C = e7, w = x2, false;
2104
+ function lintTooltip(e6, x, S) {
2105
+ let { diagnostics: C } = e6.state.field(lintState), w, T = -1, E = -1;
2106
+ C.between(x - (S < 0 ? 1 : 0), x + (S > 0 ? 1 : 0), (e7, C2, { spec: D2 }) => {
2107
+ if (x >= e7 && x <= C2 && (e7 == C2 || (x > e7 || S > 0) && (x < C2 || S < 0))) return w = D2.diagnostics, T = e7, E = C2, false;
2108
2108
  });
2109
- let T = e6.state.facet(lintConfig).tooltipFilter;
2110
- return S && T && (S = T(S, e6.state)), S ? {
2111
- pos: C,
2112
- end: w,
2113
- above: e6.state.doc.lineAt(C).to < w,
2109
+ let D = e6.state.facet(lintConfig).tooltipFilter;
2110
+ return w && D && (w = D(w, e6.state)), w ? {
2111
+ pos: T,
2112
+ end: E,
2113
+ above: e6.state.doc.lineAt(T).to < E,
2114
2114
  create() {
2115
- return { dom: diagnosticsTooltip(e6, S) };
2115
+ return { dom: diagnosticsTooltip(e6, w) };
2116
2116
  }
2117
2117
  } : null;
2118
2118
  }
2119
- function diagnosticsTooltip(e6, y) {
2120
- return crelt("ul", { class: "cm-tooltip-lint" }, y.map((y2) => renderDiagnostic(e6, y2, false)));
2119
+ function diagnosticsTooltip(e6, x) {
2120
+ return crelt("ul", { class: "cm-tooltip-lint" }, x.map((x2) => renderDiagnostic(e6, x2, false)));
2121
2121
  }
2122
2122
  var openLintPanel = (e6) => {
2123
- let y = e6.state.field(lintState, false);
2124
- (!y || !y.panel) && e6.dispatch({ effects: maybeEnableLint(e6.state, [togglePanel.of(true)]) });
2125
- let b = getPanel(e6, LintPanel.open);
2126
- return b && b.dom.querySelector(".cm-panel-lint ul").focus(), true;
2123
+ let x = e6.state.field(lintState, false);
2124
+ (!x || !x.panel) && e6.dispatch({ effects: maybeEnableLint(e6.state, [togglePanel.of(true)]) });
2125
+ let S = getPanel(e6, LintPanel.open);
2126
+ return S && S.dom.querySelector(".cm-panel-lint ul").focus(), true;
2127
2127
  }, closeLintPanel = (e6) => {
2128
- let y = e6.state.field(lintState, false);
2129
- return !y || !y.panel ? false : (e6.dispatch({ effects: togglePanel.of(false) }), true);
2128
+ let x = e6.state.field(lintState, false);
2129
+ return !x || !x.panel ? false : (e6.dispatch({ effects: togglePanel.of(false) }), true);
2130
2130
  }, lintKeymap = [{
2131
2131
  key: "Mod-Shift-m",
2132
2132
  run: openLintPanel,
@@ -2134,55 +2134,18 @@ var openLintPanel = (e6) => {
2134
2134
  }, {
2135
2135
  key: "F8",
2136
2136
  run: (e6) => {
2137
- let y = e6.state.field(lintState, false);
2138
- if (!y) return false;
2139
- let b = e6.state.selection.main, x = y.diagnostics.iter(b.to + 1);
2140
- return !x.value && (x = y.diagnostics.iter(0), !x.value || x.from == b.from && x.to == b.to) ? false : (e6.dispatch({
2137
+ let x = e6.state.field(lintState, false);
2138
+ if (!x) return false;
2139
+ let S = e6.state.selection.main, C = x.diagnostics.iter(S.to + 1);
2140
+ return !C.value && (C = x.diagnostics.iter(0), !C.value || C.from == S.from && C.to == S.to) ? false : (e6.dispatch({
2141
2141
  selection: {
2142
- anchor: x.from,
2143
- head: x.to
2142
+ anchor: C.from,
2143
+ head: C.to
2144
2144
  },
2145
2145
  scrollIntoView: true
2146
2146
  }), true);
2147
2147
  }
2148
- }], lintPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
2149
- constructor(e6) {
2150
- this.view = e6, this.timeout = -1, this.set = true;
2151
- let { delay: y } = e6.state.facet(lintConfig);
2152
- this.lintTime = Date.now() + y, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, y);
2153
- }
2154
- run() {
2155
- clearTimeout(this.timeout);
2156
- let e6 = Date.now();
2157
- if (e6 < this.lintTime - 10) this.timeout = setTimeout(this.run, this.lintTime - e6);
2158
- else {
2159
- this.set = false;
2160
- let { state: e7 } = this.view, { sources: y } = e7.facet(lintConfig);
2161
- y.length && batchResults(y.map((e8) => Promise.resolve(e8(this.view))), (y2) => {
2162
- this.view.state.doc == e7.doc && this.view.dispatch(setDiagnostics(this.view.state, y2.reduce((e8, y3) => e8.concat(y3))));
2163
- }, (e8) => {
2164
- logException(this.view.state, e8);
2165
- });
2166
- }
2167
- }
2168
- update(e6) {
2169
- let y = e6.state.facet(lintConfig);
2170
- (e6.docChanged || y != e6.startState.facet(lintConfig) || y.needsRefresh && y.needsRefresh(e6)) && (this.lintTime = Date.now() + y.delay, this.set || (this.set = true, this.timeout = setTimeout(this.run, y.delay)));
2171
- }
2172
- force() {
2173
- this.set && (this.lintTime = Date.now(), this.run());
2174
- }
2175
- destroy() {
2176
- clearTimeout(this.timeout);
2177
- }
2178
- });
2179
- function batchResults(e6, y, b) {
2180
- let x = [], S = -1;
2181
- for (let C of e6) C.then((b2) => {
2182
- x.push(b2), clearTimeout(S), x.length == e6.length ? y(x) : S = setTimeout(() => y(x), 200);
2183
- }, b);
2184
- }
2185
- var lintConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
2148
+ }], lintConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
2186
2149
  return {
2187
2150
  sources: e6.map((e7) => e7.source).filter((e7) => e7 != null),
2188
2151
  ...combineConfig(e6.map((e7) => e7.config), {
@@ -2195,61 +2158,51 @@ var lintConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
2195
2158
  delay: Math.max,
2196
2159
  markerFilter: combineFilter,
2197
2160
  tooltipFilter: combineFilter,
2198
- needsRefresh: (e7, y) => e7 ? y ? (b) => e7(b) || y(b) : e7 : y,
2199
- hideOn: (e7, y) => e7 ? y ? (b, x, S) => e7(b, x, S) || y(b, x, S) : e7 : y,
2200
- autoPanel: (e7, y) => e7 || y
2161
+ needsRefresh: (e7, x) => e7 ? x ? (S) => e7(S) || x(S) : e7 : x,
2162
+ hideOn: (e7, x) => e7 ? x ? (S, C, w) => e7(S, C, w) || x(S, C, w) : e7 : x,
2163
+ autoPanel: (e7, x) => e7 || x
2201
2164
  })
2202
2165
  };
2203
2166
  } });
2204
- function combineFilter(e6, y) {
2205
- return e6 ? y ? (b, x) => y(e6(b, x), x) : e6 : y;
2206
- }
2207
- function linter(e6, y = {}) {
2208
- return [
2209
- lintConfig.of({
2210
- source: e6,
2211
- config: y
2212
- }),
2213
- lintPlugin,
2214
- lintExtensions
2215
- ];
2167
+ function combineFilter(e6, x) {
2168
+ return e6 ? x ? (S, C) => x(e6(S, C), C) : e6 : x;
2216
2169
  }
2217
2170
  function assignKeys(e6) {
2218
- let y = [];
2219
- if (e6) actions: for (let { name: b } of e6) {
2220
- for (let e7 = 0; e7 < b.length; e7++) {
2221
- let x = b[e7];
2222
- if (/[a-zA-Z]/.test(x) && !y.some((e8) => e8.toLowerCase() == x.toLowerCase())) {
2223
- y.push(x);
2171
+ let x = [];
2172
+ if (e6) actions: for (let { name: S } of e6) {
2173
+ for (let e7 = 0; e7 < S.length; e7++) {
2174
+ let C = S[e7];
2175
+ if (/[a-zA-Z]/.test(C) && !x.some((e8) => e8.toLowerCase() == C.toLowerCase())) {
2176
+ x.push(C);
2224
2177
  continue actions;
2225
2178
  }
2226
2179
  }
2227
- y.push("");
2180
+ x.push("");
2228
2181
  }
2229
- return y;
2182
+ return x;
2230
2183
  }
2231
- function renderDiagnostic(e6, y, b) {
2184
+ function renderDiagnostic(e6, x, S) {
2232
2185
  var _a;
2233
- let x = b ? assignKeys(y.actions) : [];
2234
- return crelt("li", { class: "cm-diagnostic cm-diagnostic-" + y.severity }, crelt("span", { class: "cm-diagnosticText" }, y.renderMessage ? y.renderMessage(e6) : y.message), (_a = y.actions) == null ? void 0 : _a.map((b2, S) => {
2235
- let C = false, w = (x2) => {
2236
- if (x2.preventDefault(), C) return;
2237
- C = true;
2238
- let S2 = findDiagnostic(e6.state.field(lintState).diagnostics, y);
2239
- S2 && b2.apply(e6, S2.from, S2.to);
2240
- }, { name: T } = b2, E = x[S] ? T.indexOf(x[S]) : -1, D = E < 0 ? T : [
2241
- T.slice(0, E),
2242
- crelt("u", T.slice(E, E + 1)),
2243
- T.slice(E + 1)
2186
+ let C = S ? assignKeys(x.actions) : [];
2187
+ return crelt("li", { class: "cm-diagnostic cm-diagnostic-" + x.severity }, crelt("span", { class: "cm-diagnosticText" }, x.renderMessage ? x.renderMessage(e6) : x.message), (_a = x.actions) == null ? void 0 : _a.map((S2, w) => {
2188
+ let T = false, E = (C2) => {
2189
+ if (C2.preventDefault(), T) return;
2190
+ T = true;
2191
+ let w2 = findDiagnostic(e6.state.field(lintState).diagnostics, x);
2192
+ w2 && S2.apply(e6, w2.from, w2.to);
2193
+ }, { name: D } = S2, O = C[w] ? D.indexOf(C[w]) : -1, k = O < 0 ? D : [
2194
+ D.slice(0, O),
2195
+ crelt("u", D.slice(O, O + 1)),
2196
+ D.slice(O + 1)
2244
2197
  ];
2245
2198
  return crelt("button", {
2246
2199
  type: "button",
2247
- class: "cm-diagnosticAction" + (b2.markClass ? " " + b2.markClass : ""),
2248
- onclick: w,
2249
- onmousedown: w,
2250
- "aria-label": ` Action: ${T}${E < 0 ? "" : ` (access key "${x[S]})"`}.`
2251
- }, D);
2252
- }), y.source && crelt("div", { class: "cm-diagnosticSource" }, y.source));
2200
+ class: "cm-diagnosticAction" + (S2.markClass ? " " + S2.markClass : ""),
2201
+ onclick: E,
2202
+ onmousedown: E,
2203
+ "aria-label": ` Action: ${D}${O < 0 ? "" : ` (access key "${C[w]})"`}.`
2204
+ }, k);
2205
+ }), x.source && crelt("div", { class: "cm-diagnosticSource" }, x.source));
2253
2206
  }
2254
2207
  var DiagnosticWidget = class extends WidgetType {
2255
2208
  constructor(e6) {
@@ -2262,36 +2215,36 @@ var DiagnosticWidget = class extends WidgetType {
2262
2215
  return crelt("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
2263
2216
  }
2264
2217
  }, PanelItem = class {
2265
- constructor(e6, y) {
2266
- this.diagnostic = y, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = renderDiagnostic(e6, y, true), this.dom.id = this.id, this.dom.setAttribute("role", "option");
2218
+ constructor(e6, x) {
2219
+ this.diagnostic = x, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = renderDiagnostic(e6, x, true), this.dom.id = this.id, this.dom.setAttribute("role", "option");
2267
2220
  }
2268
2221
  }, LintPanel = class e5 {
2269
2222
  constructor(e6) {
2270
2223
  this.view = e6, this.items = [];
2271
- let y = (y2) => {
2272
- if (y2.keyCode == 27) closeLintPanel(this.view), this.view.focus();
2273
- else if (y2.keyCode == 38 || y2.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
2274
- else if (y2.keyCode == 40 || y2.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
2275
- else if (y2.keyCode == 36) this.moveSelection(0);
2276
- else if (y2.keyCode == 35) this.moveSelection(this.items.length - 1);
2277
- else if (y2.keyCode == 13) this.view.focus();
2278
- else if (y2.keyCode >= 65 && y2.keyCode <= 90 && this.selectedIndex >= 0) {
2279
- let { diagnostic: b2 } = this.items[this.selectedIndex], x = assignKeys(b2.actions);
2280
- for (let S = 0; S < x.length; S++) if (x[S].toUpperCase().charCodeAt(0) == y2.keyCode) {
2281
- let y3 = findDiagnostic(this.view.state.field(lintState).diagnostics, b2);
2282
- y3 && b2.actions[S].apply(e6, y3.from, y3.to);
2224
+ let x = (x2) => {
2225
+ if (x2.keyCode == 27) closeLintPanel(this.view), this.view.focus();
2226
+ else if (x2.keyCode == 38 || x2.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
2227
+ else if (x2.keyCode == 40 || x2.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
2228
+ else if (x2.keyCode == 36) this.moveSelection(0);
2229
+ else if (x2.keyCode == 35) this.moveSelection(this.items.length - 1);
2230
+ else if (x2.keyCode == 13) this.view.focus();
2231
+ else if (x2.keyCode >= 65 && x2.keyCode <= 90 && this.selectedIndex >= 0) {
2232
+ let { diagnostic: S2 } = this.items[this.selectedIndex], C = assignKeys(S2.actions);
2233
+ for (let w = 0; w < C.length; w++) if (C[w].toUpperCase().charCodeAt(0) == x2.keyCode) {
2234
+ let x3 = findDiagnostic(this.view.state.field(lintState).diagnostics, S2);
2235
+ x3 && S2.actions[w].apply(e6, x3.from, x3.to);
2283
2236
  }
2284
2237
  } else return;
2285
- y2.preventDefault();
2286
- }, b = (e7) => {
2287
- for (let y2 = 0; y2 < this.items.length; y2++) this.items[y2].dom.contains(e7.target) && this.moveSelection(y2);
2238
+ x2.preventDefault();
2239
+ }, S = (e7) => {
2240
+ for (let x2 = 0; x2 < this.items.length; x2++) this.items[x2].dom.contains(e7.target) && this.moveSelection(x2);
2288
2241
  };
2289
2242
  this.list = crelt("ul", {
2290
2243
  tabIndex: 0,
2291
2244
  role: "listbox",
2292
2245
  "aria-label": this.view.state.phrase("Diagnostics"),
2293
- onkeydown: y,
2294
- onclick: b
2246
+ onkeydown: x,
2247
+ onclick: S
2295
2248
  }), this.dom = crelt("div", { class: "cm-panel-lint" }, this.list, crelt("button", {
2296
2249
  type: "button",
2297
2250
  name: "close",
@@ -2302,70 +2255,70 @@ var DiagnosticWidget = class extends WidgetType {
2302
2255
  get selectedIndex() {
2303
2256
  let e6 = this.view.state.field(lintState).selected;
2304
2257
  if (!e6) return -1;
2305
- for (let y = 0; y < this.items.length; y++) if (this.items[y].diagnostic == e6.diagnostic) return y;
2258
+ for (let x = 0; x < this.items.length; x++) if (this.items[x].diagnostic == e6.diagnostic) return x;
2306
2259
  return -1;
2307
2260
  }
2308
2261
  update() {
2309
- let { diagnostics: e6, selected: y } = this.view.state.field(lintState), b = 0, x = false, S = null, C = /* @__PURE__ */ new Set();
2310
- for (e6.between(0, this.view.state.doc.length, (e7, w, { spec: T }) => {
2311
- for (let e8 of T.diagnostics) {
2312
- if (C.has(e8)) continue;
2313
- C.add(e8);
2314
- let w2 = -1, T2;
2315
- for (let y2 = b; y2 < this.items.length; y2++) if (this.items[y2].diagnostic == e8) {
2316
- w2 = y2;
2262
+ let { diagnostics: e6, selected: x } = this.view.state.field(lintState), S = 0, C = false, w = null, T = /* @__PURE__ */ new Set();
2263
+ for (e6.between(0, this.view.state.doc.length, (e7, E, { spec: D }) => {
2264
+ for (let e8 of D.diagnostics) {
2265
+ if (T.has(e8)) continue;
2266
+ T.add(e8);
2267
+ let E2 = -1, D2;
2268
+ for (let x2 = S; x2 < this.items.length; x2++) if (this.items[x2].diagnostic == e8) {
2269
+ E2 = x2;
2317
2270
  break;
2318
2271
  }
2319
- w2 < 0 ? (T2 = new PanelItem(this.view, e8), this.items.splice(b, 0, T2), x = true) : (T2 = this.items[w2], w2 > b && (this.items.splice(b, w2 - b), x = true)), y && T2.diagnostic == y.diagnostic ? T2.dom.hasAttribute("aria-selected") || (T2.dom.setAttribute("aria-selected", "true"), S = T2) : T2.dom.hasAttribute("aria-selected") && T2.dom.removeAttribute("aria-selected"), b++;
2272
+ E2 < 0 ? (D2 = new PanelItem(this.view, e8), this.items.splice(S, 0, D2), C = true) : (D2 = this.items[E2], E2 > S && (this.items.splice(S, E2 - S), C = true)), x && D2.diagnostic == x.diagnostic ? D2.dom.hasAttribute("aria-selected") || (D2.dom.setAttribute("aria-selected", "true"), w = D2) : D2.dom.hasAttribute("aria-selected") && D2.dom.removeAttribute("aria-selected"), S++;
2320
2273
  }
2321
- }); b < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); ) x = true, this.items.pop();
2274
+ }); S < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); ) C = true, this.items.pop();
2322
2275
  this.items.length == 0 && (this.items.push(new PanelItem(this.view, {
2323
2276
  from: -1,
2324
2277
  to: -1,
2325
2278
  severity: "info",
2326
2279
  message: this.view.state.phrase("No diagnostics")
2327
- })), x = true), S ? (this.list.setAttribute("aria-activedescendant", S.id), this.view.requestMeasure({
2280
+ })), C = true), w ? (this.list.setAttribute("aria-activedescendant", w.id), this.view.requestMeasure({
2328
2281
  key: this,
2329
2282
  read: () => ({
2330
- sel: S.dom.getBoundingClientRect(),
2283
+ sel: w.dom.getBoundingClientRect(),
2331
2284
  panel: this.list.getBoundingClientRect()
2332
2285
  }),
2333
- write: ({ sel: e7, panel: y2 }) => {
2334
- let b2 = y2.height / this.list.offsetHeight;
2335
- e7.top < y2.top ? this.list.scrollTop -= (y2.top - e7.top) / b2 : e7.bottom > y2.bottom && (this.list.scrollTop += (e7.bottom - y2.bottom) / b2);
2286
+ write: ({ sel: e7, panel: x2 }) => {
2287
+ let S2 = x2.height / this.list.offsetHeight;
2288
+ e7.top < x2.top ? this.list.scrollTop -= (x2.top - e7.top) / S2 : e7.bottom > x2.bottom && (this.list.scrollTop += (e7.bottom - x2.bottom) / S2);
2336
2289
  }
2337
- })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), x && this.sync();
2290
+ })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), C && this.sync();
2338
2291
  }
2339
2292
  sync() {
2340
2293
  let e6 = this.list.firstChild;
2341
- function y() {
2342
- let y2 = e6;
2343
- e6 = y2.nextSibling, y2.remove();
2294
+ function x() {
2295
+ let x2 = e6;
2296
+ e6 = x2.nextSibling, x2.remove();
2344
2297
  }
2345
- for (let b of this.items) if (b.dom.parentNode == this.list) {
2346
- for (; e6 != b.dom; ) y();
2347
- e6 = b.dom.nextSibling;
2348
- } else this.list.insertBefore(b.dom, e6);
2349
- for (; e6; ) y();
2298
+ for (let S of this.items) if (S.dom.parentNode == this.list) {
2299
+ for (; e6 != S.dom; ) x();
2300
+ e6 = S.dom.nextSibling;
2301
+ } else this.list.insertBefore(S.dom, e6);
2302
+ for (; e6; ) x();
2350
2303
  }
2351
2304
  moveSelection(e6) {
2352
2305
  if (this.selectedIndex < 0) return;
2353
- let y = findDiagnostic(this.view.state.field(lintState).diagnostics, this.items[e6].diagnostic);
2354
- y && this.view.dispatch({
2306
+ let x = findDiagnostic(this.view.state.field(lintState).diagnostics, this.items[e6].diagnostic);
2307
+ x && this.view.dispatch({
2355
2308
  selection: {
2356
- anchor: y.from,
2357
- head: y.to
2309
+ anchor: x.from,
2310
+ head: x.to
2358
2311
  },
2359
2312
  scrollIntoView: true,
2360
- effects: movePanelSelection.of(y)
2313
+ effects: movePanelSelection.of(x)
2361
2314
  });
2362
2315
  }
2363
- static open(y) {
2364
- return new e5(y);
2316
+ static open(x) {
2317
+ return new e5(x);
2365
2318
  }
2366
2319
  };
2367
- function svg(e6, y = 'viewBox="0 0 40 40"') {
2368
- return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${y}>${encodeURIComponent(e6)}</svg>')`;
2320
+ function svg(e6, x = 'viewBox="0 0 40 40"') {
2321
+ return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${x}>${encodeURIComponent(e6)}</svg>')`;
2369
2322
  }
2370
2323
  function underline(e6) {
2371
2324
  return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e6}" fill="none" stroke-width=".7"/>`, 'width="6" height="3"');
@@ -2459,81 +2412,81 @@ function severityWeight(e6) {
2459
2412
  return e6 == "error" ? 4 : e6 == "warning" ? 3 : e6 == "info" ? 2 : 1;
2460
2413
  }
2461
2414
  function maxSeverity(e6) {
2462
- let y = "hint", b = 1;
2463
- for (let x of e6) {
2464
- let e7 = severityWeight(x.severity);
2465
- e7 > b && (b = e7, y = x.severity);
2415
+ let x = "hint", S = 1;
2416
+ for (let C of e6) {
2417
+ let e7 = severityWeight(C.severity);
2418
+ e7 > S && (S = e7, x = C.severity);
2466
2419
  }
2467
- return y;
2420
+ return x;
2468
2421
  }
2469
2422
  var lintExtensions = [
2470
2423
  lintState,
2471
2424
  /* @__PURE__ */ EditorView.decorations.compute([lintState], (e6) => {
2472
- let { selected: y, panel: b } = e6.field(lintState);
2473
- return !y || !b || y.from == y.to ? Decoration.none : Decoration.set([activeMark.range(y.from, y.to)]);
2425
+ let { selected: x, panel: S } = e6.field(lintState);
2426
+ return !x || !S || x.from == x.to ? Decoration.none : Decoration.set([activeMark.range(x.from, x.to)]);
2474
2427
  }),
2475
2428
  /* @__PURE__ */ hoverTooltip(lintTooltip, { hideOn: hideTooltip }),
2476
2429
  baseTheme
2477
2430
  ];
2478
- function forEachDiagnostic(e6, y) {
2479
- let b = e6.field(lintState, false);
2480
- if (b && b.diagnostics.size) {
2481
- let e7 = [], x = [], S = -1;
2482
- for (let C = RangeSet.iter([b.diagnostics]); ; C.next()) {
2483
- for (let b2 = 0; b2 < e7.length; b2++) (!C.value || C.value.spec.diagnostics.indexOf(e7[b2]) < 0) && (y(e7[b2], x[b2], S), e7.splice(b2, 1), x.splice(b2--, 1));
2484
- if (!C.value) break;
2485
- for (let y2 of C.value.spec.diagnostics) e7.indexOf(y2) < 0 && (e7.push(y2), x.push(C.from));
2486
- S = C.to;
2431
+ function forEachDiagnostic(e6, x) {
2432
+ let S = e6.field(lintState, false);
2433
+ if (S && S.diagnostics.size) {
2434
+ let e7 = [], C = [], w = -1;
2435
+ for (let T = RangeSet.iter([S.diagnostics]); ; T.next()) {
2436
+ for (let S2 = 0; S2 < e7.length; S2++) (!T.value || T.value.spec.diagnostics.indexOf(e7[S2]) < 0) && (x(e7[S2], C[S2], w), e7.splice(S2, 1), C.splice(S2--, 1));
2437
+ if (!T.value) break;
2438
+ for (let x2 of T.value.spec.diagnostics) e7.indexOf(x2) < 0 && (e7.push(x2), C.push(T.from));
2439
+ w = T.to;
2487
2440
  }
2488
2441
  }
2489
2442
  }
2490
2443
  function _extends() {
2491
2444
  return _extends = Object.assign ? Object.assign.bind() : function(e6) {
2492
- for (var y = 1; y < arguments.length; y++) {
2493
- var b = arguments[y];
2494
- for (var x in b) ({}).hasOwnProperty.call(b, x) && (e6[x] = b[x]);
2445
+ for (var x = 1; x < arguments.length; x++) {
2446
+ var S = arguments[x];
2447
+ for (var C in S) ({}).hasOwnProperty.call(S, C) && (e6[C] = S[C]);
2495
2448
  }
2496
2449
  return e6;
2497
2450
  }, _extends.apply(null, arguments);
2498
2451
  }
2499
- function _objectWithoutPropertiesLoose(e6, y) {
2452
+ function _objectWithoutPropertiesLoose(e6, x) {
2500
2453
  if (e6 == null) return {};
2501
- var b = {};
2502
- for (var x in e6) if ({}.hasOwnProperty.call(e6, x)) {
2503
- if (y.indexOf(x) !== -1) continue;
2504
- b[x] = e6[x];
2454
+ var S = {};
2455
+ for (var C in e6) if ({}.hasOwnProperty.call(e6, C)) {
2456
+ if (x.indexOf(C) !== -1) continue;
2457
+ S[C] = e6[C];
2505
2458
  }
2506
- return b;
2459
+ return S;
2507
2460
  }
2508
2461
  var strContent = 63, strDollarBrace = 64, strEnd = 65, escapeSequence = 66, indStrContent = 67, indStrDollarBrace = 68, indStrEnd = 69, indEscapeSequence = 70, quote = 34, backslack = 92, braceL = 123, dollar = 36, apostrophe = 39, scanString = /* @__PURE__ */ new ExternalTokenizer((e6) => {
2509
- for (let y = false, b = 0; ; b++) {
2510
- let { next: x } = e6;
2511
- if (x < 0) {
2512
- b > 0 && e6.acceptToken(strContent);
2462
+ for (let x = false, S = 0; ; S++) {
2463
+ let { next: C } = e6;
2464
+ if (C < 0) {
2465
+ S > 0 && e6.acceptToken(strContent);
2513
2466
  break;
2514
- } else if (x === quote) {
2515
- b > 0 ? e6.acceptToken(strContent) : e6.acceptToken(strEnd, 1);
2467
+ } else if (C === quote) {
2468
+ S > 0 ? e6.acceptToken(strContent) : e6.acceptToken(strEnd, 1);
2516
2469
  break;
2517
- } else if (x === braceL && y) {
2518
- b == 1 ? e6.acceptToken(strDollarBrace, 1) : e6.acceptToken(strContent, -1);
2470
+ } else if (C === braceL && x) {
2471
+ S == 1 ? e6.acceptToken(strDollarBrace, 1) : e6.acceptToken(strContent, -1);
2519
2472
  break;
2520
- } else x === backslack && (e6.advance(), e6.acceptToken(escapeSequence, 1));
2521
- y = x === dollar, e6.advance();
2473
+ } else C === backslack && (e6.advance(), e6.acceptToken(escapeSequence, 1));
2474
+ x = C === dollar, e6.advance();
2522
2475
  }
2523
2476
  }), scanIndString = /* @__PURE__ */ new ExternalTokenizer((e6) => {
2524
- for (let y = false, b = false, x = 0; ; x++) {
2525
- let { next: S } = e6;
2526
- if (S < 0) {
2527
- x > 0 && e6.acceptToken(indStrContent);
2477
+ for (let x = false, S = false, C = 0; ; C++) {
2478
+ let { next: w } = e6;
2479
+ if (w < 0) {
2480
+ C > 0 && e6.acceptToken(indStrContent);
2528
2481
  break;
2529
- } else if (S === apostrophe && b) {
2530
- x > 1 ? e6.acceptToken(indStrContent, -1) : e6.acceptToken(indStrEnd, 1);
2482
+ } else if (w === apostrophe && S) {
2483
+ C > 1 ? e6.acceptToken(indStrContent, -1) : e6.acceptToken(indStrEnd, 1);
2531
2484
  break;
2532
- } else if (S === braceL && y) {
2533
- x == 1 ? e6.acceptToken(indStrDollarBrace, 1) : e6.acceptToken(indStrContent, -1);
2485
+ } else if (w === braceL && x) {
2486
+ C == 1 ? e6.acceptToken(indStrDollarBrace, 1) : e6.acceptToken(indStrContent, -1);
2534
2487
  break;
2535
- } else S === backslack && (e6.advance(), e6.acceptToken(indEscapeSequence, 1));
2536
- y = S === dollar, b = S === apostrophe, e6.advance();
2488
+ } else w === backslack && (e6.advance(), e6.acceptToken(indEscapeSequence, 1));
2489
+ x = w === dollar, S = w === apostrophe, e6.advance();
2537
2490
  }
2538
2491
  }), spec_Identifier = {
2539
2492
  __proto__: null,
@@ -2608,10 +2561,10 @@ var strContent = 63, strDollarBrace = 64, strEnd = 65, escapeSequence = 66, indS
2608
2561
  AttrSet: foldInside,
2609
2562
  List: foldInside,
2610
2563
  Let(e6) {
2611
- let y = e6.getChild("let"), b = e6.getChild("in");
2612
- return !y || !b ? null : {
2613
- from: y.to,
2614
- to: b.from
2564
+ let x = e6.getChild("let"), S = e6.getChild("in");
2565
+ return !x || !S ? null : {
2566
+ from: x.to,
2567
+ to: S.from
2615
2568
  };
2616
2569
  }
2617
2570
  }),
@@ -2779,19 +2732,19 @@ function isSpace(e6) {
2779
2732
  return e6 == 9 || e6 == 10 || e6 == 13 || e6 == 32;
2780
2733
  }
2781
2734
  var cachedName = null, cachedInput = null, cachedPos = 0;
2782
- function tagNameAfter(e6, y) {
2783
- let b = e6.pos + y;
2784
- if (cachedPos == b && cachedInput == e6) return cachedName;
2785
- let x = e6.peek(y);
2786
- for (; isSpace(x); ) x = e6.peek(++y);
2787
- let S = "";
2788
- for (; nameChar(x); ) S += String.fromCharCode(x), x = e6.peek(++y);
2789
- return cachedInput = e6, cachedPos = b, cachedName = S ? S.toLowerCase() : x == question || x == bang ? void 0 : null;
2735
+ function tagNameAfter(e6, x) {
2736
+ let S = e6.pos + x;
2737
+ if (cachedPos == S && cachedInput == e6) return cachedName;
2738
+ let C = e6.peek(x);
2739
+ for (; isSpace(C); ) C = e6.peek(++x);
2740
+ let w = "";
2741
+ for (; nameChar(C); ) w += String.fromCharCode(C), C = e6.peek(++x);
2742
+ return cachedInput = e6, cachedPos = S, cachedName = w ? w.toLowerCase() : C == question || C == bang ? void 0 : null;
2790
2743
  }
2791
2744
  var lessThan = 60, greaterThan$1 = 62, slash$1 = 47, question = 63, bang = 33;
2792
- function ElementContext(e6, y) {
2793
- this.name = e6, this.parent = y, this.hash = y ? y.hash : 0;
2794
- for (let y2 = 0; y2 < e6.length; y2++) this.hash += (this.hash << 4) + e6.charCodeAt(y2) + (e6.charCodeAt(y2) << 8);
2745
+ function ElementContext(e6, x) {
2746
+ this.name = e6, this.parent = x, this.hash = x ? x.hash : 0;
2747
+ for (let x2 = 0; x2 < e6.length; x2++) this.hash += (this.hash << 4) + e6.charCodeAt(x2) + (e6.charCodeAt(x2) << 8);
2795
2748
  }
2796
2749
  var startTagTerms = [
2797
2750
  StartTag,
@@ -2801,63 +2754,63 @@ var startTagTerms = [
2801
2754
  StartTextareaTag
2802
2755
  ], elementContext = /* @__PURE__ */ new ContextTracker({
2803
2756
  start: null,
2804
- shift(e6, y, b, x) {
2805
- return startTagTerms.indexOf(y) > -1 ? new ElementContext(tagNameAfter(x, 1) || "", e6) : e6;
2757
+ shift(e6, x, S, C) {
2758
+ return startTagTerms.indexOf(x) > -1 ? new ElementContext(tagNameAfter(C, 1) || "", e6) : e6;
2806
2759
  },
2807
- reduce(e6, y) {
2808
- return y == Element && e6 ? e6.parent : e6;
2760
+ reduce(e6, x) {
2761
+ return x == Element && e6 ? e6.parent : e6;
2809
2762
  },
2810
- reuse(e6, y, b, x) {
2811
- let S = y.type.id;
2812
- return S == StartTag || S == OpenTag ? new ElementContext(tagNameAfter(x, 1) || "", e6) : e6;
2763
+ reuse(e6, x, S, C) {
2764
+ let w = x.type.id;
2765
+ return w == StartTag || w == OpenTag ? new ElementContext(tagNameAfter(C, 1) || "", e6) : e6;
2813
2766
  },
2814
2767
  hash(e6) {
2815
2768
  return e6 ? e6.hash : 0;
2816
2769
  },
2817
2770
  strict: false
2818
- }), tagStart = /* @__PURE__ */ new ExternalTokenizer((e6, y) => {
2771
+ }), tagStart = /* @__PURE__ */ new ExternalTokenizer((e6, x) => {
2819
2772
  if (e6.next != lessThan) {
2820
- e6.next < 0 && y.context && e6.acceptToken(missingCloseTag);
2773
+ e6.next < 0 && x.context && e6.acceptToken(missingCloseTag);
2821
2774
  return;
2822
2775
  }
2823
2776
  e6.advance();
2824
- let b = e6.next == slash$1;
2825
- b && e6.advance();
2826
- let x = tagNameAfter(e6, 0);
2827
- if (x === void 0) return;
2828
- if (!x) return e6.acceptToken(b ? IncompleteCloseTag : StartTag);
2829
- let S = y.context ? y.context.name : null;
2830
- if (b) {
2831
- if (x == S) return e6.acceptToken(StartCloseTag);
2832
- if (S && implicitlyClosed[S]) return e6.acceptToken(missingCloseTag, -2);
2833
- for (let e7 = y.context; e7; e7 = e7.parent) if (e7.name == x) return;
2777
+ let S = e6.next == slash$1;
2778
+ S && e6.advance();
2779
+ let C = tagNameAfter(e6, 0);
2780
+ if (C === void 0) return;
2781
+ if (!C) return e6.acceptToken(S ? IncompleteCloseTag : StartTag);
2782
+ let w = x.context ? x.context.name : null;
2783
+ if (S) {
2784
+ if (C == w) return e6.acceptToken(StartCloseTag);
2785
+ if (w && implicitlyClosed[w]) return e6.acceptToken(missingCloseTag, -2);
2786
+ for (let e7 = x.context; e7; e7 = e7.parent) if (e7.name == C) return;
2834
2787
  e6.acceptToken(MismatchedStartCloseTag);
2835
2788
  } else {
2836
- if (x == "script") return e6.acceptToken(StartScriptTag);
2837
- if (x == "style") return e6.acceptToken(StartStyleTag);
2838
- if (x == "textarea") return e6.acceptToken(StartTextareaTag);
2839
- if (selfClosers.hasOwnProperty(x)) return e6.acceptToken(StartSelfClosingTag);
2840
- S && closeOnOpen[S] && closeOnOpen[S][x] ? e6.acceptToken(missingCloseTag, -1) : e6.acceptToken(StartTag);
2789
+ if (C == "script") return e6.acceptToken(StartScriptTag);
2790
+ if (C == "style") return e6.acceptToken(StartStyleTag);
2791
+ if (C == "textarea") return e6.acceptToken(StartTextareaTag);
2792
+ if (selfClosers.hasOwnProperty(C)) return e6.acceptToken(StartSelfClosingTag);
2793
+ w && closeOnOpen[w] && closeOnOpen[w][C] ? e6.acceptToken(missingCloseTag, -1) : e6.acceptToken(StartTag);
2841
2794
  }
2842
2795
  }, { contextual: true });
2843
- function contentTokenizer(e6, y, b) {
2844
- let x = 2 + e6.length;
2845
- return new ExternalTokenizer((S) => {
2846
- for (let C = 0, w = 0, T = 0; ; T++) {
2847
- if (S.next < 0) {
2848
- T && S.acceptToken(y);
2796
+ function contentTokenizer(e6, x, S) {
2797
+ let C = 2 + e6.length;
2798
+ return new ExternalTokenizer((w) => {
2799
+ for (let T = 0, E = 0, D = 0; ; D++) {
2800
+ if (w.next < 0) {
2801
+ D && w.acceptToken(x);
2849
2802
  break;
2850
2803
  }
2851
- if (C == 0 && S.next == lessThan || C == 1 && S.next == slash$1 || C >= 2 && C < x && S.next == e6.charCodeAt(C - 2)) C++, w++;
2852
- else if ((C == 2 || C == x) && isSpace(S.next)) w++;
2853
- else if (C == x && S.next == greaterThan$1) {
2854
- T > w ? S.acceptToken(y, -w) : S.acceptToken(b, -(w - 2));
2804
+ if (T == 0 && w.next == lessThan || T == 1 && w.next == slash$1 || T >= 2 && T < C && w.next == e6.charCodeAt(T - 2)) T++, E++;
2805
+ else if ((T == 2 || T == C) && isSpace(w.next)) E++;
2806
+ else if (T == C && w.next == greaterThan$1) {
2807
+ D > E ? w.acceptToken(x, -E) : w.acceptToken(S, -(E - 2));
2855
2808
  break;
2856
- } else if ((S.next == 10 || S.next == 13) && T) {
2857
- S.acceptToken(y, 1);
2809
+ } else if ((w.next == 10 || w.next == 13) && D) {
2810
+ w.acceptToken(x, 1);
2858
2811
  break;
2859
- } else C = w = 0;
2860
- S.advance();
2812
+ } else T = E = 0;
2813
+ w.advance();
2861
2814
  }
2862
2815
  });
2863
2816
  }
@@ -2893,108 +2846,108 @@ var scriptTokens = /* @__PURE__ */ contentTokenizer("script", scriptText, StartC
2893
2846
  at,
2894
2847
  slash
2895
2848
  ], commentContent = /* @__PURE__ */ new ExternalTokenizer((e6) => {
2896
- for (let y = 0, b = 0; ; b++) {
2849
+ for (let x = 0, S = 0; ; S++) {
2897
2850
  if (e6.next < 0) {
2898
- b && e6.acceptToken(commentContent$1);
2851
+ S && e6.acceptToken(commentContent$1);
2899
2852
  break;
2900
2853
  }
2901
- if (e6.next == dash) y++;
2902
- else if (e6.next == greaterThan && y >= 2) {
2903
- b > 3 && e6.acceptToken(commentContent$1, -2);
2854
+ if (e6.next == dash) x++;
2855
+ else if (e6.next == greaterThan && x >= 2) {
2856
+ S > 3 && e6.acceptToken(commentContent$1, -2);
2904
2857
  break;
2905
- } else y = 0;
2858
+ } else x = 0;
2906
2859
  e6.advance();
2907
2860
  }
2908
2861
  });
2909
2862
  function createStringHandler(e6) {
2910
- let y = false, b = null, x = false;
2911
- return () => y ? x ? (x = false, true) : e6.next === backslash ? (x = true, true) : b === "double" && e6.next === quoteDouble || b === "single" && e6.next === quoteSingle || b === "template" && e6.next === tick ? (y = false, b = null, true) : true : e6.next === quoteDouble ? (y = true, b = "double", true) : e6.next === quoteSingle ? (y = true, b = "single", true) : e6.next === tick ? (y = true, b = "template", true) : false;
2863
+ let x = false, S = null, C = false;
2864
+ return () => x ? C ? (C = false, true) : e6.next === backslash ? (C = true, true) : S === "double" && e6.next === quoteDouble || S === "single" && e6.next === quoteSingle || S === "template" && e6.next === tick ? (x = false, S = null, true) : true : e6.next === quoteDouble ? (x = true, S = "double", true) : e6.next === quoteSingle ? (x = true, S = "single", true) : e6.next === tick ? (x = true, S = "template", true) : false;
2912
2865
  }
2913
2866
  function createCommentHandler(e6) {
2914
- let y = false, b = false;
2915
- return () => y ? (e6.next === newline && (y = false), true) : b ? (e6.next === asterisk && e6.peek(1) === slash && (b = false), true) : e6.next === slash && e6.peek(1) === slash ? (y = true, true) : e6.next === slash && e6.peek(1) === asterisk ? (b = true, true) : false;
2867
+ let x = false, S = false;
2868
+ return () => x ? (e6.next === newline && (x = false), true) : S ? (e6.next === asterisk && e6.peek(1) === slash && (S = false), true) : e6.next === slash && e6.peek(1) === slash ? (x = true, true) : e6.next === slash && e6.peek(1) === asterisk ? (S = true, true) : false;
2916
2869
  }
2917
2870
  var longExpression = /* @__PURE__ */ new ExternalTokenizer((e6) => {
2918
2871
  if (prefixes.includes(e6.next)) return;
2919
- let y = createCommentHandler(e6), b = createStringHandler(e6), x = [], S = (e7) => {
2920
- let y2 = x.lastIndexOf(e7);
2921
- if (y2 !== -1) for (; x.length > y2; ) x.pop();
2872
+ let x = createCommentHandler(e6), S = createStringHandler(e6), C = [], w = (e7) => {
2873
+ let x2 = C.lastIndexOf(e7);
2874
+ if (x2 !== -1) for (; C.length > x2; ) C.pop();
2922
2875
  };
2923
- for (let C = 0; ; C++) {
2876
+ for (let T = 0; ; T++) {
2924
2877
  if (e6.next < 0) {
2925
- C > 0 && e6.acceptToken(LongExpression);
2878
+ T > 0 && e6.acceptToken(LongExpression);
2926
2879
  break;
2927
2880
  }
2928
- if (y() || b()) {
2881
+ if (x() || S()) {
2929
2882
  e6.advance();
2930
2883
  continue;
2931
2884
  }
2932
- if (x.length === 0 && (e6.next === curlyClose || e6.next === parenClose || e6.next === squareClose)) {
2885
+ if (C.length === 0 && (e6.next === curlyClose || e6.next === parenClose || e6.next === squareClose)) {
2933
2886
  e6.acceptToken(LongExpression);
2934
2887
  break;
2935
2888
  }
2936
2889
  switch (e6.next) {
2937
2890
  case parenOpen:
2938
- x.push("(");
2891
+ C.push("(");
2939
2892
  break;
2940
2893
  case parenClose:
2941
- S("(");
2894
+ w("(");
2942
2895
  break;
2943
2896
  case squareOpen:
2944
- x.push("[");
2897
+ C.push("[");
2945
2898
  break;
2946
2899
  case squareClose:
2947
- S("[");
2900
+ w("[");
2948
2901
  break;
2949
2902
  case curlyOpen:
2950
- x.push("{");
2903
+ C.push("{");
2951
2904
  break;
2952
2905
  case curlyClose:
2953
- S("{");
2906
+ w("{");
2954
2907
  break;
2955
2908
  }
2956
2909
  e6.advance();
2957
2910
  }
2958
2911
  }), shortExpression = /* @__PURE__ */ new ExternalTokenizer((e6) => {
2959
2912
  if (prefixes.includes(e6.peek(0))) return;
2960
- let y = createCommentHandler(e6), b = createStringHandler(e6), x = [], S = (e7) => {
2961
- let y2 = x.lastIndexOf(e7);
2962
- if (y2 !== -1) for (; x.length > y2; ) x.pop();
2913
+ let x = createCommentHandler(e6), S = createStringHandler(e6), C = [], w = (e7) => {
2914
+ let x2 = C.lastIndexOf(e7);
2915
+ if (x2 !== -1) for (; C.length > x2; ) C.pop();
2963
2916
  };
2964
- for (let C = 0; ; C++) {
2917
+ for (let T = 0; ; T++) {
2965
2918
  if (e6.next < 0) {
2966
- C > 0 && e6.acceptToken(ShortExpression);
2919
+ T > 0 && e6.acceptToken(ShortExpression);
2967
2920
  break;
2968
2921
  }
2969
- if (y() || b()) {
2922
+ if (x() || S()) {
2970
2923
  e6.advance();
2971
2924
  continue;
2972
2925
  }
2973
- if (x.length === 0 && (e6.next === curlyClose || e6.next === parenClose || e6.next === squareClose || e6.next === comma)) {
2926
+ if (C.length === 0 && (e6.next === curlyClose || e6.next === parenClose || e6.next === squareClose || e6.next === comma)) {
2974
2927
  e6.acceptToken(ShortExpression);
2975
2928
  break;
2976
2929
  }
2977
2930
  switch (e6.next) {
2978
2931
  case parenOpen:
2979
- x.push("(");
2932
+ C.push("(");
2980
2933
  break;
2981
2934
  case parenClose:
2982
- S("(");
2935
+ w("(");
2983
2936
  break;
2984
2937
  case squareOpen:
2985
- x.push("[");
2938
+ C.push("[");
2986
2939
  break;
2987
2940
  case squareClose:
2988
- S("[");
2941
+ w("[");
2989
2942
  break;
2990
2943
  case curlyOpen:
2991
- x.push("{");
2944
+ C.push("{");
2992
2945
  break;
2993
2946
  case curlyClose:
2994
- S("{");
2947
+ w("{");
2995
2948
  break;
2996
2949
  }
2997
- if (C !== 0 && x.length === 0 && space.includes(e6.next)) {
2950
+ if (T !== 0 && C.length === 0 && space.includes(e6.next)) {
2998
2951
  e6.acceptToken(ShortExpression);
2999
2952
  break;
3000
2953
  }
@@ -3270,30 +3223,30 @@ var longExpression = /* @__PURE__ */ new ExternalTokenizer((e6) => {
3270
3223
  ],
3271
3224
  tokenPrec: 1571
3272
3225
  });
3273
- function getAttrs(e6, y) {
3274
- let b = /* @__PURE__ */ Object.create(null);
3275
- for (let x of e6.firstChild.getChildren("Attribute")) {
3276
- let e7 = x.getChild("AttributeName"), S = x.getChild("AttributeValue") || x.getChild("UnquotedAttributeValue");
3277
- e7 && (b[y.read(e7.from, e7.to)] = S ? S.name == "AttributeValue" ? y.read(S.from + 1, S.to - 1) : y.read(S.from, S.to) : "");
3226
+ function getAttrs(e6, x) {
3227
+ let S = /* @__PURE__ */ Object.create(null);
3228
+ for (let C of e6.firstChild.getChildren("Attribute")) {
3229
+ let e7 = C.getChild("AttributeName"), w = C.getChild("AttributeValue") || C.getChild("UnquotedAttributeValue");
3230
+ e7 && (S[x.read(e7.from, e7.to)] = w ? w.name == "AttributeValue" ? x.read(w.from + 1, w.to - 1) : x.read(w.from, w.to) : "");
3278
3231
  }
3279
- return b;
3232
+ return S;
3280
3233
  }
3281
- function maybeNest(e6, y, b) {
3282
- let x;
3283
- for (let S of b) if (!S.attrs || S.attrs(x || (x = getAttrs(e6.node.parent, y)))) return { parser: S.parser };
3234
+ function maybeNest(e6, x, S) {
3235
+ let C;
3236
+ for (let w of S) if (!w.attrs || w.attrs(C || (C = getAttrs(e6.node.parent, x)))) return { parser: w.parser };
3284
3237
  return null;
3285
3238
  }
3286
3239
  var expressionParser = /* @__PURE__ */ parser$1.configure({ top: "SingleExpression" });
3287
3240
  function configureNesting(e6) {
3288
- let y = [], b = [], x = [];
3289
- for (let S of e6) {
3290
- let e7 = S.tag == "script" ? y : S.tag == "style" ? b : S.tag == "textarea" ? x : null;
3241
+ let x = [], S = [], C = [];
3242
+ for (let w of e6) {
3243
+ let e7 = w.tag == "script" ? x : w.tag == "style" ? S : w.tag == "textarea" ? C : null;
3291
3244
  if (!e7) throw RangeError("Only script, style, and textarea tags can host nested parsers");
3292
- e7.push(S);
3245
+ e7.push(w);
3293
3246
  }
3294
- return parseMixed((e7, S) => {
3295
- let C = e7.type.id;
3296
- return C === LongExpression || C === ShortExpression ? { parser: expressionParser } : C === ScriptText ? maybeNest(e7, S, y) : C === StyleText ? maybeNest(e7, S, b) : C === TextareaText ? maybeNest(e7, S, x) : null;
3247
+ return parseMixed((e7, w) => {
3248
+ let T = e7.type.id;
3249
+ return T === LongExpression || T === ShortExpression ? { parser: expressionParser } : T === ScriptText ? maybeNest(e7, w, x) : T === StyleText ? maybeNest(e7, w, S) : T === TextareaText ? maybeNest(e7, w, C) : null;
3297
3250
  });
3298
3251
  }
3299
3252
  var defaultNesting = [
@@ -3321,46 +3274,46 @@ var defaultNesting = [
3321
3274
  wrap: /* @__PURE__ */ configureNesting(defaultNesting),
3322
3275
  props: [/* @__PURE__ */ indentNodeProp.add({
3323
3276
  Element: (e6) => {
3324
- let y = /^(\s*)(<\/)?/.exec(e6.textAfter);
3325
- return e6.node.to <= e6.pos + y[0].length ? e6.continue() : e6.lineIndent(e6.node.from) + (y[2] ? 0 : e6.unit);
3277
+ let x = /^(\s*)(<\/)?/.exec(e6.textAfter);
3278
+ return e6.node.to <= e6.pos + x[0].length ? e6.continue() : e6.lineIndent(e6.node.from) + (x[2] ? 0 : e6.unit);
3326
3279
  },
3327
3280
  Block: (e6) => {
3328
- let y = e6.node, b = e6.textAfter.trim();
3329
- if (b.startsWith("{/")) {
3330
- let x2 = y.name;
3331
- return x2 === "IfBlock" && b.startsWith("{/if") || x2 === "EachBlock" && b.startsWith("{/each") || x2 === "AwaitBlock" && b.startsWith("{/await") || x2 === "KeyBlock" && b.startsWith("{/key") ? e6.lineIndent(e6.node.from) : null;
3281
+ let x = e6.node, S = e6.textAfter.trim();
3282
+ if (S.startsWith("{/")) {
3283
+ let C2 = x.name;
3284
+ return C2 === "IfBlock" && S.startsWith("{/if") || C2 === "EachBlock" && S.startsWith("{/each") || C2 === "AwaitBlock" && S.startsWith("{/await") || C2 === "KeyBlock" && S.startsWith("{/key") ? e6.lineIndent(e6.node.from) : null;
3332
3285
  }
3333
- if (y.name === "IfBlock" || y.name === "EachBlock") {
3334
- if (b.startsWith("{:else")) return e6.lineIndent(y.from);
3335
- } else if (y.name === "AwaitBlock" && (b.startsWith("{:then") || b.startsWith("{:catch"))) return e6.lineIndent(y.from);
3336
- let x = /^(\s*)(<\/)?/.exec(e6.textAfter);
3337
- return e6.node.to <= e6.pos + x[0].length ? e6.continue() : e6.lineIndent(e6.node.from) + (x[2] ? 0 : e6.unit);
3286
+ if (x.name === "IfBlock" || x.name === "EachBlock") {
3287
+ if (S.startsWith("{:else")) return e6.lineIndent(x.from);
3288
+ } else if (x.name === "AwaitBlock" && (S.startsWith("{:then") || S.startsWith("{:catch"))) return e6.lineIndent(x.from);
3289
+ let C = /^(\s*)(<\/)?/.exec(e6.textAfter);
3290
+ return e6.node.to <= e6.pos + C[0].length ? e6.continue() : e6.lineIndent(e6.node.from) + (C[2] ? 0 : e6.unit);
3338
3291
  },
3339
3292
  "BlockOpen BlockClose BlockInline": (e6) => e6.column(e6.node.from) + e6.unit,
3340
3293
  "OpenTag CloseTag SelfClosingTag": (e6) => e6.column(e6.node.from) + e6.unit,
3341
3294
  Document: (e6) => {
3342
3295
  if (e6.pos + /\s*/.exec(e6.textAfter)[0].length < e6.node.to) return e6.continue();
3343
- let y = null, b;
3344
- for (let b2 = e6.node; ; ) {
3345
- let e7 = b2.lastChild;
3346
- if (!e7 || e7.name != "Element" || e7.to != b2.to) break;
3347
- y = b2 = e7;
3296
+ let x = null, S;
3297
+ for (let S2 = e6.node; ; ) {
3298
+ let e7 = S2.lastChild;
3299
+ if (!e7 || e7.name != "Element" || e7.to != S2.to) break;
3300
+ x = S2 = e7;
3348
3301
  }
3349
- return y && !((b = y.lastChild) && (b.name === "CloseTag" || b.name === "SelfClosingTag")) ? e6.lineIndent(y.from) + e6.unit : null;
3302
+ return x && !((S = x.lastChild) && (S.name === "CloseTag" || S.name === "SelfClosingTag")) ? e6.lineIndent(x.from) + e6.unit : null;
3350
3303
  }
3351
3304
  }), /* @__PURE__ */ foldNodeProp.add({
3352
3305
  Block: (e6) => {
3353
- let y = `${e6.name}Open`, b = `${e6.name}Close`, x = e6.firstChild, S = e6.lastChild;
3354
- return !x || x.name !== y ? null : {
3355
- from: x.to,
3356
- to: (S == null ? void 0 : S.name) === b ? S.from : e6.to
3306
+ let x = `${e6.name}Open`, S = `${e6.name}Close`, C = e6.firstChild, w = e6.lastChild;
3307
+ return !C || C.name !== x ? null : {
3308
+ from: C.to,
3309
+ to: (w == null ? void 0 : w.name) === S ? w.from : e6.to
3357
3310
  };
3358
3311
  },
3359
3312
  Element: (e6) => {
3360
- let y = e6.firstChild, b = e6.lastChild;
3361
- return !y || y.name != "OpenTag" ? null : {
3362
- from: y.to,
3363
- to: b.name === "CloseTag" ? b.from : e6.to
3313
+ let x = e6.firstChild, S = e6.lastChild;
3314
+ return !x || x.name != "OpenTag" ? null : {
3315
+ from: x.to,
3316
+ to: S.name === "CloseTag" ? S.from : e6.to
3364
3317
  };
3365
3318
  }
3366
3319
  })]
@@ -3382,43 +3335,43 @@ function svelte() {
3382
3335
  autoCloseTags
3383
3336
  ]);
3384
3337
  }
3385
- function elementName(e6, y, b = e6.length) {
3386
- if (!y) return "";
3387
- let x = y.firstChild, S = x && (x.getChild("TagName") || x.getChild("ComponentName") || x.getChild("SvelteElementName"));
3388
- return S ? e6.sliceString(S.from, Math.min(S.to, b)) : "";
3338
+ function elementName(e6, x, S = e6.length) {
3339
+ if (!x) return "";
3340
+ let C = x.firstChild, w = C && (C.getChild("TagName") || C.getChild("ComponentName") || C.getChild("SvelteElementName"));
3341
+ return w ? e6.sliceString(w.from, Math.min(w.to, S)) : "";
3389
3342
  }
3390
- var autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((e6, y, b, x) => {
3391
- if (e6.composing || e6.state.readOnly || y != b || x != ">" && x != "/" || !svelteLanguage.isActiveAt(e6.state, y, -1)) return false;
3392
- let { state: S } = e6, C = S.changeByRange((y2) => {
3343
+ var autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((e6, x, S, C) => {
3344
+ if (e6.composing || e6.state.readOnly || x != S || C != ">" && C != "/" || !svelteLanguage.isActiveAt(e6.state, x, -1)) return false;
3345
+ let { state: w } = e6, T = w.changeByRange((x2) => {
3393
3346
  var _a, _b, _c;
3394
- let { head: b2 } = y2, C2 = syntaxTree(S).resolveInner(b2, -1), w;
3395
- if ((C2.name === "TagName" || C2.name === "ComponentName" || C2.name === "SvelteElementName" || C2.name === "StartTag") && (C2 = C2.parent), x === ">" && C2.name === "OpenTag") {
3396
- if (((_b = (_a = C2.parent) == null ? void 0 : _a.lastChild) == null ? void 0 : _b.name) != "CloseTag" && (w = elementName(S.doc, C2.parent, b2))) {
3397
- let y3 = e6.state.doc.sliceString(b2, b2 + 1) === ">", x2 = `${y3 ? "" : ">"}</${w}>`;
3347
+ let { head: S2 } = x2, T2 = syntaxTree(w).resolveInner(S2, -1), E;
3348
+ if ((T2.name === "TagName" || T2.name === "ComponentName" || T2.name === "SvelteElementName" || T2.name === "StartTag") && (T2 = T2.parent), C === ">" && T2.name === "OpenTag") {
3349
+ if (((_b = (_a = T2.parent) == null ? void 0 : _a.lastChild) == null ? void 0 : _b.name) != "CloseTag" && (E = elementName(w.doc, T2.parent, S2))) {
3350
+ let x3 = e6.state.doc.sliceString(S2, S2 + 1) === ">", C2 = `${x3 ? "" : ">"}</${E}>`;
3398
3351
  return {
3399
- range: EditorSelection.cursor(b2 + 1),
3352
+ range: EditorSelection.cursor(S2 + 1),
3400
3353
  changes: {
3401
- from: b2 + (y3 ? 1 : 0),
3402
- insert: x2
3354
+ from: S2 + (x3 ? 1 : 0),
3355
+ insert: C2
3403
3356
  }
3404
3357
  };
3405
3358
  }
3406
- } else if (x === "/" && C2.name === "OpenTag") {
3407
- let y3 = C2.parent, x2 = y3 == null ? void 0 : y3.parent;
3408
- if (y3.from == b2 - 1 && ((_c = x2.lastChild) == null ? void 0 : _c.name) != "CloseTag" && (w = elementName(S.doc, x2, b2))) {
3409
- let y4 = e6.state.doc.sliceString(b2, b2 + 1) === ">", x3 = `/${w}${y4 ? "" : ">"}`, S2 = b2 + x3.length + (y4 ? 1 : 0);
3359
+ } else if (C === "/" && T2.name === "OpenTag") {
3360
+ let x3 = T2.parent, C2 = x3 == null ? void 0 : x3.parent;
3361
+ if (x3.from == S2 - 1 && ((_c = C2.lastChild) == null ? void 0 : _c.name) != "CloseTag" && (E = elementName(w.doc, C2, S2))) {
3362
+ let x4 = e6.state.doc.sliceString(S2, S2 + 1) === ">", C3 = `/${E}${x4 ? "" : ">"}`, w2 = S2 + C3.length + (x4 ? 1 : 0);
3410
3363
  return {
3411
- range: EditorSelection.cursor(S2),
3364
+ range: EditorSelection.cursor(w2),
3412
3365
  changes: {
3413
- from: b2,
3414
- insert: x3
3366
+ from: S2,
3367
+ insert: C3
3415
3368
  }
3416
3369
  };
3417
3370
  }
3418
3371
  }
3419
- return { range: y2 };
3372
+ return { range: x2 };
3420
3373
  });
3421
- return C.changes.empty ? false : (e6.dispatch(C, {
3374
+ return T.changes.empty ? false : (e6.dispatch(T, {
3422
3375
  userEvent: "input.type",
3423
3376
  scrollIntoView: true
3424
3377
  }), true);
@@ -3586,123 +3539,123 @@ var autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((e6, y, b, x) =>
3586
3539
  true: true,
3587
3540
  false: true
3588
3541
  }, isOperatorChar = /[+\-*&^%:=<>!|/~]/, isNegativeChar = /[-]/, curPunc;
3589
- function tokenBase(e6, y) {
3590
- let b = e6.next();
3591
- if (b === '"' || b === "'" || b === "`") return y.tokenize = tokenString(b), y.tokenize(e6, y);
3592
- if (isVersion(e6, y)) return "version";
3593
- if (b === "." && keywordsMembersOfAddressType.some(function(y2) {
3594
- return e6.match(`${y2}`);
3542
+ function tokenBase(e6, x) {
3543
+ let S = e6.next();
3544
+ if (S === '"' || S === "'" || S === "`") return x.tokenize = tokenString(S), x.tokenize(e6, x);
3545
+ if (isVersion(e6, x)) return "version";
3546
+ if (S === "." && keywordsMembersOfAddressType.some(function(x2) {
3547
+ return e6.match(`${x2}`);
3595
3548
  })) return "addressFunction";
3596
- if (typeof b == "string" && isNumber(b, e6)) return "number";
3597
- if (typeof b == "string" && /[[\]{}(),;:.]/.test(b)) return updateGarmmer(b, y);
3598
- if (b === "/") {
3599
- if (e6.eat("*")) return y.tokenize = tokenComment, tokenComment(e6, y);
3549
+ if (typeof S == "string" && isNumber(S, e6)) return "number";
3550
+ if (typeof S == "string" && /[[\]{}(),;:.]/.test(S)) return updateGarmmer(S, x);
3551
+ if (S === "/") {
3552
+ if (e6.eat("*")) return x.tokenize = tokenComment, tokenComment(e6, x);
3600
3553
  if (e6.match(/\/{2}/)) {
3601
- for (b = e6.next(); b; ) {
3602
- if (b === "@") {
3603
- e6.backUp(1), y.grammar = "doc";
3554
+ for (S = e6.next(); S; ) {
3555
+ if (S === "@") {
3556
+ e6.backUp(1), x.grammar = "doc";
3604
3557
  break;
3605
3558
  }
3606
- b = e6.next();
3559
+ S = e6.next();
3607
3560
  }
3608
3561
  return "doc";
3609
3562
  }
3610
3563
  if (e6.eat("/")) return e6.skipToEnd(), "comment";
3611
3564
  }
3612
- if (typeof b == "string" && isNegativeChar.test(b)) {
3613
- let y2 = e6.peek();
3614
- return typeof y2 == "string" && isNumber(y2, e6) ? "number" : "operator";
3565
+ if (typeof S == "string" && isNegativeChar.test(S)) {
3566
+ let x2 = e6.peek();
3567
+ return typeof x2 == "string" && isNumber(x2, e6) ? "number" : "operator";
3615
3568
  }
3616
- if (typeof b == "string" && isOperatorChar.test(b)) return e6.eatWhile(isOperatorChar), "operator";
3569
+ if (typeof S == "string" && isOperatorChar.test(S)) return e6.eatWhile(isOperatorChar), "operator";
3617
3570
  e6.eatWhile(/[\w$_\xa1-\uffff]/);
3618
- let x = e6.current();
3619
- return y.grammar === "doc" ? natSpecTags.some(function(e7) {
3620
- return x === `@${e7}`;
3621
- }) ? "docReserve" : "doc" : (x === "solidity" && y.lastToken === "pragma" && (y.lastToken = y.lastToken + " " + x), Object.prototype.propertyIsEnumerable.call(keywords, x) ? ((x === "case" || x === "default") && (curPunc = "case"), Object.prototype.propertyIsEnumerable.call(keywordsSpecial, x) && (y.lastToken = x), "keyword") : Object.prototype.propertyIsEnumerable.call(keywordsEtherUnit, x) ? "etherUnit" : Object.prototype.propertyIsEnumerable.call(keywordsContractRelated, x) ? "contractRelated" : Object.prototype.propertyIsEnumerable.call(keywordsControlStructures, x) || Object.prototype.propertyIsEnumerable.call(keywordsTypeInformation, x) || Object.prototype.propertyIsEnumerable.call(keywordsV0505NewReserve, x) ? "keyword" : Object.prototype.propertyIsEnumerable.call(keywordsValueTypes, x) || Object.prototype.propertyIsEnumerable.call(keywordsTimeUnit, x) || isValidInteger(x) || isValidBytes(x) || isValidFixed(x) ? (y.lastToken += "variable", "keyword") : Object.prototype.propertyIsEnumerable.call(atoms, x) ? "atom" : Object.prototype.propertyIsEnumerable.call(keywordsErrorHandling, x) ? "errorHandling" : Object.prototype.propertyIsEnumerable.call(keywordsMathematicalAndCryptographicFuctions, x) ? "mathematicalAndCryptographic" : Object.prototype.propertyIsEnumerable.call(keywordsMoreBlockAndTransactionProperties, x) || Object.prototype.propertyIsEnumerable.call(keywordsBlockAndTransactionProperties, x) && keywordsBlockAndTransactionProperties[x].some(function(y2) {
3622
- return e6.match(`.${y2}`);
3623
- }) ? "variable-2" : x === "abi" && keywordsAbiEncodeDecodeFunctions[x].some(function(y2) {
3624
- return e6.match(`.${y2}`);
3625
- }) ? "abi" : updateHexLiterals(x, e6) ?? ((y.lastToken === "functionName(" || y.lastToken === "returns(") && Object.prototype.propertyIsEnumerable.call(keywordsContractList, x) ? (y.lastToken += "variable", "variable") : y.lastToken === "function" ? (y.lastToken = "functionName", y.para ?? (y.para = (y.grammar = "function", "")), y.para += "functionName", "functionName") : y.lastToken === "functionName(variable" ? (y.lastToken = "functionName(", "parameterValue") : y.lastToken === "returns(variable" ? (y.lastToken = "returns(", "parameterValue") : (y.lastToken === "address" && x === "payable" && (y.lastToken = "address payable"), (y.lastToken === "contract" || y.lastToken === "struct") && (keywordsContractList[x] = true, y.lastToken = null), y.grammar === "function" ? "parameterValue" : "variable")));
3571
+ let C = e6.current();
3572
+ return x.grammar === "doc" ? natSpecTags.some(function(e7) {
3573
+ return C === `@${e7}`;
3574
+ }) ? "docReserve" : "doc" : (C === "solidity" && x.lastToken === "pragma" && (x.lastToken = x.lastToken + " " + C), Object.prototype.propertyIsEnumerable.call(keywords, C) ? ((C === "case" || C === "default") && (curPunc = "case"), Object.prototype.propertyIsEnumerable.call(keywordsSpecial, C) && (x.lastToken = C), "keyword") : Object.prototype.propertyIsEnumerable.call(keywordsEtherUnit, C) ? "etherUnit" : Object.prototype.propertyIsEnumerable.call(keywordsContractRelated, C) ? "contractRelated" : Object.prototype.propertyIsEnumerable.call(keywordsControlStructures, C) || Object.prototype.propertyIsEnumerable.call(keywordsTypeInformation, C) || Object.prototype.propertyIsEnumerable.call(keywordsV0505NewReserve, C) ? "keyword" : Object.prototype.propertyIsEnumerable.call(keywordsValueTypes, C) || Object.prototype.propertyIsEnumerable.call(keywordsTimeUnit, C) || isValidInteger(C) || isValidBytes(C) || isValidFixed(C) ? (x.lastToken += "variable", "keyword") : Object.prototype.propertyIsEnumerable.call(atoms, C) ? "atom" : Object.prototype.propertyIsEnumerable.call(keywordsErrorHandling, C) ? "errorHandling" : Object.prototype.propertyIsEnumerable.call(keywordsMathematicalAndCryptographicFuctions, C) ? "mathematicalAndCryptographic" : Object.prototype.propertyIsEnumerable.call(keywordsMoreBlockAndTransactionProperties, C) || Object.prototype.propertyIsEnumerable.call(keywordsBlockAndTransactionProperties, C) && keywordsBlockAndTransactionProperties[C].some(function(x2) {
3575
+ return e6.match(`.${x2}`);
3576
+ }) ? "variable-2" : C === "abi" && keywordsAbiEncodeDecodeFunctions[C].some(function(x2) {
3577
+ return e6.match(`.${x2}`);
3578
+ }) ? "abi" : updateHexLiterals(C, e6) ?? ((x.lastToken === "functionName(" || x.lastToken === "returns(") && Object.prototype.propertyIsEnumerable.call(keywordsContractList, C) ? (x.lastToken += "variable", "variable") : x.lastToken === "function" ? (x.lastToken = "functionName", x.para ?? (x.para = (x.grammar = "function", "")), x.para += "functionName", "functionName") : x.lastToken === "functionName(variable" ? (x.lastToken = "functionName(", "parameterValue") : x.lastToken === "returns(variable" ? (x.lastToken = "returns(", "parameterValue") : (x.lastToken === "address" && C === "payable" && (x.lastToken = "address payable"), (x.lastToken === "contract" || x.lastToken === "struct") && (keywordsContractList[C] = true, x.lastToken = null), x.grammar === "function" ? "parameterValue" : "variable")));
3626
3579
  }
3627
3580
  function tokenString(e6) {
3628
- return function(y, b) {
3629
- let x = false, S, C = false;
3630
- for (S = y.next(); S != null; ) {
3631
- if (S === e6 && !x) {
3632
- C = true;
3581
+ return function(x, S) {
3582
+ let C = false, w, T = false;
3583
+ for (w = x.next(); w != null; ) {
3584
+ if (w === e6 && !C) {
3585
+ T = true;
3633
3586
  break;
3634
3587
  }
3635
- x = !x && e6 !== "`" && S === "\\", S = y.next();
3588
+ C = !C && e6 !== "`" && w === "\\", w = x.next();
3636
3589
  }
3637
- return (C || !(x || e6 === "`")) && (b.tokenize = tokenBase), "string";
3590
+ return (T || !(C || e6 === "`")) && (S.tokenize = tokenBase), "string";
3638
3591
  };
3639
3592
  }
3640
- function tokenComment(e6, y) {
3641
- let b = false, x = e6.next();
3642
- for (; x; ) {
3643
- if (x === "/" && b) {
3644
- y.tokenize = tokenBase;
3593
+ function tokenComment(e6, x) {
3594
+ let S = false, C = e6.next();
3595
+ for (; C; ) {
3596
+ if (C === "/" && S) {
3597
+ x.tokenize = tokenBase;
3645
3598
  break;
3646
3599
  }
3647
- b = x === "*", x = e6.next();
3600
+ S = C === "*", C = e6.next();
3648
3601
  }
3649
3602
  return "comment";
3650
3603
  }
3651
- function isVersion(e6, y) {
3652
- if (y.lastToken === "pragma solidity") return y.lastToken = null, !y.startOfLine && (e6.match(/[\^{0}][0-9.]+/) || e6.match(/[>=]+?[\s]*[0-9.]+[\s]*[<]?[\s]*[0-9.]+/));
3604
+ function isVersion(e6, x) {
3605
+ if (x.lastToken === "pragma solidity") return x.lastToken = null, !x.startOfLine && (e6.match(/[\^{0}][0-9.]+/) || e6.match(/[>=]+?[\s]*[0-9.]+[\s]*[<]?[\s]*[0-9.]+/));
3653
3606
  }
3654
- function isNumber(e6, y) {
3655
- if (/[\d.]/.test(e6)) return e6 === "." ? y.match(/^[0-9]+([eE][-+]?[0-9]+)?/) : e6 === "0" ? y.match(/^[xX][0-9a-fA-F]+/) || y.match(/^0[0-7]+/) : y.match(/^[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?/), true;
3607
+ function isNumber(e6, x) {
3608
+ if (/[\d.]/.test(e6)) return e6 === "." ? x.match(/^[0-9]+([eE][-+]?[0-9]+)?/) : e6 === "0" ? x.match(/^[xX][0-9a-fA-F]+/) || x.match(/^0[0-7]+/) : x.match(/^[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?/), true;
3656
3609
  }
3657
3610
  function isValidInteger(e6) {
3658
3611
  if (e6.match(/^[u]?int/)) {
3659
3612
  if (e6.indexOf("t") + 1 === e6.length) return true;
3660
- let y = Number(e6.substr(e6.indexOf("t") + 1, e6.length));
3661
- return y % 8 == 0 && y <= 256;
3613
+ let x = Number(e6.substr(e6.indexOf("t") + 1, e6.length));
3614
+ return x % 8 == 0 && x <= 256;
3662
3615
  }
3663
3616
  }
3664
3617
  function isValidBytes(e6) {
3665
3618
  if (e6.match(/^bytes/)) {
3666
3619
  if (e6.indexOf("s") + 1 === e6.length) return true;
3667
- let y = e6.substr(e6.indexOf("s") + 1, e6.length);
3668
- return Number(y) <= 32;
3620
+ let x = e6.substr(e6.indexOf("s") + 1, e6.length);
3621
+ return Number(x) <= 32;
3669
3622
  }
3670
3623
  }
3671
3624
  function isValidFixed(e6) {
3672
3625
  if (e6.match(/^[u]?fixed([0-9]+x[0-9]+)?/)) {
3673
3626
  if (e6.indexOf("d") + 1 === e6.length) return true;
3674
- let y = e6.substr(e6.indexOf("d") + 1, e6.length).split("x").map(Number);
3675
- return y[0] % 8 == 0 && y[0] <= 256 && y[1] <= 80;
3627
+ let x = e6.substr(e6.indexOf("d") + 1, e6.length).split("x").map(Number);
3628
+ return x[0] % 8 == 0 && x[0] <= 256 && x[1] <= 80;
3676
3629
  }
3677
3630
  }
3678
- function updateHexLiterals(e6, y) {
3679
- if (e6.match(/^hex/) && y.peek() === '"') {
3680
- let e7 = false, b, x = "", S = "";
3681
- for (b = y.next(); b; ) {
3682
- if (S += b, b === '"' && e7) {
3683
- if (x = S.substring(1, S.length - 1), x.match(/^[0-9a-fA-F]+$/)) return "number";
3684
- y.backUp(S.length);
3631
+ function updateHexLiterals(e6, x) {
3632
+ if (e6.match(/^hex/) && x.peek() === '"') {
3633
+ let e7 = false, S, C = "", w = "";
3634
+ for (S = x.next(); S; ) {
3635
+ if (w += S, S === '"' && e7) {
3636
+ if (C = w.substring(1, w.length - 1), C.match(/^[0-9a-fA-F]+$/)) return "number";
3637
+ x.backUp(w.length);
3685
3638
  break;
3686
3639
  }
3687
- e7 || (e7 = b === '"'), b = y.next();
3640
+ e7 || (e7 = S === '"'), S = x.next();
3688
3641
  }
3689
3642
  }
3690
3643
  }
3691
- function updateGarmmer(e6, y) {
3692
- return e6 === "," && y.para === "functionName(variable" && (y.para = "functionName("), y.para != null && y.para.startsWith("functionName") && (e6 === ")" ? y.para.endsWith("(") && (y.para = y.para.substr(0, y.para.length - 1), y.para === "functionName" && (y.grammar = "")) : e6 === "(" && (y.para += e6)), e6 === "(" && y.lastToken === "functionName" ? y.lastToken += e6 : e6 === ")" && y.lastToken === "functionName(" ? y.lastToken = null : e6 === "(" && y.lastToken === "returns" ? y.lastToken += e6 : e6 === ")" && (y.lastToken === "returns(" || y.lastToken === "returns(variable") && (y.lastToken = null), e6 === "(" && y.lastToken === "address" && (y.lastToken += e6), curPunc = e6, null;
3644
+ function updateGarmmer(e6, x) {
3645
+ return e6 === "," && x.para === "functionName(variable" && (x.para = "functionName("), x.para != null && x.para.startsWith("functionName") && (e6 === ")" ? x.para.endsWith("(") && (x.para = x.para.substr(0, x.para.length - 1), x.para === "functionName" && (x.grammar = "")) : e6 === "(" && (x.para += e6)), e6 === "(" && x.lastToken === "functionName" ? x.lastToken += e6 : e6 === ")" && x.lastToken === "functionName(" ? x.lastToken = null : e6 === "(" && x.lastToken === "returns" ? x.lastToken += e6 : e6 === ")" && (x.lastToken === "returns(" || x.lastToken === "returns(variable") && (x.lastToken = null), e6 === "(" && x.lastToken === "address" && (x.lastToken += e6), curPunc = e6, null;
3693
3646
  }
3694
3647
  var Context = class {
3695
- constructor(e6, y, b, x, S) {
3696
- this.indented = e6, this.column = y, this.type = b, this.align = x, this.prev = S;
3648
+ constructor(e6, x, S, C, w) {
3649
+ this.indented = e6, this.column = x, this.type = S, this.align = C, this.prev = w;
3697
3650
  }
3698
3651
  };
3699
- function pushContext(e6, y, b) {
3700
- return e6.context = new Context(e6.indented, y, b, null, e6.context), e6.context;
3652
+ function pushContext(e6, x, S) {
3653
+ return e6.context = new Context(e6.indented, x, S, null, e6.context), e6.context;
3701
3654
  }
3702
3655
  function popContext(e6) {
3703
3656
  if (!e6.context.prev) return;
3704
- let y = e6.context.type;
3705
- return (y === ")" || y === "]" || y === "}") && (e6.indented = e6.context.indented), e6.context = e6.context.prev;
3657
+ let x = e6.context.type;
3658
+ return (x === ")" || x === "]" || x === "}") && (e6.indented = e6.context.indented), e6.context = e6.context.prev;
3706
3659
  }
3707
3660
  var parser = {
3708
3661
  startState(e6) {
@@ -3716,19 +3669,19 @@ var parser = {
3716
3669
  para: null
3717
3670
  };
3718
3671
  },
3719
- token(e6, y) {
3720
- let b = y.context;
3721
- if (e6.sol() && (b.align ?? (b.align = false), y.indented = e6.indentation(), y.startOfLine = true, b.type === "case" && (b.type = "}"), y.grammar === "doc" && (y.grammar = null)), e6.eatSpace()) return null;
3672
+ token(e6, x) {
3673
+ let S = x.context;
3674
+ if (e6.sol() && (S.align ?? (S.align = false), x.indented = e6.indentation(), x.startOfLine = true, S.type === "case" && (S.type = "}"), x.grammar === "doc" && (x.grammar = null)), e6.eatSpace()) return null;
3722
3675
  curPunc = null;
3723
- let x = (y.tokenize || tokenBase)(e6, y);
3724
- return x === "comment" ? x : (b.align ?? (b.align = true), curPunc === "{" ? pushContext(y, e6.column(), "}") : curPunc === "[" ? pushContext(y, e6.column(), "]") : curPunc === "(" ? pushContext(y, e6.column(), ")") : curPunc === "case" ? b.type = "case" : (curPunc === "}" && b.type === "}" || curPunc === b.type) && popContext(y), y.startOfLine = false, x);
3676
+ let C = (x.tokenize || tokenBase)(e6, x);
3677
+ return C === "comment" ? C : (S.align ?? (S.align = true), curPunc === "{" ? pushContext(x, e6.column(), "}") : curPunc === "[" ? pushContext(x, e6.column(), "]") : curPunc === "(" ? pushContext(x, e6.column(), ")") : curPunc === "case" ? S.type = "case" : (curPunc === "}" && S.type === "}" || curPunc === S.type) && popContext(x), x.startOfLine = false, C);
3725
3678
  },
3726
- indent(e6, y, b) {
3679
+ indent(e6, x, S) {
3727
3680
  if (e6.tokenize !== tokenBase && e6.tokenize != null) return null;
3728
- let x = e6.context, S = y && y.charAt(0);
3729
- if (x.type === "case" && /^(?:case|default)\b/.test(y)) return e6.context.type = "}", x.indented;
3730
- let C = S === x.type;
3731
- return x.align ? x.column + (C ? 0 : 1) : x.indented + (C ? 0 : b.unit);
3681
+ let C = e6.context, w = x && x.charAt(0);
3682
+ if (C.type === "case" && /^(?:case|default)\b/.test(x)) return e6.context.type = "}", C.indented;
3683
+ let T = w === C.type;
3684
+ return C.align ? C.column + (T ? 0 : 1) : C.indented + (T ? 0 : S.unit);
3732
3685
  },
3733
3686
  electricChars: "{}):",
3734
3687
  closeBrackets: "()[]{}''\"\"``",
@@ -3982,16 +3935,16 @@ function loadLanguage(e6) {
3982
3935
  }
3983
3936
  var basicSetup = function(e6) {
3984
3937
  e6 === void 0 && (e6 = {});
3985
- var { crosshairCursor: y = false } = e6, b = [];
3986
- e6.closeBracketsKeymap !== false && (b = b.concat(closeBracketsKeymap)), e6.defaultKeymap !== false && (b = b.concat(defaultKeymap)), e6.searchKeymap !== false && (b = b.concat(searchKeymap)), e6.historyKeymap !== false && (b = b.concat(historyKeymap)), e6.foldKeymap !== false && (b = b.concat(foldKeymap)), e6.completionKeymap !== false && (b = b.concat(completionKeymap)), e6.lintKeymap !== false && (b = b.concat(lintKeymap));
3987
- var x = [];
3988
- return e6.lineNumbers !== false && x.push(lineNumbers()), e6.highlightActiveLineGutter !== false && x.push(highlightActiveLineGutter()), e6.highlightSpecialChars !== false && x.push(highlightSpecialChars()), e6.history !== false && x.push(history()), e6.foldGutter !== false && x.push(foldGutter()), e6.drawSelection !== false && x.push(drawSelection()), e6.dropCursor !== false && x.push(dropCursor()), e6.allowMultipleSelections !== false && x.push(EditorState.allowMultipleSelections.of(true)), e6.indentOnInput !== false && x.push(indentOnInput()), e6.syntaxHighlighting !== false && x.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), e6.bracketMatching !== false && x.push(bracketMatching()), e6.closeBrackets !== false && x.push(closeBrackets()), e6.autocompletion !== false && x.push(autocompletion()), e6.rectangularSelection !== false && x.push(rectangularSelection()), y !== false && x.push(crosshairCursor()), e6.highlightActiveLine !== false && x.push(highlightActiveLine()), e6.highlightSelectionMatches !== false && x.push(highlightSelectionMatches()), e6.tabSize && typeof e6.tabSize == "number" && x.push(indentUnit.of(" ".repeat(e6.tabSize))), x.concat([keymap.of(b.flat())]).filter(Boolean);
3938
+ var { crosshairCursor: x = false } = e6, S = [];
3939
+ e6.closeBracketsKeymap !== false && (S = S.concat(closeBracketsKeymap)), e6.defaultKeymap !== false && (S = S.concat(defaultKeymap)), e6.searchKeymap !== false && (S = S.concat(searchKeymap)), e6.historyKeymap !== false && (S = S.concat(historyKeymap)), e6.foldKeymap !== false && (S = S.concat(foldKeymap)), e6.completionKeymap !== false && (S = S.concat(completionKeymap)), e6.lintKeymap !== false && (S = S.concat(lintKeymap));
3940
+ var C = [];
3941
+ return e6.lineNumbers !== false && C.push(lineNumbers()), e6.highlightActiveLineGutter !== false && C.push(highlightActiveLineGutter()), e6.highlightSpecialChars !== false && C.push(highlightSpecialChars()), e6.history !== false && C.push(history()), e6.foldGutter !== false && C.push(foldGutter()), e6.drawSelection !== false && C.push(drawSelection()), e6.dropCursor !== false && C.push(dropCursor()), e6.allowMultipleSelections !== false && C.push(EditorState.allowMultipleSelections.of(true)), e6.indentOnInput !== false && C.push(indentOnInput()), e6.syntaxHighlighting !== false && C.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), e6.bracketMatching !== false && C.push(bracketMatching()), e6.closeBrackets !== false && C.push(closeBrackets()), e6.autocompletion !== false && C.push(autocompletion()), e6.rectangularSelection !== false && C.push(rectangularSelection()), x !== false && C.push(crosshairCursor()), e6.highlightActiveLine !== false && C.push(highlightActiveLine()), e6.highlightSelectionMatches !== false && C.push(highlightSelectionMatches()), e6.tabSize && typeof e6.tabSize == "number" && C.push(indentUnit.of(" ".repeat(e6.tabSize))), C.concat([keymap.of(S.flat())]).filter(Boolean);
3989
3942
  }, minimalSetup = function(e6) {
3990
3943
  e6 === void 0 && (e6 = {});
3991
- var y = [];
3992
- e6.defaultKeymap !== false && (y = y.concat(defaultKeymap)), e6.historyKeymap !== false && (y = y.concat(historyKeymap));
3993
- var b = [];
3994
- return e6.highlightSpecialChars !== false && b.push(highlightSpecialChars()), e6.history !== false && b.push(history()), e6.drawSelection !== false && b.push(drawSelection()), e6.syntaxHighlighting !== false && b.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), b.concat([keymap.of(y.flat())]).filter(Boolean);
3944
+ var x = [];
3945
+ e6.defaultKeymap !== false && (x = x.concat(defaultKeymap)), e6.historyKeymap !== false && (x = x.concat(historyKeymap));
3946
+ var S = [];
3947
+ return e6.highlightSpecialChars !== false && S.push(highlightSpecialChars()), e6.history !== false && S.push(history()), e6.drawSelection !== false && S.push(drawSelection()), e6.syntaxHighlighting !== false && S.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), S.concat([keymap.of(x.flat())]).filter(Boolean);
3995
3948
  }, chalky = "#e5c07b", coral = "#e06c75", cyan = "#56b6c2", invalid = "#ffffff", ivory = "#abb2bf", stone = "#7d8799", malibu = "#61afef", sage = "#98c379", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#21252b", highlightBackground = "#2c313a", background = "#282c34", tooltipBackground = "#353a42", selection = "#3E4451", cursor = "#528bff", oneDark = [/* @__PURE__ */ EditorView.theme({
3996
3949
  "&": {
3997
3950
  color: ivory,
@@ -4145,21 +4098,21 @@ var basicSetup = function(e6) {
4145
4098
  }
4146
4099
  ]))], defaultLightThemeOption = EditorView.theme({ "&": { backgroundColor: "#fff" } }, { dark: false }), getDefaultExtensions = function(e6) {
4147
4100
  e6 === void 0 && (e6 = {});
4148
- var { indentWithTab: y = true, editable: b = true, readOnly: x = false, theme: S = "light", placeholder: C = "", basicSetup: w = true } = e6, T = [];
4149
- switch (y && T.unshift(keymap.of([indentWithTab])), w && (typeof w == "boolean" ? T.unshift(basicSetup()) : T.unshift(basicSetup(w))), C && T.unshift(placeholder(C)), S) {
4101
+ var { indentWithTab: x = true, editable: S = true, readOnly: C = false, theme: w = "light", placeholder: T = "", basicSetup: E = true } = e6, D = [];
4102
+ switch (x && D.unshift(keymap.of([indentWithTab])), E && (typeof E == "boolean" ? D.unshift(basicSetup()) : D.unshift(basicSetup(E))), T && D.unshift(placeholder(T)), w) {
4150
4103
  case "light":
4151
- T.push(defaultLightThemeOption);
4104
+ D.push(defaultLightThemeOption);
4152
4105
  break;
4153
4106
  case "dark":
4154
- T.push(oneDark);
4107
+ D.push(oneDark);
4155
4108
  break;
4156
4109
  case "none":
4157
4110
  break;
4158
4111
  default:
4159
- T.push(S);
4112
+ D.push(w);
4160
4113
  break;
4161
4114
  }
4162
- return b === false && T.push(EditorView.editable.of(false)), x && T.push(EditorState.readOnly.of(true)), [...T];
4115
+ return S === false && D.push(EditorView.editable.of(false)), C && D.push(EditorState.readOnly.of(true)), [...D];
4163
4116
  }, getStatistics = (e6) => ({
4164
4117
  line: e6.state.doc.lineAt(e6.state.selection.main.from),
4165
4118
  lineCount: e6.state.doc.lines,
@@ -4171,11 +4124,11 @@ var basicSetup = function(e6) {
4171
4124
  selectionAsSingle: e6.state.selection.asSingle().main,
4172
4125
  ranges: e6.state.selection.ranges,
4173
4126
  selectionCode: e6.state.sliceDoc(e6.state.selection.main.from, e6.state.selection.main.to),
4174
- selections: e6.state.selection.ranges.map((y) => e6.state.sliceDoc(y.from, y.to)),
4127
+ selections: e6.state.selection.ranges.map((x) => e6.state.sliceDoc(x.from, x.to)),
4175
4128
  selectedText: e6.state.selection.ranges.some((e7) => !e7.empty)
4176
4129
  }), TimeoutLatch = class {
4177
- constructor(e6, y) {
4178
- this.timeLeftMS = void 0, this.timeoutMS = void 0, this.isCancelled = false, this.isTimeExhausted = false, this.callbacks = [], this.timeLeftMS = y, this.timeoutMS = y, this.callbacks.push(e6);
4130
+ constructor(e6, x) {
4131
+ this.timeLeftMS = void 0, this.timeoutMS = void 0, this.isCancelled = false, this.isTimeExhausted = false, this.callbacks = [], this.timeLeftMS = x, this.timeoutMS = x, this.callbacks.push(e6);
4179
4132
  }
4180
4133
  tick() {
4181
4134
  if (!this.isCancelled && !this.isTimeExhausted && (this.timeLeftMS--, this.timeLeftMS <= 0)) {
@@ -4221,68 +4174,66 @@ var basicSetup = function(e6) {
4221
4174
  }
4222
4175
  }, globalScheduler = null, getScheduler = () => typeof window > "u" ? new Scheduler() : (globalScheduler || (globalScheduler = new Scheduler()), globalScheduler), ExternalChange = Annotation.define(), TYPING_TIMOUT = 200, emptyExtensions = [];
4223
4176
  function useCodeMirror(e6) {
4224
- var { value: y, selection: b, onChange: x, onStatistics: S, onCreateEditor: C, onUpdate: w, extensions: T = emptyExtensions, autoFocus: E, theme: D = "light", height: O = null, minHeight: k = null, maxHeight: A = null, width: j = null, minWidth: M = null, maxWidth: N = null, placeholder: P = "", editable: F = true, readOnly: I = false, indentWithTab: L = true, basicSetup: R = true, root: B, initialState: V } = e6, [H, U] = (0, import_react.useState)(), [W, G] = (0, import_react.useState)(), [K, J] = (0, import_react.useState)(), Y = (0, import_react.useState)(() => ({ current: null }))[0], Z = (0, import_react.useState)(() => ({ current: null }))[0], Q = EditorView.theme({
4177
+ var { value: x, selection: S, onChange: C, onStatistics: w, onCreateEditor: T, onUpdate: E, extensions: D = emptyExtensions, autoFocus: O, theme: k = "light", height: A = null, minHeight: j = null, maxHeight: M = null, width: N = null, minWidth: P = null, maxWidth: F = null, placeholder: I = "", editable: L = true, readOnly: R = false, indentWithTab: z = true, basicSetup: B = true, root: V, initialState: H } = e6, [U, W] = (0, import_react.useState)(), [G, K] = (0, import_react.useState)(), [J, Y] = (0, import_react.useState)(), X = (0, import_react.useState)(() => ({ current: null }))[0], Z = (0, import_react.useState)(() => ({ current: null }))[0], Q = EditorView.theme({
4225
4178
  "&": {
4226
- height: O,
4227
- minHeight: k,
4228
- maxHeight: A,
4229
- width: j,
4230
- minWidth: M,
4231
- maxWidth: N
4179
+ height: A,
4180
+ minHeight: j,
4181
+ maxHeight: M,
4182
+ width: N,
4183
+ minWidth: P,
4184
+ maxWidth: F
4232
4185
  },
4233
4186
  "& .cm-scroller": { height: "100% !important" }
4234
4187
  }), $ = [
4235
4188
  EditorView.updateListener.of((e7) => {
4236
- e7.docChanged && typeof x == "function" && !e7.transactions.some((e8) => e8.annotation(ExternalChange)) && (Y.current ? Y.current.reset() : (Y.current = new TimeoutLatch(() => {
4189
+ e7.docChanged && typeof C == "function" && !e7.transactions.some((e8) => e8.annotation(ExternalChange)) && (X.current ? X.current.reset() : (X.current = new TimeoutLatch(() => {
4237
4190
  if (Z.current) {
4238
4191
  var e8 = Z.current;
4239
4192
  Z.current = null, e8();
4240
4193
  }
4241
- Y.current = null;
4242
- }, TYPING_TIMOUT), getScheduler().add(Y.current)), x(e7.state.doc.toString(), e7)), S && S(getStatistics(e7));
4194
+ X.current = null;
4195
+ }, TYPING_TIMOUT), getScheduler().add(X.current)), C(e7.state.doc.toString(), e7)), w && w(getStatistics(e7));
4243
4196
  }),
4244
4197
  Q,
4245
4198
  ...getDefaultExtensions({
4246
- theme: D,
4247
- editable: F,
4248
- readOnly: I,
4249
- placeholder: P,
4250
- indentWithTab: L,
4251
- basicSetup: R
4199
+ theme: k,
4200
+ editable: L,
4201
+ readOnly: R,
4202
+ placeholder: I,
4203
+ indentWithTab: z,
4204
+ basicSetup: B
4252
4205
  })
4253
4206
  ];
4254
- return w && typeof w == "function" && $.push(EditorView.updateListener.of(w)), $ = $.concat(T), (0, import_react.useLayoutEffect)(() => {
4255
- if (H && !K) {
4207
+ return E && typeof E == "function" && $.push(EditorView.updateListener.of(E)), $ = $.concat(D), (0, import_react.useLayoutEffect)(() => {
4208
+ if (U && !J) {
4256
4209
  var e7 = {
4257
- doc: y,
4258
- selection: b,
4210
+ doc: x,
4211
+ selection: S,
4259
4212
  extensions: $
4260
- }, x2 = V ? EditorState.fromJSON(V.json, e7, V.fields) : EditorState.create(e7);
4261
- if (J(x2), !W) {
4262
- var S2 = new EditorView({
4263
- state: x2,
4264
- parent: H,
4265
- root: B
4213
+ }, C2 = H ? EditorState.fromJSON(H.json, e7, H.fields) : EditorState.create(e7);
4214
+ if (Y(C2), !G) {
4215
+ var w2 = new EditorView({
4216
+ state: C2,
4217
+ parent: U,
4218
+ root: V
4266
4219
  });
4267
- G(S2), C && C(S2, x2);
4220
+ K(w2), T && T(w2, C2);
4268
4221
  }
4269
4222
  }
4270
4223
  return () => {
4271
- W && (J(void 0), G(void 0));
4224
+ G && (Y(void 0), K(void 0));
4272
4225
  };
4273
- }, [H, K]), (0, import_react.useEffect)(() => {
4274
- e6.container && U(e6.container);
4226
+ }, [U, J]), (0, import_react.useEffect)(() => {
4227
+ e6.container && W(e6.container);
4275
4228
  }, [e6.container]), (0, import_react.useEffect)(() => () => {
4276
- W && (W.destroy(), G(void 0)), Y.current && (Y.current = (Y.current.cancel(), null));
4277
- }, [W]), (0, import_react.useEffect)(() => {
4278
- E && W && W.focus();
4279
- }, [E, W]), (0, import_react.useEffect)(() => {
4280
- W && W.dispatch({ effects: StateEffect.reconfigure.of($) });
4229
+ G && (G.destroy(), K(void 0)), X.current && (X.current = (X.current.cancel(), null));
4230
+ }, [G]), (0, import_react.useEffect)(() => {
4231
+ O && G && G.focus();
4232
+ }, [O, G]), (0, import_react.useEffect)(() => {
4233
+ G && G.dispatch({ effects: StateEffect.reconfigure.of($) });
4281
4234
  }, [
4282
- D,
4283
- T,
4284
- O,
4285
4235
  k,
4236
+ D,
4286
4237
  A,
4287
4238
  j,
4288
4239
  M,
@@ -4292,32 +4243,34 @@ function useCodeMirror(e6) {
4292
4243
  I,
4293
4244
  L,
4294
4245
  R,
4295
- x,
4296
- w
4246
+ z,
4247
+ B,
4248
+ C,
4249
+ E
4297
4250
  ]), (0, import_react.useEffect)(() => {
4298
- if (y !== void 0) {
4299
- var e7 = W ? W.state.doc.toString() : "";
4300
- if (W && y !== e7) {
4301
- var b2 = Y.current && !Y.current.isDone, x2 = () => {
4302
- W && y !== W.state.doc.toString() && W.dispatch({
4251
+ if (x !== void 0) {
4252
+ var e7 = G ? G.state.doc.toString() : "";
4253
+ if (G && x !== e7) {
4254
+ var S2 = X.current && !X.current.isDone, C2 = () => {
4255
+ G && x !== G.state.doc.toString() && G.dispatch({
4303
4256
  changes: {
4304
4257
  from: 0,
4305
- to: W.state.doc.toString().length,
4306
- insert: y || ""
4258
+ to: G.state.doc.toString().length,
4259
+ insert: x || ""
4307
4260
  },
4308
4261
  annotations: [ExternalChange.of(true)]
4309
4262
  });
4310
4263
  };
4311
- b2 ? Z.current = x2 : x2();
4264
+ S2 ? Z.current = C2 : C2();
4312
4265
  }
4313
4266
  }
4314
- }, [y, W]), {
4315
- state: K,
4316
- setState: J,
4317
- view: W,
4318
- setView: G,
4319
- container: H,
4320
- setContainer: U
4267
+ }, [x, G]), {
4268
+ state: J,
4269
+ setState: Y,
4270
+ view: G,
4271
+ setView: K,
4272
+ container: U,
4273
+ setContainer: W
4321
4274
  };
4322
4275
  }
4323
4276
  var _excluded = [
@@ -4344,62 +4297,61 @@ var _excluded = [
4344
4297
  "readOnly",
4345
4298
  "root",
4346
4299
  "initialState"
4347
- ], ReactCodeMirror = /* @__PURE__ */ (0, import_react.forwardRef)((e6, y) => {
4348
- var { className: b, value: x = "", selection: S, extensions: C = [], onChange: w, onStatistics: T, onCreateEditor: E, onUpdate: D, autoFocus: O, theme: k = "light", height: A, minHeight: j, maxHeight: M, width: N, minWidth: P, maxWidth: F, basicSetup: I, placeholder: L, indentWithTab: R, editable: z, readOnly: B, root: V, initialState: H } = e6, U = _objectWithoutPropertiesLoose(e6, _excluded), W = (0, import_react.useRef)(null), { state: G, view: K, container: J, setContainer: Y } = useCodeMirror({
4349
- root: V,
4350
- value: x,
4351
- autoFocus: O,
4352
- theme: k,
4353
- height: A,
4354
- minHeight: j,
4355
- maxHeight: M,
4356
- width: N,
4357
- minWidth: P,
4358
- maxWidth: F,
4359
- basicSetup: I,
4360
- placeholder: L,
4361
- indentWithTab: R,
4362
- editable: z,
4363
- readOnly: B,
4364
- selection: S,
4365
- onChange: w,
4366
- onStatistics: T,
4367
- onCreateEditor: E,
4368
- onUpdate: D,
4369
- extensions: C,
4370
- initialState: H
4300
+ ], ReactCodeMirror = /* @__PURE__ */ (0, import_react.forwardRef)((e6, x) => {
4301
+ var { className: S, value: C = "", selection: w, extensions: T = [], onChange: E, onStatistics: D, onCreateEditor: O, onUpdate: k, autoFocus: A, theme: j = "light", height: M, minHeight: N, maxHeight: P, width: F, minWidth: I, maxWidth: L, basicSetup: R, placeholder: z, indentWithTab: B, editable: V, readOnly: H, root: U, initialState: W } = e6, G = _objectWithoutPropertiesLoose(e6, _excluded), K = (0, import_react.useRef)(null), { state: J, view: Y, container: X, setContainer: Z } = useCodeMirror({
4302
+ root: U,
4303
+ value: C,
4304
+ autoFocus: A,
4305
+ theme: j,
4306
+ height: M,
4307
+ minHeight: N,
4308
+ maxHeight: P,
4309
+ width: F,
4310
+ minWidth: I,
4311
+ maxWidth: L,
4312
+ basicSetup: R,
4313
+ placeholder: z,
4314
+ indentWithTab: B,
4315
+ editable: V,
4316
+ readOnly: H,
4317
+ selection: w,
4318
+ onChange: E,
4319
+ onStatistics: D,
4320
+ onCreateEditor: O,
4321
+ onUpdate: k,
4322
+ extensions: T,
4323
+ initialState: W
4371
4324
  });
4372
- (0, import_react.useImperativeHandle)(y, () => ({
4373
- editor: W.current,
4374
- state: G,
4375
- view: K
4325
+ (0, import_react.useImperativeHandle)(x, () => ({
4326
+ editor: K.current,
4327
+ state: J,
4328
+ view: Y
4376
4329
  }), [
4377
- W,
4330
+ K,
4331
+ X,
4378
4332
  J,
4379
- G,
4380
- K
4333
+ Y
4381
4334
  ]);
4382
- var X = (0, import_react.useCallback)((e7) => {
4383
- W.current = e7, Y(e7);
4384
- }, [Y]);
4385
- if (typeof x != "string") throw Error("value must be typeof string but got " + typeof x);
4335
+ var Q = (0, import_react.useCallback)((e7) => {
4336
+ K.current = e7, Z(e7);
4337
+ }, [Z]);
4338
+ if (typeof C != "string") throw Error("value must be typeof string but got " + typeof C);
4386
4339
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", _extends({
4387
- ref: X,
4388
- className: (typeof k == "string" ? "cm-theme-" + k : "cm-theme") + (b ? " " + b : "")
4389
- }, U));
4340
+ ref: Q,
4341
+ className: (typeof j == "string" ? "cm-theme-" + j : "cm-theme") + (S ? " " + S : "")
4342
+ }, G));
4390
4343
  });
4391
4344
  ReactCodeMirror.displayName = "CodeMirror";
4392
4345
  var esm_default = ReactCodeMirror;
4393
4346
  export {
4394
4347
  _extends as a,
4395
- setDiagnostics as c,
4396
- CopyClipboardIcon as d,
4348
+ historyField as c,
4397
4349
  loadLanguage as i,
4398
- historyField as l,
4350
+ insertTab as l,
4399
4351
  minimalSetup as n,
4400
4352
  forEachDiagnostic as o,
4401
4353
  langs as r,
4402
- linter as s,
4354
+ setDiagnostics as s,
4403
4355
  esm_default as t,
4404
- insertTab as u
4356
+ CopyClipboardIcon as u
4405
4357
  };