eslint-plugin-react-hooks-extra 1.5.3 → 1.5.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,114 +1,91 @@
1
1
  import { useHookCollector, isReactHookCall, isUseCallbackCall, isReactHookCallWithNameLoose, isUseMemoCall, isUseStateCall } from '@eslint-react/core';
2
+ import 'string-ts';
2
3
  import { createRuleForPlugin, parseSchema, ESLintSettingsSchema } from '@eslint-react/shared';
3
4
  import { NodeType, is, getNestedCallExpressions } from '@eslint-react/ast';
4
5
  import { getPragmaFromContext } from '@eslint-react/jsx';
5
6
  import { findVariable, getVariableInit } from '@eslint-react/var';
6
7
 
7
- var name = "eslint-plugin-react-hooks-extra";
8
- var version = "1.5.3";
8
+ var __defProp = Object.defineProperty;
9
+ var __export = (target, all2) => {
10
+ for (var name2 in all2)
11
+ __defProp(target, name2, { get: all2[name2], enumerable: true });
12
+ };
9
13
 
10
- const createRule = createRuleForPlugin("hooks-extra");
14
+ // package.json
15
+ var name = "eslint-plugin-react-hooks-extra";
16
+ var version = "1.5.4-beta.0";
17
+ var createRule = createRuleForPlugin("hooks-extra");
11
18
 
12
- const RULE_NAME$3 = "ensure-custom-hooks-using-other-hooks";
13
- var ensureCustomHooksUsingOtherHooks = createRule({
14
- name: RULE_NAME$3,
15
- meta: {
16
- type: "problem",
17
- docs: {
18
- description: "enforce custom hooks using other hooks",
19
- requiresTypeChecking: false
20
- },
21
- schema: [],
22
- messages: {
23
- ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS: "Custom hooks {{name}} should use other hooks"
24
- }
19
+ // src/rules/ensure-custom-hooks-using-other-hooks.ts
20
+ var RULE_NAME = "ensure-custom-hooks-using-other-hooks";
21
+ var ensure_custom_hooks_using_other_hooks_default = createRule({
22
+ name: RULE_NAME,
23
+ meta: {
24
+ type: "problem",
25
+ docs: {
26
+ description: "enforce custom hooks using other hooks",
27
+ requiresTypeChecking: false
25
28
  },
26
- defaultOptions: [],
27
- create (context) {
28
- const { ctx, listeners } = useHookCollector();
29
- return {
30
- ...listeners,
31
- "Program:exit" (node) {
32
- const allHooks = ctx.getAllHooks(node);
33
- for (const { name, hookCalls, node } of allHooks.values()){
34
- if (hookCalls.length > 0) continue;
35
- context.report({
36
- data: {
37
- name: name.value
38
- },
39
- messageId: "ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS",
40
- node
41
- });
42
- }
43
- }
44
- };
29
+ schema: [],
30
+ messages: {
31
+ ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS: "Custom hooks {{name}} should use other hooks"
45
32
  }
33
+ },
34
+ defaultOptions: [],
35
+ create(context) {
36
+ const { ctx, listeners } = useHookCollector();
37
+ return {
38
+ ...listeners,
39
+ "Program:exit"(node) {
40
+ const allHooks = ctx.getAllHooks(node);
41
+ for (const { name: name2, hookCalls, node: node2 } of allHooks.values()) {
42
+ if (hookCalls.length > 0)
43
+ continue;
44
+ context.report({
45
+ data: {
46
+ name: name2.value
47
+ },
48
+ messageId: "ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS",
49
+ node: node2
50
+ });
51
+ }
52
+ }
53
+ };
54
+ }
46
55
  });
47
56
 
48
- /**
49
- * Tests if a value is a `function`.
50
- *
51
- * @param input - The value to test.
52
- *
53
- * @example
54
- * import { isFunction } from 'effect/Predicate'
55
- *
56
- * assert.deepStrictEqual(isFunction(isFunction), true)
57
- * assert.deepStrictEqual(isFunction("function"), false)
58
- *
59
- * @category guards
60
- * @since 2.0.0
61
- */
62
- const isFunction$1 = input => typeof input === "function";
63
- /**
64
- * Creates a function that can be used in a data-last (aka `pipe`able) or
65
- * data-first style.
66
- *
67
- * The first parameter to `dual` is either the arity of the uncurried function
68
- * or a predicate that determines if the function is being used in a data-first
69
- * or data-last style.
70
- *
71
- * Using the arity is the most common use case, but there are some cases where
72
- * you may want to use a predicate. For example, if you have a function that
73
- * takes an optional argument, you can use a predicate to determine if the
74
- * function is being used in a data-first or data-last style.
75
- *
76
- * @param arity - Either the arity of the uncurried function or a predicate
77
- * which determines if the function is being used in a data-first
78
- * or data-last style.
79
- * @param body - The definition of the uncurried function.
80
- *
81
- * @example
82
- * import { dual, pipe } from "effect/Function"
83
- *
84
- * // Exampe using arity to determine data-first or data-last style
85
- * const sum: {
86
- * (that: number): (self: number) => number
87
- * (self: number, that: number): number
88
- * } = dual(2, (self: number, that: number): number => self + that)
89
- *
90
- * assert.deepStrictEqual(sum(2, 3), 5)
91
- * assert.deepStrictEqual(pipe(2, sum(3)), 5)
92
- *
93
- * // Example using a predicate to determine data-first or data-last style
94
- * const sum2: {
95
- * (that: number): (self: number) => number
96
- * (self: number, that: number): number
97
- * } = dual((args) => args.length === 1, (self: number, that: number): number => self + that)
98
- *
99
- * assert.deepStrictEqual(sum(2, 3), 5)
100
- * assert.deepStrictEqual(pipe(2, sum(3)), 5)
101
- *
102
- * @since 2.0.0
103
- */
104
- const dual = function (arity, body) {
57
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Function.js
58
+ var Function_exports = {};
59
+ __export(Function_exports, {
60
+ SK: () => SK,
61
+ absurd: () => absurd,
62
+ apply: () => apply,
63
+ compose: () => compose,
64
+ constFalse: () => constFalse,
65
+ constNull: () => constNull,
66
+ constTrue: () => constTrue,
67
+ constUndefined: () => constUndefined,
68
+ constVoid: () => constVoid,
69
+ constant: () => constant,
70
+ dual: () => dual,
71
+ flip: () => flip,
72
+ flow: () => flow,
73
+ hole: () => hole,
74
+ identity: () => identity,
75
+ isFunction: () => isFunction,
76
+ pipe: () => pipe,
77
+ tupled: () => tupled,
78
+ unsafeCoerce: () => unsafeCoerce,
79
+ untupled: () => untupled
80
+ });
81
+ var isFunction = (input) => typeof input === "function";
82
+ var dual = function(arity, body) {
105
83
  if (typeof arity === "function") {
106
- return function () {
84
+ return function() {
107
85
  if (arity(arguments)) {
108
- // @ts-expect-error
109
86
  return body.apply(this, arguments);
110
87
  }
111
- return self => body(self, ...arguments);
88
+ return (self) => body(self, ...arguments);
112
89
  };
113
90
  }
114
91
  switch (arity) {
@@ -116,69 +93,69 @@ const dual = function (arity, body) {
116
93
  case 1:
117
94
  throw new RangeError(`Invalid arity ${arity}`);
118
95
  case 2:
119
- return function (a, b) {
96
+ return function(a, b2) {
120
97
  if (arguments.length >= 2) {
121
- return body(a, b);
98
+ return body(a, b2);
122
99
  }
123
- return function (self) {
100
+ return function(self) {
124
101
  return body(self, a);
125
102
  };
126
103
  };
127
104
  case 3:
128
- return function (a, b, c) {
105
+ return function(a, b2, c2) {
129
106
  if (arguments.length >= 3) {
130
- return body(a, b, c);
107
+ return body(a, b2, c2);
131
108
  }
132
- return function (self) {
133
- return body(self, a, b);
109
+ return function(self) {
110
+ return body(self, a, b2);
134
111
  };
135
112
  };
136
113
  case 4:
137
- return function (a, b, c, d) {
114
+ return function(a, b2, c2, d2) {
138
115
  if (arguments.length >= 4) {
139
- return body(a, b, c, d);
116
+ return body(a, b2, c2, d2);
140
117
  }
141
- return function (self) {
142
- return body(self, a, b, c);
118
+ return function(self) {
119
+ return body(self, a, b2, c2);
143
120
  };
144
121
  };
145
122
  case 5:
146
- return function (a, b, c, d, e) {
123
+ return function(a, b2, c2, d2, e2) {
147
124
  if (arguments.length >= 5) {
148
- return body(a, b, c, d, e);
125
+ return body(a, b2, c2, d2, e2);
149
126
  }
150
- return function (self) {
151
- return body(self, a, b, c, d);
127
+ return function(self) {
128
+ return body(self, a, b2, c2, d2);
152
129
  };
153
130
  };
154
131
  default:
155
- return function () {
132
+ return function() {
156
133
  if (arguments.length >= arity) {
157
- // @ts-expect-error
158
134
  return body.apply(this, arguments);
159
135
  }
160
136
  const args = arguments;
161
- return function (self) {
137
+ return function(self) {
162
138
  return body(self, ...args);
163
139
  };
164
140
  };
165
141
  }
166
142
  };
167
- /**
168
- * Reverses the order of arguments for a curried function.
169
- *
170
- * @param f - A curried function that takes multiple arguments.
171
- *
172
- * @example
173
- * import { flip } from "effect/Function"
174
- *
175
- * const f = (a: number) => (b: string) => a - b.length
176
- *
177
- * assert.deepStrictEqual(flip(f)('aaa')(2), -1)
178
- *
179
- * @since 2.0.0
180
- */
181
- const flip = f => (...b) => (...a) => f(...a)(...b);
143
+ var apply = (a) => (self) => self(a);
144
+ var identity = (a) => a;
145
+ var unsafeCoerce = identity;
146
+ var constant = (value) => () => value;
147
+ var constTrue = /* @__PURE__ */ constant(true);
148
+ var constFalse = /* @__PURE__ */ constant(false);
149
+ var constNull = /* @__PURE__ */ constant(null);
150
+ var constUndefined = /* @__PURE__ */ constant(void 0);
151
+ var constVoid = constUndefined;
152
+ var flip = (f) => (...b2) => (...a) => f(...a)(...b2);
153
+ var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a) => bc(ab(a)));
154
+ var absurd = (_) => {
155
+ throw new Error("Called `absurd` function which should be uncallable");
156
+ };
157
+ var tupled = (f) => (a) => f(...a);
158
+ var untupled = (f) => (...a) => f(a);
182
159
  function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
183
160
  switch (arguments.length) {
184
161
  case 1:
@@ -199,126 +176,183 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
199
176
  return gh(fg(ef(de(cd(bc(ab(a)))))));
200
177
  case 9:
201
178
  return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
202
- default:
203
- {
204
- let ret = arguments[0];
205
- for (let i = 1; i < arguments.length; i++) {
206
- ret = arguments[i](ret);
207
- }
208
- return ret;
179
+ default: {
180
+ let ret = arguments[0];
181
+ for (let i2 = 1; i2 < arguments.length; i2++) {
182
+ ret = arguments[i2](ret);
209
183
  }
184
+ return ret;
185
+ }
210
186
  }
211
187
  }
188
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
189
+ switch (arguments.length) {
190
+ case 1:
191
+ return ab;
192
+ case 2:
193
+ return function() {
194
+ return bc(ab.apply(this, arguments));
195
+ };
196
+ case 3:
197
+ return function() {
198
+ return cd(bc(ab.apply(this, arguments)));
199
+ };
200
+ case 4:
201
+ return function() {
202
+ return de(cd(bc(ab.apply(this, arguments))));
203
+ };
204
+ case 5:
205
+ return function() {
206
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
207
+ };
208
+ case 6:
209
+ return function() {
210
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
211
+ };
212
+ case 7:
213
+ return function() {
214
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
215
+ };
216
+ case 8:
217
+ return function() {
218
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
219
+ };
220
+ case 9:
221
+ return function() {
222
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
223
+ };
224
+ }
225
+ return;
226
+ }
227
+ var hole = /* @__PURE__ */ unsafeCoerce(absurd);
228
+ var SK = (_, b2) => b2;
212
229
 
213
- const moduleVersion = "2.3.1";
230
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/version.js
231
+ var moduleVersion = "2.3.1";
214
232
 
215
- /**
216
- * @since 2.0.0
217
- */
218
- const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
233
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/GlobalValue.js
234
+ var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
219
235
  if (!(globalStoreId in globalThis)) {
220
- globalThis[globalStoreId] = /*#__PURE__*/new Map();
236
+ globalThis[globalStoreId] = /* @__PURE__ */ new Map();
221
237
  }
222
- const globalStore = globalThis[globalStoreId];
223
- /**
224
- * @since 2.0.0
225
- */
226
- const globalValue = (id, compute) => {
238
+ var globalStore = globalThis[globalStoreId];
239
+ var globalValue = (id, compute) => {
227
240
  if (!globalStore.has(id)) {
228
241
  globalStore.set(id, compute());
229
242
  }
230
243
  return globalStore.get(id);
231
244
  };
232
245
 
233
- /**
234
- * @since 2.0.0
235
- */
236
- /**
237
- * Tests if a value is a `function`.
238
- *
239
- * @param input - The value to test.
240
- *
241
- * @example
242
- * import { isFunction } from "effect/Predicate"
243
- *
244
- * assert.deepStrictEqual(isFunction(isFunction), true)
245
- *
246
- * assert.deepStrictEqual(isFunction("function"), false)
247
- *
248
- * @category guards
249
- * @since 2.0.0
250
- */
251
- const isFunction = isFunction$1;
252
- const isRecordOrArray = input => typeof input === "object" && input !== null;
253
- /**
254
- * Tests if a value is an `object`.
255
- *
256
- * @param input - The value to test.
257
- *
258
- * @example
259
- * import { isObject } from "effect/Predicate"
260
- *
261
- * assert.deepStrictEqual(isObject({}), true)
262
- * assert.deepStrictEqual(isObject([]), true)
263
- *
264
- * assert.deepStrictEqual(isObject(null), false)
265
- * assert.deepStrictEqual(isObject(undefined), false)
266
- *
267
- * @category guards
268
- * @since 2.0.0
269
- */
270
- const isObject = input => isRecordOrArray(input) || isFunction(input);
271
- /**
272
- * Checks whether a value is an `object` containing a specified property key.
273
- *
274
- * @param property - The field to check within the object.
275
- * @param self - The value to examine.
276
- *
277
- * @category guards
278
- * @since 2.0.0
279
- */
280
- const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
281
- /**
282
- * A guard that succeeds when the input is `null` or `undefined`.
283
- *
284
- * @param input - The value to test.
285
- *
286
- * @example
287
- * import { isNullable } from "effect/Predicate"
288
- *
289
- * assert.deepStrictEqual(isNullable(null), true)
290
- * assert.deepStrictEqual(isNullable(undefined), true)
291
- *
292
- * assert.deepStrictEqual(isNullable({}), false)
293
- * assert.deepStrictEqual(isNullable([]), false)
294
- *
295
- * @category guards
296
- * @since 2.0.0
297
- */
298
- const isNullable = input => input === null || input === undefined;
246
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Predicate.js
247
+ var isFunction2 = isFunction;
248
+ var isRecordOrArray = (input) => typeof input === "object" && input !== null;
249
+ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
250
+ var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
251
+ var isNullable = (input) => input === null || input === void 0;
299
252
 
300
- /**
301
- * @since 2.0.0
302
- */
303
- const defaultIncHi = 0x14057b7e;
304
- const defaultIncLo = 0xf767814f;
305
- const MUL_HI = 0x5851f42d >>> 0;
306
- const MUL_LO = 0x4c957f2d >>> 0;
307
- const BIT_53 = 9007199254740992.0;
308
- const BIT_27 = 134217728.0;
309
- /**
310
- * PCG is a family of simple fast space-efficient statistically good algorithms
311
- * for random number generation. Unlike many general-purpose RNGs, they are also
312
- * hard to predict.
313
- *
314
- * @category model
315
- * @since 2.0.0
316
- */
317
- class PCGRandom {
253
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Utils.js
254
+ var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
255
+ var GenKindImpl = class {
256
+ value;
257
+ constructor(value) {
258
+ this.value = value;
259
+ }
260
+ /**
261
+ * @since 2.0.0
262
+ */
263
+ get _F() {
264
+ return identity;
265
+ }
266
+ /**
267
+ * @since 2.0.0
268
+ */
269
+ get _R() {
270
+ return (_) => _;
271
+ }
272
+ /**
273
+ * @since 2.0.0
274
+ */
275
+ get _O() {
276
+ return (_) => _;
277
+ }
278
+ /**
279
+ * @since 2.0.0
280
+ */
281
+ get _E() {
282
+ return (_) => _;
283
+ }
284
+ /**
285
+ * @since 2.0.0
286
+ */
287
+ [GenKindTypeId] = GenKindTypeId;
288
+ /**
289
+ * @since 2.0.0
290
+ */
291
+ [Symbol.iterator]() {
292
+ return new SingleShotGen(this);
293
+ }
294
+ };
295
+ var SingleShotGen = class _SingleShotGen {
296
+ self;
297
+ called = false;
298
+ constructor(self) {
299
+ this.self = self;
300
+ }
301
+ /**
302
+ * @since 2.0.0
303
+ */
304
+ next(a) {
305
+ return this.called ? {
306
+ value: a,
307
+ done: true
308
+ } : (this.called = true, {
309
+ value: this.self,
310
+ done: false
311
+ });
312
+ }
313
+ /**
314
+ * @since 2.0.0
315
+ */
316
+ return(a) {
317
+ return {
318
+ value: a,
319
+ done: true
320
+ };
321
+ }
322
+ /**
323
+ * @since 2.0.0
324
+ */
325
+ throw(e2) {
326
+ throw e2;
327
+ }
328
+ /**
329
+ * @since 2.0.0
330
+ */
331
+ [Symbol.iterator]() {
332
+ return new _SingleShotGen(this.self);
333
+ }
334
+ };
335
+ var adapter = () => (
336
+ // @ts-expect-error
337
+ function() {
338
+ let x2 = arguments[0];
339
+ for (let i2 = 1; i2 < arguments.length; i2++) {
340
+ x2 = arguments[i2](x2);
341
+ }
342
+ return new GenKindImpl(x2);
343
+ }
344
+ );
345
+ var defaultIncHi = 335903614;
346
+ var defaultIncLo = 4150755663;
347
+ var MUL_HI = 1481765933 >>> 0;
348
+ var MUL_LO = 1284865837 >>> 0;
349
+ var BIT_53 = 9007199254740992;
350
+ var BIT_27 = 134217728;
351
+ var PCGRandom = class {
318
352
  _state;
319
353
  constructor(seedHi, seedLo, incHi, incLo) {
320
354
  if (isNullable(seedLo) && isNullable(seedHi)) {
321
- seedLo = Math.random() * 0xffffffff >>> 0;
355
+ seedLo = Math.random() * 4294967295 >>> 0;
322
356
  seedHi = 0;
323
357
  } else if (isNullable(seedLo)) {
324
358
  seedLo = seedHi;
@@ -370,13 +404,11 @@ class PCGRandom {
370
404
  }
371
405
  max = max >>> 0;
372
406
  if ((max & max - 1) === 0) {
373
- return this._next() & max - 1; // fast path for power of 2
407
+ return this._next() & max - 1;
374
408
  }
375
409
  let num = 0;
376
410
  const skew = (-max >>> 0) % max >>> 0;
377
411
  for (num = this._next(); num < skew; num = this._next()) {
378
- // this loop will rarely execute more than twice,
379
- // and is intentionally empty
380
412
  }
381
413
  return num % max;
382
414
  }
@@ -388,35 +420,30 @@ class PCGRandom {
388
420
  * @since 2.0.0
389
421
  */
390
422
  number() {
391
- const hi = (this._next() & 0x03ffffff) * 1.0;
392
- const lo = (this._next() & 0x07ffffff) * 1.0;
423
+ const hi = (this._next() & 67108863) * 1;
424
+ const lo = (this._next() & 134217727) * 1;
393
425
  return (hi * BIT_27 + lo) / BIT_53;
394
426
  }
395
427
  /** @internal */
396
428
  _next() {
397
- // save current state (what we'll use for this number)
398
429
  const oldHi = this._state[0] >>> 0;
399
430
  const oldLo = this._state[1] >>> 0;
400
- // churn LCG.
401
431
  mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
402
432
  add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
403
- // get least sig. 32 bits of ((oldstate >> 18) ^ oldstate) >> 27
404
433
  let xsHi = oldHi >>> 18;
405
434
  let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
406
435
  xsHi = (xsHi ^ oldHi) >>> 0;
407
436
  xsLo = (xsLo ^ oldLo) >>> 0;
408
437
  const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
409
- // rotate xorshifted right a random amount, based on the most sig. 5 bits
410
- // bits of the old state.
411
438
  const rot = oldHi >>> 27;
412
439
  const rot2 = (-rot >>> 0 & 31) >>> 0;
413
440
  return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
414
441
  }
415
- }
442
+ };
416
443
  function mul64(out, aHi, aLo, bHi, bLo) {
417
- let c1 = (aLo >>> 16) * (bLo & 0xffff) >>> 0;
418
- let c0 = (aLo & 0xffff) * (bLo >>> 16) >>> 0;
419
- let lo = (aLo & 0xffff) * (bLo & 0xffff) >>> 0;
444
+ let c1 = (aLo >>> 16) * (bLo & 65535) >>> 0;
445
+ let c0 = (aLo & 65535) * (bLo >>> 16) >>> 0;
446
+ let lo = (aLo & 65535) * (bLo & 65535) >>> 0;
420
447
  let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
421
448
  c0 = c0 << 16 >>> 0;
422
449
  lo = lo + c0 >>> 0;
@@ -433,7 +460,6 @@ function mul64(out, aHi, aLo, bHi, bLo) {
433
460
  out[0] = hi;
434
461
  out[1] = lo;
435
462
  }
436
- // add two 64 bit numbers (given in parts), and store the result in `out`.
437
463
  function add64(out, aHi, aLo, bHi, bLo) {
438
464
  let hi = aHi + bHi >>> 0;
439
465
  const lo = aLo + bLo >>> 0;
@@ -444,23 +470,11 @@ function add64(out, aHi, aLo, bHi, bLo) {
444
470
  out[1] = lo;
445
471
  }
446
472
 
447
- /**
448
- * @since 2.0.0
449
- */
450
- /** @internal */
451
- const randomHashCache = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
452
- /** @internal */
453
- const pcgr = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
454
- /**
455
- * @since 2.0.0
456
- * @category symbols
457
- */
458
- const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
459
- /**
460
- * @since 2.0.0
461
- * @category hashing
462
- */
463
- const hash = self => {
473
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Hash.js
474
+ var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
475
+ var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
476
+ var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
477
+ var hash = (self) => {
464
478
  switch (typeof self) {
465
479
  case "number":
466
480
  return number(self);
@@ -475,84 +489,55 @@ const hash = self => {
475
489
  case "undefined":
476
490
  return string("undefined");
477
491
  case "function":
478
- case "object":
479
- {
480
- if (self === null) {
481
- return string("null");
482
- }
483
- if (isHash(self)) {
484
- return self[symbol$1]();
485
- } else {
486
- return random(self);
487
- }
492
+ case "object": {
493
+ if (self === null) {
494
+ return string("null");
488
495
  }
496
+ if (isHash(self)) {
497
+ return self[symbol]();
498
+ } else {
499
+ return random(self);
500
+ }
501
+ }
489
502
  default:
490
503
  throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
491
504
  }
492
505
  };
493
- /**
494
- * @since 2.0.0
495
- * @category hashing
496
- */
497
- const random = self => {
506
+ var random = (self) => {
498
507
  if (!randomHashCache.has(self)) {
499
508
  randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
500
509
  }
501
510
  return randomHashCache.get(self);
502
511
  };
503
- /**
504
- * @since 2.0.0
505
- * @category hashing
506
- */
507
- const combine = b => self => self * 53 ^ b;
508
- /**
509
- * @since 2.0.0
510
- * @category hashing
511
- */
512
- const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
513
- /**
514
- * @since 2.0.0
515
- * @category guards
516
- */
517
- const isHash = u => hasProperty(u, symbol$1);
518
- /**
519
- * @since 2.0.0
520
- * @category hashing
521
- */
522
- const number = n => {
523
- if (n !== n || n === Infinity) {
512
+ var combine = (b2) => (self) => self * 53 ^ b2;
513
+ var optimize = (n2) => n2 & 3221225471 | n2 >>> 1 & 1073741824;
514
+ var isHash = (u2) => hasProperty(u2, symbol);
515
+ var number = (n2) => {
516
+ if (n2 !== n2 || n2 === Infinity) {
524
517
  return 0;
525
518
  }
526
- let h = n | 0;
527
- if (h !== n) {
528
- h ^= n * 0xffffffff;
519
+ let h = n2 | 0;
520
+ if (h !== n2) {
521
+ h ^= n2 * 4294967295;
529
522
  }
530
- while (n > 0xffffffff) {
531
- h ^= n /= 0xffffffff;
523
+ while (n2 > 4294967295) {
524
+ h ^= n2 /= 4294967295;
532
525
  }
533
- return optimize(n);
526
+ return optimize(n2);
534
527
  };
535
- /**
536
- * @since 2.0.0
537
- * @category hashing
538
- */
539
- const string = str => {
540
- let h = 5381,
541
- i = str.length;
542
- while (i) {
543
- h = h * 33 ^ str.charCodeAt(--i);
528
+ var string = (str) => {
529
+ let h = 5381, i2 = str.length;
530
+ while (i2) {
531
+ h = h * 33 ^ str.charCodeAt(--i2);
544
532
  }
545
533
  return optimize(h);
546
534
  };
547
535
 
548
- /**
549
- * @since 2.0.0
550
- * @category symbols
551
- */
552
- const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
536
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Equal.js
537
+ var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
553
538
  function equals() {
554
539
  if (arguments.length === 1) {
555
- return self => compareBoth(self, arguments[0]);
540
+ return (self) => compareBoth(self, arguments[0]);
556
541
  }
557
542
  return compareBoth(arguments[0], arguments[1]);
558
543
  }
@@ -566,48 +551,93 @@ function compareBoth(self, that) {
566
551
  }
567
552
  if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
568
553
  if (isEqual(self) && isEqual(that)) {
569
- return hash(self) === hash(that) && self[symbol](that);
554
+ return hash(self) === hash(that) && self[symbol2](that);
570
555
  }
571
556
  }
572
557
  return false;
573
558
  }
574
- /**
575
- * @since 2.0.0
576
- * @category guards
577
- */
578
- const isEqual = u => hasProperty(u, symbol);
559
+ var isEqual = (u2) => hasProperty(u2, symbol2);
560
+ var equivalence = () => (self, that) => equals(self, that);
561
+
562
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Equivalence.js
563
+ var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
579
564
 
580
- /**
581
- * @since 2.0.0
582
- */
583
- /**
584
- * @since 2.0.0
585
- * @category symbols
586
- */
587
- const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
588
- /**
589
- * @since 2.0.0
590
- */
591
- const toJSON = x => {
592
- if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
593
- return x.toJSON();
594
- } else if (Array.isArray(x)) {
595
- return x.map(toJSON);
596
- }
597
- return x;
565
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Inspectable.js
566
+ var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
567
+ var toJSON = (x2) => {
568
+ if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
569
+ return x2.toJSON();
570
+ } else if (Array.isArray(x2)) {
571
+ return x2.map(toJSON);
572
+ }
573
+ return x2;
598
574
  };
599
- /**
600
- * @since 2.0.0
601
- */
602
- const format = x => JSON.stringify(x, null, 2);
575
+ var format = (x2) => JSON.stringify(x2, null, 2);
576
+
577
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Option.js
578
+ var Option_exports = {};
579
+ __export(Option_exports, {
580
+ Do: () => Do,
581
+ TypeId: () => TypeId3,
582
+ all: () => all,
583
+ andThen: () => andThen,
584
+ ap: () => ap,
585
+ as: () => as,
586
+ asUnit: () => asUnit,
587
+ bind: () => bind,
588
+ bindTo: () => bindTo,
589
+ composeK: () => composeK,
590
+ contains: () => contains,
591
+ containsWith: () => containsWith,
592
+ exists: () => exists,
593
+ filter: () => filter,
594
+ filterMap: () => filterMap,
595
+ firstSomeOf: () => firstSomeOf,
596
+ flatMap: () => flatMap,
597
+ flatMapNullable: () => flatMapNullable,
598
+ flatten: () => flatten,
599
+ fromIterable: () => fromIterable,
600
+ fromNullable: () => fromNullable,
601
+ gen: () => gen,
602
+ getEquivalence: () => getEquivalence,
603
+ getLeft: () => getLeft2,
604
+ getOrElse: () => getOrElse,
605
+ getOrNull: () => getOrNull,
606
+ getOrThrow: () => getOrThrow,
607
+ getOrThrowWith: () => getOrThrowWith,
608
+ getOrUndefined: () => getOrUndefined,
609
+ getOrder: () => getOrder,
610
+ getRight: () => getRight2,
611
+ isNone: () => isNone2,
612
+ isOption: () => isOption2,
613
+ isSome: () => isSome2,
614
+ let: () => let_,
615
+ lift2: () => lift2,
616
+ liftNullable: () => liftNullable,
617
+ liftPredicate: () => liftPredicate,
618
+ liftThrowable: () => liftThrowable,
619
+ map: () => map,
620
+ match: () => match,
621
+ none: () => none2,
622
+ orElse: () => orElse,
623
+ orElseEither: () => orElseEither,
624
+ orElseSome: () => orElseSome,
625
+ partitionMap: () => partitionMap,
626
+ product: () => product,
627
+ productMany: () => productMany,
628
+ reduceCompact: () => reduceCompact,
629
+ some: () => some2,
630
+ tap: () => tap,
631
+ toArray: () => toArray,
632
+ toRefinement: () => toRefinement,
633
+ unit: () => unit,
634
+ zipLeft: () => zipLeft,
635
+ zipRight: () => zipRight,
636
+ zipWith: () => zipWith
637
+ });
603
638
 
604
- /**
605
- * @since 2.0.0
606
- */
607
- /**
608
- * @since 2.0.0
609
- */
610
- const pipeArguments = (self, args) => {
639
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Pipeable.js
640
+ var pipeArguments = (self, args) => {
611
641
  switch (args.length) {
612
642
  case 1:
613
643
  return args[0](self);
@@ -627,73 +657,67 @@ const pipeArguments = (self, args) => {
627
657
  return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
628
658
  case 9:
629
659
  return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
630
- default:
631
- {
632
- let ret = self;
633
- for (let i = 0, len = args.length; i < len; i++) {
634
- ret = args[i](ret);
635
- }
636
- return ret;
660
+ default: {
661
+ let ret = self;
662
+ for (let i2 = 0, len = args.length; i2 < len; i2++) {
663
+ ret = args[i2](ret);
637
664
  }
665
+ return ret;
666
+ }
638
667
  }
639
668
  };
640
669
 
641
- /** @internal */
642
- const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
643
- /** @internal */
644
- const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
645
- /** @internal */
646
- const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
647
- /** @internal */
648
- const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
649
- /** @internal */
650
- const effectVariance = {
670
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/effectable.js
671
+ var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
672
+ var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
673
+ var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
674
+ var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
675
+ var effectVariance = {
651
676
  /* c8 ignore next */
652
- _R: _ => _,
677
+ _R: (_) => _,
653
678
  /* c8 ignore next */
654
- _E: _ => _,
679
+ _E: (_) => _,
655
680
  /* c8 ignore next */
656
- _A: _ => _,
681
+ _A: (_) => _,
657
682
  _V: moduleVersion
658
683
  };
659
- const sinkVariance = {
684
+ var sinkVariance = {
660
685
  /* c8 ignore next */
661
- _A: _ => _,
686
+ _A: (_) => _,
662
687
  /* c8 ignore next */
663
- _In: _ => _,
688
+ _In: (_) => _,
664
689
  /* c8 ignore next */
665
- _L: _ => _,
690
+ _L: (_) => _,
666
691
  /* c8 ignore next */
667
- _E: _ => _,
692
+ _E: (_) => _,
668
693
  /* c8 ignore next */
669
- _R: _ => _
694
+ _R: (_) => _
670
695
  };
671
- const channelVariance = {
696
+ var channelVariance = {
672
697
  /* c8 ignore next */
673
- _Env: _ => _,
698
+ _Env: (_) => _,
674
699
  /* c8 ignore next */
675
- _InErr: _ => _,
700
+ _InErr: (_) => _,
676
701
  /* c8 ignore next */
677
- _InElem: _ => _,
702
+ _InElem: (_) => _,
678
703
  /* c8 ignore next */
679
- _InDone: _ => _,
704
+ _InDone: (_) => _,
680
705
  /* c8 ignore next */
681
- _OutErr: _ => _,
706
+ _OutErr: (_) => _,
682
707
  /* c8 ignore next */
683
- _OutElem: _ => _,
708
+ _OutElem: (_) => _,
684
709
  /* c8 ignore next */
685
- _OutDone: _ => _
710
+ _OutDone: (_) => _
686
711
  };
687
- /** @internal */
688
- const EffectPrototype = {
712
+ var EffectPrototype = {
689
713
  [EffectTypeId]: effectVariance,
690
714
  [StreamTypeId]: effectVariance,
691
715
  [SinkTypeId]: sinkVariance,
692
716
  [ChannelTypeId]: channelVariance,
693
- [symbol](that) {
717
+ [symbol2](that) {
694
718
  return this === that;
695
719
  },
696
- [symbol$1]() {
720
+ [symbol]() {
697
721
  return random(this);
698
722
  },
699
723
  pipe() {
@@ -701,14 +725,12 @@ const EffectPrototype = {
701
725
  }
702
726
  };
703
727
 
704
- /**
705
- * @since 2.0.0
706
- */
707
- const TypeId = /*#__PURE__*/Symbol.for("effect/Option");
708
- const CommonProto = {
728
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/option.js
729
+ var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
730
+ var CommonProto = {
709
731
  ...EffectPrototype,
710
732
  [TypeId]: {
711
- _A: _ => _
733
+ _A: (_) => _
712
734
  },
713
735
  [NodeInspectSymbol]() {
714
736
  return this.toJSON();
@@ -717,13 +739,13 @@ const CommonProto = {
717
739
  return format(this.toJSON());
718
740
  }
719
741
  };
720
- const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
742
+ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
721
743
  _tag: "Some",
722
744
  _op: "Some",
723
- [symbol](that) {
745
+ [symbol2](that) {
724
746
  return isOption(that) && isSome(that) && equals(that.value, this.value);
725
747
  },
726
- [symbol$1]() {
748
+ [symbol]() {
727
749
  return combine(hash(this._tag))(hash(this.value));
728
750
  },
729
751
  toJSON() {
@@ -734,13 +756,13 @@ const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
734
756
  };
735
757
  }
736
758
  });
737
- const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
759
+ var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
738
760
  _tag: "None",
739
761
  _op: "None",
740
- [symbol](that) {
741
- return isOption(that) && isNone$1(that);
762
+ [symbol2](that) {
763
+ return isOption(that) && isNone(that);
742
764
  },
743
- [symbol$1]() {
765
+ [symbol]() {
744
766
  return combine(hash(this._tag));
745
767
  },
746
768
  toJSON() {
@@ -750,284 +772,577 @@ const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
750
772
  };
751
773
  }
752
774
  });
753
- /** @internal */
754
- const isOption = input => hasProperty(input, TypeId);
755
- /** @internal */
756
- const isNone$1 = fa => fa._tag === "None";
757
- /** @internal */
758
- const isSome = fa => fa._tag === "Some";
759
- /** @internal */
760
- const none$1 = /*#__PURE__*/Object.create(NoneProto);
761
- /** @internal */
762
- const some$1 = value => {
775
+ var isOption = (input) => hasProperty(input, TypeId);
776
+ var isNone = (fa) => fa._tag === "None";
777
+ var isSome = (fa) => fa._tag === "Some";
778
+ var none = /* @__PURE__ */ Object.create(NoneProto);
779
+ var some = (value) => {
763
780
  const a = Object.create(SomeProto);
764
781
  a.value = value;
765
782
  return a;
766
783
  };
767
784
 
768
- /**
769
- * Creates a new `Option` that represents the absence of a value.
770
- *
771
- * @category constructors
772
- * @since 2.0.0
773
- */
774
- const none = () => none$1;
775
- /**
776
- * Creates a new `Option` that wraps the given value.
777
- *
778
- * @param value - The value to wrap.
779
- *
780
- * @category constructors
781
- * @since 2.0.0
782
- */
783
- const some = some$1;
784
- /**
785
- * Determine if a `Option` is a `None`.
786
- *
787
- * @param self - The `Option` to check.
788
- *
789
- * @example
790
- * import { some, none, isNone } from 'effect/Option'
791
- *
792
- * assert.deepStrictEqual(isNone(some(1)), false)
793
- * assert.deepStrictEqual(isNone(none()), true)
794
- *
795
- * @category guards
796
- * @since 2.0.0
797
- */
798
- const isNone = isNone$1;
799
- /**
800
- * Maps the `Some` side of an `Option` value to a new `Option` value.
801
- *
802
- * @param self - An `Option` to map
803
- * @param f - The function to map over the value of the `Option`
804
- *
805
- * @category mapping
806
- * @since 2.0.0
807
- */
808
- const map = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
809
- /**
810
- * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
811
- *
812
- * @category sequencing
813
- * @since 2.0.0
814
- */
815
- const flatMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
816
- /**
817
- * Maps over the value of an `Option` and filters out `None`s.
818
- *
819
- * Useful when in addition to filtering you also want to change the type of the `Option`.
820
- *
821
- * @param self - The `Option` to map over.
822
- * @param f - A function to apply to the value of the `Option`.
823
- *
824
- * @example
825
- * import * as O from "effect/Option"
826
- *
827
- * const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
828
- *
829
- * assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
830
- * assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
831
- * assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
832
- *
833
- * @category filtering
834
- * @since 2.0.0
835
- */
836
- const filterMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
837
- /**
838
- * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
839
- *
840
- * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
841
- *
842
- * @param predicate - A predicate function to apply to the `Option` value.
843
- * @param fb - The `Option` to filter.
844
- *
845
- * @example
846
- * import * as O from "effect/Option"
847
- *
848
- * // predicate
849
- * const isEven = (n: number) => n % 2 === 0
850
- *
851
- * assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
852
- * assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
853
- * assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
854
- *
855
- * // refinement
856
- * const isNumber = (v: unknown): v is number => typeof v === "number"
857
- *
858
- * assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
859
- * assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
860
- * assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
861
- *
862
- * @category filtering
863
- * @since 2.0.0
864
- */
865
- const filter = /*#__PURE__*/dual(2, (self, predicate) => filterMap(self, b => predicate(b) ? some$1(b) : none$1));
866
-
867
- /**
868
- * Bun currently has a bug where `setTimeout` doesn't behave correctly with a 0ms delay.
869
- *
870
- * @see https://github.com/oven-sh/bun/issues/3333
871
- */
872
- /** @internal */
873
- typeof process === "undefined" ? false : !!process?.isBun;
785
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/either.js
786
+ var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
787
+ var CommonProto2 = {
788
+ ...EffectPrototype,
789
+ [TypeId2]: {
790
+ _A: (_) => _
791
+ },
792
+ [NodeInspectSymbol]() {
793
+ return this.toJSON();
794
+ },
795
+ toString() {
796
+ return format(this.toJSON());
797
+ }
798
+ };
799
+ var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
800
+ _tag: "Right",
801
+ _op: "Right",
802
+ [symbol2](that) {
803
+ return isEither(that) && isRight(that) && equals(that.right, this.right);
804
+ },
805
+ [symbol]() {
806
+ return combine(hash(this._tag))(hash(this.right));
807
+ },
808
+ toJSON() {
809
+ return {
810
+ _id: "Either",
811
+ _tag: this._tag,
812
+ right: toJSON(this.right)
813
+ };
814
+ }
815
+ });
816
+ var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
817
+ _tag: "Left",
818
+ _op: "Left",
819
+ [symbol2](that) {
820
+ return isEither(that) && isLeft(that) && equals(that.left, this.left);
821
+ },
822
+ [symbol]() {
823
+ return combine(hash(this._tag))(hash(this.left));
824
+ },
825
+ toJSON() {
826
+ return {
827
+ _id: "Either",
828
+ _tag: this._tag,
829
+ left: toJSON(this.left)
830
+ };
831
+ }
832
+ });
833
+ var isEither = (input) => hasProperty(input, TypeId2);
834
+ var isLeft = (ma) => ma._tag === "Left";
835
+ var isRight = (ma) => ma._tag === "Right";
836
+ var left = (left2) => {
837
+ const a = Object.create(LeftProto);
838
+ a.left = left2;
839
+ return a;
840
+ };
841
+ var right = (right2) => {
842
+ const a = Object.create(RightProto);
843
+ a.right = right2;
844
+ return a;
845
+ };
846
+ var getLeft = (self) => isRight(self) ? none : some(self.left);
847
+ var getRight = (self) => isLeft(self) ? none : some(self.right);
874
848
 
875
- var match;
876
- function n(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function t(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return (e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return "Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var u=0;return function(){return u>=t.length?{done:!0}:{done:!1,value:t[u++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r=Symbol.for("@ts-pattern/matcher"),e=Symbol.for("@ts-pattern/isVariadic"),u="@ts-pattern/anonymous-select-key",i=function(n){return Boolean(n&&"object"==typeof n)},o=function(n){return n&&!!n[r]},c=function n(u,c,a){if(o(u)){var f=u[r]().match(c),s=f.matched,l=f.selections;return s&&l&&Object.keys(l).forEach(function(n){return a(n,l[n])}),s}if(i(u)){if(!i(c))return !1;if(Array.isArray(u)){if(!Array.isArray(c))return !1;for(var h,v=[],g=[],m=[],p=t(u.keys());!(h=p()).done;){var y=u[h.value];o(y)&&y[e]?m.push(y):m.length?g.push(y):v.push(y);}if(m.length){if(m.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(c.length<v.length+g.length)return !1;var d=c.slice(0,v.length),b=0===g.length?[]:c.slice(-g.length),w=c.slice(v.length,0===g.length?Infinity:-g.length);return v.every(function(t,r){return n(t,d[r],a)})&&g.every(function(t,r){return n(t,b[r],a)})&&(0===m.length||n(m[0],w,a))}return u.length===c.length&&u.every(function(t,r){return n(t,c[r],a)})}return Object.keys(u).every(function(t){var e,i=u[t];return (t in c||o(e=i)&&"optional"===e[r]().matcherType)&&n(i,c[t],a)})}return Object.is(c,u)},a=function n(t){var e,u,c;return i(t)?o(t)?null!=(e=null==(u=(c=t[r]()).getSelectionKeys)?void 0:u.call(c))?e:[]:Array.isArray(t)?f(t,n):f(Object.values(t),n):[]},f=function(n,t){return n.reduce(function(n,r){return n.concat(t(r))},[])};function l(n){return Object.assign(n,{optional:function(){return v(n)},and:function(t){return p(n,t)},or:function(t){return y(n,t)},select:function(t){return void 0===t?b(n):b(t,n)}})}function v(n){var t;return l(((t={})[r]=function(){return {match:function(t){var r={},e=function(n,t){r[n]=t;};return void 0===t?(a(n).forEach(function(n){return e(n,void 0)}),{matched:!0,selections:r}):{matched:c(n,t,e),selections:r}},getSelectionKeys:function(){return a(n)},matcherType:"optional"}},t))}function p(){var n,t=[].slice.call(arguments);return l(((n={})[r]=function(){return {match:function(n){var r={},e=function(n,t){r[n]=t;};return {matched:t.every(function(t){return c(t,n,e)}),selections:r}},getSelectionKeys:function(){return f(t,a)},matcherType:"and"}},n))}function y(){var n,t=[].slice.call(arguments);return l(((n={})[r]=function(){return {match:function(n){var r={},e=function(n,t){r[n]=t;};return f(t,a).forEach(function(n){return e(n,void 0)}),{matched:t.some(function(t){return c(t,n,e)}),selections:r}},getSelectionKeys:function(){return f(t,a)},matcherType:"or"}},n))}function d(n){var t;return (t={})[r]=function(){return {match:function(t){return {matched:Boolean(n(t))}}}},t}function b(){var n,t=[].slice.call(arguments),e="string"==typeof t[0]?t[0]:void 0,i=2===t.length?t[1]:"string"==typeof t[0]?void 0:t[0];return l(((n={})[r]=function(){return {match:function(n){var t,r=((t={})[null!=e?e:u]=n,t);return {matched:void 0===i||c(i,n,function(n,t){r[n]=t;}),selections:r}},getSelectionKeys:function(){return [null!=e?e:u].concat(void 0===i?[]:a(i))}}},n))}function w(n){return "number"==typeof n}function S(n){return "string"==typeof n}function j(n){return "bigint"==typeof n}l(d(function(n){return !0}));(function n(t){return Object.assign(l(t),{startsWith:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&n.startsWith(e)}))));var e;},endsWith:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&n.endsWith(e)}))));var e;},minLength:function(r){return n(p(t,function(n){return d(function(t){return S(t)&&t.length>=n})}(r)))},maxLength:function(r){return n(p(t,function(n){return d(function(t){return S(t)&&t.length<=n})}(r)))},includes:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&n.includes(e)}))));var e;},regex:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&Boolean(n.match(e))}))));var e;}})})(d(S));(function n(t){return Object.assign(l(t),{between:function(r,e){return n(p(t,function(n,t){return d(function(r){return w(r)&&n<=r&&t>=r})}(r,e)))},lt:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t<n})}(r)))},gt:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t>n})}(r)))},lte:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t<=n})}(r)))},gte:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t>=n})}(r)))},int:function(){return n(p(t,d(function(n){return w(n)&&Number.isInteger(n)})))},finite:function(){return n(p(t,d(function(n){return w(n)&&Number.isFinite(n)})))},positive:function(){return n(p(t,d(function(n){return w(n)&&n>0})))},negative:function(){return n(p(t,d(function(n){return w(n)&&n<0})))}})})(d(w));(function n(t){return Object.assign(l(t),{between:function(r,e){return n(p(t,function(n,t){return d(function(r){return j(r)&&n<=r&&t>=r})}(r,e)))},lt:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t<n})}(r)))},gt:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t>n})}(r)))},lte:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t<=n})}(r)))},gte:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t>=n})}(r)))},positive:function(){return n(p(t,d(function(n){return j(n)&&n>0})))},negative:function(){return n(p(t,d(function(n){return j(n)&&n<0})))}})})(d(j));l(d(function(n){return "boolean"==typeof n}));l(d(function(n){return "symbol"==typeof n}));l(d(function(n){return null==n}));var I={matched:!1,value:void 0},_=/*#__PURE__*/function(){function n(n,t){this.input=void 0,this.state=void 0,this.input=n,this.state=t;}var t=n.prototype;return t.with=function(){var t=this,r=[].slice.call(arguments);if(this.state.matched)return this;var e=r[r.length-1],i=[r[0]],o=void 0;3===r.length&&"function"==typeof r[1]?o=r[1]:r.length>2&&i.push.apply(i,r.slice(1,r.length-1));var a=!1,f={},s=function(n,t){a=!0,f[n]=t;},l=!i.some(function(n){return c(n,t.input,s)})||o&&!Boolean(o(this.input))?I:{matched:!0,value:e(a?u in f?f[u]:f:this.input,this.input)};return new n(this.input,l)},t.when=function(t,r){if(this.state.matched)return this;var e=Boolean(t(this.input));return new n(this.input,e?{matched:!0,value:r(this.input,this.input)}:I)},t.otherwise=function(n){return this.state.matched?this.state.value:n(this.input)},t.exhaustive=function(){if(this.state.matched)return this.state.value;var n;try{n=JSON.stringify(this.input);}catch(t){n=this.input;}throw new Error("Pattern matching error: no pattern matches value "+n)},t.run=function(){return this.exhaustive()},t.returnType=function(){return this},n}();match = function(n){return new _(n,I)};
849
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Order.js
850
+ var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
877
851
 
878
- const RULE_NAME$2 = "ensure-use-callback-has-non-empty-deps";
879
- var ensureUseCallbackHasNonEmptyDeps = createRule({
880
- name: RULE_NAME$2,
881
- meta: {
882
- type: "problem",
883
- docs: {
884
- description: "enforce 'useCallback' has non-empty dependencies array",
885
- requiresTypeChecking: false
886
- },
887
- schema: [],
888
- messages: {
889
- ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
890
- }
891
- },
892
- defaultOptions: [],
893
- create (context) {
894
- const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
895
- const pragma = getPragmaFromContext(context);
896
- return {
897
- CallExpression (node) {
898
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
899
- if (!isReactHookCall(node)) return;
900
- if (!isUseCallbackCall(node, context, pragma) && !alias.some(flip(isReactHookCallWithNameLoose)(node))) {
901
- return;
902
- }
903
- const [_, deps] = node.arguments;
904
- if (!deps) {
905
- context.report({
906
- messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
907
- node
908
- });
909
- return;
910
- }
911
- const maybeDescriptor = pipe(match(deps).with({
912
- type: NodeType.ArrayExpression
913
- }, some).with({
914
- type: NodeType.Identifier
915
- }, (n)=>{
916
- return pipe(findVariable(n.name, initialScope), flatMap(getVariableInit(0)), filter(is(NodeType.ArrayExpression)));
917
- }).otherwise(none), filter((x)=>x.elements.length === 0), map(()=>({
918
- node,
919
- messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS"
920
- })));
921
- map(maybeDescriptor, context.report);
922
- }
923
- };
852
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Option.js
853
+ var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
854
+ var none2 = () => none;
855
+ var some2 = some;
856
+ var isOption2 = isOption;
857
+ var isNone2 = isNone;
858
+ var isSome2 = isSome;
859
+ var match = /* @__PURE__ */ dual(2, (self, {
860
+ onNone,
861
+ onSome
862
+ }) => isNone2(self) ? onNone() : onSome(self.value));
863
+ var toRefinement = (f) => (a) => isSome2(f(a));
864
+ var fromIterable = (collection) => {
865
+ for (const a of collection) {
866
+ return some2(a);
867
+ }
868
+ return none2();
869
+ };
870
+ var getRight2 = getRight;
871
+ var getLeft2 = getLeft;
872
+ var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
873
+ var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
874
+ var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some2(onNone()) : self);
875
+ var orElseEither = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? map(that(), right) : map(self, left));
876
+ var firstSomeOf = (collection) => {
877
+ let out = none2();
878
+ for (out of collection) {
879
+ if (isSome2(out)) {
880
+ return out;
924
881
  }
882
+ }
883
+ return out;
884
+ };
885
+ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
886
+ var liftNullable = (f) => (...a) => fromNullable(f(...a));
887
+ var getOrNull = /* @__PURE__ */ getOrElse(constNull);
888
+ var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
889
+ var liftThrowable = (f) => (...a) => {
890
+ try {
891
+ return some2(f(...a));
892
+ } catch (e2) {
893
+ return none2();
894
+ }
895
+ };
896
+ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onNone) => {
897
+ if (isSome2(self)) {
898
+ return self.value;
899
+ }
900
+ throw onNone();
925
901
  });
926
-
927
- const RULE_NAME$1 = "ensure-use-memo-has-non-empty-deps";
928
- var ensureUseMemoHasNonEmptyDeps = createRule({
929
- name: RULE_NAME$1,
930
- meta: {
931
- type: "problem",
932
- docs: {
933
- description: "enforce 'useMemo' has non-empty dependencies array",
934
- requiresTypeChecking: false
935
- },
936
- schema: [],
937
- messages: {
938
- ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
902
+ var getOrThrow = /* @__PURE__ */ getOrThrowWith(() => new Error("getOrThrow called on a None"));
903
+ var map = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
904
+ var as = /* @__PURE__ */ dual(2, (self, b2) => map(self, () => b2));
905
+ var asUnit = /* @__PURE__ */ as(void 0);
906
+ var unit = /* @__PURE__ */ some2(void 0);
907
+ var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value));
908
+ var andThen = /* @__PURE__ */ dual(2, (self, f) => isFunction(f) ? flatMap(self, f) : flatMap(self, () => f));
909
+ var flatMapNullable = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : fromNullable(f(self.value)));
910
+ var flatten = /* @__PURE__ */ flatMap(identity);
911
+ var zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap(self, () => that));
912
+ var composeK = /* @__PURE__ */ dual(2, (afb, bfc) => (a) => flatMap(afb(a), bfc));
913
+ var zipLeft = /* @__PURE__ */ dual(2, (self, that) => tap(self, () => that));
914
+ var tap = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => map(f(a), () => a)));
915
+ var product = (self, that) => isSome2(self) && isSome2(that) ? some2([self.value, that.value]) : none2();
916
+ var productMany = (self, collection) => {
917
+ if (isNone2(self)) {
918
+ return none2();
919
+ }
920
+ const out = [self.value];
921
+ for (const o2 of collection) {
922
+ if (isNone2(o2)) {
923
+ return none2();
924
+ }
925
+ out.push(o2.value);
926
+ }
927
+ return some2(out);
928
+ };
929
+ var all = (input) => {
930
+ if (Symbol.iterator in input) {
931
+ const out2 = [];
932
+ for (const o2 of input) {
933
+ if (isNone2(o2)) {
934
+ return none2();
935
+ }
936
+ out2.push(o2.value);
937
+ }
938
+ return some2(out2);
939
+ }
940
+ const out = {};
941
+ for (const key of Object.keys(input)) {
942
+ const o2 = input[key];
943
+ if (isNone2(o2)) {
944
+ return none2();
945
+ }
946
+ out[key] = o2.value;
947
+ }
948
+ return some2(out);
949
+ };
950
+ var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => map(product(self, that), ([a, b2]) => f(a, b2)));
951
+ var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a)));
952
+ var reduceCompact = /* @__PURE__ */ dual(3, (self, b2, f) => {
953
+ let out = b2;
954
+ for (const oa of self) {
955
+ if (isSome2(oa)) {
956
+ out = f(out, oa.value);
957
+ }
958
+ }
959
+ return out;
960
+ });
961
+ var toArray = (self) => isNone2(self) ? [] : [self.value];
962
+ var partitionMap = /* @__PURE__ */ dual(2, (self, f) => {
963
+ if (isNone2(self)) {
964
+ return [none2(), none2()];
965
+ }
966
+ const e2 = f(self.value);
967
+ return isLeft(e2) ? [some2(e2.left), none2()] : [none2(), some2(e2.right)];
968
+ });
969
+ var filterMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value));
970
+ var filter = /* @__PURE__ */ dual(2, (self, predicate) => filterMap(self, (b2) => predicate(b2) ? some(b2) : none));
971
+ var getEquivalence = (isEquivalent) => make((x2, y2) => x2 === y2 || (isNone2(x2) ? isNone2(y2) : isNone2(y2) ? false : isEquivalent(x2.value, y2.value)));
972
+ var getOrder = (O) => make2((self, that) => isSome2(self) ? isSome2(that) ? O(self.value, that.value) : 1 : -1);
973
+ var lift2 = (f) => dual(2, (self, that) => zipWith(self, that, f));
974
+ var liftPredicate = (predicate) => (b2) => predicate(b2) ? some2(b2) : none2();
975
+ var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false : isEquivalent(self.value, a));
976
+ var _equivalence = /* @__PURE__ */ equivalence();
977
+ var contains = /* @__PURE__ */ containsWith(_equivalence);
978
+ var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
979
+ var bindTo = /* @__PURE__ */ dual(2, (self, name2) => map(self, (a) => ({
980
+ [name2]: a
981
+ })));
982
+ var let_ = /* @__PURE__ */ dual(3, (self, name2, f) => map(self, (a) => Object.assign({}, a, {
983
+ [name2]: f(a)
984
+ })));
985
+ var bind = /* @__PURE__ */ dual(3, (self, name2, f) => flatMap(self, (a) => map(f(a), (b2) => Object.assign({}, a, {
986
+ [name2]: b2
987
+ }))));
988
+ var Do = /* @__PURE__ */ some2({});
989
+ var adapter2 = /* @__PURE__ */ adapter();
990
+ var gen = (f) => {
991
+ const iterator = f(adapter2);
992
+ let state = iterator.next();
993
+ if (state.done) {
994
+ return some2(state.value);
995
+ } else {
996
+ let current = state.value.value;
997
+ if (isNone2(current)) {
998
+ return current;
999
+ }
1000
+ while (!state.done) {
1001
+ state = iterator.next(current.value);
1002
+ if (!state.done) {
1003
+ current = state.value.value;
1004
+ if (isNone2(current)) {
1005
+ return current;
939
1006
  }
1007
+ }
1008
+ }
1009
+ return some2(state.value);
1010
+ }
1011
+ };
1012
+
1013
+ // ../../../node_modules/.pnpm/ts-pattern@5.0.6/node_modules/ts-pattern/dist/index.js
1014
+ var t = Symbol.for("@ts-pattern/matcher");
1015
+ var e = Symbol.for("@ts-pattern/isVariadic");
1016
+ var n = "@ts-pattern/anonymous-select-key";
1017
+ var r = (t2) => Boolean(t2 && "object" == typeof t2);
1018
+ var i = (e2) => e2 && !!e2[t];
1019
+ var s = (n2, o2, c2) => {
1020
+ if (i(n2)) {
1021
+ const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
1022
+ return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
1023
+ }
1024
+ if (r(n2)) {
1025
+ if (!r(o2))
1026
+ return false;
1027
+ if (Array.isArray(n2)) {
1028
+ if (!Array.isArray(o2))
1029
+ return false;
1030
+ let t2 = [], r2 = [], a = [];
1031
+ for (const s2 of n2.keys()) {
1032
+ const o3 = n2[s2];
1033
+ i(o3) && o3[e] ? a.push(o3) : a.length ? r2.push(o3) : t2.push(o3);
1034
+ }
1035
+ if (a.length) {
1036
+ if (a.length > 1)
1037
+ throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
1038
+ if (o2.length < t2.length + r2.length)
1039
+ return false;
1040
+ 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);
1041
+ return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a.length || s(a[0], i2, c2));
1042
+ }
1043
+ return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
1044
+ }
1045
+ return Object.keys(n2).every((e2) => {
1046
+ const r2 = n2[e2];
1047
+ return (e2 in o2 || i(a = r2) && "optional" === a[t]().matcherType) && s(r2, o2[e2], c2);
1048
+ var a;
1049
+ });
1050
+ }
1051
+ return Object.is(o2, n2);
1052
+ };
1053
+ var o = (e2) => {
1054
+ var n2, s2, a;
1055
+ return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
1056
+ };
1057
+ var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
1058
+ function u(t2) {
1059
+ 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) });
1060
+ }
1061
+ function l(e2) {
1062
+ return u({ [t]: () => ({ match: (t2) => {
1063
+ let n2 = {};
1064
+ const r2 = (t3, e3) => {
1065
+ n2[t3] = e3;
1066
+ };
1067
+ return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
1068
+ }, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
1069
+ }
1070
+ function m(...e2) {
1071
+ return u({ [t]: () => ({ match: (t2) => {
1072
+ let n2 = {};
1073
+ const r2 = (t3, e3) => {
1074
+ n2[t3] = e3;
1075
+ };
1076
+ return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
1077
+ }, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
1078
+ }
1079
+ function y(...e2) {
1080
+ return u({ [t]: () => ({ match: (t2) => {
1081
+ let n2 = {};
1082
+ const r2 = (t3, e3) => {
1083
+ n2[t3] = e3;
1084
+ };
1085
+ return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
1086
+ }, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
1087
+ }
1088
+ function d(e2) {
1089
+ return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
1090
+ }
1091
+ function p(...e2) {
1092
+ const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
1093
+ return u({ [t]: () => ({ match: (t2) => {
1094
+ let e3 = { [null != r2 ? r2 : n]: t2 };
1095
+ return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
1096
+ e3[t3] = n2;
1097
+ }), selections: e3 };
1098
+ }, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
1099
+ }
1100
+ function v(t2) {
1101
+ return "number" == typeof t2;
1102
+ }
1103
+ function b(t2) {
1104
+ return "string" == typeof t2;
1105
+ }
1106
+ function w(t2) {
1107
+ return "bigint" == typeof t2;
1108
+ }
1109
+ u(d(function(t2) {
1110
+ return true;
1111
+ }));
1112
+ var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
1113
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.startsWith(n2)))));
1114
+ var n2;
1115
+ }, endsWith: (e2) => {
1116
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.endsWith(n2)))));
1117
+ var n2;
1118
+ }, 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) => {
1119
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.includes(n2)))));
1120
+ var n2;
1121
+ }, regex: (e2) => {
1122
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && Boolean(t3.match(n2))))));
1123
+ var n2;
1124
+ } });
1125
+ j(d(b));
1126
+ 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))) });
1127
+ K(d(v));
1128
+ 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))) });
1129
+ x(d(w));
1130
+ u(d(function(t2) {
1131
+ return "boolean" == typeof t2;
1132
+ }));
1133
+ u(d(function(t2) {
1134
+ return "symbol" == typeof t2;
1135
+ }));
1136
+ u(d(function(t2) {
1137
+ return null == t2;
1138
+ }));
1139
+ var W = { matched: false, value: void 0 };
1140
+ function N(t2) {
1141
+ return new $(t2, W);
1142
+ }
1143
+ var $ = class _$ {
1144
+ constructor(t2, e2) {
1145
+ this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
1146
+ }
1147
+ with(...t2) {
1148
+ if (this.state.matched)
1149
+ return this;
1150
+ const e2 = t2[t2.length - 1], r2 = [t2[0]];
1151
+ let i2;
1152
+ 3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
1153
+ let o2 = false, c2 = {};
1154
+ const a = (t3, e3) => {
1155
+ o2 = true, c2[t3] = e3;
1156
+ }, u2 = !r2.some((t3) => s(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
1157
+ return new _$(this.input, u2);
1158
+ }
1159
+ when(t2, e2) {
1160
+ if (this.state.matched)
1161
+ return this;
1162
+ const n2 = Boolean(t2(this.input));
1163
+ return new _$(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
1164
+ }
1165
+ otherwise(t2) {
1166
+ return this.state.matched ? this.state.value : t2(this.input);
1167
+ }
1168
+ exhaustive() {
1169
+ if (this.state.matched)
1170
+ return this.state.value;
1171
+ let t2;
1172
+ try {
1173
+ t2 = JSON.stringify(this.input);
1174
+ } catch (e2) {
1175
+ t2 = this.input;
1176
+ }
1177
+ throw new Error(`Pattern matching error: no pattern matches value ${t2}`);
1178
+ }
1179
+ run() {
1180
+ return this.exhaustive();
1181
+ }
1182
+ returnType() {
1183
+ return this;
1184
+ }
1185
+ };
1186
+
1187
+ // src/rules/ensure-use-callback-has-non-empty-deps.ts
1188
+ var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
1189
+ var ensure_use_callback_has_non_empty_deps_default = createRule({
1190
+ name: RULE_NAME2,
1191
+ meta: {
1192
+ type: "problem",
1193
+ docs: {
1194
+ description: "enforce 'useCallback' has non-empty dependencies array",
1195
+ requiresTypeChecking: false
940
1196
  },
941
- defaultOptions: [],
942
- create (context) {
943
- const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
944
- const pragma = getPragmaFromContext(context);
945
- return {
946
- CallExpression (node) {
947
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
948
- if (!isReactHookCall(node)) return;
949
- if (!isUseMemoCall(node, context, pragma) && !alias.some(flip(isReactHookCallWithNameLoose)(node))) return;
950
- const [_, deps] = node.arguments;
951
- if (!deps) {
952
- context.report({
953
- messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
954
- node
955
- });
956
- return;
957
- }
958
- const maybeDescriptor = pipe(match(deps).with({
959
- type: NodeType.ArrayExpression
960
- }, some).with({
961
- type: NodeType.Identifier
962
- }, (n)=>{
963
- return pipe(findVariable(n.name, initialScope), flatMap(getVariableInit(0)), filter(is(NodeType.ArrayExpression)));
964
- }).otherwise(none), filter((x)=>x.elements.length === 0), map(()=>({
965
- node,
966
- messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS"
967
- })));
968
- map(maybeDescriptor, context.report);
969
- }
970
- };
1197
+ schema: [],
1198
+ messages: {
1199
+ ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
971
1200
  }
1201
+ },
1202
+ defaultOptions: [],
1203
+ create(context) {
1204
+ const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
1205
+ const pragma = getPragmaFromContext(context);
1206
+ return {
1207
+ CallExpression(node) {
1208
+ const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1209
+ if (!isReactHookCall(node))
1210
+ return;
1211
+ if (!isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node))) {
1212
+ return;
1213
+ }
1214
+ const [_, deps] = node.arguments;
1215
+ if (!deps) {
1216
+ context.report({
1217
+ messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
1218
+ node
1219
+ });
1220
+ return;
1221
+ }
1222
+ const maybeDescriptor = Function_exports.pipe(
1223
+ N(deps).with({ type: NodeType.ArrayExpression }, Option_exports.some).with({ type: NodeType.Identifier }, (n2) => {
1224
+ return Function_exports.pipe(
1225
+ findVariable(n2.name, initialScope),
1226
+ Option_exports.flatMap(getVariableInit(0)),
1227
+ Option_exports.filter(is(NodeType.ArrayExpression))
1228
+ );
1229
+ }).otherwise(Option_exports.none),
1230
+ Option_exports.filter((x2) => x2.elements.length === 0),
1231
+ Option_exports.map(() => ({
1232
+ node,
1233
+ messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS"
1234
+ }))
1235
+ );
1236
+ Option_exports.map(maybeDescriptor, context.report);
1237
+ }
1238
+ };
1239
+ }
972
1240
  });
973
-
974
- // Ported from https://github.com/jsx-eslint/eslint-plugin-react/pull/3579/commits/ebb739a0fe99a2ee77055870bfda9f67a2691374
975
- const RULE_NAME = "prefer-use-state-lazy-initialization";
976
- // variables should be defined here
977
- const ALLOW_LIST = Object.freeze([
978
- "Boolean",
979
- "String",
980
- "Number"
981
- ]);
982
- // rule takes inspiration from https://github.com/facebook/react/issues/26520
983
- var preferUseStateLazyInitialization = createRule({
984
- name: RULE_NAME,
985
- meta: {
986
- type: "problem",
987
- docs: {
988
- description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
989
- requiresTypeChecking: false
990
- },
991
- schema: [],
992
- messages: {
993
- PREFER_USE_STATE_LAZY_INITIALIZATION: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'"
1241
+ var RULE_NAME3 = "ensure-use-memo-has-non-empty-deps";
1242
+ var ensure_use_memo_has_non_empty_deps_default = createRule({
1243
+ name: RULE_NAME3,
1244
+ meta: {
1245
+ type: "problem",
1246
+ docs: {
1247
+ description: "enforce 'useMemo' has non-empty dependencies array",
1248
+ requiresTypeChecking: false
1249
+ },
1250
+ schema: [],
1251
+ messages: {
1252
+ ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
1253
+ }
1254
+ },
1255
+ defaultOptions: [],
1256
+ create(context) {
1257
+ const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
1258
+ const pragma = getPragmaFromContext(context);
1259
+ return {
1260
+ CallExpression(node) {
1261
+ const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1262
+ if (!isReactHookCall(node))
1263
+ return;
1264
+ if (!isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
1265
+ return;
1266
+ const [_, deps] = node.arguments;
1267
+ if (!deps) {
1268
+ context.report({
1269
+ messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
1270
+ node
1271
+ });
1272
+ return;
994
1273
  }
1274
+ const maybeDescriptor = Function_exports.pipe(
1275
+ N(deps).with({ type: NodeType.ArrayExpression }, Option_exports.some).with({ type: NodeType.Identifier }, (n2) => {
1276
+ return Function_exports.pipe(
1277
+ findVariable(n2.name, initialScope),
1278
+ Option_exports.flatMap(getVariableInit(0)),
1279
+ Option_exports.filter(is(NodeType.ArrayExpression))
1280
+ );
1281
+ }).otherwise(Option_exports.none),
1282
+ Option_exports.filter((x2) => x2.elements.length === 0),
1283
+ Option_exports.map(() => ({
1284
+ node,
1285
+ messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS"
1286
+ }))
1287
+ );
1288
+ Option_exports.map(maybeDescriptor, context.report);
1289
+ }
1290
+ };
1291
+ }
1292
+ });
1293
+ var RULE_NAME4 = "prefer-use-state-lazy-initialization";
1294
+ var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
1295
+ var prefer_use_state_lazy_initialization_default = createRule({
1296
+ name: RULE_NAME4,
1297
+ meta: {
1298
+ type: "problem",
1299
+ docs: {
1300
+ description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
1301
+ requiresTypeChecking: false
995
1302
  },
996
- defaultOptions: [],
997
- create (context) {
998
- const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
999
- const pragma = getPragmaFromContext(context);
1000
- return {
1001
- CallExpression (node) {
1002
- if (!isReactHookCall(node)) return;
1003
- if (!isUseStateCall(node, context, pragma) && !alias.some(flip(isReactHookCallWithNameLoose)(node))) return;
1004
- const [useStateInput] = node.arguments;
1005
- if (!useStateInput) return;
1006
- const nestedCallExpressions = getNestedCallExpressions(useStateInput);
1007
- const hasFunctionCall = nestedCallExpressions.some((n)=>{
1008
- return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
1009
- });
1010
- if (!hasFunctionCall) return;
1011
- context.report({
1012
- node: useStateInput,
1013
- messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION"
1014
- });
1015
- }
1016
- };
1303
+ schema: [],
1304
+ messages: {
1305
+ PREFER_USE_STATE_LAZY_INITIALIZATION: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'"
1017
1306
  }
1307
+ },
1308
+ defaultOptions: [],
1309
+ create(context) {
1310
+ const alias = parseSchema(ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1311
+ const pragma = getPragmaFromContext(context);
1312
+ return {
1313
+ CallExpression(node) {
1314
+ if (!isReactHookCall(node))
1315
+ return;
1316
+ if (!isUseStateCall(node, context, pragma) && !alias.some(Function_exports.flip(isReactHookCallWithNameLoose)(node)))
1317
+ return;
1318
+ const [useStateInput] = node.arguments;
1319
+ if (!useStateInput)
1320
+ return;
1321
+ const nestedCallExpressions = getNestedCallExpressions(useStateInput);
1322
+ const hasFunctionCall = nestedCallExpressions.some((n2) => {
1323
+ return "name" in n2.callee && !ALLOW_LIST.includes(n2.callee.name);
1324
+ });
1325
+ if (!hasFunctionCall)
1326
+ return;
1327
+ context.report({
1328
+ node: useStateInput,
1329
+ messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION"
1330
+ });
1331
+ }
1332
+ };
1333
+ }
1018
1334
  });
1019
1335
 
1020
- // Workaround for @typescript-eslint/utils's TS2742 error.
1021
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1022
- const meta = {
1023
- name,
1024
- version
1336
+ // src/index.ts
1337
+ var meta = {
1338
+ name,
1339
+ version
1025
1340
  };
1026
- const rules = {
1027
- "ensure-custom-hooks-using-other-hooks": ensureCustomHooksUsingOtherHooks,
1028
- "ensure-use-callback-has-non-empty-deps": ensureUseCallbackHasNonEmptyDeps,
1029
- "ensure-use-memo-has-non-empty-deps": ensureUseMemoHasNonEmptyDeps,
1030
- "prefer-use-state-lazy-initialization": preferUseStateLazyInitialization
1341
+ var rules = {
1342
+ "ensure-custom-hooks-using-other-hooks": ensure_custom_hooks_using_other_hooks_default,
1343
+ "ensure-use-callback-has-non-empty-deps": ensure_use_callback_has_non_empty_deps_default,
1344
+ "ensure-use-memo-has-non-empty-deps": ensure_use_memo_has_non_empty_deps_default,
1345
+ "prefer-use-state-lazy-initialization": prefer_use_state_lazy_initialization_default
1031
1346
  };
1032
1347
 
1033
1348
  export { meta, rules };