@drjoshcsimmons/scl 0.1.0

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 (301) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/components/ui/accordion/accordion.d.ts +8 -0
  4. package/dist/components/ui/accordion/accordion.d.ts.map +1 -0
  5. package/dist/components/ui/accordion/index.d.ts +2 -0
  6. package/dist/components/ui/accordion/index.d.ts.map +1 -0
  7. package/dist/components/ui/alert/alert.d.ts +9 -0
  8. package/dist/components/ui/alert/alert.d.ts.map +1 -0
  9. package/dist/components/ui/alert/index.d.ts +2 -0
  10. package/dist/components/ui/alert/index.d.ts.map +1 -0
  11. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +21 -0
  12. package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -0
  13. package/dist/components/ui/alert-dialog/index.d.ts +2 -0
  14. package/dist/components/ui/alert-dialog/index.d.ts.map +1 -0
  15. package/dist/components/ui/avatar/avatar.d.ts +7 -0
  16. package/dist/components/ui/avatar/avatar.d.ts.map +1 -0
  17. package/dist/components/ui/avatar/index.d.ts +2 -0
  18. package/dist/components/ui/avatar/index.d.ts.map +1 -0
  19. package/dist/components/ui/badge/badge.d.ts +10 -0
  20. package/dist/components/ui/badge/badge.d.ts.map +1 -0
  21. package/dist/components/ui/badge/index.d.ts +2 -0
  22. package/dist/components/ui/badge/index.d.ts.map +1 -0
  23. package/dist/components/ui/button/button.d.ts +12 -0
  24. package/dist/components/ui/button/button.d.ts.map +1 -0
  25. package/dist/components/ui/button/index.d.ts +2 -0
  26. package/dist/components/ui/button/index.d.ts.map +1 -0
  27. package/dist/components/ui/card/card.d.ts +9 -0
  28. package/dist/components/ui/card/card.d.ts.map +1 -0
  29. package/dist/components/ui/card/index.d.ts +2 -0
  30. package/dist/components/ui/card/index.d.ts.map +1 -0
  31. package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
  32. package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -0
  33. package/dist/components/ui/checkbox/index.d.ts +2 -0
  34. package/dist/components/ui/checkbox/index.d.ts.map +1 -0
  35. package/dist/components/ui/collapsible/collapsible.d.ts +6 -0
  36. package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -0
  37. package/dist/components/ui/collapsible/index.d.ts +2 -0
  38. package/dist/components/ui/collapsible/index.d.ts.map +1 -0
  39. package/dist/components/ui/dialog/dialog.d.ts +20 -0
  40. package/dist/components/ui/dialog/dialog.d.ts.map +1 -0
  41. package/dist/components/ui/dialog/index.d.ts +2 -0
  42. package/dist/components/ui/dialog/index.d.ts.map +1 -0
  43. package/dist/components/ui/dithered-image/dithered-image.d.ts +17 -0
  44. package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -0
  45. package/dist/components/ui/dithered-image/index.d.ts +3 -0
  46. package/dist/components/ui/dithered-image/index.d.ts.map +1 -0
  47. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +28 -0
  48. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -0
  49. package/dist/components/ui/dropdown-menu/index.d.ts +2 -0
  50. package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
  51. package/dist/components/ui/input/index.d.ts +2 -0
  52. package/dist/components/ui/input/index.d.ts.map +1 -0
  53. package/dist/components/ui/input/input.d.ts +5 -0
  54. package/dist/components/ui/input/input.d.ts.map +1 -0
  55. package/dist/components/ui/label/index.d.ts +2 -0
  56. package/dist/components/ui/label/index.d.ts.map +1 -0
  57. package/dist/components/ui/label/label.d.ts +6 -0
  58. package/dist/components/ui/label/label.d.ts.map +1 -0
  59. package/dist/components/ui/popover/index.d.ts +2 -0
  60. package/dist/components/ui/popover/index.d.ts.map +1 -0
  61. package/dist/components/ui/popover/popover.d.ts +8 -0
  62. package/dist/components/ui/popover/popover.d.ts.map +1 -0
  63. package/dist/components/ui/progress/index.d.ts +2 -0
  64. package/dist/components/ui/progress/index.d.ts.map +1 -0
  65. package/dist/components/ui/progress/progress.d.ts +19 -0
  66. package/dist/components/ui/progress/progress.d.ts.map +1 -0
  67. package/dist/components/ui/radio-group/index.d.ts +2 -0
  68. package/dist/components/ui/radio-group/index.d.ts.map +1 -0
  69. package/dist/components/ui/radio-group/radio-group.d.ts +6 -0
  70. package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -0
  71. package/dist/components/ui/scroll-area/index.d.ts +2 -0
  72. package/dist/components/ui/scroll-area/index.d.ts.map +1 -0
  73. package/dist/components/ui/scroll-area/scroll-area.d.ts +6 -0
  74. package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -0
  75. package/dist/components/ui/select/index.d.ts +2 -0
  76. package/dist/components/ui/select/index.d.ts.map +1 -0
  77. package/dist/components/ui/select/select.d.ts +14 -0
  78. package/dist/components/ui/select/select.d.ts.map +1 -0
  79. package/dist/components/ui/separator/index.d.ts +2 -0
  80. package/dist/components/ui/separator/index.d.ts.map +1 -0
  81. package/dist/components/ui/separator/separator.d.ts +5 -0
  82. package/dist/components/ui/separator/separator.d.ts.map +1 -0
  83. package/dist/components/ui/sheet/index.d.ts +2 -0
  84. package/dist/components/ui/sheet/index.d.ts.map +1 -0
  85. package/dist/components/ui/sheet/sheet.d.ts +26 -0
  86. package/dist/components/ui/sheet/sheet.d.ts.map +1 -0
  87. package/dist/components/ui/skeleton/index.d.ts +2 -0
  88. package/dist/components/ui/skeleton/index.d.ts.map +1 -0
  89. package/dist/components/ui/skeleton/skeleton.d.ts +3 -0
  90. package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -0
  91. package/dist/components/ui/slider/index.d.ts +2 -0
  92. package/dist/components/ui/slider/index.d.ts.map +1 -0
  93. package/dist/components/ui/slider/slider.d.ts +5 -0
  94. package/dist/components/ui/slider/slider.d.ts.map +1 -0
  95. package/dist/components/ui/statusline/index.d.ts +2 -0
  96. package/dist/components/ui/statusline/index.d.ts.map +1 -0
  97. package/dist/components/ui/statusline/statusline.d.ts +40 -0
  98. package/dist/components/ui/statusline/statusline.d.ts.map +1 -0
  99. package/dist/components/ui/switch/index.d.ts +2 -0
  100. package/dist/components/ui/switch/index.d.ts.map +1 -0
  101. package/dist/components/ui/switch/switch.d.ts +5 -0
  102. package/dist/components/ui/switch/switch.d.ts.map +1 -0
  103. package/dist/components/ui/table/index.d.ts +2 -0
  104. package/dist/components/ui/table/index.d.ts.map +1 -0
  105. package/dist/components/ui/table/table.d.ts +11 -0
  106. package/dist/components/ui/table/table.d.ts.map +1 -0
  107. package/dist/components/ui/tabs/index.d.ts +2 -0
  108. package/dist/components/ui/tabs/index.d.ts.map +1 -0
  109. package/dist/components/ui/tabs/tabs.d.ts +8 -0
  110. package/dist/components/ui/tabs/tabs.d.ts.map +1 -0
  111. package/dist/components/ui/terminal-textarea/index.d.ts +2 -0
  112. package/dist/components/ui/terminal-textarea/index.d.ts.map +1 -0
  113. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +27 -0
  114. package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -0
  115. package/dist/components/ui/textarea/index.d.ts +2 -0
  116. package/dist/components/ui/textarea/index.d.ts.map +1 -0
  117. package/dist/components/ui/textarea/textarea.d.ts +5 -0
  118. package/dist/components/ui/textarea/textarea.d.ts.map +1 -0
  119. package/dist/components/ui/toggle/index.d.ts +2 -0
  120. package/dist/components/ui/toggle/index.d.ts.map +1 -0
  121. package/dist/components/ui/toggle/toggle.d.ts +13 -0
  122. package/dist/components/ui/toggle/toggle.d.ts.map +1 -0
  123. package/dist/components/ui/tooltip/index.d.ts +2 -0
  124. package/dist/components/ui/tooltip/index.d.ts.map +1 -0
  125. package/dist/components/ui/tooltip/tooltip.d.ts +11 -0
  126. package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -0
  127. package/dist/index.d.ts +34 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +165 -0
  130. package/dist/index10.js +61 -0
  131. package/dist/index100.js +32 -0
  132. package/dist/index101.js +17 -0
  133. package/dist/index102.js +137 -0
  134. package/dist/index103.js +52 -0
  135. package/dist/index104.js +11 -0
  136. package/dist/index105.js +6 -0
  137. package/dist/index106.js +183 -0
  138. package/dist/index107.js +652 -0
  139. package/dist/index108.js +109 -0
  140. package/dist/index109.js +93 -0
  141. package/dist/index11.js +27 -0
  142. package/dist/index110.js +69 -0
  143. package/dist/index111.js +161 -0
  144. package/dist/index112.js +399 -0
  145. package/dist/index113.js +1682 -0
  146. package/dist/index114.js +280 -0
  147. package/dist/index115.js +134 -0
  148. package/dist/index116.js +34 -0
  149. package/dist/index117.js +1613 -0
  150. package/dist/index118.js +300 -0
  151. package/dist/index119.js +637 -0
  152. package/dist/index12.js +7 -0
  153. package/dist/index120.js +146 -0
  154. package/dist/index121.js +23 -0
  155. package/dist/index122.js +11 -0
  156. package/dist/index123.js +40 -0
  157. package/dist/index124.js +20 -0
  158. package/dist/index125.js +8 -0
  159. package/dist/index126.js +14 -0
  160. package/dist/index127.js +208 -0
  161. package/dist/index128.js +24 -0
  162. package/dist/index129.js +402 -0
  163. package/dist/index13.js +100 -0
  164. package/dist/index130.js +1308 -0
  165. package/dist/index131.js +620 -0
  166. package/dist/index132.js +4 -0
  167. package/dist/index133.js +55 -0
  168. package/dist/index134.js +67 -0
  169. package/dist/index135.js +27 -0
  170. package/dist/index136.js +31 -0
  171. package/dist/index137.js +7 -0
  172. package/dist/index138.js +4 -0
  173. package/dist/index139.js +4 -0
  174. package/dist/index14.js +226 -0
  175. package/dist/index140.js +7 -0
  176. package/dist/index141.js +5 -0
  177. package/dist/index142.js +26 -0
  178. package/dist/index143.js +115 -0
  179. package/dist/index144.js +18 -0
  180. package/dist/index145.js +527 -0
  181. package/dist/index146.js +130 -0
  182. package/dist/index147.js +136 -0
  183. package/dist/index148.js +67 -0
  184. package/dist/index149.js +71 -0
  185. package/dist/index15.js +146 -0
  186. package/dist/index150.js +11 -0
  187. package/dist/index151.js +16 -0
  188. package/dist/index152.js +68 -0
  189. package/dist/index153.js +6 -0
  190. package/dist/index154.js +25 -0
  191. package/dist/index155.js +25 -0
  192. package/dist/index156.js +15 -0
  193. package/dist/index157.js +30 -0
  194. package/dist/index158.js +7 -0
  195. package/dist/index16.js +21 -0
  196. package/dist/index17.js +19 -0
  197. package/dist/index18.js +24 -0
  198. package/dist/index19.js +58 -0
  199. package/dist/index2.js +8 -0
  200. package/dist/index20.js +31 -0
  201. package/dist/index21.js +38 -0
  202. package/dist/index22.js +123 -0
  203. package/dist/index23.js +24 -0
  204. package/dist/index24.js +72 -0
  205. package/dist/index25.js +17 -0
  206. package/dist/index26.js +34 -0
  207. package/dist/index27.js +81 -0
  208. package/dist/index28.js +27 -0
  209. package/dist/index29.js +90 -0
  210. package/dist/index3.js +22 -0
  211. package/dist/index30.js +46 -0
  212. package/dist/index31.js +234 -0
  213. package/dist/index32.js +20 -0
  214. package/dist/index33.js +37 -0
  215. package/dist/index34.js +25 -0
  216. package/dist/index35.js +105 -0
  217. package/dist/index36.js +68 -0
  218. package/dist/index37.js +51 -0
  219. package/dist/index38.js +102 -0
  220. package/dist/index39.js +13 -0
  221. package/dist/index4.js +46 -0
  222. package/dist/index40.js +17 -0
  223. package/dist/index41.js +2265 -0
  224. package/dist/index42.js +35 -0
  225. package/dist/index43.js +20 -0
  226. package/dist/index44.js +239 -0
  227. package/dist/index45.js +13 -0
  228. package/dist/index46.js +75 -0
  229. package/dist/index47.js +251 -0
  230. package/dist/index48.js +11 -0
  231. package/dist/index49.js +338 -0
  232. package/dist/index5.js +51 -0
  233. package/dist/index50.js +62 -0
  234. package/dist/index51.js +243 -0
  235. package/dist/index52.js +862 -0
  236. package/dist/index53.js +11 -0
  237. package/dist/index54.js +120 -0
  238. package/dist/index55.js +227 -0
  239. package/dist/index56.js +13 -0
  240. package/dist/index57.js +13 -0
  241. package/dist/index58.js +238 -0
  242. package/dist/index59.js +262 -0
  243. package/dist/index6.js +51 -0
  244. package/dist/index60.js +14 -0
  245. package/dist/index61.js +24 -0
  246. package/dist/index62.js +532 -0
  247. package/dist/index63.js +6157 -0
  248. package/dist/index64.js +2635 -0
  249. package/dist/index65.js +300 -0
  250. package/dist/index66.js +674 -0
  251. package/dist/index67.js +832 -0
  252. package/dist/index68.js +27 -0
  253. package/dist/index69.js +330 -0
  254. package/dist/index7.js +42 -0
  255. package/dist/index70.js +4901 -0
  256. package/dist/index71.js +831 -0
  257. package/dist/index72.js +1260 -0
  258. package/dist/index73.js +536 -0
  259. package/dist/index74.js +127 -0
  260. package/dist/index75.js +163 -0
  261. package/dist/index76.js +33 -0
  262. package/dist/index77.js +437 -0
  263. package/dist/index78.js +132 -0
  264. package/dist/index79.js +83 -0
  265. package/dist/index8.js +31 -0
  266. package/dist/index80.js +70 -0
  267. package/dist/index81.js +48 -0
  268. package/dist/index82.js +29 -0
  269. package/dist/index83.js +9 -0
  270. package/dist/index84.js +54 -0
  271. package/dist/index85.js +36 -0
  272. package/dist/index86.js +13 -0
  273. package/dist/index87.js +10 -0
  274. package/dist/index88.js +32 -0
  275. package/dist/index89.js +57 -0
  276. package/dist/index9.js +54 -0
  277. package/dist/index90.js +13 -0
  278. package/dist/index91.js +6 -0
  279. package/dist/index92.js +15 -0
  280. package/dist/index93.js +8 -0
  281. package/dist/index94.js +27 -0
  282. package/dist/index95.js +71 -0
  283. package/dist/index96.js +127 -0
  284. package/dist/index97.js +221 -0
  285. package/dist/index98.js +16 -0
  286. package/dist/index99.js +56 -0
  287. package/dist/lib/utils.d.ts +14 -0
  288. package/dist/lib/utils.d.ts.map +1 -0
  289. package/dist/tokens/animations.d.ts +174 -0
  290. package/dist/tokens/animations.d.ts.map +1 -0
  291. package/dist/tokens/colors.d.ts +92 -0
  292. package/dist/tokens/colors.d.ts.map +1 -0
  293. package/dist/tokens/index.d.ts +403 -0
  294. package/dist/tokens/index.d.ts.map +1 -0
  295. package/dist/tokens/shadows.d.ts +15 -0
  296. package/dist/tokens/shadows.d.ts.map +1 -0
  297. package/dist/tokens/spacing.d.ts +55 -0
  298. package/dist/tokens/spacing.d.ts.map +1 -0
  299. package/dist/tokens/typography.d.ts +80 -0
  300. package/dist/tokens/typography.d.ts.map +1 -0
  301. package/package.json +128 -0
@@ -0,0 +1,1260 @@
1
+ import { NodeProp as p, Tree as x, IterMode as me, TreeFragment as P, Parser as ge, NodeType as V } from "./index113.js";
2
+ import { Facet as w, Prec as ke, EditorState as I, countColumn as we, RangeSetBuilder as ye, StateEffect as O, StateField as ee, combineConfig as ve } from "./index64.js";
3
+ import { EditorView as y, ViewPlugin as te, Decoration as g, logException as be, WidgetType as re, Direction as z } from "./index63.js";
4
+ import { tagHighlighter as xe, highlightTree as Te, tags as Se, styleTags as Ce } from "./index119.js";
5
+ import { StyleModule as q } from "./index108.js";
6
+ var N;
7
+ const T = /* @__PURE__ */ new p();
8
+ function Ae(n) {
9
+ return w.define({
10
+ combine: n ? (e) => e.concat(n) : void 0
11
+ });
12
+ }
13
+ const Pe = /* @__PURE__ */ new p();
14
+ class c {
15
+ /**
16
+ Construct a language object. If you need to invoke this
17
+ directly, first define a data facet with
18
+ [`defineLanguageFacet`](https://codemirror.net/6/docs/ref/#language.defineLanguageFacet), and then
19
+ configure your parser to [attach](https://codemirror.net/6/docs/ref/#language.languageDataProp) it
20
+ to the language's outer syntax node.
21
+ */
22
+ constructor(e, t, r = [], i = "") {
23
+ this.data = e, this.name = i, I.prototype.hasOwnProperty("tree") || Object.defineProperty(I.prototype, "tree", { get() {
24
+ return k(this);
25
+ } }), this.parser = t, this.extension = [
26
+ C.of(this),
27
+ I.languageData.of((s, o, a) => {
28
+ let l = J(s, o, a), u = l.type.prop(T);
29
+ if (!u)
30
+ return [];
31
+ let h = s.facet(u), f = l.type.prop(Pe);
32
+ if (f) {
33
+ let m = l.resolve(o - l.from, a);
34
+ for (let d of f)
35
+ if (d.test(m, s)) {
36
+ let v = s.facet(d.facet);
37
+ return d.type == "replace" ? v : v.concat(h);
38
+ }
39
+ }
40
+ return h;
41
+ })
42
+ ].concat(r);
43
+ }
44
+ /**
45
+ Query whether this language is active at the given position.
46
+ */
47
+ isActiveAt(e, t, r = -1) {
48
+ return J(e, t, r).type.prop(T) == this.data;
49
+ }
50
+ /**
51
+ Find the document regions that were parsed using this language.
52
+ The returned regions will _include_ any nested languages rooted
53
+ in this language, when those exist.
54
+ */
55
+ findRegions(e) {
56
+ let t = e.facet(C);
57
+ if ((t == null ? void 0 : t.data) == this.data)
58
+ return [{ from: 0, to: e.doc.length }];
59
+ if (!t || !t.allowsNesting)
60
+ return [];
61
+ let r = [], i = (s, o) => {
62
+ if (s.prop(T) == this.data) {
63
+ r.push({ from: o, to: o + s.length });
64
+ return;
65
+ }
66
+ let a = s.prop(p.mounted);
67
+ if (a) {
68
+ if (a.tree.prop(T) == this.data) {
69
+ if (a.overlay)
70
+ for (let l of a.overlay)
71
+ r.push({ from: l.from + o, to: l.to + o });
72
+ else
73
+ r.push({ from: o, to: o + s.length });
74
+ return;
75
+ } else if (a.overlay) {
76
+ let l = r.length;
77
+ if (i(a.tree, a.overlay[0].from + o), r.length > l)
78
+ return;
79
+ }
80
+ }
81
+ for (let l = 0; l < s.children.length; l++) {
82
+ let u = s.children[l];
83
+ u instanceof x && i(u, s.positions[l] + o);
84
+ }
85
+ };
86
+ return i(k(e), 0), r;
87
+ }
88
+ /**
89
+ Indicates whether this language allows nested languages. The
90
+ default implementation returns true.
91
+ */
92
+ get allowsNesting() {
93
+ return !0;
94
+ }
95
+ }
96
+ c.setState = /* @__PURE__ */ O.define();
97
+ function J(n, e, t) {
98
+ let r = n.facet(C), i = k(n).topNode;
99
+ if (!r || r.allowsNesting)
100
+ for (let s = i; s; s = s.enter(e, t, me.ExcludeBuffers))
101
+ s.type.isTop && (i = s);
102
+ return i;
103
+ }
104
+ class M extends c {
105
+ constructor(e, t, r) {
106
+ super(e, t, [], r), this.parser = t;
107
+ }
108
+ /**
109
+ Define a language from a parser.
110
+ */
111
+ static define(e) {
112
+ let t = Ae(e.languageData);
113
+ return new M(t, e.parser.configure({
114
+ props: [T.add((r) => r.isTop ? t : void 0)]
115
+ }), e.name);
116
+ }
117
+ /**
118
+ Create a new instance of this language with a reconfigured
119
+ version of its parser and optionally a new name.
120
+ */
121
+ configure(e, t) {
122
+ return new M(this.data, this.parser.configure(e), t || this.name);
123
+ }
124
+ get allowsNesting() {
125
+ return this.parser.hasWrappers();
126
+ }
127
+ }
128
+ function k(n) {
129
+ let e = n.field(c.state, !1);
130
+ return e ? e.tree : x.empty;
131
+ }
132
+ function mt(n, e, t = 50) {
133
+ var r;
134
+ let i = (r = n.field(c.state, !1)) === null || r === void 0 ? void 0 : r.context;
135
+ if (!i)
136
+ return null;
137
+ let s = i.viewport;
138
+ i.updateViewport({ from: 0, to: e });
139
+ let o = i.isDone(e) || i.work(t, e) ? i.tree : null;
140
+ return i.updateViewport(s), o;
141
+ }
142
+ class Ie {
143
+ /**
144
+ Create an input object for the given document.
145
+ */
146
+ constructor(e) {
147
+ this.doc = e, this.cursorPos = 0, this.string = "", this.cursor = e.iter();
148
+ }
149
+ get length() {
150
+ return this.doc.length;
151
+ }
152
+ syncTo(e) {
153
+ return this.string = this.cursor.next(e - this.cursorPos).value, this.cursorPos = e + this.string.length, this.cursorPos - this.string.length;
154
+ }
155
+ chunk(e) {
156
+ return this.syncTo(e), this.string;
157
+ }
158
+ get lineChunks() {
159
+ return !0;
160
+ }
161
+ read(e, t) {
162
+ let r = this.cursorPos - this.string.length;
163
+ return e < r || t >= this.cursorPos ? this.doc.sliceString(e, t) : this.string.slice(e - r, t - r);
164
+ }
165
+ }
166
+ let A = null;
167
+ class D {
168
+ constructor(e, t, r = [], i, s, o, a, l) {
169
+ this.parser = e, this.state = t, this.fragments = r, this.tree = i, this.treeLen = s, this.viewport = o, this.skipped = a, this.scheduleOn = l, this.parse = null, this.tempSkipped = [];
170
+ }
171
+ /**
172
+ @internal
173
+ */
174
+ static create(e, t, r) {
175
+ return new D(e, t, [], x.empty, 0, r, [], null);
176
+ }
177
+ startParse() {
178
+ return this.parser.startParse(new Ie(this.state.doc), this.fragments);
179
+ }
180
+ /**
181
+ @internal
182
+ */
183
+ work(e, t) {
184
+ return t != null && t >= this.state.doc.length && (t = void 0), this.tree != x.empty && this.isDone(t ?? this.state.doc.length) ? (this.takeTree(), !0) : this.withContext(() => {
185
+ var r;
186
+ if (typeof e == "number") {
187
+ let i = Date.now() + e;
188
+ e = () => Date.now() > i;
189
+ }
190
+ for (this.parse || (this.parse = this.startParse()), t != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > t) && t < this.state.doc.length && this.parse.stopAt(t); ; ) {
191
+ let i = this.parse.advance();
192
+ if (i)
193
+ if (this.fragments = this.withoutTempSkipped(P.addTree(i, this.fragments, this.parse.stoppedAt != null)), this.treeLen = (r = this.parse.stoppedAt) !== null && r !== void 0 ? r : this.state.doc.length, this.tree = i, this.parse = null, this.treeLen < (t ?? this.state.doc.length))
194
+ this.parse = this.startParse();
195
+ else
196
+ return !0;
197
+ if (e())
198
+ return !1;
199
+ }
200
+ });
201
+ }
202
+ /**
203
+ @internal
204
+ */
205
+ takeTree() {
206
+ let e, t;
207
+ this.parse && (e = this.parse.parsedPos) >= this.treeLen && ((this.parse.stoppedAt == null || this.parse.stoppedAt > e) && this.parse.stopAt(e), this.withContext(() => {
208
+ for (; !(t = this.parse.advance()); )
209
+ ;
210
+ }), this.treeLen = e, this.tree = t, this.fragments = this.withoutTempSkipped(P.addTree(this.tree, this.fragments, !0)), this.parse = null);
211
+ }
212
+ withContext(e) {
213
+ let t = A;
214
+ A = this;
215
+ try {
216
+ return e();
217
+ } finally {
218
+ A = t;
219
+ }
220
+ }
221
+ withoutTempSkipped(e) {
222
+ for (let t; t = this.tempSkipped.pop(); )
223
+ e = G(e, t.from, t.to);
224
+ return e;
225
+ }
226
+ /**
227
+ @internal
228
+ */
229
+ changes(e, t) {
230
+ let { fragments: r, tree: i, treeLen: s, viewport: o, skipped: a } = this;
231
+ if (this.takeTree(), !e.empty) {
232
+ let l = [];
233
+ if (e.iterChangedRanges((u, h, f, m) => l.push({ fromA: u, toA: h, fromB: f, toB: m })), r = P.applyChanges(r, l), i = x.empty, s = 0, o = { from: e.mapPos(o.from, -1), to: e.mapPos(o.to, 1) }, this.skipped.length) {
234
+ a = [];
235
+ for (let u of this.skipped) {
236
+ let h = e.mapPos(u.from, 1), f = e.mapPos(u.to, -1);
237
+ h < f && a.push({ from: h, to: f });
238
+ }
239
+ }
240
+ }
241
+ return new D(this.parser, t, r, i, s, o, a, this.scheduleOn);
242
+ }
243
+ /**
244
+ @internal
245
+ */
246
+ updateViewport(e) {
247
+ if (this.viewport.from == e.from && this.viewport.to == e.to)
248
+ return !1;
249
+ this.viewport = e;
250
+ let t = this.skipped.length;
251
+ for (let r = 0; r < this.skipped.length; r++) {
252
+ let { from: i, to: s } = this.skipped[r];
253
+ i < e.to && s > e.from && (this.fragments = G(this.fragments, i, s), this.skipped.splice(r--, 1));
254
+ }
255
+ return this.skipped.length >= t ? !1 : (this.reset(), !0);
256
+ }
257
+ /**
258
+ @internal
259
+ */
260
+ reset() {
261
+ this.parse && (this.takeTree(), this.parse = null);
262
+ }
263
+ /**
264
+ Notify the parse scheduler that the given region was skipped
265
+ because it wasn't in view, and the parse should be restarted
266
+ when it comes into view.
267
+ */
268
+ skipUntilInView(e, t) {
269
+ this.skipped.push({ from: e, to: t });
270
+ }
271
+ /**
272
+ Returns a parser intended to be used as placeholder when
273
+ asynchronously loading a nested parser. It'll skip its input and
274
+ mark it as not-really-parsed, so that the next update will parse
275
+ it again.
276
+
277
+ When `until` is given, a reparse will be scheduled when that
278
+ promise resolves.
279
+ */
280
+ static getSkippingParser(e) {
281
+ return new class extends ge {
282
+ createParse(t, r, i) {
283
+ let s = i[0].from, o = i[i.length - 1].to;
284
+ return {
285
+ parsedPos: s,
286
+ advance() {
287
+ let l = A;
288
+ if (l) {
289
+ for (let u of i)
290
+ l.tempSkipped.push(u);
291
+ e && (l.scheduleOn = l.scheduleOn ? Promise.all([l.scheduleOn, e]) : e);
292
+ }
293
+ return this.parsedPos = o, new x(V.none, [], [], o - s);
294
+ },
295
+ stoppedAt: null,
296
+ stopAt() {
297
+ }
298
+ };
299
+ }
300
+ }();
301
+ }
302
+ /**
303
+ @internal
304
+ */
305
+ isDone(e) {
306
+ e = Math.min(e, this.state.doc.length);
307
+ let t = this.fragments;
308
+ return this.treeLen >= e && t.length && t[0].from == 0 && t[0].to >= e;
309
+ }
310
+ /**
311
+ Get the context for the current parse, or `null` if no editor
312
+ parse is in progress.
313
+ */
314
+ static get() {
315
+ return A;
316
+ }
317
+ }
318
+ function G(n, e, t) {
319
+ return P.applyChanges(n, [{ fromA: e, toA: t, fromB: e, toB: t }]);
320
+ }
321
+ class S {
322
+ constructor(e) {
323
+ this.context = e, this.tree = e.tree;
324
+ }
325
+ apply(e) {
326
+ if (!e.docChanged && this.tree == this.context.tree)
327
+ return this;
328
+ let t = this.context.changes(e.changes, e.state), r = this.context.treeLen == e.startState.doc.length ? void 0 : Math.max(e.changes.mapPos(this.context.treeLen), t.viewport.to);
329
+ return t.work(20, r) || t.takeTree(), new S(t);
330
+ }
331
+ static init(e) {
332
+ let t = Math.min(3e3, e.doc.length), r = D.create(e.facet(C).parser, e, { from: 0, to: t });
333
+ return r.work(20, t) || r.takeTree(), new S(r);
334
+ }
335
+ }
336
+ c.state = /* @__PURE__ */ ee.define({
337
+ create: S.init,
338
+ update(n, e) {
339
+ for (let t of e.effects)
340
+ if (t.is(c.setState))
341
+ return t.value;
342
+ return e.startState.facet(C) != e.state.facet(C) ? S.init(e.state) : n.apply(e);
343
+ }
344
+ });
345
+ let ne = (n) => {
346
+ let e = setTimeout(
347
+ () => n(),
348
+ 500
349
+ /* Work.MaxPause */
350
+ );
351
+ return () => clearTimeout(e);
352
+ };
353
+ typeof requestIdleCallback < "u" && (ne = (n) => {
354
+ let e = -1, t = setTimeout(
355
+ () => {
356
+ e = requestIdleCallback(n, {
357
+ timeout: 400
358
+ /* Work.MinPause */
359
+ });
360
+ },
361
+ 100
362
+ /* Work.MinPause */
363
+ );
364
+ return () => e < 0 ? clearTimeout(t) : cancelIdleCallback(e);
365
+ });
366
+ const F = typeof navigator < "u" && (!((N = navigator.scheduling) === null || N === void 0) && N.isInputPending) ? () => navigator.scheduling.isInputPending() : null, De = /* @__PURE__ */ te.fromClass(class {
367
+ constructor(e) {
368
+ this.view = e, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork();
369
+ }
370
+ update(e) {
371
+ let t = this.view.state.field(c.state).context;
372
+ (t.updateViewport(e.view.viewport) || this.view.viewport.to > t.treeLen) && this.scheduleWork(), (e.docChanged || e.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(t);
373
+ }
374
+ scheduleWork() {
375
+ if (this.working)
376
+ return;
377
+ let { state: e } = this.view, t = e.field(c.state);
378
+ (t.tree != t.context.tree || !t.context.isDone(e.doc.length)) && (this.working = ne(this.work));
379
+ }
380
+ work(e) {
381
+ this.working = null;
382
+ let t = Date.now();
383
+ if (this.chunkEnd < t && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = t + 3e4, this.chunkBudget = 3e3), this.chunkBudget <= 0)
384
+ return;
385
+ let { state: r, viewport: { to: i } } = this.view, s = r.field(c.state);
386
+ if (s.tree == s.context.tree && s.context.isDone(
387
+ i + 1e5
388
+ /* Work.MaxParseAhead */
389
+ ))
390
+ return;
391
+ let o = Date.now() + Math.min(this.chunkBudget, 100, e && !F ? Math.max(25, e.timeRemaining() - 5) : 1e9), a = s.context.treeLen < i && r.doc.length > i + 1e3, l = s.context.work(() => F && F() || Date.now() > o, i + (a ? 0 : 1e5));
392
+ this.chunkBudget -= Date.now() - t, (l || this.chunkBudget <= 0) && (s.context.takeTree(), this.view.dispatch({ effects: c.setState.of(new S(s.context)) })), this.chunkBudget > 0 && !(l && !a) && this.scheduleWork(), this.checkAsyncSchedule(s.context);
393
+ }
394
+ checkAsyncSchedule(e) {
395
+ e.scheduleOn && (this.workScheduled++, e.scheduleOn.then(() => this.scheduleWork()).catch((t) => be(this.view.state, t)).then(() => this.workScheduled--), e.scheduleOn = null);
396
+ }
397
+ destroy() {
398
+ this.working && this.working();
399
+ }
400
+ isWorking() {
401
+ return !!(this.working || this.workScheduled > 0);
402
+ }
403
+ }, {
404
+ eventHandlers: { focus() {
405
+ this.scheduleWork();
406
+ } }
407
+ }), C = /* @__PURE__ */ w.define({
408
+ combine(n) {
409
+ return n.length ? n[0] : null;
410
+ },
411
+ enables: (n) => [
412
+ c.state,
413
+ De,
414
+ y.contentAttributes.compute([n], (e) => {
415
+ let t = e.facet(n);
416
+ return t && t.name ? { "data-language": t.name } : {};
417
+ })
418
+ ]
419
+ });
420
+ class kt {
421
+ /**
422
+ Create a language support object.
423
+ */
424
+ constructor(e, t = []) {
425
+ this.language = e, this.support = t, this.extension = [e, t];
426
+ }
427
+ }
428
+ class ie {
429
+ constructor(e, t, r, i, s, o = void 0) {
430
+ this.name = e, this.alias = t, this.extensions = r, this.filename = i, this.loadFunc = s, this.support = o, this.loading = null;
431
+ }
432
+ /**
433
+ Start loading the the language. Will return a promise that
434
+ resolves to a [`LanguageSupport`](https://codemirror.net/6/docs/ref/#language.LanguageSupport)
435
+ object when the language successfully loads.
436
+ */
437
+ load() {
438
+ return this.loading || (this.loading = this.loadFunc().then((e) => this.support = e, (e) => {
439
+ throw this.loading = null, e;
440
+ }));
441
+ }
442
+ /**
443
+ Create a language description.
444
+ */
445
+ static of(e) {
446
+ let { load: t, support: r } = e;
447
+ if (!t) {
448
+ if (!r)
449
+ throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");
450
+ t = () => Promise.resolve(r);
451
+ }
452
+ return new ie(e.name, (e.alias || []).concat(e.name).map((i) => i.toLowerCase()), e.extensions || [], e.filename, t, r);
453
+ }
454
+ /**
455
+ Look for a language in the given array of descriptions that
456
+ matches the filename. Will first match
457
+ [`filename`](https://codemirror.net/6/docs/ref/#language.LanguageDescription.filename) patterns,
458
+ and then [extensions](https://codemirror.net/6/docs/ref/#language.LanguageDescription.extensions),
459
+ and return the first language that matches.
460
+ */
461
+ static matchFilename(e, t) {
462
+ for (let i of e)
463
+ if (i.filename && i.filename.test(t))
464
+ return i;
465
+ let r = /\.([^.]+)$/.exec(t);
466
+ if (r) {
467
+ for (let i of e)
468
+ if (i.extensions.indexOf(r[1]) > -1)
469
+ return i;
470
+ }
471
+ return null;
472
+ }
473
+ /**
474
+ Look for a language whose name or alias matches the the given
475
+ name (case-insensitively). If `fuzzy` is true, and no direct
476
+ matchs is found, this'll also search for a language whose name
477
+ or alias occurs in the string (for names shorter than three
478
+ characters, only when surrounded by non-word characters).
479
+ */
480
+ static matchLanguageName(e, t, r = !0) {
481
+ t = t.toLowerCase();
482
+ for (let i of e)
483
+ if (i.alias.some((s) => s == t))
484
+ return i;
485
+ if (r)
486
+ for (let i of e)
487
+ for (let s of i.alias) {
488
+ let o = t.indexOf(s);
489
+ if (o > -1 && (s.length > 2 || !/\w/.test(t[o - 1]) && !/\w/.test(t[o + s.length])))
490
+ return i;
491
+ }
492
+ return null;
493
+ }
494
+ }
495
+ const Oe = /* @__PURE__ */ w.define(), se = /* @__PURE__ */ w.define({
496
+ combine: (n) => {
497
+ if (!n.length)
498
+ return " ";
499
+ let e = n[0];
500
+ if (!e || /\S/.test(e) || Array.from(e).some((t) => t != e[0]))
501
+ throw new Error("Invalid indent unit: " + JSON.stringify(n[0]));
502
+ return e;
503
+ }
504
+ });
505
+ function Be(n) {
506
+ let e = n.facet(se);
507
+ return e.charCodeAt(0) == 9 ? n.tabSize * e.length : e.length;
508
+ }
509
+ function wt(n, e) {
510
+ let t = "", r = n.tabSize, i = n.facet(se)[0];
511
+ if (i == " ") {
512
+ for (; e >= r; )
513
+ t += " ", e -= r;
514
+ i = " ";
515
+ }
516
+ for (let s = 0; s < e; s++)
517
+ t += i;
518
+ return t;
519
+ }
520
+ function yt(n, e) {
521
+ n instanceof I && (n = new oe(n));
522
+ for (let r of n.state.facet(Oe)) {
523
+ let i = r(n, e);
524
+ if (i !== void 0)
525
+ return i;
526
+ }
527
+ let t = k(n.state);
528
+ return t.length >= e ? Fe(n, t, e) : null;
529
+ }
530
+ class oe {
531
+ /**
532
+ Create an indent context.
533
+ */
534
+ constructor(e, t = {}) {
535
+ this.state = e, this.options = t, this.unit = Be(e);
536
+ }
537
+ /**
538
+ Get a description of the line at the given position, taking
539
+ [simulated line
540
+ breaks](https://codemirror.net/6/docs/ref/#language.IndentContext.constructor^options.simulateBreak)
541
+ into account. If there is such a break at `pos`, the `bias`
542
+ argument determines whether the part of the line line before or
543
+ after the break is used.
544
+ */
545
+ lineAt(e, t = 1) {
546
+ let r = this.state.doc.lineAt(e), { simulateBreak: i, simulateDoubleBreak: s } = this.options;
547
+ return i != null && i >= r.from && i <= r.to ? s && i == e ? { text: "", from: e } : (t < 0 ? i < e : i <= e) ? { text: r.text.slice(i - r.from), from: i } : { text: r.text.slice(0, i - r.from), from: r.from } : r;
548
+ }
549
+ /**
550
+ Get the text directly after `pos`, either the entire line
551
+ or the next 100 characters, whichever is shorter.
552
+ */
553
+ textAfterPos(e, t = 1) {
554
+ if (this.options.simulateDoubleBreak && e == this.options.simulateBreak)
555
+ return "";
556
+ let { text: r, from: i } = this.lineAt(e, t);
557
+ return r.slice(e - i, Math.min(r.length, e + 100 - i));
558
+ }
559
+ /**
560
+ Find the column for the given position.
561
+ */
562
+ column(e, t = 1) {
563
+ let { text: r, from: i } = this.lineAt(e, t), s = this.countColumn(r, e - i), o = this.options.overrideIndentation ? this.options.overrideIndentation(i) : -1;
564
+ return o > -1 && (s += o - this.countColumn(r, r.search(/\S|$/))), s;
565
+ }
566
+ /**
567
+ Find the column position (taking tabs into account) of the given
568
+ position in the given string.
569
+ */
570
+ countColumn(e, t = e.length) {
571
+ return we(e, this.state.tabSize, t);
572
+ }
573
+ /**
574
+ Find the indentation column of the line at the given point.
575
+ */
576
+ lineIndent(e, t = 1) {
577
+ let { text: r, from: i } = this.lineAt(e, t), s = this.options.overrideIndentation;
578
+ if (s) {
579
+ let o = s(i);
580
+ if (o > -1)
581
+ return o;
582
+ }
583
+ return this.countColumn(r, r.search(/\S|$/));
584
+ }
585
+ /**
586
+ Returns the [simulated line
587
+ break](https://codemirror.net/6/docs/ref/#language.IndentContext.constructor^options.simulateBreak)
588
+ for this context, if any.
589
+ */
590
+ get simulatedBreak() {
591
+ return this.options.simulateBreak || null;
592
+ }
593
+ }
594
+ const Ne = /* @__PURE__ */ new p();
595
+ function Fe(n, e, t) {
596
+ let r = e.resolveStack(t), i = e.resolveInner(t, -1).resolve(t, 0).enterUnfinishedNodesBefore(t);
597
+ if (i != r.node) {
598
+ let s = [];
599
+ for (let o = i; o && !(o.from < r.node.from || o.to > r.node.to || o.from == r.node.from && o.type == r.node.type); o = o.parent)
600
+ s.push(o);
601
+ for (let o = s.length - 1; o >= 0; o--)
602
+ r = { node: s[o], next: r };
603
+ }
604
+ return le(r, n, t);
605
+ }
606
+ function le(n, e, t) {
607
+ for (let r = n; r; r = r.next) {
608
+ let i = Le(r.node);
609
+ if (i)
610
+ return i($.create(e, t, r));
611
+ }
612
+ return 0;
613
+ }
614
+ function Ee(n) {
615
+ return n.pos == n.options.simulateBreak && n.options.simulateDoubleBreak;
616
+ }
617
+ function Le(n) {
618
+ let e = n.type.prop(Ne);
619
+ if (e)
620
+ return e;
621
+ let t = n.firstChild, r;
622
+ if (t && (r = t.type.prop(p.closedBy))) {
623
+ let i = n.lastChild, s = i && r.indexOf(i.name) > -1;
624
+ return (o) => ae(o, !0, 1, void 0, s && !Ee(o) ? i.from : void 0);
625
+ }
626
+ return n.parent == null ? Me : null;
627
+ }
628
+ function Me() {
629
+ return 0;
630
+ }
631
+ class $ extends oe {
632
+ constructor(e, t, r) {
633
+ super(e.state, e.options), this.base = e, this.pos = t, this.context = r;
634
+ }
635
+ /**
636
+ The syntax tree node to which the indentation strategy
637
+ applies.
638
+ */
639
+ get node() {
640
+ return this.context.node;
641
+ }
642
+ /**
643
+ @internal
644
+ */
645
+ static create(e, t, r) {
646
+ return new $(e, t, r);
647
+ }
648
+ /**
649
+ Get the text directly after `this.pos`, either the entire line
650
+ or the next 100 characters, whichever is shorter.
651
+ */
652
+ get textAfter() {
653
+ return this.textAfterPos(this.pos);
654
+ }
655
+ /**
656
+ Get the indentation at the reference line for `this.node`, which
657
+ is the line on which it starts, unless there is a node that is
658
+ _not_ a parent of this node covering the start of that line. If
659
+ so, the line at the start of that node is tried, again skipping
660
+ on if it is covered by another such node.
661
+ */
662
+ get baseIndent() {
663
+ return this.baseIndentFor(this.node);
664
+ }
665
+ /**
666
+ Get the indentation for the reference line of the given node
667
+ (see [`baseIndent`](https://codemirror.net/6/docs/ref/#language.TreeIndentContext.baseIndent)).
668
+ */
669
+ baseIndentFor(e) {
670
+ let t = this.state.doc.lineAt(e.from);
671
+ for (; ; ) {
672
+ let r = e.resolve(t.from);
673
+ for (; r.parent && r.parent.from == r.from; )
674
+ r = r.parent;
675
+ if (We(r, e))
676
+ break;
677
+ t = this.state.doc.lineAt(r.from);
678
+ }
679
+ return this.lineIndent(t.from);
680
+ }
681
+ /**
682
+ Continue looking for indentations in the node's parent nodes,
683
+ and return the result of that.
684
+ */
685
+ continue() {
686
+ return le(this.context.next, this.base, this.pos);
687
+ }
688
+ }
689
+ function We(n, e) {
690
+ for (let t = e; t; t = t.parent)
691
+ if (n == t)
692
+ return !0;
693
+ return !1;
694
+ }
695
+ function Re(n) {
696
+ let e = n.node, t = e.childAfter(e.from), r = e.lastChild;
697
+ if (!t)
698
+ return null;
699
+ let i = n.options.simulateBreak, s = n.state.doc.lineAt(t.from), o = i == null || i <= s.from ? s.to : Math.min(s.to, i);
700
+ for (let a = t.to; ; ) {
701
+ let l = e.childAfter(a);
702
+ if (!l || l == r)
703
+ return null;
704
+ if (!l.type.isSkipped) {
705
+ if (l.from >= o)
706
+ return null;
707
+ let u = /^ */.exec(s.text.slice(t.to - s.from))[0].length;
708
+ return { from: t.from, to: t.to + u };
709
+ }
710
+ a = l.to;
711
+ }
712
+ }
713
+ function vt({ closing: n, align: e = !0, units: t = 1 }) {
714
+ return (r) => ae(r, e, t, n);
715
+ }
716
+ function ae(n, e, t, r, i) {
717
+ let s = n.textAfter, o = s.match(/^\s*/)[0].length, a = r && s.slice(o, o + r.length) == r || i == n.pos + o, l = e ? Re(n) : null;
718
+ return l ? a ? n.column(l.from) : n.column(l.to) : n.baseIndent + (a ? 0 : n.unit * t);
719
+ }
720
+ const bt = (n) => n.baseIndent;
721
+ function xt({ except: n, units: e = 1 } = {}) {
722
+ return (t) => {
723
+ let r = n && n.test(t.textAfter);
724
+ return t.baseIndent + (r ? 0 : e * t.unit);
725
+ };
726
+ }
727
+ const He = /* @__PURE__ */ w.define(), Ve = /* @__PURE__ */ new p();
728
+ function Tt(n) {
729
+ let e = n.firstChild, t = n.lastChild;
730
+ return e && e.to < t.from ? { from: e.to, to: t.type.isError ? n.to : t.from } : null;
731
+ }
732
+ function $e(n, e, t) {
733
+ let r = k(n);
734
+ if (r.length < t)
735
+ return null;
736
+ let i = r.resolveStack(t, 1), s = null;
737
+ for (let o = i; o; o = o.next) {
738
+ let a = o.node;
739
+ if (a.to <= t || a.from > t)
740
+ continue;
741
+ if (s && a.from < e)
742
+ break;
743
+ let l = a.type.prop(Ve);
744
+ if (l && (a.to < r.length - 50 || r.length == n.doc.length || !Ue(a))) {
745
+ let u = l(a, n);
746
+ u && u.from <= t && u.from >= e && u.to > t && (s = u);
747
+ }
748
+ }
749
+ return s;
750
+ }
751
+ function Ue(n) {
752
+ let e = n.lastChild;
753
+ return e && e.to == n.to && e.type.isError;
754
+ }
755
+ function je(n, e, t) {
756
+ for (let r of n.facet(He)) {
757
+ let i = r(n, e, t);
758
+ if (i)
759
+ return i;
760
+ }
761
+ return $e(n, e, t);
762
+ }
763
+ function ue(n, e) {
764
+ let t = e.mapPos(n.from, 1), r = e.mapPos(n.to, -1);
765
+ return t >= r ? void 0 : { from: t, to: r };
766
+ }
767
+ const he = /* @__PURE__ */ O.define({ map: ue }), fe = /* @__PURE__ */ O.define({ map: ue });
768
+ function ze(n) {
769
+ let e = [];
770
+ for (let { head: t } of n.state.selection.ranges)
771
+ e.some((r) => r.from <= t && r.to >= t) || e.push(n.lineBlockAt(t));
772
+ return e;
773
+ }
774
+ const U = /* @__PURE__ */ ee.define({
775
+ create() {
776
+ return g.none;
777
+ },
778
+ update(n, e) {
779
+ e.isUserEvent("delete") && e.changes.iterChangedRanges((t, r) => n = K(n, t, r)), n = n.map(e.changes);
780
+ for (let t of e.effects)
781
+ if (t.is(he) && !Je(n, t.value.from, t.value.to)) {
782
+ let { preparePlaceholder: r } = e.state.facet(ce), i = r ? g.replace({ widget: new Ye(r(e.state, t.value)) }) : Q;
783
+ n = n.update({ add: [i.range(t.value.from, t.value.to)] });
784
+ } else t.is(fe) && (n = n.update({
785
+ filter: (r, i) => t.value.from != r || t.value.to != i,
786
+ filterFrom: t.value.from,
787
+ filterTo: t.value.to
788
+ }));
789
+ return e.selection && (n = K(n, e.selection.main.head)), n;
790
+ },
791
+ provide: (n) => y.decorations.from(n),
792
+ toJSON(n, e) {
793
+ let t = [];
794
+ return n.between(0, e.doc.length, (r, i) => {
795
+ t.push(r, i);
796
+ }), t;
797
+ },
798
+ fromJSON(n) {
799
+ if (!Array.isArray(n) || n.length % 2)
800
+ throw new RangeError("Invalid JSON for fold state");
801
+ let e = [];
802
+ for (let t = 0; t < n.length; ) {
803
+ let r = n[t++], i = n[t++];
804
+ if (typeof r != "number" || typeof i != "number")
805
+ throw new RangeError("Invalid JSON for fold state");
806
+ e.push(Q.range(r, i));
807
+ }
808
+ return g.set(e, !0);
809
+ }
810
+ });
811
+ function K(n, e, t = e) {
812
+ let r = !1;
813
+ return n.between(e, t, (i, s) => {
814
+ i < t && s > e && (r = !0);
815
+ }), r ? n.update({
816
+ filterFrom: e,
817
+ filterTo: t,
818
+ filter: (i, s) => i >= t || s <= e
819
+ }) : n;
820
+ }
821
+ function qe(n, e, t) {
822
+ var r;
823
+ let i = null;
824
+ return (r = n.field(U, !1)) === null || r === void 0 || r.between(e, t, (s, o) => {
825
+ (!i || i.from > s) && (i = { from: s, to: o });
826
+ }), i;
827
+ }
828
+ function Je(n, e, t) {
829
+ let r = !1;
830
+ return n.between(e, e, (i, s) => {
831
+ i == e && s == t && (r = !0);
832
+ }), r;
833
+ }
834
+ function Ge(n, e) {
835
+ return n.field(U, !1) ? e : e.concat(O.appendConfig.of(Xe()));
836
+ }
837
+ const St = (n) => {
838
+ for (let e of ze(n)) {
839
+ let t = je(n.state, e.from, e.to);
840
+ if (t)
841
+ return n.dispatch({ effects: Ge(n.state, [he.of(t), Ke(n, t)]) }), !0;
842
+ }
843
+ return !1;
844
+ };
845
+ function Ke(n, e, t = !0) {
846
+ let r = n.state.doc.lineAt(e.from).number, i = n.state.doc.lineAt(e.to).number;
847
+ return y.announce.of(`${n.state.phrase(t ? "Folded lines" : "Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`);
848
+ }
849
+ const Qe = {
850
+ placeholderDOM: null,
851
+ preparePlaceholder: null,
852
+ placeholderText: "…"
853
+ }, ce = /* @__PURE__ */ w.define({
854
+ combine(n) {
855
+ return ve(n, Qe);
856
+ }
857
+ });
858
+ function Xe(n) {
859
+ return [U, Ze];
860
+ }
861
+ function de(n, e) {
862
+ let { state: t } = n, r = t.facet(ce), i = (o) => {
863
+ let a = n.lineBlockAt(n.posAtDOM(o.target)), l = qe(n.state, a.from, a.to);
864
+ l && n.dispatch({ effects: fe.of(l) }), o.preventDefault();
865
+ };
866
+ if (r.placeholderDOM)
867
+ return r.placeholderDOM(n, i, e);
868
+ let s = document.createElement("span");
869
+ return s.textContent = r.placeholderText, s.setAttribute("aria-label", t.phrase("folded code")), s.title = t.phrase("unfold"), s.className = "cm-foldPlaceholder", s.onclick = i, s;
870
+ }
871
+ const Q = /* @__PURE__ */ g.replace({ widget: /* @__PURE__ */ new class extends re {
872
+ toDOM(n) {
873
+ return de(n, null);
874
+ }
875
+ }() });
876
+ class Ye extends re {
877
+ constructor(e) {
878
+ super(), this.value = e;
879
+ }
880
+ eq(e) {
881
+ return this.value == e.value;
882
+ }
883
+ toDOM(e) {
884
+ return de(e, this.value);
885
+ }
886
+ }
887
+ const Ze = /* @__PURE__ */ y.baseTheme({
888
+ ".cm-foldPlaceholder": {
889
+ backgroundColor: "#eee",
890
+ border: "1px solid #ddd",
891
+ color: "#888",
892
+ borderRadius: ".2em",
893
+ margin: "0 1px",
894
+ padding: "0 1px",
895
+ cursor: "pointer"
896
+ },
897
+ ".cm-foldGutter span": {
898
+ padding: "0 1px",
899
+ cursor: "pointer"
900
+ }
901
+ });
902
+ class j {
903
+ constructor(e, t) {
904
+ this.specs = e;
905
+ let r;
906
+ function i(a) {
907
+ let l = q.newName();
908
+ return (r || (r = /* @__PURE__ */ Object.create(null)))["." + l] = a, l;
909
+ }
910
+ const s = typeof t.all == "string" ? t.all : t.all ? i(t.all) : void 0, o = t.scope;
911
+ this.scope = o instanceof c ? (a) => a.prop(T) == o.data : o ? (a) => a == o : void 0, this.style = xe(e.map((a) => ({
912
+ tag: a.tag,
913
+ class: a.class || i(Object.assign({}, a, { tag: null }))
914
+ })), {
915
+ all: s
916
+ }).style, this.module = r ? new q(r) : null, this.themeType = t.themeType;
917
+ }
918
+ /**
919
+ Create a highlighter style that associates the given styles to
920
+ the given tags. The specs must be objects that hold a style tag
921
+ or array of tags in their `tag` property, and either a single
922
+ `class` property providing a static CSS class (for highlighter
923
+ that rely on external styling), or a
924
+ [`style-mod`](https://github.com/marijnh/style-mod#documentation)-style
925
+ set of CSS properties (which define the styling for those tags).
926
+
927
+ The CSS rules created for a highlighter will be emitted in the
928
+ order of the spec's properties. That means that for elements that
929
+ have multiple tags associated with them, styles defined further
930
+ down in the list will have a higher CSS precedence than styles
931
+ defined earlier.
932
+ */
933
+ static define(e, t) {
934
+ return new j(e, t || {});
935
+ }
936
+ }
937
+ const W = /* @__PURE__ */ w.define(), _e = /* @__PURE__ */ w.define({
938
+ combine(n) {
939
+ return n.length ? [n[0]] : null;
940
+ }
941
+ });
942
+ function E(n) {
943
+ let e = n.facet(W);
944
+ return e.length ? e : n.facet(_e);
945
+ }
946
+ function Ct(n, e) {
947
+ let t = [tt], r;
948
+ return n instanceof j && (n.module && t.push(y.styleModule.of(n.module)), r = n.themeType), r ? t.push(W.computeN([y.darkTheme], (i) => i.facet(y.darkTheme) == (r == "dark") ? [n] : [])) : t.push(W.of(n)), t;
949
+ }
950
+ class et {
951
+ constructor(e) {
952
+ this.markCache = /* @__PURE__ */ Object.create(null), this.tree = k(e.state), this.decorations = this.buildDeco(e, E(e.state)), this.decoratedTo = e.viewport.to;
953
+ }
954
+ update(e) {
955
+ let t = k(e.state), r = E(e.state), i = r != E(e.startState), { viewport: s } = e.view, o = e.changes.mapPos(this.decoratedTo, 1);
956
+ t.length < s.to && !i && t.type == this.tree.type && o >= s.to ? (this.decorations = this.decorations.map(e.changes), this.decoratedTo = o) : (t != this.tree || e.viewportChanged || i) && (this.tree = t, this.decorations = this.buildDeco(e.view, r), this.decoratedTo = s.to);
957
+ }
958
+ buildDeco(e, t) {
959
+ if (!t || !this.tree.length)
960
+ return g.none;
961
+ let r = new ye();
962
+ for (let { from: i, to: s } of e.visibleRanges)
963
+ Te(this.tree, t, (o, a, l) => {
964
+ r.add(o, a, this.markCache[l] || (this.markCache[l] = g.mark({ class: l })));
965
+ }, i, s);
966
+ return r.finish();
967
+ }
968
+ }
969
+ const tt = /* @__PURE__ */ ke.high(/* @__PURE__ */ te.fromClass(et, {
970
+ decorations: (n) => n.decorations
971
+ })), rt = 1e4, nt = "()[]{}", it = /* @__PURE__ */ new p();
972
+ function R(n, e, t) {
973
+ let r = n.prop(e < 0 ? p.openedBy : p.closedBy);
974
+ if (r)
975
+ return r;
976
+ if (n.name.length == 1) {
977
+ let i = t.indexOf(n.name);
978
+ if (i > -1 && i % 2 == (e < 0 ? 1 : 0))
979
+ return [t[i + e]];
980
+ }
981
+ return null;
982
+ }
983
+ function H(n) {
984
+ let e = n.type.prop(it);
985
+ return e ? e(n.node) : n;
986
+ }
987
+ function At(n, e, t, r = {}) {
988
+ let i = r.maxScanDistance || rt, s = r.brackets || nt, o = k(n), a = o.resolveInner(e, t);
989
+ for (let l = a; l; l = l.parent) {
990
+ let u = R(l.type, t, s);
991
+ if (u && l.from < l.to) {
992
+ let h = H(l);
993
+ if (h && (t > 0 ? e >= h.from && e < h.to : e > h.from && e <= h.to))
994
+ return st(n, e, t, l, h, u, s);
995
+ }
996
+ }
997
+ return ot(n, e, t, o, a.type, i, s);
998
+ }
999
+ function st(n, e, t, r, i, s, o) {
1000
+ let a = r.parent, l = { from: i.from, to: i.to }, u = 0, h = a == null ? void 0 : a.cursor();
1001
+ if (h && (t < 0 ? h.childBefore(r.from) : h.childAfter(r.to)))
1002
+ do
1003
+ if (t < 0 ? h.to <= r.from : h.from >= r.to) {
1004
+ if (u == 0 && s.indexOf(h.type.name) > -1 && h.from < h.to) {
1005
+ let f = H(h);
1006
+ return { start: l, end: f ? { from: f.from, to: f.to } : void 0, matched: !0 };
1007
+ } else if (R(h.type, t, o))
1008
+ u++;
1009
+ else if (R(h.type, -t, o)) {
1010
+ if (u == 0) {
1011
+ let f = H(h);
1012
+ return {
1013
+ start: l,
1014
+ end: f && f.from < f.to ? { from: f.from, to: f.to } : void 0,
1015
+ matched: !1
1016
+ };
1017
+ }
1018
+ u--;
1019
+ }
1020
+ }
1021
+ while (t < 0 ? h.prevSibling() : h.nextSibling());
1022
+ return { start: l, matched: !1 };
1023
+ }
1024
+ function ot(n, e, t, r, i, s, o) {
1025
+ let a = t < 0 ? n.sliceDoc(e - 1, e) : n.sliceDoc(e, e + 1), l = o.indexOf(a);
1026
+ if (l < 0 || l % 2 == 0 != t > 0)
1027
+ return null;
1028
+ let u = { from: t < 0 ? e - 1 : e, to: t > 0 ? e + 1 : e }, h = n.doc.iterRange(e, t > 0 ? n.doc.length : 0), f = 0;
1029
+ for (let m = 0; !h.next().done && m <= s; ) {
1030
+ let d = h.value;
1031
+ t < 0 && (m += d.length);
1032
+ let v = e + m * t;
1033
+ for (let b = t > 0 ? 0 : d.length - 1, pe = t > 0 ? d.length : -1; b != pe; b += t) {
1034
+ let B = o.indexOf(d[b]);
1035
+ if (!(B < 0 || r.resolveInner(v + b, 1).type != i))
1036
+ if (B % 2 == 0 == t > 0)
1037
+ f++;
1038
+ else {
1039
+ if (f == 1)
1040
+ return { start: u, end: { from: v + b, to: v + b + 1 }, matched: B >> 1 == l >> 1 };
1041
+ f--;
1042
+ }
1043
+ }
1044
+ t > 0 && (m += d.length);
1045
+ }
1046
+ return h.done ? { start: u, matched: !1 } : null;
1047
+ }
1048
+ function X(n, e, t, r = 0, i = 0) {
1049
+ e == null && (e = n.search(/[^\s\u00a0]/), e == -1 && (e = n.length));
1050
+ let s = i;
1051
+ for (let o = r; o < e; o++)
1052
+ n.charCodeAt(o) == 9 ? s += t - s % t : s++;
1053
+ return s;
1054
+ }
1055
+ class Pt {
1056
+ /**
1057
+ Create a stream.
1058
+ */
1059
+ constructor(e, t, r, i) {
1060
+ this.string = e, this.tabSize = t, this.indentUnit = r, this.overrideIndent = i, this.pos = 0, this.start = 0, this.lastColumnPos = 0, this.lastColumnValue = 0;
1061
+ }
1062
+ /**
1063
+ True if we are at the end of the line.
1064
+ */
1065
+ eol() {
1066
+ return this.pos >= this.string.length;
1067
+ }
1068
+ /**
1069
+ True if we are at the start of the line.
1070
+ */
1071
+ sol() {
1072
+ return this.pos == 0;
1073
+ }
1074
+ /**
1075
+ Get the next code unit after the current position, or undefined
1076
+ if we're at the end of the line.
1077
+ */
1078
+ peek() {
1079
+ return this.string.charAt(this.pos) || void 0;
1080
+ }
1081
+ /**
1082
+ Read the next code unit and advance `this.pos`.
1083
+ */
1084
+ next() {
1085
+ if (this.pos < this.string.length)
1086
+ return this.string.charAt(this.pos++);
1087
+ }
1088
+ /**
1089
+ Match the next character against the given string, regular
1090
+ expression, or predicate. Consume and return it if it matches.
1091
+ */
1092
+ eat(e) {
1093
+ let t = this.string.charAt(this.pos), r;
1094
+ if (typeof e == "string" ? r = t == e : r = t && (e instanceof RegExp ? e.test(t) : e(t)), r)
1095
+ return ++this.pos, t;
1096
+ }
1097
+ /**
1098
+ Continue matching characters that match the given string,
1099
+ regular expression, or predicate function. Return true if any
1100
+ characters were consumed.
1101
+ */
1102
+ eatWhile(e) {
1103
+ let t = this.pos;
1104
+ for (; this.eat(e); )
1105
+ ;
1106
+ return this.pos > t;
1107
+ }
1108
+ /**
1109
+ Consume whitespace ahead of `this.pos`. Return true if any was
1110
+ found.
1111
+ */
1112
+ eatSpace() {
1113
+ let e = this.pos;
1114
+ for (; /[\s\u00a0]/.test(this.string.charAt(this.pos)); )
1115
+ ++this.pos;
1116
+ return this.pos > e;
1117
+ }
1118
+ /**
1119
+ Move to the end of the line.
1120
+ */
1121
+ skipToEnd() {
1122
+ this.pos = this.string.length;
1123
+ }
1124
+ /**
1125
+ Move to directly before the given character, if found on the
1126
+ current line.
1127
+ */
1128
+ skipTo(e) {
1129
+ let t = this.string.indexOf(e, this.pos);
1130
+ if (t > -1)
1131
+ return this.pos = t, !0;
1132
+ }
1133
+ /**
1134
+ Move back `n` characters.
1135
+ */
1136
+ backUp(e) {
1137
+ this.pos -= e;
1138
+ }
1139
+ /**
1140
+ Get the column position at `this.pos`.
1141
+ */
1142
+ column() {
1143
+ return this.lastColumnPos < this.start && (this.lastColumnValue = X(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue;
1144
+ }
1145
+ /**
1146
+ Get the indentation column of the current line.
1147
+ */
1148
+ indentation() {
1149
+ var e;
1150
+ return (e = this.overrideIndent) !== null && e !== void 0 ? e : X(this.string, null, this.tabSize);
1151
+ }
1152
+ /**
1153
+ Match the input against the given string or regular expression
1154
+ (which should start with a `^`). Return true or the regexp match
1155
+ if it matches.
1156
+
1157
+ Unless `consume` is set to `false`, this will move `this.pos`
1158
+ past the matched text.
1159
+
1160
+ When matching a string `caseInsensitive` can be set to true to
1161
+ make the match case-insensitive.
1162
+ */
1163
+ match(e, t, r) {
1164
+ if (typeof e == "string") {
1165
+ let i = (o) => r ? o.toLowerCase() : o, s = this.string.substr(this.pos, e.length);
1166
+ return i(s) == i(e) ? (t !== !1 && (this.pos += e.length), !0) : null;
1167
+ } else {
1168
+ let i = this.string.slice(this.pos).match(e);
1169
+ return i && i.index > 0 ? null : (i && t !== !1 && (this.pos += i[0].length), i);
1170
+ }
1171
+ }
1172
+ /**
1173
+ Get the current token.
1174
+ */
1175
+ current() {
1176
+ return this.string.slice(this.start, this.pos);
1177
+ }
1178
+ }
1179
+ const lt = /* @__PURE__ */ Object.create(null), Y = [V.none], Z = [], _ = /* @__PURE__ */ Object.create(null), at = /* @__PURE__ */ Object.create(null);
1180
+ for (let [n, e] of [
1181
+ ["variable", "variableName"],
1182
+ ["variable-2", "variableName.special"],
1183
+ ["string-2", "string.special"],
1184
+ ["def", "variableName.definition"],
1185
+ ["tag", "tagName"],
1186
+ ["attribute", "attributeName"],
1187
+ ["type", "typeName"],
1188
+ ["builtin", "variableName.standard"],
1189
+ ["qualifier", "modifier"],
1190
+ ["error", "invalid"],
1191
+ ["header", "heading"],
1192
+ ["property", "propertyName"]
1193
+ ])
1194
+ at[n] = /* @__PURE__ */ ut(lt, e);
1195
+ function L(n, e) {
1196
+ Z.indexOf(n) > -1 || (Z.push(n), console.warn(e));
1197
+ }
1198
+ function ut(n, e) {
1199
+ let t = [];
1200
+ for (let a of e.split(" ")) {
1201
+ let l = [];
1202
+ for (let u of a.split(".")) {
1203
+ let h = n[u] || Se[u];
1204
+ h ? typeof h == "function" ? l.length ? l = l.map(h) : L(u, `Modifier ${u} used at start of tag`) : l.length ? L(u, `Tag ${u} used as modifier`) : l = Array.isArray(h) ? h : [h] : L(u, `Unknown highlighting tag ${u}`);
1205
+ }
1206
+ for (let u of l)
1207
+ t.push(u);
1208
+ }
1209
+ if (!t.length)
1210
+ return 0;
1211
+ let r = e.replace(/ /g, "_"), i = r + " " + t.map((a) => a.id), s = _[i];
1212
+ if (s)
1213
+ return s.id;
1214
+ let o = _[i] = V.define({
1215
+ id: Y.length,
1216
+ name: r,
1217
+ props: [Ce({ [r]: t })]
1218
+ });
1219
+ return Y.push(o), o.id;
1220
+ }
1221
+ z.RTL, z.LTR;
1222
+ export {
1223
+ Ie as DocInput,
1224
+ j as HighlightStyle,
1225
+ oe as IndentContext,
1226
+ M as LRLanguage,
1227
+ c as Language,
1228
+ ie as LanguageDescription,
1229
+ kt as LanguageSupport,
1230
+ D as ParseContext,
1231
+ Pt as StringStream,
1232
+ $ as TreeIndentContext,
1233
+ it as bracketMatchingHandle,
1234
+ Xe as codeFolding,
1235
+ xt as continuedIndent,
1236
+ Ae as defineLanguageFacet,
1237
+ vt as delimitedIndent,
1238
+ mt as ensureSyntaxTree,
1239
+ bt as flatIndent,
1240
+ St as foldCode,
1241
+ he as foldEffect,
1242
+ Tt as foldInside,
1243
+ Ve as foldNodeProp,
1244
+ He as foldService,
1245
+ U as foldState,
1246
+ je as foldable,
1247
+ Be as getIndentUnit,
1248
+ yt as getIndentation,
1249
+ Ne as indentNodeProp,
1250
+ Oe as indentService,
1251
+ wt as indentString,
1252
+ se as indentUnit,
1253
+ C as language,
1254
+ T as languageDataProp,
1255
+ At as matchBrackets,
1256
+ Pe as sublanguageProp,
1257
+ Ct as syntaxHighlighting,
1258
+ k as syntaxTree,
1259
+ fe as unfoldEffect
1260
+ };