@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.
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/components/ui/accordion/accordion.d.ts +8 -0
- package/dist/components/ui/accordion/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion/index.d.ts +2 -0
- package/dist/components/ui/accordion/index.d.ts.map +1 -0
- package/dist/components/ui/alert/alert.d.ts +9 -0
- package/dist/components/ui/alert/alert.d.ts.map +1 -0
- package/dist/components/ui/alert/index.d.ts +2 -0
- package/dist/components/ui/alert/index.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog/index.d.ts +2 -0
- package/dist/components/ui/alert-dialog/index.d.ts.map +1 -0
- package/dist/components/ui/avatar/avatar.d.ts +7 -0
- package/dist/components/ui/avatar/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar/index.d.ts +2 -0
- package/dist/components/ui/avatar/index.d.ts.map +1 -0
- package/dist/components/ui/badge/badge.d.ts +10 -0
- package/dist/components/ui/badge/badge.d.ts.map +1 -0
- package/dist/components/ui/badge/index.d.ts +2 -0
- package/dist/components/ui/badge/index.d.ts.map +1 -0
- package/dist/components/ui/button/button.d.ts +12 -0
- package/dist/components/ui/button/button.d.ts.map +1 -0
- package/dist/components/ui/button/index.d.ts +2 -0
- package/dist/components/ui/button/index.d.ts.map +1 -0
- package/dist/components/ui/card/card.d.ts +9 -0
- package/dist/components/ui/card/card.d.ts.map +1 -0
- package/dist/components/ui/card/index.d.ts +2 -0
- package/dist/components/ui/card/index.d.ts.map +1 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox/index.d.ts +2 -0
- package/dist/components/ui/checkbox/index.d.ts.map +1 -0
- package/dist/components/ui/collapsible/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible/index.d.ts +2 -0
- package/dist/components/ui/collapsible/index.d.ts.map +1 -0
- package/dist/components/ui/dialog/dialog.d.ts +20 -0
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.d.ts +2 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts +17 -0
- package/dist/components/ui/dithered-image/dithered-image.d.ts.map +1 -0
- package/dist/components/ui/dithered-image/index.d.ts +3 -0
- package/dist/components/ui/dithered-image/index.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +2 -0
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/components/ui/input/index.d.ts +2 -0
- package/dist/components/ui/input/index.d.ts.map +1 -0
- package/dist/components/ui/input/input.d.ts +5 -0
- package/dist/components/ui/input/input.d.ts.map +1 -0
- package/dist/components/ui/label/index.d.ts +2 -0
- package/dist/components/ui/label/index.d.ts.map +1 -0
- package/dist/components/ui/label/label.d.ts +6 -0
- package/dist/components/ui/label/label.d.ts.map +1 -0
- package/dist/components/ui/popover/index.d.ts +2 -0
- package/dist/components/ui/popover/index.d.ts.map +1 -0
- package/dist/components/ui/popover/popover.d.ts +8 -0
- package/dist/components/ui/popover/popover.d.ts.map +1 -0
- package/dist/components/ui/progress/index.d.ts +2 -0
- package/dist/components/ui/progress/index.d.ts.map +1 -0
- package/dist/components/ui/progress/progress.d.ts +19 -0
- package/dist/components/ui/progress/progress.d.ts.map +1 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/radio-group/index.d.ts.map +1 -0
- package/dist/components/ui/radio-group/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/index.d.ts +2 -0
- package/dist/components/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select/index.d.ts +2 -0
- package/dist/components/ui/select/index.d.ts.map +1 -0
- package/dist/components/ui/select/select.d.ts +14 -0
- package/dist/components/ui/select/select.d.ts.map +1 -0
- package/dist/components/ui/separator/index.d.ts +2 -0
- package/dist/components/ui/separator/index.d.ts.map +1 -0
- package/dist/components/ui/separator/separator.d.ts +5 -0
- package/dist/components/ui/separator/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet/index.d.ts +2 -0
- package/dist/components/ui/sheet/index.d.ts.map +1 -0
- package/dist/components/ui/sheet/sheet.d.ts +26 -0
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -0
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/skeleton/index.d.ts.map +1 -0
- package/dist/components/ui/skeleton/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/ui/slider/index.d.ts +2 -0
- package/dist/components/ui/slider/index.d.ts.map +1 -0
- package/dist/components/ui/slider/slider.d.ts +5 -0
- package/dist/components/ui/slider/slider.d.ts.map +1 -0
- package/dist/components/ui/statusline/index.d.ts +2 -0
- package/dist/components/ui/statusline/index.d.ts.map +1 -0
- package/dist/components/ui/statusline/statusline.d.ts +40 -0
- package/dist/components/ui/statusline/statusline.d.ts.map +1 -0
- package/dist/components/ui/switch/index.d.ts +2 -0
- package/dist/components/ui/switch/index.d.ts.map +1 -0
- package/dist/components/ui/switch/switch.d.ts +5 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -0
- package/dist/components/ui/table/index.d.ts +2 -0
- package/dist/components/ui/table/index.d.ts.map +1 -0
- package/dist/components/ui/table/table.d.ts +11 -0
- package/dist/components/ui/table/table.d.ts.map +1 -0
- package/dist/components/ui/tabs/index.d.ts +2 -0
- package/dist/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/components/ui/tabs/tabs.d.ts +8 -0
- package/dist/components/ui/tabs/tabs.d.ts.map +1 -0
- package/dist/components/ui/terminal-textarea/index.d.ts +2 -0
- package/dist/components/ui/terminal-textarea/index.d.ts.map +1 -0
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts +27 -0
- package/dist/components/ui/terminal-textarea/terminal-textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea/index.d.ts +2 -0
- package/dist/components/ui/textarea/index.d.ts.map +1 -0
- package/dist/components/ui/textarea/textarea.d.ts +5 -0
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -0
- package/dist/components/ui/toggle/index.d.ts +2 -0
- package/dist/components/ui/toggle/index.d.ts.map +1 -0
- package/dist/components/ui/toggle/toggle.d.ts +13 -0
- package/dist/components/ui/toggle/toggle.d.ts.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +2 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/components/ui/tooltip/tooltip.d.ts +11 -0
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index10.js +61 -0
- package/dist/index100.js +32 -0
- package/dist/index101.js +17 -0
- package/dist/index102.js +137 -0
- package/dist/index103.js +52 -0
- package/dist/index104.js +11 -0
- package/dist/index105.js +6 -0
- package/dist/index106.js +183 -0
- package/dist/index107.js +652 -0
- package/dist/index108.js +109 -0
- package/dist/index109.js +93 -0
- package/dist/index11.js +27 -0
- package/dist/index110.js +69 -0
- package/dist/index111.js +161 -0
- package/dist/index112.js +399 -0
- package/dist/index113.js +1682 -0
- package/dist/index114.js +280 -0
- package/dist/index115.js +134 -0
- package/dist/index116.js +34 -0
- package/dist/index117.js +1613 -0
- package/dist/index118.js +300 -0
- package/dist/index119.js +637 -0
- package/dist/index12.js +7 -0
- package/dist/index120.js +146 -0
- package/dist/index121.js +23 -0
- package/dist/index122.js +11 -0
- package/dist/index123.js +40 -0
- package/dist/index124.js +20 -0
- package/dist/index125.js +8 -0
- package/dist/index126.js +14 -0
- package/dist/index127.js +208 -0
- package/dist/index128.js +24 -0
- package/dist/index129.js +402 -0
- package/dist/index13.js +100 -0
- package/dist/index130.js +1308 -0
- package/dist/index131.js +620 -0
- package/dist/index132.js +4 -0
- package/dist/index133.js +55 -0
- package/dist/index134.js +67 -0
- package/dist/index135.js +27 -0
- package/dist/index136.js +31 -0
- package/dist/index137.js +7 -0
- package/dist/index138.js +4 -0
- package/dist/index139.js +4 -0
- package/dist/index14.js +226 -0
- package/dist/index140.js +7 -0
- package/dist/index141.js +5 -0
- package/dist/index142.js +26 -0
- package/dist/index143.js +115 -0
- package/dist/index144.js +18 -0
- package/dist/index145.js +527 -0
- package/dist/index146.js +130 -0
- package/dist/index147.js +136 -0
- package/dist/index148.js +67 -0
- package/dist/index149.js +71 -0
- package/dist/index15.js +146 -0
- package/dist/index150.js +11 -0
- package/dist/index151.js +16 -0
- package/dist/index152.js +68 -0
- package/dist/index153.js +6 -0
- package/dist/index154.js +25 -0
- package/dist/index155.js +25 -0
- package/dist/index156.js +15 -0
- package/dist/index157.js +30 -0
- package/dist/index158.js +7 -0
- package/dist/index16.js +21 -0
- package/dist/index17.js +19 -0
- package/dist/index18.js +24 -0
- package/dist/index19.js +58 -0
- package/dist/index2.js +8 -0
- package/dist/index20.js +31 -0
- package/dist/index21.js +38 -0
- package/dist/index22.js +123 -0
- package/dist/index23.js +24 -0
- package/dist/index24.js +72 -0
- package/dist/index25.js +17 -0
- package/dist/index26.js +34 -0
- package/dist/index27.js +81 -0
- package/dist/index28.js +27 -0
- package/dist/index29.js +90 -0
- package/dist/index3.js +22 -0
- package/dist/index30.js +46 -0
- package/dist/index31.js +234 -0
- package/dist/index32.js +20 -0
- package/dist/index33.js +37 -0
- package/dist/index34.js +25 -0
- package/dist/index35.js +105 -0
- package/dist/index36.js +68 -0
- package/dist/index37.js +51 -0
- package/dist/index38.js +102 -0
- package/dist/index39.js +13 -0
- package/dist/index4.js +46 -0
- package/dist/index40.js +17 -0
- package/dist/index41.js +2265 -0
- package/dist/index42.js +35 -0
- package/dist/index43.js +20 -0
- package/dist/index44.js +239 -0
- package/dist/index45.js +13 -0
- package/dist/index46.js +75 -0
- package/dist/index47.js +251 -0
- package/dist/index48.js +11 -0
- package/dist/index49.js +338 -0
- package/dist/index5.js +51 -0
- package/dist/index50.js +62 -0
- package/dist/index51.js +243 -0
- package/dist/index52.js +862 -0
- package/dist/index53.js +11 -0
- package/dist/index54.js +120 -0
- package/dist/index55.js +227 -0
- package/dist/index56.js +13 -0
- package/dist/index57.js +13 -0
- package/dist/index58.js +238 -0
- package/dist/index59.js +262 -0
- package/dist/index6.js +51 -0
- package/dist/index60.js +14 -0
- package/dist/index61.js +24 -0
- package/dist/index62.js +532 -0
- package/dist/index63.js +6157 -0
- package/dist/index64.js +2635 -0
- package/dist/index65.js +300 -0
- package/dist/index66.js +674 -0
- package/dist/index67.js +832 -0
- package/dist/index68.js +27 -0
- package/dist/index69.js +330 -0
- package/dist/index7.js +42 -0
- package/dist/index70.js +4901 -0
- package/dist/index71.js +831 -0
- package/dist/index72.js +1260 -0
- package/dist/index73.js +536 -0
- package/dist/index74.js +127 -0
- package/dist/index75.js +163 -0
- package/dist/index76.js +33 -0
- package/dist/index77.js +437 -0
- package/dist/index78.js +132 -0
- package/dist/index79.js +83 -0
- package/dist/index8.js +31 -0
- package/dist/index80.js +70 -0
- package/dist/index81.js +48 -0
- package/dist/index82.js +29 -0
- package/dist/index83.js +9 -0
- package/dist/index84.js +54 -0
- package/dist/index85.js +36 -0
- package/dist/index86.js +13 -0
- package/dist/index87.js +10 -0
- package/dist/index88.js +32 -0
- package/dist/index89.js +57 -0
- package/dist/index9.js +54 -0
- package/dist/index90.js +13 -0
- package/dist/index91.js +6 -0
- package/dist/index92.js +15 -0
- package/dist/index93.js +8 -0
- package/dist/index94.js +27 -0
- package/dist/index95.js +71 -0
- package/dist/index96.js +127 -0
- package/dist/index97.js +221 -0
- package/dist/index98.js +16 -0
- package/dist/index99.js +56 -0
- package/dist/lib/utils.d.ts +14 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/tokens/animations.d.ts +174 -0
- package/dist/tokens/animations.d.ts.map +1 -0
- package/dist/tokens/colors.d.ts +92 -0
- package/dist/tokens/colors.d.ts.map +1 -0
- package/dist/tokens/index.d.ts +403 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/shadows.d.ts +15 -0
- package/dist/tokens/shadows.d.ts.map +1 -0
- package/dist/tokens/spacing.d.ts +55 -0
- package/dist/tokens/spacing.d.ts.map +1 -0
- package/dist/tokens/typography.d.ts +80 -0
- package/dist/tokens/typography.d.ts.map +1 -0
- package/package.json +128 -0
package/dist/index113.js
ADDED
|
@@ -0,0 +1,1682 @@
|
|
|
1
|
+
const Oe = 1024;
|
|
2
|
+
let ke = 0;
|
|
3
|
+
class T {
|
|
4
|
+
constructor(e, t) {
|
|
5
|
+
this.from = e, this.to = t;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class k {
|
|
9
|
+
/**
|
|
10
|
+
Create a new node prop type.
|
|
11
|
+
*/
|
|
12
|
+
constructor(e = {}) {
|
|
13
|
+
this.id = ke++, this.perNode = !!e.perNode, this.deserialize = e.deserialize || (() => {
|
|
14
|
+
throw new Error("This node type doesn't define a deserialize function");
|
|
15
|
+
}), this.combine = e.combine || null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
This is meant to be used with
|
|
19
|
+
[`NodeSet.extend`](#common.NodeSet.extend) or
|
|
20
|
+
[`LRParser.configure`](#lr.ParserConfig.props) to compute
|
|
21
|
+
prop values for each node type in the set. Takes a [match
|
|
22
|
+
object](#common.NodeType^match) or function that returns undefined
|
|
23
|
+
if the node type doesn't get this prop, and the prop's value if
|
|
24
|
+
it does.
|
|
25
|
+
*/
|
|
26
|
+
add(e) {
|
|
27
|
+
if (this.perNode)
|
|
28
|
+
throw new RangeError("Can't add per-node props to node types");
|
|
29
|
+
return typeof e != "function" && (e = j.match(e)), (t) => {
|
|
30
|
+
let r = e(t);
|
|
31
|
+
return r === void 0 ? null : [this, r];
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
k.closedBy = new k({ deserialize: (l) => l.split(" ") });
|
|
36
|
+
k.openedBy = new k({ deserialize: (l) => l.split(" ") });
|
|
37
|
+
k.group = new k({ deserialize: (l) => l.split(" ") });
|
|
38
|
+
k.isolate = new k({ deserialize: (l) => {
|
|
39
|
+
if (l && l != "rtl" && l != "ltr" && l != "auto")
|
|
40
|
+
throw new RangeError("Invalid value for isolate: " + l);
|
|
41
|
+
return l || "auto";
|
|
42
|
+
} });
|
|
43
|
+
k.contextHash = new k({ perNode: !0 });
|
|
44
|
+
k.lookAhead = new k({ perNode: !0 });
|
|
45
|
+
k.mounted = new k({ perNode: !0 });
|
|
46
|
+
class q {
|
|
47
|
+
constructor(e, t, r) {
|
|
48
|
+
this.tree = e, this.overlay = t, this.parser = r;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
@internal
|
|
52
|
+
*/
|
|
53
|
+
static get(e) {
|
|
54
|
+
return e && e.props && e.props[k.mounted.id];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const Ce = /* @__PURE__ */ Object.create(null);
|
|
58
|
+
class j {
|
|
59
|
+
/**
|
|
60
|
+
@internal
|
|
61
|
+
*/
|
|
62
|
+
constructor(e, t, r, n = 0) {
|
|
63
|
+
this.name = e, this.props = t, this.id = r, this.flags = n;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
Define a node type.
|
|
67
|
+
*/
|
|
68
|
+
static define(e) {
|
|
69
|
+
let t = e.props && e.props.length ? /* @__PURE__ */ Object.create(null) : Ce, r = (e.top ? 1 : 0) | (e.skipped ? 2 : 0) | (e.error ? 4 : 0) | (e.name == null ? 8 : 0), n = new j(e.name || "", t, e.id, r);
|
|
70
|
+
if (e.props) {
|
|
71
|
+
for (let i of e.props)
|
|
72
|
+
if (Array.isArray(i) || (i = i(n)), i) {
|
|
73
|
+
if (i[0].perNode)
|
|
74
|
+
throw new RangeError("Can't store a per-node prop on a node type");
|
|
75
|
+
t[i[0].id] = i[1];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
Retrieves a node prop for this type. Will return `undefined` if
|
|
82
|
+
the prop isn't present on this node.
|
|
83
|
+
*/
|
|
84
|
+
prop(e) {
|
|
85
|
+
return this.props[e.id];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
True when this is the top node of a grammar.
|
|
89
|
+
*/
|
|
90
|
+
get isTop() {
|
|
91
|
+
return (this.flags & 1) > 0;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
True when this node is produced by a skip rule.
|
|
95
|
+
*/
|
|
96
|
+
get isSkipped() {
|
|
97
|
+
return (this.flags & 2) > 0;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
Indicates whether this is an error node.
|
|
101
|
+
*/
|
|
102
|
+
get isError() {
|
|
103
|
+
return (this.flags & 4) > 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
When true, this node type doesn't correspond to a user-declared
|
|
107
|
+
named node, for example because it is used to cache repetition.
|
|
108
|
+
*/
|
|
109
|
+
get isAnonymous() {
|
|
110
|
+
return (this.flags & 8) > 0;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
Returns true when this node's name or one of its
|
|
114
|
+
[groups](#common.NodeProp^group) matches the given string.
|
|
115
|
+
*/
|
|
116
|
+
is(e) {
|
|
117
|
+
if (typeof e == "string") {
|
|
118
|
+
if (this.name == e)
|
|
119
|
+
return !0;
|
|
120
|
+
let t = this.prop(k.group);
|
|
121
|
+
return t ? t.indexOf(e) > -1 : !1;
|
|
122
|
+
}
|
|
123
|
+
return this.id == e;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
Create a function from node types to arbitrary values by
|
|
127
|
+
specifying an object whose property names are node or
|
|
128
|
+
[group](#common.NodeProp^group) names. Often useful with
|
|
129
|
+
[`NodeProp.add`](#common.NodeProp.add). You can put multiple
|
|
130
|
+
names, separated by spaces, in a single property name to map
|
|
131
|
+
multiple node names to a single value.
|
|
132
|
+
*/
|
|
133
|
+
static match(e) {
|
|
134
|
+
let t = /* @__PURE__ */ Object.create(null);
|
|
135
|
+
for (let r in e)
|
|
136
|
+
for (let n of r.split(" "))
|
|
137
|
+
t[n] = e[r];
|
|
138
|
+
return (r) => {
|
|
139
|
+
for (let n = r.prop(k.group), i = -1; i < (n ? n.length : 0); i++) {
|
|
140
|
+
let s = t[i < 0 ? r.name : n[i]];
|
|
141
|
+
if (s)
|
|
142
|
+
return s;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
j.none = new j(
|
|
148
|
+
"",
|
|
149
|
+
/* @__PURE__ */ Object.create(null),
|
|
150
|
+
0,
|
|
151
|
+
8
|
|
152
|
+
/* NodeFlag.Anonymous */
|
|
153
|
+
);
|
|
154
|
+
class xe {
|
|
155
|
+
/**
|
|
156
|
+
Create a set with the given types. The `id` property of each
|
|
157
|
+
type should correspond to its position within the array.
|
|
158
|
+
*/
|
|
159
|
+
constructor(e) {
|
|
160
|
+
this.types = e;
|
|
161
|
+
for (let t = 0; t < e.length; t++)
|
|
162
|
+
if (e[t].id != t)
|
|
163
|
+
throw new RangeError("Node type ids should correspond to array positions when creating a node set");
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
Create a copy of this set with some node properties added. The
|
|
167
|
+
arguments to this method can be created with
|
|
168
|
+
[`NodeProp.add`](#common.NodeProp.add).
|
|
169
|
+
*/
|
|
170
|
+
extend(...e) {
|
|
171
|
+
let t = [];
|
|
172
|
+
for (let r of this.types) {
|
|
173
|
+
let n = null;
|
|
174
|
+
for (let i of e) {
|
|
175
|
+
let s = i(r);
|
|
176
|
+
if (s) {
|
|
177
|
+
n || (n = Object.assign({}, r.props));
|
|
178
|
+
let f = s[1], o = s[0];
|
|
179
|
+
o.combine && o.id in n && (f = o.combine(n[o.id], f)), n[o.id] = f;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
t.push(n ? new j(r.name, n, r.id, r.flags) : r);
|
|
183
|
+
}
|
|
184
|
+
return new xe(t);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const Z = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap();
|
|
188
|
+
var S;
|
|
189
|
+
(function(l) {
|
|
190
|
+
l[l.ExcludeBuffers = 1] = "ExcludeBuffers", l[l.IncludeAnonymous = 2] = "IncludeAnonymous", l[l.IgnoreMounts = 4] = "IgnoreMounts", l[l.IgnoreOverlays = 8] = "IgnoreOverlays";
|
|
191
|
+
})(S || (S = {}));
|
|
192
|
+
class z {
|
|
193
|
+
/**
|
|
194
|
+
Construct a new tree. See also [`Tree.build`](#common.Tree^build).
|
|
195
|
+
*/
|
|
196
|
+
constructor(e, t, r, n, i) {
|
|
197
|
+
if (this.type = e, this.children = t, this.positions = r, this.length = n, this.props = null, i && i.length) {
|
|
198
|
+
this.props = /* @__PURE__ */ Object.create(null);
|
|
199
|
+
for (let [s, f] of i)
|
|
200
|
+
this.props[typeof s == "number" ? s : s.id] = f;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
@internal
|
|
205
|
+
*/
|
|
206
|
+
toString() {
|
|
207
|
+
let e = q.get(this);
|
|
208
|
+
if (e && !e.overlay)
|
|
209
|
+
return e.tree.toString();
|
|
210
|
+
let t = "";
|
|
211
|
+
for (let r of this.children) {
|
|
212
|
+
let n = r.toString();
|
|
213
|
+
n && (t && (t += ","), t += n);
|
|
214
|
+
}
|
|
215
|
+
return this.type.name ? (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (t.length ? "(" + t + ")" : "") : t;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
Get a [tree cursor](#common.TreeCursor) positioned at the top of
|
|
219
|
+
the tree. Mode can be used to [control](#common.IterMode) which
|
|
220
|
+
nodes the cursor visits.
|
|
221
|
+
*/
|
|
222
|
+
cursor(e = 0) {
|
|
223
|
+
return new te(this.topNode, e);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
Get a [tree cursor](#common.TreeCursor) pointing into this tree
|
|
227
|
+
at the given position and side (see
|
|
228
|
+
[`moveTo`](#common.TreeCursor.moveTo).
|
|
229
|
+
*/
|
|
230
|
+
cursorAt(e, t = 0, r = 0) {
|
|
231
|
+
let n = Z.get(this) || this.topNode, i = new te(n);
|
|
232
|
+
return i.moveTo(e, t), Z.set(this, i._tree), i;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
Get a [syntax node](#common.SyntaxNode) object for the top of the
|
|
236
|
+
tree.
|
|
237
|
+
*/
|
|
238
|
+
get topNode() {
|
|
239
|
+
return new B(this, 0, 0, null);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
Get the [syntax node](#common.SyntaxNode) at the given position.
|
|
243
|
+
If `side` is -1, this will move into nodes that end at the
|
|
244
|
+
position. If 1, it'll move into nodes that start at the
|
|
245
|
+
position. With 0, it'll only enter nodes that cover the position
|
|
246
|
+
from both sides.
|
|
247
|
+
|
|
248
|
+
Note that this will not enter
|
|
249
|
+
[overlays](#common.MountedTree.overlay), and you often want
|
|
250
|
+
[`resolveInner`](#common.Tree.resolveInner) instead.
|
|
251
|
+
*/
|
|
252
|
+
resolve(e, t = 0) {
|
|
253
|
+
let r = K(Z.get(this) || this.topNode, e, t, !1);
|
|
254
|
+
return Z.set(this, r), r;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
Like [`resolve`](#common.Tree.resolve), but will enter
|
|
258
|
+
[overlaid](#common.MountedTree.overlay) nodes, producing a syntax node
|
|
259
|
+
pointing into the innermost overlaid tree at the given position
|
|
260
|
+
(with parent links going through all parent structure, including
|
|
261
|
+
the host trees).
|
|
262
|
+
*/
|
|
263
|
+
resolveInner(e, t = 0) {
|
|
264
|
+
let r = K(he.get(this) || this.topNode, e, t, !0);
|
|
265
|
+
return he.set(this, r), r;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
In some situations, it can be useful to iterate through all
|
|
269
|
+
nodes around a position, including those in overlays that don't
|
|
270
|
+
directly cover the position. This method gives you an iterator
|
|
271
|
+
that will produce all nodes, from small to big, around the given
|
|
272
|
+
position.
|
|
273
|
+
*/
|
|
274
|
+
resolveStack(e, t = 0) {
|
|
275
|
+
return _e(this, e, t);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
Iterate over the tree and its children, calling `enter` for any
|
|
279
|
+
node that touches the `from`/`to` region (if given) before
|
|
280
|
+
running over such a node's children, and `leave` (if given) when
|
|
281
|
+
leaving the node. When `enter` returns `false`, that node will
|
|
282
|
+
not have its children iterated over (or `leave` called).
|
|
283
|
+
*/
|
|
284
|
+
iterate(e) {
|
|
285
|
+
let { enter: t, leave: r, from: n = 0, to: i = this.length } = e, s = e.mode || 0, f = (s & S.IncludeAnonymous) > 0;
|
|
286
|
+
for (let o = this.cursor(s | S.IncludeAnonymous); ; ) {
|
|
287
|
+
let u = !1;
|
|
288
|
+
if (o.from <= i && o.to >= n && (!f && o.type.isAnonymous || t(o) !== !1)) {
|
|
289
|
+
if (o.firstChild())
|
|
290
|
+
continue;
|
|
291
|
+
u = !0;
|
|
292
|
+
}
|
|
293
|
+
for (; u && r && (f || !o.type.isAnonymous) && r(o), !o.nextSibling(); ) {
|
|
294
|
+
if (!o.parent())
|
|
295
|
+
return;
|
|
296
|
+
u = !0;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
Get the value of the given [node prop](#common.NodeProp) for this
|
|
302
|
+
node. Works with both per-node and per-type props.
|
|
303
|
+
*/
|
|
304
|
+
prop(e) {
|
|
305
|
+
return e.perNode ? this.props ? this.props[e.id] : void 0 : this.type.prop(e);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
Returns the node's [per-node props](#common.NodeProp.perNode) in a
|
|
309
|
+
format that can be passed to the [`Tree`](#common.Tree)
|
|
310
|
+
constructor.
|
|
311
|
+
*/
|
|
312
|
+
get propValues() {
|
|
313
|
+
let e = [];
|
|
314
|
+
if (this.props)
|
|
315
|
+
for (let t in this.props)
|
|
316
|
+
e.push([+t, this.props[t]]);
|
|
317
|
+
return e;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
Balance the direct children of this tree, producing a copy of
|
|
321
|
+
which may have children grouped into subtrees with type
|
|
322
|
+
[`NodeType.none`](#common.NodeType^none).
|
|
323
|
+
*/
|
|
324
|
+
balance(e = {}) {
|
|
325
|
+
return this.children.length <= 8 ? this : le(j.none, this.children, this.positions, 0, this.children.length, 0, this.length, (t, r, n) => new z(this.type, t, r, n, this.propValues), e.makeTree || ((t, r, n) => new z(j.none, t, r, n)));
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
Build a tree from a postfix-ordered buffer of node information,
|
|
329
|
+
or a cursor over such a buffer.
|
|
330
|
+
*/
|
|
331
|
+
static build(e) {
|
|
332
|
+
return Ie(e);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
z.empty = new z(j.none, [], [], 0);
|
|
336
|
+
class ie {
|
|
337
|
+
constructor(e, t) {
|
|
338
|
+
this.buffer = e, this.index = t;
|
|
339
|
+
}
|
|
340
|
+
get id() {
|
|
341
|
+
return this.buffer[this.index - 4];
|
|
342
|
+
}
|
|
343
|
+
get start() {
|
|
344
|
+
return this.buffer[this.index - 3];
|
|
345
|
+
}
|
|
346
|
+
get end() {
|
|
347
|
+
return this.buffer[this.index - 2];
|
|
348
|
+
}
|
|
349
|
+
get size() {
|
|
350
|
+
return this.buffer[this.index - 1];
|
|
351
|
+
}
|
|
352
|
+
get pos() {
|
|
353
|
+
return this.index;
|
|
354
|
+
}
|
|
355
|
+
next() {
|
|
356
|
+
this.index -= 4;
|
|
357
|
+
}
|
|
358
|
+
fork() {
|
|
359
|
+
return new ie(this.buffer, this.index);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
class H {
|
|
363
|
+
/**
|
|
364
|
+
Create a tree buffer.
|
|
365
|
+
*/
|
|
366
|
+
constructor(e, t, r) {
|
|
367
|
+
this.buffer = e, this.length = t, this.set = r;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
@internal
|
|
371
|
+
*/
|
|
372
|
+
get type() {
|
|
373
|
+
return j.none;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
@internal
|
|
377
|
+
*/
|
|
378
|
+
toString() {
|
|
379
|
+
let e = [];
|
|
380
|
+
for (let t = 0; t < this.buffer.length; )
|
|
381
|
+
e.push(this.childString(t)), t = this.buffer[t + 3];
|
|
382
|
+
return e.join(",");
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
@internal
|
|
386
|
+
*/
|
|
387
|
+
childString(e) {
|
|
388
|
+
let t = this.buffer[e], r = this.buffer[e + 3], n = this.set.types[t], i = n.name;
|
|
389
|
+
if (/\W/.test(i) && !n.isError && (i = JSON.stringify(i)), e += 4, r == e)
|
|
390
|
+
return i;
|
|
391
|
+
let s = [];
|
|
392
|
+
for (; e < r; )
|
|
393
|
+
s.push(this.childString(e)), e = this.buffer[e + 3];
|
|
394
|
+
return i + "(" + s.join(",") + ")";
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
@internal
|
|
398
|
+
*/
|
|
399
|
+
findChild(e, t, r, n, i) {
|
|
400
|
+
let { buffer: s } = this, f = -1;
|
|
401
|
+
for (let o = e; o != t && !(be(i, n, s[o + 1], s[o + 2]) && (f = o, r > 0)); o = s[o + 3])
|
|
402
|
+
;
|
|
403
|
+
return f;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
@internal
|
|
407
|
+
*/
|
|
408
|
+
slice(e, t, r) {
|
|
409
|
+
let n = this.buffer, i = new Uint16Array(t - e), s = 0;
|
|
410
|
+
for (let f = e, o = 0; f < t; ) {
|
|
411
|
+
i[o++] = n[f++], i[o++] = n[f++] - r;
|
|
412
|
+
let u = i[o++] = n[f++] - r;
|
|
413
|
+
i[o++] = n[f++] - e, s = Math.max(s, u);
|
|
414
|
+
}
|
|
415
|
+
return new H(i, s, this.set);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function be(l, e, t, r) {
|
|
419
|
+
switch (l) {
|
|
420
|
+
case -2:
|
|
421
|
+
return t < e;
|
|
422
|
+
case -1:
|
|
423
|
+
return r >= e && t < e;
|
|
424
|
+
case 0:
|
|
425
|
+
return t < e && r > e;
|
|
426
|
+
case 1:
|
|
427
|
+
return t <= e && r > e;
|
|
428
|
+
case 2:
|
|
429
|
+
return r > e;
|
|
430
|
+
case 4:
|
|
431
|
+
return !0;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function K(l, e, t, r) {
|
|
435
|
+
for (var n; l.from == l.to || (t < 1 ? l.from >= e : l.from > e) || (t > -1 ? l.to <= e : l.to < e); ) {
|
|
436
|
+
let s = !r && l instanceof B && l.index < 0 ? null : l.parent;
|
|
437
|
+
if (!s)
|
|
438
|
+
return l;
|
|
439
|
+
l = s;
|
|
440
|
+
}
|
|
441
|
+
let i = r ? 0 : S.IgnoreOverlays;
|
|
442
|
+
if (r)
|
|
443
|
+
for (let s = l, f = s.parent; f; s = f, f = s.parent)
|
|
444
|
+
s instanceof B && s.index < 0 && ((n = f.enter(e, t, i)) === null || n === void 0 ? void 0 : n.from) != s.from && (l = f);
|
|
445
|
+
for (; ; ) {
|
|
446
|
+
let s = l.enter(e, t, i);
|
|
447
|
+
if (!s)
|
|
448
|
+
return l;
|
|
449
|
+
l = s;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
class we {
|
|
453
|
+
cursor(e = 0) {
|
|
454
|
+
return new te(this, e);
|
|
455
|
+
}
|
|
456
|
+
getChild(e, t = null, r = null) {
|
|
457
|
+
let n = ue(this, e, t, r);
|
|
458
|
+
return n.length ? n[0] : null;
|
|
459
|
+
}
|
|
460
|
+
getChildren(e, t = null, r = null) {
|
|
461
|
+
return ue(this, e, t, r);
|
|
462
|
+
}
|
|
463
|
+
resolve(e, t = 0) {
|
|
464
|
+
return K(this, e, t, !1);
|
|
465
|
+
}
|
|
466
|
+
resolveInner(e, t = 0) {
|
|
467
|
+
return K(this, e, t, !0);
|
|
468
|
+
}
|
|
469
|
+
matchContext(e) {
|
|
470
|
+
return re(this.parent, e);
|
|
471
|
+
}
|
|
472
|
+
enterUnfinishedNodesBefore(e) {
|
|
473
|
+
let t = this.childBefore(e), r = this;
|
|
474
|
+
for (; t; ) {
|
|
475
|
+
let n = t.lastChild;
|
|
476
|
+
if (!n || n.to != t.to)
|
|
477
|
+
break;
|
|
478
|
+
n.type.isError && n.from == n.to ? (r = t, t = n.prevSibling) : t = n;
|
|
479
|
+
}
|
|
480
|
+
return r;
|
|
481
|
+
}
|
|
482
|
+
get node() {
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
get next() {
|
|
486
|
+
return this.parent;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
class B extends we {
|
|
490
|
+
constructor(e, t, r, n) {
|
|
491
|
+
super(), this._tree = e, this.from = t, this.index = r, this._parent = n;
|
|
492
|
+
}
|
|
493
|
+
get type() {
|
|
494
|
+
return this._tree.type;
|
|
495
|
+
}
|
|
496
|
+
get name() {
|
|
497
|
+
return this._tree.type.name;
|
|
498
|
+
}
|
|
499
|
+
get to() {
|
|
500
|
+
return this.from + this._tree.length;
|
|
501
|
+
}
|
|
502
|
+
nextChild(e, t, r, n, i = 0) {
|
|
503
|
+
for (let s = this; ; ) {
|
|
504
|
+
for (let { children: f, positions: o } = s._tree, u = t > 0 ? f.length : -1; e != u; e += t) {
|
|
505
|
+
let h = f[e], c = o[e] + s.from;
|
|
506
|
+
if (be(n, r, c, c + h.length)) {
|
|
507
|
+
if (h instanceof H) {
|
|
508
|
+
if (i & S.ExcludeBuffers)
|
|
509
|
+
continue;
|
|
510
|
+
let d = h.findChild(0, h.buffer.length, t, r - c, n);
|
|
511
|
+
if (d > -1)
|
|
512
|
+
return new D(new Ae(s, h, e, c), null, d);
|
|
513
|
+
} else if (i & S.IncludeAnonymous || !h.type.isAnonymous || se(h)) {
|
|
514
|
+
let d;
|
|
515
|
+
if (!(i & S.IgnoreMounts) && (d = q.get(h)) && !d.overlay)
|
|
516
|
+
return new B(d.tree, c, e, s);
|
|
517
|
+
let y = new B(h, c, e, s);
|
|
518
|
+
return i & S.IncludeAnonymous || !y.type.isAnonymous ? y : y.nextChild(t < 0 ? h.children.length - 1 : 0, t, r, n);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (i & S.IncludeAnonymous || !s.type.isAnonymous || (s.index >= 0 ? e = s.index + t : e = t < 0 ? -1 : s._parent._tree.children.length, s = s._parent, !s))
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
get firstChild() {
|
|
527
|
+
return this.nextChild(
|
|
528
|
+
0,
|
|
529
|
+
1,
|
|
530
|
+
0,
|
|
531
|
+
4
|
|
532
|
+
/* Side.DontCare */
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
get lastChild() {
|
|
536
|
+
return this.nextChild(
|
|
537
|
+
this._tree.children.length - 1,
|
|
538
|
+
-1,
|
|
539
|
+
0,
|
|
540
|
+
4
|
|
541
|
+
/* Side.DontCare */
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
childAfter(e) {
|
|
545
|
+
return this.nextChild(
|
|
546
|
+
0,
|
|
547
|
+
1,
|
|
548
|
+
e,
|
|
549
|
+
2
|
|
550
|
+
/* Side.After */
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
childBefore(e) {
|
|
554
|
+
return this.nextChild(
|
|
555
|
+
this._tree.children.length - 1,
|
|
556
|
+
-1,
|
|
557
|
+
e,
|
|
558
|
+
-2
|
|
559
|
+
/* Side.Before */
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
prop(e) {
|
|
563
|
+
return this._tree.prop(e);
|
|
564
|
+
}
|
|
565
|
+
enter(e, t, r = 0) {
|
|
566
|
+
let n;
|
|
567
|
+
if (!(r & S.IgnoreOverlays) && (n = q.get(this._tree)) && n.overlay) {
|
|
568
|
+
let i = e - this.from;
|
|
569
|
+
for (let { from: s, to: f } of n.overlay)
|
|
570
|
+
if ((t > 0 ? s <= i : s < i) && (t < 0 ? f >= i : f > i))
|
|
571
|
+
return new B(n.tree, n.overlay[0].from + this.from, -1, this);
|
|
572
|
+
}
|
|
573
|
+
return this.nextChild(0, 1, e, t, r);
|
|
574
|
+
}
|
|
575
|
+
nextSignificantParent() {
|
|
576
|
+
let e = this;
|
|
577
|
+
for (; e.type.isAnonymous && e._parent; )
|
|
578
|
+
e = e._parent;
|
|
579
|
+
return e;
|
|
580
|
+
}
|
|
581
|
+
get parent() {
|
|
582
|
+
return this._parent ? this._parent.nextSignificantParent() : null;
|
|
583
|
+
}
|
|
584
|
+
get nextSibling() {
|
|
585
|
+
return this._parent && this.index >= 0 ? this._parent.nextChild(
|
|
586
|
+
this.index + 1,
|
|
587
|
+
1,
|
|
588
|
+
0,
|
|
589
|
+
4
|
|
590
|
+
/* Side.DontCare */
|
|
591
|
+
) : null;
|
|
592
|
+
}
|
|
593
|
+
get prevSibling() {
|
|
594
|
+
return this._parent && this.index >= 0 ? this._parent.nextChild(
|
|
595
|
+
this.index - 1,
|
|
596
|
+
-1,
|
|
597
|
+
0,
|
|
598
|
+
4
|
|
599
|
+
/* Side.DontCare */
|
|
600
|
+
) : null;
|
|
601
|
+
}
|
|
602
|
+
get tree() {
|
|
603
|
+
return this._tree;
|
|
604
|
+
}
|
|
605
|
+
toTree() {
|
|
606
|
+
return this._tree;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
@internal
|
|
610
|
+
*/
|
|
611
|
+
toString() {
|
|
612
|
+
return this._tree.toString();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function ue(l, e, t, r) {
|
|
616
|
+
let n = l.cursor(), i = [];
|
|
617
|
+
if (!n.firstChild())
|
|
618
|
+
return i;
|
|
619
|
+
if (t != null) {
|
|
620
|
+
for (let s = !1; !s; )
|
|
621
|
+
if (s = n.type.is(t), !n.nextSibling())
|
|
622
|
+
return i;
|
|
623
|
+
}
|
|
624
|
+
for (; ; ) {
|
|
625
|
+
if (r != null && n.type.is(r))
|
|
626
|
+
return i;
|
|
627
|
+
if (n.type.is(e) && i.push(n.node), !n.nextSibling())
|
|
628
|
+
return r == null ? i : [];
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function re(l, e, t = e.length - 1) {
|
|
632
|
+
for (let r = l; t >= 0; r = r.parent) {
|
|
633
|
+
if (!r)
|
|
634
|
+
return !1;
|
|
635
|
+
if (!r.type.isAnonymous) {
|
|
636
|
+
if (e[t] && e[t] != r.name)
|
|
637
|
+
return !1;
|
|
638
|
+
t--;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return !0;
|
|
642
|
+
}
|
|
643
|
+
class Ae {
|
|
644
|
+
constructor(e, t, r, n) {
|
|
645
|
+
this.parent = e, this.buffer = t, this.index = r, this.start = n;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
class D extends we {
|
|
649
|
+
get name() {
|
|
650
|
+
return this.type.name;
|
|
651
|
+
}
|
|
652
|
+
get from() {
|
|
653
|
+
return this.context.start + this.context.buffer.buffer[this.index + 1];
|
|
654
|
+
}
|
|
655
|
+
get to() {
|
|
656
|
+
return this.context.start + this.context.buffer.buffer[this.index + 2];
|
|
657
|
+
}
|
|
658
|
+
constructor(e, t, r) {
|
|
659
|
+
super(), this.context = e, this._parent = t, this.index = r, this.type = e.buffer.set.types[e.buffer.buffer[r]];
|
|
660
|
+
}
|
|
661
|
+
child(e, t, r) {
|
|
662
|
+
let { buffer: n } = this.context, i = n.findChild(this.index + 4, n.buffer[this.index + 3], e, t - this.context.start, r);
|
|
663
|
+
return i < 0 ? null : new D(this.context, this, i);
|
|
664
|
+
}
|
|
665
|
+
get firstChild() {
|
|
666
|
+
return this.child(
|
|
667
|
+
1,
|
|
668
|
+
0,
|
|
669
|
+
4
|
|
670
|
+
/* Side.DontCare */
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
get lastChild() {
|
|
674
|
+
return this.child(
|
|
675
|
+
-1,
|
|
676
|
+
0,
|
|
677
|
+
4
|
|
678
|
+
/* Side.DontCare */
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
childAfter(e) {
|
|
682
|
+
return this.child(
|
|
683
|
+
1,
|
|
684
|
+
e,
|
|
685
|
+
2
|
|
686
|
+
/* Side.After */
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
childBefore(e) {
|
|
690
|
+
return this.child(
|
|
691
|
+
-1,
|
|
692
|
+
e,
|
|
693
|
+
-2
|
|
694
|
+
/* Side.Before */
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
prop(e) {
|
|
698
|
+
return this.type.prop(e);
|
|
699
|
+
}
|
|
700
|
+
enter(e, t, r = 0) {
|
|
701
|
+
if (r & S.ExcludeBuffers)
|
|
702
|
+
return null;
|
|
703
|
+
let { buffer: n } = this.context, i = n.findChild(this.index + 4, n.buffer[this.index + 3], t > 0 ? 1 : -1, e - this.context.start, t);
|
|
704
|
+
return i < 0 ? null : new D(this.context, this, i);
|
|
705
|
+
}
|
|
706
|
+
get parent() {
|
|
707
|
+
return this._parent || this.context.parent.nextSignificantParent();
|
|
708
|
+
}
|
|
709
|
+
externalSibling(e) {
|
|
710
|
+
return this._parent ? null : this.context.parent.nextChild(
|
|
711
|
+
this.context.index + e,
|
|
712
|
+
e,
|
|
713
|
+
0,
|
|
714
|
+
4
|
|
715
|
+
/* Side.DontCare */
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
get nextSibling() {
|
|
719
|
+
let { buffer: e } = this.context, t = e.buffer[this.index + 3];
|
|
720
|
+
return t < (this._parent ? e.buffer[this._parent.index + 3] : e.buffer.length) ? new D(this.context, this._parent, t) : this.externalSibling(1);
|
|
721
|
+
}
|
|
722
|
+
get prevSibling() {
|
|
723
|
+
let { buffer: e } = this.context, t = this._parent ? this._parent.index + 4 : 0;
|
|
724
|
+
return this.index == t ? this.externalSibling(-1) : new D(this.context, this._parent, e.findChild(
|
|
725
|
+
t,
|
|
726
|
+
this.index,
|
|
727
|
+
-1,
|
|
728
|
+
0,
|
|
729
|
+
4
|
|
730
|
+
/* Side.DontCare */
|
|
731
|
+
));
|
|
732
|
+
}
|
|
733
|
+
get tree() {
|
|
734
|
+
return null;
|
|
735
|
+
}
|
|
736
|
+
toTree() {
|
|
737
|
+
let e = [], t = [], { buffer: r } = this.context, n = this.index + 4, i = r.buffer[this.index + 3];
|
|
738
|
+
if (i > n) {
|
|
739
|
+
let s = r.buffer[this.index + 1];
|
|
740
|
+
e.push(r.slice(n, i, s)), t.push(0);
|
|
741
|
+
}
|
|
742
|
+
return new z(this.type, e, t, this.to - this.from);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
@internal
|
|
746
|
+
*/
|
|
747
|
+
toString() {
|
|
748
|
+
return this.context.buffer.childString(this.index);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function ve(l) {
|
|
752
|
+
if (!l.length)
|
|
753
|
+
return null;
|
|
754
|
+
let e = 0, t = l[0];
|
|
755
|
+
for (let i = 1; i < l.length; i++) {
|
|
756
|
+
let s = l[i];
|
|
757
|
+
(s.from > t.from || s.to < t.to) && (t = s, e = i);
|
|
758
|
+
}
|
|
759
|
+
let r = t instanceof B && t.index < 0 ? null : t.parent, n = l.slice();
|
|
760
|
+
return r ? n[e] = r : n.splice(e, 1), new Se(n, t);
|
|
761
|
+
}
|
|
762
|
+
class Se {
|
|
763
|
+
constructor(e, t) {
|
|
764
|
+
this.heads = e, this.node = t;
|
|
765
|
+
}
|
|
766
|
+
get next() {
|
|
767
|
+
return ve(this.heads);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
function _e(l, e, t) {
|
|
771
|
+
let r = l.resolveInner(e, t), n = null;
|
|
772
|
+
for (let i = r instanceof B ? r : r.context.parent; i; i = i.parent)
|
|
773
|
+
if (i.index < 0) {
|
|
774
|
+
let s = i.parent;
|
|
775
|
+
(n || (n = [r])).push(s.resolve(e, t)), i = s;
|
|
776
|
+
} else {
|
|
777
|
+
let s = q.get(i.tree);
|
|
778
|
+
if (s && s.overlay && s.overlay[0].from <= e && s.overlay[s.overlay.length - 1].to >= e) {
|
|
779
|
+
let f = new B(s.tree, s.overlay[0].from + i.from, -1, i);
|
|
780
|
+
(n || (n = [r])).push(K(f, e, t, !1));
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return n ? ve(n) : r;
|
|
784
|
+
}
|
|
785
|
+
class te {
|
|
786
|
+
/**
|
|
787
|
+
Shorthand for `.type.name`.
|
|
788
|
+
*/
|
|
789
|
+
get name() {
|
|
790
|
+
return this.type.name;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
@internal
|
|
794
|
+
*/
|
|
795
|
+
constructor(e, t = 0) {
|
|
796
|
+
if (this.mode = t, this.buffer = null, this.stack = [], this.index = 0, this.bufferNode = null, e instanceof B)
|
|
797
|
+
this.yieldNode(e);
|
|
798
|
+
else {
|
|
799
|
+
this._tree = e.context.parent, this.buffer = e.context;
|
|
800
|
+
for (let r = e._parent; r; r = r._parent)
|
|
801
|
+
this.stack.unshift(r.index);
|
|
802
|
+
this.bufferNode = e, this.yieldBuf(e.index);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
yieldNode(e) {
|
|
806
|
+
return e ? (this._tree = e, this.type = e.type, this.from = e.from, this.to = e.to, !0) : !1;
|
|
807
|
+
}
|
|
808
|
+
yieldBuf(e, t) {
|
|
809
|
+
this.index = e;
|
|
810
|
+
let { start: r, buffer: n } = this.buffer;
|
|
811
|
+
return this.type = t || n.set.types[n.buffer[e]], this.from = r + n.buffer[e + 1], this.to = r + n.buffer[e + 2], !0;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
@internal
|
|
815
|
+
*/
|
|
816
|
+
yield(e) {
|
|
817
|
+
return e ? e instanceof B ? (this.buffer = null, this.yieldNode(e)) : (this.buffer = e.context, this.yieldBuf(e.index, e.type)) : !1;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
@internal
|
|
821
|
+
*/
|
|
822
|
+
toString() {
|
|
823
|
+
return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
@internal
|
|
827
|
+
*/
|
|
828
|
+
enterChild(e, t, r) {
|
|
829
|
+
if (!this.buffer)
|
|
830
|
+
return this.yield(this._tree.nextChild(e < 0 ? this._tree._tree.children.length - 1 : 0, e, t, r, this.mode));
|
|
831
|
+
let { buffer: n } = this.buffer, i = n.findChild(this.index + 4, n.buffer[this.index + 3], e, t - this.buffer.start, r);
|
|
832
|
+
return i < 0 ? !1 : (this.stack.push(this.index), this.yieldBuf(i));
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
Move the cursor to this node's first child. When this returns
|
|
836
|
+
false, the node has no child, and the cursor has not been moved.
|
|
837
|
+
*/
|
|
838
|
+
firstChild() {
|
|
839
|
+
return this.enterChild(
|
|
840
|
+
1,
|
|
841
|
+
0,
|
|
842
|
+
4
|
|
843
|
+
/* Side.DontCare */
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
Move the cursor to this node's last child.
|
|
848
|
+
*/
|
|
849
|
+
lastChild() {
|
|
850
|
+
return this.enterChild(
|
|
851
|
+
-1,
|
|
852
|
+
0,
|
|
853
|
+
4
|
|
854
|
+
/* Side.DontCare */
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
Move the cursor to the first child that ends after `pos`.
|
|
859
|
+
*/
|
|
860
|
+
childAfter(e) {
|
|
861
|
+
return this.enterChild(
|
|
862
|
+
1,
|
|
863
|
+
e,
|
|
864
|
+
2
|
|
865
|
+
/* Side.After */
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
Move to the last child that starts before `pos`.
|
|
870
|
+
*/
|
|
871
|
+
childBefore(e) {
|
|
872
|
+
return this.enterChild(
|
|
873
|
+
-1,
|
|
874
|
+
e,
|
|
875
|
+
-2
|
|
876
|
+
/* Side.Before */
|
|
877
|
+
);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
Move the cursor to the child around `pos`. If side is -1 the
|
|
881
|
+
child may end at that position, when 1 it may start there. This
|
|
882
|
+
will also enter [overlaid](#common.MountedTree.overlay)
|
|
883
|
+
[mounted](#common.NodeProp^mounted) trees unless `overlays` is
|
|
884
|
+
set to false.
|
|
885
|
+
*/
|
|
886
|
+
enter(e, t, r = this.mode) {
|
|
887
|
+
return this.buffer ? r & S.ExcludeBuffers ? !1 : this.enterChild(1, e, t) : this.yield(this._tree.enter(e, t, r));
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
Move to the node's parent node, if this isn't the top node.
|
|
891
|
+
*/
|
|
892
|
+
parent() {
|
|
893
|
+
if (!this.buffer)
|
|
894
|
+
return this.yieldNode(this.mode & S.IncludeAnonymous ? this._tree._parent : this._tree.parent);
|
|
895
|
+
if (this.stack.length)
|
|
896
|
+
return this.yieldBuf(this.stack.pop());
|
|
897
|
+
let e = this.mode & S.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent();
|
|
898
|
+
return this.buffer = null, this.yieldNode(e);
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
@internal
|
|
902
|
+
*/
|
|
903
|
+
sibling(e) {
|
|
904
|
+
if (!this.buffer)
|
|
905
|
+
return this._tree._parent ? this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + e, e, 0, 4, this.mode)) : !1;
|
|
906
|
+
let { buffer: t } = this.buffer, r = this.stack.length - 1;
|
|
907
|
+
if (e < 0) {
|
|
908
|
+
let n = r < 0 ? 0 : this.stack[r] + 4;
|
|
909
|
+
if (this.index != n)
|
|
910
|
+
return this.yieldBuf(t.findChild(
|
|
911
|
+
n,
|
|
912
|
+
this.index,
|
|
913
|
+
-1,
|
|
914
|
+
0,
|
|
915
|
+
4
|
|
916
|
+
/* Side.DontCare */
|
|
917
|
+
));
|
|
918
|
+
} else {
|
|
919
|
+
let n = t.buffer[this.index + 3];
|
|
920
|
+
if (n < (r < 0 ? t.buffer.length : t.buffer[this.stack[r] + 3]))
|
|
921
|
+
return this.yieldBuf(n);
|
|
922
|
+
}
|
|
923
|
+
return r < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + e, e, 0, 4, this.mode)) : !1;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
Move to this node's next sibling, if any.
|
|
927
|
+
*/
|
|
928
|
+
nextSibling() {
|
|
929
|
+
return this.sibling(1);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
Move to this node's previous sibling, if any.
|
|
933
|
+
*/
|
|
934
|
+
prevSibling() {
|
|
935
|
+
return this.sibling(-1);
|
|
936
|
+
}
|
|
937
|
+
atLastNode(e) {
|
|
938
|
+
let t, r, { buffer: n } = this;
|
|
939
|
+
if (n) {
|
|
940
|
+
if (e > 0) {
|
|
941
|
+
if (this.index < n.buffer.buffer.length)
|
|
942
|
+
return !1;
|
|
943
|
+
} else
|
|
944
|
+
for (let i = 0; i < this.index; i++)
|
|
945
|
+
if (n.buffer.buffer[i + 3] < this.index)
|
|
946
|
+
return !1;
|
|
947
|
+
({ index: t, parent: r } = n);
|
|
948
|
+
} else
|
|
949
|
+
({ index: t, _parent: r } = this._tree);
|
|
950
|
+
for (; r; { index: t, _parent: r } = r)
|
|
951
|
+
if (t > -1)
|
|
952
|
+
for (let i = t + e, s = e < 0 ? -1 : r._tree.children.length; i != s; i += e) {
|
|
953
|
+
let f = r._tree.children[i];
|
|
954
|
+
if (this.mode & S.IncludeAnonymous || f instanceof H || !f.type.isAnonymous || se(f))
|
|
955
|
+
return !1;
|
|
956
|
+
}
|
|
957
|
+
return !0;
|
|
958
|
+
}
|
|
959
|
+
move(e, t) {
|
|
960
|
+
if (t && this.enterChild(
|
|
961
|
+
e,
|
|
962
|
+
0,
|
|
963
|
+
4
|
|
964
|
+
/* Side.DontCare */
|
|
965
|
+
))
|
|
966
|
+
return !0;
|
|
967
|
+
for (; ; ) {
|
|
968
|
+
if (this.sibling(e))
|
|
969
|
+
return !0;
|
|
970
|
+
if (this.atLastNode(e) || !this.parent())
|
|
971
|
+
return !1;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
Move to the next node in a
|
|
976
|
+
[pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)
|
|
977
|
+
traversal, going from a node to its first child or, if the
|
|
978
|
+
current node is empty or `enter` is false, its next sibling or
|
|
979
|
+
the next sibling of the first parent node that has one.
|
|
980
|
+
*/
|
|
981
|
+
next(e = !0) {
|
|
982
|
+
return this.move(1, e);
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
Move to the next node in a last-to-first pre-order traversal. A
|
|
986
|
+
node is followed by its last child or, if it has none, its
|
|
987
|
+
previous sibling or the previous sibling of the first parent
|
|
988
|
+
node that has one.
|
|
989
|
+
*/
|
|
990
|
+
prev(e = !0) {
|
|
991
|
+
return this.move(-1, e);
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
Move the cursor to the innermost node that covers `pos`. If
|
|
995
|
+
`side` is -1, it will enter nodes that end at `pos`. If it is 1,
|
|
996
|
+
it will enter nodes that start at `pos`.
|
|
997
|
+
*/
|
|
998
|
+
moveTo(e, t = 0) {
|
|
999
|
+
for (; (this.from == this.to || (t < 1 ? this.from >= e : this.from > e) || (t > -1 ? this.to <= e : this.to < e)) && this.parent(); )
|
|
1000
|
+
;
|
|
1001
|
+
for (; this.enterChild(1, e, t); )
|
|
1002
|
+
;
|
|
1003
|
+
return this;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
Get a [syntax node](#common.SyntaxNode) at the cursor's current
|
|
1007
|
+
position.
|
|
1008
|
+
*/
|
|
1009
|
+
get node() {
|
|
1010
|
+
if (!this.buffer)
|
|
1011
|
+
return this._tree;
|
|
1012
|
+
let e = this.bufferNode, t = null, r = 0;
|
|
1013
|
+
if (e && e.context == this.buffer)
|
|
1014
|
+
e: for (let n = this.index, i = this.stack.length; i >= 0; ) {
|
|
1015
|
+
for (let s = e; s; s = s._parent)
|
|
1016
|
+
if (s.index == n) {
|
|
1017
|
+
if (n == this.index)
|
|
1018
|
+
return s;
|
|
1019
|
+
t = s, r = i + 1;
|
|
1020
|
+
break e;
|
|
1021
|
+
}
|
|
1022
|
+
n = this.stack[--i];
|
|
1023
|
+
}
|
|
1024
|
+
for (let n = r; n < this.stack.length; n++)
|
|
1025
|
+
t = new D(this.buffer, t, this.stack[n]);
|
|
1026
|
+
return this.bufferNode = new D(this.buffer, t, this.index);
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
Get the [tree](#common.Tree) that represents the current node, if
|
|
1030
|
+
any. Will return null when the node is in a [tree
|
|
1031
|
+
buffer](#common.TreeBuffer).
|
|
1032
|
+
*/
|
|
1033
|
+
get tree() {
|
|
1034
|
+
return this.buffer ? null : this._tree._tree;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
Iterate over the current node and all its descendants, calling
|
|
1038
|
+
`enter` when entering a node and `leave`, if given, when leaving
|
|
1039
|
+
one. When `enter` returns `false`, any children of that node are
|
|
1040
|
+
skipped, and `leave` isn't called for it.
|
|
1041
|
+
*/
|
|
1042
|
+
iterate(e, t) {
|
|
1043
|
+
for (let r = 0; ; ) {
|
|
1044
|
+
let n = !1;
|
|
1045
|
+
if (this.type.isAnonymous || e(this) !== !1) {
|
|
1046
|
+
if (this.firstChild()) {
|
|
1047
|
+
r++;
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
this.type.isAnonymous || (n = !0);
|
|
1051
|
+
}
|
|
1052
|
+
for (; ; ) {
|
|
1053
|
+
if (n && t && t(this), n = this.type.isAnonymous, !r)
|
|
1054
|
+
return;
|
|
1055
|
+
if (this.nextSibling())
|
|
1056
|
+
break;
|
|
1057
|
+
this.parent(), r--, n = !0;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
Test whether the current node matches a given context—a sequence
|
|
1063
|
+
of direct parent node names. Empty strings in the context array
|
|
1064
|
+
are treated as wildcards.
|
|
1065
|
+
*/
|
|
1066
|
+
matchContext(e) {
|
|
1067
|
+
if (!this.buffer)
|
|
1068
|
+
return re(this.node.parent, e);
|
|
1069
|
+
let { buffer: t } = this.buffer, { types: r } = t.set;
|
|
1070
|
+
for (let n = e.length - 1, i = this.stack.length - 1; n >= 0; i--) {
|
|
1071
|
+
if (i < 0)
|
|
1072
|
+
return re(this._tree, e, n);
|
|
1073
|
+
let s = r[t.buffer[this.stack[i]]];
|
|
1074
|
+
if (!s.isAnonymous) {
|
|
1075
|
+
if (e[n] && e[n] != s.name)
|
|
1076
|
+
return !1;
|
|
1077
|
+
n--;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
return !0;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function se(l) {
|
|
1084
|
+
return l.children.some((e) => e instanceof H || !e.type.isAnonymous || se(e));
|
|
1085
|
+
}
|
|
1086
|
+
function Ie(l) {
|
|
1087
|
+
var e;
|
|
1088
|
+
let { buffer: t, nodeSet: r, maxBufferLength: n = 1024, reused: i = [], minRepeatType: s = r.types.length } = l, f = Array.isArray(t) ? new ie(t, t.length) : t, o = r.types, u = 0, h = 0;
|
|
1089
|
+
function c(m, w, a, C, x, A) {
|
|
1090
|
+
let { id: g, start: p, end: b, size: v } = f, N = h, U = u;
|
|
1091
|
+
if (v < 0)
|
|
1092
|
+
if (f.next(), v == -1) {
|
|
1093
|
+
let W = i[g];
|
|
1094
|
+
a.push(W), C.push(p - m);
|
|
1095
|
+
return;
|
|
1096
|
+
} else if (v == -3) {
|
|
1097
|
+
u = g;
|
|
1098
|
+
return;
|
|
1099
|
+
} else if (v == -4) {
|
|
1100
|
+
h = g;
|
|
1101
|
+
return;
|
|
1102
|
+
} else
|
|
1103
|
+
throw new RangeError(`Unrecognized record size: ${v}`);
|
|
1104
|
+
let $ = o[g], X, J, fe = p - m;
|
|
1105
|
+
if (b - p <= n && (J = O(f.pos - w, x))) {
|
|
1106
|
+
let W = new Uint16Array(J.size - J.skip), M = f.pos - J.size, R = W.length;
|
|
1107
|
+
for (; f.pos > M; )
|
|
1108
|
+
R = F(J.start, W, R);
|
|
1109
|
+
X = new H(W, b - J.start, r), fe = J.start - m;
|
|
1110
|
+
} else {
|
|
1111
|
+
let W = f.pos - v;
|
|
1112
|
+
f.next();
|
|
1113
|
+
let M = [], R = [], V = g >= s ? g : -1, G = 0, Y = b;
|
|
1114
|
+
for (; f.pos > W; )
|
|
1115
|
+
V >= 0 && f.id == V && f.size >= 0 ? (f.end <= Y - n && (_(M, R, p, G, f.end, Y, V, N, U), G = M.length, Y = f.end), f.next()) : A > 2500 ? d(p, W, M, R) : c(p, W, M, R, V, A + 1);
|
|
1116
|
+
if (V >= 0 && G > 0 && G < M.length && _(M, R, p, G, p, Y, V, N, U), M.reverse(), R.reverse(), V > -1 && G > 0) {
|
|
1117
|
+
let oe = y($, U);
|
|
1118
|
+
X = le($, M, R, 0, M.length, 0, b - p, oe, oe);
|
|
1119
|
+
} else
|
|
1120
|
+
X = P($, M, R, b - p, N - b, U);
|
|
1121
|
+
}
|
|
1122
|
+
a.push(X), C.push(fe);
|
|
1123
|
+
}
|
|
1124
|
+
function d(m, w, a, C) {
|
|
1125
|
+
let x = [], A = 0, g = -1;
|
|
1126
|
+
for (; f.pos > w; ) {
|
|
1127
|
+
let { id: p, start: b, end: v, size: N } = f;
|
|
1128
|
+
if (N > 4)
|
|
1129
|
+
f.next();
|
|
1130
|
+
else {
|
|
1131
|
+
if (g > -1 && b < g)
|
|
1132
|
+
break;
|
|
1133
|
+
g < 0 && (g = v - n), x.push(p, b, v), A++, f.next();
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
if (A) {
|
|
1137
|
+
let p = new Uint16Array(A * 4), b = x[x.length - 2];
|
|
1138
|
+
for (let v = x.length - 3, N = 0; v >= 0; v -= 3)
|
|
1139
|
+
p[N++] = x[v], p[N++] = x[v + 1] - b, p[N++] = x[v + 2] - b, p[N++] = N;
|
|
1140
|
+
a.push(new H(p, x[2] - b, r)), C.push(b - m);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function y(m, w) {
|
|
1144
|
+
return (a, C, x) => {
|
|
1145
|
+
let A = 0, g = a.length - 1, p, b;
|
|
1146
|
+
if (g >= 0 && (p = a[g]) instanceof z) {
|
|
1147
|
+
if (!g && p.type == m && p.length == x)
|
|
1148
|
+
return p;
|
|
1149
|
+
(b = p.prop(k.lookAhead)) && (A = C[g] + p.length + b);
|
|
1150
|
+
}
|
|
1151
|
+
return P(m, a, C, x, A, w);
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function _(m, w, a, C, x, A, g, p, b) {
|
|
1155
|
+
let v = [], N = [];
|
|
1156
|
+
for (; m.length > C; )
|
|
1157
|
+
v.push(m.pop()), N.push(w.pop() + a - x);
|
|
1158
|
+
m.push(P(r.types[g], v, N, A - x, p - A, b)), w.push(x - a);
|
|
1159
|
+
}
|
|
1160
|
+
function P(m, w, a, C, x, A, g) {
|
|
1161
|
+
if (A) {
|
|
1162
|
+
let p = [k.contextHash, A];
|
|
1163
|
+
g = g ? [p].concat(g) : [p];
|
|
1164
|
+
}
|
|
1165
|
+
if (x > 25) {
|
|
1166
|
+
let p = [k.lookAhead, x];
|
|
1167
|
+
g = g ? [p].concat(g) : [p];
|
|
1168
|
+
}
|
|
1169
|
+
return new z(m, w, a, C, g);
|
|
1170
|
+
}
|
|
1171
|
+
function O(m, w) {
|
|
1172
|
+
let a = f.fork(), C = 0, x = 0, A = 0, g = a.end - n, p = { size: 0, start: 0, skip: 0 };
|
|
1173
|
+
e: for (let b = a.pos - m; a.pos > b; ) {
|
|
1174
|
+
let v = a.size;
|
|
1175
|
+
if (a.id == w && v >= 0) {
|
|
1176
|
+
p.size = C, p.start = x, p.skip = A, A += 4, C += 4, a.next();
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
let N = a.pos - v;
|
|
1180
|
+
if (v < 0 || N < b || a.start < g)
|
|
1181
|
+
break;
|
|
1182
|
+
let U = a.id >= s ? 4 : 0, $ = a.start;
|
|
1183
|
+
for (a.next(); a.pos > N; ) {
|
|
1184
|
+
if (a.size < 0)
|
|
1185
|
+
if (a.size == -3 || a.size == -4)
|
|
1186
|
+
U += 4;
|
|
1187
|
+
else
|
|
1188
|
+
break e;
|
|
1189
|
+
else a.id >= s && (U += 4);
|
|
1190
|
+
a.next();
|
|
1191
|
+
}
|
|
1192
|
+
x = $, C += v, A += U;
|
|
1193
|
+
}
|
|
1194
|
+
return (w < 0 || C == m) && (p.size = C, p.start = x, p.skip = A), p.size > 4 ? p : void 0;
|
|
1195
|
+
}
|
|
1196
|
+
function F(m, w, a) {
|
|
1197
|
+
let { id: C, start: x, end: A, size: g } = f;
|
|
1198
|
+
if (f.next(), g >= 0 && C < s) {
|
|
1199
|
+
let p = a;
|
|
1200
|
+
if (g > 4) {
|
|
1201
|
+
let b = f.pos - (g - 4);
|
|
1202
|
+
for (; f.pos > b; )
|
|
1203
|
+
a = F(m, w, a);
|
|
1204
|
+
}
|
|
1205
|
+
w[--a] = p, w[--a] = A - m, w[--a] = x - m, w[--a] = C;
|
|
1206
|
+
} else g == -3 ? u = C : g == -4 && (h = C);
|
|
1207
|
+
return a;
|
|
1208
|
+
}
|
|
1209
|
+
let E = [], I = [];
|
|
1210
|
+
for (; f.pos > 0; )
|
|
1211
|
+
c(l.start || 0, l.bufferStart || 0, E, I, -1, 0);
|
|
1212
|
+
let L = (e = l.length) !== null && e !== void 0 ? e : E.length ? I[0] + E[0].length : 0;
|
|
1213
|
+
return new z(o[l.topID], E.reverse(), I.reverse(), L);
|
|
1214
|
+
}
|
|
1215
|
+
const ae = /* @__PURE__ */ new WeakMap();
|
|
1216
|
+
function ee(l, e) {
|
|
1217
|
+
if (!l.isAnonymous || e instanceof H || e.type != l)
|
|
1218
|
+
return 1;
|
|
1219
|
+
let t = ae.get(e);
|
|
1220
|
+
if (t == null) {
|
|
1221
|
+
t = 1;
|
|
1222
|
+
for (let r of e.children) {
|
|
1223
|
+
if (r.type != l || !(r instanceof z)) {
|
|
1224
|
+
t = 1;
|
|
1225
|
+
break;
|
|
1226
|
+
}
|
|
1227
|
+
t += ee(l, r);
|
|
1228
|
+
}
|
|
1229
|
+
ae.set(e, t);
|
|
1230
|
+
}
|
|
1231
|
+
return t;
|
|
1232
|
+
}
|
|
1233
|
+
function le(l, e, t, r, n, i, s, f, o) {
|
|
1234
|
+
let u = 0;
|
|
1235
|
+
for (let _ = r; _ < n; _++)
|
|
1236
|
+
u += ee(l, e[_]);
|
|
1237
|
+
let h = Math.ceil(
|
|
1238
|
+
u * 1.5 / 8
|
|
1239
|
+
/* Balance.BranchFactor */
|
|
1240
|
+
), c = [], d = [];
|
|
1241
|
+
function y(_, P, O, F, E) {
|
|
1242
|
+
for (let I = O; I < F; ) {
|
|
1243
|
+
let L = I, m = P[I], w = ee(l, _[I]);
|
|
1244
|
+
for (I++; I < F; I++) {
|
|
1245
|
+
let a = ee(l, _[I]);
|
|
1246
|
+
if (w + a >= h)
|
|
1247
|
+
break;
|
|
1248
|
+
w += a;
|
|
1249
|
+
}
|
|
1250
|
+
if (I == L + 1) {
|
|
1251
|
+
if (w > h) {
|
|
1252
|
+
let a = _[L];
|
|
1253
|
+
y(a.children, a.positions, 0, a.children.length, P[L] + E);
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
c.push(_[L]);
|
|
1257
|
+
} else {
|
|
1258
|
+
let a = P[I - 1] + _[I - 1].length - m;
|
|
1259
|
+
c.push(le(l, _, P, L, I, m, a, null, o));
|
|
1260
|
+
}
|
|
1261
|
+
d.push(m + E - i);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
return y(e, t, r, n, 0), (f || o)(c, d, s);
|
|
1265
|
+
}
|
|
1266
|
+
class Fe {
|
|
1267
|
+
constructor() {
|
|
1268
|
+
this.map = /* @__PURE__ */ new WeakMap();
|
|
1269
|
+
}
|
|
1270
|
+
setBuffer(e, t, r) {
|
|
1271
|
+
let n = this.map.get(e);
|
|
1272
|
+
n || this.map.set(e, n = /* @__PURE__ */ new Map()), n.set(t, r);
|
|
1273
|
+
}
|
|
1274
|
+
getBuffer(e, t) {
|
|
1275
|
+
let r = this.map.get(e);
|
|
1276
|
+
return r && r.get(t);
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
Set the value for this syntax node.
|
|
1280
|
+
*/
|
|
1281
|
+
set(e, t) {
|
|
1282
|
+
e instanceof D ? this.setBuffer(e.context.buffer, e.index, t) : e instanceof B && this.map.set(e.tree, t);
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
Retrieve value for this syntax node, if it exists in the map.
|
|
1286
|
+
*/
|
|
1287
|
+
get(e) {
|
|
1288
|
+
return e instanceof D ? this.getBuffer(e.context.buffer, e.index) : e instanceof B ? this.map.get(e.tree) : void 0;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
Set the value for the node that a cursor currently points to.
|
|
1292
|
+
*/
|
|
1293
|
+
cursorSet(e, t) {
|
|
1294
|
+
e.buffer ? this.setBuffer(e.buffer.buffer, e.index, t) : this.map.set(e.tree, t);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
Retrieve the value for the node that a cursor currently points
|
|
1298
|
+
to.
|
|
1299
|
+
*/
|
|
1300
|
+
cursorGet(e) {
|
|
1301
|
+
return e.buffer ? this.getBuffer(e.buffer.buffer, e.index) : this.map.get(e.tree);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
class Q {
|
|
1305
|
+
/**
|
|
1306
|
+
Construct a tree fragment. You'll usually want to use
|
|
1307
|
+
[`addTree`](#common.TreeFragment^addTree) and
|
|
1308
|
+
[`applyChanges`](#common.TreeFragment^applyChanges) instead of
|
|
1309
|
+
calling this directly.
|
|
1310
|
+
*/
|
|
1311
|
+
constructor(e, t, r, n, i = !1, s = !1) {
|
|
1312
|
+
this.from = e, this.to = t, this.tree = r, this.offset = n, this.open = (i ? 1 : 0) | (s ? 2 : 0);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
Whether the start of the fragment represents the start of a
|
|
1316
|
+
parse, or the end of a change. (In the second case, it may not
|
|
1317
|
+
be safe to reuse some nodes at the start, depending on the
|
|
1318
|
+
parsing algorithm.)
|
|
1319
|
+
*/
|
|
1320
|
+
get openStart() {
|
|
1321
|
+
return (this.open & 1) > 0;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
Whether the end of the fragment represents the end of a
|
|
1325
|
+
full-document parse, or the start of a change.
|
|
1326
|
+
*/
|
|
1327
|
+
get openEnd() {
|
|
1328
|
+
return (this.open & 2) > 0;
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
Create a set of fragments from a freshly parsed tree, or update
|
|
1332
|
+
an existing set of fragments by replacing the ones that overlap
|
|
1333
|
+
with a tree with content from the new tree. When `partial` is
|
|
1334
|
+
true, the parse is treated as incomplete, and the resulting
|
|
1335
|
+
fragment has [`openEnd`](#common.TreeFragment.openEnd) set to
|
|
1336
|
+
true.
|
|
1337
|
+
*/
|
|
1338
|
+
static addTree(e, t = [], r = !1) {
|
|
1339
|
+
let n = [new Q(0, e.length, e, 0, !1, r)];
|
|
1340
|
+
for (let i of t)
|
|
1341
|
+
i.to > e.length && n.push(i);
|
|
1342
|
+
return n;
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
Apply a set of edits to an array of fragments, removing or
|
|
1346
|
+
splitting fragments as necessary to remove edited ranges, and
|
|
1347
|
+
adjusting offsets for fragments that moved.
|
|
1348
|
+
*/
|
|
1349
|
+
static applyChanges(e, t, r = 128) {
|
|
1350
|
+
if (!t.length)
|
|
1351
|
+
return e;
|
|
1352
|
+
let n = [], i = 1, s = e.length ? e[0] : null;
|
|
1353
|
+
for (let f = 0, o = 0, u = 0; ; f++) {
|
|
1354
|
+
let h = f < t.length ? t[f] : null, c = h ? h.fromA : 1e9;
|
|
1355
|
+
if (c - o >= r)
|
|
1356
|
+
for (; s && s.from < c; ) {
|
|
1357
|
+
let d = s;
|
|
1358
|
+
if (o >= d.from || c <= d.to || u) {
|
|
1359
|
+
let y = Math.max(d.from, o) - u, _ = Math.min(d.to, c) - u;
|
|
1360
|
+
d = y >= _ ? null : new Q(y, _, d.tree, d.offset + u, f > 0, !!h);
|
|
1361
|
+
}
|
|
1362
|
+
if (d && n.push(d), s.to > c)
|
|
1363
|
+
break;
|
|
1364
|
+
s = i < e.length ? e[i++] : null;
|
|
1365
|
+
}
|
|
1366
|
+
if (!h)
|
|
1367
|
+
break;
|
|
1368
|
+
o = h.toA, u = h.toA - h.toB;
|
|
1369
|
+
}
|
|
1370
|
+
return n;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
class je {
|
|
1374
|
+
/**
|
|
1375
|
+
Start a parse, returning a [partial parse](#common.PartialParse)
|
|
1376
|
+
object. [`fragments`](#common.TreeFragment) can be passed in to
|
|
1377
|
+
make the parse incremental.
|
|
1378
|
+
|
|
1379
|
+
By default, the entire input is parsed. You can pass `ranges`,
|
|
1380
|
+
which should be a sorted array of non-empty, non-overlapping
|
|
1381
|
+
ranges, to parse only those ranges. The tree returned in that
|
|
1382
|
+
case will start at `ranges[0].from`.
|
|
1383
|
+
*/
|
|
1384
|
+
startParse(e, t, r) {
|
|
1385
|
+
return typeof e == "string" && (e = new Ne(e)), r = r ? r.length ? r.map((n) => new T(n.from, n.to)) : [new T(0, 0)] : [new T(0, e.length)], this.createParse(e, t || [], r);
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
Run a full parse, returning the resulting tree.
|
|
1389
|
+
*/
|
|
1390
|
+
parse(e, t, r) {
|
|
1391
|
+
let n = this.startParse(e, t, r);
|
|
1392
|
+
for (; ; ) {
|
|
1393
|
+
let i = n.advance();
|
|
1394
|
+
if (i)
|
|
1395
|
+
return i;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
class Ne {
|
|
1400
|
+
constructor(e) {
|
|
1401
|
+
this.string = e;
|
|
1402
|
+
}
|
|
1403
|
+
get length() {
|
|
1404
|
+
return this.string.length;
|
|
1405
|
+
}
|
|
1406
|
+
chunk(e) {
|
|
1407
|
+
return this.string.slice(e);
|
|
1408
|
+
}
|
|
1409
|
+
get lineChunks() {
|
|
1410
|
+
return !1;
|
|
1411
|
+
}
|
|
1412
|
+
read(e, t) {
|
|
1413
|
+
return this.string.slice(e, t);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
function Re(l) {
|
|
1417
|
+
return (e, t, r, n) => new Be(e, l, t, r, n);
|
|
1418
|
+
}
|
|
1419
|
+
class pe {
|
|
1420
|
+
constructor(e, t, r, n, i) {
|
|
1421
|
+
this.parser = e, this.parse = t, this.overlay = r, this.target = n, this.from = i;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
function de(l) {
|
|
1425
|
+
if (!l.length || l.some((e) => e.from >= e.to))
|
|
1426
|
+
throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(l));
|
|
1427
|
+
}
|
|
1428
|
+
class Pe {
|
|
1429
|
+
constructor(e, t, r, n, i, s, f) {
|
|
1430
|
+
this.parser = e, this.predicate = t, this.mounts = r, this.index = n, this.start = i, this.target = s, this.prev = f, this.depth = 0, this.ranges = [];
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
const ne = new k({ perNode: !0 });
|
|
1434
|
+
class Be {
|
|
1435
|
+
constructor(e, t, r, n, i) {
|
|
1436
|
+
this.nest = t, this.input = r, this.fragments = n, this.ranges = i, this.inner = [], this.innerDone = 0, this.baseTree = null, this.stoppedAt = null, this.baseParse = e;
|
|
1437
|
+
}
|
|
1438
|
+
advance() {
|
|
1439
|
+
if (this.baseParse) {
|
|
1440
|
+
let r = this.baseParse.advance();
|
|
1441
|
+
if (!r)
|
|
1442
|
+
return null;
|
|
1443
|
+
if (this.baseParse = null, this.baseTree = r, this.startInner(), this.stoppedAt != null)
|
|
1444
|
+
for (let n of this.inner)
|
|
1445
|
+
n.parse.stopAt(this.stoppedAt);
|
|
1446
|
+
}
|
|
1447
|
+
if (this.innerDone == this.inner.length) {
|
|
1448
|
+
let r = this.baseTree;
|
|
1449
|
+
return this.stoppedAt != null && (r = new z(r.type, r.children, r.positions, r.length, r.propValues.concat([[ne, this.stoppedAt]]))), r;
|
|
1450
|
+
}
|
|
1451
|
+
let e = this.inner[this.innerDone], t = e.parse.advance();
|
|
1452
|
+
if (t) {
|
|
1453
|
+
this.innerDone++;
|
|
1454
|
+
let r = Object.assign(/* @__PURE__ */ Object.create(null), e.target.props);
|
|
1455
|
+
r[k.mounted.id] = new q(t, e.overlay, e.parser), e.target.props = r;
|
|
1456
|
+
}
|
|
1457
|
+
return null;
|
|
1458
|
+
}
|
|
1459
|
+
get parsedPos() {
|
|
1460
|
+
if (this.baseParse)
|
|
1461
|
+
return 0;
|
|
1462
|
+
let e = this.input.length;
|
|
1463
|
+
for (let t = this.innerDone; t < this.inner.length; t++)
|
|
1464
|
+
this.inner[t].from < e && (e = Math.min(e, this.inner[t].parse.parsedPos));
|
|
1465
|
+
return e;
|
|
1466
|
+
}
|
|
1467
|
+
stopAt(e) {
|
|
1468
|
+
if (this.stoppedAt = e, this.baseParse)
|
|
1469
|
+
this.baseParse.stopAt(e);
|
|
1470
|
+
else
|
|
1471
|
+
for (let t = this.innerDone; t < this.inner.length; t++)
|
|
1472
|
+
this.inner[t].parse.stopAt(e);
|
|
1473
|
+
}
|
|
1474
|
+
startInner() {
|
|
1475
|
+
let e = new Me(this.fragments), t = null, r = null, n = new te(new B(this.baseTree, this.ranges[0].from, 0, null), S.IncludeAnonymous | S.IgnoreMounts);
|
|
1476
|
+
e: for (let i, s; ; ) {
|
|
1477
|
+
let f = !0, o;
|
|
1478
|
+
if (this.stoppedAt != null && n.from >= this.stoppedAt)
|
|
1479
|
+
f = !1;
|
|
1480
|
+
else if (e.hasNode(n)) {
|
|
1481
|
+
if (t) {
|
|
1482
|
+
let u = t.mounts.find((h) => h.frag.from <= n.from && h.frag.to >= n.to && h.mount.overlay);
|
|
1483
|
+
if (u)
|
|
1484
|
+
for (let h of u.mount.overlay) {
|
|
1485
|
+
let c = h.from + u.pos, d = h.to + u.pos;
|
|
1486
|
+
c >= n.from && d <= n.to && !t.ranges.some((y) => y.from < d && y.to > c) && t.ranges.push({ from: c, to: d });
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
f = !1;
|
|
1490
|
+
} else if (r && (s = ze(r.ranges, n.from, n.to)))
|
|
1491
|
+
f = s != 2;
|
|
1492
|
+
else if (!n.type.isAnonymous && (i = this.nest(n, this.input)) && (n.from < n.to || !i.overlay)) {
|
|
1493
|
+
n.tree || (Ee(n), t && t.depth++, r && r.depth++);
|
|
1494
|
+
let u = e.findMounts(n.from, i.parser);
|
|
1495
|
+
if (typeof i.overlay == "function")
|
|
1496
|
+
t = new Pe(i.parser, i.overlay, u, this.inner.length, n.from, n.tree, t);
|
|
1497
|
+
else {
|
|
1498
|
+
let h = me(this.ranges, i.overlay || (n.from < n.to ? [new T(n.from, n.to)] : []));
|
|
1499
|
+
h.length && de(h), (h.length || !i.overlay) && this.inner.push(new pe(i.parser, h.length ? i.parser.startParse(this.input, ye(u, h), h) : i.parser.startParse(""), i.overlay ? i.overlay.map((c) => new T(c.from - n.from, c.to - n.from)) : null, n.tree, h.length ? h[0].from : n.from)), i.overlay ? h.length && (r = { ranges: h, depth: 0, prev: r }) : f = !1;
|
|
1500
|
+
}
|
|
1501
|
+
} else if (t && (o = t.predicate(n)) && (o === !0 && (o = new T(n.from, n.to)), o.from < o.to)) {
|
|
1502
|
+
let u = t.ranges.length - 1;
|
|
1503
|
+
u >= 0 && t.ranges[u].to == o.from ? t.ranges[u] = { from: t.ranges[u].from, to: o.to } : t.ranges.push(o);
|
|
1504
|
+
}
|
|
1505
|
+
if (f && n.firstChild())
|
|
1506
|
+
t && t.depth++, r && r.depth++;
|
|
1507
|
+
else
|
|
1508
|
+
for (; !n.nextSibling(); ) {
|
|
1509
|
+
if (!n.parent())
|
|
1510
|
+
break e;
|
|
1511
|
+
if (t && !--t.depth) {
|
|
1512
|
+
let u = me(this.ranges, t.ranges);
|
|
1513
|
+
u.length && (de(u), this.inner.splice(t.index, 0, new pe(t.parser, t.parser.startParse(this.input, ye(t.mounts, u), u), t.ranges.map((h) => new T(h.from - t.start, h.to - t.start)), t.target, u[0].from))), t = t.prev;
|
|
1514
|
+
}
|
|
1515
|
+
r && !--r.depth && (r = r.prev);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
function ze(l, e, t) {
|
|
1521
|
+
for (let r of l) {
|
|
1522
|
+
if (r.from >= t)
|
|
1523
|
+
break;
|
|
1524
|
+
if (r.to > e)
|
|
1525
|
+
return r.from <= e && r.to >= t ? 2 : 1;
|
|
1526
|
+
}
|
|
1527
|
+
return 0;
|
|
1528
|
+
}
|
|
1529
|
+
function ce(l, e, t, r, n, i) {
|
|
1530
|
+
if (e < t) {
|
|
1531
|
+
let s = l.buffer[e + 1];
|
|
1532
|
+
r.push(l.slice(e, t, s)), n.push(s - i);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
function Ee(l) {
|
|
1536
|
+
let { node: e } = l, t = [], r = e.context.buffer;
|
|
1537
|
+
do
|
|
1538
|
+
t.push(l.index), l.parent();
|
|
1539
|
+
while (!l.tree);
|
|
1540
|
+
let n = l.tree, i = n.children.indexOf(r), s = n.children[i], f = s.buffer, o = [i];
|
|
1541
|
+
function u(h, c, d, y, _, P) {
|
|
1542
|
+
let O = t[P], F = [], E = [];
|
|
1543
|
+
ce(s, h, O, F, E, y);
|
|
1544
|
+
let I = f[O + 1], L = f[O + 2];
|
|
1545
|
+
o.push(F.length);
|
|
1546
|
+
let m = P ? u(O + 4, f[O + 3], s.set.types[f[O]], I, L - I, P - 1) : e.toTree();
|
|
1547
|
+
return F.push(m), E.push(I - y), ce(s, f[O + 3], c, F, E, y), new z(d, F, E, _);
|
|
1548
|
+
}
|
|
1549
|
+
n.children[i] = u(0, f.length, j.none, 0, s.length, t.length - 1);
|
|
1550
|
+
for (let h of o) {
|
|
1551
|
+
let c = l.tree.children[h], d = l.tree.positions[h];
|
|
1552
|
+
l.yield(new B(c, d + l.from, h, l._tree));
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
class ge {
|
|
1556
|
+
constructor(e, t) {
|
|
1557
|
+
this.offset = t, this.done = !1, this.cursor = e.cursor(S.IncludeAnonymous | S.IgnoreMounts);
|
|
1558
|
+
}
|
|
1559
|
+
// Move to the first node (in pre-order) that starts at or after `pos`.
|
|
1560
|
+
moveTo(e) {
|
|
1561
|
+
let { cursor: t } = this, r = e - this.offset;
|
|
1562
|
+
for (; !this.done && t.from < r; )
|
|
1563
|
+
t.to >= e && t.enter(r, 1, S.IgnoreOverlays | S.ExcludeBuffers) || t.next(!1) || (this.done = !0);
|
|
1564
|
+
}
|
|
1565
|
+
hasNode(e) {
|
|
1566
|
+
if (this.moveTo(e.from), !this.done && this.cursor.from + this.offset == e.from && this.cursor.tree)
|
|
1567
|
+
for (let t = this.cursor.tree; ; ) {
|
|
1568
|
+
if (t == e.tree)
|
|
1569
|
+
return !0;
|
|
1570
|
+
if (t.children.length && t.positions[0] == 0 && t.children[0] instanceof z)
|
|
1571
|
+
t = t.children[0];
|
|
1572
|
+
else
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
return !1;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
class Me {
|
|
1579
|
+
constructor(e) {
|
|
1580
|
+
var t;
|
|
1581
|
+
if (this.fragments = e, this.curTo = 0, this.fragI = 0, e.length) {
|
|
1582
|
+
let r = this.curFrag = e[0];
|
|
1583
|
+
this.curTo = (t = r.tree.prop(ne)) !== null && t !== void 0 ? t : r.to, this.inner = new ge(r.tree, -r.offset);
|
|
1584
|
+
} else
|
|
1585
|
+
this.curFrag = this.inner = null;
|
|
1586
|
+
}
|
|
1587
|
+
hasNode(e) {
|
|
1588
|
+
for (; this.curFrag && e.from >= this.curTo; )
|
|
1589
|
+
this.nextFrag();
|
|
1590
|
+
return this.curFrag && this.curFrag.from <= e.from && this.curTo >= e.to && this.inner.hasNode(e);
|
|
1591
|
+
}
|
|
1592
|
+
nextFrag() {
|
|
1593
|
+
var e;
|
|
1594
|
+
if (this.fragI++, this.fragI == this.fragments.length)
|
|
1595
|
+
this.curFrag = this.inner = null;
|
|
1596
|
+
else {
|
|
1597
|
+
let t = this.curFrag = this.fragments[this.fragI];
|
|
1598
|
+
this.curTo = (e = t.tree.prop(ne)) !== null && e !== void 0 ? e : t.to, this.inner = new ge(t.tree, -t.offset);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
findMounts(e, t) {
|
|
1602
|
+
var r;
|
|
1603
|
+
let n = [];
|
|
1604
|
+
if (this.inner) {
|
|
1605
|
+
this.inner.cursor.moveTo(e, 1);
|
|
1606
|
+
for (let i = this.inner.cursor.node; i; i = i.parent) {
|
|
1607
|
+
let s = (r = i.tree) === null || r === void 0 ? void 0 : r.prop(k.mounted);
|
|
1608
|
+
if (s && s.parser == t)
|
|
1609
|
+
for (let f = this.fragI; f < this.fragments.length; f++) {
|
|
1610
|
+
let o = this.fragments[f];
|
|
1611
|
+
if (o.from >= i.to)
|
|
1612
|
+
break;
|
|
1613
|
+
o.tree == this.curFrag.tree && n.push({
|
|
1614
|
+
frag: o,
|
|
1615
|
+
pos: i.from - o.offset,
|
|
1616
|
+
mount: s
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return n;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
function me(l, e) {
|
|
1625
|
+
let t = null, r = e;
|
|
1626
|
+
for (let n = 1, i = 0; n < l.length; n++) {
|
|
1627
|
+
let s = l[n - 1].to, f = l[n].from;
|
|
1628
|
+
for (; i < r.length; i++) {
|
|
1629
|
+
let o = r[i];
|
|
1630
|
+
if (o.from >= f)
|
|
1631
|
+
break;
|
|
1632
|
+
o.to <= s || (t || (r = t = e.slice()), o.from < s ? (t[i] = new T(o.from, s), o.to > f && t.splice(i + 1, 0, new T(f, o.to))) : o.to > f ? t[i--] = new T(f, o.to) : t.splice(i--, 1));
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
return r;
|
|
1636
|
+
}
|
|
1637
|
+
function Te(l, e, t, r) {
|
|
1638
|
+
let n = 0, i = 0, s = !1, f = !1, o = -1e9, u = [];
|
|
1639
|
+
for (; ; ) {
|
|
1640
|
+
let h = n == l.length ? 1e9 : s ? l[n].to : l[n].from, c = i == e.length ? 1e9 : f ? e[i].to : e[i].from;
|
|
1641
|
+
if (s != f) {
|
|
1642
|
+
let d = Math.max(o, t), y = Math.min(h, c, r);
|
|
1643
|
+
d < y && u.push(new T(d, y));
|
|
1644
|
+
}
|
|
1645
|
+
if (o = Math.min(h, c), o == 1e9)
|
|
1646
|
+
break;
|
|
1647
|
+
h == o && (s ? (s = !1, n++) : s = !0), c == o && (f ? (f = !1, i++) : f = !0);
|
|
1648
|
+
}
|
|
1649
|
+
return u;
|
|
1650
|
+
}
|
|
1651
|
+
function ye(l, e) {
|
|
1652
|
+
let t = [];
|
|
1653
|
+
for (let { pos: r, mount: n, frag: i } of l) {
|
|
1654
|
+
let s = r + (n.overlay ? n.overlay[0].from : 0), f = s + n.tree.length, o = Math.max(i.from, s), u = Math.min(i.to, f);
|
|
1655
|
+
if (n.overlay) {
|
|
1656
|
+
let h = n.overlay.map((d) => new T(d.from + r, d.to + r)), c = Te(e, h, o, u);
|
|
1657
|
+
for (let d = 0, y = o; ; d++) {
|
|
1658
|
+
let _ = d == c.length, P = _ ? u : c[d].from;
|
|
1659
|
+
if (P > y && t.push(new Q(y, P, n.tree, -s, i.from >= y || i.openStart, i.to <= P || i.openEnd)), _)
|
|
1660
|
+
break;
|
|
1661
|
+
y = c[d].to;
|
|
1662
|
+
}
|
|
1663
|
+
} else
|
|
1664
|
+
t.push(new Q(o, u, n.tree, -s, i.from >= s || i.openStart, i.to <= f || i.openEnd));
|
|
1665
|
+
}
|
|
1666
|
+
return t;
|
|
1667
|
+
}
|
|
1668
|
+
export {
|
|
1669
|
+
Oe as DefaultBufferLength,
|
|
1670
|
+
S as IterMode,
|
|
1671
|
+
q as MountedTree,
|
|
1672
|
+
k as NodeProp,
|
|
1673
|
+
xe as NodeSet,
|
|
1674
|
+
j as NodeType,
|
|
1675
|
+
Fe as NodeWeakMap,
|
|
1676
|
+
je as Parser,
|
|
1677
|
+
z as Tree,
|
|
1678
|
+
H as TreeBuffer,
|
|
1679
|
+
te as TreeCursor,
|
|
1680
|
+
Q as TreeFragment,
|
|
1681
|
+
Re as parseMixed
|
|
1682
|
+
};
|