@idooel/components 0.0.2-beta.7 → 0.0.2-beta.8

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.
@@ -1,855 +1,8 @@
1
+ import { parse as parse$1 } from '@idooel/expression';
1
2
  import moment from 'moment';
2
3
  import { type, net, route, util } from '@idooel/shared';
3
4
  import FileUpload from 'vue-upload-component';
4
5
 
5
- var __defProp$2 = Object.defineProperty;
6
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
7
- enumerable: true,
8
- configurable: true,
9
- writable: true,
10
- value
11
- }) : obj[key] = value;
12
- var __publicField$2 = (obj, key, value) => {
13
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
14
- return value;
15
- };
16
- class LexerError extends Error {
17
- constructor(message, index, line, column) {
18
- super(message);
19
- __publicField$2(this, "index");
20
- __publicField$2(this, "line");
21
- __publicField$2(this, "column");
22
- this.name = "LexerError";
23
- this.index = index;
24
- this.line = line;
25
- this.column = column;
26
- }
27
- }
28
- class ParseError extends Error {
29
- constructor(message, index, line, column) {
30
- super(message);
31
- __publicField$2(this, "index");
32
- __publicField$2(this, "line");
33
- __publicField$2(this, "column");
34
- this.name = "ParseError";
35
- this.index = index;
36
- this.line = line;
37
- this.column = column;
38
- }
39
- }
40
- class EvalError extends Error {
41
- constructor(message) {
42
- super(message);
43
- this.name = "EvalError";
44
- }
45
- }
46
- var TokenKind = /* @__PURE__ */(TokenKind2 => {
47
- TokenKind2["Identifier"] = "Identifier";
48
- TokenKind2["Number"] = "Number";
49
- TokenKind2["String"] = "String";
50
- TokenKind2["Punctuator"] = "Punctuator";
51
- TokenKind2["Operator"] = "Operator";
52
- TokenKind2["EOF"] = "EOF";
53
- return TokenKind2;
54
- })(TokenKind || {});
55
- const PUNCTUATORS = /* @__PURE__ */new Set(["(", ")", "{", "}", "[", "]", ".", ",", ":", "?"]);
56
- const MULTI_OPERATORS = ["?.", "??", "===", "!==", "==", "!=", "<=", ">=", "&&", "||"];
57
- const SINGLE_OPERATORS = /* @__PURE__ */new Set(["+", "-", "*", "/", "%", "<", ">", "!"]);
58
- function isDigit(ch) {
59
- return ch >= "0" && ch <= "9";
60
- }
61
- function isIdentStart(ch) {
62
- return ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch === "_" || ch === "$";
63
- }
64
- function isIdentPart(ch) {
65
- return isIdentStart(ch) || isDigit(ch);
66
- }
67
- function lex(input) {
68
- if (!input && input !== "") throw new LexerError("invalid input", 0, 1, 1);
69
- const tokens = [];
70
- let index = 0;
71
- let line = 1;
72
- let column = 1;
73
- function current() {
74
- return input.charAt(index);
75
- }
76
- function advance(n = 1) {
77
- for (let i = 0; i < n; i++) {
78
- const ch = input.charAt(index++);
79
- if (ch === "\n") {
80
- line++;
81
- column = 1;
82
- } else {
83
- column++;
84
- }
85
- }
86
- }
87
- function make(kind, text, value, startIndex, startLine, startColumn) {
88
- return {
89
- kind,
90
- text,
91
- value,
92
- index: startIndex ?? index,
93
- line: startLine ?? line,
94
- column: startColumn ?? column
95
- };
96
- }
97
- while (index < input.length) {
98
- const ch = current();
99
- if (ch === " " || ch === " " || ch === "\r" || ch === "\n" || ch === "\v" || ch === "\xA0") {
100
- advance();
101
- continue;
102
- }
103
- if (ch === "'" || ch === '"') {
104
- const quote = ch;
105
- const startIndex = index;
106
- const startLine = line;
107
- const startColumn = column;
108
- advance();
109
- let value = "";
110
- let escaped = false;
111
- while (index < input.length) {
112
- const c = current();
113
- if (escaped) {
114
- if (c === "u") {
115
- const hex = input.substring(index + 1, index + 5);
116
- if (!/^[\da-f]{4}$/i.test(hex)) {
117
- throw new LexerError(`invalid unicode escape \\u${hex}`, index, line, column);
118
- }
119
- value += String.fromCharCode(parseInt(hex, 16));
120
- advance(5);
121
- } else {
122
- const ESCAPE = {
123
- n: "\n",
124
- f: "\f",
125
- r: "\r",
126
- t: " ",
127
- v: "\v"
128
- };
129
- value += ESCAPE[c] ?? c;
130
- advance();
131
- }
132
- escaped = false;
133
- continue;
134
- }
135
- if (c === "\\") {
136
- escaped = true;
137
- advance();
138
- continue;
139
- }
140
- if (c === quote) {
141
- advance();
142
- tokens.push(make("String" /* String */, input.slice(startIndex, index), value, startIndex, startLine, startColumn));
143
- value = "";
144
- break;
145
- }
146
- value += c;
147
- advance();
148
- }
149
- if (value !== "") {
150
- const last = tokens[tokens.length - 1];
151
- if (!last || last.index !== startIndex) {
152
- throw new LexerError("unterminated string", startIndex, startLine, startColumn);
153
- }
154
- }
155
- continue;
156
- }
157
- if (isDigit(ch) || ch === "." && isDigit(input.charAt(index + 1))) {
158
- const startIndex = index;
159
- const startLine = line;
160
- const startColumn = column;
161
- let text = "";
162
- while (index < input.length) {
163
- let c = input.charAt(index).toLowerCase();
164
- if (c === "." || isDigit(c)) {
165
- text += c;
166
- } else {
167
- const c2 = input.charAt(index + 1);
168
- if (c === "e" && (c2 === "+" || c2 === "-" || isDigit(c2))) {
169
- text += c;
170
- } else if ((c === "+" || c === "-") && isDigit(c2) && text.charAt(text.length - 1) === "e") {
171
- text += c;
172
- } else if ((c === "+" || c === "-") && (!c2 || !isDigit(c2)) && text.charAt(text.length - 1) === "e") {
173
- throw new LexerError("dangling exponent", index, line, column);
174
- } else {
175
- break;
176
- }
177
- }
178
- advance();
179
- }
180
- tokens.push(make("Number" /* Number */, text, Number(text), startIndex, startLine, startColumn));
181
- continue;
182
- }
183
- if (isIdentStart(ch)) {
184
- const startIndex = index;
185
- const startLine = line;
186
- const startColumn = column;
187
- advance();
188
- while (index < input.length && isIdentPart(current())) advance();
189
- const text = input.slice(startIndex, index);
190
- tokens.push(make("Identifier" /* Identifier */, text, void 0, startIndex, startLine, startColumn));
191
- continue;
192
- }
193
- const three = input.substring(index, index + 3);
194
- const two = input.substring(index, index + 2);
195
- const one = input.substring(index, index + 1);
196
- const multi = MULTI_OPERATORS.find(op => input.startsWith(op, index));
197
- if (multi) {
198
- tokens.push(make("Operator" /* Operator */, multi, void 0, index, line, column));
199
- advance(multi.length);
200
- continue;
201
- }
202
- if (PUNCTUATORS.has(one)) {
203
- tokens.push(make("Punctuator" /* Punctuator */, one, void 0, index, line, column));
204
- advance();
205
- continue;
206
- }
207
- if (SINGLE_OPERATORS.has(one)) {
208
- tokens.push(make("Operator" /* Operator */, one, void 0, index, line, column));
209
- advance();
210
- continue;
211
- }
212
- throw new LexerError(`invalid token '${three || two || one}'`, index, line, column);
213
- }
214
- tokens.push({
215
- kind: "EOF" /* EOF */,
216
- text: "<eof>",
217
- index,
218
- line,
219
- column
220
- });
221
- return {
222
- tokens
223
- };
224
- }
225
- var __defProp$1 = Object.defineProperty;
226
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
227
- enumerable: true,
228
- configurable: true,
229
- writable: true,
230
- value
231
- }) : obj[key] = value;
232
- var __publicField$1 = (obj, key, value) => {
233
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
234
- return value;
235
- };
236
- class LRUCache {
237
- constructor(maxSize = 100) {
238
- __publicField$1(this, "cache", /* @__PURE__ */new Map());
239
- __publicField$1(this, "maxSize");
240
- this.maxSize = maxSize;
241
- }
242
- get(key) {
243
- const value = this.cache.get(key);
244
- if (value !== void 0) {
245
- this.cache.delete(key);
246
- this.cache.set(key, value);
247
- }
248
- return value;
249
- }
250
- set(key, value) {
251
- if (this.cache.has(key)) {
252
- this.cache.delete(key);
253
- }
254
- if (this.cache.size >= this.maxSize) {
255
- const firstKey = this.cache.keys().next().value;
256
- if (firstKey !== void 0) {
257
- this.cache.delete(firstKey);
258
- }
259
- }
260
- this.cache.set(key, value);
261
- }
262
- clear() {
263
- this.cache.clear();
264
- }
265
- }
266
- const astCache = new LRUCache(100);
267
- function parseToAst(input) {
268
- const cached = astCache.get(input);
269
- if (cached !== void 0) {
270
- return cached;
271
- }
272
- const {
273
- tokens
274
- } = lex(input);
275
- const state = new Parser(tokens, input);
276
- const result = state.parse();
277
- astCache.set(input, result);
278
- return result;
279
- }
280
- class Parser {
281
- constructor(tokens, input) {
282
- __publicField$1(this, "tokens");
283
- __publicField$1(this, "input");
284
- __publicField$1(this, "i", 0);
285
- this.tokens = tokens;
286
- this.input = input;
287
- }
288
- current() {
289
- return this.tokens[this.i];
290
- }
291
- next() {
292
- return this.tokens[this.i + 1];
293
- }
294
- eat() {
295
- return this.tokens[this.i++];
296
- }
297
- matchText(text) {
298
- return this.current()?.text === text;
299
- }
300
- expectText(text) {
301
- const t = this.current();
302
- if (!text || t?.text === text) {
303
- this.i++;
304
- return t;
305
- }
306
- return void 0;
307
- }
308
- consumeText(text) {
309
- const t = this.expectText(text);
310
- if (!t) this.error(this.current(), `unexpected token, expect '${text ?? "<any>"}'`);
311
- return t;
312
- }
313
- error(t, message) {
314
- throw new ParseError(`${message} at ${t.line}:${t.column}`, t.index, t.line, t.column);
315
- }
316
- parse() {
317
- const t = this.current();
318
- if (t && t.kind !== TokenKind.EOF && t.text !== "}" && t.text !== ")" && t.text !== "]") {
319
- const expr = this.expression();
320
- return expr;
321
- }
322
- return void 0;
323
- }
324
- expression() {
325
- return this.ternary();
326
- }
327
- ternary() {
328
- const test = this.nullish();
329
- if (this.expectText("?")) {
330
- const consequent = this.expression();
331
- this.consumeText(":");
332
- const alternate = this.expression();
333
- const node = {
334
- type: "ConditionalExpression",
335
- test,
336
- consequent,
337
- alternate
338
- };
339
- return node;
340
- }
341
- return test;
342
- }
343
- nullish() {
344
- let left = this.logicalOR();
345
- while (this.expectText("??")) {
346
- if (isLogicalAndOr(left)) {
347
- this.error(this.current(), "Cannot mix ?? with && or || without parentheses");
348
- }
349
- const rightStart = this.current();
350
- const right = this.logicalOR();
351
- if (isLogicalAndOr(right)) {
352
- this.error(rightStart, "Cannot mix ?? with && or || without parentheses");
353
- }
354
- const node = {
355
- type: "LogicalExpression",
356
- operator: "??",
357
- left,
358
- right
359
- };
360
- left = node;
361
- }
362
- return left;
363
- }
364
- logicalOR() {
365
- let left = this.logicalAND();
366
- while (this.expectText("||")) {
367
- const right = this.logicalAND();
368
- const node = {
369
- type: "LogicalExpression",
370
- operator: "||",
371
- left,
372
- right
373
- };
374
- left = node;
375
- }
376
- return left;
377
- }
378
- logicalAND() {
379
- let left = this.equality();
380
- while (this.expectText("&&")) {
381
- const right = this.equality();
382
- const node = {
383
- type: "LogicalExpression",
384
- operator: "&&",
385
- left,
386
- right
387
- };
388
- left = node;
389
- }
390
- return left;
391
- }
392
- equality() {
393
- let left = this.relational();
394
- while (true) {
395
- if (this.expectText("===")) {
396
- left = this.binary(left, "===", this.relational());
397
- } else if (this.expectText("!==")) {
398
- left = this.binary(left, "!==", this.relational());
399
- } else if (this.expectText("==")) {
400
- left = this.binary(left, "==", this.relational());
401
- } else if (this.expectText("!=")) {
402
- left = this.binary(left, "!=", this.relational());
403
- } else break;
404
- }
405
- return left;
406
- }
407
- relational() {
408
- let left = this.additive();
409
- while (true) {
410
- if (this.expectText("<=")) {
411
- left = this.binary(left, "<=", this.additive());
412
- } else if (this.expectText(">=")) {
413
- left = this.binary(left, ">=", this.additive());
414
- } else if (this.expectText("<")) {
415
- left = this.binary(left, "<", this.additive());
416
- } else if (this.expectText(">")) {
417
- left = this.binary(left, ">", this.additive());
418
- } else break;
419
- }
420
- return left;
421
- }
422
- additive() {
423
- let left = this.multiplicative();
424
- while (true) {
425
- if (this.expectText("+")) {
426
- left = this.binary(left, "+", this.multiplicative());
427
- } else if (this.expectText("-")) {
428
- left = this.binary(left, "-", this.multiplicative());
429
- } else break;
430
- }
431
- return left;
432
- }
433
- multiplicative() {
434
- let left = this.unary();
435
- while (true) {
436
- if (this.expectText("*")) {
437
- left = this.binary(left, "*", this.unary());
438
- } else if (this.expectText("/")) {
439
- left = this.binary(left, "/", this.unary());
440
- } else if (this.expectText("%")) {
441
- left = this.binary(left, "%", this.unary());
442
- } else break;
443
- }
444
- return left;
445
- }
446
- unary() {
447
- if (this.expectText("+")) {
448
- return this.primary();
449
- }
450
- if (this.expectText("-")) {
451
- const arg = this.unary();
452
- const node = {
453
- type: "UnaryExpression",
454
- operator: "-",
455
- argument: arg
456
- };
457
- return node;
458
- }
459
- if (this.expectText("!")) {
460
- const arg = this.unary();
461
- const node = {
462
- type: "UnaryExpression",
463
- operator: "!",
464
- argument: arg
465
- };
466
- return node;
467
- }
468
- return this.primary();
469
- }
470
- primary() {
471
- const t = this.current();
472
- let expr;
473
- if (this.expectText("(")) {
474
- expr = this.expression();
475
- this.consumeText(")");
476
- } else if (this.expectText("[")) {
477
- expr = this.array();
478
- } else if (this.expectText("{")) {
479
- expr = this.object();
480
- } else if (t.kind === TokenKind.Identifier && (t.text === "true" || t.text === "false" || t.text === "null" || t.text === "undefined")) {
481
- const tok = this.eat();
482
- const map = {
483
- true: true,
484
- false: false,
485
- null: null,
486
- undefined: void 0
487
- };
488
- const node = {
489
- type: "Literal",
490
- value: map[tok.text]
491
- };
492
- expr = node;
493
- } else if (t.kind === TokenKind.Identifier) {
494
- expr = this.identifier();
495
- } else if (t.kind === TokenKind.Number || t.kind === TokenKind.String) {
496
- const tok = this.eat();
497
- const node = {
498
- type: "Literal",
499
- value: tok.kind === TokenKind.Number ? Number(tok.text) : String(tok.value)
500
- };
501
- expr = node;
502
- } else {
503
- this.error(t, "unexpected token in primary");
504
- }
505
- while (true) {
506
- if (this.expectText("(")) {
507
- const args = [];
508
- if (!this.matchText(")")) {
509
- do {
510
- args.push(this.expression());
511
- } while (this.expectText(","));
512
- }
513
- this.consumeText(")");
514
- const call = {
515
- type: "CallExpression",
516
- callee: expr,
517
- arguments: args,
518
- optional: false
519
- };
520
- expr = call;
521
- continue;
522
- }
523
- if (this.expectText("?.(")) ;
524
- if (this.expectText(".")) {
525
- const id = this.consumeIdentifier();
526
- const prop = {
527
- type: "Identifier",
528
- name: id
529
- };
530
- const mem = {
531
- type: "MemberExpression",
532
- object: expr,
533
- property: prop,
534
- computed: false,
535
- optional: false
536
- };
537
- expr = mem;
538
- continue;
539
- }
540
- if (this.expectText("[")) {
541
- const prop = this.expression();
542
- this.consumeText("]");
543
- const mem = {
544
- type: "MemberExpression",
545
- object: expr,
546
- property: prop,
547
- computed: true,
548
- optional: false
549
- };
550
- expr = mem;
551
- continue;
552
- }
553
- if (this.matchText("?.")) {
554
- this.eat();
555
- if (this.expectText("(")) {
556
- const args = [];
557
- if (!this.matchText(")")) {
558
- do {
559
- args.push(this.expression());
560
- } while (this.expectText(","));
561
- }
562
- this.consumeText(")");
563
- const call = {
564
- type: "CallExpression",
565
- callee: expr,
566
- arguments: args,
567
- optional: true
568
- };
569
- expr = call;
570
- continue;
571
- }
572
- if (this.expectText("[")) {
573
- const prop2 = this.expression();
574
- this.consumeText("]");
575
- const mem2 = {
576
- type: "MemberExpression",
577
- object: expr,
578
- property: prop2,
579
- computed: true,
580
- optional: true
581
- };
582
- expr = mem2;
583
- continue;
584
- }
585
- const id = this.consumeIdentifier();
586
- const prop = {
587
- type: "Identifier",
588
- name: id
589
- };
590
- const mem = {
591
- type: "MemberExpression",
592
- object: expr,
593
- property: prop,
594
- computed: false,
595
- optional: true
596
- };
597
- expr = mem;
598
- continue;
599
- }
600
- break;
601
- }
602
- return expr;
603
- }
604
- identifier() {
605
- const name = this.consumeIdentifier();
606
- const node = {
607
- type: "Identifier",
608
- name
609
- };
610
- return node;
611
- }
612
- consumeIdentifier() {
613
- const t = this.current();
614
- if (t.kind !== TokenKind.Identifier) this.error(t, "identifier expected");
615
- this.eat();
616
- return t.text;
617
- }
618
- array() {
619
- const elements = [];
620
- if (!this.matchText("]")) {
621
- do {
622
- if (this.matchText("]")) break;
623
- elements.push(this.expression());
624
- } while (this.expectText(","));
625
- }
626
- this.consumeText("]");
627
- return {
628
- type: "ArrayExpression",
629
- elements
630
- };
631
- }
632
- object() {
633
- const properties = [];
634
- if (!this.matchText("}")) {
635
- do {
636
- if (this.matchText("}")) break;
637
- const keyTok = this.eat();
638
- let key;
639
- if (keyTok.kind === TokenKind.String) key = String(keyTok.value);else if (keyTok.kind === TokenKind.Identifier) key = keyTok.text;else this.error(keyTok, "invalid object key");
640
- this.consumeText(":");
641
- const value = this.expression();
642
- properties.push({
643
- key,
644
- value
645
- });
646
- } while (this.expectText(","));
647
- }
648
- this.consumeText("}");
649
- return {
650
- type: "ObjectExpression",
651
- properties
652
- };
653
- }
654
- binary(left, op, right) {
655
- return {
656
- type: "BinaryExpression",
657
- operator: op,
658
- left,
659
- right
660
- };
661
- }
662
- }
663
- function isLogicalAndOr(node) {
664
- return node.type === "LogicalExpression" && (node.operator === "&&" || node.operator === "||");
665
- }
666
- const DENY_KEYS = /* @__PURE__ */new Set(["__proto__", "prototype", "constructor"]);
667
- let evalOptions = {};
668
- let currentDepth = 0;
669
- function evaluate(ast, scope, options) {
670
- if (!ast) return void 0;
671
- evalOptions = options || {};
672
- currentDepth = 0;
673
- return exec(ast, scope);
674
- }
675
- function exec(node, scope) {
676
- const maxDepth = evalOptions.maxDepth || 100;
677
- if (++currentDepth > maxDepth) {
678
- currentDepth--;
679
- if (evalOptions.strict) {
680
- throw new EvalError(`Maximum recursion depth (${maxDepth}) exceeded`);
681
- }
682
- return void 0;
683
- }
684
- try {
685
- switch (node.type) {
686
- case "Literal":
687
- return node.value;
688
- case "Identifier":
689
- return readIdentifier(node, scope);
690
- case "MemberExpression":
691
- return readMember(node, scope);
692
- case "CallExpression":
693
- return callExpression(node, scope);
694
- case "UnaryExpression":
695
- return unaryExpression(node, scope);
696
- case "BinaryExpression":
697
- return binaryExpression(node, scope);
698
- case "LogicalExpression":
699
- return logicalExpression(node, scope);
700
- case "ConditionalExpression":
701
- return conditionalExpression(node, scope);
702
- case "ArrayExpression":
703
- return arrayExpression(node, scope);
704
- case "ObjectExpression":
705
- return objectExpression(node, scope);
706
- default:
707
- return void 0;
708
- }
709
- } finally {
710
- currentDepth--;
711
- }
712
- }
713
- function readIdentifier(node, scope) {
714
- if (!scope) return void 0;
715
- return scope[node.name];
716
- }
717
- function readMember(node, scope) {
718
- const object = exec(node.object, scope);
719
- if (object == null) {
720
- return void 0;
721
- }
722
- const key = node.computed ? String(exec(node.property, scope)) : node.property.name;
723
- if (DENY_KEYS.has(key)) {
724
- if (evalOptions.strict) {
725
- throw new EvalError(`Access to property "${key}" is not allowed`);
726
- }
727
- return void 0;
728
- }
729
- try {
730
- return object[key];
731
- } catch (err) {
732
- if (evalOptions.strict) {
733
- throw new EvalError(`Failed to access property "${key}": ${err}`);
734
- }
735
- return void 0;
736
- }
737
- }
738
- function callExpression(node, scope) {
739
- let fn;
740
- let thisArg = void 0;
741
- const calleeNode = node.callee;
742
- if (calleeNode.type === "MemberExpression") {
743
- const mem = calleeNode;
744
- thisArg = exec(mem.object, scope);
745
- if (thisArg == null) return void 0;
746
- const key = mem.computed ? String(exec(mem.property, scope)) : mem.property.name;
747
- if (DENY_KEYS.has(key)) {
748
- if (evalOptions.strict) {
749
- throw new EvalError(`Call to method "${key}" is not allowed`);
750
- }
751
- return void 0;
752
- }
753
- fn = thisArg[key];
754
- } else {
755
- fn = exec(node.callee, scope);
756
- }
757
- if (fn == null) return void 0;
758
- if (typeof fn !== "function") {
759
- if (evalOptions.strict) {
760
- throw new EvalError(`Cannot call non-function value`);
761
- }
762
- return void 0;
763
- }
764
- const args = node.arguments.map(a => exec(a, scope));
765
- try {
766
- return fn.apply(thisArg, args);
767
- } catch (err) {
768
- if (evalOptions.strict) {
769
- throw new EvalError(`Function call failed: ${err}`);
770
- }
771
- return void 0;
772
- }
773
- }
774
- function unaryExpression(node, scope) {
775
- const v = exec(node.argument, scope);
776
- switch (node.operator) {
777
- case "-":
778
- return 0 - Number(v);
779
- case "!":
780
- return !v;
781
- case "+":
782
- return v;
783
- }
784
- }
785
- function binaryExpression(node, scope) {
786
- const a = exec(node.left, scope);
787
- const b = exec(node.right, scope);
788
- switch (node.operator) {
789
- case "+":
790
- return a + b;
791
- case "-":
792
- return a - b;
793
- case "*":
794
- return a * b;
795
- case "/":
796
- return a / b;
797
- case "%":
798
- return a % b;
799
- case "==":
800
- return a == b;
801
- case "!=":
802
- return a != b;
803
- case "===":
804
- return a === b;
805
- case "!==":
806
- return a !== b;
807
- case "<":
808
- return a < b;
809
- case ">":
810
- return a > b;
811
- case "<=":
812
- return a <= b;
813
- case ">=":
814
- return a >= b;
815
- }
816
- }
817
- function logicalExpression(node, scope) {
818
- if (node.operator === "&&") {
819
- const left2 = exec(node.left, scope);
820
- return left2 ? exec(node.right, scope) : left2;
821
- }
822
- if (node.operator === "||") {
823
- const left2 = exec(node.left, scope);
824
- return left2 ? left2 : exec(node.right, scope);
825
- }
826
- const left = exec(node.left, scope);
827
- return left ?? exec(node.right, scope);
828
- }
829
- function conditionalExpression(node, scope) {
830
- const test = exec(node.test, scope);
831
- return test ? exec(node.consequent, scope) : exec(node.alternate, scope);
832
- }
833
- function arrayExpression(node, scope) {
834
- return node.elements.map(e => exec(e, scope));
835
- }
836
- function objectExpression(node, scope) {
837
- const out = {};
838
- for (const p of node.properties) {
839
- if (DENY_KEYS.has(p.key)) continue;
840
- out[p.key] = exec(p.value, scope);
841
- }
842
- return out;
843
- }
844
- function compile(expression, options) {
845
- if (!expression) throw new Error("expression is required");
846
- const ast = parseToAst(expression);
847
- return scope => evaluate(ast, scope, options);
848
- }
849
- function parse$1(expression, scope = {}, options) {
850
- return compile(expression, options)(scope);
851
- }
852
-
853
6
  const CONTEXT = '__idooel__ele__context__';
854
7
  const AREA_NAMES = {
855
8
  BUTTON_GROUP: 'BUTTON_GROUP'