@gsc-basic/components 1.0.1

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 (231) hide show
  1. package/dist/es/_virtual/_plugin-vue_export-helper.js +9 -0
  2. package/dist/es/index.js +35 -0
  3. package/dist/es/node_modules/@codemirror/autocomplete/dist/index.js +1371 -0
  4. package/dist/es/node_modules/@codemirror/commands/dist/index.js +838 -0
  5. package/dist/es/node_modules/@codemirror/lang-java/dist/index.js +38 -0
  6. package/dist/es/node_modules/@codemirror/lang-javascript/dist/index.js +300 -0
  7. package/dist/es/node_modules/@codemirror/lang-json/dist/index.js +48 -0
  8. package/dist/es/node_modules/@codemirror/lang-python/dist/index.js +399 -0
  9. package/dist/es/node_modules/@codemirror/lang-sql/dist/index.js +497 -0
  10. package/dist/es/node_modules/@codemirror/lang-xml/dist/index.js +216 -0
  11. package/dist/es/node_modules/@codemirror/lang-yaml/dist/index.js +51 -0
  12. package/dist/es/node_modules/@codemirror/language/dist/index.js +1299 -0
  13. package/dist/es/node_modules/@codemirror/lint/dist/index.js +649 -0
  14. package/dist/es/node_modules/@codemirror/search/dist/index.js +872 -0
  15. package/dist/es/node_modules/@codemirror/state/dist/index.js +2639 -0
  16. package/dist/es/node_modules/@codemirror/theme-one-dark/dist/index.js +132 -0
  17. package/dist/es/node_modules/@codemirror/view/dist/index.js +7280 -0
  18. package/dist/es/node_modules/@lezer/common/dist/index.js +1430 -0
  19. package/dist/es/node_modules/@lezer/highlight/dist/index.js +637 -0
  20. package/dist/es/node_modules/@lezer/java/dist/index.js +62 -0
  21. package/dist/es/node_modules/@lezer/javascript/dist/index.js +161 -0
  22. package/dist/es/node_modules/@lezer/json/dist/index.js +34 -0
  23. package/dist/es/node_modules/@lezer/lr/dist/index.js +1307 -0
  24. package/dist/es/node_modules/@lezer/python/dist/index.js +221 -0
  25. package/dist/es/node_modules/@lezer/xml/dist/index.js +100 -0
  26. package/dist/es/node_modules/@lezer/yaml/dist/index.js +274 -0
  27. package/dist/es/node_modules/@marijn/find-cluster-break/src/index.js +69 -0
  28. package/dist/es/node_modules/@vueuse/core/dist/index.js +125 -0
  29. package/dist/es/node_modules/@vueuse/shared/dist/index.js +55 -0
  30. package/dist/es/node_modules/codemirror/dist/index.js +40 -0
  31. package/dist/es/node_modules/crelt/index.js +27 -0
  32. package/dist/es/node_modules/lodash-es/_Hash.js +20 -0
  33. package/dist/es/node_modules/lodash-es/_ListCache.js +20 -0
  34. package/dist/es/node_modules/lodash-es/_Map.js +6 -0
  35. package/dist/es/node_modules/lodash-es/_MapCache.js +20 -0
  36. package/dist/es/node_modules/lodash-es/_Symbol.js +5 -0
  37. package/dist/es/node_modules/lodash-es/_arrayMap.js +8 -0
  38. package/dist/es/node_modules/lodash-es/_assocIndexOf.js +10 -0
  39. package/dist/es/node_modules/lodash-es/_baseGet.js +11 -0
  40. package/dist/es/node_modules/lodash-es/_baseGetTag.js +10 -0
  41. package/dist/es/node_modules/lodash-es/_baseIsNative.js +16 -0
  42. package/dist/es/node_modules/lodash-es/_baseToString.js +18 -0
  43. package/dist/es/node_modules/lodash-es/_castPath.js +10 -0
  44. package/dist/es/node_modules/lodash-es/_coreJsData.js +5 -0
  45. package/dist/es/node_modules/lodash-es/_freeGlobal.js +4 -0
  46. package/dist/es/node_modules/lodash-es/_getMapData.js +8 -0
  47. package/dist/es/node_modules/lodash-es/_getNative.js +9 -0
  48. package/dist/es/node_modules/lodash-es/_getRawTag.js +15 -0
  49. package/dist/es/node_modules/lodash-es/_getValue.js +6 -0
  50. package/dist/es/node_modules/lodash-es/_hashClear.js +7 -0
  51. package/dist/es/node_modules/lodash-es/_hashDelete.js +7 -0
  52. package/dist/es/node_modules/lodash-es/_hashGet.js +13 -0
  53. package/dist/es/node_modules/lodash-es/_hashHas.js +9 -0
  54. package/dist/es/node_modules/lodash-es/_hashSet.js +9 -0
  55. package/dist/es/node_modules/lodash-es/_isKey.js +12 -0
  56. package/dist/es/node_modules/lodash-es/_isKeyable.js +7 -0
  57. package/dist/es/node_modules/lodash-es/_isMasked.js +11 -0
  58. package/dist/es/node_modules/lodash-es/_listCacheClear.js +6 -0
  59. package/dist/es/node_modules/lodash-es/_listCacheDelete.js +12 -0
  60. package/dist/es/node_modules/lodash-es/_listCacheGet.js +8 -0
  61. package/dist/es/node_modules/lodash-es/_listCacheHas.js +7 -0
  62. package/dist/es/node_modules/lodash-es/_listCacheSet.js +8 -0
  63. package/dist/es/node_modules/lodash-es/_mapCacheClear.js +13 -0
  64. package/dist/es/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  65. package/dist/es/node_modules/lodash-es/_mapCacheGet.js +7 -0
  66. package/dist/es/node_modules/lodash-es/_mapCacheHas.js +7 -0
  67. package/dist/es/node_modules/lodash-es/_mapCacheSet.js +8 -0
  68. package/dist/es/node_modules/lodash-es/_memoizeCapped.js +11 -0
  69. package/dist/es/node_modules/lodash-es/_nativeCreate.js +5 -0
  70. package/dist/es/node_modules/lodash-es/_objectToString.js +7 -0
  71. package/dist/es/node_modules/lodash-es/_root.js +5 -0
  72. package/dist/es/node_modules/lodash-es/_stringToPath.js +10 -0
  73. package/dist/es/node_modules/lodash-es/_toKey.js +10 -0
  74. package/dist/es/node_modules/lodash-es/_toSource.js +17 -0
  75. package/dist/es/node_modules/lodash-es/eq.js +6 -0
  76. package/dist/es/node_modules/lodash-es/get.js +8 -0
  77. package/dist/es/node_modules/lodash-es/isArray.js +4 -0
  78. package/dist/es/node_modules/lodash-es/isFunction.js +12 -0
  79. package/dist/es/node_modules/lodash-es/isNil.js +6 -0
  80. package/dist/es/node_modules/lodash-es/isObject.js +7 -0
  81. package/dist/es/node_modules/lodash-es/isObjectLike.js +6 -0
  82. package/dist/es/node_modules/lodash-es/isString.js +10 -0
  83. package/dist/es/node_modules/lodash-es/isSymbol.js +9 -0
  84. package/dist/es/node_modules/lodash-es/memoize.js +18 -0
  85. package/dist/es/node_modules/lodash-es/toString.js +7 -0
  86. package/dist/es/node_modules/style-mod/src/style-mod.js +109 -0
  87. package/dist/es/node_modules/vue-codemirror/dist/vue-codemirror.esm.js +132 -0
  88. package/dist/es/node_modules/w3c-keyname/index.js +93 -0
  89. package/dist/es/src/CodeEditor/index.js +6 -0
  90. package/dist/es/src/CodeEditor/src/index.css +1 -0
  91. package/dist/es/src/CodeEditor/src/index.vue.js +128 -0
  92. package/dist/es/src/CodeEditor/src/index2.css +1 -0
  93. package/dist/es/src/ConfigProvider/index.js +7 -0
  94. package/dist/es/src/ConfigProvider/src/configProvider.js +14 -0
  95. package/dist/es/src/ConfigProvider/src/configProviderProps.js +22 -0
  96. package/dist/es/src/ConfigProvider/src/constants.js +9 -0
  97. package/dist/es/src/ConfigProvider/src/useGlobalConfig.js +45 -0
  98. package/dist/es/src/ScaleScreen/index.js +6 -0
  99. package/dist/es/src/ScaleScreen/src/index.css +1 -0
  100. package/dist/es/src/ScaleScreen/src/index.vue.js +115 -0
  101. package/dist/es/src/ScaleScreen/src/index2.css +1 -0
  102. package/dist/es/src/VideoBackground/index.js +6 -0
  103. package/dist/es/src/VideoBackground/src/helper.js +29 -0
  104. package/dist/es/src/VideoBackground/src/index.css +1 -0
  105. package/dist/es/src/VideoBackground/src/index.vue.js +108 -0
  106. package/dist/es/src/VideoBackground/src/index2.css +1 -0
  107. package/dist/es/src/VideoBackground/src/index3.css +1 -0
  108. package/dist/es/src/VideoBackground/src/videoBackground.js +31 -0
  109. package/dist/es/src/hooks/useLocale.js +24 -0
  110. package/dist/es/src/hooks/useNamespace.js +8 -0
  111. package/dist/es/src/index.js +28 -0
  112. package/dist/es/src/locale/lang/en-US.js +32 -0
  113. package/dist/es/src/locale/lang/ja-JP.js +32 -0
  114. package/dist/es/src/locale/lang/zh-CN.js +32 -0
  115. package/dist/es/src/styles/tokens.css +1 -0
  116. package/dist/lib/_virtual/_plugin-vue_export-helper.js +1 -0
  117. package/dist/lib/index.js +1 -0
  118. package/dist/lib/node_modules/@codemirror/autocomplete/dist/index.js +1 -0
  119. package/dist/lib/node_modules/@codemirror/commands/dist/index.js +1 -0
  120. package/dist/lib/node_modules/@codemirror/lang-java/dist/index.js +1 -0
  121. package/dist/lib/node_modules/@codemirror/lang-javascript/dist/index.js +13 -0
  122. package/dist/lib/node_modules/@codemirror/lang-json/dist/index.js +1 -0
  123. package/dist/lib/node_modules/@codemirror/lang-python/dist/index.js +3 -0
  124. package/dist/lib/node_modules/@codemirror/lang-sql/dist/index.js +2 -0
  125. package/dist/lib/node_modules/@codemirror/lang-xml/dist/index.js +1 -0
  126. package/dist/lib/node_modules/@codemirror/lang-yaml/dist/index.js +1 -0
  127. package/dist/lib/node_modules/@codemirror/language/dist/index.js +1 -0
  128. package/dist/lib/node_modules/@codemirror/lint/dist/index.js +1 -0
  129. package/dist/lib/node_modules/@codemirror/search/dist/index.js +2 -0
  130. package/dist/lib/node_modules/@codemirror/state/dist/index.js +5 -0
  131. package/dist/lib/node_modules/@codemirror/theme-one-dark/dist/index.js +1 -0
  132. package/dist/lib/node_modules/@codemirror/view/dist/index.js +5 -0
  133. package/dist/lib/node_modules/@lezer/common/dist/index.js +1 -0
  134. package/dist/lib/node_modules/@lezer/highlight/dist/index.js +1 -0
  135. package/dist/lib/node_modules/@lezer/java/dist/index.js +1 -0
  136. package/dist/lib/node_modules/@lezer/javascript/dist/index.js +1 -0
  137. package/dist/lib/node_modules/@lezer/json/dist/index.js +1 -0
  138. package/dist/lib/node_modules/@lezer/lr/dist/index.js +1 -0
  139. package/dist/lib/node_modules/@lezer/python/dist/index.js +1 -0
  140. package/dist/lib/node_modules/@lezer/xml/dist/index.js +1 -0
  141. package/dist/lib/node_modules/@lezer/yaml/dist/index.js +1 -0
  142. package/dist/lib/node_modules/@marijn/find-cluster-break/src/index.js +1 -0
  143. package/dist/lib/node_modules/@vueuse/core/dist/index.js +1 -0
  144. package/dist/lib/node_modules/@vueuse/shared/dist/index.js +1 -0
  145. package/dist/lib/node_modules/codemirror/dist/index.js +1 -0
  146. package/dist/lib/node_modules/crelt/index.js +1 -0
  147. package/dist/lib/node_modules/lodash-es/_Hash.js +1 -0
  148. package/dist/lib/node_modules/lodash-es/_ListCache.js +1 -0
  149. package/dist/lib/node_modules/lodash-es/_Map.js +1 -0
  150. package/dist/lib/node_modules/lodash-es/_MapCache.js +1 -0
  151. package/dist/lib/node_modules/lodash-es/_Symbol.js +1 -0
  152. package/dist/lib/node_modules/lodash-es/_arrayMap.js +1 -0
  153. package/dist/lib/node_modules/lodash-es/_assocIndexOf.js +1 -0
  154. package/dist/lib/node_modules/lodash-es/_baseGet.js +1 -0
  155. package/dist/lib/node_modules/lodash-es/_baseGetTag.js +1 -0
  156. package/dist/lib/node_modules/lodash-es/_baseIsNative.js +1 -0
  157. package/dist/lib/node_modules/lodash-es/_baseToString.js +1 -0
  158. package/dist/lib/node_modules/lodash-es/_castPath.js +1 -0
  159. package/dist/lib/node_modules/lodash-es/_coreJsData.js +1 -0
  160. package/dist/lib/node_modules/lodash-es/_freeGlobal.js +1 -0
  161. package/dist/lib/node_modules/lodash-es/_getMapData.js +1 -0
  162. package/dist/lib/node_modules/lodash-es/_getNative.js +1 -0
  163. package/dist/lib/node_modules/lodash-es/_getRawTag.js +1 -0
  164. package/dist/lib/node_modules/lodash-es/_getValue.js +1 -0
  165. package/dist/lib/node_modules/lodash-es/_hashClear.js +1 -0
  166. package/dist/lib/node_modules/lodash-es/_hashDelete.js +1 -0
  167. package/dist/lib/node_modules/lodash-es/_hashGet.js +1 -0
  168. package/dist/lib/node_modules/lodash-es/_hashHas.js +1 -0
  169. package/dist/lib/node_modules/lodash-es/_hashSet.js +1 -0
  170. package/dist/lib/node_modules/lodash-es/_isKey.js +1 -0
  171. package/dist/lib/node_modules/lodash-es/_isKeyable.js +1 -0
  172. package/dist/lib/node_modules/lodash-es/_isMasked.js +1 -0
  173. package/dist/lib/node_modules/lodash-es/_listCacheClear.js +1 -0
  174. package/dist/lib/node_modules/lodash-es/_listCacheDelete.js +1 -0
  175. package/dist/lib/node_modules/lodash-es/_listCacheGet.js +1 -0
  176. package/dist/lib/node_modules/lodash-es/_listCacheHas.js +1 -0
  177. package/dist/lib/node_modules/lodash-es/_listCacheSet.js +1 -0
  178. package/dist/lib/node_modules/lodash-es/_mapCacheClear.js +1 -0
  179. package/dist/lib/node_modules/lodash-es/_mapCacheDelete.js +1 -0
  180. package/dist/lib/node_modules/lodash-es/_mapCacheGet.js +1 -0
  181. package/dist/lib/node_modules/lodash-es/_mapCacheHas.js +1 -0
  182. package/dist/lib/node_modules/lodash-es/_mapCacheSet.js +1 -0
  183. package/dist/lib/node_modules/lodash-es/_memoizeCapped.js +1 -0
  184. package/dist/lib/node_modules/lodash-es/_nativeCreate.js +1 -0
  185. package/dist/lib/node_modules/lodash-es/_objectToString.js +1 -0
  186. package/dist/lib/node_modules/lodash-es/_root.js +1 -0
  187. package/dist/lib/node_modules/lodash-es/_stringToPath.js +1 -0
  188. package/dist/lib/node_modules/lodash-es/_toKey.js +1 -0
  189. package/dist/lib/node_modules/lodash-es/_toSource.js +1 -0
  190. package/dist/lib/node_modules/lodash-es/eq.js +1 -0
  191. package/dist/lib/node_modules/lodash-es/get.js +1 -0
  192. package/dist/lib/node_modules/lodash-es/isArray.js +1 -0
  193. package/dist/lib/node_modules/lodash-es/isFunction.js +1 -0
  194. package/dist/lib/node_modules/lodash-es/isNil.js +1 -0
  195. package/dist/lib/node_modules/lodash-es/isObject.js +1 -0
  196. package/dist/lib/node_modules/lodash-es/isObjectLike.js +1 -0
  197. package/dist/lib/node_modules/lodash-es/isString.js +1 -0
  198. package/dist/lib/node_modules/lodash-es/isSymbol.js +1 -0
  199. package/dist/lib/node_modules/lodash-es/memoize.js +1 -0
  200. package/dist/lib/node_modules/lodash-es/toString.js +1 -0
  201. package/dist/lib/node_modules/style-mod/src/style-mod.js +3 -0
  202. package/dist/lib/node_modules/vue-codemirror/dist/vue-codemirror.esm.js +1 -0
  203. package/dist/lib/node_modules/w3c-keyname/index.js +1 -0
  204. package/dist/lib/src/CodeEditor/index.js +1 -0
  205. package/dist/lib/src/CodeEditor/src/index.css +1 -0
  206. package/dist/lib/src/CodeEditor/src/index.vue.js +1 -0
  207. package/dist/lib/src/CodeEditor/src/index2.css +1 -0
  208. package/dist/lib/src/ConfigProvider/index.js +1 -0
  209. package/dist/lib/src/ConfigProvider/src/configProvider.js +1 -0
  210. package/dist/lib/src/ConfigProvider/src/configProviderProps.js +1 -0
  211. package/dist/lib/src/ConfigProvider/src/constants.js +1 -0
  212. package/dist/lib/src/ConfigProvider/src/useGlobalConfig.js +1 -0
  213. package/dist/lib/src/ScaleScreen/index.js +1 -0
  214. package/dist/lib/src/ScaleScreen/src/index.css +1 -0
  215. package/dist/lib/src/ScaleScreen/src/index.vue.js +1 -0
  216. package/dist/lib/src/ScaleScreen/src/index2.css +1 -0
  217. package/dist/lib/src/VideoBackground/index.js +1 -0
  218. package/dist/lib/src/VideoBackground/src/helper.js +1 -0
  219. package/dist/lib/src/VideoBackground/src/index.css +1 -0
  220. package/dist/lib/src/VideoBackground/src/index.vue.js +1 -0
  221. package/dist/lib/src/VideoBackground/src/index2.css +1 -0
  222. package/dist/lib/src/VideoBackground/src/index3.css +1 -0
  223. package/dist/lib/src/VideoBackground/src/videoBackground.js +1 -0
  224. package/dist/lib/src/hooks/useLocale.js +1 -0
  225. package/dist/lib/src/hooks/useNamespace.js +1 -0
  226. package/dist/lib/src/index.js +1 -0
  227. package/dist/lib/src/locale/lang/en-US.js +1 -0
  228. package/dist/lib/src/locale/lang/ja-JP.js +1 -0
  229. package/dist/lib/src/locale/lang/zh-CN.js +1 -0
  230. package/dist/lib/src/styles/tokens.css +1 -0
  231. package/package.json +71 -0
@@ -0,0 +1,838 @@
1
+ import { StateField as qe, Facet as oe, EditorSelection as a, countColumn as $, Text as le, Annotation as ce, Transaction as P, combineConfig as Ke, findClusterBreak as E, StateEffect as se, ChangeSet as $e, ChangeDesc as We } from "../../state/dist/index.js";
2
+ import { EditorView as x, Direction as Qe } from "../../view/dist/index.js";
3
+ import { IndentContext as ie, getIndentation as ue, indentString as R, syntaxTree as W, matchBrackets as D, getIndentUnit as G, indentUnit as Xe } from "../../language/dist/index.js";
4
+ import { NodeProp as F } from "../../../@lezer/common/dist/index.js";
5
+ const Ye = (e) => {
6
+ let { state: t } = e, r = t.doc.lineAt(t.selection.main.from), n = X(e.state, r.from);
7
+ return n.line ? Ze(e) : n.block ? we(e) : !1;
8
+ };
9
+ function Q(e, t) {
10
+ return ({ state: r, dispatch: n }) => {
11
+ if (r.readOnly)
12
+ return !1;
13
+ let l = e(t, r);
14
+ return l ? (n(r.update(l)), !0) : !1;
15
+ };
16
+ }
17
+ const Ze = /* @__PURE__ */ Q(
18
+ tt,
19
+ 0
20
+ /* CommentOption.Toggle */
21
+ ), je = /* @__PURE__ */ Q(
22
+ fe,
23
+ 0
24
+ /* CommentOption.Toggle */
25
+ ), we = /* @__PURE__ */ Q(
26
+ (e, t) => fe(e, t, et(t)),
27
+ 0
28
+ /* CommentOption.Toggle */
29
+ );
30
+ function X(e, t) {
31
+ let r = e.languageDataAt("commentTokens", t, 1);
32
+ return r.length ? r[0] : {};
33
+ }
34
+ const M = 50;
35
+ function _e(e, { open: t, close: r }, n, l) {
36
+ let o = e.sliceDoc(n - M, n), c = e.sliceDoc(l, l + M), s = /\s*$/.exec(o)[0].length, i = /^\s*/.exec(c)[0].length, f = o.length - s;
37
+ if (o.slice(f - t.length, f) == t && c.slice(i, i + r.length) == r)
38
+ return {
39
+ open: { pos: n - s, margin: s && 1 },
40
+ close: { pos: l + i, margin: i && 1 }
41
+ };
42
+ let u, h;
43
+ l - n <= 2 * M ? u = h = e.sliceDoc(n, l) : (u = e.sliceDoc(n, n + M), h = e.sliceDoc(l - M, l));
44
+ let p = /^\s*/.exec(u)[0].length, T = /\s*$/.exec(h)[0].length, L = h.length - T - r.length;
45
+ return u.slice(p, p + t.length) == t && h.slice(L, L + r.length) == r ? {
46
+ open: {
47
+ pos: n + p + t.length,
48
+ margin: /\s/.test(u.charAt(p + t.length)) ? 1 : 0
49
+ },
50
+ close: {
51
+ pos: l - T - r.length,
52
+ margin: /\s/.test(h.charAt(L - 1)) ? 1 : 0
53
+ }
54
+ } : null;
55
+ }
56
+ function et(e) {
57
+ let t = [];
58
+ for (let r of e.selection.ranges) {
59
+ let n = e.doc.lineAt(r.from), l = r.to <= n.to ? n : e.doc.lineAt(r.to);
60
+ l.from > n.from && l.from == r.to && (l = r.to == n.to + 1 ? n : e.doc.lineAt(r.to - 1));
61
+ let o = t.length - 1;
62
+ o >= 0 && t[o].to > n.from ? t[o].to = l.to : t.push({ from: n.from + /^\s*/.exec(n.text)[0].length, to: l.to });
63
+ }
64
+ return t;
65
+ }
66
+ function fe(e, t, r = t.selection.ranges) {
67
+ let n = r.map((o) => X(t, o.from).block);
68
+ if (!n.every((o) => o))
69
+ return null;
70
+ let l = r.map((o, c) => _e(t, n[c], o.from, o.to));
71
+ if (e != 2 && !l.every((o) => o))
72
+ return { changes: t.changes(r.map((o, c) => l[c] ? [] : [{ from: o.from, insert: n[c].open + " " }, { from: o.to, insert: " " + n[c].close }])) };
73
+ if (e != 1 && l.some((o) => o)) {
74
+ let o = [];
75
+ for (let c = 0, s; c < l.length; c++)
76
+ if (s = l[c]) {
77
+ let i = n[c], { open: f, close: u } = s;
78
+ o.push({ from: f.pos - i.open.length, to: f.pos + f.margin }, { from: u.pos - u.margin, to: u.pos + i.close.length });
79
+ }
80
+ return { changes: o };
81
+ }
82
+ return null;
83
+ }
84
+ function tt(e, t, r = t.selection.ranges) {
85
+ let n = [], l = -1;
86
+ for (let { from: o, to: c } of r) {
87
+ let s = n.length, i = 1e9, f = X(t, o).line;
88
+ if (f) {
89
+ for (let u = o; u <= c; ) {
90
+ let h = t.doc.lineAt(u);
91
+ if (h.from > l && (o == c || c > h.from)) {
92
+ l = h.from;
93
+ let p = /^\s*/.exec(h.text)[0].length, T = p == h.length, L = h.text.slice(p, p + f.length) == f ? p : -1;
94
+ p < h.text.length && p < i && (i = p), n.push({ line: h, comment: L, token: f, indent: p, empty: T, single: !1 });
95
+ }
96
+ u = h.to + 1;
97
+ }
98
+ if (i < 1e9)
99
+ for (let u = s; u < n.length; u++)
100
+ n[u].indent < n[u].line.text.length && (n[u].indent = i);
101
+ n.length == s + 1 && (n[s].single = !0);
102
+ }
103
+ }
104
+ if (e != 2 && n.some((o) => o.comment < 0 && (!o.empty || o.single))) {
105
+ let o = [];
106
+ for (let { line: s, token: i, indent: f, empty: u, single: h } of n)
107
+ (h || !u) && o.push({ from: s.from + f, insert: i + " " });
108
+ let c = t.changes(o);
109
+ return { changes: c, selection: t.selection.map(c, 1) };
110
+ } else if (e != 1 && n.some((o) => o.comment >= 0)) {
111
+ let o = [];
112
+ for (let { line: c, comment: s, token: i } of n)
113
+ if (s >= 0) {
114
+ let f = c.from + s, u = f + i.length;
115
+ c.text[u - c.from] == " " && u++, o.push({ from: f, to: u });
116
+ }
117
+ return { changes: o };
118
+ }
119
+ return null;
120
+ }
121
+ const z = /* @__PURE__ */ ce.define(), nt = /* @__PURE__ */ ce.define(), rt = /* @__PURE__ */ oe.define(), ae = /* @__PURE__ */ oe.define({
122
+ combine(e) {
123
+ return Ke(e, {
124
+ minDepth: 100,
125
+ newGroupDelay: 500,
126
+ joinToEvent: (t, r) => r
127
+ }, {
128
+ minDepth: Math.max,
129
+ newGroupDelay: Math.min,
130
+ joinToEvent: (t, r) => (n, l) => t(n, l) || r(n, l)
131
+ });
132
+ }
133
+ }), he = /* @__PURE__ */ qe.define({
134
+ create() {
135
+ return B.empty;
136
+ },
137
+ update(e, t) {
138
+ let r = t.state.facet(ae), n = t.annotation(z);
139
+ if (n) {
140
+ let i = m.fromTransaction(t, n.selection), f = n.side, u = f == 0 ? e.undone : e.done;
141
+ return i ? u = v(u, u.length, r.minDepth, i) : u = pe(u, t.startState.selection), new B(f == 0 ? n.rest : u, f == 0 ? u : n.rest);
142
+ }
143
+ let l = t.annotation(nt);
144
+ if ((l == "full" || l == "before") && (e = e.isolate()), t.annotation(P.addToHistory) === !1)
145
+ return t.changes.empty ? e : e.addMapping(t.changes.desc);
146
+ let o = m.fromTransaction(t), c = t.annotation(P.time), s = t.annotation(P.userEvent);
147
+ return o ? e = e.addChanges(o, c, s, r, t) : t.selection && (e = e.addSelection(t.startState.selection, c, s, r.newGroupDelay)), (l == "full" || l == "after") && (e = e.isolate()), e;
148
+ },
149
+ toJSON(e) {
150
+ return { done: e.done.map((t) => t.toJSON()), undone: e.undone.map((t) => t.toJSON()) };
151
+ },
152
+ fromJSON(e) {
153
+ return new B(e.done.map(m.fromJSON), e.undone.map(m.fromJSON));
154
+ }
155
+ });
156
+ function un(e = {}) {
157
+ return [
158
+ he,
159
+ ae.of(e),
160
+ x.domEventHandlers({
161
+ beforeinput(t, r) {
162
+ let n = t.inputType == "historyUndo" ? de : t.inputType == "historyRedo" ? H : null;
163
+ return n ? (t.preventDefault(), n(r)) : !1;
164
+ }
165
+ })
166
+ ];
167
+ }
168
+ function I(e, t) {
169
+ return function({ state: r, dispatch: n }) {
170
+ if (!t && r.readOnly)
171
+ return !1;
172
+ let l = r.field(he, !1);
173
+ if (!l)
174
+ return !1;
175
+ let o = l.pop(e, r, t);
176
+ return o ? (n(o), !0) : !1;
177
+ };
178
+ }
179
+ const de = /* @__PURE__ */ I(0, !1), H = /* @__PURE__ */ I(1, !1), ot = /* @__PURE__ */ I(0, !0), lt = /* @__PURE__ */ I(1, !0);
180
+ class m {
181
+ constructor(t, r, n, l, o) {
182
+ this.changes = t, this.effects = r, this.mapped = n, this.startSelection = l, this.selectionsAfter = o;
183
+ }
184
+ setSelAfter(t) {
185
+ return new m(this.changes, this.effects, this.mapped, this.startSelection, t);
186
+ }
187
+ toJSON() {
188
+ var t, r, n;
189
+ return {
190
+ changes: (t = this.changes) === null || t === void 0 ? void 0 : t.toJSON(),
191
+ mapped: (r = this.mapped) === null || r === void 0 ? void 0 : r.toJSON(),
192
+ startSelection: (n = this.startSelection) === null || n === void 0 ? void 0 : n.toJSON(),
193
+ selectionsAfter: this.selectionsAfter.map((l) => l.toJSON())
194
+ };
195
+ }
196
+ static fromJSON(t) {
197
+ return new m(t.changes && $e.fromJSON(t.changes), [], t.mapped && We.fromJSON(t.mapped), t.startSelection && a.fromJSON(t.startSelection), t.selectionsAfter.map(a.fromJSON));
198
+ }
199
+ // This does not check `addToHistory` and such, it assumes the
200
+ // transaction needs to be converted to an item. Returns null when
201
+ // there are no changes or effects in the transaction.
202
+ static fromTransaction(t, r) {
203
+ let n = g;
204
+ for (let l of t.startState.facet(rt)) {
205
+ let o = l(t);
206
+ o.length && (n = n.concat(o));
207
+ }
208
+ return !n.length && t.changes.empty ? null : new m(t.changes.invert(t.startState.doc), n, void 0, r || t.startState.selection, g);
209
+ }
210
+ static selection(t) {
211
+ return new m(void 0, g, void 0, void 0, t);
212
+ }
213
+ }
214
+ function v(e, t, r, n) {
215
+ let l = t + 1 > r + 20 ? t - r - 1 : 0, o = e.slice(l, t);
216
+ return o.push(n), o;
217
+ }
218
+ function ct(e, t) {
219
+ let r = [], n = !1;
220
+ return e.iterChangedRanges((l, o) => r.push(l, o)), t.iterChangedRanges((l, o, c, s) => {
221
+ for (let i = 0; i < r.length; ) {
222
+ let f = r[i++], u = r[i++];
223
+ s >= f && c <= u && (n = !0);
224
+ }
225
+ }), n;
226
+ }
227
+ function st(e, t) {
228
+ return e.ranges.length == t.ranges.length && e.ranges.filter((r, n) => r.empty != t.ranges[n].empty).length === 0;
229
+ }
230
+ function me(e, t) {
231
+ return e.length ? t.length ? e.concat(t) : e : t;
232
+ }
233
+ const g = [], it = 200;
234
+ function pe(e, t) {
235
+ if (e.length) {
236
+ let r = e[e.length - 1], n = r.selectionsAfter.slice(Math.max(0, r.selectionsAfter.length - it));
237
+ return n.length && n[n.length - 1].eq(t) ? e : (n.push(t), v(e, e.length - 1, 1e9, r.setSelAfter(n)));
238
+ } else
239
+ return [m.selection([t])];
240
+ }
241
+ function ut(e) {
242
+ let t = e[e.length - 1], r = e.slice();
243
+ return r[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), r;
244
+ }
245
+ function J(e, t) {
246
+ if (!e.length)
247
+ return e;
248
+ let r = e.length, n = g;
249
+ for (; r; ) {
250
+ let l = ft(e[r - 1], t, n);
251
+ if (l.changes && !l.changes.empty || l.effects.length) {
252
+ let o = e.slice(0, r);
253
+ return o[r - 1] = l, o;
254
+ } else
255
+ t = l.mapped, r--, n = l.selectionsAfter;
256
+ }
257
+ return n.length ? [m.selection(n)] : g;
258
+ }
259
+ function ft(e, t, r) {
260
+ let n = me(e.selectionsAfter.length ? e.selectionsAfter.map((s) => s.map(t)) : g, r);
261
+ if (!e.changes)
262
+ return m.selection(n);
263
+ let l = e.changes.map(t), o = t.mapDesc(e.changes, !0), c = e.mapped ? e.mapped.composeDesc(o) : o;
264
+ return new m(l, se.mapEffects(e.effects, t), c, e.startSelection.map(o), n);
265
+ }
266
+ const at = /^(input\.type|delete)($|\.)/;
267
+ class B {
268
+ constructor(t, r, n = 0, l = void 0) {
269
+ this.done = t, this.undone = r, this.prevTime = n, this.prevUserEvent = l;
270
+ }
271
+ isolate() {
272
+ return this.prevTime ? new B(this.done, this.undone) : this;
273
+ }
274
+ addChanges(t, r, n, l, o) {
275
+ let c = this.done, s = c[c.length - 1];
276
+ return s && s.changes && !s.changes.empty && t.changes && (!n || at.test(n)) && (!s.selectionsAfter.length && r - this.prevTime < l.newGroupDelay && l.joinToEvent(o, ct(s.changes, t.changes)) || // For compose (but not compose.start) events, always join with previous event
277
+ n == "input.type.compose") ? c = v(c, c.length - 1, l.minDepth, new m(t.changes.compose(s.changes), me(se.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, g)) : c = v(c, c.length, l.minDepth, t), new B(c, g, r, n);
278
+ }
279
+ addSelection(t, r, n, l) {
280
+ let o = this.done.length ? this.done[this.done.length - 1].selectionsAfter : g;
281
+ return o.length > 0 && r - this.prevTime < l && n == this.prevUserEvent && n && /^select($|\.)/.test(n) && st(o[o.length - 1], t) ? this : new B(pe(this.done, t), this.undone, r, n);
282
+ }
283
+ addMapping(t) {
284
+ return new B(J(this.done, t), J(this.undone, t), this.prevTime, this.prevUserEvent);
285
+ }
286
+ pop(t, r, n) {
287
+ let l = t == 0 ? this.done : this.undone;
288
+ if (l.length == 0)
289
+ return null;
290
+ let o = l[l.length - 1], c = o.selectionsAfter[0] || r.selection;
291
+ if (n && o.selectionsAfter.length)
292
+ return r.update({
293
+ selection: o.selectionsAfter[o.selectionsAfter.length - 1],
294
+ annotations: z.of({ side: t, rest: ut(l), selection: c }),
295
+ userEvent: t == 0 ? "select.undo" : "select.redo",
296
+ scrollIntoView: !0
297
+ });
298
+ if (o.changes) {
299
+ let s = l.length == 1 ? g : l.slice(0, l.length - 1);
300
+ return o.mapped && (s = J(s, o.mapped)), r.update({
301
+ changes: o.changes,
302
+ selection: o.startSelection,
303
+ effects: o.effects,
304
+ annotations: z.of({ side: t, rest: s, selection: c }),
305
+ filter: !1,
306
+ userEvent: t == 0 ? "undo" : "redo",
307
+ scrollIntoView: !0
308
+ });
309
+ } else
310
+ return null;
311
+ }
312
+ }
313
+ B.empty = /* @__PURE__ */ new B(g, g);
314
+ const fn = [
315
+ { key: "Mod-z", run: de, preventDefault: !0 },
316
+ { key: "Mod-y", mac: "Mod-Shift-z", run: H, preventDefault: !0 },
317
+ { linux: "Ctrl-Shift-z", run: H, preventDefault: !0 },
318
+ { key: "Mod-u", run: ot, preventDefault: !0 },
319
+ { key: "Alt-u", mac: "Mod-Shift-u", run: lt, preventDefault: !0 }
320
+ ];
321
+ function C(e, t) {
322
+ return a.create(e.ranges.map(t), e.mainIndex);
323
+ }
324
+ function k(e, t) {
325
+ return e.update({ selection: t, scrollIntoView: !0, userEvent: "select" });
326
+ }
327
+ function A({ state: e, dispatch: t }, r) {
328
+ let n = C(e.selection, r);
329
+ return n.eq(e.selection, !0) ? !1 : (t(k(e, n)), !0);
330
+ }
331
+ function U(e, t) {
332
+ return a.cursor(t ? e.to : e.from);
333
+ }
334
+ function ge(e, t) {
335
+ return A(e, (r) => r.empty ? e.moveByChar(r, t) : U(r, t));
336
+ }
337
+ function d(e) {
338
+ return e.textDirectionAt(e.state.selection.main.head) == Qe.LTR;
339
+ }
340
+ const ye = (e) => ge(e, !d(e)), ke = (e) => ge(e, d(e));
341
+ function Ae(e, t) {
342
+ return A(e, (r) => r.empty ? e.moveByGroup(r, t) : U(r, t));
343
+ }
344
+ const ht = (e) => Ae(e, !d(e)), dt = (e) => Ae(e, d(e));
345
+ function mt(e, t, r) {
346
+ if (t.type.prop(r))
347
+ return !0;
348
+ let n = t.to - t.from;
349
+ return n && (n > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
350
+ }
351
+ function V(e, t, r) {
352
+ let n = W(e).resolveInner(t.head), l = r ? F.closedBy : F.openedBy;
353
+ for (let i = t.head; ; ) {
354
+ let f = r ? n.childAfter(i) : n.childBefore(i);
355
+ if (!f)
356
+ break;
357
+ mt(e, f, l) ? n = f : i = r ? f.to : f.from;
358
+ }
359
+ let o = n.type.prop(l), c, s;
360
+ return o && (c = r ? D(e, n.from, 1) : D(e, n.to, -1)) && c.matched ? s = r ? c.end.to : c.end.from : s = r ? n.to : n.from, a.cursor(s, r ? -1 : 1);
361
+ }
362
+ const pt = (e) => A(e, (t) => V(e.state, t, !d(e))), gt = (e) => A(e, (t) => V(e.state, t, d(e)));
363
+ function Be(e, t) {
364
+ return A(e, (r) => {
365
+ if (!r.empty)
366
+ return U(r, t);
367
+ let n = e.moveVertically(r, t);
368
+ return n.head != r.head ? n : e.moveToLineBoundary(r, t);
369
+ });
370
+ }
371
+ const Se = (e) => Be(e, !1), De = (e) => Be(e, !0);
372
+ function xe(e) {
373
+ let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, r = 0, n = 0, l;
374
+ if (t) {
375
+ for (let o of e.state.facet(x.scrollMargins)) {
376
+ let c = o(e);
377
+ c?.top && (r = Math.max(c?.top, r)), c?.bottom && (n = Math.max(c?.bottom, n));
378
+ }
379
+ l = e.scrollDOM.clientHeight - r - n;
380
+ } else
381
+ l = (e.dom.ownerDocument.defaultView || window).innerHeight;
382
+ return {
383
+ marginTop: r,
384
+ marginBottom: n,
385
+ selfScroll: t,
386
+ height: Math.max(e.defaultLineHeight, l - 5)
387
+ };
388
+ }
389
+ function Ce(e, t) {
390
+ let r = xe(e), { state: n } = e, l = C(n.selection, (c) => c.empty ? e.moveVertically(c, t, r.height) : U(c, t));
391
+ if (l.eq(n.selection))
392
+ return !1;
393
+ let o;
394
+ if (r.selfScroll) {
395
+ let c = e.coordsAtPos(n.selection.main.head), s = e.scrollDOM.getBoundingClientRect(), i = s.top + r.marginTop, f = s.bottom - r.marginBottom;
396
+ c && c.top > i && c.bottom < f && (o = x.scrollIntoView(l.main.head, { y: "start", yMargin: c.top - i }));
397
+ }
398
+ return e.dispatch(k(n, l), { effects: o }), !0;
399
+ }
400
+ const Z = (e) => Ce(e, !1), q = (e) => Ce(e, !0);
401
+ function S(e, t, r) {
402
+ let n = e.lineBlockAt(t.head), l = e.moveToLineBoundary(t, r);
403
+ if (l.head == t.head && l.head != (r ? n.to : n.from) && (l = e.moveToLineBoundary(t, r, !1)), !r && l.head == n.from && n.length) {
404
+ let o = /^\s*/.exec(e.state.sliceDoc(n.from, Math.min(n.from + 100, n.to)))[0].length;
405
+ o && t.head != n.from + o && (l = a.cursor(n.from + o));
406
+ }
407
+ return l;
408
+ }
409
+ const yt = (e) => A(e, (t) => S(e, t, !0)), kt = (e) => A(e, (t) => S(e, t, !1)), At = (e) => A(e, (t) => S(e, t, !d(e))), Bt = (e) => A(e, (t) => S(e, t, d(e))), St = (e) => A(e, (t) => a.cursor(e.lineBlockAt(t.head).from, 1)), Dt = (e) => A(e, (t) => a.cursor(e.lineBlockAt(t.head).to, -1));
410
+ function xt(e, t, r) {
411
+ let n = !1, l = C(e.selection, (o) => {
412
+ let c = D(e, o.head, -1) || D(e, o.head, 1) || o.head > 0 && D(e, o.head - 1, 1) || o.head < e.doc.length && D(e, o.head + 1, -1);
413
+ if (!c || !c.end)
414
+ return o;
415
+ n = !0;
416
+ let s = c.start.from == o.head ? c.end.to : c.end.from;
417
+ return a.cursor(s);
418
+ });
419
+ return n ? (t(k(e, l)), !0) : !1;
420
+ }
421
+ const Ct = ({ state: e, dispatch: t }) => xt(e, t);
422
+ function y(e, t) {
423
+ let r = C(e.state.selection, (n) => {
424
+ let l = t(n);
425
+ return a.range(n.anchor, l.head, l.goalColumn, l.bidiLevel || void 0);
426
+ });
427
+ return r.eq(e.state.selection) ? !1 : (e.dispatch(k(e.state, r)), !0);
428
+ }
429
+ function Le(e, t) {
430
+ return y(e, (r) => e.moveByChar(r, t));
431
+ }
432
+ const Me = (e) => Le(e, !d(e)), Ee = (e) => Le(e, d(e));
433
+ function Oe(e, t) {
434
+ return y(e, (r) => e.moveByGroup(r, t));
435
+ }
436
+ const Lt = (e) => Oe(e, !d(e)), Mt = (e) => Oe(e, d(e)), Et = (e) => y(e, (t) => V(e.state, t, !d(e))), Ot = (e) => y(e, (t) => V(e.state, t, d(e)));
437
+ function Te(e, t) {
438
+ return y(e, (r) => e.moveVertically(r, t));
439
+ }
440
+ const be = (e) => Te(e, !1), Re = (e) => Te(e, !0);
441
+ function ve(e, t) {
442
+ return y(e, (r) => e.moveVertically(r, t, xe(e).height));
443
+ }
444
+ const j = (e) => ve(e, !1), w = (e) => ve(e, !0), Tt = (e) => y(e, (t) => S(e, t, !0)), bt = (e) => y(e, (t) => S(e, t, !1)), Rt = (e) => y(e, (t) => S(e, t, !d(e))), vt = (e) => y(e, (t) => S(e, t, d(e))), It = (e) => y(e, (t) => a.cursor(e.lineBlockAt(t.head).from)), Ut = (e) => y(e, (t) => a.cursor(e.lineBlockAt(t.head).to)), _ = ({ state: e, dispatch: t }) => (t(k(e, { anchor: 0 })), !0), ee = ({ state: e, dispatch: t }) => (t(k(e, { anchor: e.doc.length })), !0), te = ({ state: e, dispatch: t }) => (t(k(e, { anchor: e.selection.main.anchor, head: 0 })), !0), ne = ({ state: e, dispatch: t }) => (t(k(e, { anchor: e.selection.main.anchor, head: e.doc.length })), !0), Vt = ({ state: e, dispatch: t }) => (t(e.update({ selection: { anchor: 0, head: e.doc.length }, userEvent: "select" })), !0), Nt = ({ state: e, dispatch: t }) => {
445
+ let r = N(e).map(({ from: n, to: l }) => a.range(n, Math.min(l + 1, e.doc.length)));
446
+ return t(e.update({ selection: a.create(r), userEvent: "select" })), !0;
447
+ }, Pt = ({ state: e, dispatch: t }) => {
448
+ let r = C(e.selection, (n) => {
449
+ let l = W(e), o = l.resolveStack(n.from, 1);
450
+ if (n.empty) {
451
+ let c = l.resolveStack(n.from, -1);
452
+ c.node.from >= o.node.from && c.node.to <= o.node.to && (o = c);
453
+ }
454
+ for (let c = o; c; c = c.next) {
455
+ let { node: s } = c;
456
+ if ((s.from < n.from && s.to >= n.to || s.to > n.to && s.from <= n.from) && c.next)
457
+ return a.range(s.to, s.from);
458
+ }
459
+ return n;
460
+ });
461
+ return r.eq(e.selection) ? !1 : (t(k(e, r)), !0);
462
+ };
463
+ function Ie(e, t) {
464
+ let { state: r } = e, n = r.selection, l = r.selection.ranges.slice();
465
+ for (let o of r.selection.ranges) {
466
+ let c = r.doc.lineAt(o.head);
467
+ if (t ? c.to < e.state.doc.length : c.from > 0)
468
+ for (let s = o; ; ) {
469
+ let i = e.moveVertically(s, t);
470
+ if (i.head < c.from || i.head > c.to) {
471
+ l.some((f) => f.head == i.head) || l.push(i);
472
+ break;
473
+ } else {
474
+ if (i.head == s.head)
475
+ break;
476
+ s = i;
477
+ }
478
+ }
479
+ }
480
+ return l.length == n.ranges.length ? !1 : (e.dispatch(k(r, a.create(l, l.length - 1))), !0);
481
+ }
482
+ const Jt = (e) => Ie(e, !1), Gt = (e) => Ie(e, !0), Ft = ({ state: e, dispatch: t }) => {
483
+ let r = e.selection, n = null;
484
+ return r.ranges.length > 1 ? n = a.create([r.main]) : r.main.empty || (n = a.create([a.cursor(r.main.head)])), n ? (t(k(e, n)), !0) : !1;
485
+ };
486
+ function O(e, t) {
487
+ if (e.state.readOnly)
488
+ return !1;
489
+ let r = "delete.selection", { state: n } = e, l = n.changeByRange((o) => {
490
+ let { from: c, to: s } = o;
491
+ if (c == s) {
492
+ let i = t(o);
493
+ i < c ? (r = "delete.backward", i = b(e, i, !1)) : i > c && (r = "delete.forward", i = b(e, i, !0)), c = Math.min(c, i), s = Math.max(s, i);
494
+ } else
495
+ c = b(e, c, !1), s = b(e, s, !0);
496
+ return c == s ? { range: o } : { changes: { from: c, to: s }, range: a.cursor(c, c < o.head ? -1 : 1) };
497
+ });
498
+ return l.changes.empty ? !1 : (e.dispatch(n.update(l, {
499
+ scrollIntoView: !0,
500
+ userEvent: r,
501
+ effects: r == "delete.selection" ? x.announce.of(n.phrase("Selection deleted")) : void 0
502
+ })), !0);
503
+ }
504
+ function b(e, t, r) {
505
+ if (e instanceof x)
506
+ for (let n of e.state.facet(x.atomicRanges).map((l) => l(e)))
507
+ n.between(t, t, (l, o) => {
508
+ l < t && o > t && (t = r ? o : l);
509
+ });
510
+ return t;
511
+ }
512
+ const Ue = (e, t, r) => O(e, (n) => {
513
+ let l = n.from, { state: o } = e, c = o.doc.lineAt(l), s, i;
514
+ if (r && !t && l > c.from && l < c.from + 200 && !/[^ \t]/.test(s = c.text.slice(0, l - c.from))) {
515
+ if (s[s.length - 1] == " ")
516
+ return l - 1;
517
+ let f = $(s, o.tabSize), u = f % G(o) || G(o);
518
+ for (let h = 0; h < u && s[s.length - 1 - h] == " "; h++)
519
+ l--;
520
+ i = l;
521
+ } else
522
+ i = E(c.text, l - c.from, t, t) + c.from, i == l && c.number != (t ? o.doc.lines : 1) ? i += t ? 1 : -1 : !t && /[\ufe00-\ufe0f]/.test(c.text.slice(i - c.from, l - c.from)) && (i = E(c.text, i - c.from, !1, !1) + c.from);
523
+ return i;
524
+ }), K = (e) => Ue(e, !1, !0), Ve = (e) => Ue(e, !0, !1), Ne = (e, t) => O(e, (r) => {
525
+ let n = r.head, { state: l } = e, o = l.doc.lineAt(n), c = l.charCategorizer(n);
526
+ for (let s = null; ; ) {
527
+ if (n == (t ? o.to : o.from)) {
528
+ n == r.head && o.number != (t ? l.doc.lines : 1) && (n += t ? 1 : -1);
529
+ break;
530
+ }
531
+ let i = E(o.text, n - o.from, t) + o.from, f = o.text.slice(Math.min(n, i) - o.from, Math.max(n, i) - o.from), u = c(f);
532
+ if (s != null && u != s)
533
+ break;
534
+ (f != " " || n != r.head) && (s = u), n = i;
535
+ }
536
+ return n;
537
+ }), Pe = (e) => Ne(e, !1), zt = (e) => Ne(e, !0), Ht = (e) => O(e, (t) => {
538
+ let r = e.lineBlockAt(t.head).to;
539
+ return t.head < r ? r : Math.min(e.state.doc.length, t.head + 1);
540
+ }), qt = (e) => O(e, (t) => {
541
+ let r = e.moveToLineBoundary(t, !1).head;
542
+ return t.head > r ? r : Math.max(0, t.head - 1);
543
+ }), Kt = (e) => O(e, (t) => {
544
+ let r = e.moveToLineBoundary(t, !0).head;
545
+ return t.head < r ? r : Math.min(e.state.doc.length, t.head + 1);
546
+ }), $t = ({ state: e, dispatch: t }) => {
547
+ if (e.readOnly)
548
+ return !1;
549
+ let r = e.changeByRange((n) => ({
550
+ changes: { from: n.from, to: n.to, insert: le.of(["", ""]) },
551
+ range: a.cursor(n.from)
552
+ }));
553
+ return t(e.update(r, { scrollIntoView: !0, userEvent: "input" })), !0;
554
+ }, Wt = ({ state: e, dispatch: t }) => {
555
+ if (e.readOnly)
556
+ return !1;
557
+ let r = e.changeByRange((n) => {
558
+ if (!n.empty || n.from == 0 || n.from == e.doc.length)
559
+ return { range: n };
560
+ let l = n.from, o = e.doc.lineAt(l), c = l == o.from ? l - 1 : E(o.text, l - o.from, !1) + o.from, s = l == o.to ? l + 1 : E(o.text, l - o.from, !0) + o.from;
561
+ return {
562
+ changes: { from: c, to: s, insert: e.doc.slice(l, s).append(e.doc.slice(c, l)) },
563
+ range: a.cursor(s)
564
+ };
565
+ });
566
+ return r.changes.empty ? !1 : (t(e.update(r, { scrollIntoView: !0, userEvent: "move.character" })), !0);
567
+ };
568
+ function N(e) {
569
+ let t = [], r = -1;
570
+ for (let n of e.selection.ranges) {
571
+ let l = e.doc.lineAt(n.from), o = e.doc.lineAt(n.to);
572
+ if (!n.empty && n.to == o.from && (o = e.doc.lineAt(n.to - 1)), r >= l.number) {
573
+ let c = t[t.length - 1];
574
+ c.to = o.to, c.ranges.push(n);
575
+ } else
576
+ t.push({ from: l.from, to: o.to, ranges: [n] });
577
+ r = o.number + 1;
578
+ }
579
+ return t;
580
+ }
581
+ function Je(e, t, r) {
582
+ if (e.readOnly)
583
+ return !1;
584
+ let n = [], l = [];
585
+ for (let o of N(e)) {
586
+ if (r ? o.to == e.doc.length : o.from == 0)
587
+ continue;
588
+ let c = e.doc.lineAt(r ? o.to + 1 : o.from - 1), s = c.length + 1;
589
+ if (r) {
590
+ n.push({ from: o.to, to: c.to }, { from: o.from, insert: c.text + e.lineBreak });
591
+ for (let i of o.ranges)
592
+ l.push(a.range(Math.min(e.doc.length, i.anchor + s), Math.min(e.doc.length, i.head + s)));
593
+ } else {
594
+ n.push({ from: c.from, to: o.from }, { from: o.to, insert: e.lineBreak + c.text });
595
+ for (let i of o.ranges)
596
+ l.push(a.range(i.anchor - s, i.head - s));
597
+ }
598
+ }
599
+ return n.length ? (t(e.update({
600
+ changes: n,
601
+ scrollIntoView: !0,
602
+ selection: a.create(l, e.selection.mainIndex),
603
+ userEvent: "move.line"
604
+ })), !0) : !1;
605
+ }
606
+ const Qt = ({ state: e, dispatch: t }) => Je(e, t, !1), Xt = ({ state: e, dispatch: t }) => Je(e, t, !0);
607
+ function Ge(e, t, r) {
608
+ if (e.readOnly)
609
+ return !1;
610
+ let n = [];
611
+ for (let l of N(e))
612
+ r ? n.push({ from: l.from, insert: e.doc.slice(l.from, l.to) + e.lineBreak }) : n.push({ from: l.to, insert: e.lineBreak + e.doc.slice(l.from, l.to) });
613
+ return t(e.update({ changes: n, scrollIntoView: !0, userEvent: "input.copyline" })), !0;
614
+ }
615
+ const Yt = ({ state: e, dispatch: t }) => Ge(e, t, !1), Zt = ({ state: e, dispatch: t }) => Ge(e, t, !0), jt = (e) => {
616
+ if (e.state.readOnly)
617
+ return !1;
618
+ let { state: t } = e, r = t.changes(N(t).map(({ from: l, to: o }) => (l > 0 ? l-- : o < t.doc.length && o++, { from: l, to: o }))), n = C(t.selection, (l) => {
619
+ let o;
620
+ if (e.lineWrapping) {
621
+ let c = e.lineBlockAt(l.head), s = e.coordsAtPos(l.head, l.assoc || 1);
622
+ s && (o = c.bottom + e.documentTop - s.bottom + e.defaultLineHeight / 2);
623
+ }
624
+ return e.moveVertically(l, !0, o);
625
+ }).map(r);
626
+ return e.dispatch({ changes: r, selection: n, scrollIntoView: !0, userEvent: "delete.line" }), !0;
627
+ };
628
+ function wt(e, t) {
629
+ if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1)))
630
+ return { from: t, to: t };
631
+ let r = W(e).resolveInner(t), n = r.childBefore(t), l = r.childAfter(t), o;
632
+ return n && l && n.to <= t && l.from >= t && (o = n.type.prop(F.closedBy)) && o.indexOf(l.name) > -1 && e.doc.lineAt(n.to).from == e.doc.lineAt(l.from).from && !/\S/.test(e.sliceDoc(n.to, l.from)) ? { from: n.to, to: l.from } : null;
633
+ }
634
+ const re = /* @__PURE__ */ Fe(!1), _t = /* @__PURE__ */ Fe(!0);
635
+ function Fe(e) {
636
+ return ({ state: t, dispatch: r }) => {
637
+ if (t.readOnly)
638
+ return !1;
639
+ let n = t.changeByRange((l) => {
640
+ let { from: o, to: c } = l, s = t.doc.lineAt(o), i = !e && o == c && wt(t, o);
641
+ e && (o = c = (c <= s.to ? s : t.doc.lineAt(c)).to);
642
+ let f = new ie(t, { simulateBreak: o, simulateDoubleBreak: !!i }), u = ue(f, o);
643
+ for (u == null && (u = $(/^\s*/.exec(t.doc.lineAt(o).text)[0], t.tabSize)); c < s.to && /\s/.test(s.text[c - s.from]); )
644
+ c++;
645
+ i ? { from: o, to: c } = i : o > s.from && o < s.from + 100 && !/\S/.test(s.text.slice(0, o)) && (o = s.from);
646
+ let h = ["", R(t, u)];
647
+ return i && h.push(R(t, f.lineIndent(s.from, -1))), {
648
+ changes: { from: o, to: c, insert: le.of(h) },
649
+ range: a.cursor(o + 1 + h[1].length)
650
+ };
651
+ });
652
+ return r(t.update(n, { scrollIntoView: !0, userEvent: "input" })), !0;
653
+ };
654
+ }
655
+ function Y(e, t) {
656
+ let r = -1;
657
+ return e.changeByRange((n) => {
658
+ let l = [];
659
+ for (let c = n.from; c <= n.to; ) {
660
+ let s = e.doc.lineAt(c);
661
+ s.number > r && (n.empty || n.to > s.from) && (t(s, l, n), r = s.number), c = s.to + 1;
662
+ }
663
+ let o = e.changes(l);
664
+ return {
665
+ changes: l,
666
+ range: a.range(o.mapPos(n.anchor, 1), o.mapPos(n.head, 1))
667
+ };
668
+ });
669
+ }
670
+ const en = ({ state: e, dispatch: t }) => {
671
+ if (e.readOnly)
672
+ return !1;
673
+ let r = /* @__PURE__ */ Object.create(null), n = new ie(e, { overrideIndentation: (o) => {
674
+ let c = r[o];
675
+ return c ?? -1;
676
+ } }), l = Y(e, (o, c, s) => {
677
+ let i = ue(n, o.from);
678
+ if (i == null)
679
+ return;
680
+ /\S/.test(o.text) || (i = 0);
681
+ let f = /^\s*/.exec(o.text)[0], u = R(e, i);
682
+ (f != u || s.from < o.from + f.length) && (r[o.from] = i, c.push({ from: o.from, to: o.from + f.length, insert: u }));
683
+ });
684
+ return l.changes.empty || t(e.update(l, { userEvent: "indent" })), !0;
685
+ }, ze = ({ state: e, dispatch: t }) => e.readOnly ? !1 : (t(e.update(Y(e, (r, n) => {
686
+ n.push({ from: r.from, insert: e.facet(Xe) });
687
+ }), { userEvent: "input.indent" })), !0), He = ({ state: e, dispatch: t }) => e.readOnly ? !1 : (t(e.update(Y(e, (r, n) => {
688
+ let l = /^\s*/.exec(r.text)[0];
689
+ if (!l)
690
+ return;
691
+ let o = $(l, e.tabSize), c = 0, s = R(e, Math.max(0, o - G(e)));
692
+ for (; c < l.length && c < s.length && l.charCodeAt(c) == s.charCodeAt(c); )
693
+ c++;
694
+ n.push({ from: r.from + c, to: r.from + l.length, insert: s.slice(c) });
695
+ }), { userEvent: "delete.dedent" })), !0), tn = (e) => (e.setTabFocusMode(), !0), nn = [
696
+ { key: "Ctrl-b", run: ye, shift: Me, preventDefault: !0 },
697
+ { key: "Ctrl-f", run: ke, shift: Ee },
698
+ { key: "Ctrl-p", run: Se, shift: be },
699
+ { key: "Ctrl-n", run: De, shift: Re },
700
+ { key: "Ctrl-a", run: St, shift: It },
701
+ { key: "Ctrl-e", run: Dt, shift: Ut },
702
+ { key: "Ctrl-d", run: Ve },
703
+ { key: "Ctrl-h", run: K },
704
+ { key: "Ctrl-k", run: Ht },
705
+ { key: "Ctrl-Alt-h", run: Pe },
706
+ { key: "Ctrl-o", run: $t },
707
+ { key: "Ctrl-t", run: Wt },
708
+ { key: "Ctrl-v", run: q }
709
+ ], rn = /* @__PURE__ */ [
710
+ { key: "ArrowLeft", run: ye, shift: Me, preventDefault: !0 },
711
+ { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: ht, shift: Lt, preventDefault: !0 },
712
+ { mac: "Cmd-ArrowLeft", run: At, shift: Rt, preventDefault: !0 },
713
+ { key: "ArrowRight", run: ke, shift: Ee, preventDefault: !0 },
714
+ { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: dt, shift: Mt, preventDefault: !0 },
715
+ { mac: "Cmd-ArrowRight", run: Bt, shift: vt, preventDefault: !0 },
716
+ { key: "ArrowUp", run: Se, shift: be, preventDefault: !0 },
717
+ { mac: "Cmd-ArrowUp", run: _, shift: te },
718
+ { mac: "Ctrl-ArrowUp", run: Z, shift: j },
719
+ { key: "ArrowDown", run: De, shift: Re, preventDefault: !0 },
720
+ { mac: "Cmd-ArrowDown", run: ee, shift: ne },
721
+ { mac: "Ctrl-ArrowDown", run: q, shift: w },
722
+ { key: "PageUp", run: Z, shift: j },
723
+ { key: "PageDown", run: q, shift: w },
724
+ { key: "Home", run: kt, shift: bt, preventDefault: !0 },
725
+ { key: "Mod-Home", run: _, shift: te },
726
+ { key: "End", run: yt, shift: Tt, preventDefault: !0 },
727
+ { key: "Mod-End", run: ee, shift: ne },
728
+ { key: "Enter", run: re, shift: re },
729
+ { key: "Mod-a", run: Vt },
730
+ { key: "Backspace", run: K, shift: K, preventDefault: !0 },
731
+ { key: "Delete", run: Ve, preventDefault: !0 },
732
+ { key: "Mod-Backspace", mac: "Alt-Backspace", run: Pe, preventDefault: !0 },
733
+ { key: "Mod-Delete", mac: "Alt-Delete", run: zt, preventDefault: !0 },
734
+ { mac: "Mod-Backspace", run: qt, preventDefault: !0 },
735
+ { mac: "Mod-Delete", run: Kt, preventDefault: !0 }
736
+ ].concat(/* @__PURE__ */ nn.map((e) => ({ mac: e.key, run: e.run, shift: e.shift }))), an = /* @__PURE__ */ [
737
+ { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: pt, shift: Et },
738
+ { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: gt, shift: Ot },
739
+ { key: "Alt-ArrowUp", run: Qt },
740
+ { key: "Shift-Alt-ArrowUp", run: Yt },
741
+ { key: "Alt-ArrowDown", run: Xt },
742
+ { key: "Shift-Alt-ArrowDown", run: Zt },
743
+ { key: "Mod-Alt-ArrowUp", run: Jt },
744
+ { key: "Mod-Alt-ArrowDown", run: Gt },
745
+ { key: "Escape", run: Ft },
746
+ { key: "Mod-Enter", run: _t },
747
+ { key: "Alt-l", mac: "Ctrl-l", run: Nt },
748
+ { key: "Mod-i", run: Pt, preventDefault: !0 },
749
+ { key: "Mod-[", run: He },
750
+ { key: "Mod-]", run: ze },
751
+ { key: "Mod-Alt-\\", run: en },
752
+ { key: "Shift-Mod-k", run: jt },
753
+ { key: "Shift-Mod-\\", run: Ct },
754
+ { key: "Mod-/", run: Ye },
755
+ { key: "Alt-A", run: je },
756
+ { key: "Ctrl-m", mac: "Shift-Alt-m", run: tn }
757
+ ].concat(rn), hn = { key: "Tab", run: ze, shift: He };
758
+ export {
759
+ Jt as addCursorAbove,
760
+ Gt as addCursorBelow,
761
+ Zt as copyLineDown,
762
+ Yt as copyLineUp,
763
+ ye as cursorCharLeft,
764
+ ke as cursorCharRight,
765
+ ee as cursorDocEnd,
766
+ _ as cursorDocStart,
767
+ ht as cursorGroupLeft,
768
+ dt as cursorGroupRight,
769
+ kt as cursorLineBoundaryBackward,
770
+ yt as cursorLineBoundaryForward,
771
+ At as cursorLineBoundaryLeft,
772
+ Bt as cursorLineBoundaryRight,
773
+ De as cursorLineDown,
774
+ Dt as cursorLineEnd,
775
+ St as cursorLineStart,
776
+ Se as cursorLineUp,
777
+ Ct as cursorMatchingBracket,
778
+ q as cursorPageDown,
779
+ Z as cursorPageUp,
780
+ pt as cursorSyntaxLeft,
781
+ gt as cursorSyntaxRight,
782
+ an as defaultKeymap,
783
+ K as deleteCharBackward,
784
+ Ve as deleteCharForward,
785
+ Pe as deleteGroupBackward,
786
+ zt as deleteGroupForward,
787
+ jt as deleteLine,
788
+ qt as deleteLineBoundaryBackward,
789
+ Kt as deleteLineBoundaryForward,
790
+ Ht as deleteToLineEnd,
791
+ nn as emacsStyleKeymap,
792
+ un as history,
793
+ fn as historyKeymap,
794
+ He as indentLess,
795
+ ze as indentMore,
796
+ en as indentSelection,
797
+ hn as indentWithTab,
798
+ _t as insertBlankLine,
799
+ re as insertNewlineAndIndent,
800
+ rt as invertedEffects,
801
+ nt as isolateHistory,
802
+ Xt as moveLineDown,
803
+ Qt as moveLineUp,
804
+ H as redo,
805
+ lt as redoSelection,
806
+ Vt as selectAll,
807
+ Me as selectCharLeft,
808
+ Ee as selectCharRight,
809
+ ne as selectDocEnd,
810
+ te as selectDocStart,
811
+ Lt as selectGroupLeft,
812
+ Mt as selectGroupRight,
813
+ Nt as selectLine,
814
+ bt as selectLineBoundaryBackward,
815
+ Tt as selectLineBoundaryForward,
816
+ Rt as selectLineBoundaryLeft,
817
+ vt as selectLineBoundaryRight,
818
+ Re as selectLineDown,
819
+ Ut as selectLineEnd,
820
+ It as selectLineStart,
821
+ be as selectLineUp,
822
+ w as selectPageDown,
823
+ j as selectPageUp,
824
+ Pt as selectParentSyntax,
825
+ Et as selectSyntaxLeft,
826
+ Ot as selectSyntaxRight,
827
+ Ft as simplifySelection,
828
+ $t as splitLine,
829
+ rn as standardKeymap,
830
+ je as toggleBlockComment,
831
+ we as toggleBlockCommentByLine,
832
+ Ye as toggleComment,
833
+ Ze as toggleLineComment,
834
+ tn as toggleTabFocusMode,
835
+ Wt as transposeChars,
836
+ de as undo,
837
+ ot as undoSelection
838
+ };