@eslint-react/jsx 1.5.0 → 1.5.1-beta.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/dist/index.cjs CHANGED
@@ -2,18 +2,1086 @@
2
2
 
3
3
  var ast = require('@eslint-react/ast');
4
4
  var shared = require('@eslint-react/shared');
5
- var tools = require('@eslint-react/tools');
6
5
  var memo = require('micro-memoize');
7
6
  var _var = require('@eslint-react/var');
8
7
  var types = require('@typescript-eslint/types');
9
8
 
9
+ /**
10
+ * Tests if a value is a `function`.
11
+ *
12
+ * @param input - The value to test.
13
+ *
14
+ * @example
15
+ * import { isFunction } from 'effect/Predicate'
16
+ *
17
+ * assert.deepStrictEqual(isFunction(isFunction), true)
18
+ * assert.deepStrictEqual(isFunction("function"), false)
19
+ *
20
+ * @category guards
21
+ * @since 2.0.0
22
+ */
23
+ const isFunction$1 = input => typeof input === "function";
24
+ /**
25
+ * Creates a function that can be used in a data-last (aka `pipe`able) or
26
+ * data-first style.
27
+ *
28
+ * The first parameter to `dual` is either the arity of the uncurried function
29
+ * or a predicate that determines if the function is being used in a data-first
30
+ * or data-last style.
31
+ *
32
+ * Using the arity is the most common use case, but there are some cases where
33
+ * you may want to use a predicate. For example, if you have a function that
34
+ * takes an optional argument, you can use a predicate to determine if the
35
+ * function is being used in a data-first or data-last style.
36
+ *
37
+ * @param arity - Either the arity of the uncurried function or a predicate
38
+ * which determines if the function is being used in a data-first
39
+ * or data-last style.
40
+ * @param body - The definition of the uncurried function.
41
+ *
42
+ * @example
43
+ * import { dual, pipe } from "effect/Function"
44
+ *
45
+ * // Exampe using arity to determine data-first or data-last style
46
+ * const sum: {
47
+ * (that: number): (self: number) => number
48
+ * (self: number, that: number): number
49
+ * } = dual(2, (self: number, that: number): number => self + that)
50
+ *
51
+ * assert.deepStrictEqual(sum(2, 3), 5)
52
+ * assert.deepStrictEqual(pipe(2, sum(3)), 5)
53
+ *
54
+ * // Example using a predicate to determine data-first or data-last style
55
+ * const sum2: {
56
+ * (that: number): (self: number) => number
57
+ * (self: number, that: number): number
58
+ * } = dual((args) => args.length === 1, (self: number, that: number): number => self + that)
59
+ *
60
+ * assert.deepStrictEqual(sum(2, 3), 5)
61
+ * assert.deepStrictEqual(pipe(2, sum(3)), 5)
62
+ *
63
+ * @since 2.0.0
64
+ */
65
+ const dual = function (arity, body) {
66
+ if (typeof arity === "function") {
67
+ return function () {
68
+ if (arity(arguments)) {
69
+ // @ts-expect-error
70
+ return body.apply(this, arguments);
71
+ }
72
+ return self => body(self, ...arguments);
73
+ };
74
+ }
75
+ switch (arity) {
76
+ case 0:
77
+ case 1:
78
+ throw new RangeError(`Invalid arity ${arity}`);
79
+ case 2:
80
+ return function (a, b) {
81
+ if (arguments.length >= 2) {
82
+ return body(a, b);
83
+ }
84
+ return function (self) {
85
+ return body(self, a);
86
+ };
87
+ };
88
+ case 3:
89
+ return function (a, b, c) {
90
+ if (arguments.length >= 3) {
91
+ return body(a, b, c);
92
+ }
93
+ return function (self) {
94
+ return body(self, a, b);
95
+ };
96
+ };
97
+ case 4:
98
+ return function (a, b, c, d) {
99
+ if (arguments.length >= 4) {
100
+ return body(a, b, c, d);
101
+ }
102
+ return function (self) {
103
+ return body(self, a, b, c);
104
+ };
105
+ };
106
+ case 5:
107
+ return function (a, b, c, d, e) {
108
+ if (arguments.length >= 5) {
109
+ return body(a, b, c, d, e);
110
+ }
111
+ return function (self) {
112
+ return body(self, a, b, c, d);
113
+ };
114
+ };
115
+ default:
116
+ return function () {
117
+ if (arguments.length >= arity) {
118
+ // @ts-expect-error
119
+ return body.apply(this, arguments);
120
+ }
121
+ const args = arguments;
122
+ return function (self) {
123
+ return body(self, ...args);
124
+ };
125
+ };
126
+ }
127
+ };
128
+ /**
129
+ * Creates a constant value that never changes.
130
+ *
131
+ * This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument)
132
+ * and want that inner function to always use the same value, no matter how many times it is called.
133
+ *
134
+ * @param value - The constant value to be returned.
135
+ *
136
+ * @example
137
+ * import { constant } from "effect/Function"
138
+ *
139
+ * const constNull = constant(null)
140
+ *
141
+ * assert.deepStrictEqual(constNull(), null)
142
+ * assert.deepStrictEqual(constNull(), null)
143
+ *
144
+ * @since 2.0.0
145
+ */
146
+ const constant = value => () => value;
147
+ /**
148
+ * A thunk that returns always `true`.
149
+ *
150
+ * @example
151
+ * import { constTrue } from "effect/Function"
152
+ *
153
+ * assert.deepStrictEqual(constTrue(), true)
154
+ *
155
+ * @since 2.0.0
156
+ */
157
+ const constTrue = /*#__PURE__*/constant(true);
158
+ /**
159
+ * A thunk that returns always `false`.
160
+ *
161
+ * @example
162
+ * import { constFalse } from "effect/Function"
163
+ *
164
+ * assert.deepStrictEqual(constFalse(), false)
165
+ *
166
+ * @since 2.0.0
167
+ */
168
+ const constFalse = /*#__PURE__*/constant(false);
169
+ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
170
+ switch (arguments.length) {
171
+ case 1:
172
+ return a;
173
+ case 2:
174
+ return ab(a);
175
+ case 3:
176
+ return bc(ab(a));
177
+ case 4:
178
+ return cd(bc(ab(a)));
179
+ case 5:
180
+ return de(cd(bc(ab(a))));
181
+ case 6:
182
+ return ef(de(cd(bc(ab(a)))));
183
+ case 7:
184
+ return fg(ef(de(cd(bc(ab(a))))));
185
+ case 8:
186
+ return gh(fg(ef(de(cd(bc(ab(a)))))));
187
+ case 9:
188
+ return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
189
+ default:
190
+ {
191
+ let ret = arguments[0];
192
+ for (let i = 1; i < arguments.length; i++) {
193
+ ret = arguments[i](ret);
194
+ }
195
+ return ret;
196
+ }
197
+ }
198
+ }
199
+
200
+ const moduleVersion = "2.2.2";
201
+
202
+ /**
203
+ * @since 2.0.0
204
+ */
205
+ const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
206
+ if (!(globalStoreId in globalThis)) {
207
+ globalThis[globalStoreId] = /*#__PURE__*/new Map();
208
+ }
209
+ const globalStore = globalThis[globalStoreId];
210
+ /**
211
+ * @since 2.0.0
212
+ */
213
+ const globalValue = (id, compute) => {
214
+ if (!globalStore.has(id)) {
215
+ globalStore.set(id, compute());
216
+ }
217
+ return globalStore.get(id);
218
+ };
219
+
220
+ /**
221
+ * @since 2.0.0
222
+ */
223
+ /**
224
+ * Tests if a value is a `string`.
225
+ *
226
+ * @param input - The value to test.
227
+ *
228
+ * @example
229
+ * import { isString } from "effect/Predicate"
230
+ *
231
+ * assert.deepStrictEqual(isString("a"), true)
232
+ *
233
+ * assert.deepStrictEqual(isString(1), false)
234
+ *
235
+ * @category guards
236
+ * @since 2.0.0
237
+ */
238
+ const isString = input => typeof input === "string";
239
+ /**
240
+ * Tests if a value is a `function`.
241
+ *
242
+ * @param input - The value to test.
243
+ *
244
+ * @example
245
+ * import { isFunction } from "effect/Predicate"
246
+ *
247
+ * assert.deepStrictEqual(isFunction(isFunction), true)
248
+ *
249
+ * assert.deepStrictEqual(isFunction("function"), false)
250
+ *
251
+ * @category guards
252
+ * @since 2.0.0
253
+ */
254
+ const isFunction = isFunction$1;
255
+ const isRecordOrArray = input => typeof input === "object" && input !== null;
256
+ /**
257
+ * Tests if a value is an `object`.
258
+ *
259
+ * @param input - The value to test.
260
+ *
261
+ * @example
262
+ * import { isObject } from "effect/Predicate"
263
+ *
264
+ * assert.deepStrictEqual(isObject({}), true)
265
+ * assert.deepStrictEqual(isObject([]), true)
266
+ *
267
+ * assert.deepStrictEqual(isObject(null), false)
268
+ * assert.deepStrictEqual(isObject(undefined), false)
269
+ *
270
+ * @category guards
271
+ * @since 2.0.0
272
+ */
273
+ const isObject = input => isRecordOrArray(input) || isFunction(input);
274
+ /**
275
+ * Checks whether a value is an `object` containing a specified property key.
276
+ *
277
+ * @param property - The field to check within the object.
278
+ * @param self - The value to examine.
279
+ *
280
+ * @category guards
281
+ * @since 2.0.0
282
+ */
283
+ const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
284
+ /**
285
+ * A guard that succeeds when the input is `null` or `undefined`.
286
+ *
287
+ * @param input - The value to test.
288
+ *
289
+ * @example
290
+ * import { isNullable } from "effect/Predicate"
291
+ *
292
+ * assert.deepStrictEqual(isNullable(null), true)
293
+ * assert.deepStrictEqual(isNullable(undefined), true)
294
+ *
295
+ * assert.deepStrictEqual(isNullable({}), false)
296
+ * assert.deepStrictEqual(isNullable([]), false)
297
+ *
298
+ * @category guards
299
+ * @since 2.0.0
300
+ */
301
+ const isNullable = input => input === null || input === undefined;
302
+
303
+ /**
304
+ * @since 2.0.0
305
+ */
306
+ const defaultIncHi = 0x14057b7e;
307
+ const defaultIncLo = 0xf767814f;
308
+ const MUL_HI = 0x5851f42d >>> 0;
309
+ const MUL_LO = 0x4c957f2d >>> 0;
310
+ const BIT_53 = 9007199254740992.0;
311
+ const BIT_27 = 134217728.0;
312
+ /**
313
+ * PCG is a family of simple fast space-efficient statistically good algorithms
314
+ * for random number generation. Unlike many general-purpose RNGs, they are also
315
+ * hard to predict.
316
+ *
317
+ * @category model
318
+ * @since 2.0.0
319
+ */
320
+ class PCGRandom {
321
+ _state;
322
+ constructor(seedHi, seedLo, incHi, incLo) {
323
+ if (isNullable(seedLo) && isNullable(seedHi)) {
324
+ seedLo = Math.random() * 0xffffffff >>> 0;
325
+ seedHi = 0;
326
+ } else if (isNullable(seedLo)) {
327
+ seedLo = seedHi;
328
+ seedHi = 0;
329
+ }
330
+ if (isNullable(incLo) && isNullable(incHi)) {
331
+ incLo = this._state ? this._state[3] : defaultIncLo;
332
+ incHi = this._state ? this._state[2] : defaultIncHi;
333
+ } else if (isNullable(incLo)) {
334
+ incLo = incHi;
335
+ incHi = 0;
336
+ }
337
+ this._state = new Int32Array([0, 0, incHi >>> 0, ((incLo || 0) | 1) >>> 0]);
338
+ this._next();
339
+ add64(this._state, this._state[0], this._state[1], seedHi >>> 0, seedLo >>> 0);
340
+ this._next();
341
+ return this;
342
+ }
343
+ /**
344
+ * Returns a copy of the internal state of this random number generator as a
345
+ * JavaScript Array.
346
+ *
347
+ * @category getters
348
+ * @since 2.0.0
349
+ */
350
+ getState() {
351
+ return [this._state[0], this._state[1], this._state[2], this._state[3]];
352
+ }
353
+ /**
354
+ * Restore state previously retrieved using `getState()`.
355
+ *
356
+ * @since 2.0.0
357
+ */
358
+ setState(state) {
359
+ this._state[0] = state[0];
360
+ this._state[1] = state[1];
361
+ this._state[2] = state[2];
362
+ this._state[3] = state[3] | 1;
363
+ }
364
+ /**
365
+ * Get a uniformly distributed 32 bit integer between [0, max).
366
+ *
367
+ * @category getter
368
+ * @since 2.0.0
369
+ */
370
+ integer(max) {
371
+ if (!max) {
372
+ return this._next();
373
+ }
374
+ max = max >>> 0;
375
+ if ((max & max - 1) === 0) {
376
+ return this._next() & max - 1; // fast path for power of 2
377
+ }
378
+ let num = 0;
379
+ const skew = (-max >>> 0) % max >>> 0;
380
+ for (num = this._next(); num < skew; num = this._next()) {
381
+ // this loop will rarely execute more than twice,
382
+ // and is intentionally empty
383
+ }
384
+ return num % max;
385
+ }
386
+ /**
387
+ * Get a uniformly distributed IEEE-754 double between 0.0 and 1.0, with
388
+ * 53 bits of precision (every bit of the mantissa is randomized).
389
+ *
390
+ * @category getters
391
+ * @since 2.0.0
392
+ */
393
+ number() {
394
+ const hi = (this._next() & 0x03ffffff) * 1.0;
395
+ const lo = (this._next() & 0x07ffffff) * 1.0;
396
+ return (hi * BIT_27 + lo) / BIT_53;
397
+ }
398
+ /** @internal */
399
+ _next() {
400
+ // save current state (what we'll use for this number)
401
+ const oldHi = this._state[0] >>> 0;
402
+ const oldLo = this._state[1] >>> 0;
403
+ // churn LCG.
404
+ mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
405
+ add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
406
+ // get least sig. 32 bits of ((oldstate >> 18) ^ oldstate) >> 27
407
+ let xsHi = oldHi >>> 18;
408
+ let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
409
+ xsHi = (xsHi ^ oldHi) >>> 0;
410
+ xsLo = (xsLo ^ oldLo) >>> 0;
411
+ const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
412
+ // rotate xorshifted right a random amount, based on the most sig. 5 bits
413
+ // bits of the old state.
414
+ const rot = oldHi >>> 27;
415
+ const rot2 = (-rot >>> 0 & 31) >>> 0;
416
+ return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
417
+ }
418
+ }
419
+ function mul64(out, aHi, aLo, bHi, bLo) {
420
+ let c1 = (aLo >>> 16) * (bLo & 0xffff) >>> 0;
421
+ let c0 = (aLo & 0xffff) * (bLo >>> 16) >>> 0;
422
+ let lo = (aLo & 0xffff) * (bLo & 0xffff) >>> 0;
423
+ let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
424
+ c0 = c0 << 16 >>> 0;
425
+ lo = lo + c0 >>> 0;
426
+ if (lo >>> 0 < c0 >>> 0) {
427
+ hi = hi + 1 >>> 0;
428
+ }
429
+ c1 = c1 << 16 >>> 0;
430
+ lo = lo + c1 >>> 0;
431
+ if (lo >>> 0 < c1 >>> 0) {
432
+ hi = hi + 1 >>> 0;
433
+ }
434
+ hi = hi + Math.imul(aLo, bHi) >>> 0;
435
+ hi = hi + Math.imul(aHi, bLo) >>> 0;
436
+ out[0] = hi;
437
+ out[1] = lo;
438
+ }
439
+ // add two 64 bit numbers (given in parts), and store the result in `out`.
440
+ function add64(out, aHi, aLo, bHi, bLo) {
441
+ let hi = aHi + bHi >>> 0;
442
+ const lo = aLo + bLo >>> 0;
443
+ if (lo >>> 0 < aLo >>> 0) {
444
+ hi = hi + 1 | 0;
445
+ }
446
+ out[0] = hi;
447
+ out[1] = lo;
448
+ }
449
+
450
+ /**
451
+ * @since 2.0.0
452
+ */
453
+ /** @internal */
454
+ const randomHashCache = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
455
+ /** @internal */
456
+ const pcgr = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
457
+ /**
458
+ * @since 2.0.0
459
+ * @category symbols
460
+ */
461
+ const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
462
+ /**
463
+ * @since 2.0.0
464
+ * @category hashing
465
+ */
466
+ const hash = self => {
467
+ switch (typeof self) {
468
+ case "number":
469
+ return number(self);
470
+ case "bigint":
471
+ return string(self.toString(10));
472
+ case "boolean":
473
+ return string(String(self));
474
+ case "symbol":
475
+ return string(String(self));
476
+ case "string":
477
+ return string(self);
478
+ case "undefined":
479
+ return string("undefined");
480
+ case "function":
481
+ case "object":
482
+ {
483
+ if (self === null) {
484
+ return string("null");
485
+ }
486
+ if (isHash(self)) {
487
+ return self[symbol$1]();
488
+ } else {
489
+ return random(self);
490
+ }
491
+ }
492
+ default:
493
+ throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
494
+ }
495
+ };
496
+ /**
497
+ * @since 2.0.0
498
+ * @category hashing
499
+ */
500
+ const random = self => {
501
+ if (!randomHashCache.has(self)) {
502
+ randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
503
+ }
504
+ return randomHashCache.get(self);
505
+ };
506
+ /**
507
+ * @since 2.0.0
508
+ * @category hashing
509
+ */
510
+ const combine = b => self => self * 53 ^ b;
511
+ /**
512
+ * @since 2.0.0
513
+ * @category hashing
514
+ */
515
+ const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
516
+ /**
517
+ * @since 2.0.0
518
+ * @category guards
519
+ */
520
+ const isHash = u => hasProperty(u, symbol$1);
521
+ /**
522
+ * @since 2.0.0
523
+ * @category hashing
524
+ */
525
+ const number = n => {
526
+ if (n !== n || n === Infinity) {
527
+ return 0;
528
+ }
529
+ let h = n | 0;
530
+ if (h !== n) {
531
+ h ^= n * 0xffffffff;
532
+ }
533
+ while (n > 0xffffffff) {
534
+ h ^= n /= 0xffffffff;
535
+ }
536
+ return optimize(n);
537
+ };
538
+ /**
539
+ * @since 2.0.0
540
+ * @category hashing
541
+ */
542
+ const string = str => {
543
+ let h = 5381,
544
+ i = str.length;
545
+ while (i) {
546
+ h = h * 33 ^ str.charCodeAt(--i);
547
+ }
548
+ return optimize(h);
549
+ };
550
+
551
+ /**
552
+ * @since 2.0.0
553
+ * @category symbols
554
+ */
555
+ const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
556
+ function equals() {
557
+ if (arguments.length === 1) {
558
+ return self => compareBoth(self, arguments[0]);
559
+ }
560
+ return compareBoth(arguments[0], arguments[1]);
561
+ }
562
+ function compareBoth(self, that) {
563
+ if (self === that) {
564
+ return true;
565
+ }
566
+ const selfType = typeof self;
567
+ if (selfType !== typeof that) {
568
+ return false;
569
+ }
570
+ if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
571
+ if (isEqual(self) && isEqual(that)) {
572
+ return hash(self) === hash(that) && self[symbol](that);
573
+ }
574
+ }
575
+ return false;
576
+ }
577
+ /**
578
+ * @since 2.0.0
579
+ * @category guards
580
+ */
581
+ const isEqual = u => hasProperty(u, symbol);
582
+
583
+ /**
584
+ * @since 2.0.0
585
+ */
586
+ /**
587
+ * @since 2.0.0
588
+ * @category symbols
589
+ */
590
+ const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
591
+ /**
592
+ * @since 2.0.0
593
+ */
594
+ const toJSON = x => {
595
+ if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
596
+ return x.toJSON();
597
+ } else if (Array.isArray(x)) {
598
+ return x.map(toJSON);
599
+ }
600
+ return x;
601
+ };
602
+ /**
603
+ * @since 2.0.0
604
+ */
605
+ const format = x => JSON.stringify(x, null, 2);
606
+
607
+ /**
608
+ * @since 2.0.0
609
+ */
610
+ /**
611
+ * @since 2.0.0
612
+ */
613
+ const pipeArguments = (self, args) => {
614
+ switch (args.length) {
615
+ case 1:
616
+ return args[0](self);
617
+ case 2:
618
+ return args[1](args[0](self));
619
+ case 3:
620
+ return args[2](args[1](args[0](self)));
621
+ case 4:
622
+ return args[3](args[2](args[1](args[0](self))));
623
+ case 5:
624
+ return args[4](args[3](args[2](args[1](args[0](self)))));
625
+ case 6:
626
+ return args[5](args[4](args[3](args[2](args[1](args[0](self))))));
627
+ case 7:
628
+ return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))));
629
+ case 8:
630
+ return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
631
+ case 9:
632
+ return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
633
+ default:
634
+ {
635
+ let ret = self;
636
+ for (let i = 0, len = args.length; i < len; i++) {
637
+ ret = args[i](ret);
638
+ }
639
+ return ret;
640
+ }
641
+ }
642
+ };
643
+
644
+ /** @internal */
645
+ const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
646
+ /** @internal */
647
+ const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
648
+ /** @internal */
649
+ const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
650
+ /** @internal */
651
+ const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
652
+ /** @internal */
653
+ const effectVariance = {
654
+ /* c8 ignore next */
655
+ _R: _ => _,
656
+ /* c8 ignore next */
657
+ _E: _ => _,
658
+ /* c8 ignore next */
659
+ _A: _ => _,
660
+ _V: moduleVersion
661
+ };
662
+ const sinkVariance = {
663
+ /* c8 ignore next */
664
+ _R: _ => _,
665
+ /* c8 ignore next */
666
+ _E: _ => _,
667
+ /* c8 ignore next */
668
+ _In: _ => _,
669
+ /* c8 ignore next */
670
+ _L: _ => _,
671
+ /* c8 ignore next */
672
+ _Z: _ => _
673
+ };
674
+ const channelVariance = {
675
+ /* c8 ignore next */
676
+ _Env: _ => _,
677
+ /* c8 ignore next */
678
+ _InErr: _ => _,
679
+ /* c8 ignore next */
680
+ _InElem: _ => _,
681
+ /* c8 ignore next */
682
+ _InDone: _ => _,
683
+ /* c8 ignore next */
684
+ _OutErr: _ => _,
685
+ /* c8 ignore next */
686
+ _OutElem: _ => _,
687
+ /* c8 ignore next */
688
+ _OutDone: _ => _
689
+ };
690
+ /** @internal */
691
+ const EffectPrototype = {
692
+ [EffectTypeId]: effectVariance,
693
+ [StreamTypeId]: effectVariance,
694
+ [SinkTypeId]: sinkVariance,
695
+ [ChannelTypeId]: channelVariance,
696
+ [symbol](that) {
697
+ return this === that;
698
+ },
699
+ [symbol$1]() {
700
+ return random(this);
701
+ },
702
+ pipe() {
703
+ return pipeArguments(this, arguments);
704
+ }
705
+ };
706
+
707
+ /**
708
+ * @since 2.0.0
709
+ */
710
+ const TypeId = /*#__PURE__*/Symbol.for("effect/Option");
711
+ const CommonProto = {
712
+ ...EffectPrototype,
713
+ [TypeId]: {
714
+ _A: _ => _
715
+ },
716
+ [NodeInspectSymbol]() {
717
+ return this.toJSON();
718
+ },
719
+ toString() {
720
+ return format(this.toJSON());
721
+ }
722
+ };
723
+ const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
724
+ _tag: "Some",
725
+ _op: "Some",
726
+ [symbol](that) {
727
+ return isOption(that) && isSome$1(that) && equals(that.value, this.value);
728
+ },
729
+ [symbol$1]() {
730
+ return combine(hash(this._tag))(hash(this.value));
731
+ },
732
+ toJSON() {
733
+ return {
734
+ _id: "Option",
735
+ _tag: this._tag,
736
+ value: toJSON(this.value)
737
+ };
738
+ }
739
+ });
740
+ const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
741
+ _tag: "None",
742
+ _op: "None",
743
+ [symbol](that) {
744
+ return isOption(that) && isNone$1(that);
745
+ },
746
+ [symbol$1]() {
747
+ return combine(hash(this._tag));
748
+ },
749
+ toJSON() {
750
+ return {
751
+ _id: "Option",
752
+ _tag: this._tag
753
+ };
754
+ }
755
+ });
756
+ /** @internal */
757
+ const isOption = input => hasProperty(input, TypeId);
758
+ /** @internal */
759
+ const isNone$1 = fa => fa._tag === "None";
760
+ /** @internal */
761
+ const isSome$1 = fa => fa._tag === "Some";
762
+ /** @internal */
763
+ const none$1 = /*#__PURE__*/Object.create(NoneProto);
764
+ /** @internal */
765
+ const some$1 = value => {
766
+ const a = Object.create(SomeProto);
767
+ a.value = value;
768
+ return a;
769
+ };
770
+
771
+ /**
772
+ * Creates a new `Option` that represents the absence of a value.
773
+ *
774
+ * @category constructors
775
+ * @since 2.0.0
776
+ */
777
+ const none = () => none$1;
778
+ /**
779
+ * Creates a new `Option` that wraps the given value.
780
+ *
781
+ * @param value - The value to wrap.
782
+ *
783
+ * @category constructors
784
+ * @since 2.0.0
785
+ */
786
+ const some = some$1;
787
+ /**
788
+ * Determine if a `Option` is a `None`.
789
+ *
790
+ * @param self - The `Option` to check.
791
+ *
792
+ * @example
793
+ * import { some, none, isNone } from 'effect/Option'
794
+ *
795
+ * assert.deepStrictEqual(isNone(some(1)), false)
796
+ * assert.deepStrictEqual(isNone(none()), true)
797
+ *
798
+ * @category guards
799
+ * @since 2.0.0
800
+ */
801
+ const isNone = isNone$1;
802
+ /**
803
+ * Determine if a `Option` is a `Some`.
804
+ *
805
+ * @param self - The `Option` to check.
806
+ *
807
+ * @example
808
+ * import { some, none, isSome } from 'effect/Option'
809
+ *
810
+ * assert.deepStrictEqual(isSome(some(1)), true)
811
+ * assert.deepStrictEqual(isSome(none()), false)
812
+ *
813
+ * @category guards
814
+ * @since 2.0.0
815
+ */
816
+ const isSome = isSome$1;
817
+ /**
818
+ * Returns the value of the `Option` if it is `Some`, otherwise returns `onNone`
819
+ *
820
+ * @param self - The `Option` to get the value of.
821
+ * @param onNone - Function that returns the default value to return if the `Option` is `None`.
822
+ *
823
+ * @example
824
+ * import { some, none, getOrElse } from 'effect/Option'
825
+ * import { pipe } from "effect/Function"
826
+ *
827
+ * assert.deepStrictEqual(pipe(some(1), getOrElse(() => 0)), 1)
828
+ * assert.deepStrictEqual(pipe(none(), getOrElse(() => 0)), 0)
829
+ *
830
+ * @category getters
831
+ * @since 2.0.0
832
+ */
833
+ const getOrElse = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
834
+ /**
835
+ * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.
836
+ *
837
+ * @param self - The first `Option` to be checked.
838
+ * @param that - The `Option` to return if `self` is `None`.
839
+ *
840
+ * @example
841
+ * import * as O from "effect/Option"
842
+ * import { pipe } from "effect/Function"
843
+ *
844
+ * assert.deepStrictEqual(
845
+ * pipe(
846
+ * O.none(),
847
+ * O.orElse(() => O.none())
848
+ * ),
849
+ * O.none()
850
+ * )
851
+ * assert.deepStrictEqual(
852
+ * pipe(
853
+ * O.some('a'),
854
+ * O.orElse(() => O.none())
855
+ * ),
856
+ * O.some('a')
857
+ * )
858
+ * assert.deepStrictEqual(
859
+ * pipe(
860
+ * O.none(),
861
+ * O.orElse(() => O.some('b'))
862
+ * ),
863
+ * O.some('b')
864
+ * )
865
+ * assert.deepStrictEqual(
866
+ * pipe(
867
+ * O.some('a'),
868
+ * O.orElse(() => O.some('b'))
869
+ * ),
870
+ * O.some('a')
871
+ * )
872
+ *
873
+ * @category error handling
874
+ * @since 2.0.0
875
+ */
876
+ const orElse = /*#__PURE__*/dual(2, (self, that) => isNone(self) ? that() : self);
877
+ /**
878
+ * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
879
+ * returns the value wrapped in a `Some`.
880
+ *
881
+ * @param nullableValue - The nullable value to be converted to an `Option`.
882
+ *
883
+ * @example
884
+ * import * as O from "effect/Option"
885
+ *
886
+ * assert.deepStrictEqual(O.fromNullable(undefined), O.none())
887
+ * assert.deepStrictEqual(O.fromNullable(null), O.none())
888
+ * assert.deepStrictEqual(O.fromNullable(1), O.some(1))
889
+ *
890
+ * @category conversions
891
+ * @since 2.0.0
892
+ */
893
+ const fromNullable = nullableValue => nullableValue == null ? none() : some(nullableValue);
894
+ /**
895
+ * Maps the `Some` side of an `Option` value to a new `Option` value.
896
+ *
897
+ * @param self - An `Option` to map
898
+ * @param f - The function to map over the value of the `Option`
899
+ *
900
+ * @category mapping
901
+ * @since 2.0.0
902
+ */
903
+ const map = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
904
+ /**
905
+ * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
906
+ *
907
+ * @category sequencing
908
+ * @since 2.0.0
909
+ */
910
+ const flatMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
911
+ /**
912
+ * This is `flatMap` + `fromNullable`, useful when working with optional values.
913
+ *
914
+ * @example
915
+ * import { some, none, flatMapNullable } from 'effect/Option'
916
+ * import { pipe } from "effect/Function"
917
+ *
918
+ * interface Employee {
919
+ * company?: {
920
+ * address?: {
921
+ * street?: {
922
+ * name?: string
923
+ * }
924
+ * }
925
+ * }
926
+ * }
927
+ *
928
+ * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
929
+ *
930
+ * assert.deepStrictEqual(
931
+ * pipe(
932
+ * some(employee1),
933
+ * flatMapNullable(employee => employee.company?.address?.street?.name),
934
+ * ),
935
+ * some('high street')
936
+ * )
937
+ *
938
+ * const employee2: Employee = { company: { address: { street: {} } } }
939
+ *
940
+ * assert.deepStrictEqual(
941
+ * pipe(
942
+ * some(employee2),
943
+ * flatMapNullable(employee => employee.company?.address?.street?.name),
944
+ * ),
945
+ * none()
946
+ * )
947
+ *
948
+ * @category sequencing
949
+ * @since 2.0.0
950
+ */
951
+ const flatMapNullable = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : fromNullable(f(self.value)));
952
+ /**
953
+ * @category combining
954
+ * @since 2.0.0
955
+ */
956
+ const product = (self, that) => isSome(self) && isSome(that) ? some([self.value, that.value]) : none();
957
+ /**
958
+ * Zips two `Option` values together using a provided function, returning a new `Option` of the result.
959
+ *
960
+ * @param self - The left-hand side of the zip operation
961
+ * @param that - The right-hand side of the zip operation
962
+ * @param f - The function used to combine the values of the two `Option`s
963
+ *
964
+ * @example
965
+ * import * as O from "effect/Option"
966
+ *
967
+ * type Complex = [real: number, imaginary: number]
968
+ *
969
+ * const complex = (real: number, imaginary: number): Complex => [real, imaginary]
970
+ *
971
+ * assert.deepStrictEqual(O.zipWith(O.none(), O.none(), complex), O.none())
972
+ * assert.deepStrictEqual(O.zipWith(O.some(1), O.none(), complex), O.none())
973
+ * assert.deepStrictEqual(O.zipWith(O.none(), O.some(1), complex), O.none())
974
+ * assert.deepStrictEqual(O.zipWith(O.some(1), O.some(2), complex), O.some([1, 2]))
975
+ *
976
+ * assert.deepStrictEqual(O.zipWith(O.some(1), complex)(O.some(2)), O.some([2, 1]))
977
+ *
978
+ * @category zipping
979
+ * @since 2.0.0
980
+ */
981
+ const zipWith = /*#__PURE__*/dual(3, (self, that, f) => map(product(self, that), ([a, b]) => f(a, b)));
982
+ /**
983
+ * Maps over the value of an `Option` and filters out `None`s.
984
+ *
985
+ * Useful when in addition to filtering you also want to change the type of the `Option`.
986
+ *
987
+ * @param self - The `Option` to map over.
988
+ * @param f - A function to apply to the value of the `Option`.
989
+ *
990
+ * @example
991
+ * import * as O from "effect/Option"
992
+ *
993
+ * const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
994
+ *
995
+ * assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
996
+ * assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
997
+ * assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
998
+ *
999
+ * @category filtering
1000
+ * @since 2.0.0
1001
+ */
1002
+ const filterMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
1003
+ /**
1004
+ * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1005
+ *
1006
+ * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1007
+ *
1008
+ * @param predicate - A predicate function to apply to the `Option` value.
1009
+ * @param fb - The `Option` to filter.
1010
+ *
1011
+ * @example
1012
+ * import * as O from "effect/Option"
1013
+ *
1014
+ * // predicate
1015
+ * const isEven = (n: number) => n % 2 === 0
1016
+ *
1017
+ * assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
1018
+ * assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
1019
+ * assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
1020
+ *
1021
+ * // refinement
1022
+ * const isNumber = (v: unknown): v is number => typeof v === "number"
1023
+ *
1024
+ * assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
1025
+ * assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
1026
+ * assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
1027
+ *
1028
+ * @category filtering
1029
+ * @since 2.0.0
1030
+ */
1031
+ const filter = /*#__PURE__*/dual(2, (self, predicate) => filterMap(self, b => predicate(b) ? some$1(b) : none$1));
1032
+ /**
1033
+ * Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
1034
+ * if the predicate returns `false`.
1035
+ *
1036
+ * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
1037
+ *
1038
+ * @example
1039
+ * import * as O from "effect/Option"
1040
+ *
1041
+ * const getOption = O.liftPredicate((n: number) => n >= 0)
1042
+ *
1043
+ * assert.deepStrictEqual(getOption(-1), O.none())
1044
+ * assert.deepStrictEqual(getOption(1), O.some(1))
1045
+ *
1046
+ * @category lifting
1047
+ * @since 2.0.0
1048
+ */
1049
+ const liftPredicate = predicate => b => predicate(b) ? some(b) : none();
1050
+ /**
1051
+ * Check if a value in an `Option` type meets a certain predicate.
1052
+ *
1053
+ * @param self - The `Option` to check.
1054
+ * @param predicate - The condition to check.
1055
+ *
1056
+ * @example
1057
+ * import { some, none, exists } from 'effect/Option'
1058
+ * import { pipe } from "effect/Function"
1059
+ *
1060
+ * const isEven = (n: number) => n % 2 === 0
1061
+ *
1062
+ * assert.deepStrictEqual(pipe(some(2), exists(isEven)), true)
1063
+ * assert.deepStrictEqual(pipe(some(1), exists(isEven)), false)
1064
+ * assert.deepStrictEqual(pipe(none(), exists(isEven)), false)
1065
+ *
1066
+ * @since 2.0.0
1067
+ */
1068
+ const exists = /*#__PURE__*/dual(2, (self, refinement) => isNone(self) ? false : refinement(self.value));
1069
+
1070
+ /**
1071
+ * Bun currently has a bug where `setTimeout` doesn't behave correctly with a 0ms delay.
1072
+ *
1073
+ * @see https://github.com/oven-sh/bun/issues/3333
1074
+ */
1075
+ /** @internal */
1076
+ typeof process === "undefined" ? false : !!process?.isBun;
1077
+
10
1078
  const RE_JSX_ANNOTATION_REGEX = /@jsx\s+(\S+)/u;
11
1079
  // Does not check for reserved keywords or unicode characters
12
1080
  const RE_JS_IDENTIFIER_REGEX = /^[$A-Z_a-z][\w$]*$/u;
13
1081
  function getFragmentFromContext(context) {
14
1082
  const settings = shared.parseSchema(shared.ESLintSettingsSchema, context.settings);
15
1083
  const fragment = settings.reactOptions?.jsxPragmaFrag;
16
- if (tools.Prd.isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment)) return fragment;
1084
+ if (isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment)) return fragment;
17
1085
  return "Fragment";
18
1086
  }
19
1087
  const getPragmaFromContext = memo((context)=>{
@@ -21,15 +1089,15 @@ const getPragmaFromContext = memo((context)=>{
21
1089
  const pragma = settings.reactOptions?.jsxPragma;
22
1090
  const { sourceCode } = context;
23
1091
  const pragmaNode = sourceCode.getAllComments().find((node)=>RE_JSX_ANNOTATION_REGEX.test(node.value));
24
- return tools.F.pipe(tools.O.orElse(tools.O.fromNullable(pragma), ()=>tools.F.pipe(tools.O.fromNullable(pragmaNode), tools.O.map(({ value })=>RE_JSX_ANNOTATION_REGEX.exec(value)), tools.O.flatMapNullable((matches)=>matches?.[1]?.split(".")[0]))), tools.O.flatMap(tools.O.liftPredicate((x)=>RE_JS_IDENTIFIER_REGEX.test(x))), tools.O.getOrElse(tools.F.constant("React")));
1092
+ return pipe(orElse(fromNullable(pragma), ()=>pipe(fromNullable(pragmaNode), map(({ value })=>RE_JSX_ANNOTATION_REGEX.exec(value)), flatMapNullable((matches)=>matches?.[1]?.split(".")[0]))), flatMap(liftPredicate((x)=>RE_JS_IDENTIFIER_REGEX.test(x))), getOrElse(constant("React")));
25
1093
  });
26
1094
 
27
1095
  const t=Symbol.for("@ts-pattern/matcher"),e=Symbol.for("@ts-pattern/isVariadic"),n="@ts-pattern/anonymous-select-key",r=t=>Boolean(t&&"object"==typeof t),i=e=>e&&!!e[t],s=(n,o,c)=>{if(i(n)){const e=n[t](),{matched:r,selections:i}=e.match(o);return r&&i&&Object.keys(i).forEach(t=>c(t,i[t])),r}if(r(n)){if(!r(o))return !1;if(Array.isArray(n)){if(!Array.isArray(o))return !1;let t=[],r=[],a=[];for(const s of n.keys()){const o=n[s];i(o)&&o[e]?a.push(o):a.length?r.push(o):t.push(o);}if(a.length){if(a.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(o.length<t.length+r.length)return !1;const e=o.slice(0,t.length),n=0===r.length?[]:o.slice(-r.length),i=o.slice(t.length,0===r.length?Infinity:-r.length);return t.every((t,n)=>s(t,e[n],c))&&r.every((t,e)=>s(t,n[e],c))&&(0===a.length||s(a[0],i,c))}return n.length===o.length&&n.every((t,e)=>s(t,o[e],c))}return Object.keys(n).every(e=>{const r=n[e];return (e in o||i(a=r)&&"optional"===a[t]().matcherType)&&s(r,o[e],c);var a;})}return Object.is(o,n)},o=e=>{var n,s,a;return r(e)?i(e)?null!=(n=null==(s=(a=e[t]()).getSelectionKeys)?void 0:s.call(a))?n:[]:Array.isArray(e)?c(e,o):c(Object.values(e),o):[]},c=(t,e)=>t.reduce((t,n)=>t.concat(e(n)),[]);function a(...t){if(1===t.length){const[e]=t;return t=>s(e,t,()=>{})}if(2===t.length){const[e,n]=t;return s(e,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`)}function u(t){return Object.assign(t,{optional:()=>l(t),and:e=>m(t,e),or:e=>y(t,e),select:e=>void 0===e?p(t):p(e,t)})}function h(t){return Object.assign((t=>Object.assign(t,{*[Symbol.iterator](){yield Object.assign(t,{[e]:!0});}}))(t),{optional:()=>h(l(t)),select:e=>h(void 0===e?p(t):p(e,t))})}function l(e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e;};return void 0===t?(o(e).forEach(t=>r(t,void 0)),{matched:!0,selections:n}):{matched:s(e,t,r),selections:n}},getSelectionKeys:()=>o(e),matcherType:"optional"})})}const f=(t,e)=>{for(const n of t)if(!e(n))return !1;return !0},g=(t,e)=>{for(const[n,r]of t.entries())if(!e(r,n))return !1;return !0};function m(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e;};return {matched:e.every(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:"and"})})}function y(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e;};return c(e,o).forEach(t=>r(t,void 0)),{matched:e.some(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:"or"})})}function d(e){return {[t]:()=>({match:t=>({matched:Boolean(e(t))})})}}function p(...e){const r="string"==typeof e[0]?e[0]:void 0,i=2===e.length?e[1]:"string"==typeof e[0]?void 0:e[0];return u({[t]:()=>({match:t=>{let e={[null!=r?r:n]:t};return {matched:void 0===i||s(i,t,(t,n)=>{e[t]=n;}),selections:e}},getSelectionKeys:()=>[null!=r?r:n].concat(void 0===i?[]:o(i))})})}function v(t){return "number"==typeof t}function b(t){return "string"==typeof t}function w(t){return "bigint"==typeof t}const S=u(d(function(t){return !0})),O=S,j=t=>Object.assign(u(t),{startsWith:e=>{return j(m(t,(n=e,d(t=>b(t)&&t.startsWith(n)))));var n;},endsWith:e=>{return j(m(t,(n=e,d(t=>b(t)&&t.endsWith(n)))));var n;},minLength:e=>j(m(t,(t=>d(e=>b(e)&&e.length>=t))(e))),maxLength:e=>j(m(t,(t=>d(e=>b(e)&&e.length<=t))(e))),includes:e=>{return j(m(t,(n=e,d(t=>b(t)&&t.includes(n)))));var n;},regex:e=>{return j(m(t,(n=e,d(t=>b(t)&&Boolean(t.match(n))))));var n;}}),E=j(d(b)),K=t=>Object.assign(u(t),{between:(e,n)=>K(m(t,((t,e)=>d(n=>v(n)&&t<=n&&e>=n))(e,n))),lt:e=>K(m(t,(t=>d(e=>v(e)&&e<t))(e))),gt:e=>K(m(t,(t=>d(e=>v(e)&&e>t))(e))),lte:e=>K(m(t,(t=>d(e=>v(e)&&e<=t))(e))),gte:e=>K(m(t,(t=>d(e=>v(e)&&e>=t))(e))),int:()=>K(m(t,d(t=>v(t)&&Number.isInteger(t)))),finite:()=>K(m(t,d(t=>v(t)&&Number.isFinite(t)))),positive:()=>K(m(t,d(t=>v(t)&&t>0))),negative:()=>K(m(t,d(t=>v(t)&&t<0)))}),A=K(d(v)),x=t=>Object.assign(u(t),{between:(e,n)=>x(m(t,((t,e)=>d(n=>w(n)&&t<=n&&e>=n))(e,n))),lt:e=>x(m(t,(t=>d(e=>w(e)&&e<t))(e))),gt:e=>x(m(t,(t=>d(e=>w(e)&&e>t))(e))),lte:e=>x(m(t,(t=>d(e=>w(e)&&e<=t))(e))),gte:e=>x(m(t,(t=>d(e=>w(e)&&e>=t))(e))),positive:()=>x(m(t,d(t=>w(t)&&t>0))),negative:()=>x(m(t,d(t=>w(t)&&t<0)))}),P=x(d(w)),T=u(d(function(t){return "boolean"==typeof t})),k=u(d(function(t){return "symbol"==typeof t})),B=u(d(function(t){return null==t}));var _={__proto__:null,matcher:t,optional:l,array:function(...e){return h({[t]:()=>({match:t=>{if(!Array.isArray(t))return {matched:!1};if(0===e.length)return {matched:!0};const n=e[0];let r={};if(0===t.length)return o(n).forEach(t=>{r[t]=[];}),{matched:!0,selections:r};const i=(t,e)=>{r[t]=(r[t]||[]).concat([e]);};return {matched:t.every(t=>s(n,t,i)),selections:r}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},set:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Set))return {matched:!1};let n={};if(0===t.size)return {matched:!0,selections:n};if(0===e.length)return {matched:!0};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e]);},i=e[0];return {matched:f(t,t=>s(i,t,r)),selections:n}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},map:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Map))return {matched:!1};let n={};if(0===t.size)return {matched:!0,selections:n};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e]);};if(0===e.length)return {matched:!0};var i;if(1===e.length)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null==(i=e[0])?void 0:i.toString()}`);const[o,c]=e;return {matched:g(t,(t,e)=>{const n=s(o,e,r),i=s(c,t,r);return n&&i}),selections:n}},getSelectionKeys:()=>0===e.length?[]:[...o(e[0]),...o(e[1])]})})},intersection:m,union:y,not:function(e){return u({[t]:()=>({match:t=>({matched:!s(e,t,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:d,select:p,any:S,_:O,string:E,number:A,bigint:P,boolean:T,symbol:k,nullish:B,instanceOf:function(t){return u(d(function(t){return e=>e instanceof t}(t)))},shape:function(t){return u(d(a(t)))}};const W={matched:!1,value:void 0};function N(t){return new $(t,W)}class ${constructor(t,e){this.input=void 0,this.state=void 0,this.input=t,this.state=e;}with(...t){if(this.state.matched)return this;const e=t[t.length-1],r=[t[0]];let i;3===t.length&&"function"==typeof t[1]?i=t[1]:t.length>2&&r.push(...t.slice(1,t.length-1));let o=!1,c={};const a=(t,e)=>{o=!0,c[t]=e;},u=!r.some(t=>s(t,this.input,a))||i&&!Boolean(i(this.input))?W:{matched:!0,value:e(o?n in c?c[n]:c:this.input,this.input)};return new $(this.input,u)}when(t,e){if(this.state.matched)return this;const n=Boolean(t(this.input));return new $(this.input,n?{matched:!0,value:e(this.input,this.input)}:W)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;let t;try{t=JSON.stringify(this.input);}catch(e){t=this.input;}throw new Error(`Pattern matching error: no pattern matches value ${t}`)}run(){return this.exhaustive()}returnType(){return this}}
28
1096
 
29
1097
  function isInitializedFromPragma(variableName, context, initialScope, pragma = getPragmaFromContext(context)) {
30
1098
  const maybeVariable = _var.findVariable(variableName, initialScope);
31
- const maybeLatestDef = tools.O.flatMapNullable(maybeVariable, (variable)=>variable.defs.at(-1));
32
- if (tools.O.isNone(maybeLatestDef)) return false;
1099
+ const maybeLatestDef = flatMapNullable(maybeVariable, (variable)=>variable.defs.at(-1));
1100
+ if (isNone(maybeLatestDef)) return false;
33
1101
  const latestDef = maybeLatestDef.value;
34
1102
  const { node, parent } = latestDef;
35
1103
  if (node.type === ast.NodeType.VariableDeclarator && node.init) {
@@ -54,7 +1122,7 @@ function isInitializedFromPragma(variableName, context, initialScope, pragma = g
54
1122
  type: ast.NodeType.Identifier,
55
1123
  name: "require"
56
1124
  }
57
- }, (exp)=>tools.O.some(exp)).with({
1125
+ }, (exp)=>some(exp)).with({
58
1126
  type: ast.NodeType.MemberExpression,
59
1127
  object: {
60
1128
  type: ast.NodeType.CallExpression,
@@ -63,8 +1131,8 @@ function isInitializedFromPragma(variableName, context, initialScope, pragma = g
63
1131
  name: "require"
64
1132
  }
65
1133
  }
66
- }, ({ object })=>tools.O.some(object)).otherwise(tools.O.none);
67
- if (tools.O.isNone(maybeRequireExpression)) return false;
1134
+ }, ({ object })=>some(object)).otherwise(none);
1135
+ if (isNone(maybeRequireExpression)) return false;
68
1136
  const requireExpression = maybeRequireExpression.value;
69
1137
  const [firstArg] = requireExpression.arguments;
70
1138
  if (firstArg?.type !== ast.NodeType.Literal) return false;
@@ -188,10 +1256,10 @@ function resolveMemberExpressions(object, property) {
188
1256
  * @param context The rule context
189
1257
  * @returns `true` if the node is inside createElement's props
190
1258
  */ function isInsideCreateElementProps(node, context) {
191
- return tools.F.pipe(ast.traverseUp(node, (n)=>ast.is(ast.NodeType.CallExpression)(n) && isCreateElementCall(n, context)), tools.O.filter(ast.is(ast.NodeType.CallExpression)), tools.O.flatMapNullable((c)=>c.arguments.at(1)), tools.O.filter(ast.is(ast.NodeType.ObjectExpression)), tools.O.zipWith(ast.traverseUp(node, ast.is(ast.NodeType.ObjectExpression)), (a, b)=>a === b), tools.O.getOrElse(tools.F.constFalse));
1259
+ return pipe(ast.traverseUp(node, (n)=>ast.is(ast.NodeType.CallExpression)(n) && isCreateElementCall(n, context)), filter(ast.is(ast.NodeType.CallExpression)), flatMapNullable((c)=>c.arguments.at(1)), filter(ast.is(ast.NodeType.ObjectExpression)), zipWith(ast.traverseUp(node, ast.is(ast.NodeType.ObjectExpression)), (a, b)=>a === b), getOrElse(constFalse));
192
1260
  }
193
1261
  function isChildrenOfCreateElement(node, context) {
194
- return tools.F.pipe(tools.O.fromNullable(node.parent), tools.O.filter(ast.is(ast.NodeType.CallExpression)), tools.O.filter((n)=>isCreateElementCall(n, context)), tools.O.exists((n)=>n.arguments.slice(2).some((arg)=>arg === node)));
1262
+ return pipe(fromNullable(node.parent), filter(ast.is(ast.NodeType.CallExpression)), filter((n)=>isCreateElementCall(n, context)), exists((n)=>n.arguments.slice(2).some((arg)=>arg === node)));
195
1263
  }
196
1264
  /**
197
1265
  * Check if a `JSXElement` or `JSXFragment` has children
@@ -199,7 +1267,7 @@ function isChildrenOfCreateElement(node, context) {
199
1267
  * @param predicate A predicate to filter the children
200
1268
  * @returns `true` if the node has children
201
1269
  */ function hasChildren(node, predicate) {
202
- if (tools.Prd.isFunction(predicate)) return node.children.some(predicate);
1270
+ if (isFunction(predicate)) return node.children.some(predicate);
203
1271
  return node.children.length > 0;
204
1272
  }
205
1273
  /**
@@ -283,16 +1351,16 @@ const isFragment = (node, pragma, fragment)=>{
283
1351
  if (!node) return false;
284
1352
  return N(node).with({
285
1353
  type: ast.NodeType.JSXElement
286
- }, tools.F.constTrue).with({
1354
+ }, constTrue).with({
287
1355
  type: ast.NodeType.JSXFragment
288
- }, tools.F.constTrue).with({
1356
+ }, constTrue).with({
289
1357
  type: ast.NodeType.JSXMemberExpression
290
- }, tools.F.constTrue).with({
1358
+ }, constTrue).with({
291
1359
  type: ast.NodeType.JSXNamespacedName
292
- }, tools.F.constTrue).with({
1360
+ }, constTrue).with({
293
1361
  type: ast.NodeType.Literal
294
1362
  }, (node)=>{
295
- return N(node.value).with(null, ()=>!(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, ()=>!(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with(_.number, ()=>!(hint & JSXValueHint.SkipNumberLiteral)).otherwise(tools.F.constFalse);
1363
+ return N(node.value).with(null, ()=>!(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, ()=>!(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with(_.number, ()=>!(hint & JSXValueHint.SkipNumberLiteral)).otherwise(constFalse);
296
1364
  }).with({
297
1365
  type: ast.NodeType.TemplateLiteral
298
1366
  }, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with({
@@ -341,8 +1409,8 @@ const isFragment = (node, pragma, fragment)=>{
341
1409
  if (ast.isJSXTagNameExpression(node)) return true;
342
1410
  const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
343
1411
  const maybeVariable = _var.findVariable(name, initialScope);
344
- return tools.F.pipe(maybeVariable, tools.O.flatMap(_var.getVariableInit(0)), tools.O.exists((n)=>isJSXValue(n, context, hint)));
345
- }).otherwise(tools.F.constFalse);
1412
+ return pipe(maybeVariable, flatMap(_var.getVariableInit(0)), exists((n)=>isJSXValue(n, context, hint)));
1413
+ }).otherwise(constFalse);
346
1414
  }
347
1415
 
348
1416
  /**
@@ -379,13 +1447,13 @@ function getProp(props, propName, context, initialScope) {
379
1447
  const initialScope = context.sourceCode.getScope?.(attribute) ?? context.getScope();
380
1448
  if (attribute.type === ast.NodeType.JSXAttribute && "value" in attribute) {
381
1449
  const { value } = attribute;
382
- if (value === null) return tools.O.none();
383
- if (value.type === ast.NodeType.Literal) return tools.O.some(getStaticValue(value, initialScope));
384
- if (value.type === ast.NodeType.JSXExpressionContainer) return tools.O.some(getStaticValue(value.expression, initialScope));
385
- return tools.O.none();
1450
+ if (value === null) return none();
1451
+ if (value.type === ast.NodeType.Literal) return some(getStaticValue(value, initialScope));
1452
+ if (value.type === ast.NodeType.JSXExpressionContainer) return some(getStaticValue(value.expression, initialScope));
1453
+ return none();
386
1454
  }
387
1455
  const { argument } = attribute;
388
- return tools.O.some(getStaticValue(argument, initialScope));
1456
+ return some(getStaticValue(argument, initialScope));
389
1457
  }
390
1458
  /**
391
1459
  * @param properties The properties to search in
@@ -399,32 +1467,32 @@ function getProp(props, propName, context, initialScope) {
399
1467
  * @param propName The name of the property to search for
400
1468
  * @returns The property if found
401
1469
  */ return (propName)=>{
402
- return tools.O.fromNullable(properties.find((prop)=>{
1470
+ return fromNullable(properties.find((prop)=>{
403
1471
  return N(prop).when(ast.is(ast.NodeType.Property), (prop)=>{
404
1472
  return "name" in prop.key && prop.key.name === propName;
405
1473
  }).when(ast.is(ast.NodeType.SpreadElement), (prop)=>{
406
1474
  return N(prop.argument).when(ast.is(ast.NodeType.Identifier), (argument)=>{
407
1475
  const { name } = argument;
408
- const maybeInit = tools.O.flatMap(_var.findVariable(name, initialScope), _var.getVariableInit(0));
409
- if (tools.O.isNone(maybeInit)) return false;
1476
+ const maybeInit = flatMap(_var.findVariable(name, initialScope), _var.getVariableInit(0));
1477
+ if (isNone(maybeInit)) return false;
410
1478
  const init = maybeInit.value;
411
1479
  if (init.type !== ast.NodeType.ObjectExpression) return false;
412
1480
  if (seenProps.includes(name)) return false;
413
- return tools.O.isSome(findPropInProperties(init.properties, context, initialScope, [
1481
+ return isSome(findPropInProperties(init.properties, context, initialScope, [
414
1482
  ...seenProps,
415
1483
  name
416
1484
  ])(propName));
417
1485
  }).when(ast.is(ast.NodeType.ObjectExpression), (argument)=>{
418
- return tools.O.isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
1486
+ return isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
419
1487
  }).when(ast.is(ast.NodeType.MemberExpression), ()=>{
420
1488
  // Not implemented
421
1489
  }).when(ast.is(ast.NodeType.CallExpression), ()=>{
422
1490
  // Not implemented
423
- }).otherwise(tools.F.constFalse);
1491
+ }).otherwise(constFalse);
424
1492
  }).when(ast.is(ast.NodeType.RestElement), ()=>{
425
1493
  // Not implemented
426
1494
  return false;
427
- }).otherwise(tools.F.constFalse);
1495
+ }).otherwise(constFalse);
428
1496
  }));
429
1497
  };
430
1498
  }
@@ -439,27 +1507,27 @@ function getProp(props, propName, context, initialScope) {
439
1507
  * @param propName The name of the property to search for
440
1508
  * @returns The property if found
441
1509
  */ return (propName)=>{
442
- return tools.O.fromNullable(attributes.find((attr)=>{
1510
+ return fromNullable(attributes.find((attr)=>{
443
1511
  return N(attr).when(ast.is(ast.NodeType.JSXAttribute), (attr)=>getPropName(attr) === propName).when(ast.is(ast.NodeType.JSXSpreadAttribute), (attr)=>{
444
1512
  return N(attr.argument).with({
445
1513
  type: ast.NodeType.Identifier
446
1514
  }, (argument)=>{
447
1515
  const { name } = argument;
448
- const maybeInit = tools.O.flatMap(_var.findVariable(name, initialScope), _var.getVariableInit(0));
449
- if (tools.O.isNone(maybeInit)) return false;
1516
+ const maybeInit = flatMap(_var.findVariable(name, initialScope), _var.getVariableInit(0));
1517
+ if (isNone(maybeInit)) return false;
450
1518
  const init = maybeInit.value;
451
1519
  if (!("properties" in init)) return false;
452
- return tools.O.isSome(findPropInProperties(init.properties, context, initialScope)(propName));
1520
+ return isSome(findPropInProperties(init.properties, context, initialScope)(propName));
453
1521
  }).when(ast.is(ast.NodeType.ObjectExpression), (argument)=>{
454
- return tools.O.isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
1522
+ return isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
455
1523
  }).when(ast.is(ast.NodeType.MemberExpression), ()=>{
456
1524
  // Not implemented
457
1525
  return false;
458
1526
  }).when(ast.is(ast.NodeType.CallExpression), ()=>{
459
1527
  // Not implemented
460
1528
  return false;
461
- }).otherwise(tools.F.constFalse);
462
- }).otherwise(tools.F.constFalse);
1529
+ }).otherwise(constFalse);
1530
+ }).otherwise(constFalse);
463
1531
  }));
464
1532
  };
465
1533
  }
@@ -472,7 +1540,7 @@ function getProp(props, propName, context, initialScope) {
472
1540
  * @param initialScope
473
1541
  * @returns `true` if the given prop name is present in the given properties
474
1542
  */ function hasProp(attributes, propName, context, initialScope) {
475
- return tools.O.isSome(findPropInAttributes(attributes, context, initialScope)(propName));
1543
+ return isSome(findPropInAttributes(attributes, context, initialScope)(propName));
476
1544
  }
477
1545
  /**
478
1546
  * Check if any of the given prop names are present in the given attributes
@@ -500,7 +1568,7 @@ function getProp(props, propName, context, initialScope) {
500
1568
  * @param node The AST node to start traversing from
501
1569
  * @param predicate The predicate to check each node
502
1570
  * @returns prop node if found
503
- */ function traverseUpProp(node, predicate = tools.F.constTrue) {
1571
+ */ function traverseUpProp(node, predicate = constTrue) {
504
1572
  const guard = (node)=>{
505
1573
  return node.type === ast.NodeType.JSXAttribute && predicate(node);
506
1574
  };
@@ -513,7 +1581,7 @@ function getProp(props, propName, context, initialScope) {
513
1581
  * @returns `true` if the node is inside a prop's value
514
1582
  */ function isInsidePropValue(node) {
515
1583
  if (ast.isStringLiteral(node)) return node.parent.type === ast.NodeType.JSXAttribute;
516
- return tools.O.isSome(traverseUpProp(node, (n)=>n.value?.type === ast.NodeType.JSXExpressionContainer));
1584
+ return isSome(traverseUpProp(node, (n)=>n.value?.type === ast.NodeType.JSXExpressionContainer));
517
1585
  }
518
1586
 
519
1587
  /**
@@ -529,7 +1597,7 @@ function getProp(props, propName, context, initialScope) {
529
1597
  * @param node The AST node to check
530
1598
  * @returns boolean `true` if the node is whitespace
531
1599
  */ function isWhiteSpace(node) {
532
- return tools.Prd.isString(node.value) && node.value.trim() === "";
1600
+ return isString(node.value) && node.value.trim() === "";
533
1601
  }
534
1602
  /**
535
1603
  * Check if a Literal or JSXText node is a line break