typerighter 0.3.0 → 0.4.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.

Potentially problematic release.


This version of typerighter might be problematic. Click here for more details.

Files changed (91) hide show
  1. package/dist/app-Bw90hv7G.js +266 -0
  2. package/dist/brand-BtMsUv5o.js +201 -0
  3. package/dist/{cli-CoyGXgR1.js → cli-s44ly0MH.js} +233 -172
  4. package/dist/cli.js +1 -1
  5. package/dist/client/app/index.d.ts +12 -4
  6. package/dist/client/app/index.d.ts.map +1 -1
  7. package/dist/client/app/router.d.ts.map +1 -1
  8. package/dist/client/theme-default.js +707 -149
  9. package/dist/client.js +2 -2
  10. package/dist/constants-E2UATqMm.js +32183 -0
  11. package/dist/es-ClqUVRJn.js +705 -0
  12. package/dist/index.js +4 -4
  13. package/dist/{init-CUo89E7j.js → init-0hKcjQtf.js} +10 -12
  14. package/dist/node/build/index.d.ts.map +1 -1
  15. package/dist/node/lib/markdown/index.d.ts.map +1 -1
  16. package/dist/node/lib/markdown/plugins/callout-container.d.ts +4 -0
  17. package/dist/node/lib/markdown/plugins/callout-container.d.ts.map +1 -0
  18. package/dist/node/lib/markdown/plugins/custom-container.d.ts +3 -0
  19. package/dist/node/lib/markdown/plugins/custom-container.d.ts.map +1 -0
  20. package/dist/node/lib/markdown/plugins/{highlight.d.ts → highlight/index.d.ts} +1 -1
  21. package/dist/node/lib/markdown/plugins/highlight/index.d.ts.map +1 -0
  22. package/dist/node/lib/markdown/plugins/highlight/language.d.ts +3 -0
  23. package/dist/node/lib/markdown/plugins/highlight/language.d.ts.map +1 -0
  24. package/dist/node/lib/progress.d.ts.map +1 -1
  25. package/dist/node/lib/render/vue.d.ts +2 -2
  26. package/dist/node/lib/render/vue.d.ts.map +1 -1
  27. package/dist/node/lib/typedown-context.d.ts +4 -4
  28. package/dist/node/lib/typedown-context.d.ts.map +1 -1
  29. package/dist/node/plugin/vite/constants.d.ts +2 -1
  30. package/dist/node/plugin/vite/constants.d.ts.map +1 -1
  31. package/dist/node/plugin/vite/index.d.ts +15 -1
  32. package/dist/node/plugin/vite/index.d.ts.map +1 -1
  33. package/dist/node/plugin/vite/search.d.ts +15 -0
  34. package/dist/node/plugin/vite/search.d.ts.map +1 -0
  35. package/dist/shared/constants.d.ts +6 -0
  36. package/dist/shared/constants.d.ts.map +1 -0
  37. package/dist/shared/index.d.ts +1 -0
  38. package/dist/shared/index.d.ts.map +1 -1
  39. package/dist/shared/types/content.d.ts +54 -4
  40. package/dist/shared/types/content.d.ts.map +1 -1
  41. package/dist/shared/types/ssg.d.ts +3 -1
  42. package/dist/shared/types/ssg.d.ts.map +1 -1
  43. package/dist/shared/utils/content.d.ts +5 -5
  44. package/dist/shared/utils/content.d.ts.map +1 -1
  45. package/dist/shared/utils/debounce.d.ts +2 -0
  46. package/dist/shared/utils/debounce.d.ts.map +1 -0
  47. package/dist/shared/utils/format.d.ts +5 -1
  48. package/dist/shared/utils/format.d.ts.map +1 -1
  49. package/dist/shared/utils/html.d.ts +1 -0
  50. package/dist/shared/utils/html.d.ts.map +1 -1
  51. package/dist/shared/utils/index.d.ts +6 -4
  52. package/dist/shared/utils/index.d.ts.map +1 -1
  53. package/dist/shared/utils/path.d.ts +8 -0
  54. package/dist/shared/utils/path.d.ts.map +1 -0
  55. package/dist/shared/utils/regex.d.ts +2 -0
  56. package/dist/shared/utils/regex.d.ts.map +1 -0
  57. package/dist/shared/utils/time.d.ts +6 -0
  58. package/dist/shared/utils/time.d.ts.map +1 -0
  59. package/dist/shared/utils/url.d.ts +6 -2
  60. package/dist/shared/utils/url.d.ts.map +1 -1
  61. package/dist/typerighter.css +1 -1
  62. package/dist/vite-nzhkELg7.js +309 -0
  63. package/dist/vite.js +2 -3
  64. package/package.json +9 -5
  65. package/dist/app-CM3biamr.js +0 -184
  66. package/dist/brand-CeSqpEQ2.js +0 -4
  67. package/dist/chunk-DfAF0w94-EwUSVR-h.js +0 -13
  68. package/dist/constants-B7b8AsH0.js +0 -9530
  69. package/dist/content-BM3UKxcc.js +0 -16
  70. package/dist/lib-CBtriEt5-Ch50D04V.js +0 -3309
  71. package/dist/liteDOM-Cp0aN3bP-YwW1TGWI.js +0 -741
  72. package/dist/node/lib/markdown/plugins/container.d.ts +0 -3
  73. package/dist/node/lib/markdown/plugins/container.d.ts.map +0 -1
  74. package/dist/node/lib/markdown/plugins/highlight.d.ts.map +0 -1
  75. package/dist/node/plugin/vite/codegen.d.ts +0 -27
  76. package/dist/node/plugin/vite/codegen.d.ts.map +0 -1
  77. package/dist/node/plugin/vite/codegen.test.d.ts +0 -2
  78. package/dist/node/plugin/vite/codegen.test.d.ts.map +0 -1
  79. package/dist/plugin-D2xuSVM4.js +0 -1
  80. package/dist/rolldown-runtime-Dqa2HsxW.js +0 -20
  81. package/dist/shared/utils/environment.d.ts +0 -2
  82. package/dist/shared/utils/environment.d.ts.map +0 -1
  83. package/dist/shared/utils/highlight.d.ts +0 -3
  84. package/dist/shared/utils/highlight.d.ts.map +0 -1
  85. package/dist/shared/utils/html.test.d.ts +0 -2
  86. package/dist/shared/utils/html.test.d.ts.map +0 -1
  87. package/dist/shared-DzTfF-_d.js +0 -14
  88. package/dist/tex-svg-full-BI3fonbT-CfoPQ3xc.js +0 -60224
  89. package/dist/vite-BxXQPieu.js +0 -228
  90. package/dist/wgxpath.install-node-Csk64Aj9-C0enUGLs.js +0 -1094
  91. package/dist/xypic-DrMJn58R-B4fw2rYo.js +0 -14846
@@ -1,1094 +0,0 @@
1
- import { n as e } from "./chunk-DfAF0w94-EwUSVR-h.js";
2
- //#region ../../node_modules/.pnpm/mathxyjax3@0.8.3/node_modules/mathxyjax3/dist/wgxpath.install-node-Csk64Aj9.js
3
- var t = globalThis, n = e(((e, n) => {
4
- (function() {
5
- var e = this;
6
- function t(e) {
7
- var t = typeof e;
8
- if (t == "object") if (e) {
9
- if (e instanceof Array) return "array";
10
- if (e instanceof Object) return t;
11
- var n = Object.prototype.toString.call(e);
12
- if (n == "[object Window]") return "object";
13
- if (n == "[object Array]" || typeof e.length == "number" && e.splice !== void 0 && e.propertyIsEnumerable !== void 0 && !e.propertyIsEnumerable("splice")) return "array";
14
- if (n == "[object Function]" || e.call !== void 0 && e.propertyIsEnumerable !== void 0 && !e.propertyIsEnumerable("call")) return "function";
15
- } else return "null";
16
- else if (t == "function" && e.call === void 0) return "object";
17
- return t;
18
- }
19
- function r(e) {
20
- return typeof e == "string";
21
- }
22
- function i(e, t, n) {
23
- return e.call.apply(e.bind, arguments);
24
- }
25
- function a(e, t, n) {
26
- if (!e) throw Error();
27
- if (2 < arguments.length) {
28
- var r = Array.prototype.slice.call(arguments, 2);
29
- return function() {
30
- var n = Array.prototype.slice.call(arguments);
31
- return Array.prototype.unshift.apply(n, r), e.apply(t, n);
32
- };
33
- }
34
- return function() {
35
- return e.apply(t, arguments);
36
- };
37
- }
38
- function o(e, t, n) {
39
- return o = Function.prototype.bind && Function.prototype.bind.toString().indexOf("native code") != -1 ? i : a, o.apply(null, arguments);
40
- }
41
- function s(e, t) {
42
- var n = Array.prototype.slice.call(arguments, 1);
43
- return function() {
44
- var t = n.slice();
45
- return t.push.apply(t, arguments), e.apply(this, t);
46
- };
47
- }
48
- function c(e) {
49
- var t = D;
50
- function n() {}
51
- n.prototype = t.prototype, e.G = t.prototype, e.prototype = new n(), e.prototype.constructor = e, e.F = function(e, n, r) {
52
- for (var i = Array(arguments.length - 2), a = 2; a < arguments.length; a++) i[a - 2] = arguments[a];
53
- return t.prototype[n].apply(e, i);
54
- };
55
- }
56
- var l = String.prototype.trim ? function(e) {
57
- return e.trim();
58
- } : function(e) {
59
- return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
60
- };
61
- function u(e, t) {
62
- return e.indexOf(t) != -1;
63
- }
64
- function ee(e, t) {
65
- return e < t ? -1 : +(e > t);
66
- }
67
- var d = Array.prototype.indexOf ? function(e, t, n) {
68
- return Array.prototype.indexOf.call(e, t, n);
69
- } : function(e, t, n) {
70
- if (n = n == null ? 0 : 0 > n ? Math.max(0, e.length + n) : n, r(e)) return r(t) && t.length == 1 ? e.indexOf(t, n) : -1;
71
- for (; n < e.length; n++) if (n in e && e[n] === t) return n;
72
- return -1;
73
- }, f = Array.prototype.forEach ? function(e, t, n) {
74
- Array.prototype.forEach.call(e, t, n);
75
- } : function(e, t, n) {
76
- for (var i = e.length, a = r(e) ? e.split("") : e, o = 0; o < i; o++) o in a && t.call(n, a[o], o, e);
77
- }, te = Array.prototype.filter ? function(e, t, n) {
78
- return Array.prototype.filter.call(e, t, n);
79
- } : function(e, t, n) {
80
- for (var i = e.length, a = [], o = 0, s = r(e) ? e.split("") : e, c = 0; c < i; c++) if (c in s) {
81
- var l = s[c];
82
- t.call(n, l, c, e) && (a[o++] = l);
83
- }
84
- return a;
85
- }, p = Array.prototype.reduce ? function(e, t, n, r) {
86
- return r && (t = o(t, r)), Array.prototype.reduce.call(e, t, n);
87
- } : function(e, t, n, r) {
88
- var i = n;
89
- return f(e, function(n, a) {
90
- i = t.call(r, i, n, a, e);
91
- }), i;
92
- }, ne = Array.prototype.some ? function(e, t, n) {
93
- return Array.prototype.some.call(e, t, n);
94
- } : function(e, t, n) {
95
- for (var i = e.length, a = r(e) ? e.split("") : e, o = 0; o < i; o++) if (o in a && t.call(n, a[o], o, e)) return !0;
96
- return !1;
97
- };
98
- function re(e, t) {
99
- var n;
100
- a: {
101
- n = e.length;
102
- for (var i = r(e) ? e.split("") : e, a = 0; a < n; a++) if (a in i && t.call(void 0, i[a], a, e)) {
103
- n = a;
104
- break a;
105
- }
106
- n = -1;
107
- }
108
- return 0 > n ? null : r(e) ? e.charAt(n) : e[n];
109
- }
110
- function ie(e) {
111
- return Array.prototype.concat.apply(Array.prototype, arguments);
112
- }
113
- function ae(e, t, n) {
114
- return 2 >= arguments.length ? Array.prototype.slice.call(e, t) : Array.prototype.slice.call(e, t, n);
115
- }
116
- var m;
117
- a: {
118
- var oe = e.navigator;
119
- if (oe) {
120
- var se = oe.userAgent;
121
- if (se) {
122
- m = se;
123
- break a;
124
- }
125
- }
126
- m = "";
127
- }
128
- var ce = u(m, "Opera") || u(m, "OPR"), h = u(m, "Trident") || u(m, "MSIE"), le = u(m, "Edge"), ue = u(m, "Gecko") && !(u(m.toLowerCase(), "webkit") && !u(m, "Edge")) && !(u(m, "Trident") || u(m, "MSIE")) && !u(m, "Edge"), de = u(m.toLowerCase(), "webkit") && !u(m, "Edge");
129
- function fe() {
130
- var t = e.document;
131
- return t ? t.documentMode : void 0;
132
- }
133
- var g;
134
- a: {
135
- var pe = "", me = function() {
136
- var e = m;
137
- if (ue) return /rv\:([^\);]+)(\)|;)/.exec(e);
138
- if (le) return /Edge\/([\d\.]+)/.exec(e);
139
- if (h) return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e);
140
- if (de) return /WebKit\/(\S+)/.exec(e);
141
- if (ce) return /(?:Version)[ \/]?(\S+)/.exec(e);
142
- }();
143
- if (me && (pe = me ? me[1] : ""), h) {
144
- var he = fe();
145
- if (he != null && he > parseFloat(pe)) {
146
- g = String(he);
147
- break a;
148
- }
149
- }
150
- g = pe;
151
- }
152
- var ge = {};
153
- function _e(e) {
154
- if (!ge[e]) {
155
- for (var t = 0, n = l(String(g)).split("."), r = l(String(e)).split("."), i = Math.max(n.length, r.length), a = 0; t == 0 && a < i; a++) {
156
- var o = n[a] || "", s = r[a] || "", c = /(\d*)(\D*)/g, u = /(\d*)(\D*)/g;
157
- do {
158
- var d = c.exec(o) || [
159
- "",
160
- "",
161
- ""
162
- ], f = u.exec(s) || [
163
- "",
164
- "",
165
- ""
166
- ];
167
- if (d[0].length == 0 && f[0].length == 0) break;
168
- t = ee(d[1].length == 0 ? 0 : parseInt(d[1], 10), f[1].length == 0 ? 0 : parseInt(f[1], 10)) || ee(d[2].length == 0, f[2].length == 0) || ee(d[2], f[2]);
169
- } while (t == 0);
170
- }
171
- ge[e] = 0 <= t;
172
- }
173
- }
174
- var ve = e.document, _ = ve && h ? fe() || (ve.compatMode == "CSS1Compat" ? parseInt(g, 10) : 5) : void 0, v = h && !(9 <= Number(_)), ye = h && !(8 <= Number(_));
175
- function y(e, t, n, r) {
176
- this.a = e, this.nodeName = n, this.nodeValue = r, this.nodeType = 2, this.parentNode = this.ownerElement = t;
177
- }
178
- function be(e, t) {
179
- var n = ye && t.nodeName == "href" ? e.getAttribute(t.nodeName, 2) : t.nodeValue;
180
- return new y(t, e, t.nodeName, n);
181
- }
182
- function b(e) {
183
- var t = null, n = e.nodeType;
184
- if (n == 1 && (t = e.textContent, t = t == null || t == null ? e.innerText : t, t = t == null || t == null ? "" : t), typeof t != "string") if (v && e.nodeName.toLowerCase() == "title" && n == 1) t = e.text;
185
- else if (n == 9 || n == 1) {
186
- e = n == 9 ? e.documentElement : e.firstChild;
187
- for (var n = 0, r = [], t = ""; e;) {
188
- do
189
- e.nodeType != 1 && (t += e.nodeValue), v && e.nodeName.toLowerCase() == "title" && (t += e.text), r[n++] = e;
190
- while (e = e.firstChild);
191
- for (; n && !(e = r[--n].nextSibling););
192
- }
193
- } else t = e.nodeValue;
194
- return "" + t;
195
- }
196
- function x(e, t, n) {
197
- if (t === null) return !0;
198
- try {
199
- if (!e.getAttribute) return !1;
200
- } catch {
201
- return !1;
202
- }
203
- return ye && t == "class" && (t = "className"), n == null ? !!e.getAttribute(t) : e.getAttribute(t, 2) == n;
204
- }
205
- function S(e, t, n, i, a) {
206
- return (v ? xe : Se).call(null, e, t, r(n) ? n : null, r(i) ? i : null, a || new C());
207
- }
208
- function xe(e, t, n, r, i) {
209
- if (e instanceof W || e.b == 8 || n && e.b === null) {
210
- var a = t.all;
211
- if (!a || (e = Ee(e), e != "*" && (a = t.getElementsByTagName(e), !a))) return i;
212
- if (n) {
213
- for (var o = [], s = 0; t = a[s++];) x(t, n, r) && o.push(t);
214
- a = o;
215
- }
216
- for (s = 0; t = a[s++];) e == "*" && t.tagName == "!" || w(i, t);
217
- return i;
218
- }
219
- return Te(e, t, n, r, i), i;
220
- }
221
- function Se(e, t, n, r, i) {
222
- return t.getElementsByName && r && n == "name" && !h ? (t = t.getElementsByName(r), f(t, function(t) {
223
- e.a(t) && w(i, t);
224
- })) : t.getElementsByClassName && r && n == "class" ? (t = t.getElementsByClassName(r), f(t, function(t) {
225
- t.className == r && e.a(t) && w(i, t);
226
- })) : e instanceof z ? Te(e, t, n, r, i) : t.getElementsByTagName && (t = t.getElementsByTagName(e.f()), f(t, function(e) {
227
- x(e, n, r) && w(i, e);
228
- })), i;
229
- }
230
- function Ce(e, t, n, r, i) {
231
- var a;
232
- if ((e instanceof W || e.b == 8 || n && e.b === null) && (a = t.childNodes)) {
233
- var o = Ee(e);
234
- return o != "*" && (a = te(a, function(e) {
235
- return e.tagName && e.tagName.toLowerCase() == o;
236
- }), !a) ? i : (n && (a = te(a, function(e) {
237
- return x(e, n, r);
238
- })), f(a, function(e) {
239
- o == "*" && (e.tagName == "!" || o == "*" && e.nodeType != 1) || w(i, e);
240
- }), i);
241
- }
242
- return we(e, t, n, r, i);
243
- }
244
- function we(e, t, n, r, i) {
245
- for (t = t.firstChild; t; t = t.nextSibling) x(t, n, r) && e.a(t) && w(i, t);
246
- return i;
247
- }
248
- function Te(e, t, n, r, i) {
249
- for (t = t.firstChild; t; t = t.nextSibling) x(t, n, r) && e.a(t) && w(i, t), Te(e, t, n, r, i);
250
- }
251
- function Ee(e) {
252
- if (e instanceof z) {
253
- if (e.b == 8) return "!";
254
- if (e.b === null) return "*";
255
- }
256
- return e.f();
257
- }
258
- !ue && !h || h && 9 <= Number(_) || ue && _e("1.9.1"), h && _e("9");
259
- function De(e, t) {
260
- if (!e || !t) return !1;
261
- if (e.contains && t.nodeType == 1) return e == t || e.contains(t);
262
- if (e.compareDocumentPosition !== void 0) return e == t || !!(e.compareDocumentPosition(t) & 16);
263
- for (; t && e != t;) t = t.parentNode;
264
- return t == e;
265
- }
266
- function Oe(t, n) {
267
- if (t == n) return 0;
268
- if (t.compareDocumentPosition) return t.compareDocumentPosition(n) & 2 ? 1 : -1;
269
- if (h && !(9 <= Number(_))) {
270
- if (t.nodeType == 9) return -1;
271
- if (n.nodeType == 9) return 1;
272
- }
273
- if ("sourceIndex" in t || t.parentNode && "sourceIndex" in t.parentNode) {
274
- var r = t.nodeType == 1, i = n.nodeType == 1;
275
- if (r && i) return t.sourceIndex - n.sourceIndex;
276
- var a = t.parentNode, o = n.parentNode;
277
- return a == o ? Ae(t, n) : !r && De(a, n) ? -1 * ke(t, n) : !i && De(o, t) ? ke(n, t) : (r ? t.sourceIndex : a.sourceIndex) - (i ? n.sourceIndex : o.sourceIndex);
278
- }
279
- return i = t.nodeType == 9 ? t : t.ownerDocument || t.document, r = i.createRange(), r.selectNode(t), r.collapse(!0), i = i.createRange(), i.selectNode(n), i.collapse(!0), r.compareBoundaryPoints(e.Range.START_TO_END, i);
280
- }
281
- function ke(e, t) {
282
- var n = e.parentNode;
283
- if (n == t) return -1;
284
- for (var r = t; r.parentNode != n;) r = r.parentNode;
285
- return Ae(r, e);
286
- }
287
- function Ae(e, t) {
288
- for (var n = t; n = n.previousSibling;) if (n == e) return -1;
289
- return 1;
290
- }
291
- function C() {
292
- this.b = this.a = null, this.l = 0;
293
- }
294
- function je(e) {
295
- this.node = e, this.a = this.b = null;
296
- }
297
- function Me(e, t) {
298
- if (!e.a) return t;
299
- if (!t.a) return e;
300
- for (var n = e.a, r = t.a, i = null, a = null, o = 0; n && r;) {
301
- var a = n.node, s = r.node;
302
- a == s || a instanceof y && s instanceof y && a.a == s.a ? (a = n, n = n.a, r = r.a) : 0 < Oe(n.node, r.node) ? (a = r, r = r.a) : (a = n, n = n.a), (a.b = i) ? i.a = a : e.a = a, i = a, o++;
303
- }
304
- for (a = n || r; a;) a.b = i, i = i.a = a, o++, a = a.a;
305
- return e.b = i, e.l = o, e;
306
- }
307
- function Ne(e, t) {
308
- var n = new je(t);
309
- n.a = e.a, e.b ? e.a.b = n : e.a = e.b = n, e.a = n, e.l++;
310
- }
311
- function w(e, t) {
312
- var n = new je(t);
313
- n.b = e.b, e.a ? e.b.a = n : e.a = e.b = n, e.b = n, e.l++;
314
- }
315
- function Pe(e) {
316
- return (e = e.a) ? e.node : null;
317
- }
318
- function Fe(e) {
319
- return (e = Pe(e)) ? b(e) : "";
320
- }
321
- function T(e, t) {
322
- return new Ie(e, !!t);
323
- }
324
- function Ie(e, t) {
325
- this.f = e, this.b = (this.c = t) ? e.b : e.a, this.a = null;
326
- }
327
- function E(e) {
328
- var t = e.b;
329
- if (t == null) return null;
330
- var n = e.a = t;
331
- return e.b = e.c ? t.b : t.a, n.node;
332
- }
333
- function D(e) {
334
- this.i = e, this.b = this.g = !1, this.f = null;
335
- }
336
- function O(e) {
337
- return "\n " + e.toString().split("\n").join("\n ");
338
- }
339
- function Le(e, t) {
340
- e.g = t;
341
- }
342
- function Re(e, t) {
343
- e.b = t;
344
- }
345
- function k(e, t) {
346
- var n = e.a(t);
347
- return n instanceof C ? +Fe(n) : +n;
348
- }
349
- function A(e, t) {
350
- var n = e.a(t);
351
- return n instanceof C ? Fe(n) : "" + n;
352
- }
353
- function j(e, t) {
354
- var n = e.a(t);
355
- return n instanceof C ? !!n.l : !!n;
356
- }
357
- function M(e, t, n) {
358
- D.call(this, e.i), this.c = e, this.h = t, this.o = n, this.g = t.g || n.g, this.b = t.b || n.b, this.c == Ve && (n.b || n.g || n.i == 4 || n.i == 0 || !t.f ? t.b || t.g || t.i == 4 || t.i == 0 || !n.f || (this.f = {
359
- name: n.f.name,
360
- s: t
361
- }) : this.f = {
362
- name: t.f.name,
363
- s: n
364
- });
365
- }
366
- c(M);
367
- function N(e, t, n, r, i) {
368
- t = t.a(r), n = n.a(r);
369
- var a;
370
- if (t instanceof C && n instanceof C) {
371
- for (t = T(t), r = E(t); r; r = E(t)) for (i = T(n), a = E(i); a; a = E(i)) if (e(b(r), b(a))) return !0;
372
- return !1;
373
- }
374
- if (t instanceof C || n instanceof C) {
375
- t instanceof C ? (i = t, r = n) : (i = n, r = t), a = T(i);
376
- for (var o = typeof r, s = E(a); s; s = E(a)) {
377
- switch (o) {
378
- case "number":
379
- s = +b(s);
380
- break;
381
- case "boolean":
382
- s = !!b(s);
383
- break;
384
- case "string":
385
- s = b(s);
386
- break;
387
- default: throw Error("Illegal primitive type for comparison.");
388
- }
389
- if (i == t && e(s, r) || i == n && e(r, s)) return !0;
390
- }
391
- return !1;
392
- }
393
- return i ? typeof t == "boolean" || typeof n == "boolean" ? e(!!t, !!n) : typeof t == "number" || typeof n == "number" ? e(+t, +n) : e(t, n) : e(+t, +n);
394
- }
395
- M.prototype.a = function(e) {
396
- return this.c.m(this.h, this.o, e);
397
- }, M.prototype.toString = function() {
398
- var e = "Binary Expression: " + this.c, e = e + O(this.h);
399
- return e += O(this.o);
400
- };
401
- function ze(e, t, n, r) {
402
- this.a = e, this.w = t, this.i = n, this.m = r;
403
- }
404
- ze.prototype.toString = function() {
405
- return this.a;
406
- };
407
- var Be = {};
408
- function P(e, t, n, r) {
409
- if (Be.hasOwnProperty(e)) throw Error("Binary operator already created: " + e);
410
- return e = new ze(e, t, n, r), Be[e.toString()] = e;
411
- }
412
- P("div", 6, 1, function(e, t, n) {
413
- return k(e, n) / k(t, n);
414
- }), P("mod", 6, 1, function(e, t, n) {
415
- return k(e, n) % k(t, n);
416
- }), P("*", 6, 1, function(e, t, n) {
417
- return k(e, n) * k(t, n);
418
- }), P("+", 5, 1, function(e, t, n) {
419
- return k(e, n) + k(t, n);
420
- }), P("-", 5, 1, function(e, t, n) {
421
- return k(e, n) - k(t, n);
422
- }), P("<", 4, 2, function(e, t, n) {
423
- return N(function(e, t) {
424
- return e < t;
425
- }, e, t, n);
426
- }), P(">", 4, 2, function(e, t, n) {
427
- return N(function(e, t) {
428
- return e > t;
429
- }, e, t, n);
430
- }), P("<=", 4, 2, function(e, t, n) {
431
- return N(function(e, t) {
432
- return e <= t;
433
- }, e, t, n);
434
- }), P(">=", 4, 2, function(e, t, n) {
435
- return N(function(e, t) {
436
- return e >= t;
437
- }, e, t, n);
438
- });
439
- var Ve = P("=", 3, 2, function(e, t, n) {
440
- return N(function(e, t) {
441
- return e == t;
442
- }, e, t, n, !0);
443
- });
444
- P("!=", 3, 2, function(e, t, n) {
445
- return N(function(e, t) {
446
- return e != t;
447
- }, e, t, n, !0);
448
- }), P("and", 2, 2, function(e, t, n) {
449
- return j(e, n) && j(t, n);
450
- }), P("or", 1, 2, function(e, t, n) {
451
- return j(e, n) || j(t, n);
452
- });
453
- function F(e, t, n) {
454
- this.a = e, this.b = t || 1, this.f = n || 1;
455
- }
456
- function I(e, t) {
457
- if (t.a.length && e.i != 4) throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");
458
- D.call(this, e.i), this.c = e, this.h = t, this.g = e.g, this.b = e.b;
459
- }
460
- c(I), I.prototype.a = function(e) {
461
- return e = this.c.a(e), et(this.h, e);
462
- }, I.prototype.toString = function() {
463
- var e = "Filter:" + O(this.c);
464
- return e += O(this.h);
465
- };
466
- function L(e, t) {
467
- if (t.length < e.A) throw Error("Function " + e.j + " expects at least" + e.A + " arguments, " + t.length + " given");
468
- if (e.v !== null && t.length > e.v) throw Error("Function " + e.j + " expects at most " + e.v + " arguments, " + t.length + " given");
469
- e.B && f(t, function(t, n) {
470
- if (t.i != 4) throw Error("Argument " + n + " to function " + e.j + " is not of type Nodeset: " + t);
471
- }), D.call(this, e.i), this.h = e, this.c = t, Le(this, e.g || ne(t, function(e) {
472
- return e.g;
473
- })), Re(this, e.D && !t.length || e.C && !!t.length || ne(t, function(e) {
474
- return e.b;
475
- }));
476
- }
477
- c(L), L.prototype.a = function(e) {
478
- return this.h.m.apply(null, ie(e, this.c));
479
- }, L.prototype.toString = function() {
480
- var e = "Function: " + this.h;
481
- if (this.c.length) var t = p(this.c, function(e, t) {
482
- return e + O(t);
483
- }, "Arguments:"), e = e + O(t);
484
- return e;
485
- };
486
- function He(e, t, n, r, i, a, o, s, c) {
487
- this.j = e, this.i = t, this.g = n, this.D = r, this.C = i, this.m = a, this.A = o, this.v = s === void 0 ? o : s, this.B = !!c;
488
- }
489
- He.prototype.toString = function() {
490
- return this.j;
491
- };
492
- var Ue = {};
493
- function R(e, t, n, r, i, a, o, s) {
494
- if (Ue.hasOwnProperty(e)) throw Error("Function already created: " + e + ".");
495
- Ue[e] = new He(e, t, n, r, !1, i, a, o, s);
496
- }
497
- R("boolean", 2, !1, !1, function(e, t) {
498
- return j(t, e);
499
- }, 1), R("ceiling", 1, !1, !1, function(e, t) {
500
- return Math.ceil(k(t, e));
501
- }, 1), R("concat", 3, !1, !1, function(e, t) {
502
- return p(ae(arguments, 1), function(t, n) {
503
- return t + A(n, e);
504
- }, "");
505
- }, 2, null), R("contains", 2, !1, !1, function(e, t, n) {
506
- return u(A(t, e), A(n, e));
507
- }, 2), R("count", 1, !1, !1, function(e, t) {
508
- return t.a(e).l;
509
- }, 1, 1, !0), R("false", 2, !1, !1, function() {
510
- return !1;
511
- }, 0), R("floor", 1, !1, !1, function(e, t) {
512
- return Math.floor(k(t, e));
513
- }, 1), R("id", 4, !1, !1, function(e, t) {
514
- function n(e) {
515
- if (v) {
516
- var t = i.all[e];
517
- if (t) {
518
- if (t.nodeType && e == t.id) return t;
519
- if (t.length) return re(t, function(t) {
520
- return e == t.id;
521
- });
522
- }
523
- return null;
524
- }
525
- return i.getElementById(e);
526
- }
527
- var r = e.a, i = r.nodeType == 9 ? r : r.ownerDocument, r = A(t, e).split(/\s+/), a = [];
528
- f(r, function(e) {
529
- e = n(e), !e || 0 <= d(a, e) || a.push(e);
530
- }), a.sort(Oe);
531
- var o = new C();
532
- return f(a, function(e) {
533
- w(o, e);
534
- }), o;
535
- }, 1), R("lang", 2, !1, !1, function() {
536
- return !1;
537
- }, 1), R("last", 1, !0, !1, function(e) {
538
- if (arguments.length != 1) throw Error("Function last expects ()");
539
- return e.f;
540
- }, 0), R("local-name", 3, !1, !0, function(e, t) {
541
- var n = t ? Pe(t.a(e)) : e.a;
542
- return n ? n.localName || n.nodeName.toLowerCase() : "";
543
- }, 0, 1, !0), R("name", 3, !1, !0, function(e, t) {
544
- var n = t ? Pe(t.a(e)) : e.a;
545
- return n ? n.nodeName.toLowerCase() : "";
546
- }, 0, 1, !0), R("namespace-uri", 3, !0, !1, function() {
547
- return "";
548
- }, 0, 1, !0), R("normalize-space", 3, !1, !0, function(e, t) {
549
- return (t ? A(t, e) : b(e.a)).replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "");
550
- }, 0, 1), R("not", 2, !1, !1, function(e, t) {
551
- return !j(t, e);
552
- }, 1), R("number", 1, !1, !0, function(e, t) {
553
- return t ? k(t, e) : +b(e.a);
554
- }, 0, 1), R("position", 1, !0, !1, function(e) {
555
- return e.b;
556
- }, 0), R("round", 1, !1, !1, function(e, t) {
557
- return Math.round(k(t, e));
558
- }, 1), R("starts-with", 2, !1, !1, function(e, t, n) {
559
- return t = A(t, e), e = A(n, e), t.lastIndexOf(e, 0) == 0;
560
- }, 2), R("string", 3, !1, !0, function(e, t) {
561
- return t ? A(t, e) : b(e.a);
562
- }, 0, 1), R("string-length", 1, !1, !0, function(e, t) {
563
- return (t ? A(t, e) : b(e.a)).length;
564
- }, 0, 1), R("substring", 3, !1, !1, function(e, t, n, r) {
565
- if (n = k(n, e), isNaN(n) || n == Infinity || n == -Infinity || (r = r ? k(r, e) : Infinity, isNaN(r) || r === -Infinity)) return "";
566
- n = Math.round(n) - 1;
567
- var i = Math.max(n, 0);
568
- return e = A(t, e), r == Infinity ? e.substring(i) : e.substring(i, n + Math.round(r));
569
- }, 2, 3), R("substring-after", 3, !1, !1, function(e, t, n) {
570
- return t = A(t, e), e = A(n, e), n = t.indexOf(e), n == -1 ? "" : t.substring(n + e.length);
571
- }, 2), R("substring-before", 3, !1, !1, function(e, t, n) {
572
- return t = A(t, e), e = A(n, e), e = t.indexOf(e), e == -1 ? "" : t.substring(0, e);
573
- }, 2), R("sum", 1, !1, !1, function(e, t) {
574
- for (var n = T(t.a(e)), r = 0, i = E(n); i; i = E(n)) r += +b(i);
575
- return r;
576
- }, 1, 1, !0), R("translate", 3, !1, !1, function(e, t, n, r) {
577
- t = A(t, e), n = A(n, e);
578
- var i = A(r, e);
579
- for (e = {}, r = 0; r < n.length; r++) {
580
- var a = n.charAt(r);
581
- a in e || (e[a] = i.charAt(r));
582
- }
583
- for (n = "", r = 0; r < t.length; r++) a = t.charAt(r), n += a in e ? e[a] : a;
584
- return n;
585
- }, 3), R("true", 2, !1, !1, function() {
586
- return !0;
587
- }, 0);
588
- function z(e, t) {
589
- switch (this.h = e, this.c = t === void 0 ? null : t, this.b = null, e) {
590
- case "comment":
591
- this.b = 8;
592
- break;
593
- case "text":
594
- this.b = 3;
595
- break;
596
- case "processing-instruction":
597
- this.b = 7;
598
- break;
599
- case "node": break;
600
- default: throw Error("Unexpected argument");
601
- }
602
- }
603
- function We(e) {
604
- return e == "comment" || e == "text" || e == "processing-instruction" || e == "node";
605
- }
606
- z.prototype.a = function(e) {
607
- return this.b === null || this.b == e.nodeType;
608
- }, z.prototype.f = function() {
609
- return this.h;
610
- }, z.prototype.toString = function() {
611
- var e = "Kind Test: " + this.h;
612
- return this.c === null || (e += O(this.c)), e;
613
- };
614
- function Ge(e) {
615
- this.b = e, this.a = 0;
616
- }
617
- function Ke(e) {
618
- e = e.match(qe);
619
- for (var t = 0; t < e.length; t++) Je.test(e[t]) && e.splice(t, 1);
620
- return new Ge(e);
621
- }
622
- var qe = /\$?(?:(?![0-9-\.])(?:\*|[\w-\.]+):)?(?![0-9-\.])(?:\*|[\w-\.]+)|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|\s+|./g, Je = /^\s/;
623
- function B(e, t) {
624
- return e.b[e.a + (t || 0)];
625
- }
626
- function V(e) {
627
- return e.b[e.a++];
628
- }
629
- function H(e) {
630
- return e.b.length <= e.a;
631
- }
632
- function U(e) {
633
- D.call(this, 3), this.c = e.substring(1, e.length - 1);
634
- }
635
- c(U), U.prototype.a = function() {
636
- return this.c;
637
- }, U.prototype.toString = function() {
638
- return "Literal: " + this.c;
639
- };
640
- function W(e, t) {
641
- this.j = e.toLowerCase();
642
- var n = this.j == "*" ? "*" : "http://www.w3.org/1999/xhtml";
643
- this.c = t ? t.toLowerCase() : n;
644
- }
645
- W.prototype.a = function(e) {
646
- var t = e.nodeType;
647
- return t != 1 && t != 2 ? !1 : (t = e.localName === void 0 ? e.nodeName : e.localName, this.j != "*" && this.j != t.toLowerCase() ? !1 : this.c == "*" || this.c == (e.namespaceURI ? e.namespaceURI.toLowerCase() : "http://www.w3.org/1999/xhtml"));
648
- }, W.prototype.f = function() {
649
- return this.j;
650
- }, W.prototype.toString = function() {
651
- return "Name Test: " + (this.c == "http://www.w3.org/1999/xhtml" ? "" : this.c + ":") + this.j;
652
- };
653
- function Ye(e, t) {
654
- if (D.call(this, e.i), this.h = e, this.c = t, this.g = e.g, this.b = e.b, this.c.length == 1) {
655
- var n = this.c[0];
656
- n.u || n.c != rt || (n = n.o, n.f() != "*" && (this.f = {
657
- name: n.f(),
658
- s: null
659
- }));
660
- }
661
- }
662
- c(Ye);
663
- function G() {
664
- D.call(this, 4);
665
- }
666
- c(G), G.prototype.a = function(e) {
667
- var t = new C();
668
- return e = e.a, e.nodeType == 9 ? w(t, e) : w(t, e.ownerDocument), t;
669
- }, G.prototype.toString = function() {
670
- return "Root Helper Expression";
671
- };
672
- function Xe() {
673
- D.call(this, 4);
674
- }
675
- c(Xe), Xe.prototype.a = function(e) {
676
- var t = new C();
677
- return w(t, e.a), t;
678
- }, Xe.prototype.toString = function() {
679
- return "Context Helper Expression";
680
- };
681
- function Ze(e) {
682
- return e == "/" || e == "//";
683
- }
684
- Ye.prototype.a = function(e) {
685
- var t = this.h.a(e);
686
- if (!(t instanceof C)) throw Error("Filter expression must evaluate to nodeset.");
687
- e = this.c;
688
- for (var n = 0, r = e.length; n < r && t.l; n++) {
689
- var i = e[n], a = T(t, i.c.a), o;
690
- if (i.g || i.c != ot) if (i.g || i.c != ct) for (o = E(a), t = i.a(new F(o)); (o = E(a)) != null;) o = i.a(new F(o)), t = Me(t, o);
691
- else o = E(a), t = i.a(new F(o));
692
- else {
693
- for (o = E(a); (t = E(a)) && (!o.contains || o.contains(t)) && t.compareDocumentPosition(o) & 8; o = t);
694
- t = i.a(new F(o));
695
- }
696
- }
697
- return t;
698
- }, Ye.prototype.toString = function() {
699
- var e = "Path Expression:" + O(this.h);
700
- if (this.c.length) {
701
- var t = p(this.c, function(e, t) {
702
- return e + O(t);
703
- }, "Steps:");
704
- e += O(t);
705
- }
706
- return e;
707
- };
708
- function Qe(e) {
709
- D.call(this, 4), this.c = e, Le(this, ne(this.c, function(e) {
710
- return e.g;
711
- })), Re(this, ne(this.c, function(e) {
712
- return e.b;
713
- }));
714
- }
715
- c(Qe), Qe.prototype.a = function(e) {
716
- var t = new C();
717
- return f(this.c, function(n) {
718
- if (n = n.a(e), !(n instanceof C)) throw Error("Path expression must evaluate to NodeSet.");
719
- t = Me(t, n);
720
- }), t;
721
- }, Qe.prototype.toString = function() {
722
- return p(this.c, function(e, t) {
723
- return e + O(t);
724
- }, "Union Expression:");
725
- };
726
- function $e(e, t) {
727
- this.a = e, this.b = !!t;
728
- }
729
- function et(e, t, n) {
730
- for (n ||= 0; n < e.a.length; n++) for (var r = e.a[n], i = T(t), a = t.l, o, s = 0; o = E(i); s++) {
731
- var c = e.b ? a - s : s + 1;
732
- if (o = r.a(new F(o, c, a)), typeof o == "number") c = c == o;
733
- else if (typeof o == "string" || typeof o == "boolean") c = !!o;
734
- else if (o instanceof C) c = 0 < o.l;
735
- else throw Error("Predicate.evaluate returned an unexpected type.");
736
- if (!c) {
737
- c = i, o = c.f;
738
- var l = c.a;
739
- if (!l) throw Error("Next must be called at least once before remove.");
740
- var u = l.b, l = l.a;
741
- u ? u.a = l : o.a = l, l ? l.b = u : o.b = u, o.l--, c.a = null;
742
- }
743
- }
744
- return t;
745
- }
746
- $e.prototype.toString = function() {
747
- return p(this.a, function(e, t) {
748
- return e + O(t);
749
- }, "Predicates:");
750
- };
751
- function K(e, t, n, r) {
752
- D.call(this, 4), this.c = e, this.o = t, this.h = n || new $e([]), this.u = !!r, t = this.h, t = 0 < t.a.length ? t.a[0].f : null, e.b && t && (e = t.name, e = v ? e.toLowerCase() : e, this.f = {
753
- name: e,
754
- s: t.s
755
- });
756
- a: {
757
- for (e = this.h, t = 0; t < e.a.length; t++) if (n = e.a[t], n.g || n.i == 1 || n.i == 0) {
758
- e = !0;
759
- break a;
760
- }
761
- e = !1;
762
- }
763
- this.g = e;
764
- }
765
- c(K), K.prototype.a = function(e) {
766
- var t = e.a, n = null, n = this.f, r = null, i = null, a = 0;
767
- if (n && (r = n.name, i = n.s ? A(n.s, e) : null, a = 1), this.u) if (this.g || this.c != it) if (e = T(new K(at, new z("node")).a(e)), t = E(e)) for (n = this.m(t, r, i, a); (t = E(e)) != null;) n = Me(n, this.m(t, r, i, a));
768
- else n = new C();
769
- else n = S(this.o, t, r, i), n = et(this.h, n, a);
770
- else n = this.m(e.a, r, i, a);
771
- return n;
772
- }, K.prototype.m = function(e, t, n, r) {
773
- return e = this.c.f(this.o, e, t, n), e = et(this.h, e, r);
774
- }, K.prototype.toString = function() {
775
- var e = "Step:" + O("Operator: " + (this.u ? "//" : "/"));
776
- if (this.c.j && (e += O("Axis: " + this.c)), e += O(this.o), this.h.a.length) {
777
- var t = p(this.h.a, function(e, t) {
778
- return e + O(t);
779
- }, "Predicates:");
780
- e += O(t);
781
- }
782
- return e;
783
- };
784
- function tt(e, t, n, r) {
785
- this.j = e, this.f = t, this.a = n, this.b = r;
786
- }
787
- tt.prototype.toString = function() {
788
- return this.j;
789
- };
790
- var nt = {};
791
- function q(e, t, n, r) {
792
- if (nt.hasOwnProperty(e)) throw Error("Axis already created: " + e);
793
- return t = new tt(e, t, n, !!r), nt[e] = t;
794
- }
795
- q("ancestor", function(e, t) {
796
- for (var n = new C(), r = t; r = r.parentNode;) e.a(r) && Ne(n, r);
797
- return n;
798
- }, !0), q("ancestor-or-self", function(e, t) {
799
- var n = new C(), r = t;
800
- do
801
- e.a(r) && Ne(n, r);
802
- while (r = r.parentNode);
803
- return n;
804
- }, !0);
805
- var rt = q("attribute", function(e, t) {
806
- var n = new C(), r = e.f();
807
- if (r == "style" && v && t.style) return w(n, new y(t.style, t, "style", t.style.cssText)), n;
808
- var i = t.attributes;
809
- if (i) if (e instanceof z && e.b === null || r == "*") for (var r = 0, a; a = i[r]; r++) v ? a.nodeValue && w(n, be(t, a)) : w(n, a);
810
- else (a = i.getNamedItem(r)) && (v ? a.nodeValue && w(n, be(t, a)) : w(n, a));
811
- return n;
812
- }, !1), it = q("child", function(e, t, n, i, a) {
813
- return (v ? Ce : we).call(null, e, t, r(n) ? n : null, r(i) ? i : null, a || new C());
814
- }, !1, !0);
815
- q("descendant", S, !1, !0);
816
- var at = q("descendant-or-self", function(e, t, n, r) {
817
- var i = new C();
818
- return x(t, n, r) && e.a(t) && w(i, t), S(e, t, n, r, i);
819
- }, !1, !0), ot = q("following", function(e, t, n, r) {
820
- var i = new C();
821
- do
822
- for (var a = t; a = a.nextSibling;) x(a, n, r) && e.a(a) && w(i, a), i = S(e, a, n, r, i);
823
- while (t = t.parentNode);
824
- return i;
825
- }, !1, !0);
826
- q("following-sibling", function(e, t) {
827
- for (var n = new C(), r = t; r = r.nextSibling;) e.a(r) && w(n, r);
828
- return n;
829
- }, !1), q("namespace", function() {
830
- return new C();
831
- }, !1);
832
- var st = q("parent", function(e, t) {
833
- var n = new C();
834
- if (t.nodeType == 9) return n;
835
- if (t.nodeType == 2) return w(n, t.ownerElement), n;
836
- var r = t.parentNode;
837
- return e.a(r) && w(n, r), n;
838
- }, !1), ct = q("preceding", function(e, t, n, r) {
839
- var i = new C(), a = [];
840
- do
841
- a.unshift(t);
842
- while (t = t.parentNode);
843
- for (var o = 1, s = a.length; o < s; o++) {
844
- var c = [];
845
- for (t = a[o]; t = t.previousSibling;) c.unshift(t);
846
- for (var l = 0, u = c.length; l < u; l++) t = c[l], x(t, n, r) && e.a(t) && w(i, t), i = S(e, t, n, r, i);
847
- }
848
- return i;
849
- }, !0, !0);
850
- q("preceding-sibling", function(e, t) {
851
- for (var n = new C(), r = t; r = r.previousSibling;) e.a(r) && Ne(n, r);
852
- return n;
853
- }, !0);
854
- var lt = q("self", function(e, t) {
855
- var n = new C();
856
- return e.a(t) && w(n, t), n;
857
- }, !1);
858
- function J(e) {
859
- D.call(this, 1), this.c = e, this.g = e.g, this.b = e.b;
860
- }
861
- c(J), J.prototype.a = function(e) {
862
- return -k(this.c, e);
863
- }, J.prototype.toString = function() {
864
- return "Unary Expression: -" + O(this.c);
865
- };
866
- function ut(e) {
867
- D.call(this, 1), this.c = e;
868
- }
869
- c(ut), ut.prototype.a = function() {
870
- return this.c;
871
- }, ut.prototype.toString = function() {
872
- return "Number: " + this.c;
873
- };
874
- function dt(e, t) {
875
- this.a = e, this.b = t;
876
- }
877
- function ft(e) {
878
- for (var t, n = [];;) {
879
- Y(e, "Missing right hand side of binary expression."), t = yt(e);
880
- var r = V(e.a);
881
- if (!r) break;
882
- var i = (r = Be[r] || null) && r.w;
883
- if (!i) {
884
- e.a.a--;
885
- break;
886
- }
887
- for (; n.length && i <= n[n.length - 1].w;) t = new M(n.pop(), n.pop(), t);
888
- n.push(t, r);
889
- }
890
- for (; n.length;) t = new M(n.pop(), n.pop(), t);
891
- return t;
892
- }
893
- function Y(e, t) {
894
- if (H(e.a)) throw Error(t);
895
- }
896
- function pt(e, t) {
897
- var n = V(e.a);
898
- if (n != t) throw Error("Bad token, expected: " + t + " got: " + n);
899
- }
900
- function mt(e) {
901
- if (e = V(e.a), e != ")") throw Error("Bad token: " + e);
902
- }
903
- function ht(e) {
904
- if (e = V(e.a), 2 > e.length) throw Error("Unclosed literal string");
905
- return new U(e);
906
- }
907
- function gt(e) {
908
- var t, n = [], r;
909
- if (Ze(B(e.a))) {
910
- if (t = V(e.a), r = B(e.a), t == "/" && (H(e.a) || r != "." && r != ".." && r != "@" && r != "*" && !/(?![0-9])[\w]/.test(r))) return new G();
911
- r = new G(), Y(e, "Missing next location step."), t = _t(e, t), n.push(t);
912
- } else {
913
- a: {
914
- switch (t = B(e.a), r = t.charAt(0), r) {
915
- case "$": throw Error("Variable reference not allowed in HTML XPath");
916
- case "(":
917
- V(e.a), t = ft(e), Y(e, "unclosed \"(\""), pt(e, ")");
918
- break;
919
- case "\"":
920
- case "'":
921
- t = ht(e);
922
- break;
923
- default: if (isNaN(+t)) if (!We(t) && /(?![0-9])[\w]/.test(r) && B(e.a, 1) == "(") {
924
- for (t = V(e.a), t = Ue[t] || null, V(e.a), r = []; B(e.a) != ")" && (Y(e, "Missing function argument list."), r.push(ft(e)), B(e.a) == ",");) V(e.a);
925
- Y(e, "Unclosed function argument list."), mt(e), t = new L(t, r);
926
- } else {
927
- t = null;
928
- break a;
929
- }
930
- else t = new ut(+V(e.a));
931
- }
932
- B(e.a) == "[" && (r = new $e(vt(e)), t = new I(t, r));
933
- }
934
- if (t) if (Ze(B(e.a))) r = t;
935
- else return t;
936
- else t = _t(e, "/"), r = new Xe(), n.push(t);
937
- }
938
- for (; Ze(B(e.a));) t = V(e.a), Y(e, "Missing next location step."), t = _t(e, t), n.push(t);
939
- return new Ye(r, n);
940
- }
941
- function _t(e, t) {
942
- var n, r, i;
943
- if (t != "/" && t != "//") throw Error("Step op should be \"/\" or \"//\"");
944
- if (B(e.a) == ".") return r = new K(lt, new z("node")), V(e.a), r;
945
- if (B(e.a) == "..") return r = new K(st, new z("node")), V(e.a), r;
946
- var a;
947
- if (B(e.a) == "@") a = rt, V(e.a), Y(e, "Missing attribute name");
948
- else if (B(e.a, 1) == "::") {
949
- if (!/(?![0-9])[\w]/.test(B(e.a).charAt(0))) throw Error("Bad token: " + V(e.a));
950
- if (n = V(e.a), a = nt[n] || null, !a) throw Error("No axis with name: " + n);
951
- V(e.a), Y(e, "Missing node name");
952
- } else a = it;
953
- if (n = B(e.a), /(?![0-9])[\w\*]/.test(n.charAt(0))) if (B(e.a, 1) == "(") {
954
- if (!We(n)) throw Error("Invalid node type: " + n);
955
- if (n = V(e.a), !We(n)) throw Error("Invalid type name: " + n);
956
- pt(e, "("), Y(e, "Bad nodetype"), i = B(e.a).charAt(0);
957
- var o = null;
958
- (i == "\"" || i == "'") && (o = ht(e)), Y(e, "Bad nodetype"), mt(e), n = new z(n, o);
959
- } else if (n = V(e.a), i = n.indexOf(":"), i == -1) n = new W(n);
960
- else {
961
- var o = n.substring(0, i), s;
962
- if (o == "*") s = "*";
963
- else if (s = e.b(o), !s) throw Error("Namespace prefix not declared: " + o);
964
- n = n.substr(i + 1), n = new W(n, s);
965
- }
966
- else throw Error("Bad token: " + V(e.a));
967
- return i = new $e(vt(e), a.a), r || new K(a, n, i, t == "//");
968
- }
969
- function vt(e) {
970
- for (var t = []; B(e.a) == "[";) {
971
- V(e.a), Y(e, "Missing predicate expression.");
972
- var n = ft(e);
973
- t.push(n), Y(e, "Unclosed predicate expression."), pt(e, "]");
974
- }
975
- return t;
976
- }
977
- function yt(e) {
978
- if (B(e.a) == "-") return V(e.a), new J(yt(e));
979
- var t = gt(e);
980
- if (B(e.a) != "|") e = t;
981
- else {
982
- for (t = [t]; V(e.a) == "|";) Y(e, "Missing next union location path."), t.push(gt(e));
983
- e.a.a--, e = new Qe(t);
984
- }
985
- return e;
986
- }
987
- function bt(e) {
988
- switch (e.nodeType) {
989
- case 1: return s(St, e);
990
- case 9: return bt(e.documentElement);
991
- case 11:
992
- case 10:
993
- case 6:
994
- case 12: return xt;
995
- default: return e.parentNode ? bt(e.parentNode) : xt;
996
- }
997
- }
998
- function xt() {
999
- return null;
1000
- }
1001
- function St(e, t) {
1002
- if (e.prefix == t) return e.namespaceURI || "http://www.w3.org/1999/xhtml";
1003
- var n = e.getAttributeNode("xmlns:" + t);
1004
- return n && n.specified ? n.value || null : e.parentNode && e.parentNode.nodeType != 9 ? St(e.parentNode, t) : null;
1005
- }
1006
- function Ct(e, n) {
1007
- if (!e.length) throw Error("Empty XPath expression.");
1008
- var r = Ke(e);
1009
- if (H(r)) throw Error("Invalid XPath expression.");
1010
- n ? t(n) == "function" || (n = o(n.lookupNamespaceURI, n)) : n = function() {
1011
- return null;
1012
- };
1013
- var i = ft(new dt(r, n));
1014
- if (!H(r)) throw Error("Bad token: " + V(r));
1015
- this.evaluate = function(e, t) {
1016
- return new X(i.a(new F(e)), t);
1017
- };
1018
- }
1019
- function X(e, t) {
1020
- if (t == 0) if (e instanceof C) t = 4;
1021
- else if (typeof e == "string") t = 2;
1022
- else if (typeof e == "number") t = 1;
1023
- else if (typeof e == "boolean") t = 3;
1024
- else throw Error("Unexpected evaluation result.");
1025
- if (t != 2 && t != 1 && t != 3 && !(e instanceof C)) throw Error("value could not be converted to the specified type");
1026
- this.resultType = t;
1027
- var n;
1028
- switch (t) {
1029
- case 2:
1030
- this.stringValue = e instanceof C ? Fe(e) : "" + e;
1031
- break;
1032
- case 1:
1033
- this.numberValue = e instanceof C ? +Fe(e) : +e;
1034
- break;
1035
- case 3:
1036
- this.booleanValue = e instanceof C ? 0 < e.l : !!e;
1037
- break;
1038
- case 4:
1039
- case 5:
1040
- case 6:
1041
- case 7:
1042
- var r = T(e);
1043
- n = [];
1044
- for (var i = E(r); i; i = E(r)) n.push(i instanceof y ? i.a : i);
1045
- this.snapshotLength = e.l, this.invalidIteratorState = !1;
1046
- break;
1047
- case 8:
1048
- case 9:
1049
- r = Pe(e), this.singleNodeValue = r instanceof y ? r.a : r;
1050
- break;
1051
- default: throw Error("Unknown XPathResult type.");
1052
- }
1053
- var a = 0;
1054
- this.iterateNext = function() {
1055
- if (t != 4 && t != 5) throw Error("iterateNext called with wrong result type");
1056
- return a >= n.length ? null : n[a++];
1057
- }, this.snapshotItem = function(e) {
1058
- if (t != 6 && t != 7) throw Error("snapshotItem called with wrong result type");
1059
- return e >= n.length || 0 > e ? null : n[e];
1060
- };
1061
- }
1062
- X.ANY_TYPE = 0, X.NUMBER_TYPE = 1, X.STRING_TYPE = 2, X.BOOLEAN_TYPE = 3, X.UNORDERED_NODE_ITERATOR_TYPE = 4, X.ORDERED_NODE_ITERATOR_TYPE = 5, X.UNORDERED_NODE_SNAPSHOT_TYPE = 6, X.ORDERED_NODE_SNAPSHOT_TYPE = 7, X.ANY_UNORDERED_NODE_TYPE = 8, X.FIRST_ORDERED_NODE_TYPE = 9;
1063
- function wt(e) {
1064
- this.lookupNamespaceURI = bt(e);
1065
- }
1066
- function Tt(t, n) {
1067
- var r = t || e, i = r.Document && r.Document.prototype || r.document;
1068
- (!i.evaluate || n) && (r.XPathResult = X, i.evaluate = function(e, t, n, r) {
1069
- return new Ct(e, n).evaluate(t, r);
1070
- }, i.createExpression = function(e, t) {
1071
- return new Ct(e, t);
1072
- }, i.createNSResolver = function(e) {
1073
- return new wt(e);
1074
- });
1075
- }
1076
- var Z = ["wgxpath", "install"], Q = e;
1077
- Z[0] in Q || !Q.execScript || Q.execScript("var " + Z[0]);
1078
- for (var $; Z.length && ($ = Z.shift());) Z.length || Tt === void 0 ? Q = Q[$] ? Q[$] : Q[$] = {} : Q[$] = Tt;
1079
- n.exports.install = Tt, n.exports.XPathResultType = {
1080
- ANY_TYPE: 0,
1081
- NUMBER_TYPE: 1,
1082
- STRING_TYPE: 2,
1083
- BOOLEAN_TYPE: 3,
1084
- UNORDERED_NODE_ITERATOR_TYPE: 4,
1085
- ORDERED_NODE_ITERATOR_TYPE: 5,
1086
- UNORDERED_NODE_SNAPSHOT_TYPE: 6,
1087
- ORDERED_NODE_SNAPSHOT_TYPE: 7,
1088
- ANY_UNORDERED_NODE_TYPE: 8,
1089
- FIRST_ORDERED_NODE_TYPE: 9
1090
- };
1091
- }).call(t);
1092
- }))();
1093
- //#endregion
1094
- export { n as default };