@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,872 @@
1
+ import { EditorView as x, ViewPlugin as Z, getPanel as R, Decoration as d, showPanel as ee, runScopeHandlers as me } from "../../view/dist/index.js";
2
+ import { StateField as te, StateEffect as A, Prec as pe, EditorSelection as g, Facet as ne, combineConfig as re, codePointAt as ge, codePointSize as xe, fromCodePoint as Se, CharCategory as p, EditorState as ye, RangeSetBuilder as Me, findClusterBreak as ie } from "../../state/dist/index.js";
3
+ import h from "../../../crelt/index.js";
4
+ const J = typeof String.prototype.normalize == "function" ? (t) => t.normalize("NFKD") : (t) => t;
5
+ class v {
6
+ /**
7
+ Create a text cursor. The query is the search string, `from` to
8
+ `to` provides the region to search.
9
+
10
+ When `normalize` is given, it will be called, on both the query
11
+ string and the content it is matched against, before comparing.
12
+ You can, for example, create a case-insensitive search by
13
+ passing `s => s.toLowerCase()`.
14
+
15
+ Text is always normalized with
16
+ [`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
17
+ (when supported).
18
+ */
19
+ constructor(e, n, r = 0, i = e.length, s, l) {
20
+ this.test = l, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(r, i), this.bufferStart = r, this.normalize = s ? (o) => s(J(o)) : J, this.query = this.normalize(n);
21
+ }
22
+ peek() {
23
+ if (this.bufferPos == this.buffer.length) {
24
+ if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done)
25
+ return -1;
26
+ this.bufferPos = 0, this.buffer = this.iter.value;
27
+ }
28
+ return ge(this.buffer, this.bufferPos);
29
+ }
30
+ /**
31
+ Look for the next match. Updates the iterator's
32
+ [`value`](https://codemirror.net/6/docs/ref/#search.SearchCursor.value) and
33
+ [`done`](https://codemirror.net/6/docs/ref/#search.SearchCursor.done) properties. Should be called
34
+ at least once before using the cursor.
35
+ */
36
+ next() {
37
+ for (; this.matches.length; )
38
+ this.matches.pop();
39
+ return this.nextOverlapping();
40
+ }
41
+ /**
42
+ The `next` method will ignore matches that partially overlap a
43
+ previous match. This method behaves like `next`, but includes
44
+ such matches.
45
+ */
46
+ nextOverlapping() {
47
+ for (; ; ) {
48
+ let e = this.peek();
49
+ if (e < 0)
50
+ return this.done = !0, this;
51
+ let n = Se(e), r = this.bufferStart + this.bufferPos;
52
+ this.bufferPos += xe(e);
53
+ let i = this.normalize(n);
54
+ if (i.length)
55
+ for (let s = 0, l = r; ; s++) {
56
+ let o = i.charCodeAt(s), c = this.match(o, l, this.bufferPos + this.bufferStart);
57
+ if (s == i.length - 1) {
58
+ if (c)
59
+ return this.value = c, this;
60
+ break;
61
+ }
62
+ l == r && s < n.length && n.charCodeAt(s) == o && l++;
63
+ }
64
+ }
65
+ }
66
+ match(e, n, r) {
67
+ let i = null;
68
+ for (let s = 0; s < this.matches.length; s += 2) {
69
+ let l = this.matches[s], o = !1;
70
+ this.query.charCodeAt(l) == e && (l == this.query.length - 1 ? i = { from: this.matches[s + 1], to: r } : (this.matches[s]++, o = !0)), o || (this.matches.splice(s, 2), s -= 2);
71
+ }
72
+ return this.query.charCodeAt(0) == e && (this.query.length == 1 ? i = { from: n, to: r } : this.matches.push(1, n)), i && this.test && !this.test(i.from, i.to, this.buffer, this.bufferStart) && (i = null), i;
73
+ }
74
+ }
75
+ typeof Symbol < "u" && (v.prototype[Symbol.iterator] = function() {
76
+ return this;
77
+ });
78
+ const se = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }, N = "gm" + (/x/.unicode == null ? "" : "u");
79
+ class le {
80
+ /**
81
+ Create a cursor that will search the given range in the given
82
+ document. `query` should be the raw pattern (as you'd pass it to
83
+ `new RegExp`).
84
+ */
85
+ constructor(e, n, r, i = 0, s = e.length) {
86
+ if (this.text = e, this.to = s, this.curLine = "", this.done = !1, this.value = se, /\\[sWDnr]|\n|\r|\[\^/.test(n))
87
+ return new oe(e, n, r, i, s);
88
+ this.re = new RegExp(n, N + (r?.ignoreCase ? "i" : "")), this.test = r?.test, this.iter = e.iter();
89
+ let l = e.lineAt(i);
90
+ this.curLineStart = l.from, this.matchPos = P(e, i), this.getLine(this.curLineStart);
91
+ }
92
+ getLine(e) {
93
+ this.iter.next(e), 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());
94
+ }
95
+ nextLine() {
96
+ this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0);
97
+ }
98
+ /**
99
+ Move to the next match, if there is one.
100
+ */
101
+ next() {
102
+ for (let e = this.matchPos - this.curLineStart; ; ) {
103
+ this.re.lastIndex = e;
104
+ let n = this.matchPos <= this.to && this.re.exec(this.curLine);
105
+ if (n) {
106
+ let r = this.curLineStart + n.index, i = r + n[0].length;
107
+ if (this.matchPos = P(this.text, i + (r == i ? 1 : 0)), r == this.curLineStart + this.curLine.length && this.nextLine(), (r < i || r > this.value.to) && (!this.test || this.test(r, i, n)))
108
+ return this.value = { from: r, to: i, match: n }, this;
109
+ e = this.matchPos - this.curLineStart;
110
+ } else if (this.curLineStart + this.curLine.length < this.to)
111
+ this.nextLine(), e = 0;
112
+ else
113
+ return this.done = !0, this;
114
+ }
115
+ }
116
+ }
117
+ const Q = /* @__PURE__ */ new WeakMap();
118
+ class b {
119
+ constructor(e, n) {
120
+ this.from = e, this.text = n;
121
+ }
122
+ get to() {
123
+ return this.from + this.text.length;
124
+ }
125
+ static get(e, n, r) {
126
+ let i = Q.get(e);
127
+ if (!i || i.from >= r || i.to <= n) {
128
+ let o = new b(n, e.sliceString(n, r));
129
+ return Q.set(e, o), o;
130
+ }
131
+ if (i.from == n && i.to == r)
132
+ return i;
133
+ let { text: s, from: l } = i;
134
+ return l > n && (s = e.sliceString(n, l) + s, l = n), i.to < r && (s += e.sliceString(i.to, r)), Q.set(e, new b(l, s)), new b(n, s.slice(n - l, r - l));
135
+ }
136
+ }
137
+ class oe {
138
+ constructor(e, n, r, i, s) {
139
+ this.text = e, this.to = s, this.done = !1, this.value = se, this.matchPos = P(e, i), this.re = new RegExp(n, N + (r?.ignoreCase ? "i" : "")), this.test = r?.test, this.flat = b.get(e, i, this.chunkEnd(
140
+ i + 5e3
141
+ /* Chunk.Base */
142
+ ));
143
+ }
144
+ chunkEnd(e) {
145
+ return e >= this.to ? this.to : this.text.lineAt(e).to;
146
+ }
147
+ next() {
148
+ for (; ; ) {
149
+ let e = this.re.lastIndex = this.matchPos - this.flat.from, n = this.re.exec(this.flat.text);
150
+ if (n && !n[0] && n.index == e && (this.re.lastIndex = e + 1, n = this.re.exec(this.flat.text)), n) {
151
+ let r = this.flat.from + n.index, i = r + n[0].length;
152
+ if ((this.flat.to >= this.to || n.index + n[0].length <= this.flat.text.length - 10) && (!this.test || this.test(r, i, n)))
153
+ return this.value = { from: r, to: i, match: n }, this.matchPos = P(this.text, i + (r == i ? 1 : 0)), this;
154
+ }
155
+ if (this.flat.to == this.to)
156
+ return this.done = !0, this;
157
+ this.flat = b.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
158
+ }
159
+ }
160
+ }
161
+ typeof Symbol < "u" && (le.prototype[Symbol.iterator] = oe.prototype[Symbol.iterator] = function() {
162
+ return this;
163
+ });
164
+ function be(t) {
165
+ try {
166
+ return new RegExp(t, N), !0;
167
+ } catch {
168
+ return !1;
169
+ }
170
+ }
171
+ function P(t, e) {
172
+ if (e >= t.length)
173
+ return e;
174
+ let n = t.lineAt(e), r;
175
+ for (; e < n.to && (r = n.text.charCodeAt(e - n.from)) >= 56320 && r < 57344; )
176
+ e++;
177
+ return e;
178
+ }
179
+ function _(t) {
180
+ let e = String(t.state.doc.lineAt(t.state.selection.main.head).number), n = h("input", { class: "cm-textfield", name: "line", value: e }), r = h("form", {
181
+ class: "cm-gotoLine",
182
+ onkeydown: (s) => {
183
+ s.keyCode == 27 ? (s.preventDefault(), t.dispatch({ effects: L.of(!1) }), t.focus()) : s.keyCode == 13 && (s.preventDefault(), i());
184
+ },
185
+ onsubmit: (s) => {
186
+ s.preventDefault(), i();
187
+ }
188
+ }, h("label", t.state.phrase("Go to line"), ": ", n), " ", h("button", { class: "cm-button", type: "submit" }, t.state.phrase("go")), h("button", {
189
+ name: "close",
190
+ onclick: () => {
191
+ t.dispatch({ effects: L.of(!1) }), t.focus();
192
+ },
193
+ "aria-label": t.state.phrase("close"),
194
+ type: "button"
195
+ }, ["×"]));
196
+ function i() {
197
+ let s = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);
198
+ if (!s)
199
+ return;
200
+ let { state: l } = t, o = l.doc.lineAt(l.selection.main.head), [, c, a, u, m] = s, E = u ? +u.slice(1) : 0, k = a ? +a : o.number;
201
+ if (a && m) {
202
+ let O = k / 100;
203
+ c && (O = O * (c == "-" ? -1 : 1) + o.number / l.doc.lines), k = Math.round(l.doc.lines * O);
204
+ } else a && c && (k = k * (c == "-" ? -1 : 1) + o.number);
205
+ let G = l.doc.line(Math.max(1, Math.min(l.doc.lines, k))), j = g.cursor(G.from + Math.max(0, Math.min(E, G.length)));
206
+ t.dispatch({
207
+ effects: [L.of(!1), x.scrollIntoView(j.from, { y: "center" })],
208
+ selection: j
209
+ }), t.focus();
210
+ }
211
+ return { dom: r };
212
+ }
213
+ const L = /* @__PURE__ */ A.define(), U = /* @__PURE__ */ te.define({
214
+ create() {
215
+ return !0;
216
+ },
217
+ update(t, e) {
218
+ for (let n of e.effects)
219
+ n.is(L) && (t = n.value);
220
+ return t;
221
+ },
222
+ provide: (t) => ee.from(t, (e) => e ? _ : null)
223
+ }), ve = (t) => {
224
+ let e = R(t, _);
225
+ if (!e) {
226
+ let n = [L.of(!0)];
227
+ t.state.field(U, !1) == null && n.push(A.appendConfig.of([U, Ce])), t.dispatch({ effects: n }), e = R(t, _);
228
+ }
229
+ return e && e.dom.querySelector("input").select(), !0;
230
+ }, Ce = /* @__PURE__ */ x.baseTheme({
231
+ ".cm-panel.cm-gotoLine": {
232
+ padding: "2px 6px 4px",
233
+ position: "relative",
234
+ "& label": { fontSize: "80%" },
235
+ "& [name=close]": {
236
+ position: "absolute",
237
+ top: "0",
238
+ bottom: "0",
239
+ right: "4px",
240
+ backgroundColor: "inherit",
241
+ border: "none",
242
+ font: "inherit",
243
+ padding: "0"
244
+ }
245
+ }
246
+ }), ke = {
247
+ highlightWordAroundCursor: !1,
248
+ minSelectionLength: 1,
249
+ maxMatches: 100,
250
+ wholeWords: !1
251
+ }, Le = /* @__PURE__ */ ne.define({
252
+ combine(t) {
253
+ return re(t, ke, {
254
+ highlightWordAroundCursor: (e, n) => e || n,
255
+ minSelectionLength: Math.min,
256
+ maxMatches: Math.min
257
+ });
258
+ }
259
+ });
260
+ function Ue(t) {
261
+ return [Fe, Ee];
262
+ }
263
+ const We = /* @__PURE__ */ d.mark({ class: "cm-selectionMatch" }), Ae = /* @__PURE__ */ d.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
264
+ function X(t, e, n, r) {
265
+ return (n == 0 || t(e.sliceDoc(n - 1, n)) != p.Word) && (r == e.doc.length || t(e.sliceDoc(r, r + 1)) != p.Word);
266
+ }
267
+ function De(t, e, n, r) {
268
+ return t(e.sliceDoc(n, n + 1)) == p.Word && t(e.sliceDoc(r - 1, r)) == p.Word;
269
+ }
270
+ const Ee = /* @__PURE__ */ Z.fromClass(class {
271
+ constructor(t) {
272
+ this.decorations = this.getDeco(t);
273
+ }
274
+ update(t) {
275
+ (t.selectionSet || t.docChanged || t.viewportChanged) && (this.decorations = this.getDeco(t.view));
276
+ }
277
+ getDeco(t) {
278
+ let e = t.state.facet(Le), { state: n } = t, r = n.selection;
279
+ if (r.ranges.length > 1)
280
+ return d.none;
281
+ let i = r.main, s, l = null;
282
+ if (i.empty) {
283
+ if (!e.highlightWordAroundCursor)
284
+ return d.none;
285
+ let c = n.wordAt(i.head);
286
+ if (!c)
287
+ return d.none;
288
+ l = n.charCategorizer(i.head), s = n.sliceDoc(c.from, c.to);
289
+ } else {
290
+ let c = i.to - i.from;
291
+ if (c < e.minSelectionLength || c > 200)
292
+ return d.none;
293
+ if (e.wholeWords) {
294
+ if (s = n.sliceDoc(i.from, i.to), l = n.charCategorizer(i.head), !(X(l, n, i.from, i.to) && De(l, n, i.from, i.to)))
295
+ return d.none;
296
+ } else if (s = n.sliceDoc(i.from, i.to), !s)
297
+ return d.none;
298
+ }
299
+ let o = [];
300
+ for (let c of t.visibleRanges) {
301
+ let a = new v(n.doc, s, c.from, c.to);
302
+ for (; !a.next().done; ) {
303
+ let { from: u, to: m } = a.value;
304
+ if ((!l || X(l, n, u, m)) && (i.empty && u <= i.from && m >= i.to ? o.push(Ae.range(u, m)) : (u >= i.to || m <= i.from) && o.push(We.range(u, m)), o.length > e.maxMatches))
305
+ return d.none;
306
+ }
307
+ }
308
+ return d.set(o);
309
+ }
310
+ }, {
311
+ decorations: (t) => t.decorations
312
+ }), Fe = /* @__PURE__ */ x.baseTheme({
313
+ ".cm-selectionMatch": { backgroundColor: "#99ff7780" },
314
+ ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
315
+ }), qe = ({ state: t, dispatch: e }) => {
316
+ let { selection: n } = t, r = g.create(n.ranges.map((i) => t.wordAt(i.head) || g.cursor(i.head)), n.mainIndex);
317
+ return r.eq(n) ? !1 : (e(t.update({ selection: r })), !0);
318
+ };
319
+ function Re(t, e) {
320
+ let { main: n, ranges: r } = t.selection, i = t.wordAt(n.head), s = i && i.from == n.from && i.to == n.to;
321
+ for (let l = !1, o = new v(t.doc, e, r[r.length - 1].to); ; )
322
+ if (o.next(), o.done) {
323
+ if (l)
324
+ return null;
325
+ o = new v(t.doc, e, 0, Math.max(0, r[r.length - 1].from - 1)), l = !0;
326
+ } else {
327
+ if (l && r.some((c) => c.from == o.value.from))
328
+ continue;
329
+ if (s) {
330
+ let c = t.wordAt(o.value.from);
331
+ if (!c || c.from != o.value.from || c.to != o.value.to)
332
+ continue;
333
+ }
334
+ return o.value;
335
+ }
336
+ }
337
+ const Pe = ({ state: t, dispatch: e }) => {
338
+ let { ranges: n } = t.selection;
339
+ if (n.some((s) => s.from === s.to))
340
+ return qe({ state: t, dispatch: e });
341
+ let r = t.sliceDoc(n[0].from, n[0].to);
342
+ if (t.selection.ranges.some((s) => t.sliceDoc(s.from, s.to) != r))
343
+ return !1;
344
+ let i = Re(t, r);
345
+ return i ? (e(t.update({
346
+ selection: t.selection.addRange(g.range(i.from, i.to), !1),
347
+ effects: x.scrollIntoView(i.to)
348
+ })), !0) : !1;
349
+ }, C = /* @__PURE__ */ ne.define({
350
+ combine(t) {
351
+ return re(t, {
352
+ top: !1,
353
+ caseSensitive: !1,
354
+ literal: !1,
355
+ regexp: !1,
356
+ wholeWord: !1,
357
+ createPanel: (e) => new Ve(e),
358
+ scrollToMatch: (e) => x.scrollIntoView(e)
359
+ });
360
+ }
361
+ });
362
+ class ce {
363
+ /**
364
+ Create a query object.
365
+ */
366
+ constructor(e) {
367
+ this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp || be(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord;
368
+ }
369
+ /**
370
+ @internal
371
+ */
372
+ unquote(e) {
373
+ return this.literal ? e : e.replace(/\\([nrt\\])/g, (n, r) => r == "n" ? `
374
+ ` : r == "r" ? "\r" : r == "t" ? " " : "\\");
375
+ }
376
+ /**
377
+ Compare this query to another query.
378
+ */
379
+ eq(e) {
380
+ return this.search == e.search && this.replace == e.replace && this.caseSensitive == e.caseSensitive && this.regexp == e.regexp && this.wholeWord == e.wholeWord;
381
+ }
382
+ /**
383
+ @internal
384
+ */
385
+ create() {
386
+ return this.regexp ? new we(this) : new Te(this);
387
+ }
388
+ /**
389
+ Get a search cursor for this query, searching through the given
390
+ range in the given state.
391
+ */
392
+ getCursor(e, n = 0, r) {
393
+ let i = e.doc ? e : ye.create({ doc: e });
394
+ return r == null && (r = i.doc.length), this.regexp ? M(this, i, n, r) : y(this, i, n, r);
395
+ }
396
+ }
397
+ class ae {
398
+ constructor(e) {
399
+ this.spec = e;
400
+ }
401
+ }
402
+ function y(t, e, n, r) {
403
+ return new v(e.doc, t.unquoted, n, r, t.caseSensitive ? void 0 : (i) => i.toLowerCase(), t.wholeWord ? Ie(e.doc, e.charCategorizer(e.selection.main.head)) : void 0);
404
+ }
405
+ function Ie(t, e) {
406
+ return (n, r, i, s) => ((s > n || s + i.length < r) && (s = Math.max(0, n - 2), i = t.sliceString(s, Math.min(t.length, r + 2))), (e(I(i, n - s)) != p.Word || e(T(i, n - s)) != p.Word) && (e(T(i, r - s)) != p.Word || e(I(i, r - s)) != p.Word));
407
+ }
408
+ class Te extends ae {
409
+ constructor(e) {
410
+ super(e);
411
+ }
412
+ nextMatch(e, n, r) {
413
+ let i = y(this.spec, e, r, e.doc.length).nextOverlapping();
414
+ if (i.done) {
415
+ let s = Math.min(e.doc.length, n + this.spec.unquoted.length);
416
+ i = y(this.spec, e, 0, s).nextOverlapping();
417
+ }
418
+ return i.done || i.value.from == n && i.value.to == r ? null : i.value;
419
+ }
420
+ // Searching in reverse is, rather than implementing an inverted search
421
+ // cursor, done by scanning chunk after chunk forward.
422
+ prevMatchInRange(e, n, r) {
423
+ for (let i = r; ; ) {
424
+ let s = Math.max(n, i - 1e4 - this.spec.unquoted.length), l = y(this.spec, e, s, i), o = null;
425
+ for (; !l.nextOverlapping().done; )
426
+ o = l.value;
427
+ if (o)
428
+ return o;
429
+ if (s == n)
430
+ return null;
431
+ i -= 1e4;
432
+ }
433
+ }
434
+ prevMatch(e, n, r) {
435
+ let i = this.prevMatchInRange(e, 0, n);
436
+ return i || (i = this.prevMatchInRange(e, Math.max(0, r - this.spec.unquoted.length), e.doc.length)), i && (i.from != n || i.to != r) ? i : null;
437
+ }
438
+ getReplacement(e) {
439
+ return this.spec.unquote(this.spec.replace);
440
+ }
441
+ matchAll(e, n) {
442
+ let r = y(this.spec, e, 0, e.doc.length), i = [];
443
+ for (; !r.next().done; ) {
444
+ if (i.length >= n)
445
+ return null;
446
+ i.push(r.value);
447
+ }
448
+ return i;
449
+ }
450
+ highlight(e, n, r, i) {
451
+ let s = y(this.spec, e, Math.max(0, n - this.spec.unquoted.length), Math.min(r + this.spec.unquoted.length, e.doc.length));
452
+ for (; !s.next().done; )
453
+ i(s.value.from, s.value.to);
454
+ }
455
+ }
456
+ function M(t, e, n, r) {
457
+ return new le(e.doc, t.search, {
458
+ ignoreCase: !t.caseSensitive,
459
+ test: t.wholeWord ? $e(e.charCategorizer(e.selection.main.head)) : void 0
460
+ }, n, r);
461
+ }
462
+ function I(t, e) {
463
+ return t.slice(ie(t, e, !1), e);
464
+ }
465
+ function T(t, e) {
466
+ return t.slice(e, ie(t, e));
467
+ }
468
+ function $e(t) {
469
+ return (e, n, r) => !r[0].length || (t(I(r.input, r.index)) != p.Word || t(T(r.input, r.index)) != p.Word) && (t(T(r.input, r.index + r[0].length)) != p.Word || t(I(r.input, r.index + r[0].length)) != p.Word);
470
+ }
471
+ class we extends ae {
472
+ nextMatch(e, n, r) {
473
+ let i = M(this.spec, e, r, e.doc.length).next();
474
+ return i.done && (i = M(this.spec, e, 0, n).next()), i.done ? null : i.value;
475
+ }
476
+ prevMatchInRange(e, n, r) {
477
+ for (let i = 1; ; i++) {
478
+ let s = Math.max(
479
+ n,
480
+ r - i * 1e4
481
+ /* FindPrev.ChunkSize */
482
+ ), l = M(this.spec, e, s, r), o = null;
483
+ for (; !l.next().done; )
484
+ o = l.value;
485
+ if (o && (s == n || o.from > s + 10))
486
+ return o;
487
+ if (s == n)
488
+ return null;
489
+ }
490
+ }
491
+ prevMatch(e, n, r) {
492
+ return this.prevMatchInRange(e, 0, n) || this.prevMatchInRange(e, r, e.doc.length);
493
+ }
494
+ getReplacement(e) {
495
+ return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (n, r) => {
496
+ if (r == "&")
497
+ return e.match[0];
498
+ if (r == "$")
499
+ return "$";
500
+ for (let i = r.length; i > 0; i--) {
501
+ let s = +r.slice(0, i);
502
+ if (s > 0 && s < e.match.length)
503
+ return e.match[s] + r.slice(i);
504
+ }
505
+ return n;
506
+ });
507
+ }
508
+ matchAll(e, n) {
509
+ let r = M(this.spec, e, 0, e.doc.length), i = [];
510
+ for (; !r.next().done; ) {
511
+ if (i.length >= n)
512
+ return null;
513
+ i.push(r.value);
514
+ }
515
+ return i;
516
+ }
517
+ highlight(e, n, r, i) {
518
+ let s = M(this.spec, e, Math.max(
519
+ 0,
520
+ n - 250
521
+ /* RegExp.HighlightMargin */
522
+ ), Math.min(r + 250, e.doc.length));
523
+ for (; !s.next().done; )
524
+ i(s.value.from, s.value.to);
525
+ }
526
+ }
527
+ const W = /* @__PURE__ */ A.define(), V = /* @__PURE__ */ A.define(), S = /* @__PURE__ */ te.define({
528
+ create(t) {
529
+ return new z(B(t).create(), null);
530
+ },
531
+ update(t, e) {
532
+ for (let n of e.effects)
533
+ n.is(W) ? t = new z(n.value.create(), t.panel) : n.is(V) && (t = new z(t.query, n.value ? H : null));
534
+ return t;
535
+ },
536
+ provide: (t) => ee.from(t, (e) => e.panel)
537
+ });
538
+ class z {
539
+ constructor(e, n) {
540
+ this.query = e, this.panel = n;
541
+ }
542
+ }
543
+ const Oe = /* @__PURE__ */ d.mark({ class: "cm-searchMatch" }), Qe = /* @__PURE__ */ d.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), ze = /* @__PURE__ */ Z.fromClass(class {
544
+ constructor(t) {
545
+ this.view = t, this.decorations = this.highlight(t.state.field(S));
546
+ }
547
+ update(t) {
548
+ let e = t.state.field(S);
549
+ (e != t.startState.field(S) || t.docChanged || t.selectionSet || t.viewportChanged) && (this.decorations = this.highlight(e));
550
+ }
551
+ highlight({ query: t, panel: e }) {
552
+ if (!e || !t.spec.valid)
553
+ return d.none;
554
+ let { view: n } = this, r = new Me();
555
+ for (let i = 0, s = n.visibleRanges, l = s.length; i < l; i++) {
556
+ let { from: o, to: c } = s[i];
557
+ for (; i < l - 1 && c > s[i + 1].from - 500; )
558
+ c = s[++i].to;
559
+ t.highlight(n.state, o, c, (a, u) => {
560
+ let m = n.state.selection.ranges.some((E) => E.from == a && E.to == u);
561
+ r.add(a, u, m ? Qe : Oe);
562
+ });
563
+ }
564
+ return r.finish();
565
+ }
566
+ }, {
567
+ decorations: (t) => t.decorations
568
+ });
569
+ function D(t) {
570
+ return (e) => {
571
+ let n = e.state.field(S, !1);
572
+ return n && n.query.spec.valid ? t(e, n) : fe(e);
573
+ };
574
+ }
575
+ const $ = /* @__PURE__ */ D((t, { query: e }) => {
576
+ let { to: n } = t.state.selection.main, r = e.nextMatch(t.state, n, n);
577
+ if (!r)
578
+ return !1;
579
+ let i = g.single(r.from, r.to), s = t.state.facet(C);
580
+ return t.dispatch({
581
+ selection: i,
582
+ effects: [K(t, r), s.scrollToMatch(i.main, t)],
583
+ userEvent: "select.search"
584
+ }), ue(t), !0;
585
+ }), w = /* @__PURE__ */ D((t, { query: e }) => {
586
+ let { state: n } = t, { from: r } = n.selection.main, i = e.prevMatch(n, r, r);
587
+ if (!i)
588
+ return !1;
589
+ let s = g.single(i.from, i.to), l = t.state.facet(C);
590
+ return t.dispatch({
591
+ selection: s,
592
+ effects: [K(t, i), l.scrollToMatch(s.main, t)],
593
+ userEvent: "select.search"
594
+ }), ue(t), !0;
595
+ }), _e = /* @__PURE__ */ D((t, { query: e }) => {
596
+ let n = e.matchAll(t.state, 1e3);
597
+ return !n || !n.length ? !1 : (t.dispatch({
598
+ selection: g.create(n.map((r) => g.range(r.from, r.to))),
599
+ userEvent: "select.search.matches"
600
+ }), !0);
601
+ }), Be = ({ state: t, dispatch: e }) => {
602
+ let n = t.selection;
603
+ if (n.ranges.length > 1 || n.main.empty)
604
+ return !1;
605
+ let { from: r, to: i } = n.main, s = [], l = 0;
606
+ for (let o = new v(t.doc, t.sliceDoc(r, i)); !o.next().done; ) {
607
+ if (s.length > 1e3)
608
+ return !1;
609
+ o.value.from == r && (l = s.length), s.push(g.range(o.value.from, o.value.to));
610
+ }
611
+ return e(t.update({
612
+ selection: g.create(s, l),
613
+ userEvent: "select.search.matches"
614
+ })), !0;
615
+ }, Y = /* @__PURE__ */ D((t, { query: e }) => {
616
+ let { state: n } = t, { from: r, to: i } = n.selection.main;
617
+ if (n.readOnly)
618
+ return !1;
619
+ let s = e.nextMatch(n, r, r);
620
+ if (!s)
621
+ return !1;
622
+ let l = s, o = [], c, a, u = [];
623
+ l.from == r && l.to == i && (a = n.toText(e.getReplacement(l)), o.push({ from: l.from, to: l.to, insert: a }), l = e.nextMatch(n, l.from, l.to), u.push(x.announce.of(n.phrase("replaced match on line $", n.doc.lineAt(r).number) + ".")));
624
+ let m = t.state.changes(o);
625
+ return l && (c = g.single(l.from, l.to).map(m), u.push(K(t, l)), u.push(n.facet(C).scrollToMatch(c.main, t))), t.dispatch({
626
+ changes: m,
627
+ selection: c,
628
+ effects: u,
629
+ userEvent: "input.replace"
630
+ }), !0;
631
+ }), Ne = /* @__PURE__ */ D((t, { query: e }) => {
632
+ if (t.state.readOnly)
633
+ return !1;
634
+ let n = e.matchAll(t.state, 1e9).map((i) => {
635
+ let { from: s, to: l } = i;
636
+ return { from: s, to: l, insert: e.getReplacement(i) };
637
+ });
638
+ if (!n.length)
639
+ return !1;
640
+ let r = t.state.phrase("replaced $ matches", n.length) + ".";
641
+ return t.dispatch({
642
+ changes: n,
643
+ effects: x.announce.of(r),
644
+ userEvent: "input.replace.all"
645
+ }), !0;
646
+ });
647
+ function H(t) {
648
+ return t.state.facet(C).createPanel(t);
649
+ }
650
+ function B(t, e) {
651
+ var n, r, i, s, l;
652
+ let o = t.selection.main, c = o.empty || o.to > o.from + 100 ? "" : t.sliceDoc(o.from, o.to);
653
+ if (e && !c)
654
+ return e;
655
+ let a = t.facet(C);
656
+ return new ce({
657
+ search: ((n = e?.literal) !== null && n !== void 0 ? n : a.literal) ? c : c.replace(/\n/g, "\\n"),
658
+ caseSensitive: (r = e?.caseSensitive) !== null && r !== void 0 ? r : a.caseSensitive,
659
+ literal: (i = e?.literal) !== null && i !== void 0 ? i : a.literal,
660
+ regexp: (s = e?.regexp) !== null && s !== void 0 ? s : a.regexp,
661
+ wholeWord: (l = e?.wholeWord) !== null && l !== void 0 ? l : a.wholeWord
662
+ });
663
+ }
664
+ function he(t) {
665
+ let e = R(t, H);
666
+ return e && e.dom.querySelector("[main-field]");
667
+ }
668
+ function ue(t) {
669
+ let e = he(t);
670
+ e && e == t.root.activeElement && e.select();
671
+ }
672
+ const fe = (t) => {
673
+ let e = t.state.field(S, !1);
674
+ if (e && e.panel) {
675
+ let n = he(t);
676
+ if (n && n != t.root.activeElement) {
677
+ let r = B(t.state, e.query.spec);
678
+ r.valid && t.dispatch({ effects: W.of(r) }), n.focus(), n.select();
679
+ }
680
+ } else
681
+ t.dispatch({ effects: [
682
+ V.of(!0),
683
+ e ? W.of(B(t.state, e.query.spec)) : A.appendConfig.of(Ke)
684
+ ] });
685
+ return !0;
686
+ }, de = (t) => {
687
+ let e = t.state.field(S, !1);
688
+ if (!e || !e.panel)
689
+ return !1;
690
+ let n = R(t, H);
691
+ return n && n.dom.contains(t.root.activeElement) && t.focus(), t.dispatch({ effects: V.of(!1) }), !0;
692
+ }, Xe = [
693
+ { key: "Mod-f", run: fe, scope: "editor search-panel" },
694
+ { key: "F3", run: $, shift: w, scope: "editor search-panel", preventDefault: !0 },
695
+ { key: "Mod-g", run: $, shift: w, scope: "editor search-panel", preventDefault: !0 },
696
+ { key: "Escape", run: de, scope: "editor search-panel" },
697
+ { key: "Mod-Shift-l", run: Be },
698
+ { key: "Mod-Alt-g", run: ve },
699
+ { key: "Mod-d", run: Pe, preventDefault: !0 }
700
+ ];
701
+ class Ve {
702
+ constructor(e) {
703
+ this.view = e;
704
+ let n = this.query = e.state.field(S).query.spec;
705
+ this.commit = this.commit.bind(this), this.searchField = h("input", {
706
+ value: n.search,
707
+ placeholder: f(e, "Find"),
708
+ "aria-label": f(e, "Find"),
709
+ class: "cm-textfield",
710
+ name: "search",
711
+ form: "",
712
+ "main-field": "true",
713
+ onchange: this.commit,
714
+ onkeyup: this.commit
715
+ }), this.replaceField = h("input", {
716
+ value: n.replace,
717
+ placeholder: f(e, "Replace"),
718
+ "aria-label": f(e, "Replace"),
719
+ class: "cm-textfield",
720
+ name: "replace",
721
+ form: "",
722
+ onchange: this.commit,
723
+ onkeyup: this.commit
724
+ }), this.caseField = h("input", {
725
+ type: "checkbox",
726
+ name: "case",
727
+ form: "",
728
+ checked: n.caseSensitive,
729
+ onchange: this.commit
730
+ }), this.reField = h("input", {
731
+ type: "checkbox",
732
+ name: "re",
733
+ form: "",
734
+ checked: n.regexp,
735
+ onchange: this.commit
736
+ }), this.wordField = h("input", {
737
+ type: "checkbox",
738
+ name: "word",
739
+ form: "",
740
+ checked: n.wholeWord,
741
+ onchange: this.commit
742
+ });
743
+ function r(i, s, l) {
744
+ return h("button", { class: "cm-button", name: i, onclick: s, type: "button" }, l);
745
+ }
746
+ this.dom = h("div", { onkeydown: (i) => this.keydown(i), class: "cm-search" }, [
747
+ this.searchField,
748
+ r("next", () => $(e), [f(e, "next")]),
749
+ r("prev", () => w(e), [f(e, "previous")]),
750
+ r("select", () => _e(e), [f(e, "all")]),
751
+ h("label", null, [this.caseField, f(e, "match case")]),
752
+ h("label", null, [this.reField, f(e, "regexp")]),
753
+ h("label", null, [this.wordField, f(e, "by word")]),
754
+ ...e.state.readOnly ? [] : [
755
+ h("br"),
756
+ this.replaceField,
757
+ r("replace", () => Y(e), [f(e, "replace")]),
758
+ r("replaceAll", () => Ne(e), [f(e, "replace all")])
759
+ ],
760
+ h("button", {
761
+ name: "close",
762
+ onclick: () => de(e),
763
+ "aria-label": f(e, "close"),
764
+ type: "button"
765
+ }, ["×"])
766
+ ]);
767
+ }
768
+ commit() {
769
+ let e = new ce({
770
+ search: this.searchField.value,
771
+ caseSensitive: this.caseField.checked,
772
+ regexp: this.reField.checked,
773
+ wholeWord: this.wordField.checked,
774
+ replace: this.replaceField.value
775
+ });
776
+ e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: W.of(e) }));
777
+ }
778
+ keydown(e) {
779
+ me(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? w : $)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), Y(this.view));
780
+ }
781
+ update(e) {
782
+ for (let n of e.transactions)
783
+ for (let r of n.effects)
784
+ r.is(W) && !r.value.eq(this.query) && this.setQuery(r.value);
785
+ }
786
+ setQuery(e) {
787
+ this.query = e, this.searchField.value = e.search, this.replaceField.value = e.replace, this.caseField.checked = e.caseSensitive, this.reField.checked = e.regexp, this.wordField.checked = e.wholeWord;
788
+ }
789
+ mount() {
790
+ this.searchField.select();
791
+ }
792
+ get pos() {
793
+ return 80;
794
+ }
795
+ get top() {
796
+ return this.view.state.facet(C).top;
797
+ }
798
+ }
799
+ function f(t, e) {
800
+ return t.state.phrase(e);
801
+ }
802
+ const F = 30, q = /[\s\.,:;?!]/;
803
+ function K(t, { from: e, to: n }) {
804
+ let r = t.state.doc.lineAt(e), i = t.state.doc.lineAt(n).to, s = Math.max(r.from, e - F), l = Math.min(i, n + F), o = t.state.sliceDoc(s, l);
805
+ if (s != r.from) {
806
+ for (let c = 0; c < F; c++)
807
+ if (!q.test(o[c + 1]) && q.test(o[c])) {
808
+ o = o.slice(c);
809
+ break;
810
+ }
811
+ }
812
+ if (l != i) {
813
+ for (let c = o.length - 1; c > o.length - F; c--)
814
+ if (!q.test(o[c - 1]) && q.test(o[c])) {
815
+ o = o.slice(0, c);
816
+ break;
817
+ }
818
+ }
819
+ return x.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${r.number}.`);
820
+ }
821
+ const He = /* @__PURE__ */ x.baseTheme({
822
+ ".cm-panel.cm-search": {
823
+ padding: "2px 6px 4px",
824
+ position: "relative",
825
+ "& [name=close]": {
826
+ position: "absolute",
827
+ top: "0",
828
+ right: "4px",
829
+ backgroundColor: "inherit",
830
+ border: "none",
831
+ font: "inherit",
832
+ padding: 0,
833
+ margin: 0
834
+ },
835
+ "& input, & button, & label": {
836
+ margin: ".2em .6em .2em 0"
837
+ },
838
+ "& input[type=checkbox]": {
839
+ marginRight: ".2em"
840
+ },
841
+ "& label": {
842
+ fontSize: "80%",
843
+ whiteSpace: "pre"
844
+ }
845
+ },
846
+ "&light .cm-searchMatch": { backgroundColor: "#ffff0054" },
847
+ "&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
848
+ "&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
849
+ "&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
850
+ }), Ke = [
851
+ S,
852
+ /* @__PURE__ */ pe.low(ze),
853
+ He
854
+ ];
855
+ export {
856
+ le as RegExpCursor,
857
+ v as SearchCursor,
858
+ ce as SearchQuery,
859
+ de as closeSearchPanel,
860
+ $ as findNext,
861
+ w as findPrevious,
862
+ ve as gotoLine,
863
+ Ue as highlightSelectionMatches,
864
+ fe as openSearchPanel,
865
+ Ne as replaceAll,
866
+ Y as replaceNext,
867
+ Xe as searchKeymap,
868
+ _e as selectMatches,
869
+ Pe as selectNextOccurrence,
870
+ Be as selectSelectionMatches,
871
+ W as setSearchQuery
872
+ };