@eslint-react/jsx 1.5.3 → 1.5.4-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/dist/index.js +1369 -1228
  2. package/dist/index.mjs +1366 -1229
  3. package/package.json +8 -8
  4. package/dist/index.cjs +0 -1656
package/dist/index.mjs CHANGED
@@ -1,73 +1,48 @@
1
- import { NodeType, isOneOf, is, traverseUp, isJSXTagNameExpression, getNestedReturnStatements, ESLintCommunityESLintUtils, traverseUpGuard, isStringLiteral, isMultiLine } from '@eslint-react/ast';
1
+ import { is, NodeType, isOneOf, traverseUp, isJSXTagNameExpression, getNestedReturnStatements, traverseUpGuard, isStringLiteral, isMultiLine, ESLintCommunityESLintUtils } from '@eslint-react/ast';
2
2
  import { parseSchema, ESLintSettingsSchema } from '@eslint-react/shared';
3
3
  import memo from 'micro-memoize';
4
4
  import { findVariable, getVariableInit } from '@eslint-react/var';
5
5
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
6
+ import '@typescript-eslint/utils';
6
7
 
7
- /**
8
- * Tests if a value is a `function`.
9
- *
10
- * @param input - The value to test.
11
- *
12
- * @example
13
- * import { isFunction } from 'effect/Predicate'
14
- *
15
- * assert.deepStrictEqual(isFunction(isFunction), true)
16
- * assert.deepStrictEqual(isFunction("function"), false)
17
- *
18
- * @category guards
19
- * @since 2.0.0
20
- */
21
- const isFunction$1 = input => typeof input === "function";
22
- /**
23
- * Creates a function that can be used in a data-last (aka `pipe`able) or
24
- * data-first style.
25
- *
26
- * The first parameter to `dual` is either the arity of the uncurried function
27
- * or a predicate that determines if the function is being used in a data-first
28
- * or data-last style.
29
- *
30
- * Using the arity is the most common use case, but there are some cases where
31
- * you may want to use a predicate. For example, if you have a function that
32
- * takes an optional argument, you can use a predicate to determine if the
33
- * function is being used in a data-first or data-last style.
34
- *
35
- * @param arity - Either the arity of the uncurried function or a predicate
36
- * which determines if the function is being used in a data-first
37
- * or data-last style.
38
- * @param body - The definition of the uncurried function.
39
- *
40
- * @example
41
- * import { dual, pipe } from "effect/Function"
42
- *
43
- * // Exampe using arity to determine data-first or data-last style
44
- * const sum: {
45
- * (that: number): (self: number) => number
46
- * (self: number, that: number): number
47
- * } = dual(2, (self: number, that: number): number => self + that)
48
- *
49
- * assert.deepStrictEqual(sum(2, 3), 5)
50
- * assert.deepStrictEqual(pipe(2, sum(3)), 5)
51
- *
52
- * // Example using a predicate to determine data-first or data-last style
53
- * const sum2: {
54
- * (that: number): (self: number) => number
55
- * (self: number, that: number): number
56
- * } = dual((args) => args.length === 1, (self: number, that: number): number => self + that)
57
- *
58
- * assert.deepStrictEqual(sum(2, 3), 5)
59
- * assert.deepStrictEqual(pipe(2, sum(3)), 5)
60
- *
61
- * @since 2.0.0
62
- */
63
- const dual = function (arity, body) {
8
+ var __defProp = Object.defineProperty;
9
+ var __export = (target, all3) => {
10
+ for (var name in all3)
11
+ __defProp(target, name, { get: all3[name], enumerable: true });
12
+ };
13
+
14
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Function.js
15
+ var Function_exports = {};
16
+ __export(Function_exports, {
17
+ SK: () => SK,
18
+ absurd: () => absurd,
19
+ apply: () => apply,
20
+ compose: () => compose,
21
+ constFalse: () => constFalse,
22
+ constNull: () => constNull,
23
+ constTrue: () => constTrue,
24
+ constUndefined: () => constUndefined,
25
+ constVoid: () => constVoid,
26
+ constant: () => constant,
27
+ dual: () => dual,
28
+ flip: () => flip,
29
+ flow: () => flow,
30
+ hole: () => hole,
31
+ identity: () => identity,
32
+ isFunction: () => isFunction,
33
+ pipe: () => pipe,
34
+ tupled: () => tupled,
35
+ unsafeCoerce: () => unsafeCoerce,
36
+ untupled: () => untupled
37
+ });
38
+ var isFunction = (input) => typeof input === "function";
39
+ var dual = function(arity, body) {
64
40
  if (typeof arity === "function") {
65
- return function () {
41
+ return function() {
66
42
  if (arity(arguments)) {
67
- // @ts-expect-error
68
43
  return body.apply(this, arguments);
69
44
  }
70
- return self => body(self, ...arguments);
45
+ return (self) => body(self, ...arguments);
71
46
  };
72
47
  }
73
48
  switch (arity) {
@@ -75,251 +50,388 @@ const dual = function (arity, body) {
75
50
  case 1:
76
51
  throw new RangeError(`Invalid arity ${arity}`);
77
52
  case 2:
78
- return function (a, b) {
53
+ return function(a2, b2) {
79
54
  if (arguments.length >= 2) {
80
- return body(a, b);
55
+ return body(a2, b2);
81
56
  }
82
- return function (self) {
83
- return body(self, a);
57
+ return function(self) {
58
+ return body(self, a2);
84
59
  };
85
60
  };
86
61
  case 3:
87
- return function (a, b, c) {
62
+ return function(a2, b2, c2) {
88
63
  if (arguments.length >= 3) {
89
- return body(a, b, c);
64
+ return body(a2, b2, c2);
90
65
  }
91
- return function (self) {
92
- return body(self, a, b);
66
+ return function(self) {
67
+ return body(self, a2, b2);
93
68
  };
94
69
  };
95
70
  case 4:
96
- return function (a, b, c, d) {
71
+ return function(a2, b2, c2, d2) {
97
72
  if (arguments.length >= 4) {
98
- return body(a, b, c, d);
73
+ return body(a2, b2, c2, d2);
99
74
  }
100
- return function (self) {
101
- return body(self, a, b, c);
75
+ return function(self) {
76
+ return body(self, a2, b2, c2);
102
77
  };
103
78
  };
104
79
  case 5:
105
- return function (a, b, c, d, e) {
80
+ return function(a2, b2, c2, d2, e2) {
106
81
  if (arguments.length >= 5) {
107
- return body(a, b, c, d, e);
82
+ return body(a2, b2, c2, d2, e2);
108
83
  }
109
- return function (self) {
110
- return body(self, a, b, c, d);
84
+ return function(self) {
85
+ return body(self, a2, b2, c2, d2);
111
86
  };
112
87
  };
113
88
  default:
114
- return function () {
89
+ return function() {
115
90
  if (arguments.length >= arity) {
116
- // @ts-expect-error
117
91
  return body.apply(this, arguments);
118
92
  }
119
93
  const args = arguments;
120
- return function (self) {
94
+ return function(self) {
121
95
  return body(self, ...args);
122
96
  };
123
97
  };
124
98
  }
125
99
  };
126
- /**
127
- * Creates a constant value that never changes.
128
- *
129
- * This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument)
130
- * and want that inner function to always use the same value, no matter how many times it is called.
131
- *
132
- * @param value - The constant value to be returned.
133
- *
134
- * @example
135
- * import { constant } from "effect/Function"
136
- *
137
- * const constNull = constant(null)
138
- *
139
- * assert.deepStrictEqual(constNull(), null)
140
- * assert.deepStrictEqual(constNull(), null)
141
- *
142
- * @since 2.0.0
143
- */
144
- const constant = value => () => value;
145
- /**
146
- * A thunk that returns always `true`.
147
- *
148
- * @example
149
- * import { constTrue } from "effect/Function"
150
- *
151
- * assert.deepStrictEqual(constTrue(), true)
152
- *
153
- * @since 2.0.0
154
- */
155
- const constTrue = /*#__PURE__*/constant(true);
156
- /**
157
- * A thunk that returns always `false`.
158
- *
159
- * @example
160
- * import { constFalse } from "effect/Function"
161
- *
162
- * assert.deepStrictEqual(constFalse(), false)
163
- *
164
- * @since 2.0.0
165
- */
166
- const constFalse = /*#__PURE__*/constant(false);
167
- function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
100
+ var apply = (a2) => (self) => self(a2);
101
+ var identity = (a2) => a2;
102
+ var unsafeCoerce = identity;
103
+ var constant = (value) => () => value;
104
+ var constTrue = /* @__PURE__ */ constant(true);
105
+ var constFalse = /* @__PURE__ */ constant(false);
106
+ var constNull = /* @__PURE__ */ constant(null);
107
+ var constUndefined = /* @__PURE__ */ constant(void 0);
108
+ var constVoid = constUndefined;
109
+ var flip = (f2) => (...b2) => (...a2) => f2(...a2)(...b2);
110
+ var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a2) => bc(ab(a2)));
111
+ var absurd = (_2) => {
112
+ throw new Error("Called `absurd` function which should be uncallable");
113
+ };
114
+ var tupled = (f2) => (a2) => f2(...a2);
115
+ var untupled = (f2) => (...a2) => f2(a2);
116
+ function pipe(a2, ab, bc, cd, de, ef, fg, gh, hi) {
168
117
  switch (arguments.length) {
169
118
  case 1:
170
- return a;
119
+ return a2;
171
120
  case 2:
172
- return ab(a);
121
+ return ab(a2);
173
122
  case 3:
174
- return bc(ab(a));
123
+ return bc(ab(a2));
175
124
  case 4:
176
- return cd(bc(ab(a)));
125
+ return cd(bc(ab(a2)));
177
126
  case 5:
178
- return de(cd(bc(ab(a))));
127
+ return de(cd(bc(ab(a2))));
179
128
  case 6:
180
- return ef(de(cd(bc(ab(a)))));
129
+ return ef(de(cd(bc(ab(a2)))));
181
130
  case 7:
182
- return fg(ef(de(cd(bc(ab(a))))));
131
+ return fg(ef(de(cd(bc(ab(a2))))));
183
132
  case 8:
184
- return gh(fg(ef(de(cd(bc(ab(a)))))));
133
+ return gh(fg(ef(de(cd(bc(ab(a2)))))));
185
134
  case 9:
186
- return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
187
- default:
188
- {
189
- let ret = arguments[0];
190
- for (let i = 1; i < arguments.length; i++) {
191
- ret = arguments[i](ret);
192
- }
193
- return ret;
135
+ return hi(gh(fg(ef(de(cd(bc(ab(a2))))))));
136
+ default: {
137
+ let ret = arguments[0];
138
+ for (let i2 = 1; i2 < arguments.length; i2++) {
139
+ ret = arguments[i2](ret);
194
140
  }
141
+ return ret;
142
+ }
143
+ }
144
+ }
145
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
146
+ switch (arguments.length) {
147
+ case 1:
148
+ return ab;
149
+ case 2:
150
+ return function() {
151
+ return bc(ab.apply(this, arguments));
152
+ };
153
+ case 3:
154
+ return function() {
155
+ return cd(bc(ab.apply(this, arguments)));
156
+ };
157
+ case 4:
158
+ return function() {
159
+ return de(cd(bc(ab.apply(this, arguments))));
160
+ };
161
+ case 5:
162
+ return function() {
163
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
164
+ };
165
+ case 6:
166
+ return function() {
167
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
168
+ };
169
+ case 7:
170
+ return function() {
171
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
172
+ };
173
+ case 8:
174
+ return function() {
175
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
176
+ };
177
+ case 9:
178
+ return function() {
179
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
180
+ };
195
181
  }
182
+ return;
196
183
  }
184
+ var hole = /* @__PURE__ */ unsafeCoerce(absurd);
185
+ var SK = (_2, b2) => b2;
197
186
 
198
- const moduleVersion = "2.3.1";
187
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/internal/version.js
188
+ var moduleVersion = "2.3.3";
199
189
 
200
- /**
201
- * @since 2.0.0
202
- */
203
- const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
190
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/GlobalValue.js
191
+ var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
204
192
  if (!(globalStoreId in globalThis)) {
205
- globalThis[globalStoreId] = /*#__PURE__*/new Map();
193
+ globalThis[globalStoreId] = /* @__PURE__ */ new Map();
206
194
  }
207
- const globalStore = globalThis[globalStoreId];
208
- /**
209
- * @since 2.0.0
210
- */
211
- const globalValue = (id, compute) => {
195
+ var globalStore = globalThis[globalStoreId];
196
+ var globalValue = (id, compute) => {
212
197
  if (!globalStore.has(id)) {
213
198
  globalStore.set(id, compute());
214
199
  }
215
200
  return globalStore.get(id);
216
201
  };
217
202
 
218
- /**
219
- * @since 2.0.0
220
- */
221
- /**
222
- * Tests if a value is a `string`.
223
- *
224
- * @param input - The value to test.
225
- *
226
- * @example
227
- * import { isString } from "effect/Predicate"
228
- *
229
- * assert.deepStrictEqual(isString("a"), true)
230
- *
231
- * assert.deepStrictEqual(isString(1), false)
232
- *
233
- * @category guards
234
- * @since 2.0.0
235
- */
236
- const isString = input => typeof input === "string";
237
- /**
238
- * Tests if a value is a `function`.
239
- *
240
- * @param input - The value to test.
241
- *
242
- * @example
243
- * import { isFunction } from "effect/Predicate"
244
- *
245
- * assert.deepStrictEqual(isFunction(isFunction), true)
246
- *
247
- * assert.deepStrictEqual(isFunction("function"), false)
248
- *
249
- * @category guards
250
- * @since 2.0.0
251
- */
252
- const isFunction = isFunction$1;
253
- const isRecordOrArray = input => typeof input === "object" && input !== null;
254
- /**
255
- * Tests if a value is an `object`.
256
- *
257
- * @param input - The value to test.
258
- *
259
- * @example
260
- * import { isObject } from "effect/Predicate"
261
- *
262
- * assert.deepStrictEqual(isObject({}), true)
263
- * assert.deepStrictEqual(isObject([]), true)
264
- *
265
- * assert.deepStrictEqual(isObject(null), false)
266
- * assert.deepStrictEqual(isObject(undefined), false)
267
- *
268
- * @category guards
269
- * @since 2.0.0
270
- */
271
- const isObject = input => isRecordOrArray(input) || isFunction(input);
272
- /**
273
- * Checks whether a value is an `object` containing a specified property key.
274
- *
275
- * @param property - The field to check within the object.
276
- * @param self - The value to examine.
277
- *
278
- * @category guards
279
- * @since 2.0.0
280
- */
281
- const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
282
- /**
283
- * A guard that succeeds when the input is `null` or `undefined`.
284
- *
285
- * @param input - The value to test.
286
- *
287
- * @example
288
- * import { isNullable } from "effect/Predicate"
289
- *
290
- * assert.deepStrictEqual(isNullable(null), true)
291
- * assert.deepStrictEqual(isNullable(undefined), true)
292
- *
293
- * assert.deepStrictEqual(isNullable({}), false)
294
- * assert.deepStrictEqual(isNullable([]), false)
295
- *
296
- * @category guards
297
- * @since 2.0.0
298
- */
299
- const isNullable = input => input === null || input === undefined;
203
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Predicate.js
204
+ var Predicate_exports = {};
205
+ __export(Predicate_exports, {
206
+ all: () => all,
207
+ and: () => and,
208
+ compose: () => compose2,
209
+ eqv: () => eqv,
210
+ every: () => every,
211
+ hasProperty: () => hasProperty,
212
+ implies: () => implies,
213
+ isBigInt: () => isBigInt,
214
+ isBoolean: () => isBoolean,
215
+ isDate: () => isDate,
216
+ isError: () => isError,
217
+ isFunction: () => isFunction2,
218
+ isIterable: () => isIterable,
219
+ isNever: () => isNever,
220
+ isNotNull: () => isNotNull,
221
+ isNotNullable: () => isNotNullable,
222
+ isNotUndefined: () => isNotUndefined,
223
+ isNull: () => isNull,
224
+ isNullable: () => isNullable,
225
+ isNumber: () => isNumber,
226
+ isObject: () => isObject,
227
+ isPromise: () => isPromise,
228
+ isReadonlyRecord: () => isReadonlyRecord,
229
+ isRecord: () => isRecord,
230
+ isString: () => isString,
231
+ isSymbol: () => isSymbol,
232
+ isTagged: () => isTagged,
233
+ isUint8Array: () => isUint8Array,
234
+ isUndefined: () => isUndefined,
235
+ isUnknown: () => isUnknown,
236
+ mapInput: () => mapInput,
237
+ nand: () => nand,
238
+ nor: () => nor,
239
+ not: () => not,
240
+ or: () => or,
241
+ product: () => product,
242
+ productMany: () => productMany,
243
+ some: () => some,
244
+ struct: () => struct,
245
+ tuple: () => tuple,
246
+ xor: () => xor
247
+ });
248
+ var mapInput = /* @__PURE__ */ dual(2, (self, f2) => (b2) => self(f2(b2)));
249
+ var isString = (input) => typeof input === "string";
250
+ var isNumber = (input) => typeof input === "number";
251
+ var isBoolean = (input) => typeof input === "boolean";
252
+ var isBigInt = (input) => typeof input === "bigint";
253
+ var isSymbol = (input) => typeof input === "symbol";
254
+ var isFunction2 = isFunction;
255
+ var isUndefined = (input) => input === void 0;
256
+ var isNotUndefined = (input) => input !== void 0;
257
+ var isNull = (input) => input === null;
258
+ var isNotNull = (input) => input !== null;
259
+ var isNever = (_2) => false;
260
+ var isUnknown = (_2) => true;
261
+ var isRecordOrArray = (input) => typeof input === "object" && input !== null;
262
+ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
263
+ var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
264
+ var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
265
+ var isNullable = (input) => input === null || input === void 0;
266
+ var isNotNullable = (input) => input !== null && input !== void 0;
267
+ var isError = (input) => input instanceof Error;
268
+ var isUint8Array = (input) => input instanceof Uint8Array;
269
+ var isDate = (input) => input instanceof Date;
270
+ var isIterable = (input) => hasProperty(input, Symbol.iterator);
271
+ var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
272
+ var isReadonlyRecord = isRecord;
273
+ var isPromise = (input) => hasProperty(input, "then") && "catch" in input && isFunction2(input.then) && isFunction2(input.catch);
274
+ var compose2 = /* @__PURE__ */ dual(2, (ab, bc) => (a2) => ab(a2) && bc(a2));
275
+ var product = (self, that) => ([a2, b2]) => self(a2) && that(b2);
276
+ var all = (collection) => {
277
+ return (as2) => {
278
+ let collectionIndex = 0;
279
+ for (const p2 of collection) {
280
+ if (collectionIndex >= as2.length) {
281
+ break;
282
+ }
283
+ if (p2(as2[collectionIndex]) === false) {
284
+ return false;
285
+ }
286
+ collectionIndex++;
287
+ }
288
+ return true;
289
+ };
290
+ };
291
+ var productMany = (self, collection) => {
292
+ const rest = all(collection);
293
+ return ([head, ...tail]) => self(head) === false ? false : rest(tail);
294
+ };
295
+ var tuple = (...elements) => all(elements);
296
+ var struct = (fields) => {
297
+ const keys = Object.keys(fields);
298
+ return (a2) => {
299
+ for (const key of keys) {
300
+ if (!fields[key](a2[key])) {
301
+ return false;
302
+ }
303
+ }
304
+ return true;
305
+ };
306
+ };
307
+ var not = (self) => (a2) => !self(a2);
308
+ var or = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) || that(a2));
309
+ var and = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) && that(a2));
310
+ var xor = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) !== that(a2));
311
+ var eqv = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) === that(a2));
312
+ var implies = /* @__PURE__ */ dual(2, (self, that) => (a2) => self(a2) ? that(a2) : true);
313
+ var nor = /* @__PURE__ */ dual(2, (self, that) => (a2) => !(self(a2) || that(a2)));
314
+ var nand = /* @__PURE__ */ dual(2, (self, that) => (a2) => !(self(a2) && that(a2)));
315
+ var every = (collection) => (a2) => {
316
+ for (const p2 of collection) {
317
+ if (!p2(a2)) {
318
+ return false;
319
+ }
320
+ }
321
+ return true;
322
+ };
323
+ var some = (collection) => (a2) => {
324
+ for (const p2 of collection) {
325
+ if (p2(a2)) {
326
+ return true;
327
+ }
328
+ }
329
+ return false;
330
+ };
300
331
 
301
- /**
302
- * @since 2.0.0
303
- */
304
- const defaultIncHi = 0x14057b7e;
305
- const defaultIncLo = 0xf767814f;
306
- const MUL_HI = 0x5851f42d >>> 0;
307
- const MUL_LO = 0x4c957f2d >>> 0;
308
- const BIT_53 = 9007199254740992.0;
309
- const BIT_27 = 134217728.0;
310
- /**
311
- * PCG is a family of simple fast space-efficient statistically good algorithms
312
- * for random number generation. Unlike many general-purpose RNGs, they are also
313
- * hard to predict.
314
- *
315
- * @category model
316
- * @since 2.0.0
317
- */
318
- class PCGRandom {
332
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Utils.js
333
+ var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
334
+ var GenKindImpl = class {
335
+ value;
336
+ constructor(value) {
337
+ this.value = value;
338
+ }
339
+ /**
340
+ * @since 2.0.0
341
+ */
342
+ get _F() {
343
+ return identity;
344
+ }
345
+ /**
346
+ * @since 2.0.0
347
+ */
348
+ get _R() {
349
+ return (_2) => _2;
350
+ }
351
+ /**
352
+ * @since 2.0.0
353
+ */
354
+ get _O() {
355
+ return (_2) => _2;
356
+ }
357
+ /**
358
+ * @since 2.0.0
359
+ */
360
+ get _E() {
361
+ return (_2) => _2;
362
+ }
363
+ /**
364
+ * @since 2.0.0
365
+ */
366
+ [GenKindTypeId] = GenKindTypeId;
367
+ /**
368
+ * @since 2.0.0
369
+ */
370
+ [Symbol.iterator]() {
371
+ return new SingleShotGen(this);
372
+ }
373
+ };
374
+ var SingleShotGen = class _SingleShotGen {
375
+ self;
376
+ called = false;
377
+ constructor(self) {
378
+ this.self = self;
379
+ }
380
+ /**
381
+ * @since 2.0.0
382
+ */
383
+ next(a2) {
384
+ return this.called ? {
385
+ value: a2,
386
+ done: true
387
+ } : (this.called = true, {
388
+ value: this.self,
389
+ done: false
390
+ });
391
+ }
392
+ /**
393
+ * @since 2.0.0
394
+ */
395
+ return(a2) {
396
+ return {
397
+ value: a2,
398
+ done: true
399
+ };
400
+ }
401
+ /**
402
+ * @since 2.0.0
403
+ */
404
+ throw(e2) {
405
+ throw e2;
406
+ }
407
+ /**
408
+ * @since 2.0.0
409
+ */
410
+ [Symbol.iterator]() {
411
+ return new _SingleShotGen(this.self);
412
+ }
413
+ };
414
+ var adapter = () => (
415
+ // @ts-expect-error
416
+ function() {
417
+ let x2 = arguments[0];
418
+ for (let i2 = 1; i2 < arguments.length; i2++) {
419
+ x2 = arguments[i2](x2);
420
+ }
421
+ return new GenKindImpl(x2);
422
+ }
423
+ );
424
+ var defaultIncHi = 335903614;
425
+ var defaultIncLo = 4150755663;
426
+ var MUL_HI = 1481765933 >>> 0;
427
+ var MUL_LO = 1284865837 >>> 0;
428
+ var BIT_53 = 9007199254740992;
429
+ var BIT_27 = 134217728;
430
+ var PCGRandom = class {
319
431
  _state;
320
432
  constructor(seedHi, seedLo, incHi, incLo) {
321
433
  if (isNullable(seedLo) && isNullable(seedHi)) {
322
- seedLo = Math.random() * 0xffffffff >>> 0;
434
+ seedLo = Math.random() * 4294967295 >>> 0;
323
435
  seedHi = 0;
324
436
  } else if (isNullable(seedLo)) {
325
437
  seedLo = seedHi;
@@ -371,13 +483,11 @@ class PCGRandom {
371
483
  }
372
484
  max = max >>> 0;
373
485
  if ((max & max - 1) === 0) {
374
- return this._next() & max - 1; // fast path for power of 2
486
+ return this._next() & max - 1;
375
487
  }
376
488
  let num = 0;
377
489
  const skew = (-max >>> 0) % max >>> 0;
378
490
  for (num = this._next(); num < skew; num = this._next()) {
379
- // this loop will rarely execute more than twice,
380
- // and is intentionally empty
381
491
  }
382
492
  return num % max;
383
493
  }
@@ -389,35 +499,30 @@ class PCGRandom {
389
499
  * @since 2.0.0
390
500
  */
391
501
  number() {
392
- const hi = (this._next() & 0x03ffffff) * 1.0;
393
- const lo = (this._next() & 0x07ffffff) * 1.0;
502
+ const hi = (this._next() & 67108863) * 1;
503
+ const lo = (this._next() & 134217727) * 1;
394
504
  return (hi * BIT_27 + lo) / BIT_53;
395
505
  }
396
506
  /** @internal */
397
507
  _next() {
398
- // save current state (what we'll use for this number)
399
508
  const oldHi = this._state[0] >>> 0;
400
509
  const oldLo = this._state[1] >>> 0;
401
- // churn LCG.
402
510
  mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
403
511
  add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
404
- // get least sig. 32 bits of ((oldstate >> 18) ^ oldstate) >> 27
405
512
  let xsHi = oldHi >>> 18;
406
513
  let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
407
514
  xsHi = (xsHi ^ oldHi) >>> 0;
408
515
  xsLo = (xsLo ^ oldLo) >>> 0;
409
516
  const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
410
- // rotate xorshifted right a random amount, based on the most sig. 5 bits
411
- // bits of the old state.
412
517
  const rot = oldHi >>> 27;
413
518
  const rot2 = (-rot >>> 0 & 31) >>> 0;
414
519
  return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
415
520
  }
416
- }
521
+ };
417
522
  function mul64(out, aHi, aLo, bHi, bLo) {
418
- let c1 = (aLo >>> 16) * (bLo & 0xffff) >>> 0;
419
- let c0 = (aLo & 0xffff) * (bLo >>> 16) >>> 0;
420
- let lo = (aLo & 0xffff) * (bLo & 0xffff) >>> 0;
523
+ let c1 = (aLo >>> 16) * (bLo & 65535) >>> 0;
524
+ let c0 = (aLo & 65535) * (bLo >>> 16) >>> 0;
525
+ let lo = (aLo & 65535) * (bLo & 65535) >>> 0;
421
526
  let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
422
527
  c0 = c0 << 16 >>> 0;
423
528
  lo = lo + c0 >>> 0;
@@ -434,7 +539,6 @@ function mul64(out, aHi, aLo, bHi, bLo) {
434
539
  out[0] = hi;
435
540
  out[1] = lo;
436
541
  }
437
- // add two 64 bit numbers (given in parts), and store the result in `out`.
438
542
  function add64(out, aHi, aLo, bHi, bLo) {
439
543
  let hi = aHi + bHi >>> 0;
440
544
  const lo = aLo + bLo >>> 0;
@@ -445,23 +549,11 @@ function add64(out, aHi, aLo, bHi, bLo) {
445
549
  out[1] = lo;
446
550
  }
447
551
 
448
- /**
449
- * @since 2.0.0
450
- */
451
- /** @internal */
452
- const randomHashCache = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
453
- /** @internal */
454
- const pcgr = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
455
- /**
456
- * @since 2.0.0
457
- * @category symbols
458
- */
459
- const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
460
- /**
461
- * @since 2.0.0
462
- * @category hashing
463
- */
464
- const hash = self => {
552
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Hash.js
553
+ var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
554
+ var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
555
+ var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
556
+ var hash = (self) => {
465
557
  switch (typeof self) {
466
558
  case "number":
467
559
  return number(self);
@@ -476,84 +568,55 @@ const hash = self => {
476
568
  case "undefined":
477
569
  return string("undefined");
478
570
  case "function":
479
- case "object":
480
- {
481
- if (self === null) {
482
- return string("null");
483
- }
484
- if (isHash(self)) {
485
- return self[symbol$1]();
486
- } else {
487
- return random(self);
488
- }
571
+ case "object": {
572
+ if (self === null) {
573
+ return string("null");
574
+ }
575
+ if (isHash(self)) {
576
+ return self[symbol]();
577
+ } else {
578
+ return random(self);
489
579
  }
580
+ }
490
581
  default:
491
582
  throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
492
583
  }
493
584
  };
494
- /**
495
- * @since 2.0.0
496
- * @category hashing
497
- */
498
- const random = self => {
585
+ var random = (self) => {
499
586
  if (!randomHashCache.has(self)) {
500
587
  randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
501
588
  }
502
589
  return randomHashCache.get(self);
503
590
  };
504
- /**
505
- * @since 2.0.0
506
- * @category hashing
507
- */
508
- const combine = b => self => self * 53 ^ b;
509
- /**
510
- * @since 2.0.0
511
- * @category hashing
512
- */
513
- const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
514
- /**
515
- * @since 2.0.0
516
- * @category guards
517
- */
518
- const isHash = u => hasProperty(u, symbol$1);
519
- /**
520
- * @since 2.0.0
521
- * @category hashing
522
- */
523
- const number = n => {
524
- if (n !== n || n === Infinity) {
591
+ var combine = (b2) => (self) => self * 53 ^ b2;
592
+ var optimize = (n2) => n2 & 3221225471 | n2 >>> 1 & 1073741824;
593
+ var isHash = (u2) => hasProperty(u2, symbol);
594
+ var number = (n2) => {
595
+ if (n2 !== n2 || n2 === Infinity) {
525
596
  return 0;
526
597
  }
527
- let h = n | 0;
528
- if (h !== n) {
529
- h ^= n * 0xffffffff;
598
+ let h2 = n2 | 0;
599
+ if (h2 !== n2) {
600
+ h2 ^= n2 * 4294967295;
530
601
  }
531
- while (n > 0xffffffff) {
532
- h ^= n /= 0xffffffff;
602
+ while (n2 > 4294967295) {
603
+ h2 ^= n2 /= 4294967295;
533
604
  }
534
- return optimize(n);
605
+ return optimize(n2);
535
606
  };
536
- /**
537
- * @since 2.0.0
538
- * @category hashing
539
- */
540
- const string = str => {
541
- let h = 5381,
542
- i = str.length;
543
- while (i) {
544
- h = h * 33 ^ str.charCodeAt(--i);
545
- }
546
- return optimize(h);
607
+ var string = (str) => {
608
+ let h2 = 5381, i2 = str.length;
609
+ while (i2) {
610
+ h2 = h2 * 33 ^ str.charCodeAt(--i2);
611
+ }
612
+ return optimize(h2);
547
613
  };
548
614
 
549
- /**
550
- * @since 2.0.0
551
- * @category symbols
552
- */
553
- const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
615
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Equal.js
616
+ var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
554
617
  function equals() {
555
618
  if (arguments.length === 1) {
556
- return self => compareBoth(self, arguments[0]);
619
+ return (self) => compareBoth(self, arguments[0]);
557
620
  }
558
621
  return compareBoth(arguments[0], arguments[1]);
559
622
  }
@@ -567,48 +630,93 @@ function compareBoth(self, that) {
567
630
  }
568
631
  if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
569
632
  if (isEqual(self) && isEqual(that)) {
570
- return hash(self) === hash(that) && self[symbol](that);
633
+ return hash(self) === hash(that) && self[symbol2](that);
571
634
  }
572
635
  }
573
636
  return false;
574
637
  }
575
- /**
576
- * @since 2.0.0
577
- * @category guards
578
- */
579
- const isEqual = u => hasProperty(u, symbol);
638
+ var isEqual = (u2) => hasProperty(u2, symbol2);
639
+ var equivalence = () => (self, that) => equals(self, that);
640
+
641
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Equivalence.js
642
+ var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
580
643
 
581
- /**
582
- * @since 2.0.0
583
- */
584
- /**
585
- * @since 2.0.0
586
- * @category symbols
587
- */
588
- const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
589
- /**
590
- * @since 2.0.0
591
- */
592
- const toJSON = x => {
593
- if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
594
- return x.toJSON();
595
- } else if (Array.isArray(x)) {
596
- return x.map(toJSON);
597
- }
598
- return x;
644
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Inspectable.js
645
+ var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
646
+ var toJSON = (x2) => {
647
+ if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
648
+ return x2.toJSON();
649
+ } else if (Array.isArray(x2)) {
650
+ return x2.map(toJSON);
651
+ }
652
+ return x2;
599
653
  };
600
- /**
601
- * @since 2.0.0
602
- */
603
- const format = x => JSON.stringify(x, null, 2);
654
+ var format = (x2) => JSON.stringify(x2, null, 2);
604
655
 
605
- /**
606
- * @since 2.0.0
607
- */
608
- /**
609
- * @since 2.0.0
610
- */
611
- const pipeArguments = (self, args) => {
656
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Option.js
657
+ var Option_exports = {};
658
+ __export(Option_exports, {
659
+ Do: () => Do,
660
+ TypeId: () => TypeId3,
661
+ all: () => all2,
662
+ andThen: () => andThen,
663
+ ap: () => ap,
664
+ as: () => as,
665
+ asUnit: () => asUnit,
666
+ bind: () => bind,
667
+ bindTo: () => bindTo,
668
+ composeK: () => composeK,
669
+ contains: () => contains,
670
+ containsWith: () => containsWith,
671
+ exists: () => exists,
672
+ filter: () => filter,
673
+ filterMap: () => filterMap,
674
+ firstSomeOf: () => firstSomeOf,
675
+ flatMap: () => flatMap,
676
+ flatMapNullable: () => flatMapNullable,
677
+ flatten: () => flatten,
678
+ fromIterable: () => fromIterable,
679
+ fromNullable: () => fromNullable,
680
+ gen: () => gen,
681
+ getEquivalence: () => getEquivalence,
682
+ getLeft: () => getLeft2,
683
+ getOrElse: () => getOrElse,
684
+ getOrNull: () => getOrNull,
685
+ getOrThrow: () => getOrThrow,
686
+ getOrThrowWith: () => getOrThrowWith,
687
+ getOrUndefined: () => getOrUndefined,
688
+ getOrder: () => getOrder,
689
+ getRight: () => getRight2,
690
+ isNone: () => isNone2,
691
+ isOption: () => isOption2,
692
+ isSome: () => isSome2,
693
+ let: () => let_,
694
+ lift2: () => lift2,
695
+ liftNullable: () => liftNullable,
696
+ liftPredicate: () => liftPredicate,
697
+ liftThrowable: () => liftThrowable,
698
+ map: () => map,
699
+ match: () => match,
700
+ none: () => none2,
701
+ orElse: () => orElse,
702
+ orElseEither: () => orElseEither,
703
+ orElseSome: () => orElseSome,
704
+ partitionMap: () => partitionMap,
705
+ product: () => product2,
706
+ productMany: () => productMany2,
707
+ reduceCompact: () => reduceCompact,
708
+ some: () => some3,
709
+ tap: () => tap,
710
+ toArray: () => toArray,
711
+ toRefinement: () => toRefinement,
712
+ unit: () => unit,
713
+ zipLeft: () => zipLeft,
714
+ zipRight: () => zipRight,
715
+ zipWith: () => zipWith
716
+ });
717
+
718
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Pipeable.js
719
+ var pipeArguments = (self, args) => {
612
720
  switch (args.length) {
613
721
  case 1:
614
722
  return args[0](self);
@@ -628,73 +736,67 @@ const pipeArguments = (self, args) => {
628
736
  return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
629
737
  case 9:
630
738
  return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
631
- default:
632
- {
633
- let ret = self;
634
- for (let i = 0, len = args.length; i < len; i++) {
635
- ret = args[i](ret);
636
- }
637
- return ret;
739
+ default: {
740
+ let ret = self;
741
+ for (let i2 = 0, len = args.length; i2 < len; i2++) {
742
+ ret = args[i2](ret);
638
743
  }
744
+ return ret;
745
+ }
639
746
  }
640
747
  };
641
748
 
642
- /** @internal */
643
- const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
644
- /** @internal */
645
- const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
646
- /** @internal */
647
- const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
648
- /** @internal */
649
- const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
650
- /** @internal */
651
- const effectVariance = {
749
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/internal/effectable.js
750
+ var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
751
+ var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
752
+ var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
753
+ var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
754
+ var effectVariance = {
652
755
  /* c8 ignore next */
653
- _R: _ => _,
756
+ _R: (_2) => _2,
654
757
  /* c8 ignore next */
655
- _E: _ => _,
758
+ _E: (_2) => _2,
656
759
  /* c8 ignore next */
657
- _A: _ => _,
760
+ _A: (_2) => _2,
658
761
  _V: moduleVersion
659
762
  };
660
- const sinkVariance = {
763
+ var sinkVariance = {
661
764
  /* c8 ignore next */
662
- _A: _ => _,
765
+ _A: (_2) => _2,
663
766
  /* c8 ignore next */
664
- _In: _ => _,
767
+ _In: (_2) => _2,
665
768
  /* c8 ignore next */
666
- _L: _ => _,
769
+ _L: (_2) => _2,
667
770
  /* c8 ignore next */
668
- _E: _ => _,
771
+ _E: (_2) => _2,
669
772
  /* c8 ignore next */
670
- _R: _ => _
773
+ _R: (_2) => _2
671
774
  };
672
- const channelVariance = {
775
+ var channelVariance = {
673
776
  /* c8 ignore next */
674
- _Env: _ => _,
777
+ _Env: (_2) => _2,
675
778
  /* c8 ignore next */
676
- _InErr: _ => _,
779
+ _InErr: (_2) => _2,
677
780
  /* c8 ignore next */
678
- _InElem: _ => _,
781
+ _InElem: (_2) => _2,
679
782
  /* c8 ignore next */
680
- _InDone: _ => _,
783
+ _InDone: (_2) => _2,
681
784
  /* c8 ignore next */
682
- _OutErr: _ => _,
785
+ _OutErr: (_2) => _2,
683
786
  /* c8 ignore next */
684
- _OutElem: _ => _,
787
+ _OutElem: (_2) => _2,
685
788
  /* c8 ignore next */
686
- _OutDone: _ => _
789
+ _OutDone: (_2) => _2
687
790
  };
688
- /** @internal */
689
- const EffectPrototype = {
791
+ var EffectPrototype = {
690
792
  [EffectTypeId]: effectVariance,
691
793
  [StreamTypeId]: effectVariance,
692
794
  [SinkTypeId]: sinkVariance,
693
795
  [ChannelTypeId]: channelVariance,
694
- [symbol](that) {
796
+ [symbol2](that) {
695
797
  return this === that;
696
798
  },
697
- [symbol$1]() {
799
+ [symbol]() {
698
800
  return random(this);
699
801
  },
700
802
  pipe() {
@@ -702,14 +804,12 @@ const EffectPrototype = {
702
804
  }
703
805
  };
704
806
 
705
- /**
706
- * @since 2.0.0
707
- */
708
- const TypeId = /*#__PURE__*/Symbol.for("effect/Option");
709
- const CommonProto = {
807
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/internal/option.js
808
+ var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
809
+ var CommonProto = {
710
810
  ...EffectPrototype,
711
811
  [TypeId]: {
712
- _A: _ => _
812
+ _A: (_2) => _2
713
813
  },
714
814
  [NodeInspectSymbol]() {
715
815
  return this.toJSON();
@@ -718,13 +818,13 @@ const CommonProto = {
718
818
  return format(this.toJSON());
719
819
  }
720
820
  };
721
- const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
821
+ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
722
822
  _tag: "Some",
723
823
  _op: "Some",
724
- [symbol](that) {
725
- return isOption(that) && isSome$1(that) && equals(that.value, this.value);
824
+ [symbol2](that) {
825
+ return isOption(that) && isSome(that) && equals(that.value, this.value);
726
826
  },
727
- [symbol$1]() {
827
+ [symbol]() {
728
828
  return combine(hash(this._tag))(hash(this.value));
729
829
  },
730
830
  toJSON() {
@@ -735,13 +835,13 @@ const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
735
835
  };
736
836
  }
737
837
  });
738
- const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
838
+ var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
739
839
  _tag: "None",
740
840
  _op: "None",
741
- [symbol](that) {
742
- return isOption(that) && isNone$1(that);
841
+ [symbol2](that) {
842
+ return isOption(that) && isNone(that);
743
843
  },
744
- [symbol$1]() {
844
+ [symbol]() {
745
845
  return combine(hash(this._tag));
746
846
  },
747
847
  toJSON() {
@@ -751,865 +851,902 @@ const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
751
851
  };
752
852
  }
753
853
  });
754
- /** @internal */
755
- const isOption = input => hasProperty(input, TypeId);
756
- /** @internal */
757
- const isNone$1 = fa => fa._tag === "None";
758
- /** @internal */
759
- const isSome$1 = fa => fa._tag === "Some";
760
- /** @internal */
761
- const none$1 = /*#__PURE__*/Object.create(NoneProto);
762
- /** @internal */
763
- const some$1 = value => {
764
- const a = Object.create(SomeProto);
765
- a.value = value;
766
- return a;
854
+ var isOption = (input) => hasProperty(input, TypeId);
855
+ var isNone = (fa) => fa._tag === "None";
856
+ var isSome = (fa) => fa._tag === "Some";
857
+ var none = /* @__PURE__ */ Object.create(NoneProto);
858
+ var some2 = (value) => {
859
+ const a2 = Object.create(SomeProto);
860
+ a2.value = value;
861
+ return a2;
767
862
  };
768
863
 
769
- /**
770
- * Creates a new `Option` that represents the absence of a value.
771
- *
772
- * @category constructors
773
- * @since 2.0.0
774
- */
775
- const none = () => none$1;
776
- /**
777
- * Creates a new `Option` that wraps the given value.
778
- *
779
- * @param value - The value to wrap.
780
- *
781
- * @category constructors
782
- * @since 2.0.0
783
- */
784
- const some = some$1;
785
- /**
786
- * Determine if a `Option` is a `None`.
787
- *
788
- * @param self - The `Option` to check.
789
- *
790
- * @example
791
- * import { some, none, isNone } from 'effect/Option'
792
- *
793
- * assert.deepStrictEqual(isNone(some(1)), false)
794
- * assert.deepStrictEqual(isNone(none()), true)
795
- *
796
- * @category guards
797
- * @since 2.0.0
798
- */
799
- const isNone = isNone$1;
800
- /**
801
- * Determine if a `Option` is a `Some`.
802
- *
803
- * @param self - The `Option` to check.
804
- *
805
- * @example
806
- * import { some, none, isSome } from 'effect/Option'
807
- *
808
- * assert.deepStrictEqual(isSome(some(1)), true)
809
- * assert.deepStrictEqual(isSome(none()), false)
810
- *
811
- * @category guards
812
- * @since 2.0.0
813
- */
814
- const isSome = isSome$1;
815
- /**
816
- * Returns the value of the `Option` if it is `Some`, otherwise returns `onNone`
817
- *
818
- * @param self - The `Option` to get the value of.
819
- * @param onNone - Function that returns the default value to return if the `Option` is `None`.
820
- *
821
- * @example
822
- * import { some, none, getOrElse } from 'effect/Option'
823
- * import { pipe } from "effect/Function"
824
- *
825
- * assert.deepStrictEqual(pipe(some(1), getOrElse(() => 0)), 1)
826
- * assert.deepStrictEqual(pipe(none(), getOrElse(() => 0)), 0)
827
- *
828
- * @category getters
829
- * @since 2.0.0
830
- */
831
- const getOrElse = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
832
- /**
833
- * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.
834
- *
835
- * @param self - The first `Option` to be checked.
836
- * @param that - The `Option` to return if `self` is `None`.
837
- *
838
- * @example
839
- * import * as O from "effect/Option"
840
- * import { pipe } from "effect/Function"
841
- *
842
- * assert.deepStrictEqual(
843
- * pipe(
844
- * O.none(),
845
- * O.orElse(() => O.none())
846
- * ),
847
- * O.none()
848
- * )
849
- * assert.deepStrictEqual(
850
- * pipe(
851
- * O.some('a'),
852
- * O.orElse(() => O.none())
853
- * ),
854
- * O.some('a')
855
- * )
856
- * assert.deepStrictEqual(
857
- * pipe(
858
- * O.none(),
859
- * O.orElse(() => O.some('b'))
860
- * ),
861
- * O.some('b')
862
- * )
863
- * assert.deepStrictEqual(
864
- * pipe(
865
- * O.some('a'),
866
- * O.orElse(() => O.some('b'))
867
- * ),
868
- * O.some('a')
869
- * )
870
- *
871
- * @category error handling
872
- * @since 2.0.0
873
- */
874
- const orElse = /*#__PURE__*/dual(2, (self, that) => isNone(self) ? that() : self);
875
- /**
876
- * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
877
- * returns the value wrapped in a `Some`.
878
- *
879
- * @param nullableValue - The nullable value to be converted to an `Option`.
880
- *
881
- * @example
882
- * import * as O from "effect/Option"
883
- *
884
- * assert.deepStrictEqual(O.fromNullable(undefined), O.none())
885
- * assert.deepStrictEqual(O.fromNullable(null), O.none())
886
- * assert.deepStrictEqual(O.fromNullable(1), O.some(1))
887
- *
888
- * @category conversions
889
- * @since 2.0.0
890
- */
891
- const fromNullable = nullableValue => nullableValue == null ? none() : some(nullableValue);
892
- /**
893
- * Maps the `Some` side of an `Option` value to a new `Option` value.
894
- *
895
- * @param self - An `Option` to map
896
- * @param f - The function to map over the value of the `Option`
897
- *
898
- * @category mapping
899
- * @since 2.0.0
900
- */
901
- const map = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
902
- /**
903
- * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
904
- *
905
- * @category sequencing
906
- * @since 2.0.0
907
- */
908
- const flatMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
909
- /**
910
- * This is `flatMap` + `fromNullable`, useful when working with optional values.
911
- *
912
- * @example
913
- * import { some, none, flatMapNullable } from 'effect/Option'
914
- * import { pipe } from "effect/Function"
915
- *
916
- * interface Employee {
917
- * company?: {
918
- * address?: {
919
- * street?: {
920
- * name?: string
921
- * }
922
- * }
923
- * }
924
- * }
925
- *
926
- * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
927
- *
928
- * assert.deepStrictEqual(
929
- * pipe(
930
- * some(employee1),
931
- * flatMapNullable(employee => employee.company?.address?.street?.name),
932
- * ),
933
- * some('high street')
934
- * )
935
- *
936
- * const employee2: Employee = { company: { address: { street: {} } } }
937
- *
938
- * assert.deepStrictEqual(
939
- * pipe(
940
- * some(employee2),
941
- * flatMapNullable(employee => employee.company?.address?.street?.name),
942
- * ),
943
- * none()
944
- * )
945
- *
946
- * @category sequencing
947
- * @since 2.0.0
948
- */
949
- const flatMapNullable = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : fromNullable(f(self.value)));
950
- /**
951
- * @category combining
952
- * @since 2.0.0
953
- */
954
- const product = (self, that) => isSome(self) && isSome(that) ? some([self.value, that.value]) : none();
955
- /**
956
- * Zips two `Option` values together using a provided function, returning a new `Option` of the result.
957
- *
958
- * @param self - The left-hand side of the zip operation
959
- * @param that - The right-hand side of the zip operation
960
- * @param f - The function used to combine the values of the two `Option`s
961
- *
962
- * @example
963
- * import * as O from "effect/Option"
964
- *
965
- * type Complex = [real: number, imaginary: number]
966
- *
967
- * const complex = (real: number, imaginary: number): Complex => [real, imaginary]
968
- *
969
- * assert.deepStrictEqual(O.zipWith(O.none(), O.none(), complex), O.none())
970
- * assert.deepStrictEqual(O.zipWith(O.some(1), O.none(), complex), O.none())
971
- * assert.deepStrictEqual(O.zipWith(O.none(), O.some(1), complex), O.none())
972
- * assert.deepStrictEqual(O.zipWith(O.some(1), O.some(2), complex), O.some([1, 2]))
973
- *
974
- * assert.deepStrictEqual(O.zipWith(O.some(1), complex)(O.some(2)), O.some([2, 1]))
975
- *
976
- * @category zipping
977
- * @since 2.0.0
978
- */
979
- const zipWith = /*#__PURE__*/dual(3, (self, that, f) => map(product(self, that), ([a, b]) => f(a, b)));
980
- /**
981
- * Maps over the value of an `Option` and filters out `None`s.
982
- *
983
- * Useful when in addition to filtering you also want to change the type of the `Option`.
984
- *
985
- * @param self - The `Option` to map over.
986
- * @param f - A function to apply to the value of the `Option`.
987
- *
988
- * @example
989
- * import * as O from "effect/Option"
990
- *
991
- * const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
992
- *
993
- * assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
994
- * assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
995
- * assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
996
- *
997
- * @category filtering
998
- * @since 2.0.0
999
- */
1000
- const filterMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
1001
- /**
1002
- * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1003
- *
1004
- * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1005
- *
1006
- * @param predicate - A predicate function to apply to the `Option` value.
1007
- * @param fb - The `Option` to filter.
1008
- *
1009
- * @example
1010
- * import * as O from "effect/Option"
1011
- *
1012
- * // predicate
1013
- * const isEven = (n: number) => n % 2 === 0
1014
- *
1015
- * assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
1016
- * assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
1017
- * assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
1018
- *
1019
- * // refinement
1020
- * const isNumber = (v: unknown): v is number => typeof v === "number"
1021
- *
1022
- * assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
1023
- * assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
1024
- * assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
1025
- *
1026
- * @category filtering
1027
- * @since 2.0.0
1028
- */
1029
- const filter = /*#__PURE__*/dual(2, (self, predicate) => filterMap(self, b => predicate(b) ? some$1(b) : none$1));
1030
- /**
1031
- * Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
1032
- * if the predicate returns `false`.
1033
- *
1034
- * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
1035
- *
1036
- * @example
1037
- * import * as O from "effect/Option"
1038
- *
1039
- * const getOption = O.liftPredicate((n: number) => n >= 0)
1040
- *
1041
- * assert.deepStrictEqual(getOption(-1), O.none())
1042
- * assert.deepStrictEqual(getOption(1), O.some(1))
1043
- *
1044
- * @category lifting
1045
- * @since 2.0.0
1046
- */
1047
- const liftPredicate = predicate => b => predicate(b) ? some(b) : none();
1048
- /**
1049
- * Check if a value in an `Option` type meets a certain predicate.
1050
- *
1051
- * @param self - The `Option` to check.
1052
- * @param predicate - The condition to check.
1053
- *
1054
- * @example
1055
- * import { some, none, exists } from 'effect/Option'
1056
- * import { pipe } from "effect/Function"
1057
- *
1058
- * const isEven = (n: number) => n % 2 === 0
1059
- *
1060
- * assert.deepStrictEqual(pipe(some(2), exists(isEven)), true)
1061
- * assert.deepStrictEqual(pipe(some(1), exists(isEven)), false)
1062
- * assert.deepStrictEqual(pipe(none(), exists(isEven)), false)
1063
- *
1064
- * @since 2.0.0
1065
- */
1066
- const exists = /*#__PURE__*/dual(2, (self, refinement) => isNone(self) ? false : refinement(self.value));
864
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/internal/either.js
865
+ var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
866
+ var CommonProto2 = {
867
+ ...EffectPrototype,
868
+ [TypeId2]: {
869
+ _A: (_2) => _2
870
+ },
871
+ [NodeInspectSymbol]() {
872
+ return this.toJSON();
873
+ },
874
+ toString() {
875
+ return format(this.toJSON());
876
+ }
877
+ };
878
+ var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
879
+ _tag: "Right",
880
+ _op: "Right",
881
+ [symbol2](that) {
882
+ return isEither(that) && isRight(that) && equals(that.right, this.right);
883
+ },
884
+ [symbol]() {
885
+ return combine(hash(this._tag))(hash(this.right));
886
+ },
887
+ toJSON() {
888
+ return {
889
+ _id: "Either",
890
+ _tag: this._tag,
891
+ right: toJSON(this.right)
892
+ };
893
+ }
894
+ });
895
+ var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
896
+ _tag: "Left",
897
+ _op: "Left",
898
+ [symbol2](that) {
899
+ return isEither(that) && isLeft(that) && equals(that.left, this.left);
900
+ },
901
+ [symbol]() {
902
+ return combine(hash(this._tag))(hash(this.left));
903
+ },
904
+ toJSON() {
905
+ return {
906
+ _id: "Either",
907
+ _tag: this._tag,
908
+ left: toJSON(this.left)
909
+ };
910
+ }
911
+ });
912
+ var isEither = (input) => hasProperty(input, TypeId2);
913
+ var isLeft = (ma) => ma._tag === "Left";
914
+ var isRight = (ma) => ma._tag === "Right";
915
+ var left = (left2) => {
916
+ const a2 = Object.create(LeftProto);
917
+ a2.left = left2;
918
+ return a2;
919
+ };
920
+ var right = (right2) => {
921
+ const a2 = Object.create(RightProto);
922
+ a2.right = right2;
923
+ return a2;
924
+ };
925
+ var getLeft = (self) => isRight(self) ? none : some2(self.left);
926
+ var getRight = (self) => isLeft(self) ? none : some2(self.right);
1067
927
 
1068
- /**
1069
- * Bun currently has a bug where `setTimeout` doesn't behave correctly with a 0ms delay.
1070
- *
1071
- * @see https://github.com/oven-sh/bun/issues/3333
1072
- */
1073
- /** @internal */
1074
- typeof process === "undefined" ? false : !!process?.isBun;
928
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Order.js
929
+ var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
1075
930
 
1076
- const RE_JSX_ANNOTATION_REGEX = /@jsx\s+(\S+)/u;
1077
- // Does not check for reserved keywords or unicode characters
1078
- const RE_JS_IDENTIFIER_REGEX = /^[$A-Z_a-z][\w$]*$/u;
931
+ // ../../../node_modules/.pnpm/effect@2.3.3/node_modules/effect/dist/esm/Option.js
932
+ var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
933
+ var none2 = () => none;
934
+ var some3 = some2;
935
+ var isOption2 = isOption;
936
+ var isNone2 = isNone;
937
+ var isSome2 = isSome;
938
+ var match = /* @__PURE__ */ dual(2, (self, {
939
+ onNone,
940
+ onSome
941
+ }) => isNone2(self) ? onNone() : onSome(self.value));
942
+ var toRefinement = (f2) => (a2) => isSome2(f2(a2));
943
+ var fromIterable = (collection) => {
944
+ for (const a2 of collection) {
945
+ return some3(a2);
946
+ }
947
+ return none2();
948
+ };
949
+ var getRight2 = getRight;
950
+ var getLeft2 = getLeft;
951
+ var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
952
+ var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
953
+ var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some3(onNone()) : self);
954
+ var orElseEither = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? map(that(), right) : map(self, left));
955
+ var firstSomeOf = (collection) => {
956
+ let out = none2();
957
+ for (out of collection) {
958
+ if (isSome2(out)) {
959
+ return out;
960
+ }
961
+ }
962
+ return out;
963
+ };
964
+ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some3(nullableValue);
965
+ var liftNullable = (f2) => (...a2) => fromNullable(f2(...a2));
966
+ var getOrNull = /* @__PURE__ */ getOrElse(constNull);
967
+ var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
968
+ var liftThrowable = (f2) => (...a2) => {
969
+ try {
970
+ return some3(f2(...a2));
971
+ } catch (e2) {
972
+ return none2();
973
+ }
974
+ };
975
+ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onNone) => {
976
+ if (isSome2(self)) {
977
+ return self.value;
978
+ }
979
+ throw onNone();
980
+ });
981
+ var getOrThrow = /* @__PURE__ */ getOrThrowWith(() => new Error("getOrThrow called on a None"));
982
+ var map = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : some3(f2(self.value)));
983
+ var as = /* @__PURE__ */ dual(2, (self, b2) => map(self, () => b2));
984
+ var asUnit = /* @__PURE__ */ as(void 0);
985
+ var unit = /* @__PURE__ */ some3(void 0);
986
+ var flatMap = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : f2(self.value));
987
+ var andThen = /* @__PURE__ */ dual(2, (self, f2) => flatMap(self, (a2) => {
988
+ const b2 = isFunction(f2) ? f2(a2) : f2;
989
+ return isOption2(b2) ? b2 : some3(b2);
990
+ }));
991
+ var flatMapNullable = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : fromNullable(f2(self.value)));
992
+ var flatten = /* @__PURE__ */ flatMap(identity);
993
+ var zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap(self, () => that));
994
+ var composeK = /* @__PURE__ */ dual(2, (afb, bfc) => (a2) => flatMap(afb(a2), bfc));
995
+ var zipLeft = /* @__PURE__ */ dual(2, (self, that) => tap(self, () => that));
996
+ var tap = /* @__PURE__ */ dual(2, (self, f2) => flatMap(self, (a2) => map(f2(a2), () => a2)));
997
+ var product2 = (self, that) => isSome2(self) && isSome2(that) ? some3([self.value, that.value]) : none2();
998
+ var productMany2 = (self, collection) => {
999
+ if (isNone2(self)) {
1000
+ return none2();
1001
+ }
1002
+ const out = [self.value];
1003
+ for (const o2 of collection) {
1004
+ if (isNone2(o2)) {
1005
+ return none2();
1006
+ }
1007
+ out.push(o2.value);
1008
+ }
1009
+ return some3(out);
1010
+ };
1011
+ var all2 = (input) => {
1012
+ if (Symbol.iterator in input) {
1013
+ const out2 = [];
1014
+ for (const o2 of input) {
1015
+ if (isNone2(o2)) {
1016
+ return none2();
1017
+ }
1018
+ out2.push(o2.value);
1019
+ }
1020
+ return some3(out2);
1021
+ }
1022
+ const out = {};
1023
+ for (const key of Object.keys(input)) {
1024
+ const o2 = input[key];
1025
+ if (isNone2(o2)) {
1026
+ return none2();
1027
+ }
1028
+ out[key] = o2.value;
1029
+ }
1030
+ return some3(out);
1031
+ };
1032
+ var zipWith = /* @__PURE__ */ dual(3, (self, that, f2) => map(product2(self, that), ([a2, b2]) => f2(a2, b2)));
1033
+ var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f2, a2) => f2(a2)));
1034
+ var reduceCompact = /* @__PURE__ */ dual(3, (self, b2, f2) => {
1035
+ let out = b2;
1036
+ for (const oa of self) {
1037
+ if (isSome2(oa)) {
1038
+ out = f2(out, oa.value);
1039
+ }
1040
+ }
1041
+ return out;
1042
+ });
1043
+ var toArray = (self) => isNone2(self) ? [] : [self.value];
1044
+ var partitionMap = /* @__PURE__ */ dual(2, (self, f2) => {
1045
+ if (isNone2(self)) {
1046
+ return [none2(), none2()];
1047
+ }
1048
+ const e2 = f2(self.value);
1049
+ return isLeft(e2) ? [some3(e2.left), none2()] : [none2(), some3(e2.right)];
1050
+ });
1051
+ var filterMap = /* @__PURE__ */ dual(2, (self, f2) => isNone2(self) ? none2() : f2(self.value));
1052
+ var filter = /* @__PURE__ */ dual(2, (self, predicate) => filterMap(self, (b2) => predicate(b2) ? some2(b2) : none));
1053
+ var getEquivalence = (isEquivalent) => make((x2, y2) => x2 === y2 || (isNone2(x2) ? isNone2(y2) : isNone2(y2) ? false : isEquivalent(x2.value, y2.value)));
1054
+ var getOrder = (O2) => make2((self, that) => isSome2(self) ? isSome2(that) ? O2(self.value, that.value) : 1 : -1);
1055
+ var lift2 = (f2) => dual(2, (self, that) => zipWith(self, that, f2));
1056
+ var liftPredicate = (predicate) => (b2) => predicate(b2) ? some3(b2) : none2();
1057
+ var containsWith = (isEquivalent) => dual(2, (self, a2) => isNone2(self) ? false : isEquivalent(self.value, a2));
1058
+ var _equivalence = /* @__PURE__ */ equivalence();
1059
+ var contains = /* @__PURE__ */ containsWith(_equivalence);
1060
+ var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
1061
+ var bindTo = /* @__PURE__ */ dual(2, (self, name) => map(self, (a2) => ({
1062
+ [name]: a2
1063
+ })));
1064
+ var let_ = /* @__PURE__ */ dual(3, (self, name, f2) => map(self, (a2) => Object.assign({}, a2, {
1065
+ [name]: f2(a2)
1066
+ })));
1067
+ var bind = /* @__PURE__ */ dual(3, (self, name, f2) => flatMap(self, (a2) => map(f2(a2), (b2) => Object.assign({}, a2, {
1068
+ [name]: b2
1069
+ }))));
1070
+ var Do = /* @__PURE__ */ some3({});
1071
+ var adapter2 = /* @__PURE__ */ adapter();
1072
+ var gen = (f2) => {
1073
+ const iterator = f2(adapter2);
1074
+ let state = iterator.next();
1075
+ if (state.done) {
1076
+ return some3(state.value);
1077
+ } else {
1078
+ let current = state.value.value;
1079
+ if (isNone2(current)) {
1080
+ return current;
1081
+ }
1082
+ while (!state.done) {
1083
+ state = iterator.next(current.value);
1084
+ if (!state.done) {
1085
+ current = state.value.value;
1086
+ if (isNone2(current)) {
1087
+ return current;
1088
+ }
1089
+ }
1090
+ }
1091
+ return some3(state.value);
1092
+ }
1093
+ };
1094
+ var RE_JSX_ANNOTATION_REGEX = /@jsx\s+(\S+)/u;
1095
+ var RE_JS_IDENTIFIER_REGEX = /^[$A-Z_a-z][\w$]*$/u;
1079
1096
  function getFragmentFromContext(context) {
1080
- const settings = parseSchema(ESLintSettingsSchema, context.settings);
1081
- const fragment = settings.reactOptions?.jsxPragmaFrag;
1082
- if (isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment)) return fragment;
1083
- return "Fragment";
1097
+ const settings = parseSchema(ESLintSettingsSchema, context.settings);
1098
+ const fragment = settings.reactOptions?.jsxPragmaFrag;
1099
+ if (Predicate_exports.isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment))
1100
+ return fragment;
1101
+ return "Fragment";
1084
1102
  }
1085
- const getPragmaFromContext = memo((context)=>{
1103
+ var getPragmaFromContext = memo(
1104
+ (context) => {
1086
1105
  const settings = parseSchema(ESLintSettingsSchema, context.settings);
1087
1106
  const pragma = settings.reactOptions?.jsxPragma;
1088
1107
  const { sourceCode } = context;
1089
- const pragmaNode = sourceCode.getAllComments().find((node)=>RE_JSX_ANNOTATION_REGEX.test(node.value));
1090
- 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")));
1091
- });
1092
-
1093
- 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}}
1108
+ const pragmaNode = sourceCode.getAllComments().find((node) => RE_JSX_ANNOTATION_REGEX.test(node.value));
1109
+ return Function_exports.pipe(
1110
+ Option_exports.orElse(Option_exports.fromNullable(pragma), () => Function_exports.pipe(
1111
+ Option_exports.fromNullable(pragmaNode),
1112
+ Option_exports.map(({ value }) => RE_JSX_ANNOTATION_REGEX.exec(value)),
1113
+ Option_exports.flatMapNullable((matches) => matches?.[1]?.split(".")[0])
1114
+ )),
1115
+ Option_exports.flatMap(Option_exports.liftPredicate((x2) => RE_JS_IDENTIFIER_REGEX.test(x2))),
1116
+ Option_exports.getOrElse(Function_exports.constant("React"))
1117
+ );
1118
+ }
1119
+ );
1094
1120
 
1095
- function isInitializedFromPragma(variableName, context, initialScope, pragma = getPragmaFromContext(context)) {
1096
- const maybeVariable = findVariable(variableName, initialScope);
1097
- const maybeLatestDef = flatMapNullable(maybeVariable, (variable)=>variable.defs.at(-1));
1098
- if (isNone(maybeLatestDef)) return false;
1099
- const latestDef = maybeLatestDef.value;
1100
- const { node, parent } = latestDef;
1101
- if (node.type === NodeType.VariableDeclarator && node.init) {
1102
- const { init } = node;
1103
- // check for: `variable = pragma.variable`
1104
- if (a({
1105
- type: "MemberExpression",
1106
- object: {
1107
- type: "Identifier",
1108
- name: pragma
1109
- }
1110
- }, init)) return true;
1111
- // check for: `{ variable } = pragma`
1112
- if (a({
1113
- type: "Identifier",
1114
- name: pragma
1115
- }, init)) return true;
1116
- // check if from a require call: `require("react")`
1117
- const maybeRequireExpression = N(init).with({
1118
- type: NodeType.CallExpression,
1119
- callee: {
1120
- type: NodeType.Identifier,
1121
- name: "require"
1122
- }
1123
- }, (exp)=>some(exp)).with({
1124
- type: NodeType.MemberExpression,
1125
- object: {
1126
- type: NodeType.CallExpression,
1127
- callee: {
1128
- type: NodeType.Identifier,
1129
- name: "require"
1130
- }
1131
- }
1132
- }, ({ object })=>some(object)).otherwise(none);
1133
- if (isNone(maybeRequireExpression)) return false;
1134
- const requireExpression = maybeRequireExpression.value;
1135
- const [firstArg] = requireExpression.arguments;
1136
- if (firstArg?.type !== NodeType.Literal) return false;
1137
- return firstArg.value === pragma.toLowerCase();
1121
+ // ../../../node_modules/.pnpm/ts-pattern@5.0.6/node_modules/ts-pattern/dist/index.js
1122
+ var t = Symbol.for("@ts-pattern/matcher");
1123
+ var e = Symbol.for("@ts-pattern/isVariadic");
1124
+ var n = "@ts-pattern/anonymous-select-key";
1125
+ var r = (t2) => Boolean(t2 && "object" == typeof t2);
1126
+ var i = (e2) => e2 && !!e2[t];
1127
+ var s = (n2, o2, c2) => {
1128
+ if (i(n2)) {
1129
+ const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
1130
+ return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
1131
+ }
1132
+ if (r(n2)) {
1133
+ if (!r(o2))
1134
+ return false;
1135
+ if (Array.isArray(n2)) {
1136
+ if (!Array.isArray(o2))
1137
+ return false;
1138
+ let t2 = [], r2 = [], a2 = [];
1139
+ for (const s2 of n2.keys()) {
1140
+ const o3 = n2[s2];
1141
+ i(o3) && o3[e] ? a2.push(o3) : a2.length ? r2.push(o3) : t2.push(o3);
1142
+ }
1143
+ if (a2.length) {
1144
+ if (a2.length > 1)
1145
+ throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
1146
+ if (o2.length < t2.length + r2.length)
1147
+ return false;
1148
+ const e2 = o2.slice(0, t2.length), n3 = 0 === r2.length ? [] : o2.slice(-r2.length), i2 = o2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
1149
+ return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a2.length || s(a2[0], i2, c2));
1150
+ }
1151
+ return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
1138
1152
  }
1139
- // latest definition is an import declaration: import { variable } from 'react'
1140
- return a({
1141
- type: "ImportDeclaration",
1142
- source: {
1143
- value: pragma.toLowerCase()
1144
- }
1145
- }, parent);
1146
- }
1147
- function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context)) {
1148
- const isMatch = a({
1149
- type: NodeType.MemberExpression,
1150
- object: {
1151
- type: NodeType.Identifier,
1152
- name: pragma
1153
- },
1154
- property: {
1155
- name
1156
- }
1153
+ return Object.keys(n2).every((e2) => {
1154
+ const r2 = n2[e2];
1155
+ return (e2 in o2 || i(a2 = r2) && "optional" === a2[t]().matcherType) && s(r2, o2[e2], c2);
1156
+ var a2;
1157
+ });
1158
+ }
1159
+ return Object.is(o2, n2);
1160
+ };
1161
+ var o = (e2) => {
1162
+ var n2, s2, a2;
1163
+ return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a2 = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a2)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
1164
+ };
1165
+ var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
1166
+ function a(...t2) {
1167
+ if (1 === t2.length) {
1168
+ const [e2] = t2;
1169
+ return (t3) => s(e2, t3, () => {
1170
+ });
1171
+ }
1172
+ if (2 === t2.length) {
1173
+ const [e2, n2] = t2;
1174
+ return s(e2, n2, () => {
1157
1175
  });
1158
- return isMatch;
1176
+ }
1177
+ throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t2.length}.`);
1159
1178
  }
1160
- /**
1161
- * Checks if the given node is a call expression to the given function or method of the pragma
1162
- * @param name The name of the function or method to check
1163
- * @returns A predicate that checks if the given node is a call expression to the given function or method
1164
- */ function isFromPragma(name) {
1165
- return (node, context)=>{
1166
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1167
- if (node.type === NodeType.MemberExpression) return isPropertyOfPragma(name, context)(node);
1168
- if (node.name === name) return isInitializedFromPragma(name, context, initialScope);
1169
- return false;
1179
+ function u(t2) {
1180
+ return Object.assign(t2, { optional: () => l(t2), and: (e2) => m(t2, e2), or: (e2) => y(t2, e2), select: (e2) => void 0 === e2 ? p(t2) : p(e2, t2) });
1181
+ }
1182
+ function h(t2) {
1183
+ return Object.assign(((t3) => Object.assign(t3, { *[Symbol.iterator]() {
1184
+ yield Object.assign(t3, { [e]: true });
1185
+ } }))(t2), { optional: () => h(l(t2)), select: (e2) => h(void 0 === e2 ? p(t2) : p(e2, t2)) });
1186
+ }
1187
+ function l(e2) {
1188
+ return u({ [t]: () => ({ match: (t2) => {
1189
+ let n2 = {};
1190
+ const r2 = (t3, e3) => {
1191
+ n2[t3] = e3;
1170
1192
  };
1193
+ return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
1194
+ }, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
1171
1195
  }
1172
- /**
1173
- * @internal
1174
- * @param pragmaMemberName
1175
- * @param name
1176
- * @returns A function that checks if a given node is a member expression of a Pragma member.
1177
- */ function isFromPragmaMember(pragmaMemberName, name) {
1178
- return (node, context, pragma = getPragmaFromContext(context))=>{
1179
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1180
- if (node.property.type !== NodeType.Identifier || node.property.name !== name) return false;
1181
- if (node.object.type === NodeType.Identifier && node.object.name === pragmaMemberName) {
1182
- return isInitializedFromPragma(node.object.name, context, initialScope, pragma);
1183
- }
1184
- if (node.object.type === NodeType.MemberExpression && node.object.object.type === NodeType.Identifier && node.object.object.name === pragma && node.object.property.type === NodeType.Identifier) {
1185
- return node.object.property.name === pragmaMemberName;
1186
- }
1187
- return false;
1196
+ var f = (t2, e2) => {
1197
+ for (const n2 of t2)
1198
+ if (!e2(n2))
1199
+ return false;
1200
+ return true;
1201
+ };
1202
+ var g = (t2, e2) => {
1203
+ for (const [n2, r2] of t2.entries())
1204
+ if (!e2(r2, n2))
1205
+ return false;
1206
+ return true;
1207
+ };
1208
+ function m(...e2) {
1209
+ return u({ [t]: () => ({ match: (t2) => {
1210
+ let n2 = {};
1211
+ const r2 = (t3, e3) => {
1212
+ n2[t3] = e3;
1188
1213
  };
1214
+ return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
1215
+ }, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
1189
1216
  }
1190
- function isCallFromPragma(name) {
1191
- return (node, context)=>{
1192
- if (!isOneOf([
1193
- NodeType.Identifier,
1194
- NodeType.MemberExpression
1195
- ])(node.callee)) return false;
1196
- return isFromPragma(name)(node.callee, context);
1217
+ function y(...e2) {
1218
+ return u({ [t]: () => ({ match: (t2) => {
1219
+ let n2 = {};
1220
+ const r2 = (t3, e3) => {
1221
+ n2[t3] = e3;
1197
1222
  };
1223
+ return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
1224
+ }, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
1198
1225
  }
1199
- function isCallFromPragmaMember(pragmaMemberName, name) {
1200
- return (node, context)=>{
1201
- if (!is(NodeType.MemberExpression)(node.callee)) return false;
1202
- return isFromPragmaMember(pragmaMemberName, name)(node.callee, context);
1226
+ function d(e2) {
1227
+ return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
1228
+ }
1229
+ function p(...e2) {
1230
+ const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
1231
+ return u({ [t]: () => ({ match: (t2) => {
1232
+ let e3 = { [null != r2 ? r2 : n]: t2 };
1233
+ return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
1234
+ e3[t3] = n2;
1235
+ }), selections: e3 };
1236
+ }, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
1237
+ }
1238
+ function v(t2) {
1239
+ return "number" == typeof t2;
1240
+ }
1241
+ function b(t2) {
1242
+ return "string" == typeof t2;
1243
+ }
1244
+ function w(t2) {
1245
+ return "bigint" == typeof t2;
1246
+ }
1247
+ var S = u(d(function(t2) {
1248
+ return true;
1249
+ }));
1250
+ var O = S;
1251
+ var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
1252
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.startsWith(n2)))));
1253
+ var n2;
1254
+ }, endsWith: (e2) => {
1255
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.endsWith(n2)))));
1256
+ var n2;
1257
+ }, minLength: (e2) => j(m(t2, ((t3) => d((e3) => b(e3) && e3.length >= t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => d((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
1258
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.includes(n2)))));
1259
+ var n2;
1260
+ }, regex: (e2) => {
1261
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && Boolean(t3.match(n2))))));
1262
+ var n2;
1263
+ } });
1264
+ var E = j(d(b));
1265
+ var K = (t2) => Object.assign(u(t2), { between: (e2, n2) => K(m(t2, ((t3, e3) => d((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 >= t3))(e2))), int: () => K(m(t2, d((t3) => v(t3) && Number.isInteger(t3)))), finite: () => K(m(t2, d((t3) => v(t3) && Number.isFinite(t3)))), positive: () => K(m(t2, d((t3) => v(t3) && t3 > 0))), negative: () => K(m(t2, d((t3) => v(t3) && t3 < 0))) });
1266
+ var A = K(d(v));
1267
+ var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => d((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 >= t3))(e2))), positive: () => x(m(t2, d((t3) => w(t3) && t3 > 0))), negative: () => x(m(t2, d((t3) => w(t3) && t3 < 0))) });
1268
+ var P = x(d(w));
1269
+ var T = u(d(function(t2) {
1270
+ return "boolean" == typeof t2;
1271
+ }));
1272
+ var k = u(d(function(t2) {
1273
+ return "symbol" == typeof t2;
1274
+ }));
1275
+ var B = u(d(function(t2) {
1276
+ return null == t2;
1277
+ }));
1278
+ var _ = { __proto__: null, matcher: t, optional: l, array: function(...e2) {
1279
+ return h({ [t]: () => ({ match: (t2) => {
1280
+ if (!Array.isArray(t2))
1281
+ return { matched: false };
1282
+ if (0 === e2.length)
1283
+ return { matched: true };
1284
+ const n2 = e2[0];
1285
+ let r2 = {};
1286
+ if (0 === t2.length)
1287
+ return o(n2).forEach((t3) => {
1288
+ r2[t3] = [];
1289
+ }), { matched: true, selections: r2 };
1290
+ const i2 = (t3, e3) => {
1291
+ r2[t3] = (r2[t3] || []).concat([e3]);
1292
+ };
1293
+ return { matched: t2.every((t3) => s(n2, t3, i2)), selections: r2 };
1294
+ }, getSelectionKeys: () => 0 === e2.length ? [] : o(e2[0]) }) });
1295
+ }, set: function(...e2) {
1296
+ return u({ [t]: () => ({ match: (t2) => {
1297
+ if (!(t2 instanceof Set))
1298
+ return { matched: false };
1299
+ let n2 = {};
1300
+ if (0 === t2.size)
1301
+ return { matched: true, selections: n2 };
1302
+ if (0 === e2.length)
1303
+ return { matched: true };
1304
+ const r2 = (t3, e3) => {
1305
+ n2[t3] = (n2[t3] || []).concat([e3]);
1306
+ }, i2 = e2[0];
1307
+ return { matched: f(t2, (t3) => s(i2, t3, r2)), selections: n2 };
1308
+ }, getSelectionKeys: () => 0 === e2.length ? [] : o(e2[0]) }) });
1309
+ }, map: function(...e2) {
1310
+ return u({ [t]: () => ({ match: (t2) => {
1311
+ if (!(t2 instanceof Map))
1312
+ return { matched: false };
1313
+ let n2 = {};
1314
+ if (0 === t2.size)
1315
+ return { matched: true, selections: n2 };
1316
+ const r2 = (t3, e3) => {
1317
+ n2[t3] = (n2[t3] || []).concat([e3]);
1203
1318
  };
1319
+ if (0 === e2.length)
1320
+ return { matched: true };
1321
+ var i2;
1322
+ if (1 === e2.length)
1323
+ throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i2 = e2[0]) ? void 0 : i2.toString()}`);
1324
+ const [o2, c2] = e2;
1325
+ return { matched: g(t2, (t3, e3) => {
1326
+ const n3 = s(o2, e3, r2), i3 = s(c2, t3, r2);
1327
+ return n3 && i3;
1328
+ }), selections: n2 };
1329
+ }, getSelectionKeys: () => 0 === e2.length ? [] : [...o(e2[0]), ...o(e2[1])] }) });
1330
+ }, intersection: m, union: y, not: function(e2) {
1331
+ return u({ [t]: () => ({ match: (t2) => ({ matched: !s(e2, t2, () => {
1332
+ }) }), getSelectionKeys: () => [], matcherType: "not" }) });
1333
+ }, when: d, select: p, any: S, _: O, string: E, number: A, bigint: P, boolean: T, symbol: k, nullish: B, instanceOf: function(t2) {
1334
+ return u(d(/* @__PURE__ */ function(t3) {
1335
+ return (e2) => e2 instanceof t3;
1336
+ }(t2)));
1337
+ }, shape: function(t2) {
1338
+ return u(d(a(t2)));
1339
+ } };
1340
+ var W = { matched: false, value: void 0 };
1341
+ function N(t2) {
1342
+ return new $(t2, W);
1204
1343
  }
1205
-
1206
- const isCreateElement = isFromPragma("createElement");
1207
- const isCreateElementCall = (node, context)=>{
1208
- if (!isOneOf([
1209
- NodeType.Identifier,
1210
- NodeType.MemberExpression
1211
- ])(node.callee)) return false;
1212
- return isCreateElement(node.callee, context);
1213
- };
1214
- const isCloneElement = isFromPragma("cloneElement");
1215
- const isCloneElementCall = (node, context)=>{
1216
- if (!isOneOf([
1217
- NodeType.Identifier,
1218
- NodeType.MemberExpression
1219
- ])(node.callee)) return false;
1220
- return isCloneElement(node.callee, context);
1344
+ var $ = class _$ {
1345
+ constructor(t2, e2) {
1346
+ this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
1347
+ }
1348
+ with(...t2) {
1349
+ if (this.state.matched)
1350
+ return this;
1351
+ const e2 = t2[t2.length - 1], r2 = [t2[0]];
1352
+ let i2;
1353
+ 3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
1354
+ let o2 = false, c2 = {};
1355
+ const a2 = (t3, e3) => {
1356
+ o2 = true, c2[t3] = e3;
1357
+ }, u2 = !r2.some((t3) => s(t3, this.input, a2)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
1358
+ return new _$(this.input, u2);
1359
+ }
1360
+ when(t2, e2) {
1361
+ if (this.state.matched)
1362
+ return this;
1363
+ const n2 = Boolean(t2(this.input));
1364
+ return new _$(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
1365
+ }
1366
+ otherwise(t2) {
1367
+ return this.state.matched ? this.state.value : t2(this.input);
1368
+ }
1369
+ exhaustive() {
1370
+ if (this.state.matched)
1371
+ return this.state.value;
1372
+ let t2;
1373
+ try {
1374
+ t2 = JSON.stringify(this.input);
1375
+ } catch (e2) {
1376
+ t2 = this.input;
1377
+ }
1378
+ throw new Error(`Pattern matching error: no pattern matches value ${t2}`);
1379
+ }
1380
+ run() {
1381
+ return this.exhaustive();
1382
+ }
1383
+ returnType() {
1384
+ return this;
1385
+ }
1221
1386
  };
1222
1387
 
1223
- function resolveMemberExpressions(object, property) {
1224
- if (object.type === AST_NODE_TYPES.JSXMemberExpression) {
1225
- return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
1226
- }
1227
- if (object.type === AST_NODE_TYPES.JSXNamespacedName) {
1228
- return `${object.namespace.name}:${object.name.name}.${property.name}`;
1229
- }
1230
- return `${object.name}.${property.name}`;
1388
+ // src/pragma/is-from-pragma.ts
1389
+ function isInitializedFromPragma(variableName, context, initialScope, pragma = getPragmaFromContext(context)) {
1390
+ const maybeVariable = findVariable(variableName, initialScope);
1391
+ const maybeLatestDef = Option_exports.flatMapNullable(maybeVariable, (variable) => variable.defs.at(-1));
1392
+ if (Option_exports.isNone(maybeLatestDef))
1393
+ return false;
1394
+ const latestDef = maybeLatestDef.value;
1395
+ const { node, parent } = latestDef;
1396
+ if (node.type === NodeType.VariableDeclarator && node.init) {
1397
+ const { init } = node;
1398
+ if (a({ type: "MemberExpression", object: { type: "Identifier", name: pragma } }, init))
1399
+ return true;
1400
+ if (a({ type: "Identifier", name: pragma }, init))
1401
+ return true;
1402
+ const maybeRequireExpression = N(init).with({
1403
+ type: NodeType.CallExpression,
1404
+ callee: { type: NodeType.Identifier, name: "require" }
1405
+ }, (exp) => Option_exports.some(exp)).with(
1406
+ {
1407
+ type: NodeType.MemberExpression,
1408
+ object: {
1409
+ type: NodeType.CallExpression,
1410
+ callee: { type: NodeType.Identifier, name: "require" }
1411
+ }
1412
+ },
1413
+ ({ object }) => Option_exports.some(object)
1414
+ ).otherwise(Option_exports.none);
1415
+ if (Option_exports.isNone(maybeRequireExpression))
1416
+ return false;
1417
+ const requireExpression = maybeRequireExpression.value;
1418
+ const [firstArg] = requireExpression.arguments;
1419
+ if (firstArg?.type !== NodeType.Literal)
1420
+ return false;
1421
+ return firstArg.value === pragma.toLowerCase();
1422
+ }
1423
+ return a({ type: "ImportDeclaration", source: { value: pragma.toLowerCase() } }, parent);
1231
1424
  }
1232
- /**
1233
- * Returns the tag name associated with a JSXOpeningElement.
1234
- * @param node The visited JSXOpeningElement node object.
1235
- * @returns The element's tag name.
1236
- */ function elementType(node) {
1237
- if (node.type === AST_NODE_TYPES.JSXOpeningFragment) {
1238
- return "<>";
1425
+ function isPropertyOfPragma(name, context, pragma = getPragmaFromContext(context)) {
1426
+ const isMatch = a({
1427
+ type: NodeType.MemberExpression,
1428
+ object: {
1429
+ type: NodeType.Identifier,
1430
+ name: pragma
1431
+ },
1432
+ property: {
1433
+ name
1239
1434
  }
1240
- const { name } = node;
1241
- if (name.type === AST_NODE_TYPES.JSXMemberExpression) {
1242
- const { object, property } = name;
1243
- return resolveMemberExpressions(object, property);
1435
+ });
1436
+ return isMatch;
1437
+ }
1438
+ function isFromPragma(name) {
1439
+ return (node, context) => {
1440
+ const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1441
+ if (node.type === NodeType.MemberExpression)
1442
+ return isPropertyOfPragma(name, context)(node);
1443
+ if (node.name === name)
1444
+ return isInitializedFromPragma(name, context, initialScope);
1445
+ return false;
1446
+ };
1447
+ }
1448
+ function isFromPragmaMember(pragmaMemberName, name) {
1449
+ return (node, context, pragma = getPragmaFromContext(context)) => {
1450
+ const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1451
+ if (node.property.type !== NodeType.Identifier || node.property.name !== name)
1452
+ return false;
1453
+ if (node.object.type === NodeType.Identifier && node.object.name === pragmaMemberName) {
1454
+ return isInitializedFromPragma(node.object.name, context, initialScope, pragma);
1244
1455
  }
1245
- if (name.type === AST_NODE_TYPES.JSXNamespacedName) {
1246
- return `${name.namespace.name}:${name.name.name}`;
1456
+ if (node.object.type === NodeType.MemberExpression && node.object.object.type === NodeType.Identifier && node.object.object.name === pragma && node.object.property.type === NodeType.Identifier) {
1457
+ return node.object.property.name === pragmaMemberName;
1247
1458
  }
1248
- return name.name;
1459
+ return false;
1460
+ };
1461
+ }
1462
+ function isCallFromPragma(name) {
1463
+ return (node, context) => {
1464
+ if (!isOneOf([NodeType.Identifier, NodeType.MemberExpression])(node.callee))
1465
+ return false;
1466
+ return isFromPragma(name)(node.callee, context);
1467
+ };
1468
+ }
1469
+ function isCallFromPragmaMember(pragmaMemberName, name) {
1470
+ return (node, context) => {
1471
+ if (!is(NodeType.MemberExpression)(node.callee))
1472
+ return false;
1473
+ return isFromPragmaMember(pragmaMemberName, name)(node.callee, context);
1474
+ };
1249
1475
  }
1250
1476
 
1251
- /**
1252
- * Determines whether inside createElement's props.
1253
- * @param node The AST node to check
1254
- * @param context The rule context
1255
- * @returns `true` if the node is inside createElement's props
1256
- */ function isInsideCreateElementProps(node, context) {
1257
- return pipe(traverseUp(node, (n)=>is(NodeType.CallExpression)(n) && isCreateElementCall(n, context)), filter(is(NodeType.CallExpression)), flatMapNullable((c)=>c.arguments.at(1)), filter(is(NodeType.ObjectExpression)), zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a, b)=>a === b), getOrElse(constFalse));
1477
+ // src/element/api.ts
1478
+ var isCreateElement = isFromPragma("createElement");
1479
+ var isCreateElementCall = (node, context) => {
1480
+ if (!isOneOf([NodeType.Identifier, NodeType.MemberExpression])(node.callee))
1481
+ return false;
1482
+ return isCreateElement(node.callee, context);
1483
+ };
1484
+ var isCloneElement = isFromPragma("cloneElement");
1485
+ var isCloneElementCall = (node, context) => {
1486
+ if (!isOneOf([NodeType.Identifier, NodeType.MemberExpression])(node.callee))
1487
+ return false;
1488
+ return isCloneElement(node.callee, context);
1489
+ };
1490
+ function resolveMemberExpressions(object, property) {
1491
+ if (object.type === AST_NODE_TYPES.JSXMemberExpression) {
1492
+ return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
1493
+ }
1494
+ if (object.type === AST_NODE_TYPES.JSXNamespacedName) {
1495
+ return `${object.namespace.name}:${object.name.name}.${property.name}`;
1496
+ }
1497
+ return `${object.name}.${property.name}`;
1498
+ }
1499
+ function elementType(node) {
1500
+ if (node.type === AST_NODE_TYPES.JSXOpeningFragment) {
1501
+ return "<>";
1502
+ }
1503
+ const { name } = node;
1504
+ if (name.type === AST_NODE_TYPES.JSXMemberExpression) {
1505
+ const { object, property } = name;
1506
+ return resolveMemberExpressions(object, property);
1507
+ }
1508
+ if (name.type === AST_NODE_TYPES.JSXNamespacedName) {
1509
+ return `${name.namespace.name}:${name.name.name}`;
1510
+ }
1511
+ return name.name;
1512
+ }
1513
+ function isInsideCreateElementProps(node, context) {
1514
+ return Function_exports.pipe(
1515
+ traverseUp(node, (n2) => is(NodeType.CallExpression)(n2) && isCreateElementCall(n2, context)),
1516
+ Option_exports.filter(is(NodeType.CallExpression)),
1517
+ Option_exports.flatMapNullable((c2) => c2.arguments.at(1)),
1518
+ Option_exports.filter(is(NodeType.ObjectExpression)),
1519
+ Option_exports.zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a2, b2) => a2 === b2),
1520
+ Option_exports.getOrElse(Function_exports.constFalse)
1521
+ );
1258
1522
  }
1259
1523
  function isChildrenOfCreateElement(node, context) {
1260
- return pipe(fromNullable(node.parent), filter(is(NodeType.CallExpression)), filter((n)=>isCreateElementCall(n, context)), exists((n)=>n.arguments.slice(2).some((arg)=>arg === node)));
1524
+ return Function_exports.pipe(
1525
+ Option_exports.fromNullable(node.parent),
1526
+ Option_exports.filter(is(NodeType.CallExpression)),
1527
+ Option_exports.filter((n2) => isCreateElementCall(n2, context)),
1528
+ Option_exports.exists(
1529
+ (n2) => n2.arguments.slice(2).some((arg) => arg === node)
1530
+ )
1531
+ );
1261
1532
  }
1262
- /**
1263
- * Check if a `JSXElement` or `JSXFragment` has children
1264
- * @param node The AST node to check
1265
- * @param predicate A predicate to filter the children
1266
- * @returns `true` if the node has children
1267
- */ function hasChildren(node, predicate) {
1268
- if (isFunction(predicate)) return node.children.some(predicate);
1269
- return node.children.length > 0;
1533
+ function hasChildren(node, predicate) {
1534
+ if (Predicate_exports.isFunction(predicate))
1535
+ return node.children.some(predicate);
1536
+ return node.children.length > 0;
1270
1537
  }
1271
- /**
1272
- * Check if a node is a child of a `JSXElement`
1273
- * @param node The AST node to check
1274
- * @returns `true` if the node is a child of a `JSXElement`
1275
- */ function isChildOfJSXElement(node) {
1276
- return node.parent?.type === NodeType.JSXElement && node.parent.children.some((child)=>child === node);
1538
+ function isChildOfJSXElement(node) {
1539
+ return node.parent?.type === NodeType.JSXElement && node.parent.children.some((child) => child === node);
1277
1540
  }
1278
-
1279
- /**
1280
- * Check if a node is a `JSXElement` of `User-Defined Component` type
1281
- * @param node The AST node to check
1282
- * @returns `true` if the node is a `JSXElement` of `User-Defined Component` type
1283
- */ function isJSXElementOfUserDefinedComponent(node) {
1284
- return node.openingElement.name.type === NodeType.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
1541
+ function isJSXElementOfUserDefinedComponent(node) {
1542
+ return node.openingElement.name.type === NodeType.JSXIdentifier && /^[A-Z]/u.test(node.openingElement.name.name);
1285
1543
  }
1286
- /**
1287
- * Check if a node is a `JSXFragment` of `Built-in Component` type
1288
- * @param node The AST node to check
1289
- * @returns `true` if the node is a `JSXFragment` of `Built-in Component` type
1290
- */ function isJSXElementOfBuiltinComponent(node) {
1291
- return node.openingElement.name.type === NodeType.JSXIdentifier && node.openingElement.name.name.toLowerCase() === node.openingElement.name.name && /^[a-z]/u.test(node.openingElement.name.name);
1544
+ function isJSXElementOfBuiltinComponent(node) {
1545
+ return node.openingElement.name.type === NodeType.JSXIdentifier && node.openingElement.name.name.toLowerCase() === node.openingElement.name.name && /^[a-z]/u.test(node.openingElement.name.name);
1292
1546
  }
1293
-
1294
- const isFragment = (node, pragma, fragment)=>{
1295
- if (!isOneOf([
1296
- NodeType.JSXElement,
1297
- NodeType.JSXFragment
1298
- ])(node)) return false;
1299
- return isFragmentSyntax(node) || isFragmentElement(node, pragma, fragment);
1547
+ var isFragment = (node, pragma, fragment) => {
1548
+ if (!isOneOf([NodeType.JSXElement, NodeType.JSXFragment])(node))
1549
+ return false;
1550
+ return isFragmentSyntax(node) || isFragmentElement(node, pragma, fragment);
1300
1551
  };
1301
- /**
1302
- * Check if a node is `<></>`
1303
- */ const isFragmentSyntax = is(NodeType.JSXFragment);
1304
- /**
1305
- * Check if a node is `<Fragment></Fragment>` or `<Pragma.Fragment></Pragma.Fragment>`
1306
- * @param node
1307
- * @param pragma
1308
- * @param fragment
1309
- */ function isFragmentElement(node, pragma, fragment) {
1310
- const { name } = node.openingElement;
1311
- // <Fragment>
1312
- if (name.type === NodeType.JSXIdentifier && name.name === fragment) return true;
1313
- // <Pragma.Fragment>
1314
- return name.type === NodeType.JSXMemberExpression && name.object.type === NodeType.JSXIdentifier && name.object.name === pragma && name.property.name === fragment;
1552
+ var isFragmentSyntax = is(NodeType.JSXFragment);
1553
+ function isFragmentElement(node, pragma, fragment) {
1554
+ const { name } = node.openingElement;
1555
+ if (name.type === NodeType.JSXIdentifier && name.name === fragment)
1556
+ return true;
1557
+ return name.type === NodeType.JSXMemberExpression && name.object.type === NodeType.JSXIdentifier && name.object.name === pragma && name.property.name === fragment;
1315
1558
  }
1316
-
1317
- // type ReactNode =
1318
- // | ReactElement
1319
- // | string
1320
- // | number
1321
- // | Iterable<ReactNode>
1322
- // | ReactPortal
1323
- // | boolean
1324
- // | null
1325
- // | undefined
1326
- // | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[
1327
- // keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES
1328
- // ];
1329
- /* eslint-disable perfectionist/sort-objects */ const JSXValueHint = {
1330
- None: 0n,
1331
- SkipNullLiteral: 1n << 0n,
1332
- SkipUndefinedLiteral: 1n << 1n,
1333
- SkipBooleanLiteral: 1n << 2n,
1334
- SkipStringLiteral: 1n << 3n,
1335
- SkipNumberLiteral: 1n << 4n,
1336
- SkipCreateElement: 1n << 5n,
1337
- StrictArray: 1n << 6n,
1338
- StrictLogical: 1n << 7n,
1339
- StrictConditional: 1n << 8n
1559
+ var JSXValueHint = {
1560
+ None: 0n,
1561
+ SkipNullLiteral: 1n << 0n,
1562
+ SkipUndefinedLiteral: 1n << 1n,
1563
+ SkipBooleanLiteral: 1n << 2n,
1564
+ SkipStringLiteral: 1n << 3n,
1565
+ SkipNumberLiteral: 1n << 4n,
1566
+ SkipCreateElement: 1n << 5n,
1567
+ StrictArray: 1n << 6n,
1568
+ StrictLogical: 1n << 7n,
1569
+ StrictConditional: 1n << 8n
1340
1570
  };
1341
- /* eslint-enable perfectionist/sort-objects */ const DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
1342
- /**
1343
- * Check if a node is a JSX value
1344
- * @param node The AST node to check
1345
- * @param context The rule context
1346
- * @param hint The `JSXValueHint` to use
1347
- * @returns boolean
1348
- */ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
1349
- if (!node) return false;
1350
- return N(node).with({
1351
- type: NodeType.JSXElement
1352
- }, constTrue).with({
1353
- type: NodeType.JSXFragment
1354
- }, constTrue).with({
1355
- type: NodeType.JSXMemberExpression
1356
- }, constTrue).with({
1357
- type: NodeType.JSXNamespacedName
1358
- }, constTrue).with({
1359
- type: NodeType.Literal
1360
- }, (node)=>{
1361
- 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);
1362
- }).with({
1363
- type: NodeType.TemplateLiteral
1364
- }, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with({
1365
- type: NodeType.ArrayExpression
1366
- }, (node)=>{
1367
- if (hint & JSXValueHint.StrictArray) return node.elements.every((n)=>isJSXValue(n, context, hint));
1368
- return node.elements.some((n)=>isJSXValue(n, context, hint));
1369
- }).with({
1370
- type: NodeType.ConditionalExpression
1371
- }, (node)=>{
1372
- function leftHasJSX(node) {
1373
- if (Array.isArray(node.consequent)) {
1374
- if (hint & JSXValueHint.StrictArray) {
1375
- return node.consequent.every((n)=>isJSXValue(n, context, hint));
1376
- }
1377
- return node.consequent.some((n)=>isJSXValue(n, context, hint));
1378
- }
1379
- return isJSXValue(node.consequent, context, hint);
1380
- }
1381
- function rightHasJSX(node) {
1382
- return isJSXValue(node.alternate, context, hint);
1383
- }
1384
- if (hint & JSXValueHint.StrictConditional) {
1385
- return leftHasJSX(node) && rightHasJSX(node);
1571
+ var DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
1572
+ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
1573
+ if (!node)
1574
+ return false;
1575
+ return N(node).with({ type: NodeType.JSXElement }, Function_exports.constTrue).with({ type: NodeType.JSXFragment }, Function_exports.constTrue).with({ type: NodeType.JSXMemberExpression }, Function_exports.constTrue).with({ type: NodeType.JSXNamespacedName }, Function_exports.constTrue).with({ type: NodeType.Literal }, (node2) => {
1576
+ return N(node2.value).with(null, () => !(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, () => !(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, () => !(hint & JSXValueHint.SkipStringLiteral)).with(_.number, () => !(hint & JSXValueHint.SkipNumberLiteral)).otherwise(Function_exports.constFalse);
1577
+ }).with({ type: NodeType.TemplateLiteral }, () => !(hint & JSXValueHint.SkipStringLiteral)).with({ type: NodeType.ArrayExpression }, (node2) => {
1578
+ if (hint & JSXValueHint.StrictArray)
1579
+ return node2.elements.every((n2) => isJSXValue(n2, context, hint));
1580
+ return node2.elements.some((n2) => isJSXValue(n2, context, hint));
1581
+ }).with({ type: NodeType.ConditionalExpression }, (node2) => {
1582
+ function leftHasJSX(node3) {
1583
+ if (Array.isArray(node3.consequent)) {
1584
+ if (hint & JSXValueHint.StrictArray) {
1585
+ return node3.consequent.every((n2) => isJSXValue(n2, context, hint));
1386
1586
  }
1387
- return leftHasJSX(node) || rightHasJSX(node);
1388
- }).with({
1389
- type: NodeType.LogicalExpression
1390
- }, (node)=>{
1391
- return isJSXValue(node.left, context, hint) || isJSXValue(node.right, context, hint);
1392
- }).with({
1393
- type: NodeType.SequenceExpression
1394
- }, (node)=>{
1395
- const exp = node.expressions.at(-1);
1396
- return isJSXValue(exp, context, hint);
1397
- }).with({
1398
- type: NodeType.CallExpression
1399
- }, (node)=>{
1400
- if (hint & JSXValueHint.SkipCreateElement) return false;
1401
- return isCreateElementCall(node, context);
1402
- }).with({
1403
- type: NodeType.Identifier
1404
- }, (node)=>{
1405
- const { name } = node;
1406
- if (name === "undefined") return !(hint & JSXValueHint.SkipUndefinedLiteral);
1407
- if (isJSXTagNameExpression(node)) return true;
1408
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1409
- const maybeVariable = findVariable(name, initialScope);
1410
- return pipe(maybeVariable, flatMap(getVariableInit(0)), exists((n)=>isJSXValue(n, context, hint)));
1411
- }).otherwise(constFalse);
1412
- }
1413
-
1414
- /**
1415
- * Check if function is returning JSX
1416
- * @param node The return statement node to check
1417
- * @param context The rule context
1418
- * @param hint The `JSXValueHint` to use
1419
- * @returns boolean
1420
- */ function isFunctionReturningJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
1421
- if (node.body.type !== NodeType.BlockStatement) {
1422
- return isJSXValue(node.body, context, hint);
1587
+ return node3.consequent.some((n2) => isJSXValue(n2, context, hint));
1588
+ }
1589
+ return isJSXValue(node3.consequent, context, hint);
1590
+ }
1591
+ function rightHasJSX(node3) {
1592
+ return isJSXValue(node3.alternate, context, hint);
1423
1593
  }
1424
- const statements = getNestedReturnStatements(node.body);
1425
- return statements.some((statement)=>isJSXValue(statement.argument, context, hint));
1594
+ if (hint & JSXValueHint.StrictConditional) {
1595
+ return leftHasJSX(node2) && rightHasJSX(node2);
1596
+ }
1597
+ return leftHasJSX(node2) || rightHasJSX(node2);
1598
+ }).with({ type: NodeType.LogicalExpression }, (node2) => {
1599
+ return isJSXValue(node2.left, context, hint) || isJSXValue(node2.right, context, hint);
1600
+ }).with({ type: NodeType.SequenceExpression }, (node2) => {
1601
+ const exp = node2.expressions.at(-1);
1602
+ return isJSXValue(exp, context, hint);
1603
+ }).with({ type: NodeType.CallExpression }, (node2) => {
1604
+ if (hint & JSXValueHint.SkipCreateElement)
1605
+ return false;
1606
+ return isCreateElementCall(node2, context);
1607
+ }).with({ type: NodeType.Identifier }, (node2) => {
1608
+ const { name } = node2;
1609
+ if (name === "undefined")
1610
+ return !(hint & JSXValueHint.SkipUndefinedLiteral);
1611
+ if (isJSXTagNameExpression(node2))
1612
+ return true;
1613
+ const initialScope = context.sourceCode.getScope?.(node2) ?? context.getScope();
1614
+ const maybeVariable = findVariable(name, initialScope);
1615
+ return Function_exports.pipe(
1616
+ maybeVariable,
1617
+ Option_exports.flatMap(getVariableInit(0)),
1618
+ Option_exports.exists((n2) => isJSXValue(n2, context, hint))
1619
+ );
1620
+ }).otherwise(Function_exports.constFalse);
1426
1621
  }
1427
1622
 
1428
- const { getStaticValue } = ESLintCommunityESLintUtils;
1429
- /**
1430
- * Get the name of a JSX attribute with namespace
1431
- * @param node The JSX attribute node
1432
- * @returns string
1433
- */ function getPropName(node) {
1434
- return N(node.name).when(is(NodeType.JSXIdentifier), (n)=>n.name).when(is(NodeType.JSXNamespacedName), (n)=>`${n.namespace.name}:${n.name.name}`).exhaustive();
1623
+ // src/misc.ts
1624
+ function isFunctionReturningJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
1625
+ if (node.body.type !== NodeType.BlockStatement) {
1626
+ return isJSXValue(node.body, context, hint);
1627
+ }
1628
+ const statements = getNestedReturnStatements(node.body);
1629
+ return statements.some((statement) => isJSXValue(statement.argument, context, hint));
1630
+ }
1631
+ var { getStaticValue } = ESLintCommunityESLintUtils;
1632
+ function getPropName(node) {
1633
+ return N(node.name).when(is(NodeType.JSXIdentifier), (n2) => n2.name).when(is(NodeType.JSXNamespacedName), (n2) => `${n2.namespace.name}:${n2.name.name}`).exhaustive();
1435
1634
  }
1436
1635
  function getProp(props, propName, context, initialScope) {
1437
- return findPropInAttributes(props, context, initialScope)(propName);
1636
+ return findPropInAttributes(props, context, initialScope)(propName);
1438
1637
  }
1439
- /**
1440
- * Gets and resolves the static value of a JSX attribute
1441
- * @param attribute The JSX attribute to get the value of
1442
- * @param context The rule context
1443
- * @returns The static value of the given JSX attribute
1444
- */ function getPropValue(attribute, context) {
1445
- const initialScope = context.sourceCode.getScope?.(attribute) ?? context.getScope();
1446
- if (attribute.type === NodeType.JSXAttribute && "value" in attribute) {
1447
- const { value } = attribute;
1448
- if (value === null) return none();
1449
- if (value.type === NodeType.Literal) return some(getStaticValue(value, initialScope));
1450
- if (value.type === NodeType.JSXExpressionContainer) return some(getStaticValue(value.expression, initialScope));
1451
- return none();
1452
- }
1453
- const { argument } = attribute;
1454
- return some(getStaticValue(argument, initialScope));
1638
+ function getPropValue(attribute, context) {
1639
+ const initialScope = context.sourceCode.getScope?.(attribute) ?? context.getScope();
1640
+ if (attribute.type === NodeType.JSXAttribute && "value" in attribute) {
1641
+ const { value } = attribute;
1642
+ if (value === null)
1643
+ return Option_exports.none();
1644
+ if (value.type === NodeType.Literal)
1645
+ return Option_exports.some(getStaticValue(value, initialScope));
1646
+ if (value.type === NodeType.JSXExpressionContainer)
1647
+ return Option_exports.some(getStaticValue(value.expression, initialScope));
1648
+ return Option_exports.none();
1649
+ }
1650
+ const { argument } = attribute;
1651
+ return Option_exports.some(getStaticValue(argument, initialScope));
1455
1652
  }
1456
- /**
1457
- * @param properties The properties to search in
1458
- * @param context The rule context
1459
- * @param initialScope
1460
- * @param seenProps The properties that have already been seen
1461
- * @returns A function that searches for a property in the given properties
1462
- */ function findPropInProperties(properties, context, initialScope, seenProps = []) {
1463
- /**
1464
- * Search for a property in the given properties
1465
- * @param propName The name of the property to search for
1466
- * @returns The property if found
1467
- */ return (propName)=>{
1468
- return fromNullable(properties.find((prop)=>{
1469
- return N(prop).when(is(NodeType.Property), (prop)=>{
1470
- return "name" in prop.key && prop.key.name === propName;
1471
- }).when(is(NodeType.SpreadElement), (prop)=>{
1472
- return N(prop.argument).when(is(NodeType.Identifier), (argument)=>{
1473
- const { name } = argument;
1474
- const maybeInit = flatMap(findVariable(name, initialScope), getVariableInit(0));
1475
- if (isNone(maybeInit)) return false;
1476
- const init = maybeInit.value;
1477
- if (init.type !== NodeType.ObjectExpression) return false;
1478
- if (seenProps.includes(name)) return false;
1479
- return isSome(findPropInProperties(init.properties, context, initialScope, [
1480
- ...seenProps,
1481
- name
1482
- ])(propName));
1483
- }).when(is(NodeType.ObjectExpression), (argument)=>{
1484
- return isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
1485
- }).when(is(NodeType.MemberExpression), ()=>{
1486
- // Not implemented
1487
- }).when(is(NodeType.CallExpression), ()=>{
1488
- // Not implemented
1489
- }).otherwise(constFalse);
1490
- }).when(is(NodeType.RestElement), ()=>{
1491
- // Not implemented
1492
- return false;
1493
- }).otherwise(constFalse);
1494
- }));
1495
- };
1653
+ function findPropInProperties(properties, context, initialScope, seenProps = []) {
1654
+ return (propName) => {
1655
+ return Option_exports.fromNullable(
1656
+ properties.find((prop) => {
1657
+ return N(prop).when(is(NodeType.Property), (prop2) => {
1658
+ return "name" in prop2.key && prop2.key.name === propName;
1659
+ }).when(is(NodeType.SpreadElement), (prop2) => {
1660
+ return N(prop2.argument).when(is(NodeType.Identifier), (argument) => {
1661
+ const { name } = argument;
1662
+ const maybeInit = Option_exports.flatMap(
1663
+ findVariable(name, initialScope),
1664
+ getVariableInit(0)
1665
+ );
1666
+ if (Option_exports.isNone(maybeInit))
1667
+ return false;
1668
+ const init = maybeInit.value;
1669
+ if (init.type !== NodeType.ObjectExpression)
1670
+ return false;
1671
+ if (seenProps.includes(name))
1672
+ return false;
1673
+ return Option_exports.isSome(
1674
+ findPropInProperties(init.properties, context, initialScope, [...seenProps, name])(propName)
1675
+ );
1676
+ }).when(is(NodeType.ObjectExpression), (argument) => {
1677
+ return Option_exports.isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
1678
+ }).when(is(NodeType.MemberExpression), () => {
1679
+ }).when(is(NodeType.CallExpression), () => {
1680
+ }).otherwise(Function_exports.constFalse);
1681
+ }).when(is(NodeType.RestElement), () => {
1682
+ return false;
1683
+ }).otherwise(Function_exports.constFalse);
1684
+ })
1685
+ );
1686
+ };
1496
1687
  }
1497
- /**
1498
- * @param attributes The attributes to search in
1499
- * @param context The rule context
1500
- * @param initialScope
1501
- * @returns A function that searches for a property in the given attributes
1502
- */ function findPropInAttributes(attributes, context, initialScope) {
1503
- /**
1504
- * Search for a property in the given attributes
1505
- * @param propName The name of the property to search for
1506
- * @returns The property if found
1507
- */ return (propName)=>{
1508
- return fromNullable(attributes.find((attr)=>{
1509
- return N(attr).when(is(NodeType.JSXAttribute), (attr)=>getPropName(attr) === propName).when(is(NodeType.JSXSpreadAttribute), (attr)=>{
1510
- return N(attr.argument).with({
1511
- type: NodeType.Identifier
1512
- }, (argument)=>{
1513
- const { name } = argument;
1514
- const maybeInit = flatMap(findVariable(name, initialScope), getVariableInit(0));
1515
- if (isNone(maybeInit)) return false;
1516
- const init = maybeInit.value;
1517
- if (!("properties" in init)) return false;
1518
- return isSome(findPropInProperties(init.properties, context, initialScope)(propName));
1519
- }).when(is(NodeType.ObjectExpression), (argument)=>{
1520
- return isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
1521
- }).when(is(NodeType.MemberExpression), ()=>{
1522
- // Not implemented
1523
- return false;
1524
- }).when(is(NodeType.CallExpression), ()=>{
1525
- // Not implemented
1526
- return false;
1527
- }).otherwise(constFalse);
1528
- }).otherwise(constFalse);
1529
- }));
1530
- };
1688
+ function findPropInAttributes(attributes, context, initialScope) {
1689
+ return (propName) => {
1690
+ return Option_exports.fromNullable(
1691
+ attributes.find((attr) => {
1692
+ return N(attr).when(is(NodeType.JSXAttribute), (attr2) => getPropName(attr2) === propName).when(is(NodeType.JSXSpreadAttribute), (attr2) => {
1693
+ return N(attr2.argument).with({ type: NodeType.Identifier }, (argument) => {
1694
+ const { name } = argument;
1695
+ const maybeInit = Option_exports.flatMap(
1696
+ findVariable(name, initialScope),
1697
+ getVariableInit(0)
1698
+ );
1699
+ if (Option_exports.isNone(maybeInit))
1700
+ return false;
1701
+ const init = maybeInit.value;
1702
+ if (!("properties" in init))
1703
+ return false;
1704
+ return Option_exports.isSome(findPropInProperties(init.properties, context, initialScope)(propName));
1705
+ }).when(is(NodeType.ObjectExpression), (argument) => {
1706
+ return Option_exports.isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
1707
+ }).when(is(NodeType.MemberExpression), () => {
1708
+ return false;
1709
+ }).when(is(NodeType.CallExpression), () => {
1710
+ return false;
1711
+ }).otherwise(Function_exports.constFalse);
1712
+ }).otherwise(Function_exports.constFalse);
1713
+ })
1714
+ );
1715
+ };
1531
1716
  }
1532
1717
 
1533
- /**
1534
- * Check if the given prop name is present in the given attributes
1535
- * @param attributes The attributes to search in
1536
- * @param propName The prop name to search for
1537
- * @param context The rule context
1538
- * @param initialScope
1539
- * @returns `true` if the given prop name is present in the given properties
1540
- */ function hasProp(attributes, propName, context, initialScope) {
1541
- return isSome(findPropInAttributes(attributes, context, initialScope)(propName));
1718
+ // src/prop/has-prop.ts
1719
+ function hasProp(attributes, propName, context, initialScope) {
1720
+ return Option_exports.isSome(findPropInAttributes(attributes, context, initialScope)(propName));
1542
1721
  }
1543
- /**
1544
- * Check if any of the given prop names are present in the given attributes
1545
- * @param attributes The attributes to search in
1546
- * @param propNames The prop names to search for
1547
- * @param context The rule context
1548
- * @param initialScope
1549
- * @returns `true` if any of the given prop names are present in the given attributes
1550
- */ function hasAnyProp(attributes, propNames, context, initialScope) {
1551
- return propNames.some((propName)=>hasProp(attributes, propName, context, initialScope));
1722
+ function hasAnyProp(attributes, propNames, context, initialScope) {
1723
+ return propNames.some((propName) => hasProp(attributes, propName, context, initialScope));
1552
1724
  }
1553
- /**
1554
- * Check if all of the given prop names are present in the given attributes
1555
- * @param attributes The attributes to search in
1556
- * @param propNames The prop names to search for
1557
- * @param context The rule context
1558
- * @param initialScope
1559
- * @returns `true` if all of the given prop names are present in the given attributes
1560
- */ function hasEveryProp(attributes, propNames, context, initialScope) {
1561
- return propNames.every((propName)=>hasProp(attributes, propName, context, initialScope));
1725
+ function hasEveryProp(attributes, propNames, context, initialScope) {
1726
+ return propNames.every((propName) => hasProp(attributes, propName, context, initialScope));
1562
1727
  }
1563
-
1564
- /**
1565
- * Traverses up prop node
1566
- * @param node The AST node to start traversing from
1567
- * @param predicate The predicate to check each node
1568
- * @returns prop node if found
1569
- */ function traverseUpProp(node, predicate = constTrue) {
1570
- const guard = (node)=>{
1571
- return node.type === NodeType.JSXAttribute && predicate(node);
1572
- };
1573
- return traverseUpGuard(node, guard);
1728
+ function traverseUpProp(node, predicate = Function_exports.constTrue) {
1729
+ const guard = (node2) => {
1730
+ return node2.type === NodeType.JSXAttribute && predicate(node2);
1731
+ };
1732
+ return traverseUpGuard(node, guard);
1574
1733
  }
1575
1734
 
1576
- /**
1577
- * Checks if the node is inside a prop's value
1578
- * @param node The AST node to check
1579
- * @returns `true` if the node is inside a prop's value
1580
- */ function isInsidePropValue(node) {
1581
- if (isStringLiteral(node)) return node.parent.type === NodeType.JSXAttribute;
1582
- return isSome(traverseUpProp(node, (n)=>n.value?.type === NodeType.JSXExpressionContainer));
1735
+ // src/prop/misc.ts
1736
+ function isInsidePropValue(node) {
1737
+ if (isStringLiteral(node))
1738
+ return node.parent.type === NodeType.JSXAttribute;
1739
+ return Option_exports.isSome(traverseUpProp(node, (n2) => n2.value?.type === NodeType.JSXExpressionContainer));
1583
1740
  }
1584
-
1585
- /**
1586
- * Check if a node is a Literal or JSXText
1587
- * @param node The AST node to check
1588
- * @returns boolean `true` if the node is a Literal or JSXText
1589
- */ const isLiteral = isOneOf([
1590
- NodeType.Literal,
1591
- NodeType.JSXText
1592
- ]);
1593
- /**
1594
- * Check if a Literal or JSXText node is whitespace
1595
- * @param node The AST node to check
1596
- * @returns boolean `true` if the node is whitespace
1597
- */ function isWhiteSpace(node) {
1598
- return isString(node.value) && node.value.trim() === "";
1741
+ var isLiteral = isOneOf([NodeType.Literal, NodeType.JSXText]);
1742
+ function isWhiteSpace(node) {
1743
+ return Predicate_exports.isString(node.value) && node.value.trim() === "";
1599
1744
  }
1600
- /**
1601
- * Check if a Literal or JSXText node is a line break
1602
- * @param node The AST node to check
1603
- * @returns boolean
1604
- */ function isLineBreak(node) {
1605
- return isLiteral(node) && isWhiteSpace(node) && isMultiLine(node);
1745
+ function isLineBreak(node) {
1746
+ return isLiteral(node) && isWhiteSpace(node) && isMultiLine(node);
1606
1747
  }
1607
- /**
1608
- * Check if a Literal or JSXText node is padding spaces
1609
- * @param node The AST node to check
1610
- * @returns boolean
1611
- */ function isPaddingSpaces(node) {
1612
- return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
1748
+ function isPaddingSpaces(node) {
1749
+ return isLiteral(node) && isWhiteSpace(node) && node.raw.includes("\n");
1613
1750
  }
1614
1751
 
1615
1752
  export { DEFAULT_JSX_VALUE_HINT, JSXValueHint, elementType, findPropInAttributes, findPropInProperties, getFragmentFromContext, getPragmaFromContext, getProp, getPropName, getPropValue, hasAnyProp, hasChildren, hasEveryProp, hasProp, isCallFromPragma, isCallFromPragmaMember, isChildOfJSXElement, isChildrenOfCreateElement, isCloneElement, isCloneElementCall, isCreateElement, isCreateElementCall, isFragment, isFragmentElement, isFragmentSyntax, isFromPragma, isFromPragmaMember, isFunctionReturningJSXValue, isInitializedFromPragma, isInsideCreateElementProps, isInsidePropValue, isJSXElementOfBuiltinComponent, isJSXElementOfUserDefinedComponent, isJSXValue, isLineBreak, isLiteral, isPaddingSpaces, isPropertyOfPragma, isWhiteSpace, traverseUpProp };