@superutils/fetch 1.5.3 → 1.5.4

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/README.md CHANGED
@@ -67,7 +67,7 @@ OR,
67
67
 
68
68
  This will expose a global namespace with the following:
69
69
 
70
- ```javascript
70
+ ```java
71
71
  // Namespace: default export (function) from '@superutils/fetch' and all the exports as properties
72
72
  superutils.fetch
73
73
  // Namespace: default export (class) from '@superutils/promise' and all the exports as properties
@@ -77,7 +77,7 @@ const { fetch, PromisE } = superutils
77
77
 
78
78
  // Fetch usage
79
79
  fetch('url', { method: 'get', timeout: 10_000 })
80
- fetch.get()
80
+ fetch.get('url')
81
81
  fetch.createClient({ method: 'post', timeout: 30_000 }, {}, { delay: 500 })
82
82
 
83
83
  // PromisE usage
@@ -103,7 +103,7 @@ Use as a drop-in replacement to built-in `fetch()`.
103
103
  ```javascript
104
104
  import fetch from '@superutils/fetch'
105
105
 
106
- fetch('https://dummyjson.com/products/1')
106
+ fetch('[DUMMYJSON-DOT-COM]/products/1')
107
107
  .then(response => response.json())
108
108
  .then(console.log)
109
109
  ```
@@ -119,7 +119,7 @@ All fetch calls return a `TimeoutPromise` instance from (`@superutils/promise`)
119
119
  ```javascript
120
120
  import fetch from '@superutils/fetch'
121
121
 
122
- const request = fetch('https://dummyjson.com/products/1')
122
+ const request = fetch('[DUMMYJSON-DOT-COM]/products/1')
123
123
 
124
124
  console.log(request.pending) // true
125
125
 
@@ -138,7 +138,7 @@ request.then(() => {
138
138
  import fetch from '@superutils/fetch'
139
139
 
140
140
  // Request that will take 5 seconds to resolve
141
- const request = fetch('https://dummyjson.com/products?delay=5000')
141
+ const request = fetch('[DUMMYJSON-DOT-COM]/products?delay=5000')
142
142
 
143
143
  request.then(result => console.log(result), console.warn)
144
144
 
@@ -191,7 +191,7 @@ While `fetch()` provides access to all HTTP request methods by specifying it in
191
191
  - `fetch.post.deferred(...)`
192
192
  - `fetch.put.deferred(...)`
193
193
 
194
- All method specific functions by default return result parsed as JSON. No need for `response.json()` or `result.data.data` drilling.
194
+ All method specific functions by default return result parsed as JSON. No need for `response.json()` or "result.data.data" drilling.
195
195
 
196
196
  <div id="fetch-get"></div>
197
197
 
@@ -205,7 +205,7 @@ Equivalent to `fetch(url, { method: 'get', as: 'json' })`.
205
205
  import fetch from '@superutils/fetch'
206
206
 
207
207
  fetch
208
- .get('https://dummyjson.com/products/1')
208
+ .get('[DUMMYJSON-DOT-COM]/products/1')
209
209
  .then(product => console.log({ product }))
210
210
  ```
211
211
 
@@ -225,15 +225,13 @@ const searchProducts = fetch.get.deferred({
225
225
  })
226
226
 
227
227
  // User types 'iphone'
228
- searchProducts('https://dummyjson.com/products/search?q=iphone').then(
229
- result => {
230
- console.log('Result for "iphone":', result)
231
- },
232
- )
228
+ searchProducts('[DUMMYJSON-DOT-COM]/products/search?q=iphone').then(result => {
229
+ console.log('Result for "iphone":', result)
230
+ })
233
231
 
234
232
  // Before 300ms has passed, the user continues typing 'iphone 12'
235
233
  setTimeout(() => {
236
- searchProducts('https://dummyjson.com/products/search?q=iphone 12').then(
234
+ searchProducts('[DUMMYJSON-DOT-COM]/products/search?q=iphone 12').then(
237
235
  result => {
238
236
  console.log('Result for "iphone 12":', result)
239
237
  },
@@ -279,7 +277,7 @@ const getRandomQuote = fetch.get.deferred(
279
277
  // Ignored calls will resolve with the result of the last successful call.
280
278
  resolveIgnored: 'WITH_LAST',
281
279
  },
282
- 'https://dummyjson.com/quotes/random', // Default URL
280
+ '[DUMMYJSON-DOT-COM]/quotes/random', // Default URL
283
281
  { timeout: 3000 }, // Default fetch options
284
282
  )
285
283
 
@@ -306,7 +304,7 @@ import fetch from '@superutils/fetch'
306
304
 
307
305
  const newProduct = { title: 'Perfume Oil' }
308
306
 
309
- fetch.post('https://dummyjson.com/products/add', newProduct).then(
307
+ fetch.post('[DUMMYJSON-DOT-COM]/products/add', newProduct).then(
310
308
  createdProduct => console.log('Product created:', createdProduct),
311
309
  error => console.error('Failed to create product:', error),
312
310
  )
@@ -332,7 +330,7 @@ const saveProductThrottled = fetch.post.deferred(
332
330
  trailing: true, // Ensures the very last update is always saved
333
331
  onResult: product => console.log(`[Saved] Product: ${product.title}`),
334
332
  },
335
- 'https://dummyjson.com/products/add', // Default URL
333
+ '[DUMMYJSON-DOT-COM]/products/add', // Default URL
336
334
  )
337
335
  // Simulate a user typing quickly, triggering multiple saves.
338
336
  console.log('User starts typing...')
@@ -373,7 +371,7 @@ const requestNewToken = fetch.post.deferred(
373
371
  currentRefreshToken = refreshToken
374
372
  },
375
373
  },
376
- 'https://dummyjson.com/auth/refresh', // Default URL
374
+ '[DUMMYJSON-DOT-COM]/auth/refresh', // Default URL
377
375
  () => ({
378
376
  refreshToken: currentRefreshToken,
379
377
  expiresInMins: 30,
@@ -384,7 +382,7 @@ const requestNewToken = fetch.post.deferred(
384
382
  // First authenticate user to get the initial refresh token and then request new refresh tokens
385
383
  fetch
386
384
  .post<{ refreshToken: string }>(
387
- 'https://dummyjson.com/auth/login',
385
+ '[DUMMYJSON-DOT-COM]/auth/login',
388
386
  {
389
387
  username: 'emilys',
390
388
  password: 'emilyspass',
@@ -463,7 +461,7 @@ const interceptors = {
463
461
  // You can transform the response by returning different `Response` object or even make a completely new HTTP reuqest.
464
462
  // You can transform the response by returning different `Response` object or even make a completely new HTTP request.
465
463
  // The subsequent response interceptors will receive the returned response
466
- return fetch('https://dummyjson.com/products/1') // promise will be resolved automatically
464
+ return fetch('[DUMMYJSON-DOT-COM]/products/1') // promise will be resolved automatically
467
465
  },
468
466
  ],
469
467
  result: [
@@ -479,7 +477,7 @@ const interceptors = {
479
477
  ],
480
478
  }
481
479
  fetch
482
- .get('https://dummyjson.com/products/1', { interceptors })
480
+ .get('[DUMMYJSON-DOT-COM]/products/1', { interceptors })
483
481
  .then(product => console.log({ product }))
484
482
  ```
485
483
 
@@ -502,7 +500,7 @@ interceptors.error.push((err, url, options) => {
502
500
  })
503
501
 
504
502
  // Each time a requst is made using @superutils/fetch, the above interceptors will be executed when appropriate
505
- fetch('https://dummyjson.com/products/1').then(console.log, console.warn)
503
+ fetch('[DUMMYJSON-DOT-COM]/products/1').then(console.log, console.warn)
506
504
  ```
507
505
 
508
506
  <div id="retry"></div>
@@ -514,7 +512,7 @@ The `retry` option provides a robust mechanism to automatically re-attempt faile
514
512
  ```javascript
515
513
  import fetch from '@superutils/fetch'
516
514
 
517
- fetch.get('https://dummyjson.com/products/1', {
515
+ fetch.get('[DUMMYJSON-DOT-COM]/products/1', {
518
516
  retry: 3, // Max number of retries.
519
517
  retryBackOff: 'linear', // Backoff strategy: 'linear' or 'exponential'.
520
518
  // Delay in milliseconds.
@@ -540,7 +538,7 @@ A request can be automatically cancelled by simply providing a `timeout` duratio
540
538
  ```javascript
541
539
  import fetch from '@superutils/fetch'
542
540
 
543
- fetch.get('https://dummyjson.com/products/1', {
541
+ fetch.get('[DUMMYJSON-DOT-COM]/products/1', {
544
542
  timeout: 5000,
545
543
  })
546
544
  ```
@@ -568,7 +566,7 @@ To retrieve the response in a different format (e.g., as text, a blob, or the ra
568
566
  ```typescript
569
567
  import fetch, { FetchAs } from '@superutils/fetch'
570
568
 
571
- fetch.get('https://dummyjson.com/products/1', {
569
+ fetch.get('[DUMMYJSON-DOT-COM]/products/1', {
572
570
  as: FetchAs.text,
573
571
  })
574
572
  ```
@@ -587,11 +585,11 @@ import { createClient } from '@superutils/fetch'
587
585
  // Create a "GET" client with default headers and a 5-second timeout
588
586
  const apiClient = createClient(
589
587
  {
590
- // fixed options cannot be overridden
588
+ // fixed options (cannot be overridden)
591
589
  method: 'get',
592
590
  },
593
591
  {
594
- // default options can be overridden
592
+ // common options (can be overridden)
595
593
  headers: {
596
594
  Authorization: 'Bearer my-secret-token',
597
595
  'Content-Type': 'application/json',
@@ -599,14 +597,14 @@ const apiClient = createClient(
599
597
  timeout: 5000,
600
598
  },
601
599
  {
602
- // default defer options (can be overridden)
600
+ // defer options (can be overridden)
603
601
  delay: 300,
604
602
  retry: 2, // If request fails, retry up to two more times
605
603
  },
606
604
  )
607
605
 
608
606
  // Use it just like the standard fetch
609
- apiClient('https://dummyjson.com/products/1', {
607
+ apiClient('[DUMMYJSON-DOT-COM]/products/1', {
610
608
  // The 'method' property cannot be overridden as it is used in the fixed options when creating the client.
611
609
  // In TypeScript, the compiler will not allow this property.
612
610
  // In Javascript, it will simply be ignored.
@@ -617,14 +615,14 @@ apiClient('https://dummyjson.com/products/1', {
617
615
  // create a deferred client using "apiClient"
618
616
  const deferredClient = apiClient.deferred(
619
617
  { retry: 0 }, // disable retrying by overriding the `retry` defer option
620
- 'https://dummyjson.com/products/1',
618
+ '[DUMMYJSON-DOT-COM]/products/1',
621
619
  { timeout: 3000 },
622
620
  )
623
621
  deferredClient({ timeout: 10000 }) // timeout is overridden by individual request
624
622
  .then(console.log, console.warn)
625
623
  ```
626
624
 
627
- ### `createPostClient(mandatoryOptions, commonOptions, commonDeferOptions)`: Reusable Post-like Clients
625
+ ### `createPostClient(fixedOptions, commonOptions, commonDeferOptions)`: Reusable Post-like Clients
628
626
 
629
627
  While `createClient()` is versatile enough for any HTTP method, `createPostClient()` is specifically designed for methods that require a request body, such as `DELETE`, `PATCH`, `POST`, and `PUT`. If a method is not provided, it defaults to `POST`. The generated client accepts an additional second parameter (`data`) for the request payload.
630
628
 
@@ -644,7 +642,7 @@ const postClient = createPostClient(
644
642
 
645
643
  // Invoking `postClient()` automatically applies the pre-configured options
646
644
  postClient(
647
- 'https://dummyjson.com/products/add',
645
+ '[DUMMYJSON-DOT-COM]/products/add',
648
646
  { title: 'New Product' }, // data/body
649
647
  {}, // other options
650
648
  ).then(console.log)
@@ -655,7 +653,7 @@ const updateProduct = postClient.deferred(
655
653
  delay: 300, // debounce duration
656
654
  onResult: console.log, // prints only successful results
657
655
  },
658
- 'https://dummyjson.com/products/add',
656
+ '[DUMMYJSON-DOT-COM]/products/add',
659
657
  {
660
658
  method: 'patch',
661
659
  timeout: 3000,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../promise/dist/index.js","../../../core/dist/index.js","../../src/index.ts","../../src/executeInterceptors.ts","../../src/getResponse.ts","../../src/mergeOptions.ts","../../src/types/constants.ts","../../src/types/FetchError.ts","../../src/fetch.ts","../../src/createClient.ts","../../src/createPostClient.ts","../../src/browser.ts"],"names":["dist_exports","__export","PromisE","PromisEBase","ResolveError","ResolveIgnored","TIMEOUT_FALLBACK","TIMEOUT_MAX","TimeoutPromise","index_default","deferred","deferredCallback","delay","delayReject","retry","timeout","isObj","x","strict","isArr","isInteger","isNumber","isPositiveInteger","isPositiveNumber","isEmpty","nonNumerable","fallback","proto","isFn","isUrl","isUrlValid","tldExceptions","url","y","_","isError","isPromise","isSymbol","fallbackIfFails","target","args","result","err","fallbackIfFails_default","objKeys","obj","sorted","includeSymbols","objKeys_default","clone","value","objCopy","input","output","ignoreKeys","override","recursive","_output","_ignoreKeys","inKeys","_key","key","ignoreChildKeys","arrUnique","arr","flatDepth","debounce","callback","config","leading","onError","thisArg","tid","_callback","firstArgs","leadingGlobal","debounce_default","throttle","d","trailing","handleCallback","trailArgs","cbArgs","throttle_default","_PromisEBase","_resolve","_reject","resolve","reject","reason","fn","_a","_b","values","promise","callbackFn","PromisEBase_default","ResolveError2","ResolveIgnored2","options","sequence","onIgnore","onResult","delay2","ignoreStale","resolveError","resolveIgnored","lastInSeries","lastExecuted","queue","isSequential","handleIgnore","items","iId","iItem","isStale","handleRemaining","currentId","nextId","nextItem","handleItem","currentIndex","id","executeItem","qItem","deferred_default","deferPromise","deferredCallback_default","duration","asRejected","finalize","result2","_result","_result2","delay_default","delayReject_default","func","maxRetries","retryBackOff","retryDelay","retryDelayJitter","retryDelayJitterMax","_retryDelay","retryCount","error","shouldRetry","retry_default","data","timeout2","_signals","_c","_d","signal","_e","s","TimeoutPromise_default","opts","promises","v","dataPromise","timeoutPromise","timeout_default","PromisE_default","index_exports","ContentType","FetchAs","FetchError","createClient","createPostClient","executeInterceptors","fetch","mergeOptions","interceptors","interceptor","executeInterceptors_default","getResponse","fetchFunc","attemptCount","res","count","abortCtrl","retryIf","getResponse_default","allOptions","merged","headers","ints1","ints2","toArr","mergeOptions_default","_FetchError","message","newMessage","fromPostClient","response","parseAs","onAbort","onTimeout","_f","interceptErr","body","errMsgs","validateUrl","contentType","status","jsonError","parseFunc","_err","fetch_default","fixedOptions","commonOptions","commonDeferOptions","client","mergedOptions","deferOptions","defaultUrl","defaultOptions","_abortCtrl","createClient_default","defaultData","createPostClient_default","methods","browser_default","w"],"mappings":"mFAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAAA,EAAAA,CAAA,EAAA,CAAAC,EAAAA,CAAAD,EAAAA,CAAA,aAAAE,CAAAA,CAAA,WAAA,CAAA,IAAAC,EAAAA,CAAA,YAAA,CAAA,IAAAC,GAAA,cAAA,CAAA,IAAAC,EAAAA,CAAA,gBAAA,CAAA,IAAAC,CAAAA,CAAA,gBAAAC,CAAAA,CAAA,cAAA,CAAA,IAAAC,EAAAA,CAAA,OAAA,CAAA,IAAAC,GAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,gBAAA,CAAA,IAAAC,CAAAA,CAAA,UAAAC,CAAAA,CAAA,WAAA,CAAA,IAAAC,EAAAA,CAAA,KAAA,CAAA,IAAAC,EAAA,OAAA,CAAA,IAAAC,CAAAA,CAAAA,CAAAA,CCcA,IAAIC,CAAAA,CAAQ,CAACC,CAAAA,CAAGC,CAAAA,CAAS,IAAA,GAAS,CAAC,CAACD,CAAAA,EAAK,OAAOA,CAAAA,EAAM,QAAA,GAAa,CAACC,CAAAA,EAAU,CAC5E,MAAA,CAAO,SA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nD,CAAAA,CAAM,OAAA,CAAUmD,EAAQ,OAAA,CACxBnD,CAAAA,CAAM,KAAA,CAAQmD,CAAAA,CAAQ,MACtBnD,CAAAA,CAAM,IAAA,CAAOmD,CAAAA,CAAQ,IAAA,CACrBnD,EAAM,GAAA,CAAMmD,CAAAA,CAAQ,GAAA,CAEpB,IAAOpN,GAAQiK,CAAAA,CSjLf,IAAMA,EAAAA,CAAqBjK,EAAAA,CAE3B,OAAO,IAAA,CAAK0J,EAAY,CAAA,CAAE,OAAA,CAAQtG,GAAO,CACpC,CAAC,UAAW,OAAO,CAAA,CAAE,QAAA,CAASA,CAAG,IACnC6G,EAAAA,CAAA7G,CAAAA,CAAAA,GAAA,IAAA,GAAA6G,GAAA7G,CAAAA,CAAAA,CACDsG,EAAAA,CACCtG,CAAG,CAAA,EACN,CAAC,CAAA,CACD,IAAOiK,EAAAA,CAAQpD,EAAAA,CAcTxK,GAAyBO,GAC/B,MAAA,CAAO,IAAA,CAAKT,EAAc,EAAE,OAAA,CAAQ6D,CAAAA,EAAO,CACtC,CAAC,SAAA,CAAW,SAAS,CAAA,CAAE,SAASA,CAAG,CAAA,EAAA,CACrC3D,EAAAA,CAAA2D,KAAA,IAAA,GAAA3D,EAAAA,CAAA2D,CAAAA,CAAAA,CACD7D,EAAAA,CACC6D,CAAG,CAAA,EACN,CAAC,CAAA,CACD,IAAMkK,GAAI,UAAA,CAzCVpI,CA0CAoI,EAAAA,CAAE,aAAF,IAAA,GAAAA,EAAAA,CAAE,UAAA,CAAe,IA1CjB,IAAApI,EAAAA,CAAAC,CA2CAA,CAAAD,GAAAoI,EAAAA,CAAE,UAAA,EAAW,OAAA,GAAb,IAAA,GAAApI,GAAa,OAAA,CAAYzF,EAAAA,CAAAA","file":"index.min.js","sourcesContent":["// src/deferred.ts\nimport {\n deferred as deferredSync,\n fallbackIfFails as fallbackIfFails2,\n isFn as isFn2,\n isPositiveNumber,\n objCopy\n} from \"@superutils/core\";\n\n// src/PromisEBase.ts\nimport { fallbackIfFails, isFn, isPromise } from \"@superutils/core\";\nvar _PromisEBase = class _PromisEBase extends Promise {\n constructor(input) {\n let _resolve;\n let _reject;\n super((resolve, reject) => {\n _reject = (reason) => {\n reject(reason);\n this._state = 2;\n this.onFinalize.forEach(\n (fn) => fallbackIfFails(fn, [void 0, reason], void 0)\n );\n };\n _resolve = (value) => {\n resolve(value);\n this._state = 1;\n this.onFinalize.forEach(\n (fn) => fallbackIfFails(fn, [value, void 0], void 0)\n );\n };\n if (isFn(input)) {\n fallbackIfFails(input, [_resolve, _reject], _reject);\n } else if (isPromise(input)) {\n input.then(_resolve, _reject);\n } else if (input !== void 0) {\n _resolve(input);\n }\n });\n this._state = 0;\n /**\n * callbacks to be invoked whenever PromisE instance is finalized early using non-static resolve()/reject() methods */\n this.onEarlyFinalize = [];\n this.onFinalize = [];\n //\n //\n // --------------------------- Early resolve/reject ---------------------------\n //\n //\n /** Resovle pending promise early. */\n this.resolve = (value) => {\n var _a, _b;\n if (!this.pending) return;\n (_a = this._resolve) == null ? void 0 : _a.call(this, value);\n (_b = this.onEarlyFinalize) == null ? void 0 : _b.forEach((fn) => {\n fallbackIfFails(fn, [true, value], void 0);\n });\n };\n /** Reject pending promise early. */\n this.reject = (reason) => {\n var _a, _b;\n if (!this.pending) return;\n (_a = this._reject) == null ? void 0 : _a.call(this, reason);\n (_b = this.onEarlyFinalize) == null ? void 0 : _b.forEach((fn) => {\n fallbackIfFails(fn, [false, reason], void 0);\n });\n };\n this._resolve = _resolve;\n this._reject = _reject;\n }\n //\n //\n //-------------------- Status related read-only attributes --------------------\n //\n //\n /** Indicates if the promise is still pending/unfinalized */\n get pending() {\n return this.state === 0;\n }\n /** Indicates if the promise has been rejected */\n get rejected() {\n return this.state === 2;\n }\n /** Indicates if the promise has been resolved */\n get resolved() {\n return this.state === 1;\n }\n /**\n * Get promise status code:\n *\n * - `0` = pending\n * - `1` = resolved\n * - `2` = rejected\n */\n get state() {\n return this._state;\n }\n};\n//\n//\n// Extend all static `Promise` methods\n//\n//\n/** Sugar for `new PromisE(Promise.all(...))` */\n_PromisEBase.all = (values) => new _PromisEBase(globalThis.Promise.all(values));\n/** Sugar for `new PromisE(Promise.allSettled(...))` */\n_PromisEBase.allSettled = (values) => new _PromisEBase(globalThis.Promise.allSettled(values));\n/** Sugar for `new PromisE(Promise.any(...))` */\n_PromisEBase.any = (values) => new _PromisEBase(globalThis.Promise.any(values));\n/** Sugar for `new PromisE(Promise.race(..))` */\n_PromisEBase.race = (values) => new _PromisEBase(globalThis.Promise.race(values));\n/** Extends Promise.reject */\n_PromisEBase.reject = (reason) => {\n const promise = new _PromisEBase();\n queueMicrotask(() => promise.reject(reason));\n return promise;\n};\n/** Sugar for `new PromisE(Promise.resolve(...))` */\n_PromisEBase.resolve = (value) => new _PromisEBase(\n globalThis.Promise.resolve(value)\n);\n/** Sugar for `new PromisE(Promise.try(...))` */\n_PromisEBase.try = (callbackFn, ...args) => new _PromisEBase(\n (resolve) => resolve(\n // Promise.try is not supported in Node < 23.\n fallbackIfFails(\n callbackFn,\n args,\n // rethrow error to ensure the returned promise is rejected\n (err) => globalThis.Promise.reject(err)\n )\n )\n);\n/**\n * Creates a `PromisE` instance and returns it in an object, along with its `resolve` and `reject` functions.\n *\n * NB: this function is technically no longer needed because the `PromisE` class already comes with the resolvers.\n *\n * ---\n * @example\n * Using `PromisE` directly: simply provide an empty function as the executor\n *\n * ```typescript\n * import PromisE from '@superutils/promise'\n * const promisE = new PromisE<number>(() => {})\n * setTimeout(() => promisE.resolve(1), 1000)\n * promisE.then(console.log)\n * ```\n *\n * @example\n * Using `withResolvers`\n * ```typescript\n * import PromisE from '@superutils/promise'\n * const pwr = PromisE.withResolvers<number>()\n * setTimeout(() => pwr.resolve(1), 1000)\n * pwr.promise.then(console.log)\n * ```\n */\n_PromisEBase.withResolvers = () => {\n const promise = new _PromisEBase();\n return { promise, reject: promise.reject, resolve: promise.resolve };\n};\nvar PromisEBase = _PromisEBase;\nvar PromisEBase_default = PromisEBase;\n\n// src/types/deferred.ts\nvar ResolveError = /* @__PURE__ */ ((ResolveError2) => {\n ResolveError2[\"NEVER\"] = \"NEVER\";\n ResolveError2[\"REJECT\"] = \"REJECT\";\n ResolveError2[\"WITH_ERROR\"] = \"RESOLVE_ERROR\";\n ResolveError2[\"WITH_UNDEFINED\"] = \"RESOLVE_UNDEFINED\";\n return ResolveError2;\n})(ResolveError || {});\nvar ResolveIgnored = /* @__PURE__ */ ((ResolveIgnored2) => {\n ResolveIgnored2[\"NEVER\"] = \"NEVER\";\n ResolveIgnored2[\"WITH_LAST\"] = \"WITH_LAST\";\n ResolveIgnored2[\"WITH_UNDEFINED\"] = \"WITH_UNDEFINED\";\n return ResolveIgnored2;\n})(ResolveIgnored || {});\n\n// src/deferred.ts\nfunction deferred(options = {}) {\n let sequence = 0;\n options = objCopy(\n deferred.defaults,\n options,\n [],\n \"empty\"\n );\n let { onError, onIgnore, onResult } = options;\n const {\n delay: delay2 = 0,\n ignoreStale,\n resolveError,\n resolveIgnored,\n thisArg,\n throttle\n } = options;\n let lastInSeries = null;\n let lastExecuted;\n const queue = /* @__PURE__ */ new Map();\n const isSequential = !isPositiveNumber(delay2);\n if (thisArg !== void 0) {\n onError = onError == null ? void 0 : onError.bind(thisArg);\n onIgnore = onIgnore == null ? void 0 : onIgnore.bind(thisArg);\n onResult = onResult == null ? void 0 : onResult.bind(thisArg);\n }\n const handleIgnore = (items) => {\n for (const [iId, iItem] of items) {\n queue.delete(iId);\n const isStale = ignoreStale && iItem.sequence < lastExecuted.sequence;\n if (iItem.resolved || iItem.started && !isStale) continue;\n if (iItem.started) {\n iItem.getPromise = (() => iItem.result);\n }\n fallbackIfFails2(onIgnore, [iItem.getPromise], 0);\n switch (resolveIgnored) {\n case \"WITH_UNDEFINED\" /* WITH_UNDEFINED */:\n iItem.resolve(void 0);\n break;\n case \"WITH_LAST\" /* WITH_LAST */:\n lastExecuted == null ? void 0 : lastExecuted.then(iItem.resolve, iItem.reject);\n break;\n case \"NEVER\" /* NEVER */:\n break;\n }\n }\n if (!queue.size) sequence = 0;\n };\n const handleRemaining = (currentId) => {\n lastInSeries = null;\n if (isSequential) {\n queue.delete(currentId);\n const [nextId, nextItem] = [...queue.entries()][0] || [];\n return nextId && nextItem && handleItem(nextId, nextItem);\n }\n let items = [...queue.entries()];\n if (throttle === true && options.trailing) {\n const currentIndex = items.findIndex(([id]) => id === currentId);\n items = items.slice(0, currentIndex);\n } else if (!throttle) {\n items = items.slice(0, -1);\n }\n handleIgnore(items);\n queue.delete(currentId);\n };\n const executeItem = async (id, qItem) => {\n var _a;\n try {\n qItem.started = true;\n lastExecuted = qItem;\n lastInSeries = qItem;\n (_a = qItem.result) != null ? _a : qItem.result = PromisEBase_default.try(qItem.getPromise);\n const result = await qItem.result;\n const isStale = !!ignoreStale && qItem.sequence < lastExecuted.sequence;\n if (isStale) return handleIgnore([[id, qItem]]);\n qItem.resolve(result);\n onResult && fallbackIfFails2(onResult, [result], void 0);\n } catch (err) {\n onError && fallbackIfFails2(onError, [err], void 0);\n switch (resolveError) {\n case \"REJECT\" /* REJECT */:\n qItem.reject(err);\n // eslint-disable-next-line no-fallthrough\n case \"NEVER\" /* NEVER */:\n break;\n case \"RESOLVE_UNDEFINED\" /* WITH_UNDEFINED */:\n qItem.resolve(void 0);\n break;\n case \"RESOLVE_ERROR\" /* WITH_ERROR */:\n qItem.resolve(err);\n break;\n }\n }\n handleRemaining(id);\n };\n const handleItem = isSequential ? executeItem : deferredSync(\n executeItem,\n delay2,\n options\n );\n return (promise) => {\n const id = /* @__PURE__ */ Symbol(\"deferred-queue-item-id\");\n const qItem = new PromisEBase_default();\n qItem.getPromise = isFn2(promise) ? promise : () => promise;\n qItem.started = false;\n qItem.sequence = ++sequence;\n queue.set(id, qItem);\n if (!lastInSeries || !isSequential) handleItem(id, qItem);\n return qItem;\n };\n}\ndeferred.defaults = {\n /**\n * Default delay in milliseconds, used in `debounce` and `throttle` modes.\n *\n * Use `0` (or negative number) to disable debounce/throttle and execute all operations sequentially.\n */\n delay: 100,\n /** Set the default error resolution behavior. {@link ResolveError} for all options. */\n resolveError: \"REJECT\" /* REJECT */,\n /** Set the default ignored resolution behavior. See {@link ResolveIgnored} for all options. */\n resolveIgnored: \"WITH_LAST\" /* WITH_LAST */\n};\nvar deferred_default = deferred;\n\n// src/deferredCallback.ts\nfunction deferredCallback(callback, options = {}) {\n const { thisArg } = options;\n if (thisArg !== void 0) callback = callback.bind(thisArg);\n const deferPromise = deferred_default(options);\n return (...args) => deferPromise(() => callback(...args));\n}\nvar deferredCallback_default = deferredCallback;\n\n// src/delay.ts\nimport { fallbackIfFails as fallbackIfFails3, isFn as isFn3 } from \"@superutils/core\";\nfunction delay(duration = delay.defaults.duration, result, asRejected = false) {\n const promise = new PromisEBase_default();\n const finalize = (result2) => {\n const _result = fallbackIfFails3(\n async () => {\n const _result2 = await (isFn3(result2) ? result2() : result2);\n return !asRejected ? _result2 != null ? _result2 : duration : _result2 != null ? _result2 : new Error(\n `${delay.defaults.delayTimeoutMsg} ${duration}ms`\n );\n },\n [],\n // when result is a function and it fails/rejects,\n // promise will reject even if `asRejected = false`\n (err) => Promise.reject(err)\n );\n !asRejected ? promise.resolve(_result) : _result.then(promise.reject, promise.reject);\n };\n promise.timeoutId = setTimeout(() => finalize(result), duration);\n promise.pause = () => clearTimeout(promise.timeoutId);\n promise.catch(() => {\n }).finally(() => promise.pause());\n promise.onEarlyFinalize.push(() => promise.pause());\n return promise;\n}\ndelay.defaults = {\n /** Default delay duration in milliseconds */\n duration: 100,\n /** Default timed out message (if `result` is not provided) */\n delayTimeoutMsg: \"Timed out after\"\n};\nvar delay_default = delay;\n\n// src/delayReject.ts\nfunction delayReject(duration, reason) {\n return delay_default(duration, reason, true);\n}\nvar delayReject_default = delayReject;\n\n// src/retry.ts\nimport {\n fallbackIfFails as fallbackIfFails4,\n isEmpty,\n isPositiveInteger,\n objCopy as objCopy2\n} from \"@superutils/core\";\nvar retry = async (func, options) => {\n var _a, _b;\n options = objCopy2(retry.defaults, options != null ? options : {}, [], (key, value) => {\n switch (key) {\n // case 'retryDelayJitter':\n // \treturn true\n case \"retry\":\n // eslint-disable-next-line no-fallthrough\n case \"retryDelay\":\n case \"retryDelayJitterMax\":\n return value !== 0 && !isPositiveInteger(value);\n }\n return !!isEmpty(value);\n });\n const {\n retry: maxRetries,\n retryBackOff,\n retryDelay,\n retryDelayJitter,\n retryDelayJitterMax\n } = options;\n let _retryDelay = retryDelay;\n let retryCount = -1;\n let result;\n let error;\n let shouldRetry = false;\n do {\n retryCount++;\n if (retryBackOff === \"exponential\" && retryCount > 1) _retryDelay *= 2;\n if (retryDelayJitter)\n _retryDelay += Math.floor(Math.random() * retryDelayJitterMax);\n if (retryCount > 0) await delay_default(_retryDelay);\n try {\n error = void 0;\n result = await func();\n } catch (err) {\n error = err;\n }\n if (maxRetries === 0 || retryCount >= maxRetries) break;\n shouldRetry = !!((_b = await fallbackIfFails4(\n (_a = options.retryIf) != null ? _a : error,\n // if `retryIf` not provided, retry on error\n [result, retryCount, error],\n error\n // if `retryIf` throws error, default to retry on error\n )) != null ? _b : error);\n } while (shouldRetry);\n if (error !== void 0) return Promise.reject(error);\n return result;\n};\nretry.defaults = {\n retry: 1,\n retryBackOff: \"exponential\",\n retryDelay: 300,\n retryDelayJitter: true,\n retryDelayJitterMax: 100\n};\nvar retry_default = retry;\n\n// src/timeout.ts\nimport {\n arrUnique as arrUnique2,\n isFn as isFn4,\n isNumber,\n isObj as isObj2,\n isPositiveNumber as isPositiveNumber2,\n objCopy as objCopy3\n} from \"@superutils/core\";\n\n// src/TimeoutPromise.ts\nimport { arrUnique, fallbackIfFails as fallbackIfFails5, isObj } from \"@superutils/core\";\nvar TIMEOUT_FALLBACK = 1e4;\nvar TIMEOUT_MAX = 2147483647;\nvar TimeoutPromise = class extends PromisEBase_default {\n constructor(data, timeout2, options, _signals) {\n super(data);\n this.started = /* @__PURE__ */ new Date();\n this._setup = () => {\n var _a, _b, _c, _d;\n this._signals = arrUnique(\n [(_b = (_a = this.options) == null ? void 0 : _a.abortCtrl) == null ? void 0 : _b.signal, (_c = this.options) == null ? void 0 : _c.signal].filter(\n Boolean\n )\n );\n !this.onEarlyFinalize.includes(this._handleEarlyFinalize) && this.onEarlyFinalize.push(this._handleEarlyFinalize);\n !this.onFinalize.includes(this._handleFinalize) && this.onFinalize.push(this._handleFinalize);\n (_d = this._signals) == null ? void 0 : _d.forEach(\n (signal) => signal == null ? void 0 : signal.addEventListener(\n \"abort\",\n this._handleAbort\n )\n );\n };\n this._handleAbort = async () => {\n var _a, _b, _c;\n if (!((_a = this._signals) == null ? void 0 : _a.length) || !this.pending) return;\n let err = await fallbackIfFails5((_b = this.options) == null ? void 0 : _b.onAbort, [], void 0);\n err != null ? err : err = new Error(\n `Aborted after ${(/* @__PURE__ */ new Date()).getTime() - this.started.getTime()}ms`\n );\n (_c = err.name) != null ? _c : err.name = \"AbortError\";\n this.reject(err);\n };\n this._handleEarlyFinalize = () => {\n var _a, _b, _c, _d;\n ((_a = this.options) == null ? void 0 : _a.abortOnEarlyFinalize) && ((_d = (_c = (_b = this.options) == null ? void 0 : _b.abortCtrl) == null ? void 0 : _c.abort) == null ? void 0 : _d.call(_c));\n };\n // cleanup after execution\n this._handleFinalize = ((_, err) => {\n var _a, _b, _c, _d, _e;\n this.cancelAbort();\n this.clearTimeout();\n if (!this.timeout.rejected && !((_a = this._signals) == null ? void 0 : _a.find((x) => x == null ? void 0 : x.aborted)))\n return;\n ((_d = (_c = (_b = this.options) == null ? void 0 : _b.abortCtrl) == null ? void 0 : _c.signal) == null ? void 0 : _d.aborted) === false && ((_e = this.options) == null ? void 0 : _e.abortCtrl.abort(err));\n });\n this.data = data;\n this.options = isObj(options) ? options : {};\n this.timeout = timeout2;\n this._signals = _signals;\n this._setup();\n }\n get abortCtrl() {\n return this.options.abortCtrl;\n }\n get aborted() {\n var _a;\n return this.rejected && !this.timeout.rejected && !!((_a = this._signals) == null ? void 0 : _a.find((s) => s == null ? void 0 : s.aborted));\n }\n cancelAbort() {\n var _a;\n (_a = this._signals) == null ? void 0 : _a.forEach(\n (signal) => signal == null ? void 0 : signal.removeEventListener(\n \"abort\",\n this._handleAbort\n )\n );\n }\n clearTimeout() {\n clearTimeout(this.timeout.timeoutId);\n }\n get timedout() {\n return this.rejected && this.timeout.rejected;\n }\n};\nvar TimeoutPromise_default = TimeoutPromise;\n\n// src/timeout.ts\nfunction timeout(options, ...values) {\n var _a;\n const opts = objCopy3(\n timeout.defaults,\n isNumber(options) ? { timeout: options } : isObj2(options) ? options : {},\n [],\n \"empty\"\n );\n opts.timeout = Math.min(\n isPositiveNumber2(opts.timeout) ? opts.timeout : TIMEOUT_FALLBACK,\n TIMEOUT_MAX\n );\n const promises = values.map(\n (v) => isFn4(v) ? PromisEBase_default.try(v) : v\n );\n const dataPromise = promises.length <= 1 ? (\n // single promise resolves to a single result\n promises[0] instanceof PromisEBase_default ? promises[0] : new PromisEBase_default(promises[0])\n ) : (\n // multiple promises resolve to an array of results\n (isFn4(PromisEBase_default[opts.batchFunc]) ? PromisEBase_default[opts.batchFunc] : PromisEBase_default.all)(promises)\n );\n const timeoutPromise = delayReject_default(opts.timeout, opts.onTimeout);\n return new TimeoutPromise_default(\n PromisEBase_default.race([dataPromise, timeoutPromise]),\n timeoutPromise,\n opts,\n arrUnique2(\n [(_a = opts.abortCtrl) == null ? void 0 : _a.signal, opts.signal].filter(Boolean)\n )\n );\n}\ntimeout.defaults = {\n abortOnEarlyFinalize: true,\n batchFunc: \"all\",\n timeout: TIMEOUT_FALLBACK\n};\nvar timeout_default = timeout;\n\n// src/PromisE.ts\nvar PromisE = class extends PromisEBase_default {\n};\nPromisE.deferred = deferred_default;\nPromisE.deferredCallback = deferredCallback_default;\nPromisE.delay = delay_default;\nPromisE.delayReject = delayReject_default;\nPromisE.retry = retry_default;\nPromisE.timeout = timeout_default;\nvar PromisE_default = PromisE;\n\n// src/index.ts\nvar index_default = PromisE_default;\nexport {\n PromisE,\n PromisEBase,\n ResolveError,\n ResolveIgnored,\n TIMEOUT_FALLBACK,\n TIMEOUT_MAX,\n TimeoutPromise,\n index_default as default,\n deferred,\n deferredCallback,\n delay,\n delayReject,\n retry,\n timeout\n};\n","// src/curry.ts\nfunction curry(func, ...[arity = func.length]) {\n const curriedFn = (...args) => {\n const _args = args;\n if (_args.length >= arity) return func(...args);\n return (...nextArgs) => curriedFn(\n ..._args,\n ...nextArgs\n );\n };\n return curriedFn;\n}\n\n// src/is/isObj.ts\nvar isObj = (x, strict = true) => !!x && typeof x === \"object\" && (!strict || [\n Object.prototype,\n null\n // when an object is created using `Object.create(null)`\n].includes(Object.getPrototypeOf(x)));\nvar isObj_default = isObj;\n\n// src/is/isArr.ts\nvar isArr = (x) => Array.isArray(x);\nvar isArrObj = (x, strict = true) => isArr(x) && x.every((x2) => isObj(x2, strict));\nvar isArr2D = (x) => isArr(x) && x.every(isArr);\nvar isArrLike = (x) => isArr(x) || x instanceof Set || x instanceof Map;\nvar isArrLikeSafe = (x) => [\"[object Array]\", \"[object Map]\", \"[object Set]\"].includes(\n Object.prototype.toString.call(x)\n);\nvar isArrUnique = (x) => isArr(x) && new Set(x).size === x.length;\nvar isUint8Arr = (x) => x instanceof Uint8Array;\nvar isArr_default = isArr;\n\n// src/is/isDate.ts\nvar isDate = (x) => x instanceof Date;\nvar isDateValid = (date) => {\n const dateIsStr = typeof date === \"string\";\n if (!dateIsStr && !isDate(date)) return false;\n const dateObj = new Date(date);\n if (Number.isNaN(dateObj.getTime())) return false;\n if (!dateIsStr) return true;\n const [original, converted] = [date, dateObj.toISOString()].map(\n (y) => y.replace(/[TZ]/g, \"\").substring(0, 10)\n );\n return original === converted;\n};\nvar isDate_default = isDate;\n\n// src/is/isNumber.ts\nvar isInteger = (x) => Number.isInteger(x);\nvar isNegativeInteger = (x) => Number.isInteger(x) && x < 0;\nvar isNegativeNumber = (x) => isNumber(x) && x < 0;\nvar isNumber = (x) => typeof x === \"number\" && !Number.isNaN(x) && Number.isFinite(x);\nvar isPositiveInteger = (x) => isInteger(x) && x > 0;\nvar isPositiveNumber = (x) => isNumber(x) && x > 0;\n\n// src/is/isEmpty.ts\nvar isEmpty = (x, nonNumerable = false, fallback = false) => {\n if (x === null || x === void 0) return true;\n switch (typeof x) {\n case \"number\":\n return !isNumber(x);\n case \"string\":\n return !x.replaceAll(\"\t\", \"\").trim().length;\n case \"boolean\":\n case \"bigint\":\n case \"symbol\":\n case \"function\":\n return false;\n }\n if (x instanceof Date) return Number.isNaN(x.getTime());\n if (x instanceof Map || x instanceof Set) return !x.size;\n if (Array.isArray(x) || x instanceof Uint8Array) return !x.length;\n if (x instanceof Error) return !x.message.length;\n const proto = typeof x === \"object\" && Object.getPrototypeOf(x);\n if (proto === Object.prototype || proto === null) {\n return nonNumerable ? !Object.getOwnPropertyNames(x).length : !Object.keys(x).length;\n }\n return fallback;\n};\nvar isEmptySafe = (x, numberableOnly = false) => {\n const empty = isEmpty(x, numberableOnly, 0);\n if (empty !== 0) return empty;\n switch (Object.prototype.toString.call(x)) {\n case \"[object Uint8Array]\":\n return !x.length;\n case \"[object Date]\":\n return Number.isNaN(x.getTime());\n case \"[object Map]\":\n return !x.size;\n case \"[object Object]\":\n return !Object.keys(x).length;\n case \"[object Set]\":\n return !x.size;\n default:\n return false;\n }\n};\nvar isEmpty_default = isEmpty;\n\n// src/is/isEnv.ts\nvar isEnvBrowser = () => typeof window !== \"undefined\" && typeof (window == null ? void 0 : window.document) !== \"undefined\";\nvar isEnvNode = () => {\n var _a;\n return typeof process !== \"undefined\" && ((_a = process == null ? void 0 : process.versions) == null ? void 0 : _a.node) != null;\n};\nvar isEnvTouchable = () => {\n var _a, _b;\n return typeof window !== \"undefined\" && \"ontouchstart\" in ((_b = (_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement) != null ? _b : {});\n};\n\n// src/noop.ts\nfunction noop() {\n}\nasync function noopAsync() {\n}\n\n// src/is/isFn.ts\nvar isFn = (x) => typeof x === \"function\";\nvar isAsyncFn = (x) => x instanceof noopAsync.constructor && x[Symbol.toStringTag] === \"AsyncFunction\";\nvar isFn_default = isFn;\n\n// src/is/isMap.ts\nvar isMap = (x) => x instanceof Map;\nvar isMapObj = (x, strict = true) => isMap(x) && [...x.values()].every((value) => isObj_default(value, strict));\n\n// src/is/isUrl.ts\nvar isUrl = (x) => x instanceof URL;\nvar isUrlValid = (x, strict = true, tldExceptions = [\"localhost\"]) => {\n if (!x) return false;\n try {\n if (typeof x !== \"string\" && !isUrl(x)) return false;\n const url = isUrl(x) ? x : new URL(x);\n if (!strict) return true;\n const gotTld = tldExceptions.includes(url.hostname) || url.host.split(\".\").length > 1;\n if (!gotTld) return false;\n let y = `${x}`;\n if (y.endsWith(url.hostname)) y += \"/\";\n return url.href === y;\n } catch (_) {\n return false;\n }\n};\nvar isUrl_default = isUrl;\n\n// src/is/index.ts\nvar isBool = (x) => typeof x === \"boolean\" || x instanceof Boolean;\nvar isDefined = (x) => x !== void 0 && x !== null;\nvar isError = (x) => x instanceof Error;\nvar isPromise = (x) => x instanceof Promise;\nvar isRegExp = (x) => x instanceof RegExp;\nvar isSet = (x) => x instanceof Set;\nvar isStr = (x) => typeof x === \"string\";\nvar isSubjectLike = (x, withValue = false) => isObj_default(x, false) && isFn_default(x.subscribe) && isFn_default(x.next) && (!withValue || \"value\" in x);\nvar isSymbol = (x) => typeof x === \"symbol\";\nvar is = {\n arr: isArr_default,\n arr2D: isArr2D,\n arrLike: isArrLike,\n arrLikeSafe: isArrLikeSafe,\n arrObj: isArrObj,\n arrUnique: isArrUnique,\n asyncFn: isAsyncFn,\n bool: isBool,\n date: isDate_default,\n dateValid: isDateValid,\n defined: isDefined,\n empty: isEmpty_default,\n emptySafe: isEmptySafe,\n envBrowser: isEnvBrowser,\n envNode: isEnvNode,\n envTouchable: isEnvTouchable,\n error: isError,\n fn: isFn_default,\n integer: isInteger,\n map: isMap,\n mapObj: isMapObj,\n negativeInteger: isNegativeInteger,\n negativeNumber: isNegativeNumber,\n number: isNumber,\n obj: isObj_default,\n positiveInteger: isPositiveInteger,\n positiveNumber: isPositiveNumber,\n promise: isPromise,\n regExp: isRegExp,\n set: isSet,\n str: isStr,\n subjectLike: isSubjectLike,\n symbol: isSymbol,\n uint8Arr: isUint8Arr,\n url: isUrl_default,\n urlValid: isUrlValid\n};\n\n// src/fallbackIfFails.ts\nvar fallbackIfFails = (target, args, fallback) => {\n try {\n const result = !isFn(target) ? target : target(...isFn(args) ? args() : args);\n if (!isPromise(result)) return result;\n return result.catch(\n (err) => isFn(fallback) ? fallback(err) : fallback\n );\n } catch (err) {\n return isFn(fallback) ? fallback(err) : fallback;\n }\n};\nvar fallbackIfFails_default = fallbackIfFails;\n\n// src/toDatetimeLocal.ts\nvar toDatetimeLocal = (dateStr) => {\n const date = new Date(dateStr);\n if (!isDateValid(date)) return \"\";\n const year = date.getFullYear();\n const month = (date.getMonth() + 1).toString().padStart(2, \"0\");\n const day = date.getDate().toString().padStart(2, \"0\");\n const hours = date.getHours().toString().padStart(2, \"0\");\n const minutes = date.getMinutes().toString().padStart(2, \"0\");\n const res = `${year}-${month}-${day}T${hours}:${minutes}`;\n return res;\n};\n(/* @__PURE__ */ new Date()).getTime();\n\n// src/obj/objClean.ts\nvar objClean = (obj, keys, ignoreIfNotExist = true) => {\n const result = {};\n if (!isObj(obj) || !isArr(keys)) return result;\n const uniqKeys = arrUnique(\n keys.map((x) => String(x).split(\".\")[0])\n ).sort();\n for (const key of uniqKeys) {\n if (ignoreIfNotExist && !obj.hasOwnProperty(key)) continue;\n const value = obj[key];\n if (!isObj(value) || isSymbol(key)) {\n result[key] = value;\n continue;\n }\n const childPrefix = `${key}.`;\n const childKeys = keys.filter((k) => {\n var _a;\n return (_a = k == null ? void 0 : k.startsWith) == null ? void 0 : _a.call(k, childPrefix);\n }).map((k) => k.split(childPrefix)[1]);\n if (!childKeys.length) {\n result[key] = value;\n continue;\n }\n result[key] = objClean(\n value,\n childKeys\n );\n }\n return result;\n};\n\n// src/obj/objKeys.ts\nvar objKeys = (obj, sorted = true, includeSymbols = true) => (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n fallbackIfFails_default(\n () => [\n ...includeSymbols && Object.getOwnPropertySymbols(obj) || [],\n ...sorted ? Object.keys(obj).sort() : Object.keys(obj)\n ],\n [],\n []\n )\n);\nvar objKeys_default = objKeys;\n\n// src/obj/objCopy.ts\nvar clone = (value, fallback = \"null\") => JSON.parse(fallbackIfFails_default(JSON.stringify, [value], fallback));\nvar objCopy = (input, output, ignoreKeys, override = false, recursive = true) => {\n const _output = isObj(output, false) || isFn(output) ? output : {};\n if (!isObj(input, false) && !isFn(output)) return _output;\n const _ignoreKeys = new Set(ignoreKeys != null ? ignoreKeys : []);\n const inKeys = objKeys_default(input, true, true).filter(\n (x) => !_ignoreKeys.has(x)\n );\n for (const _key of inKeys) {\n const key = _key;\n const value = input[key];\n const skip = _output.hasOwnProperty(key) && (override === \"empty\" ? !isEmpty(_output[key]) : isFn(override) ? !override(key, _output[key], value) : true);\n if (skip) continue;\n const isPrimitive = [void 0, null, Infinity, NaN].includes(value) || !isObj(value, false);\n if (isPrimitive) {\n _output[key] = value;\n continue;\n }\n _output[key] = (() => {\n switch (Object.getPrototypeOf(value)) {\n case Array.prototype:\n return clone(value, \"[]\");\n case ArrayBuffer.prototype:\n return value.slice(0);\n case Date.prototype:\n return new Date(value.getTime());\n case Map.prototype:\n return new Map(\n clone(\n Array.from(\n value\n ),\n \"[]\"\n )\n );\n case RegExp.prototype:\n return new RegExp(value);\n case Set.prototype:\n return new Set(\n clone(Array.from(value))\n );\n case Uint8Array.prototype:\n return new Uint8Array([...value]);\n case URL.prototype:\n return new URL(value);\n default:\n break;\n }\n if (isSymbol(key) || !recursive) return clone(value);\n const ignoreChildKeys = [..._ignoreKeys].map(\n (x) => String(x).startsWith(String(key).concat(\".\")) && String(x).split(String(key).concat(\".\"))[1]\n ).filter(Boolean);\n if (!ignoreChildKeys.length) return clone(value);\n return objCopy(\n value,\n _output[key],\n ignoreChildKeys,\n override,\n recursive\n );\n })();\n }\n return _output;\n};\n\n// src/obj/objCreate.ts\nvar objCreate = (keys = [], values = [], result) => {\n if (!isObj(result)) result = {};\n for (let i = 0; i < (isArr(keys) ? keys : []).length; i++) {\n ;\n result[keys[i]] = values == null ? void 0 : values[i];\n }\n return result;\n};\n\n// src/obj/objHasKeys.ts\nfunction objHasKeys(input = {}, keys = [], requireValue = false) {\n if (!isObj(input) || !isArr(keys)) return false;\n for (const key of keys) {\n if (!input.hasOwnProperty(key)) return false;\n if (requireValue && isEmpty(input[key])) return false;\n }\n return true;\n}\n\n// src/obj/objReadOnly.ts\nvar objReadOnly = (obj, config) => {\n if (!isObj(obj, false)) obj = {};\n const { add, revocable, silent = true } = config != null ? config : {};\n const [typeTitle, keyTitle] = isArr(obj) ? [\"array\", \"index\"] : [\"object\", \"property name\"];\n function handleSetProp(obj2, key, value) {\n const isUpdate = obj2[key] !== void 0;\n if (isUpdate && silent) return true;\n const allowAddition = !isUpdate && (!isFn(add) ? add : add(obj2, key, value));\n const shouldThrow = !silent && (isUpdate || !allowAddition);\n if (shouldThrow)\n throw new TypeError(\n `Mutation not allow on read-only ${typeTitle} ${keyTitle}: ${key.toString()}`\n );\n if (!allowAddition) return true;\n obj2[key] = value;\n return true;\n }\n const proxyHandler = {\n get: (obj2, key) => obj2[key],\n set: handleSetProp,\n defineProperty: (obj2, key, { value }) => handleSetProp(obj2, key, value),\n // Prevent removal of properties\n deleteProperty: (obj2, key) => {\n if (!silent && obj2.hasOwnProperty(key)) {\n throw new Error(\n `Mutation not allow on read-only ${typeTitle} ${keyTitle}: ${key.toString()}`\n );\n }\n return true;\n }\n };\n return revocable ? Proxy.revocable(obj, proxyHandler) : new Proxy(obj, proxyHandler);\n};\n\n// src/obj/objSetProp.ts\nvar objSetProp = (obj, key, falsyValue, condition, truthyValue) => {\n var _a;\n const result = !isObj(obj, false) ? {} : obj;\n falsyValue != null ? falsyValue : falsyValue = result[key];\n condition = isFn(condition) ? condition((_a = result[key]) != null ? _a : falsyValue, key, obj) : condition;\n result[key] = !condition ? falsyValue : truthyValue;\n return result;\n};\nvar objSetPropUndefined = (...[obj, key, ...args]) => (obj == null ? void 0 : obj[key]) === void 0 && objSetProp(obj, key, ...args) || obj;\n\n// src/obj/objSort.ts\nvar objSort = (obj, recursive = true, _done = /* @__PURE__ */ new Map()) => {\n const sorted = {};\n if (!isObj(obj)) return sorted;\n for (const key of objKeys_default(obj)) {\n const value = obj[key];\n _done.set(value, true);\n sorted[key] = !recursive || !isObj(value) ? value : objSort(\n value,\n recursive,\n _done\n );\n }\n return sorted;\n};\n\n// src/obj/objWithoutKeys.ts\nvar objWithoutKeys = (input, keys, output) => {\n if (!isObj(input, false)) return {};\n if (!isArr(keys) || !keys.length) return input;\n output = {\n ...isObj(output, false) && output,\n ...input\n };\n for (const key of keys) delete output[key];\n return output;\n};\n\n// src/arr/arrReadOnly.ts\nvar arrReadOnly = (arr, config = {}) => objReadOnly(new ReadOnlyArrayHelper(config, arr), config);\nvar ReadOnlyArrayHelper = class extends Array {\n constructor(config, arr) {\n var _a;\n (_a = config.silent) != null ? _a : config.silent = true;\n super(...arr);\n this.config = config;\n this.ignoreOrThrow = (returnValue) => {\n if (this.config.silent) return returnValue;\n throw new Error(\"Mutation not allowed on read-only array\");\n };\n this.pop = () => this.ignoreOrThrow(this[this.length - 1]);\n this.push = (...items) => !this.config.add ? this.ignoreOrThrow(this.length) : super.push(...items);\n this.reverse = () => this.ignoreOrThrow(this);\n this.shift = () => this.ignoreOrThrow(this[0]);\n this.splice = (..._ignoredArgs) => this.ignoreOrThrow([]);\n this.unshift = (..._ignoredArgs) => this.ignoreOrThrow(this.length);\n }\n // fromAsync = super.fromAsync\n // reduce = super.reduce\n // reduceRight = super.reduceRight\n};\n\n// src/arr/arrReverse.ts\nvar arrReverse = (arr, reverse2 = true, newArray = false) => {\n if (!isArr(arr)) return [];\n if (newArray) arr = [...arr];\n return reverse2 ? arr.reverse() : arr;\n};\n\n// src/arr/arrToMap.ts\nfunction arrToMap(arr, key, flatDepth = 0) {\n ;\n [key, flatDepth] = isNumber(key) ? [void 0, key] : [key, flatDepth];\n const flatEntries = (!isArr(arr) ? [] : flatDepth > 0 ? arr.flat(flatDepth) : arr).map((item, i, flatArr) => {\n var _a;\n return [\n (_a = isFn(key) ? key(item, i, flatArr) : isObj(item) && isDefined(key) ? item[key] : i) != null ? _a : i,\n item\n ];\n });\n return new Map(flatEntries);\n}\n\n// src/arr/arrUnique.ts\nvar arrUnique = (arr, flatDepth = 0) => !isArr(arr) ? [] : Array.from(new Set(arr.flat(flatDepth)));\n\n// src/deferred/debounce.ts\nvar debounce = (callback, delay = 50, config = {}) => {\n const {\n leading = debounce.defaults.leading,\n onError = debounce.defaults.onError,\n thisArg\n } = config;\n let { tid } = config;\n if (thisArg !== void 0) callback = callback.bind(thisArg);\n const _callback = (...args) => fallbackIfFails_default(callback, args, onError);\n let firstArgs = null;\n const leadingGlobal = leading === \"global\";\n return (...args) => {\n clearTimeout(tid);\n tid = setTimeout(() => {\n firstArgs !== args && _callback(...args);\n firstArgs = leadingGlobal ? true : null;\n }, delay);\n if (!leading || firstArgs) return;\n firstArgs = args;\n _callback(...args);\n };\n};\ndebounce.defaults = {\n /**\n * Set the default value of argument `leading` for the `deferred` function.\n * This change is applicable application-wide and only applies to any new invocation of `deferred()`.\n */\n leading: false,\n /**\n * Set the default value of argument `onError` for the `deferred` function.\n * This change is applicable application-wide and only applies to any new invocation of `deferred()`.\n */\n onError: void 0\n};\nvar debounce_default = debounce;\n\n// src/deferred/throttle.ts\nvar throttle = (callback, delay = 50, config = {}) => {\n const { defaults: d } = throttle;\n const { onError = d.onError, trailing = d.trailing, thisArg } = config;\n let { tid } = config;\n const handleCallback = (...args) => fallbackIfFails_default(\n thisArg !== void 0 ? callback.bind(thisArg) : callback,\n args,\n !isFn(onError) ? void 0 : (err) => fallbackIfFails_default(onError, [err], void 0)\n );\n let trailArgs = null;\n return (...args) => {\n if (tid) {\n trailArgs = args;\n return;\n }\n tid = setTimeout(() => {\n tid = void 0;\n if (!trailing) return;\n const cbArgs = trailArgs;\n trailArgs = null;\n cbArgs && cbArgs !== args && handleCallback(...cbArgs);\n }, delay);\n handleCallback(...args);\n };\n};\nthrottle.defaults = {\n onError: void 0,\n trailing: false\n};\nvar throttled = throttle;\nvar throttle_default = throttle;\n\n// src/deferred/deferred.ts\nvar deferred = (callback, delay = 50, config = {}) => config.throttle ? throttle_default(callback, delay, config) : debounce_default(callback, delay, config);\n\n// src/iterable/filter.ts\nvar filter = (data, predicate, limit, asArray, result) => {\n var _a;\n if (!isMap(result)) result = /* @__PURE__ */ new Map();\n if (!isPositiveInteger(limit)) limit = Infinity;\n for (const [key, item] of ((_a = data == null ? void 0 : data.entries) == null ? void 0 : _a.call(data)) || []) {\n if (result.size >= limit) break;\n fallbackIfFails_default(predicate != null ? predicate : item, [item, key, data], false) && result.set(key, item);\n }\n return asArray ? [...result.values()] : result;\n};\nvar filter_default = filter;\n\n// src/iterable/getSize.ts\nvar getSize = (x) => {\n if (!x) return 0;\n try {\n const s = \"size\" in x ? x.size : \"length\" in x ? x.length : 0;\n return isNumber(s) ? s : 0;\n } catch (_) {\n return 0;\n }\n};\nvar getSize_default = getSize;\n\n// src/iterable/getValues.ts\nvar getValues = (data) => {\n var _a;\n return [\n ...((_a = data == null ? void 0 : data.values) == null ? void 0 : _a.call(data)) || []\n ];\n};\nvar getValues_default = getValues;\n\n// src/iterable/search.ts\nvar search = (data, options) => {\n var _a;\n const ignore = !getSize_default(data) || isEmpty(options == null ? void 0 : options.query);\n const result = isMap(options == null ? void 0 : options.result) ? options.result : /* @__PURE__ */ new Map();\n const asMap = (_a = options == null ? void 0 : options.asMap) != null ? _a : search.defaults.asMap;\n if (ignore) return asMap ? result : getValues_default(result);\n options = objCopy(\n search.defaults,\n options,\n [],\n \"empty\"\n // override `option` property with default value when \"empty\" (undefined, null, '',....)\n );\n const {\n ignoreCase,\n limit = Infinity,\n matchAll,\n matchExact,\n ranked\n } = options;\n let { query } = options;\n const qIsStr = isStr(query);\n const qIsRegExp = isRegExp(query);\n const qKeys = fallbackIfFails_default(Object.keys, [query], []);\n if (ignoreCase && !matchExact && !qIsRegExp) {\n query = qIsStr ? query.toLowerCase() : objCreate(\n qKeys,\n Object.values(query).map(\n (x) => isRegExp(x) ? x : `${x}`.toLowerCase()\n )\n );\n }\n options.query = query;\n if (!ranked) {\n for (const [dataKey, dataValue] of data.entries()) {\n if (result.size >= limit) break;\n const matched = qIsStr || qIsRegExp ? (\n // global search across all properties\n matchObjOrProp(options, dataValue, void 0) >= 0\n ) : (\n // field-specific search\n qKeys[matchAll ? \"every\" : \"some\"](\n (key) => matchObjOrProp(options, dataValue, key) >= 0\n )\n );\n if (!matched) continue;\n result.set(dataKey, dataValue);\n }\n } else {\n const preRankedResults = [];\n for (const [dataKey, dataValue] of data.entries()) {\n let matchIndex = -1;\n if (qIsStr || qIsRegExp) {\n matchIndex = matchObjOrProp(options, dataValue, void 0);\n matchIndex >= 0 && preRankedResults.push([matchIndex, dataKey, dataValue]);\n continue;\n }\n const indexes = [];\n const match = qKeys[matchAll ? \"every\" : \"some\"](\n // field-specific search\n (key) => {\n const index = matchObjOrProp(options, dataValue, key);\n indexes.push(index);\n return index >= 0;\n }\n );\n if (!match) continue;\n matchIndex = // eslint-disable-next-line @typescript-eslint/prefer-find\n indexes.sort((a, b) => a - b).filter((n) => n !== -1)[0];\n matchIndex >= 0 && preRankedResults.push([matchIndex, dataKey, dataValue]);\n }\n preRankedResults.sort((a, b) => a[0] - b[0]).slice(0, limit).forEach(([_, key, value]) => result.set(key, value));\n }\n return asMap ? result : getValues_default(result);\n};\nsearch.defaults = {\n asMap: true,\n ignoreCase: true,\n limit: Infinity,\n matchAll: false,\n ranked: false,\n transform: true\n};\nfunction matchObjOrProp({\n query,\n ignoreCase,\n matchExact,\n transform = true\n}, item, propertyName) {\n var _a, _b;\n const global = isStr(query) || isRegExp(query) || propertyName === void 0;\n const keyword = global ? query : query[propertyName];\n const propVal = global || !isObj(item) ? item : item[propertyName];\n const value = fallbackIfFails_default(\n () => isFn(transform) ? transform(\n item,\n global ? void 0 : propVal,\n propertyName\n ) : matchExact && transform === false ? propVal : isObj(propVal, false) ? JSON.stringify(\n isArrLike(propVal) ? [...propVal.values()] : Object.values(propVal)\n ) : String(propVal != null ? propVal : \"\"),\n [],\n \"\"\n );\n if (value === keyword) return 0;\n if (matchExact && !isRegExp(keyword)) return -1;\n let valueStr = String(value);\n if (!valueStr.trim()) return -1;\n if (isRegExp(keyword)) return (_b = (_a = valueStr.match(keyword)) == null ? void 0 : _a.index) != null ? _b : -1;\n if (ignoreCase) valueStr = valueStr.toLowerCase();\n return valueStr.indexOf(String(keyword));\n}\nvar search_default = search;\n\n// src/iterable/find.ts\nfunction find(data, optsOrCb) {\n const result = isFn(optsOrCb) ? filter_default(data, optsOrCb, 1) : search_default(data, { ...optsOrCb, asMap: true, limit: 1 });\n return result[\n (optsOrCb == null ? void 0 : optsOrCb.includeKey) ? \"entries\" : \"values\"\n // returns: value\n ]().next().value;\n}\n\n// src/iterable/getEntries.ts\nvar getEntries = (map) => {\n var _a;\n return [\n ...((_a = map == null ? void 0 : map.entries) == null ? void 0 : _a.call(map)) || []\n ];\n};\n\n// src/iterable/getKeys.ts\nvar getKeys = (data) => {\n var _a;\n return [\n ...((_a = data == null ? void 0 : data.keys) == null ? void 0 : _a.call(data)) || []\n ];\n};\n\n// src/iterable/reverse.ts\nvar reverse = (data, reverse2 = true, newInstance = false) => {\n var _a, _b, _c;\n const dataType = isArr(data) ? 1 : isMap(data) ? 2 : isSet(data) ? 3 : 0;\n if (!dataType) return [];\n const arr = dataType === 1 ? !newInstance ? data : [...data] : dataType === 2 ? [...data.entries()] : [...data.values()];\n if (reverse2) arr.reverse();\n switch (dataType) {\n case 1:\n return arr;\n case 2:\n case 3:\n if (newInstance || !(\"clear\" in data && isFn(data.clear)))\n return dataType === 2 ? new Map(arr) : new Set(arr);\n }\n (_a = data == null ? void 0 : data.clear) == null ? void 0 : _a.call(data);\n for (const item of arr)\n \"set\" in data ? (_b = data.set) == null ? void 0 : _b.call(data, ...item) : \"add\" in data && ((_c = data == null ? void 0 : data.add) == null ? void 0 : _c.call(data, item));\n return data;\n};\n\n// src/iterable/sliceMap.ts\nvar sliceMap = (data, options) => {\n var _a;\n const {\n asMap = false,\n end,\n start = 0,\n transform,\n ignoreEmpty = true\n } = isFn(options) ? { transform: options } : isObj(options) ? options : {};\n const result = /* @__PURE__ */ new Map();\n const subset = [...((_a = data == null ? void 0 : data.entries) == null ? void 0 : _a.call(data)) || []].slice(start, end);\n for (const [_, [key, value]] of subset.entries()) {\n if (ignoreEmpty && isEmpty(value)) continue;\n const newValue = fallbackIfFails_default(\n transform != null ? transform : value,\n [value, key, data],\n void 0\n );\n newValue !== void 0 && result.set(key, newValue);\n }\n return asMap ? result : [...result.values()];\n};\n\n// src/iterable/sort.ts\nfunction sort(data, keyOrFn, options) {\n const dataType = isArr(data) ? 1 : isMap(data) ? 2 : isSet(data) ? 3 : 0;\n if (!dataType) return data;\n const { asString, ignoreCase, newInstance, reverse: reverse2, undefinedFirst } = {\n ...sort.defaults,\n ...isObj(options) ? options : isObj(keyOrFn) ? keyOrFn : {}\n };\n if (dataType === 1 && isFn(keyOrFn)) {\n return arrReverse(\n data.sort(keyOrFn),\n // use provided comparator function\n reverse2,\n newInstance\n );\n }\n const alt = asString ? undefinedFirst ? \"\" : \"Z\".repeat(10) : undefinedFirst ? -Infinity : Infinity;\n const sorted = isFn(keyOrFn) ? arrReverse(\n // handle Set with comparator function\n [...data.entries()].sort(keyOrFn),\n reverse2,\n false\n // not required because of entries() & spread\n ) : (() => {\n let index = 1;\n const getVal = (target) => {\n const val = isObj(target) && index !== 0 ? target[keyOrFn] : target;\n if (!asString) return val;\n const value = `${val != null ? val : alt}`;\n return ignoreCase ? value.toLowerCase() : value;\n };\n const [gt, lt] = reverse2 ? [-1, 1] : [1, -1];\n if ([1, 3].includes(dataType)) {\n return (dataType === 3 || newInstance ? [...data] : data).sort((a, b) => getVal(a) > getVal(b) ? gt : lt);\n }\n index = keyOrFn === true ? 0 : 1;\n return [...data.entries()].sort(\n (a, b) => getVal(a == null ? void 0 : a[index]) > getVal(b == null ? void 0 : b[index]) ? gt : lt\n );\n })();\n if (dataType === 1) return sorted;\n if (newInstance) {\n return dataType === 2 ? new Map(sorted) : new Set(sorted);\n }\n ;\n data.clear();\n for (const entry of sorted)\n dataType === 2 ? data.set(...entry) : data.add(entry);\n return data;\n}\nsort.defaults = {\n asString: true,\n ignoreCase: true,\n newInstance: false,\n reverse: false,\n undefinedFirst: false\n};\n\n// src/map/mapJoin.ts\nvar mapJoin = (...inputs) => {\n var _a;\n return new Map(\n (_a = inputs == null ? void 0 : inputs.flatMap) == null ? void 0 : _a.call(\n inputs,\n (input) => isMap(input) ? Array.from(input.entries()) : isArr2D(input) ? input : []\n )\n );\n};\n\n// src/number/randomInt.ts\nvar randomInt = (min = 0, max = Number.MAX_SAFE_INTEGER) => parseInt(`${Math.random() * (max - min) + min}`);\n\n// src/str/clearClutter.ts\nvar clearClutter = (text, lineSeparator = \" \") => `${text}`.split(\"\\n\").map((ln) => ln.trim()).filter(Boolean).join(lineSeparator);\n\n// src/str/copyToClipboard.ts\nvar copyToClipboard = (str) => fallbackIfFails(\n // First attempt: modern clipboard API\n () => navigator.clipboard.writeText(str).then(() => 1),\n [],\n // If clipboard API is not available or fails, use the fallback method\n () => Promise.resolve(copyLegacy(str) ? 2 : 0)\n);\nvar copyLegacy = (str) => fallbackIfFails(\n () => {\n const el = document.createElement(\"textarea\");\n el.value = str;\n el.setAttribute(\"readonly\", \"\");\n el.style.position = \"absolute\";\n el.style.left = \"-9999px\";\n document.body.appendChild(el);\n el.select();\n const success = document.execCommand(\"copy\");\n document.body.removeChild(el);\n return success;\n },\n [],\n false\n // On error, return false\n);\n\n// src/str/getUrlParam.ts\nvar getUrlParam = (name, url, asArray) => {\n var _a;\n url != null ? url : url = fallbackIfFails_default(() => window.location.href, [], \"\");\n const _asArray = isArr(asArray) ? asArray : asArray === true && isStr(name) ? [name] : [];\n const prepareResult = (value = \"\", values = {}) => name ? isArr(value) || !_asArray.includes(name) ? value : [value].filter(Boolean) : values;\n if (!url) return prepareResult();\n if (typeof URLSearchParams === \"undefined\" || !URLSearchParams) {\n const r = getUrlParamRegex(name, url, _asArray);\n return prepareResult(r, r);\n }\n const search2 = isUrl(url) ? url.search : ((_a = url.split(\"?\")) == null ? void 0 : _a[1]) || \"\";\n if (search2 === \"?\" || !search2) return prepareResult();\n const params = new URLSearchParams(search2);\n const getValue = (paramName) => {\n const value = arrUnique(params.getAll(paramName));\n return value.length > 1 || _asArray.includes(paramName) ? value : value[0];\n };\n if (name) return prepareResult(getValue(name));\n const result = {};\n for (const name2 of arrUnique([...params.keys()])) {\n result[name2] = getValue(name2);\n }\n return result;\n};\nvar getUrlParamRegex = (name, url, asArray = []) => {\n url != null ? url : url = fallbackIfFails_default(() => window.location.href, [], \"\");\n if (isUrl(url)) url = url.toString();\n const params = {};\n const regex = /[?&]+([^=&]+)=([^&]*)/gi;\n url == null ? void 0 : url.replace(regex, (_, name2, value) => {\n value = decodeURIComponent(value);\n if (asArray.includes(name2) || params[name2] !== void 0) {\n params[name2] = isArr(params[name2]) ? params[name2] : [params[name2]];\n params[name2] = arrUnique([...params[name2], value]).filter(Boolean);\n } else {\n params[name2] = value;\n }\n return \"\";\n });\n return name ? params[name] : params;\n};\n\n// src/str/regex.ts\nvar EMAIL_REGEX = new RegExp(\n /^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,9}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i\n);\nvar HEX_REGEX = /^0x[0-9a-f]+$/i;\nvar HASH_REGEX = /^0x[0-9a-f]{64}$/i;\n\n// src/str/strToArr.ts\nvar strToArr = (value, seperator = \",\") => typeof value === \"string\" && value.split(seperator).filter(Boolean) || [];\nexport {\n EMAIL_REGEX,\n HASH_REGEX,\n HEX_REGEX,\n ReadOnlyArrayHelper,\n arrReadOnly,\n arrReverse,\n arrToMap,\n arrUnique,\n clearClutter,\n copyToClipboard,\n curry,\n debounce,\n deferred,\n fallbackIfFails,\n filter,\n find,\n getEntries,\n getKeys,\n getSize,\n getUrlParam,\n getValues,\n is,\n isArr,\n isArr2D,\n isArrLike,\n isArrLikeSafe,\n isArrObj,\n isArrUnique,\n isAsyncFn,\n isBool,\n isDate,\n isDateValid,\n isDefined,\n isEmpty,\n isEmptySafe,\n isEnvBrowser,\n isEnvNode,\n isEnvTouchable,\n isError,\n isFn,\n isInteger,\n isMap,\n isMapObj,\n isNegativeInteger,\n isNegativeNumber,\n isNumber,\n isObj,\n isPositiveInteger,\n isPositiveNumber,\n isPromise,\n isRegExp,\n isSet,\n isStr,\n isSubjectLike,\n isSymbol,\n isUint8Arr,\n isUrl,\n isUrlValid,\n mapJoin,\n matchObjOrProp,\n noop,\n noopAsync,\n objClean,\n objCopy,\n objCreate,\n objHasKeys,\n objKeys,\n objReadOnly,\n objSetProp,\n objSetPropUndefined,\n objSort,\n objWithoutKeys,\n randomInt,\n reverse,\n search,\n sliceMap,\n sort,\n strToArr,\n throttle,\n throttled,\n toDatetimeLocal\n};\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// Re-export fetch relevant & useful things from '@superutils/promise' for ease of use\nexport {\n\tResolveError,\n\tResolveIgnored,\n\tTIMEOUT_FALLBACK,\n\tTIMEOUT_MAX,\n\tTimeoutPromise,\n} from '@superutils/promise'\nexport type {\n\tDeferredAsyncOptions,\n\tOnEarlyFinalize,\n\tOnFinalize,\n\tRetryIfFunc,\n\tRetryOptions,\n\tTimeoutOptions,\n} from '@superutils/promise'\n\n/* All local exports */\nexport * from './createClient'\nexport * from './createPostClient'\nexport * from './executeInterceptors'\nexport * from './fetch'\nexport * from './getResponse'\nexport * from './mergeOptions'\nexport * from './types'\nimport createClient from './createClient'\nimport createPostClient from './createPostClient'\nimport _fetch from './fetch'\nimport { FetchAs, FetchCustomOptions, FetchInterceptors } from './types'\n\nconst methods = {\n\t/** Make HTTP requests with method GET */\n\tget: createClient({ method: 'get' }),\n\n\t/** Make HTTP requests with method HEAD */\n\thead: createClient({ method: 'head' }),\n\n\t/** Make HTTP requests with method OPTIONS */\n\toptions: createClient({ method: 'options' }),\n\n\t/** Make HTTP requests with method DELETE */\n\tdelete: createPostClient({ method: 'delete' }),\n\n\t/** Make HTTP requests with method PATCH */\n\tpatch: createPostClient({ method: 'patch' }),\n\n\t/** Make HTTP requests with method POST */\n\tpost: createPostClient({ method: 'post' }),\n\n\t/** Make HTTP requests with method PUT */\n\tput: createPostClient({ method: 'put' }),\n}\n\n/**\n * A `fetch()` replacement that simplifies data fetching with automatic JSON parsing, request timeouts, retries,\n * and handy interceptors that also work as transformers. It also includes deferred and throttled request\n * capabilities for complex asynchronous control flows.\n *\n * Will reject promise if response status code is not 2xx (200 <= status < 300).\n *\n * ## Method Specific Functions\n *\n * While `fetch()` provides access to all HTTP request methods by specifying it in options (eg: `{ method: 'get' }`),\n * for ease of use you can also use the following:\n *\n * - `fetch.delete(...)`\n * - `fetch.get(...)`\n * - `fetch.head(...)`\n * - `fetch.options(...)`\n * - `fetch.patch(...)`\n * - `fetch.post(...)`\n * - `fetch.put(...)`\n *\n * **Deferred variants:** To debounce/throttle requests.\n *\n * - `fetch.delete.deferred(...)`\n * - `fetch.get.deferred(...)`\n * - `fetch.head.deferred(...)`\n * - `fetch.options.deferred(...)`\n * - `fetch.patch.deferred(...)`\n * - `fetch.post.deferred(...)`\n * - `fetch.put.deferred(...)`\n *\n * @template T The type of the value that the `fetch` resolves to.\n * @template TReturn Return value type.\n *\n * If `T` is not specified defaults to the following based on the value of `options.as`:\n * - FetchAs.arrayBuffer: `ArrayBuffer`\n * - FetchAs.blob: `Blob`\n * - FetchAs.bytes: `Uint8Array<ArrayBuffer>`\n * - FetchAs.formData: `FormData`\n * - FetchAs.json: `unknown`\n * - FetchAs.text: `string`\n * - FetchAs.response: `Response`\n *\n * @param url\n * @param options (optional) Standard `fetch` options extended with {@link FetchCustomOptions}\n * @param options.abortCtrl (optional) if not provided `AbortController` will be instantiated when `timeout` used.\n *\n * Default: `new AbortController()`\n * @param options.as (optional) (optional) specify how to parse the result.\n * For raw `Response` use {@link FetchAs.response}\n *\n * Default: {@link FetchAs.json}\n * @param options.headers (optional) request headers\n *\n * Default: `{ 'content-type': 'application/json' }`\n * @param options.interceptors (optional) request interceptor/transformer callbacks.\n * See {@link FetchInterceptors} for details.\n * @param options.method (optional) fetch method.\n *\n * Default: `'get'`\n * @param options.timeout (optional) duration in milliseconds to abort the request.\n * This duration includes the execution of all interceptors/transformers.\n *\n * Default: `30_000`\n *\n *\n *\n * ---\n *\n * @example\n * #### Drop-in replacement for built-in fetch\n *\n * ```javascript\n * import fetch from '@superutils/fetch'\n *\n * fetch('https://dummyjson.com/products/1')\n * .then(response => response.json())\n * .then(console.log, console.error)\n * ```\n *\n * @example\n * #### Method specific function with JSON parsing by default\n * ```javascript\n * import fetch from '@superutils/fetch'\n *\n * // no need for `response.json()` or `result.data.data` drilling\n * fetch.get('https://dummyjson.com/products/1')\n * .then(product => console.log(product))\n * fetch.post('https://dummyjson.com/products/add', { title: 'Product title' })\n * .then(product => console.log(product))\n * ```\n *\n *\n * @example\n * #### Set default options.\n *\n * Options' default values (excluding `as` and `method`) can be configured to be EFFECTIVE GLOBALLY.\n *\n * ```typescript\n * import fetch from '@superutils/fetch'\n *\n * const { defaults, errorMsgs, interceptors } = fetch\n *\n * // set default request timeout duration in milliseconds\n * defaults.timeout = 40_000\n *\n * // default headers\n * defaults.headers = { 'content-type': 'text/plain' }\n *\n * // override error messages\n * errorMsgs.invalidUrl = 'URL is not valid'\n * errorMsgs.timedout = 'Request took longer than expected'\n *\n * // add an interceptor to log all request failures.\n * const fetchLogger = (fetchErr, url, options) => console.log('Fetch error log', fetchErr)\n * interceptors.error.push(fetchLogger)\n *\n * // add an interceptor to conditionally include header before making requests\n * interceptors.request.push((url, options) => {\n * // ignore login requests\n * if (`${url}`.includes('/login')) return\n *\n * options.headers.set('x-auth-token', 'my-auth-token')\n * })\n * ```\n */\nexport const fetch = _fetch as typeof _fetch & typeof methods\nfetch.delete = methods.delete\nfetch.get = methods.get\nfetch.head = methods.head\nfetch.options = methods.options\nfetch.patch = methods.patch\nfetch.post = methods.post\nfetch.put = methods.put\n\nexport default fetch\n","import { fallbackIfFails, isFn } from '@superutils/core'\nimport { type Interceptor } from './types'\n\n/**\n * Gracefully executes interceptors and returns the processed value.\n * If the value is not transformed (by returning a new value) by the interceptors,\n * the original value is returned.\n *\n * @param\tvalue value to be passed to the interceptors\n * @param\tsignal The AbortController used to monitor the request status. If the signal is aborted (e.g. due to\n * timeout or manual cancellation), the interceptor chain halts immediately. Note: This does not interrupt the\n * currently executing interceptor, but prevents subsequent ones from running.\n * @param\tinterceptors interceptor/transformer callbacks\n * @param\targs (optional) common arguments to be supplied to all the interceptors in addition to\n * the `value' which will always be the first argument.\n *\n * Interceptor arguments: `[value, ...args]`\n */\nexport const executeInterceptors = async <T, TArgs extends unknown[]>(\n\tvalue: T,\n\tsignal?: AbortSignal,\n\tinterceptors?: Interceptor<T, TArgs>[],\n\t...args: TArgs\n) => {\n\tfor (const interceptor of [...(interceptors ?? [])].filter(isFn)) {\n\t\tif (signal?.aborted) break\n\t\tvalue =\n\t\t\t((await fallbackIfFails(\n\t\t\t\tinterceptor,\n\t\t\t\t[value, ...args],\n\t\t\t\tundefined,\n\t\t\t)) as T) ?? value // if throws error or undefined/null is returned\n\t}\n\treturn value\n}\n\nexport default executeInterceptors\n","import { fallbackIfFails, isFn, isPositiveInteger } from '@superutils/core'\nimport { retry } from '@superutils/promise'\nimport { FetchArgs, FetchFunc } from './types'\n\n/**\n * Executes the built-in `fetch()` (or a custom `fetchFunc` if provided) with support for automatic retries.\n *\n * If `options.retry` is greater than 0, the request will be retried if it fails or if the response is not OK,\n * unless overridden by `options.retryIf`.\n *\n * @param url The request URL.\n * @param options (optional) Fetch options, including retry settings.\n *\n * @returns A promise resolving to the Response.\n */\nconst getResponse = (url: FetchArgs[0], options: FetchArgs[1] = {}) => {\n\tconst fetchFunc = isFn(options.fetchFunc)\n\t\t? options.fetchFunc\n\t\t: (globalThis.fetch as FetchFunc)\n\tif (!isPositiveInteger(options.retry)) return fetchFunc(url, options)\n\n\tlet attemptCount = 0\n\tconst response = retry(\n\t\t() => {\n\t\t\tattemptCount++\n\t\t\treturn fetchFunc(url, options)\n\t\t},\n\t\t{\n\t\t\t...options,\n\t\t\tretryIf: async (res, count, error) => {\n\t\t\t\tconst { abortCtrl, retryIf, signal } = options\n\t\t\t\tif (abortCtrl?.signal.aborted || signal?.aborted) return false\n\n\t\t\t\treturn !!(\n\t\t\t\t\t(await fallbackIfFails(\n\t\t\t\t\t\tretryIf,\n\t\t\t\t\t\t[res, count, error],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t))\n\t\t\t\t\t?? (!!error || !res?.ok)\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t).catch(err =>\n\t\tPromise.reject(\n\t\t\tnew Error(`Request failed after attempt #${attemptCount}`, {\n\t\t\t\tcause: err,\n\t\t\t}),\n\t\t),\n\t)\n\n\treturn response\n}\nexport default getResponse\n","import { isArr, isFn, isObj, objCopy } from '@superutils/core'\nimport { FetchOptions, FetchOptionsInterceptor } from './types'\n\n/**\n * Merge one or more {@link FetchOptions}\n *\n * Notes:\n * - item properties will be prioritized in the order of sequence they were passed in\n * - the following properties will be merged:\n * * `errMsgs`\n * * `headers`\n * * `interceptors`\n * - all other properties will simply override previous values\n *\n * @returns combined\n */\nexport const mergeOptions = (...allOptions: (FetchOptions | undefined)[]) =>\n\tallOptions.reduce(\n\t\t(merged: FetchOptions, options) => {\n\t\t\toptions = isObj(options) ? options : {}\n\t\t\tconst { headers, interceptors: ints1 = {} } = merged\n\t\t\tconst { interceptors: ints2 = {} } = options\n\t\t\toptions.headers\n\t\t\t\t&& new Headers(options.headers).forEach((value, key) =>\n\t\t\t\t\t(headers as Headers).set(key, value),\n\t\t\t\t)\n\n\t\t\treturn {\n\t\t\t\t...merged,\n\t\t\t\t...options,\n\t\t\t\terrMsgs: objCopy(\n\t\t\t\t\toptions.errMsgs as Record<string, string>,\n\t\t\t\t\tmerged.errMsgs,\n\t\t\t\t\t[],\n\t\t\t\t\t'empty',\n\t\t\t\t),\n\t\t\t\theaders,\n\t\t\t\tinterceptors: {\n\t\t\t\t\terror: [...toArr(ints1?.error), ...toArr(ints2?.error)],\n\t\t\t\t\trequest: [\n\t\t\t\t\t\t...toArr(ints1?.request),\n\t\t\t\t\t\t...toArr(ints2?.request),\n\t\t\t\t\t],\n\t\t\t\t\tresponse: [\n\t\t\t\t\t\t...toArr(ints1?.response),\n\t\t\t\t\t\t...toArr(ints2?.response),\n\t\t\t\t\t],\n\t\t\t\t\tresult: [...toArr(ints1?.result), ...toArr(ints2?.result)],\n\t\t\t\t},\n\t\t\t\ttimeout: options.timeout ?? merged.timeout,\n\t\t\t} as FetchOptions\n\t\t},\n\t\t{ headers: new Headers() },\n\t) as FetchOptionsInterceptor\nexport default mergeOptions\n\nconst toArr = <T = unknown>(x?: T | T[]) => (isArr(x) ? x : isFn(x) ? [x] : [])\n","/** Commonly used content types for easier access */\nexport const ContentType = {\n\tAPPLICATION_JAVASCRIPT: 'application/javascript',\n\tAPPLICATION_JSON: 'application/json',\n\tAPPLICATION_OCTET_STREAM: 'application/octet-stream',\n\tAPPLICATION_PDF: 'application/pdf',\n\tAPPLICATION_X_WWW_FORM_URLENCODED: 'application/x-www-form-urlencoded',\n\tAPPLICATION_XML: 'application/xml',\n\tAPPLICATION_ZIP: 'application/zip',\n\tAUDIO_MPEG: 'audio/mpeg',\n\tMULTIPART_FORM_DATA: 'multipart/form-data',\n\tTEXT_CSS: 'text/css',\n\tTEXT_HTML: 'text/html',\n\tTEXT_PLAIN: 'text/plain',\n\tVIDEO_MP4: 'video/mp4',\n} as const\n\nexport enum FetchAs {\n\tarrayBuffer = 'arrayBuffer',\n\tblob = 'blob',\n\tbytes = 'bytes',\n\tformData = 'formData',\n\tjson = 'json',\n\tresponse = 'response',\n\ttext = 'text',\n}\n","import { FetchOptions } from './options'\n\n\n/** Custom error message for fetch requests with more detailed info about the request URL, fetch options and response */\nexport class FetchError extends Error {\n /** Create a new `FetchError` with a new `message` while preserving all metadata */\n clone!: (newMessage: string) => FetchError\n /* FetchOptions */\n options!: FetchOptions\n /* FResponse received, if any */\n response!: Response | undefined\n /* Fetch URL */\n url!: string | URL\n\n constructor(\n message: string,\n options: {\n cause?: unknown\n options: FetchOptions\n response?: Response\n url: string | URL\n },\n ) {\n super(message, { cause: options.cause })\n\n this.name = 'FetchError'\n\n /* Prevents cluttering the console log output while also preserving ready-only member behavior */\n Object.defineProperties(this, {\n clone: {\n get() {\n return (newMessage: string) =>\n new FetchError(newMessage, {\n cause: options.cause,\n options: options.options,\n response: options.response,\n url: options.url,\n })\n },\n },\n options: {\n get() {\n return options.options\n },\n },\n response: {\n get() {\n return options.response\n },\n },\n url: {\n get() {\n return options.url\n },\n },\n })\n }\n}","import {\n\tfallbackIfFails,\n\tisError,\n\tisFn,\n\tisObj,\n\tisPromise,\n\tisUrlValid,\n} from '@superutils/core'\nimport { timeout as PromisE_timeout, TIMEOUT_MAX } from '@superutils/promise'\nimport executeInterceptors from './executeInterceptors'\nimport getResponse from './getResponse'\nimport mergeOptions from './mergeOptions'\nimport type {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tFetchCustomOptions,\n\tFetchOptions,\n\tFetchOptionsInterceptor,\n\tFetchResult,\n\tIPromise_Fetch,\n\tPostBody,\n} from './types'\nimport {\n\tContentType,\n\tFetchAs,\n\tFetchErrMsgs,\n\tFetchError,\n\tFetchOptionsDefault,\n} from './types'\n\n/**\n * Extended `fetch` with timeout, retry, and other options. Automatically parses as JSON by default on success.\n *\n * @param url request URL\n * @param options (optional) Standard `fetch` options extended with {@link FetchCustomOptions}.\n * Default \"content-type\" header is 'application/json'.\n * @param options.as (optional) determines how to parse the result. Default: {@link FetchAs.json}\n * @param options.method (optional) fetch method. Default: `'get'`\n *\n * @example\n * #### Make a simple HTTP requests\n * ```javascript\n * import { fetch } from '@superutils/fetch'\n *\n * // no need for `response.json()` or `result.data.data` drilling\n * fetch.get('https://dummyjson.com/products/1')\n * \t .then(product => console.log(product))\n * ```\n */\nconst fetch = <\n\tT = unknown,\n\tTOptions extends FetchOptions = FetchOptions,\n\tTAs extends FetchAs = TOptions['as'] extends FetchAs\n\t\t? TOptions['as']\n\t\t: FetchAs.response,\n\tTReturn = FetchResult<T>[TAs],\n>(\n\turl: string | URL,\n\toptions: FetchOptions & TOptions = {} as TOptions,\n) => {\n\tif (!isObj(options)) options = {} as TOptions\n\tlet fromPostClient = false\n\tif ((options as unknown as Record<string, boolean>).fromPostClient) {\n\t\tdelete (options as unknown as Record<string, boolean>).fromPostClient\n\t\tfromPostClient = true\n\t}\n\tlet response: Response | undefined\n\t// merge `defaults` with `options` to make sure default values are used where appropriate\n\tconst opts = mergeOptions(\n\t\t{\n\t\t\tabortOnEarlyFinalize: fetch.defaults.abortOnEarlyFinalize,\n\t\t\terrMsgs: fetch.defaults.errMsgs,\n\t\t\ttimeout: TIMEOUT_MAX,\n\t\t\tvalidateUrl: false,\n\t\t},\n\t\toptions,\n\t)\n\t// make sure there's always an abort controller, so that request is aborted when promise is early finalized\n\topts.abortCtrl =\n\t\topts.abortCtrl instanceof AbortController\n\t\t\t? opts.abortCtrl\n\t\t\t: new AbortController()\n\topts.as ??= FetchAs.response\n\topts.method ??= 'get'\n\topts.signal ??= opts.abortCtrl.signal\n\tconst { abortCtrl, as: parseAs, headers, onAbort, onTimeout } = opts\n\topts.onAbort = async () => {\n\t\tconst err: Error =\n\t\t\t(await fallbackIfFails(onAbort, [], undefined))\n\t\t\t?? opts.abortCtrl?.signal?.reason\n\t\t\t?? opts.signal?.reason\n\t\t\t?? opts.errMsgs.aborted\n\n\t\tif (isError(err) && err.name === 'AbortError') {\n\t\t\terr.message = ['This operation was aborted'].includes(err.message)\n\t\t\t\t? opts.errMsgs.aborted\n\t\t\t\t: err.message\n\t\t}\n\t\treturn await interceptErr(\n\t\t\tisError(err) ? err : new Error(err),\n\t\t\turl,\n\t\t\topts,\n\t\t\tresponse,\n\t\t)\n\t}\n\topts.onTimeout = async () => {\n\t\tconst err = await fallbackIfFails(onTimeout, [], undefined)\n\t\treturn await interceptErr(\n\t\t\terr ?? new Error(opts.errMsgs.timedout),\n\t\t\turl,\n\t\t\topts,\n\t\t\tresponse,\n\t\t)\n\t}\n\treturn PromisE_timeout(opts, async () => {\n\t\ttry {\n\t\t\t// invoke body function before executing request interceptors\n\t\t\topts.body = await fallbackIfFails(\n\t\t\t\topts.body as unknown as Promise<PostBody>,\n\t\t\t\t[],\n\t\t\t\t(err: Error) => Promise.reject(err),\n\t\t\t)\n\n\t\t\t// invoke global and local response interceptors to intercept and/or transform `url` and `options`\n\t\t\turl = await executeInterceptors(\n\t\t\t\turl,\n\t\t\t\tabortCtrl.signal,\n\t\t\t\topts.interceptors?.request,\n\t\t\t\topts,\n\t\t\t)\n\n\t\t\tconst { body, errMsgs, validateUrl = false } = opts\n\t\t\topts.signal ??= abortCtrl.signal\n\t\t\tif (validateUrl && !isUrlValid(url, false))\n\t\t\t\tthrow new Error(errMsgs.invalidUrl)\n\n\t\t\tif (fromPostClient) {\n\t\t\t\tlet contentType = headers.get('content-type')\n\t\t\t\tif (!contentType) {\n\t\t\t\t\theaders.set('content-type', ContentType.APPLICATION_JSON)\n\t\t\t\t\tcontentType = ContentType.APPLICATION_JSON\n\t\t\t\t}\n\t\t\t\tconst shouldStringifyBody =\n\t\t\t\t\t['delete', 'patch', 'post', 'put'].includes(\n\t\t\t\t\t\t`${opts.method}`.toLowerCase(),\n\t\t\t\t\t)\n\t\t\t\t\t&& !['undefined', 'string'].includes(typeof body)\n\t\t\t\t\t&& isObj(body, true)\n\t\t\t\t\t&& contentType === ContentType.APPLICATION_JSON\n\t\t\t\t// stringify data/body\n\t\t\t\tif (shouldStringifyBody) opts.body = JSON.stringify(opts.body)\n\t\t\t}\n\n\t\t\t// make the fetch call\n\t\t\tresponse = await getResponse(url, opts)\n\t\t\t// invoke global and local request interceptors to intercept and/or transform `response`\n\t\t\tresponse = await executeInterceptors(\n\t\t\t\tresponse,\n\t\t\t\tabortCtrl.signal,\n\t\t\t\topts.interceptors?.response,\n\t\t\t\turl,\n\t\t\t\topts,\n\t\t\t)\n\t\t\tconst status = response?.status ?? 0\n\t\t\tconst isSuccess = status >= 200 && status < 300\n\t\t\tif (!isSuccess) {\n\t\t\t\tconst jsonError: unknown = await fallbackIfFails(\n\t\t\t\t\t// try to parse error response as json first\n\t\t\t\t\t() => response!.json(),\n\t\t\t\t\t[],\n\t\t\t\t\tundefined,\n\t\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t(jsonError as Error)?.message\n\t\t\t\t\t\t|| `${errMsgs.requestFailed} ${status}`,\n\t\t\t\t\t{ cause: jsonError },\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst parseFunc = response[parseAs as keyof typeof response]\n\t\t\tlet result: unknown = !isFn(parseFunc)\n\t\t\t\t? response\n\t\t\t\t: parseFunc.bind(response)()\n\t\t\tif (isPromise(result))\n\t\t\t\tresult = await result.catch((err: Error) =>\n\t\t\t\t\tPromise.reject(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`${errMsgs.parseFailed} ${parseAs}. ${err?.message}`,\n\t\t\t\t\t\t\t{ cause: err },\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t// invoke global and local request interceptors to intercept and/or transform parsed `result`\n\t\t\tresult = await executeInterceptors(\n\t\t\t\tresult,\n\t\t\t\tabortCtrl.signal,\n\t\t\t\topts.interceptors?.result,\n\t\t\t\turl,\n\t\t\t\topts,\n\t\t\t)\n\t\t\treturn result as TReturn\n\t\t} catch (_err: unknown) {\n\t\t\tlet err = _err as Error\n\n\t\t\terr = await interceptErr(_err as Error, url, opts, response)\n\t\t\treturn Promise.reject(err as FetchError)\n\t\t}\n\t}) as IPromise_Fetch<TReturn>\n}\n/** Default fetch options */\nfetch.defaults = {\n\tabortOnEarlyFinalize: true,\n\terrMsgs: {\n\t\taborted: 'Request aborted',\n\t\tinvalidUrl: 'Invalid URL',\n\t\tparseFailed: 'Failed to parse response as',\n\t\ttimedout: 'Request timed out',\n\t\trequestFailed: 'Request failed with status code:',\n\t} as Required<FetchErrMsgs>, // all error messages must be defined here\n\theaders: new Headers(),\n\tinterceptors: {\n\t\terror: [],\n\t\trequest: [],\n\t\tresponse: [],\n\t\tresult: [],\n\t},\n\ttimeout: 60_000,\n\tvalidateUrl: false,\n} as FetchOptionsDefault\n\nconst interceptErr = async (\n\terr: Error,\n\turl: string | URL,\n\toptions: FetchOptionsInterceptor,\n\tresponse?: Response,\n) => {\n\t// invoke global and local request interceptors to intercept and/or transform `error`\n\tconst fErr = await executeInterceptors(\n\t\tnew FetchError(err?.message ?? err, {\n\t\t\tcause: err?.cause ?? err,\n\t\t\tresponse: response,\n\t\t\toptions: options,\n\t\t\turl,\n\t\t}),\n\t\tundefined, // should execute regardless of abort status\n\t\toptions.interceptors?.error,\n\t\turl,\n\t\toptions,\n\t)\n\treturn fErr\n}\n\nexport default fetch\n","import { DeferredAsyncOptions, deferredCallback } from '@superutils/promise'\nimport fetch from './fetch'\nimport mergeOptions from './mergeOptions'\nimport type {\n\tExtractAs,\n\tExcludeOptions,\n\tFetchArgs,\n\tFetchOptions,\n\tGetFetchResult,\n\tIPromise_Fetch,\n} from './types'\nimport { FetchAs } from './types'\n\n/**\n * Defines client generic parameter T based on fixed options.\n *\n * If `fixedOptions.as` is defined and not `FetcAs.json`, then `T` will be `never`.\n */\nexport type ClientData<FixedOptions> =\n\tExtractAs<[FixedOptions]> extends FetchAs.json ? unknown : never // disallow providing T\n/**\n * Create a reusable fetch client with shared options. The returned function comes attached with a\n * `.deferred()` function for debounce and throttle behavior.\n *\n * The `createClient` utility streamlines the creation of dedicated API clients by generating pre-configured fetch\n * functions. These functions can be equipped with default options like headers, timeouts, or a specific HTTP method,\n * which minimizes code repetition across your application. If a method is not specified during creation, the client\n * will default to `GET`.\n *\n * The returned client also includes a `.deferred()` method, providing the same debounce, throttle, and sequential\n * execution capabilities found in functions like `fetch.get.deferred()`.\n *\n * @example\n * #### Create reusable clients\n * ```javascript\n * import { createClient } from '@superutils/fetch'\n *\n * // Create a \"GET\" client with default headers and a 5-second timeout\n * const apiClient = createClient(\n * \t { method: 'get' }, // fixed options cannot be overridden\n * \t { // default options can be overridden\n * \t headers: {\n * \t \tAuthorization: 'Bearer my-secret-token',\n * \t \t'Content-Type': 'application/json',\n * \t },\n * \t timeout: 5000,\n * \t },\n * \t {// default defer options (can be overridden)\n * \t delay: 300,\n * \t retry: 2, // If request fails, retry up to two more times\n * \t },\n * )\n *\n * // Use it just like the standard fetch\n * apiClient('https://dummyjson.com/products/1', {\n * // The 'method' property cannot be overridden as it is used in the fixed options when creating the client.\n * // In TypeScript, the compiler will not allow this property.\n * // In Javascript, it will simply be ignored.\n * // method: 'post',\n * timeout: 3000, // The 'timeout' property can be overridden\n * }).then(console.log, console.warn)\n *\n * // create a deferred client using \"apiClient\"\n * const deferredClient = apiClient.deferred(\n * { retry: 0 }, // disable retrying by overriding the `retry` defer option\n * 'https://dummyjson.com/products/1',\n * { timeout: 3000 },\n * )\n * deferredClient({ timeout: 10000 }) // timeout is overridden by individual request\n * \t.then(console.log, console.warn)\n * ```\n */\nexport const createClient = <\n\tFixedOptions extends FetchOptions | undefined,\n\tCommonOptions extends ExcludeOptions<FixedOptions> | undefined,\n\tCommonDelay extends number,\n>(\n\t/** Mandatory fetch options that cannot be overriden by individual request */\n\tfixedOptions?: FixedOptions,\n\t/** Common fetch options that can be overriden by individual request */\n\tcommonOptions?: FetchOptions & CommonOptions,\n\tcommonDeferOptions?: DeferredAsyncOptions<unknown, CommonDelay>,\n) => {\n\tfunction client<\n\t\tT extends ClientData<FixedOptions> = never,\n\t\tTOptions extends ExcludeOptions<FixedOptions> | undefined =\n\t\t\t| ExcludeOptions<FixedOptions>\n\t\t\t| undefined,\n\t\tResult = GetFetchResult<[FixedOptions, TOptions, CommonOptions], T>,\n\t>(url: FetchArgs[0], options?: TOptions): IPromise_Fetch<Result> {\n\t\tconst mergedOptions = mergeOptions(\n\t\t\tfetch.defaults,\n\t\t\tcommonOptions,\n\t\t\toptions,\n\t\t\tfixedOptions, // fixed options will always override other options\n\t\t)\n\t\tmergedOptions.as ??= FetchAs.json\n\t\treturn fetch(url, mergedOptions)\n\t}\n\n\t/** Make requests with debounce/throttle behavior */\n\tclient.deferred = <\n\t\tThisArg,\n\t\tDelay extends CommonDelay | number,\n\t\tDefaultUrl extends FetchArgs[0] | undefined = FetchArgs[0] | undefined,\n\t\tDefaultOptions extends ExcludeOptions<FixedOptions> | undefined =\n\t\t\t| ExcludeOptions<FixedOptions>\n\t\t\t| undefined,\n\t>(\n\t\tdeferOptions?: DeferredAsyncOptions<ThisArg, Delay>,\n\t\tdefaultUrl?: DefaultUrl,\n\t\tdefaultOptions?: DefaultOptions,\n\t) => {\n\t\tlet _abortCtrl: AbortController | undefined\n\t\tconst fetchCb = <\n\t\t\tT extends ClientData<FixedOptions> = never,\n\t\t\tTOptions extends ExcludeOptions<FixedOptions> | undefined =\n\t\t\t\t| ExcludeOptions<FixedOptions>\n\t\t\t\t| undefined,\n\t\t\tResult = GetFetchResult<\n\t\t\t\t[FixedOptions, TOptions, DefaultOptions, CommonOptions],\n\t\t\t\tT\n\t\t\t>,\n\t\t>(\n\t\t\t...args: DefaultUrl extends undefined\n\t\t\t\t? [url: FetchArgs[0], options?: TOptions]\n\t\t\t\t: [options?: TOptions]\n\t\t): IPromise_Fetch<Result> => {\n\t\t\tconst mergedOptions = (mergeOptions(\n\t\t\t\tfetch.defaults,\n\t\t\t\tcommonOptions,\n\t\t\t\tdefaultOptions,\n\t\t\t\t(defaultUrl === undefined ? args[1] : args[0]) as TOptions,\n\t\t\t\tfixedOptions, // fixed options will always override other options\n\t\t\t) ?? {}) as FetchOptions\n\t\t\tmergedOptions.as ??= FetchAs.json\n\t\t\t// make sure to abort any previously pending request\n\t\t\t_abortCtrl?.abort?.()\n\t\t\t// ensure AbortController is present in options and propagete external abort signal if provided\n\t\t\t_abortCtrl = new AbortController()\n\n\t\t\treturn fetch(\n\t\t\t\t(defaultUrl ?? args[0]) as FetchArgs[0],\n\t\t\t\tmergedOptions,\n\t\t\t) as unknown as IPromise_Fetch<Result>\n\t\t}\n\n\t\treturn deferredCallback(fetchCb, {\n\t\t\t...commonDeferOptions,\n\t\t\t...deferOptions,\n\t\t} as DeferredAsyncOptions<ThisArg, CommonDelay>) as typeof fetchCb\n\t}\n\n\treturn client\n}\nexport default createClient\n","import { DeferredAsyncOptions, deferredCallback } from '@superutils/promise'\nimport { ClientData } from './createClient'\nimport fetch from './fetch'\nimport mergeOptions from './mergeOptions'\nimport {\n\tExcludePostOptions,\n\tFetchAs,\n\tPostArgs,\n\tPostDeferredCbArgs,\n\tPostOptions,\n\tIPromise_Fetch,\n\tGetFetchResult,\n} from './types'\n\n/**\n * Create a reusable fetch client with shared options. The returned function comes attached with a\n * `.deferred()` function for debounced and throttled request.\n * While `createClient()` is versatile enough for any HTTP method, `createPostClient()` is specifically designed for\n * methods that require a request body, such as `DELETE`, `PATCH`, `POST`, and `PUT`. If a method is not provided, it\n * defaults to `POST`. The generated client accepts an additional second parameter (`data`) for the request payload.\n *\n * Similar to `createClient`, the returned function comes equipped with a `.deferred()` method, enabling debounced,\n * throttled, or sequential execution.\n *\n * @example\n * #### Create reusable clients\n * ```javascript\n * import { createPostClient, FetchAs } from '@superutils/fetch'\n *\n * // Create a POST client with 10-second as the default timeout\n * const postClient = createPostClient(\n * \t{ // fixed options cannot be overrided by client calls\n * \t method: 'post',\n * \t headers: { 'content-type': 'application/json' },\n * \t},\n * \t{ timeout: 10000 }, // common options that can be overriden by client calls\n * )\n *\n * // Invoking `postClient()` automatically applies the pre-configured options\n * postClient(\n * \t 'https://dummyjson.com/products/add',\n * \t { title: 'New Product' }, // data/body\n * \t {}, // other options\n * ).then(console.log)\n *\n * // create a deferred client using \"postClient\"\n * const updateProduct = postClient.deferred(\n * \t{\n * \t\tdelay: 300, // debounce duration\n * \t\tonResult: console.log, // prints only successful results\n * \t},\n * \t'https://dummyjson.com/products/add',\n * \t{ method: 'patch', timeout: 3000 },\n * )\n * updateProduct({ title: 'New title 1' }) // ignored by debounce\n * updateProduct({ title: 'New title 2' }) // executed\n * ```\n */\nexport const createPostClient = <\n\tFixedOptions extends PostOptions | undefined,\n\tCommonOptions extends ExcludePostOptions<FixedOptions> | undefined,\n\tCommonDelay extends number = number,\n>(\n\t/** Mandatory fetch options that cannot be overriden by individual request */\n\tfixedOptions?: FixedOptions,\n\t/** Common fetch options that can be overriden by individual request */\n\tcommonOptions?: PostOptions & CommonOptions,\n\tcommonDeferOptions?: DeferredAsyncOptions<unknown, CommonDelay>,\n) => {\n\t/**\n\t * Executes the HTTP request using the configured client options.\n\t *\n\t * This function is specifically designed for methods that require a request body (e.g., POST, PUT, PATCH),\n\t * allowing the payload to be passed directly as the second argument.\n\t */\n\tfunction client<\n\t\tT extends ClientData<FixedOptions> = never,\n\t\tOptions extends ExcludePostOptions<FixedOptions> | undefined =\n\t\t\t| ExcludePostOptions<FixedOptions>\n\t\t\t| undefined,\n\t\tResult = GetFetchResult<[FixedOptions, Options, CommonOptions], T>,\n\t>(\n\t\turl: PostArgs[0],\n\t\tdata?: PostArgs[1],\n\t\toptions?: Options,\n\t): IPromise_Fetch<Result> {\n\t\tconst mergedOptions = mergeOptions(\n\t\t\tfetch.defaults,\n\t\t\tcommonOptions,\n\t\t\toptions,\n\t\t\tfixedOptions, // fixed options will always override other options\n\t\t) as PostOptions\n\t\tmergedOptions.as ??= FetchAs.json\n\t\tmergedOptions.body = data ?? mergedOptions.body\n\t\tmergedOptions.method ??= 'post'\n\t\t;(mergedOptions as Record<string, boolean>).fromPostClient = true\n\t\treturn fetch(url, mergedOptions)\n\t}\n\n\t/**\n\t * Returns a version of the client configured for debounced, throttled, or sequential execution.\n\t *\n\t * This is particularly useful for optimizing high-frequency operations, such as auto-saving forms\n\t * or managing rapid state updates, by automatically handling request cancellation and execution timing.\n\t */\n\tclient.deferred = <\n\t\tThisArg,\n\t\tDefaultUrl extends PostArgs[0] | undefined,\n\t\tDefaultData extends PostArgs[1] | undefined,\n\t\tDefaultOptions extends ExcludePostOptions<FixedOptions> | undefined =\n\t\t\t| ExcludePostOptions<FixedOptions>\n\t\t\t| undefined,\n\t\tDelay extends CommonDelay | number = number,\n\t>(\n\t\tdeferOptions?: DeferredAsyncOptions<ThisArg, Delay>,\n\t\tdefaultUrl?: DefaultUrl,\n\t\tdefaultData?: DefaultData,\n\t\tdefaultOptions?: DefaultOptions,\n\t) => {\n\t\tlet _abortCtrl: AbortController | undefined\n\t\tconst postCb = <\n\t\t\tT extends ClientData<FixedOptions> = never,\n\t\t\tOptions extends ExcludePostOptions<FixedOptions> | undefined =\n\t\t\t\t| ExcludePostOptions<FixedOptions>\n\t\t\t\t| undefined,\n\t\t\tTReturn = GetFetchResult<\n\t\t\t\t[FixedOptions, Options, DefaultOptions, CommonOptions],\n\t\t\t\tT\n\t\t\t>,\n\t\t>(\n\t\t\t...args: PostDeferredCbArgs<DefaultUrl, DefaultData, Options>\n\t\t): IPromise_Fetch<TReturn> => {\n\t\t\t// add default url to the beginning of the array\n\t\t\tif (defaultUrl !== undefined) args.splice(0, 0, defaultUrl)\n\t\t\t// add default data after the url\n\t\t\tif (defaultData !== undefined) args.splice(1, 0, defaultData)\n\t\t\tconst mergedOptions = (mergeOptions(\n\t\t\t\tfetch.defaults,\n\t\t\t\tcommonOptions,\n\t\t\t\tdefaultOptions,\n\t\t\t\targs[2] as Options,\n\t\t\t\tfixedOptions, // fixed options will always override other options\n\t\t\t) ?? {}) as PostOptions\n\t\t\tmergedOptions.as ??= FetchAs.json\n\t\t\t// make sure to abort any previously pending request\n\t\t\t_abortCtrl?.abort?.()\n\t\t\t// ensure AbortController is present in options and propagete external abort signal if provided\n\t\t\t_abortCtrl = new AbortController()\n\n\t\t\t// attach body to options\n\t\t\tmergedOptions.body = (args[1] ?? mergedOptions.body) as PostArgs[1]\n\t\t\tmergedOptions.method ??= 'post'\n\t\t\t;(mergedOptions as Record<string, boolean>).fromPostClient = true\n\t\t\treturn fetch(args[0] as PostArgs[0], mergedOptions)\n\t\t}\n\n\t\treturn deferredCallback(postCb, {\n\t\t\t...commonDeferOptions,\n\t\t\t...deferOptions,\n\t\t} as typeof deferOptions) as typeof postCb\n\t}\n\n\treturn client\n}\nexport default createPostClient\n","/** This is an entrypoint tailored for IIFE builds for browsers. */\nimport * as promiseExports from '@superutils/promise'\nimport * as fetchExports from './index'\n\n/**\n * Export the fetch function and include all other exports as it's property\n *\n * ### Usage:\n * - `window.superutils.fetch(...)`\n * - `window.superutils.fetch.get(...)`\n * - `window.superutils.fetch.createClient(...)`\n */\nconst fetch = fetchExports.default\n\nObject.keys(fetchExports).forEach(key => {\n\tif (['default', 'fetch'].includes(key)) return\n\t;(fetch as unknown as Record<string, unknown>)[key] ??= (\n\t\tfetchExports as Record<string, unknown>\n\t)[key]\n})\nexport default fetch\n\n/**\n * Include all exports from @supertuils/promise:\n * 1. as if it were imported independantly\n * 2. only adds ~0.5KB (95%+ of the code is already used by @superutils/fetch)\n * 3. eliminates the need to import it separately\n * window.superutils.fetch(...)\n * window.superutils.fetch.get(...)\n * window.superutils.fetch.createClient(...)\n *\n * Usage:\n * window.\n */\nconst PromisE = promiseExports.default\nObject.keys(promiseExports).forEach(key => {\n\tif (['default', 'PromisE'].includes(key)) return\n\t;(PromisE as unknown as Record<string, unknown>)[key] ??= (\n\t\tpromiseExports as Record<string, unknown>\n\t)[key]\n})\nconst w = globalThis as unknown as Record<string, Record<string, unknown>>\nw.superutils ??= {}\nw.superutils.PromisE ??= PromisE\n"]}
1
+ {"version":3,"sources":["../../../promise/dist/index.js","../../../core/dist/index.js","../../src/index.ts","../../src/executeInterceptors.ts","../../src/getResponse.ts","../../src/mergeOptions.ts","../../src/types/constants.ts","../../src/types/FetchError.ts","../../src/fetch.ts","../../src/createClient.ts","../../src/createPostClient.ts","../../src/browser.ts"],"names":["dist_exports","__export","PromisE","PromisEBase","ResolveError","ResolveIgnored","TIMEOUT_FALLBACK","TIMEOUT_MAX","TimeoutPromise","index_default","deferred","deferredCallback","delay","delayReject","retry","timeout","isObj","x","strict","isArr","isInteger","isNumber","isPositiveInteger","isPositiveNumber","isEmpty","nonNumerable","fallback","proto","isFn","isUrl","isUrlValid","tldExceptions","url","y","_","isError","isPromise","isSymbol","fallbackIfFails","target","args","result","err","fallbackIfFails_default","objKeys","obj","sorted","includeSymbols","objKeys_default","clone","value","objCopy","input","output","ignoreKeys","override","recursive","_output","_ignoreKeys","inKeys","_key","key","ignoreChildKeys","arrUnique","arr","flatDepth","debounce","callback","config","leading","onError","thisArg","tid","_callback","firstArgs","leadingGlobal","debounce_default","throttle","d","trailing","handleCallback","trailArgs","cbArgs","throttle_default","_PromisEBase","_resolve","_reject","resolve","reject","reason","fn","_a","_b","values","promise","callbackFn","PromisEBase_default","ResolveError2","ResolveIgnored2","options","sequence","onIgnore","onResult","delay2","ignoreStale","resolveError","resolveIgnored","lastInSeries","lastExecuted","queue","isSequential","handleIgnore","items","iId","iItem","isStale","handleRemaining","currentId","nextId","nextItem","handleItem","currentIndex","id","executeItem","qItem","deferred_default","deferPromise","deferredCallback_default","duration","asRejected","finalize","result2","_result","_result2","delay_default","delayReject_default","func","maxRetries","retryBackOff","retryDelay","retryDelayJitter","retryDelayJitterMax","_retryDelay","retryCount","error","shouldRetry","retry_default","data","timeout2","_signals","_c","_d","signal","_e","s","TimeoutPromise_default","opts","promises","v","dataPromise","timeoutPromise","timeout_default","PromisE_default","index_exports","ContentType","FetchAs","FetchError","createClient","createPostClient","executeInterceptors","fetch","mergeOptions","interceptors","interceptor","executeInterceptors_default","getResponse","fetchFunc","attemptCount","res","count","abortCtrl","retryIf","getResponse_default","allOptions","merged","headers","ints1","ints2","toArr","mergeOptions_default","_FetchError","message","newMessage","fromPostClient","response","parseAs","onAbort","onTimeout","_f","interceptErr","body","errMsgs","validateUrl","contentType","status","jsonError","parseFunc","_err","fetch_default","fixedOptions","commonOptions","commonDeferOptions","client","mergedOptions","deferOptions","defaultUrl","defaultOptions","_abortCtrl","createClient_default","defaultData","createPostClient_default","methods","browser_default","w"],"mappings":"mFAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAAA,EAAAA,CAAA,EAAA,CAAAC,EAAAA,CAAAD,EAAAA,CAAA,aAAAE,CAAAA,CAAA,WAAA,CAAA,IAAAC,EAAAA,CAAA,YAAA,CAAA,IAAAC,GAAA,cAAA,CAAA,IAAAC,EAAAA,CAAA,gBAAA,CAAA,IAAAC,CAAAA,CAAA,gBAAAC,CAAAA,CAAA,cAAA,CAAA,IAAAC,EAAAA,CAAA,OAAA,CAAA,IAAAC,GAAA,QAAA,CAAA,IAAAC,EAAAA,CAAA,gBAAA,CAAA,IAAAC,CAAAA,CAAA,UAAAC,CAAAA,CAAA,WAAA,CAAA,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CA2CAA,CAAAD,GAAAoI,EAAAA,CAAE,UAAA,EAAW,OAAA,GAAb,IAAA,GAAApI,GAAa,OAAA,CAAYzF,EAAAA,CAAAA","file":"index.min.js","sourcesContent":["// src/deferred.ts\nimport {\n deferred as deferredSync,\n fallbackIfFails as fallbackIfFails2,\n isFn as isFn2,\n isPositiveNumber,\n objCopy\n} from \"@superutils/core\";\n\n// src/PromisEBase.ts\nimport { fallbackIfFails, isFn, isPromise } from \"@superutils/core\";\nvar _PromisEBase = class _PromisEBase extends Promise {\n constructor(input) {\n let _resolve;\n let _reject;\n super((resolve, reject) => {\n _reject = (reason) => {\n reject(reason);\n this._state = 2;\n this.onFinalize.forEach(\n (fn) => fallbackIfFails(fn, [void 0, reason], void 0)\n );\n };\n _resolve = (value) => {\n resolve(value);\n this._state = 1;\n this.onFinalize.forEach(\n (fn) => fallbackIfFails(fn, [value, void 0], void 0)\n );\n };\n if (isFn(input)) {\n fallbackIfFails(input, [_resolve, _reject], _reject);\n } else if (isPromise(input)) {\n input.then(_resolve, _reject);\n } else if (input !== void 0) {\n _resolve(input);\n }\n });\n this._state = 0;\n /**\n * callbacks to be invoked whenever PromisE instance is finalized early using non-static resolve()/reject() methods */\n this.onEarlyFinalize = [];\n this.onFinalize = [];\n //\n //\n // --------------------------- Early resolve/reject ---------------------------\n //\n //\n /** Resovle pending promise early. */\n this.resolve = (value) => {\n var _a, _b;\n if (!this.pending) return;\n (_a = this._resolve) == null ? void 0 : _a.call(this, value);\n (_b = this.onEarlyFinalize) == null ? void 0 : _b.forEach((fn) => {\n fallbackIfFails(fn, [true, value], void 0);\n });\n };\n /** Reject pending promise early. */\n this.reject = (reason) => {\n var _a, _b;\n if (!this.pending) return;\n (_a = this._reject) == null ? void 0 : _a.call(this, reason);\n (_b = this.onEarlyFinalize) == null ? void 0 : _b.forEach((fn) => {\n fallbackIfFails(fn, [false, reason], void 0);\n });\n };\n this._resolve = _resolve;\n this._reject = _reject;\n }\n //\n //\n //-------------------- Status related read-only attributes --------------------\n //\n //\n /** Indicates if the promise is still pending/unfinalized */\n get pending() {\n return this.state === 0;\n }\n /** Indicates if the promise has been rejected */\n get rejected() {\n return this.state === 2;\n }\n /** Indicates if the promise has been resolved */\n get resolved() {\n return this.state === 1;\n }\n /**\n * Get promise status code:\n *\n * - `0` = pending\n * - `1` = resolved\n * - `2` = rejected\n */\n get state() {\n return this._state;\n }\n};\n//\n//\n// Extend all static `Promise` methods\n//\n//\n/** Sugar for `new PromisE(Promise.all(...))` */\n_PromisEBase.all = (values) => new _PromisEBase(globalThis.Promise.all(values));\n/** Sugar for `new PromisE(Promise.allSettled(...))` */\n_PromisEBase.allSettled = (values) => new _PromisEBase(globalThis.Promise.allSettled(values));\n/** Sugar for `new PromisE(Promise.any(...))` */\n_PromisEBase.any = (values) => new _PromisEBase(globalThis.Promise.any(values));\n/** Sugar for `new PromisE(Promise.race(..))` */\n_PromisEBase.race = (values) => new _PromisEBase(globalThis.Promise.race(values));\n/** Extends Promise.reject */\n_PromisEBase.reject = (reason) => {\n const promise = new _PromisEBase();\n queueMicrotask(() => promise.reject(reason));\n return promise;\n};\n/** Sugar for `new PromisE(Promise.resolve(...))` */\n_PromisEBase.resolve = (value) => new _PromisEBase(\n globalThis.Promise.resolve(value)\n);\n/** Sugar for `new PromisE(Promise.try(...))` */\n_PromisEBase.try = (callbackFn, ...args) => new _PromisEBase(\n (resolve) => resolve(\n // Promise.try is not supported in Node < 23.\n fallbackIfFails(\n callbackFn,\n args,\n // rethrow error to ensure the returned promise is rejected\n (err) => globalThis.Promise.reject(err)\n )\n )\n);\n/**\n * Creates a `PromisE` instance and returns it in an object, along with its `resolve` and `reject` functions.\n *\n * NB: this function is technically no longer needed because the `PromisE` class already comes with the resolvers.\n *\n * ---\n * @example\n * Using `PromisE` directly: simply provide an empty function as the executor\n *\n * ```typescript\n * import PromisE from '@superutils/promise'\n * const promisE = new PromisE<number>(() => {})\n * setTimeout(() => promisE.resolve(1), 1000)\n * promisE.then(console.log)\n * ```\n *\n * @example\n * Using `withResolvers`\n * ```typescript\n * import PromisE from '@superutils/promise'\n * const pwr = PromisE.withResolvers<number>()\n * setTimeout(() => pwr.resolve(1), 1000)\n * pwr.promise.then(console.log)\n * ```\n */\n_PromisEBase.withResolvers = () => {\n const promise = new _PromisEBase();\n return { promise, reject: promise.reject, resolve: promise.resolve };\n};\nvar PromisEBase = _PromisEBase;\nvar PromisEBase_default = PromisEBase;\n\n// src/types/deferred.ts\nvar ResolveError = /* @__PURE__ */ ((ResolveError2) => {\n ResolveError2[\"NEVER\"] = \"NEVER\";\n ResolveError2[\"REJECT\"] = \"REJECT\";\n ResolveError2[\"WITH_ERROR\"] = \"RESOLVE_ERROR\";\n ResolveError2[\"WITH_UNDEFINED\"] = \"RESOLVE_UNDEFINED\";\n return ResolveError2;\n})(ResolveError || {});\nvar ResolveIgnored = /* @__PURE__ */ ((ResolveIgnored2) => {\n ResolveIgnored2[\"NEVER\"] = \"NEVER\";\n ResolveIgnored2[\"WITH_LAST\"] = \"WITH_LAST\";\n ResolveIgnored2[\"WITH_UNDEFINED\"] = \"WITH_UNDEFINED\";\n return ResolveIgnored2;\n})(ResolveIgnored || {});\n\n// src/deferred.ts\nfunction deferred(options = {}) {\n let sequence = 0;\n options = objCopy(\n deferred.defaults,\n options,\n [],\n \"empty\"\n );\n let { onError, onIgnore, onResult } = options;\n const {\n delay: delay2 = 0,\n ignoreStale,\n resolveError,\n resolveIgnored,\n thisArg,\n throttle\n } = options;\n let lastInSeries = null;\n let lastExecuted;\n const queue = /* @__PURE__ */ new Map();\n const isSequential = !isPositiveNumber(delay2);\n if (thisArg !== void 0) {\n onError = onError == null ? void 0 : onError.bind(thisArg);\n onIgnore = onIgnore == null ? void 0 : onIgnore.bind(thisArg);\n onResult = onResult == null ? void 0 : onResult.bind(thisArg);\n }\n const handleIgnore = (items) => {\n for (const [iId, iItem] of items) {\n queue.delete(iId);\n const isStale = ignoreStale && iItem.sequence < lastExecuted.sequence;\n if (iItem.resolved || iItem.started && !isStale) continue;\n if (iItem.started) {\n iItem.getPromise = (() => iItem.result);\n }\n fallbackIfFails2(onIgnore, [iItem.getPromise], 0);\n switch (resolveIgnored) {\n case \"WITH_UNDEFINED\" /* WITH_UNDEFINED */:\n iItem.resolve(void 0);\n break;\n case \"WITH_LAST\" /* WITH_LAST */:\n lastExecuted == null ? void 0 : lastExecuted.then(iItem.resolve, iItem.reject);\n break;\n case \"NEVER\" /* NEVER */:\n break;\n }\n }\n if (!queue.size) sequence = 0;\n };\n const handleRemaining = (currentId) => {\n lastInSeries = null;\n if (isSequential) {\n queue.delete(currentId);\n const [nextId, nextItem] = [...queue.entries()][0] || [];\n return nextId && nextItem && handleItem(nextId, nextItem);\n }\n let items = [...queue.entries()];\n if (throttle === true && options.trailing) {\n const currentIndex = items.findIndex(([id]) => id === currentId);\n items = items.slice(0, currentIndex);\n } else if (!throttle) {\n items = items.slice(0, -1);\n }\n handleIgnore(items);\n queue.delete(currentId);\n };\n const executeItem = async (id, qItem) => {\n var _a;\n try {\n qItem.started = true;\n lastExecuted = qItem;\n lastInSeries = qItem;\n (_a = qItem.result) != null ? _a : qItem.result = PromisEBase_default.try(qItem.getPromise);\n const result = await qItem.result;\n const isStale = !!ignoreStale && qItem.sequence < lastExecuted.sequence;\n if (isStale) return handleIgnore([[id, qItem]]);\n qItem.resolve(result);\n onResult && fallbackIfFails2(onResult, [result], void 0);\n } catch (err) {\n onError && fallbackIfFails2(onError, [err], void 0);\n switch (resolveError) {\n case \"REJECT\" /* REJECT */:\n qItem.reject(err);\n // eslint-disable-next-line no-fallthrough\n case \"NEVER\" /* NEVER */:\n break;\n case \"RESOLVE_UNDEFINED\" /* WITH_UNDEFINED */:\n qItem.resolve(void 0);\n break;\n case \"RESOLVE_ERROR\" /* WITH_ERROR */:\n qItem.resolve(err);\n break;\n }\n }\n handleRemaining(id);\n };\n const handleItem = isSequential ? executeItem : deferredSync(\n executeItem,\n delay2,\n options\n );\n return (promise) => {\n const id = /* @__PURE__ */ Symbol(\"deferred-queue-item-id\");\n const qItem = new PromisEBase_default();\n qItem.getPromise = isFn2(promise) ? promise : () => promise;\n qItem.started = false;\n qItem.sequence = ++sequence;\n queue.set(id, qItem);\n if (!lastInSeries || !isSequential) handleItem(id, qItem);\n return qItem;\n };\n}\ndeferred.defaults = {\n /**\n * Default delay in milliseconds, used in `debounce` and `throttle` modes.\n *\n * Use `0` (or negative number) to disable debounce/throttle and execute all operations sequentially.\n */\n delay: 100,\n /** Set the default error resolution behavior. {@link ResolveError} for all options. */\n resolveError: \"REJECT\" /* REJECT */,\n /** Set the default ignored resolution behavior. See {@link ResolveIgnored} for all options. */\n resolveIgnored: \"WITH_LAST\" /* WITH_LAST */\n};\nvar deferred_default = deferred;\n\n// src/deferredCallback.ts\nfunction deferredCallback(callback, options = {}) {\n const { thisArg } = options;\n if (thisArg !== void 0) callback = callback.bind(thisArg);\n const deferPromise = deferred_default(options);\n return (...args) => deferPromise(() => callback(...args));\n}\nvar deferredCallback_default = deferredCallback;\n\n// src/delay.ts\nimport { fallbackIfFails as fallbackIfFails3, isFn as isFn3 } from \"@superutils/core\";\nfunction delay(duration = delay.defaults.duration, result, asRejected = false) {\n const promise = new PromisEBase_default();\n const finalize = (result2) => {\n const _result = fallbackIfFails3(\n async () => {\n const _result2 = await (isFn3(result2) ? result2() : result2);\n return !asRejected ? _result2 != null ? _result2 : duration : _result2 != null ? _result2 : new Error(\n `${delay.defaults.delayTimeoutMsg} ${duration}ms`\n );\n },\n [],\n // when result is a function and it fails/rejects,\n // promise will reject even if `asRejected = false`\n (err) => Promise.reject(err)\n );\n !asRejected ? promise.resolve(_result) : _result.then(promise.reject, promise.reject);\n };\n promise.timeoutId = setTimeout(() => finalize(result), duration);\n promise.pause = () => clearTimeout(promise.timeoutId);\n promise.catch(() => {\n }).finally(() => promise.pause());\n promise.onEarlyFinalize.push(() => promise.pause());\n return promise;\n}\ndelay.defaults = {\n /** Default delay duration in milliseconds */\n duration: 100,\n /** Default timed out message (if `result` is not provided) */\n delayTimeoutMsg: \"Timed out after\"\n};\nvar delay_default = delay;\n\n// src/delayReject.ts\nfunction delayReject(duration, reason) {\n return delay_default(duration, reason, true);\n}\nvar delayReject_default = delayReject;\n\n// src/retry.ts\nimport {\n fallbackIfFails as fallbackIfFails4,\n isEmpty,\n isPositiveInteger,\n objCopy as objCopy2\n} from \"@superutils/core\";\nvar retry = async (func, options) => {\n var _a, _b;\n options = objCopy2(retry.defaults, options != null ? options : {}, [], (key, value) => {\n switch (key) {\n // case 'retryDelayJitter':\n // \treturn true\n case \"retry\":\n // eslint-disable-next-line no-fallthrough\n case \"retryDelay\":\n case \"retryDelayJitterMax\":\n return value !== 0 && !isPositiveInteger(value);\n }\n return !!isEmpty(value);\n });\n const {\n retry: maxRetries,\n retryBackOff,\n retryDelay,\n retryDelayJitter,\n retryDelayJitterMax\n } = options;\n let _retryDelay = retryDelay;\n let retryCount = -1;\n let result;\n let error;\n let shouldRetry = false;\n do {\n retryCount++;\n if (retryBackOff === \"exponential\" && retryCount > 1) _retryDelay *= 2;\n if (retryDelayJitter)\n _retryDelay += Math.floor(Math.random() * retryDelayJitterMax);\n if (retryCount > 0) await delay_default(_retryDelay);\n try {\n error = void 0;\n result = await func();\n } catch (err) {\n error = err;\n }\n if (maxRetries === 0 || retryCount >= maxRetries) break;\n shouldRetry = !!((_b = await fallbackIfFails4(\n (_a = options.retryIf) != null ? _a : error,\n // if `retryIf` not provided, retry on error\n [result, retryCount, error],\n error\n // if `retryIf` throws error, default to retry on error\n )) != null ? _b : error);\n } while (shouldRetry);\n if (error !== void 0) return Promise.reject(error);\n return result;\n};\nretry.defaults = {\n retry: 1,\n retryBackOff: \"exponential\",\n retryDelay: 300,\n retryDelayJitter: true,\n retryDelayJitterMax: 100\n};\nvar retry_default = retry;\n\n// src/timeout.ts\nimport {\n arrUnique as arrUnique2,\n isFn as isFn4,\n isNumber,\n isObj as isObj2,\n isPositiveNumber as isPositiveNumber2,\n objCopy as objCopy3\n} from \"@superutils/core\";\n\n// src/TimeoutPromise.ts\nimport { arrUnique, fallbackIfFails as fallbackIfFails5, isObj } from \"@superutils/core\";\nvar TIMEOUT_FALLBACK = 1e4;\nvar TIMEOUT_MAX = 2147483647;\nvar TimeoutPromise = class extends PromisEBase_default {\n constructor(data, timeout2, options, _signals) {\n super(data);\n this.started = /* @__PURE__ */ new Date();\n this._setup = () => {\n var _a, _b, _c, _d;\n this._signals = arrUnique(\n [(_b = (_a = this.options) == null ? void 0 : _a.abortCtrl) == null ? void 0 : _b.signal, (_c = this.options) == null ? void 0 : _c.signal].filter(\n Boolean\n )\n );\n !this.onEarlyFinalize.includes(this._handleEarlyFinalize) && this.onEarlyFinalize.push(this._handleEarlyFinalize);\n !this.onFinalize.includes(this._handleFinalize) && this.onFinalize.push(this._handleFinalize);\n (_d = this._signals) == null ? void 0 : _d.forEach(\n (signal) => signal == null ? void 0 : signal.addEventListener(\n \"abort\",\n this._handleAbort\n )\n );\n };\n this._handleAbort = async () => {\n var _a, _b, _c;\n if (!((_a = this._signals) == null ? void 0 : _a.length) || !this.pending) return;\n let err = await fallbackIfFails5((_b = this.options) == null ? void 0 : _b.onAbort, [], void 0);\n err != null ? err : err = new Error(\n `Aborted after ${(/* @__PURE__ */ new Date()).getTime() - this.started.getTime()}ms`\n );\n (_c = err.name) != null ? _c : err.name = \"AbortError\";\n this.reject(err);\n };\n this._handleEarlyFinalize = () => {\n var _a, _b, _c, _d;\n ((_a = this.options) == null ? void 0 : _a.abortOnEarlyFinalize) && ((_d = (_c = (_b = this.options) == null ? void 0 : _b.abortCtrl) == null ? void 0 : _c.abort) == null ? void 0 : _d.call(_c));\n };\n // cleanup after execution\n this._handleFinalize = ((_, err) => {\n var _a, _b, _c, _d, _e;\n this.cancelAbort();\n this.clearTimeout();\n if (!this.timeout.rejected && !((_a = this._signals) == null ? void 0 : _a.find((x) => x == null ? void 0 : x.aborted)))\n return;\n ((_d = (_c = (_b = this.options) == null ? void 0 : _b.abortCtrl) == null ? void 0 : _c.signal) == null ? void 0 : _d.aborted) === false && ((_e = this.options) == null ? void 0 : _e.abortCtrl.abort(err));\n });\n this.data = data;\n this.options = isObj(options) ? options : {};\n this.timeout = timeout2;\n this._signals = _signals;\n this._setup();\n }\n get abortCtrl() {\n return this.options.abortCtrl;\n }\n get aborted() {\n var _a;\n return this.rejected && !this.timeout.rejected && !!((_a = this._signals) == null ? void 0 : _a.find((s) => s == null ? void 0 : s.aborted));\n }\n cancelAbort() {\n var _a;\n (_a = this._signals) == null ? void 0 : _a.forEach(\n (signal) => signal == null ? void 0 : signal.removeEventListener(\n \"abort\",\n this._handleAbort\n )\n );\n }\n clearTimeout() {\n clearTimeout(this.timeout.timeoutId);\n }\n get timedout() {\n return this.rejected && this.timeout.rejected;\n }\n};\nvar TimeoutPromise_default = TimeoutPromise;\n\n// src/timeout.ts\nfunction timeout(options, ...values) {\n var _a;\n const opts = objCopy3(\n timeout.defaults,\n isNumber(options) ? { timeout: options } : isObj2(options) ? options : {},\n [],\n \"empty\"\n );\n opts.timeout = Math.min(\n isPositiveNumber2(opts.timeout) ? opts.timeout : TIMEOUT_FALLBACK,\n TIMEOUT_MAX\n );\n const promises = values.map(\n (v) => isFn4(v) ? PromisEBase_default.try(v) : v\n );\n const dataPromise = promises.length <= 1 ? (\n // single promise resolves to a single result\n promises[0] instanceof PromisEBase_default ? promises[0] : new PromisEBase_default(promises[0])\n ) : (\n // multiple promises resolve to an array of results\n (isFn4(PromisEBase_default[opts.batchFunc]) ? PromisEBase_default[opts.batchFunc] : PromisEBase_default.all)(promises)\n );\n const timeoutPromise = delayReject_default(opts.timeout, opts.onTimeout);\n return new TimeoutPromise_default(\n PromisEBase_default.race([dataPromise, timeoutPromise]),\n timeoutPromise,\n opts,\n arrUnique2(\n [(_a = opts.abortCtrl) == null ? void 0 : _a.signal, opts.signal].filter(Boolean)\n )\n );\n}\ntimeout.defaults = {\n abortOnEarlyFinalize: true,\n batchFunc: \"all\",\n timeout: TIMEOUT_FALLBACK\n};\nvar timeout_default = timeout;\n\n// src/PromisE.ts\nvar PromisE = class extends PromisEBase_default {\n};\nPromisE.deferred = deferred_default;\nPromisE.deferredCallback = deferredCallback_default;\nPromisE.delay = delay_default;\nPromisE.delayReject = delayReject_default;\nPromisE.retry = retry_default;\nPromisE.timeout = timeout_default;\nvar PromisE_default = PromisE;\n\n// src/index.ts\nvar index_default = PromisE_default;\nexport {\n PromisE,\n PromisEBase,\n ResolveError,\n ResolveIgnored,\n TIMEOUT_FALLBACK,\n TIMEOUT_MAX,\n TimeoutPromise,\n index_default as default,\n deferred,\n deferredCallback,\n delay,\n delayReject,\n retry,\n timeout\n};\n","// src/curry.ts\nfunction curry(func, ...[arity = func.length]) {\n const curriedFn = (...args) => {\n const _args = args;\n if (_args.length >= arity) return func(...args);\n return (...nextArgs) => curriedFn(\n ..._args,\n ...nextArgs\n );\n };\n return curriedFn;\n}\n\n// src/is/isObj.ts\nvar isObj = (x, strict = true) => !!x && typeof x === \"object\" && (!strict || [\n Object.prototype,\n null\n // when an object is created using `Object.create(null)`\n].includes(Object.getPrototypeOf(x)));\nvar isObj_default = isObj;\n\n// src/is/isArr.ts\nvar isArr = (x) => Array.isArray(x);\nvar isArrObj = (x, strict = true) => isArr(x) && x.every((x2) => isObj(x2, strict));\nvar isArr2D = (x) => isArr(x) && x.every(isArr);\nvar isArrLike = (x) => isArr(x) || x instanceof Set || x instanceof Map;\nvar isArrLikeSafe = (x) => [\"[object Array]\", \"[object Map]\", \"[object Set]\"].includes(\n Object.prototype.toString.call(x)\n);\nvar isArrUnique = (x) => isArr(x) && new Set(x).size === x.length;\nvar isUint8Arr = (x) => x instanceof Uint8Array;\nvar isArr_default = isArr;\n\n// src/is/isDate.ts\nvar isDate = (x) => x instanceof Date;\nvar isDateValid = (date) => {\n const dateIsStr = typeof date === \"string\";\n if (!dateIsStr && !isDate(date)) return false;\n const dateObj = new Date(date);\n if (Number.isNaN(dateObj.getTime())) return false;\n if (!dateIsStr) return true;\n const [original, converted] = [date, dateObj.toISOString()].map(\n (y) => y.replace(/[TZ]/g, \"\").substring(0, 10)\n );\n return original === converted;\n};\nvar isDate_default = isDate;\n\n// src/is/isNumber.ts\nvar isInteger = (x) => Number.isInteger(x);\nvar isNegativeInteger = (x) => Number.isInteger(x) && x < 0;\nvar isNegativeNumber = (x) => isNumber(x) && x < 0;\nvar isNumber = (x) => typeof x === \"number\" && !Number.isNaN(x) && Number.isFinite(x);\nvar isPositiveInteger = (x) => isInteger(x) && x > 0;\nvar isPositiveNumber = (x) => isNumber(x) && x > 0;\n\n// src/is/isEmpty.ts\nvar isEmpty = (x, nonNumerable = false, fallback = false) => {\n if (x === null || x === void 0) return true;\n switch (typeof x) {\n case \"number\":\n return !isNumber(x);\n case \"string\":\n return !x.replaceAll(\"\t\", \"\").trim().length;\n case \"boolean\":\n case \"bigint\":\n case \"symbol\":\n case \"function\":\n return false;\n }\n if (x instanceof Date) return Number.isNaN(x.getTime());\n if (x instanceof Map || x instanceof Set) return !x.size;\n if (Array.isArray(x) || x instanceof Uint8Array) return !x.length;\n if (x instanceof Error) return !x.message.length;\n const proto = typeof x === \"object\" && Object.getPrototypeOf(x);\n if (proto === Object.prototype || proto === null) {\n return nonNumerable ? !Object.getOwnPropertyNames(x).length : !Object.keys(x).length;\n }\n return fallback;\n};\nvar isEmptySafe = (x, numberableOnly = false) => {\n const empty = isEmpty(x, numberableOnly, 0);\n if (empty !== 0) return empty;\n switch (Object.prototype.toString.call(x)) {\n case \"[object Uint8Array]\":\n return !x.length;\n case \"[object Date]\":\n return Number.isNaN(x.getTime());\n case \"[object Map]\":\n return !x.size;\n case \"[object Object]\":\n return !Object.keys(x).length;\n case \"[object Set]\":\n return !x.size;\n default:\n return false;\n }\n};\nvar isEmpty_default = isEmpty;\n\n// src/is/isEnv.ts\nvar isEnvBrowser = () => typeof window !== \"undefined\" && typeof (window == null ? void 0 : window.document) !== \"undefined\";\nvar isEnvNode = () => {\n var _a;\n return typeof process !== \"undefined\" && ((_a = process == null ? void 0 : process.versions) == null ? void 0 : _a.node) != null;\n};\nvar isEnvTouchable = () => {\n var _a, _b;\n return typeof window !== \"undefined\" && \"ontouchstart\" in ((_b = (_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement) != null ? _b : {});\n};\n\n// src/noop.ts\nfunction noop() {\n}\nasync function noopAsync() {\n}\n\n// src/is/isFn.ts\nvar isFn = (x) => typeof x === \"function\";\nvar isAsyncFn = (x) => x instanceof noopAsync.constructor && x[Symbol.toStringTag] === \"AsyncFunction\";\nvar isFn_default = isFn;\n\n// src/is/isMap.ts\nvar isMap = (x) => x instanceof Map;\nvar isMapObj = (x, strict = true) => isMap(x) && [...x.values()].every((value) => isObj_default(value, strict));\n\n// src/is/isUrl.ts\nvar isUrl = (x) => x instanceof URL;\nvar isUrlValid = (x, strict = true, tldExceptions = [\"localhost\"]) => {\n if (!x) return false;\n try {\n if (typeof x !== \"string\" && !isUrl(x)) return false;\n const url = isUrl(x) ? x : new URL(x);\n if (!strict) return true;\n const gotTld = tldExceptions.includes(url.hostname) || url.host.split(\".\").length > 1;\n if (!gotTld) return false;\n let y = `${x}`;\n if (y.endsWith(url.hostname)) y += \"/\";\n return url.href === y;\n } catch (_) {\n return false;\n }\n};\nvar isUrl_default = isUrl;\n\n// src/is/index.ts\nvar isBool = (x) => typeof x === \"boolean\" || x instanceof Boolean;\nvar isDefined = (x) => x !== void 0 && x !== null;\nvar isError = (x) => x instanceof Error;\nvar isPromise = (x) => x instanceof Promise;\nvar isRegExp = (x) => x instanceof RegExp;\nvar isSet = (x) => x instanceof Set;\nvar isStr = (x) => typeof x === \"string\";\nvar isSubjectLike = (x, withValue = false) => isObj_default(x, false) && isFn_default(x.subscribe) && isFn_default(x.next) && (!withValue || \"value\" in x);\nvar isSymbol = (x) => typeof x === \"symbol\";\nvar is = {\n arr: isArr_default,\n arr2D: isArr2D,\n arrLike: isArrLike,\n arrLikeSafe: isArrLikeSafe,\n arrObj: isArrObj,\n arrUnique: isArrUnique,\n asyncFn: isAsyncFn,\n bool: isBool,\n date: isDate_default,\n dateValid: isDateValid,\n defined: isDefined,\n empty: isEmpty_default,\n emptySafe: isEmptySafe,\n envBrowser: isEnvBrowser,\n envNode: isEnvNode,\n envTouchable: isEnvTouchable,\n error: isError,\n fn: isFn_default,\n integer: isInteger,\n map: isMap,\n mapObj: isMapObj,\n negativeInteger: isNegativeInteger,\n negativeNumber: isNegativeNumber,\n number: isNumber,\n obj: isObj_default,\n positiveInteger: isPositiveInteger,\n positiveNumber: isPositiveNumber,\n promise: isPromise,\n regExp: isRegExp,\n set: isSet,\n str: isStr,\n subjectLike: isSubjectLike,\n symbol: isSymbol,\n uint8Arr: isUint8Arr,\n url: isUrl_default,\n urlValid: isUrlValid\n};\n\n// src/fallbackIfFails.ts\nvar fallbackIfFails = (target, args, fallback) => {\n try {\n const result = !isFn(target) ? target : target(...isFn(args) ? args() : args);\n if (!isPromise(result)) return result;\n return result.catch(\n (err) => isFn(fallback) ? fallback(err) : fallback\n );\n } catch (err) {\n return isFn(fallback) ? fallback(err) : fallback;\n }\n};\nvar fallbackIfFails_default = fallbackIfFails;\n\n// src/toDatetimeLocal.ts\nvar toDatetimeLocal = (dateStr) => {\n const date = new Date(dateStr);\n if (!isDateValid(date)) return \"\";\n const year = date.getFullYear();\n const month = (date.getMonth() + 1).toString().padStart(2, \"0\");\n const day = date.getDate().toString().padStart(2, \"0\");\n const hours = date.getHours().toString().padStart(2, \"0\");\n const minutes = date.getMinutes().toString().padStart(2, \"0\");\n const res = `${year}-${month}-${day}T${hours}:${minutes}`;\n return res;\n};\n(/* @__PURE__ */ new Date()).getTime();\n\n// src/obj/objClean.ts\nvar objClean = (obj, keys, ignoreIfNotExist = true) => {\n const result = {};\n if (!isObj(obj) || !isArr(keys)) return result;\n const uniqKeys = arrUnique(\n keys.map((x) => String(x).split(\".\")[0])\n ).sort();\n for (const key of uniqKeys) {\n if (ignoreIfNotExist && !obj.hasOwnProperty(key)) continue;\n const value = obj[key];\n if (!isObj(value) || isSymbol(key)) {\n result[key] = value;\n continue;\n }\n const childPrefix = `${key}.`;\n const childKeys = keys.filter((k) => {\n var _a;\n return (_a = k == null ? void 0 : k.startsWith) == null ? void 0 : _a.call(k, childPrefix);\n }).map((k) => k.split(childPrefix)[1]);\n if (!childKeys.length) {\n result[key] = value;\n continue;\n }\n result[key] = objClean(\n value,\n childKeys\n );\n }\n return result;\n};\n\n// src/obj/objKeys.ts\nvar objKeys = (obj, sorted = true, includeSymbols = true) => (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n fallbackIfFails_default(\n () => [\n ...includeSymbols && Object.getOwnPropertySymbols(obj) || [],\n ...sorted ? Object.keys(obj).sort() : Object.keys(obj)\n ],\n [],\n []\n )\n);\nvar objKeys_default = objKeys;\n\n// src/obj/objCopy.ts\nvar clone = (value, fallback = \"null\") => JSON.parse(fallbackIfFails_default(JSON.stringify, [value], fallback));\nvar objCopy = (input, output, ignoreKeys, override = false, recursive = true) => {\n const _output = isObj(output, false) || isFn(output) ? output : {};\n if (!isObj(input, false) && !isFn(output)) return _output;\n const _ignoreKeys = new Set(ignoreKeys != null ? ignoreKeys : []);\n const inKeys = objKeys_default(input, true, true).filter(\n (x) => !_ignoreKeys.has(x)\n );\n for (const _key of inKeys) {\n const key = _key;\n const value = input[key];\n const skip = _output.hasOwnProperty(key) && (override === \"empty\" ? !isEmpty(_output[key]) : isFn(override) ? !override(key, _output[key], value) : true);\n if (skip) continue;\n const isPrimitive = [void 0, null, Infinity, NaN].includes(value) || !isObj(value, false);\n if (isPrimitive) {\n _output[key] = value;\n continue;\n }\n _output[key] = (() => {\n switch (Object.getPrototypeOf(value)) {\n case Array.prototype:\n return clone(value, \"[]\");\n case ArrayBuffer.prototype:\n return value.slice(0);\n case Date.prototype:\n return new Date(value.getTime());\n case Map.prototype:\n return new Map(\n clone(\n Array.from(\n value\n ),\n \"[]\"\n )\n );\n case RegExp.prototype:\n return new RegExp(value);\n case Set.prototype:\n return new Set(\n clone(Array.from(value))\n );\n case Uint8Array.prototype:\n return new Uint8Array([...value]);\n case URL.prototype:\n return new URL(value);\n default:\n break;\n }\n if (isSymbol(key) || !recursive) return clone(value);\n const ignoreChildKeys = [..._ignoreKeys].map(\n (x) => String(x).startsWith(String(key).concat(\".\")) && String(x).split(String(key).concat(\".\"))[1]\n ).filter(Boolean);\n if (!ignoreChildKeys.length) return clone(value);\n return objCopy(\n value,\n _output[key],\n ignoreChildKeys,\n override,\n recursive\n );\n })();\n }\n return _output;\n};\n\n// src/obj/objCreate.ts\nvar objCreate = (keys = [], values = [], result) => {\n if (!isObj(result)) result = {};\n for (let i = 0; i < (isArr(keys) ? keys : []).length; i++) {\n ;\n result[keys[i]] = values == null ? void 0 : values[i];\n }\n return result;\n};\n\n// src/obj/objHasKeys.ts\nfunction objHasKeys(input = {}, keys = [], requireValue = false) {\n if (!isObj(input) || !isArr(keys)) return false;\n for (const key of keys) {\n if (!input.hasOwnProperty(key)) return false;\n if (requireValue && isEmpty(input[key])) return false;\n }\n return true;\n}\n\n// src/obj/objReadOnly.ts\nvar objReadOnly = (obj, config) => {\n if (!isObj(obj, false)) obj = {};\n const { add, revocable, silent = true } = config != null ? config : {};\n const [typeTitle, keyTitle] = isArr(obj) ? [\"array\", \"index\"] : [\"object\", \"property name\"];\n function handleSetProp(obj2, key, value) {\n const isUpdate = obj2[key] !== void 0;\n if (isUpdate && silent) return true;\n const allowAddition = !isUpdate && (!isFn(add) ? add : add(obj2, key, value));\n const shouldThrow = !silent && (isUpdate || !allowAddition);\n if (shouldThrow)\n throw new TypeError(\n `Mutation not allow on read-only ${typeTitle} ${keyTitle}: ${key.toString()}`\n );\n if (!allowAddition) return true;\n obj2[key] = value;\n return true;\n }\n const proxyHandler = {\n get: (obj2, key) => obj2[key],\n set: handleSetProp,\n defineProperty: (obj2, key, { value }) => handleSetProp(obj2, key, value),\n // Prevent removal of properties\n deleteProperty: (obj2, key) => {\n if (!silent && obj2.hasOwnProperty(key)) {\n throw new Error(\n `Mutation not allow on read-only ${typeTitle} ${keyTitle}: ${key.toString()}`\n );\n }\n return true;\n }\n };\n return revocable ? Proxy.revocable(obj, proxyHandler) : new Proxy(obj, proxyHandler);\n};\n\n// src/obj/objSetProp.ts\nvar objSetProp = (obj, key, falsyValue, condition, truthyValue) => {\n var _a;\n const result = !isObj(obj, false) ? {} : obj;\n falsyValue != null ? falsyValue : falsyValue = result[key];\n condition = isFn(condition) ? condition((_a = result[key]) != null ? _a : falsyValue, key, obj) : condition;\n result[key] = !condition ? falsyValue : truthyValue;\n return result;\n};\nvar objSetPropUndefined = (...[obj, key, ...args]) => (obj == null ? void 0 : obj[key]) === void 0 && objSetProp(obj, key, ...args) || obj;\n\n// src/obj/objSort.ts\nvar objSort = (obj, recursive = true, _done = /* @__PURE__ */ new Map()) => {\n const sorted = {};\n if (!isObj(obj)) return sorted;\n for (const key of objKeys_default(obj)) {\n const value = obj[key];\n _done.set(value, true);\n sorted[key] = !recursive || !isObj(value) ? value : objSort(\n value,\n recursive,\n _done\n );\n }\n return sorted;\n};\n\n// src/obj/objWithoutKeys.ts\nvar objWithoutKeys = (input, keys, output) => {\n if (!isObj(input, false)) return {};\n if (!isArr(keys) || !keys.length) return input;\n output = {\n ...isObj(output, false) && output,\n ...input\n };\n for (const key of keys) delete output[key];\n return output;\n};\n\n// src/arr/arrReadOnly.ts\nvar arrReadOnly = (arr, config = {}) => objReadOnly(new ReadOnlyArrayHelper(config, arr), config);\nvar ReadOnlyArrayHelper = class extends Array {\n constructor(config, arr) {\n var _a;\n (_a = config.silent) != null ? _a : config.silent = true;\n super(...arr);\n this.config = config;\n this.ignoreOrThrow = (returnValue) => {\n if (this.config.silent) return returnValue;\n throw new Error(\"Mutation not allowed on read-only array\");\n };\n this.pop = () => this.ignoreOrThrow(this[this.length - 1]);\n this.push = (...items) => !this.config.add ? this.ignoreOrThrow(this.length) : super.push(...items);\n this.reverse = () => this.ignoreOrThrow(this);\n this.shift = () => this.ignoreOrThrow(this[0]);\n this.splice = (..._ignoredArgs) => this.ignoreOrThrow([]);\n this.unshift = (..._ignoredArgs) => this.ignoreOrThrow(this.length);\n }\n // fromAsync = super.fromAsync\n // reduce = super.reduce\n // reduceRight = super.reduceRight\n};\n\n// src/arr/arrReverse.ts\nvar arrReverse = (arr, reverse2 = true, newArray = false) => {\n if (!isArr(arr)) return [];\n if (newArray) arr = [...arr];\n return reverse2 ? arr.reverse() : arr;\n};\n\n// src/arr/arrToMap.ts\nfunction arrToMap(arr, key, flatDepth = 0) {\n ;\n [key, flatDepth] = isNumber(key) ? [void 0, key] : [key, flatDepth];\n const flatEntries = (!isArr(arr) ? [] : flatDepth > 0 ? arr.flat(flatDepth) : arr).map((item, i, flatArr) => {\n var _a;\n return [\n (_a = isFn(key) ? key(item, i, flatArr) : isObj(item) && isDefined(key) ? item[key] : i) != null ? _a : i,\n item\n ];\n });\n return new Map(flatEntries);\n}\n\n// src/arr/arrUnique.ts\nvar arrUnique = (arr, flatDepth = 0) => !isArr(arr) ? [] : Array.from(new Set(arr.flat(flatDepth)));\n\n// src/deferred/debounce.ts\nvar debounce = (callback, delay = 50, config = {}) => {\n const {\n leading = debounce.defaults.leading,\n onError = debounce.defaults.onError,\n thisArg\n } = config;\n let { tid } = config;\n if (thisArg !== void 0) callback = callback.bind(thisArg);\n const _callback = (...args) => fallbackIfFails_default(callback, args, onError);\n let firstArgs = null;\n const leadingGlobal = leading === \"global\";\n return (...args) => {\n clearTimeout(tid);\n tid = setTimeout(() => {\n firstArgs !== args && _callback(...args);\n firstArgs = leadingGlobal ? true : null;\n }, delay);\n if (!leading || firstArgs) return;\n firstArgs = args;\n _callback(...args);\n };\n};\ndebounce.defaults = {\n /**\n * Set the default value of argument `leading` for the `deferred` function.\n * This change is applicable application-wide and only applies to any new invocation of `deferred()`.\n */\n leading: false,\n /**\n * Set the default value of argument `onError` for the `deferred` function.\n * This change is applicable application-wide and only applies to any new invocation of `deferred()`.\n */\n onError: void 0\n};\nvar debounce_default = debounce;\n\n// src/deferred/throttle.ts\nvar throttle = (callback, delay = 50, config = {}) => {\n const { defaults: d } = throttle;\n const { onError = d.onError, trailing = d.trailing, thisArg } = config;\n let { tid } = config;\n const handleCallback = (...args) => fallbackIfFails_default(\n thisArg !== void 0 ? callback.bind(thisArg) : callback,\n args,\n !isFn(onError) ? void 0 : (err) => fallbackIfFails_default(onError, [err], void 0)\n );\n let trailArgs = null;\n return (...args) => {\n if (tid) {\n trailArgs = args;\n return;\n }\n tid = setTimeout(() => {\n tid = void 0;\n if (!trailing) return;\n const cbArgs = trailArgs;\n trailArgs = null;\n cbArgs && cbArgs !== args && handleCallback(...cbArgs);\n }, delay);\n handleCallback(...args);\n };\n};\nthrottle.defaults = {\n onError: void 0,\n trailing: false\n};\nvar throttled = throttle;\nvar throttle_default = throttle;\n\n// src/deferred/deferred.ts\nvar deferred = (callback, delay = 50, config = {}) => config.throttle ? throttle_default(callback, delay, config) : debounce_default(callback, delay, config);\n\n// src/iterable/filter.ts\nvar filter = (data, predicate, limit, asArray, result) => {\n var _a;\n if (!isMap(result)) result = /* @__PURE__ */ new Map();\n if (!isPositiveInteger(limit)) limit = Infinity;\n for (const [key, item] of ((_a = data == null ? void 0 : data.entries) == null ? void 0 : _a.call(data)) || []) {\n if (result.size >= limit) break;\n fallbackIfFails_default(predicate != null ? predicate : item, [item, key, data], false) && result.set(key, item);\n }\n return asArray ? [...result.values()] : result;\n};\nvar filter_default = filter;\n\n// src/iterable/getSize.ts\nvar getSize = (x) => {\n if (!x) return 0;\n try {\n const s = \"size\" in x ? x.size : \"length\" in x ? x.length : 0;\n return isNumber(s) ? s : 0;\n } catch (_) {\n return 0;\n }\n};\nvar getSize_default = getSize;\n\n// src/iterable/getValues.ts\nvar getValues = (data) => {\n var _a;\n return [\n ...((_a = data == null ? void 0 : data.values) == null ? void 0 : _a.call(data)) || []\n ];\n};\nvar getValues_default = getValues;\n\n// src/iterable/search.ts\nvar search = (data, options) => {\n var _a;\n const ignore = !getSize_default(data) || isEmpty(options == null ? void 0 : options.query);\n const result = isMap(options == null ? void 0 : options.result) ? options.result : /* @__PURE__ */ new Map();\n const asMap = (_a = options == null ? void 0 : options.asMap) != null ? _a : search.defaults.asMap;\n if (ignore) return asMap ? result : getValues_default(result);\n options = objCopy(\n search.defaults,\n options,\n [],\n \"empty\"\n // override `option` property with default value when \"empty\" (undefined, null, '',....)\n );\n const {\n ignoreCase,\n limit = Infinity,\n matchAll,\n matchExact,\n ranked\n } = options;\n let { query } = options;\n const qIsStr = isStr(query);\n const qIsRegExp = isRegExp(query);\n const qKeys = fallbackIfFails_default(Object.keys, [query], []);\n if (ignoreCase && !matchExact && !qIsRegExp) {\n query = qIsStr ? query.toLowerCase() : objCreate(\n qKeys,\n Object.values(query).map(\n (x) => isRegExp(x) ? x : `${x}`.toLowerCase()\n )\n );\n }\n options.query = query;\n if (!ranked) {\n for (const [dataKey, dataValue] of data.entries()) {\n if (result.size >= limit) break;\n const matched = qIsStr || qIsRegExp ? (\n // global search across all properties\n matchObjOrProp(options, dataValue, void 0) >= 0\n ) : (\n // field-specific search\n qKeys[matchAll ? \"every\" : \"some\"](\n (key) => matchObjOrProp(options, dataValue, key) >= 0\n )\n );\n if (!matched) continue;\n result.set(dataKey, dataValue);\n }\n } else {\n const preRankedResults = [];\n for (const [dataKey, dataValue] of data.entries()) {\n let matchIndex = -1;\n if (qIsStr || qIsRegExp) {\n matchIndex = matchObjOrProp(options, dataValue, void 0);\n matchIndex >= 0 && preRankedResults.push([matchIndex, dataKey, dataValue]);\n continue;\n }\n const indexes = [];\n const match = qKeys[matchAll ? \"every\" : \"some\"](\n // field-specific search\n (key) => {\n const index = matchObjOrProp(options, dataValue, key);\n indexes.push(index);\n return index >= 0;\n }\n );\n if (!match) continue;\n matchIndex = // eslint-disable-next-line @typescript-eslint/prefer-find\n indexes.sort((a, b) => a - b).filter((n) => n !== -1)[0];\n matchIndex >= 0 && preRankedResults.push([matchIndex, dataKey, dataValue]);\n }\n preRankedResults.sort((a, b) => a[0] - b[0]).slice(0, limit).forEach(([_, key, value]) => result.set(key, value));\n }\n return asMap ? result : getValues_default(result);\n};\nsearch.defaults = {\n asMap: true,\n ignoreCase: true,\n limit: Infinity,\n matchAll: false,\n ranked: false,\n transform: true\n};\nfunction matchObjOrProp({\n query,\n ignoreCase,\n matchExact,\n transform = true\n}, item, propertyName) {\n var _a, _b;\n const global = isStr(query) || isRegExp(query) || propertyName === void 0;\n const keyword = global ? query : query[propertyName];\n const propVal = global || !isObj(item) ? item : item[propertyName];\n const value = fallbackIfFails_default(\n () => isFn(transform) ? transform(\n item,\n global ? void 0 : propVal,\n propertyName\n ) : matchExact && transform === false ? propVal : isObj(propVal, false) ? JSON.stringify(\n isArrLike(propVal) ? [...propVal.values()] : Object.values(propVal)\n ) : String(propVal != null ? propVal : \"\"),\n [],\n \"\"\n );\n if (value === keyword) return 0;\n if (matchExact && !isRegExp(keyword)) return -1;\n let valueStr = String(value);\n if (!valueStr.trim()) return -1;\n if (isRegExp(keyword)) return (_b = (_a = valueStr.match(keyword)) == null ? void 0 : _a.index) != null ? _b : -1;\n if (ignoreCase) valueStr = valueStr.toLowerCase();\n return valueStr.indexOf(String(keyword));\n}\nvar search_default = search;\n\n// src/iterable/find.ts\nfunction find(data, optsOrCb) {\n const result = isFn(optsOrCb) ? filter_default(data, optsOrCb, 1) : search_default(data, { ...optsOrCb, asMap: true, limit: 1 });\n return result[\n (optsOrCb == null ? void 0 : optsOrCb.includeKey) ? \"entries\" : \"values\"\n // returns: value\n ]().next().value;\n}\n\n// src/iterable/getEntries.ts\nvar getEntries = (map) => {\n var _a;\n return [\n ...((_a = map == null ? void 0 : map.entries) == null ? void 0 : _a.call(map)) || []\n ];\n};\n\n// src/iterable/getKeys.ts\nvar getKeys = (data) => {\n var _a;\n return [\n ...((_a = data == null ? void 0 : data.keys) == null ? void 0 : _a.call(data)) || []\n ];\n};\n\n// src/iterable/reverse.ts\nvar reverse = (data, reverse2 = true, newInstance = false) => {\n var _a, _b, _c;\n const dataType = isArr(data) ? 1 : isMap(data) ? 2 : isSet(data) ? 3 : 0;\n if (!dataType) return [];\n const arr = dataType === 1 ? !newInstance ? data : [...data] : dataType === 2 ? [...data.entries()] : [...data.values()];\n if (reverse2) arr.reverse();\n switch (dataType) {\n case 1:\n return arr;\n case 2:\n case 3:\n if (newInstance || !(\"clear\" in data && isFn(data.clear)))\n return dataType === 2 ? new Map(arr) : new Set(arr);\n }\n (_a = data == null ? void 0 : data.clear) == null ? void 0 : _a.call(data);\n for (const item of arr)\n \"set\" in data ? (_b = data.set) == null ? void 0 : _b.call(data, ...item) : \"add\" in data && ((_c = data == null ? void 0 : data.add) == null ? void 0 : _c.call(data, item));\n return data;\n};\n\n// src/iterable/sliceMap.ts\nvar sliceMap = (data, options) => {\n var _a;\n const {\n asMap = false,\n end,\n start = 0,\n transform,\n ignoreEmpty = true\n } = isFn(options) ? { transform: options } : isObj(options) ? options : {};\n const result = /* @__PURE__ */ new Map();\n const subset = [...((_a = data == null ? void 0 : data.entries) == null ? void 0 : _a.call(data)) || []].slice(start, end);\n for (const [_, [key, value]] of subset.entries()) {\n if (ignoreEmpty && isEmpty(value)) continue;\n const newValue = fallbackIfFails_default(\n transform != null ? transform : value,\n [value, key, data],\n void 0\n );\n newValue !== void 0 && result.set(key, newValue);\n }\n return asMap ? result : [...result.values()];\n};\n\n// src/iterable/sort.ts\nfunction sort(data, keyOrFn, options) {\n const dataType = isArr(data) ? 1 : isMap(data) ? 2 : isSet(data) ? 3 : 0;\n if (!dataType) return data;\n const { asString, ignoreCase, newInstance, reverse: reverse2, undefinedFirst } = {\n ...sort.defaults,\n ...isObj(options) ? options : isObj(keyOrFn) ? keyOrFn : {}\n };\n if (dataType === 1 && isFn(keyOrFn)) {\n return arrReverse(\n data.sort(keyOrFn),\n // use provided comparator function\n reverse2,\n newInstance\n );\n }\n const alt = asString ? undefinedFirst ? \"\" : \"Z\".repeat(10) : undefinedFirst ? -Infinity : Infinity;\n const sorted = isFn(keyOrFn) ? arrReverse(\n // handle Set with comparator function\n [...data.entries()].sort(keyOrFn),\n reverse2,\n false\n // not required because of entries() & spread\n ) : (() => {\n let index = 1;\n const getVal = (target) => {\n const val = isObj(target) && index !== 0 ? target[keyOrFn] : target;\n if (!asString) return val;\n const value = `${val != null ? val : alt}`;\n return ignoreCase ? value.toLowerCase() : value;\n };\n const [gt, lt] = reverse2 ? [-1, 1] : [1, -1];\n if ([1, 3].includes(dataType)) {\n return (dataType === 3 || newInstance ? [...data] : data).sort((a, b) => getVal(a) > getVal(b) ? gt : lt);\n }\n index = keyOrFn === true ? 0 : 1;\n return [...data.entries()].sort(\n (a, b) => getVal(a == null ? void 0 : a[index]) > getVal(b == null ? void 0 : b[index]) ? gt : lt\n );\n })();\n if (dataType === 1) return sorted;\n if (newInstance) {\n return dataType === 2 ? new Map(sorted) : new Set(sorted);\n }\n ;\n data.clear();\n for (const entry of sorted)\n dataType === 2 ? data.set(...entry) : data.add(entry);\n return data;\n}\nsort.defaults = {\n asString: true,\n ignoreCase: true,\n newInstance: false,\n reverse: false,\n undefinedFirst: false\n};\n\n// src/map/mapJoin.ts\nvar mapJoin = (...inputs) => {\n var _a;\n return new Map(\n (_a = inputs == null ? void 0 : inputs.flatMap) == null ? void 0 : _a.call(\n inputs,\n (input) => isMap(input) ? Array.from(input.entries()) : isArr2D(input) ? input : []\n )\n );\n};\n\n// src/number/randomInt.ts\nvar randomInt = (min = 0, max = Number.MAX_SAFE_INTEGER) => parseInt(`${Math.random() * (max - min) + min}`);\n\n// src/str/clearClutter.ts\nvar clearClutter = (text, lineSeparator = \" \") => `${text}`.split(\"\\n\").map((ln) => ln.trim()).filter(Boolean).join(lineSeparator);\n\n// src/str/copyToClipboard.ts\nvar copyToClipboard = (str) => fallbackIfFails(\n // First attempt: modern clipboard API\n () => navigator.clipboard.writeText(str).then(() => 1),\n [],\n // If clipboard API is not available or fails, use the fallback method\n () => Promise.resolve(copyLegacy(str) ? 2 : 0)\n);\nvar copyLegacy = (str) => fallbackIfFails(\n () => {\n const el = document.createElement(\"textarea\");\n el.value = str;\n el.setAttribute(\"readonly\", \"\");\n el.style.position = \"absolute\";\n el.style.left = \"-9999px\";\n document.body.appendChild(el);\n el.select();\n const success = document.execCommand(\"copy\");\n document.body.removeChild(el);\n return success;\n },\n [],\n false\n // On error, return false\n);\n\n// src/str/getUrlParam.ts\nvar getUrlParam = (name, url, asArray) => {\n var _a;\n url != null ? url : url = fallbackIfFails_default(() => window.location.href, [], \"\");\n const _asArray = isArr(asArray) ? asArray : asArray === true && isStr(name) ? [name] : [];\n const prepareResult = (value = \"\", values = {}) => name ? isArr(value) || !_asArray.includes(name) ? value : [value].filter(Boolean) : values;\n if (!url) return prepareResult();\n if (typeof URLSearchParams === \"undefined\" || !URLSearchParams) {\n const r = getUrlParamRegex(name, url, _asArray);\n return prepareResult(r, r);\n }\n const search2 = isUrl(url) ? url.search : ((_a = url.split(\"?\")) == null ? void 0 : _a[1]) || \"\";\n if (search2 === \"?\" || !search2) return prepareResult();\n const params = new URLSearchParams(search2);\n const getValue = (paramName) => {\n const value = arrUnique(params.getAll(paramName));\n return value.length > 1 || _asArray.includes(paramName) ? value : value[0];\n };\n if (name) return prepareResult(getValue(name));\n const result = {};\n for (const name2 of arrUnique([...params.keys()])) {\n result[name2] = getValue(name2);\n }\n return result;\n};\nvar getUrlParamRegex = (name, url, asArray = []) => {\n url != null ? url : url = fallbackIfFails_default(() => window.location.href, [], \"\");\n if (isUrl(url)) url = url.toString();\n const params = {};\n const regex = /[?&]+([^=&]+)=([^&]*)/gi;\n url == null ? void 0 : url.replace(regex, (_, name2, value) => {\n value = decodeURIComponent(value);\n if (asArray.includes(name2) || params[name2] !== void 0) {\n params[name2] = isArr(params[name2]) ? params[name2] : [params[name2]];\n params[name2] = arrUnique([...params[name2], value]).filter(Boolean);\n } else {\n params[name2] = value;\n }\n return \"\";\n });\n return name ? params[name] : params;\n};\n\n// src/str/regex.ts\nvar EMAIL_REGEX = new RegExp(\n /^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,9}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i\n);\nvar HEX_REGEX = /^0x[0-9a-f]+$/i;\nvar HASH_REGEX = /^0x[0-9a-f]{64}$/i;\n\n// src/str/strToArr.ts\nvar strToArr = (value, seperator = \",\") => typeof value === \"string\" && value.split(seperator).filter(Boolean) || [];\nexport {\n EMAIL_REGEX,\n HASH_REGEX,\n HEX_REGEX,\n ReadOnlyArrayHelper,\n arrReadOnly,\n arrReverse,\n arrToMap,\n arrUnique,\n clearClutter,\n copyToClipboard,\n curry,\n debounce,\n deferred,\n fallbackIfFails,\n filter,\n find,\n getEntries,\n getKeys,\n getSize,\n getUrlParam,\n getValues,\n is,\n isArr,\n isArr2D,\n isArrLike,\n isArrLikeSafe,\n isArrObj,\n isArrUnique,\n isAsyncFn,\n isBool,\n isDate,\n isDateValid,\n isDefined,\n isEmpty,\n isEmptySafe,\n isEnvBrowser,\n isEnvNode,\n isEnvTouchable,\n isError,\n isFn,\n isInteger,\n isMap,\n isMapObj,\n isNegativeInteger,\n isNegativeNumber,\n isNumber,\n isObj,\n isPositiveInteger,\n isPositiveNumber,\n isPromise,\n isRegExp,\n isSet,\n isStr,\n isSubjectLike,\n isSymbol,\n isUint8Arr,\n isUrl,\n isUrlValid,\n mapJoin,\n matchObjOrProp,\n noop,\n noopAsync,\n objClean,\n objCopy,\n objCreate,\n objHasKeys,\n objKeys,\n objReadOnly,\n objSetProp,\n objSetPropUndefined,\n objSort,\n objWithoutKeys,\n randomInt,\n reverse,\n search,\n sliceMap,\n sort,\n strToArr,\n throttle,\n throttled,\n toDatetimeLocal\n};\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// Re-export fetch relevant & useful things from '@superutils/promise' for ease of use\nexport {\n\tResolveError,\n\tResolveIgnored,\n\tTIMEOUT_FALLBACK,\n\tTIMEOUT_MAX,\n\tTimeoutPromise,\n} from '@superutils/promise'\nexport type {\n\tDeferredAsyncOptions,\n\tOnEarlyFinalize,\n\tOnFinalize,\n\tRetryIfFunc,\n\tRetryOptions,\n\tTimeoutOptions,\n} from '@superutils/promise'\n\n/* All local exports */\nexport * from './createClient'\nexport * from './createPostClient'\nexport * from './executeInterceptors'\nexport * from './fetch'\nexport * from './getResponse'\nexport * from './mergeOptions'\nexport * from './types'\nimport createClient from './createClient'\nimport createPostClient from './createPostClient'\nimport _fetch from './fetch'\nimport { FetchAs, FetchCustomOptions, FetchInterceptors } from './types'\n\nconst methods = {\n\t/** Make HTTP requests with method GET */\n\tget: createClient({ method: 'get' }),\n\n\t/** Make HTTP requests with method HEAD */\n\thead: createClient({ method: 'head' }),\n\n\t/** Make HTTP requests with method OPTIONS */\n\toptions: createClient({ method: 'options' }),\n\n\t/** Make HTTP requests with method DELETE */\n\tdelete: createPostClient({ method: 'delete' }),\n\n\t/** Make HTTP requests with method PATCH */\n\tpatch: createPostClient({ method: 'patch' }),\n\n\t/** Make HTTP requests with method POST */\n\tpost: createPostClient({ method: 'post' }),\n\n\t/** Make HTTP requests with method PUT */\n\tput: createPostClient({ method: 'put' }),\n}\n\n/**\n * A `fetch()` replacement that simplifies data fetching with automatic JSON parsing, request timeouts, retries,\n * and handy interceptors that also work as transformers. It also includes deferred and throttled request\n * capabilities for complex asynchronous control flows.\n *\n * Will reject promise if response status code is not 2xx (200 <= status < 300).\n *\n * ## Method Specific Functions\n *\n * While `fetch()` provides access to all HTTP request methods by specifying it in options (eg: `{ method: 'get' }`),\n * for ease of use you can also use the following:\n *\n * - `fetch.delete(...)`\n * - `fetch.get(...)`\n * - `fetch.head(...)`\n * - `fetch.options(...)`\n * - `fetch.patch(...)`\n * - `fetch.post(...)`\n * - `fetch.put(...)`\n *\n * **Deferred variants:** To debounce/throttle requests.\n *\n * - `fetch.delete.deferred(...)`\n * - `fetch.get.deferred(...)`\n * - `fetch.head.deferred(...)`\n * - `fetch.options.deferred(...)`\n * - `fetch.patch.deferred(...)`\n * - `fetch.post.deferred(...)`\n * - `fetch.put.deferred(...)`\n *\n * @template T The type of the value that the `fetch` resolves to.\n * @template TReturn Return value type.\n *\n * If `T` is not specified defaults to the following based on the value of `options.as`:\n * - FetchAs.arrayBuffer: `ArrayBuffer`\n * - FetchAs.blob: `Blob`\n * - FetchAs.bytes: `Uint8Array<ArrayBuffer>`\n * - FetchAs.formData: `FormData`\n * - FetchAs.json: `unknown`\n * - FetchAs.text: `string`\n * - FetchAs.response: `Response`\n *\n * @param url\n * @param options (optional) Standard `fetch` options extended with {@link FetchCustomOptions}\n * @param options.abortCtrl (optional) if not provided `AbortController` will be instantiated when `timeout` used.\n *\n * Default: `new AbortController()`\n * @param options.as (optional) (optional) specify how to parse the result.\n * For raw `Response` use {@link FetchAs.response}\n *\n * Default: {@link FetchAs.json}\n * @param options.headers (optional) request headers\n *\n * Default: `{ 'content-type': 'application/json' }`\n * @param options.interceptors (optional) request interceptor/transformer callbacks.\n * See {@link FetchInterceptors} for details.\n * @param options.method (optional) fetch method.\n *\n * Default: `'get'`\n * @param options.timeout (optional) duration in milliseconds to abort the request.\n * This duration includes the execution of all interceptors/transformers.\n *\n * Default: `30_000`\n *\n *\n *\n * ---\n *\n * @example\n * #### Drop-in replacement for built-in fetch\n *\n * ```javascript\n * import fetch from '@superutils/fetch'\n *\n * fetch('[DUMMYJSON-DOT-COM]/products/1')\n * .then(response => response.json())\n * .then(console.log, console.error)\n * ```\n *\n * @example\n * #### Method specific function with JSON parsing by default\n * ```javascript\n * import fetch from '@superutils/fetch'\n *\n * // no need for `response.json()` or `result.data.data` drilling\n * fetch.get('[DUMMYJSON-DOT-COM]/products/1')\n * .then(product => console.log(product))\n * fetch.post('[DUMMYJSON-DOT-COM]/products/add', { title: 'Product title' })\n * .then(product => console.log(product))\n * ```\n *\n *\n * @example\n * #### Set default options.\n *\n * Options' default values (excluding `as` and `method`) can be configured to be EFFECTIVE GLOBALLY.\n *\n * ```typescript\n * import fetch from '@superutils/fetch'\n *\n * const { defaults, errorMsgs, interceptors } = fetch\n *\n * // set default request timeout duration in milliseconds\n * defaults.timeout = 40_000\n *\n * // default headers\n * defaults.headers = { 'content-type': 'text/plain' }\n *\n * // override error messages\n * errorMsgs.invalidUrl = 'URL is not valid'\n * errorMsgs.timedout = 'Request took longer than expected'\n *\n * // add an interceptor to log all request failures.\n * const fetchLogger = (fetchErr, url, options) => console.log('Fetch error log', fetchErr)\n * interceptors.error.push(fetchLogger)\n *\n * // add an interceptor to conditionally include header before making requests\n * interceptors.request.push((url, options) => {\n * // ignore login requests\n * if (`${url}`.includes('/login')) return\n *\n * options.headers.set('x-auth-token', 'my-auth-token')\n * })\n * ```\n */\nexport const fetch = _fetch as typeof _fetch & typeof methods\nfetch.delete = methods.delete\nfetch.get = methods.get\nfetch.head = methods.head\nfetch.options = methods.options\nfetch.patch = methods.patch\nfetch.post = methods.post\nfetch.put = methods.put\n\nexport default fetch\n","import { fallbackIfFails, isFn } from '@superutils/core'\nimport { type Interceptor } from './types'\n\n/**\n * Gracefully executes interceptors and returns the processed value.\n * If the value is not transformed (by returning a new value) by the interceptors,\n * the original value is returned.\n *\n * @param\tvalue value to be passed to the interceptors\n * @param\tsignal The AbortController used to monitor the request status. If the signal is aborted (e.g. due to\n * timeout or manual cancellation), the interceptor chain halts immediately. Note: This does not interrupt the\n * currently executing interceptor, but prevents subsequent ones from running.\n * @param\tinterceptors interceptor/transformer callbacks\n * @param\targs (optional) common arguments to be supplied to all the interceptors in addition to\n * the `value' which will always be the first argument.\n *\n * Interceptor arguments: `[value, ...args]`\n */\nexport const executeInterceptors = async <T, TArgs extends unknown[]>(\n\tvalue: T,\n\tsignal?: AbortSignal,\n\tinterceptors?: Interceptor<T, TArgs>[],\n\t...args: TArgs\n) => {\n\tfor (const interceptor of [...(interceptors ?? [])].filter(isFn)) {\n\t\tif (signal?.aborted) break\n\t\tvalue =\n\t\t\t((await fallbackIfFails(\n\t\t\t\tinterceptor,\n\t\t\t\t[value, ...args],\n\t\t\t\tundefined,\n\t\t\t)) as T) ?? value // if throws error or undefined/null is returned\n\t}\n\treturn value\n}\n\nexport default executeInterceptors\n","import { fallbackIfFails, isFn, isPositiveInteger } from '@superutils/core'\nimport { retry } from '@superutils/promise'\nimport { FetchArgs, FetchFunc } from './types'\n\n/**\n * Executes the built-in `fetch()` (or a custom `fetchFunc` if provided) with support for automatic retries.\n *\n * If `options.retry` is greater than 0, the request will be retried if it fails or if the response is not OK,\n * unless overridden by `options.retryIf`.\n *\n * @param url The request URL.\n * @param options (optional) Fetch options, including retry settings.\n *\n * @returns A promise resolving to the Response.\n */\nconst getResponse = (url: FetchArgs[0], options: FetchArgs[1] = {}) => {\n\tconst fetchFunc = isFn(options.fetchFunc)\n\t\t? options.fetchFunc\n\t\t: (globalThis.fetch as FetchFunc)\n\tif (!isPositiveInteger(options.retry)) return fetchFunc(url, options)\n\n\tlet attemptCount = 0\n\tconst response = retry(\n\t\t() => {\n\t\t\tattemptCount++\n\t\t\treturn fetchFunc(url, options)\n\t\t},\n\t\t{\n\t\t\t...options,\n\t\t\tretryIf: async (res, count, error) => {\n\t\t\t\tconst { abortCtrl, retryIf, signal } = options\n\t\t\t\tif (abortCtrl?.signal.aborted || signal?.aborted) return false\n\n\t\t\t\treturn !!(\n\t\t\t\t\t(await fallbackIfFails(\n\t\t\t\t\t\tretryIf,\n\t\t\t\t\t\t[res, count, error],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t))\n\t\t\t\t\t?? (!!error || !res?.ok)\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t).catch(err =>\n\t\tPromise.reject(\n\t\t\tnew Error(`Request failed after attempt #${attemptCount}`, {\n\t\t\t\tcause: err,\n\t\t\t}),\n\t\t),\n\t)\n\n\treturn response\n}\nexport default getResponse\n","import { isArr, isFn, isObj, objCopy } from '@superutils/core'\nimport { FetchOptions, FetchOptionsInterceptor } from './types'\n\n/**\n * Merge one or more {@link FetchOptions}\n *\n * Notes:\n * - item properties will be prioritized in the order of sequence they were passed in\n * - the following properties will be merged:\n * * `errMsgs`\n * * `headers`\n * * `interceptors`\n * - all other properties will simply override previous values\n *\n * @returns combined\n */\nexport const mergeOptions = (...allOptions: (FetchOptions | undefined)[]) =>\n\tallOptions.reduce(\n\t\t(merged: FetchOptions, options) => {\n\t\t\toptions = isObj(options) ? options : {}\n\t\t\tconst { headers, interceptors: ints1 = {} } = merged\n\t\t\tconst { interceptors: ints2 = {} } = options\n\t\t\toptions.headers\n\t\t\t\t&& new Headers(options.headers).forEach((value, key) =>\n\t\t\t\t\t(headers as Headers).set(key, value),\n\t\t\t\t)\n\n\t\t\treturn {\n\t\t\t\t...merged,\n\t\t\t\t...options,\n\t\t\t\terrMsgs: objCopy(\n\t\t\t\t\toptions.errMsgs as Record<string, string>,\n\t\t\t\t\tmerged.errMsgs,\n\t\t\t\t\t[],\n\t\t\t\t\t'empty',\n\t\t\t\t),\n\t\t\t\theaders,\n\t\t\t\tinterceptors: {\n\t\t\t\t\terror: [...toArr(ints1?.error), ...toArr(ints2?.error)],\n\t\t\t\t\trequest: [\n\t\t\t\t\t\t...toArr(ints1?.request),\n\t\t\t\t\t\t...toArr(ints2?.request),\n\t\t\t\t\t],\n\t\t\t\t\tresponse: [\n\t\t\t\t\t\t...toArr(ints1?.response),\n\t\t\t\t\t\t...toArr(ints2?.response),\n\t\t\t\t\t],\n\t\t\t\t\tresult: [...toArr(ints1?.result), ...toArr(ints2?.result)],\n\t\t\t\t},\n\t\t\t\ttimeout: options.timeout ?? merged.timeout,\n\t\t\t} as FetchOptions\n\t\t},\n\t\t{ headers: new Headers() },\n\t) as FetchOptionsInterceptor\nexport default mergeOptions\n\nconst toArr = <T = unknown>(x?: T | T[]) => (isArr(x) ? x : isFn(x) ? [x] : [])\n","/** Commonly used content types for easier access */\nexport const ContentType = {\n\tAPPLICATION_JAVASCRIPT: 'application/javascript',\n\tAPPLICATION_JSON: 'application/json',\n\tAPPLICATION_OCTET_STREAM: 'application/octet-stream',\n\tAPPLICATION_PDF: 'application/pdf',\n\tAPPLICATION_X_WWW_FORM_URLENCODED: 'application/x-www-form-urlencoded',\n\tAPPLICATION_XML: 'application/xml',\n\tAPPLICATION_ZIP: 'application/zip',\n\tAUDIO_MPEG: 'audio/mpeg',\n\tMULTIPART_FORM_DATA: 'multipart/form-data',\n\tTEXT_CSS: 'text/css',\n\tTEXT_HTML: 'text/html',\n\tTEXT_PLAIN: 'text/plain',\n\tVIDEO_MP4: 'video/mp4',\n} as const\n\nexport enum FetchAs {\n\tarrayBuffer = 'arrayBuffer',\n\tblob = 'blob',\n\tbytes = 'bytes',\n\tformData = 'formData',\n\tjson = 'json',\n\tresponse = 'response',\n\ttext = 'text',\n}\n","import { FetchOptions } from './options'\n\n\n/** Custom error message for fetch requests with more detailed info about the request URL, fetch options and response */\nexport class FetchError extends Error {\n /** Create a new `FetchError` with a new `message` while preserving all metadata */\n clone!: (newMessage: string) => FetchError\n /* FetchOptions */\n options!: FetchOptions\n /* FResponse received, if any */\n response!: Response | undefined\n /* Fetch URL */\n url!: string | URL\n\n constructor(\n message: string,\n options: {\n cause?: unknown\n options: FetchOptions\n response?: Response\n url: string | URL\n },\n ) {\n super(message, { cause: options.cause })\n\n this.name = 'FetchError'\n\n /* Prevents cluttering the console log output while also preserving ready-only member behavior */\n Object.defineProperties(this, {\n clone: {\n get() {\n return (newMessage: string) =>\n new FetchError(newMessage, {\n cause: options.cause,\n options: options.options,\n response: options.response,\n url: options.url,\n })\n },\n },\n options: {\n get() {\n return options.options\n },\n },\n response: {\n get() {\n return options.response\n },\n },\n url: {\n get() {\n return options.url\n },\n },\n })\n }\n}","import {\n\tfallbackIfFails,\n\tisError,\n\tisFn,\n\tisObj,\n\tisPromise,\n\tisUrlValid,\n} from '@superutils/core'\nimport { timeout as PromisE_timeout, TIMEOUT_MAX } from '@superutils/promise'\nimport executeInterceptors from './executeInterceptors'\nimport getResponse from './getResponse'\nimport mergeOptions from './mergeOptions'\nimport type {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tFetchCustomOptions,\n\tFetchOptions,\n\tFetchOptionsInterceptor,\n\tFetchResult,\n\tIPromise_Fetch,\n\tPostBody,\n} from './types'\nimport {\n\tContentType,\n\tFetchAs,\n\tFetchErrMsgs,\n\tFetchError,\n\tFetchOptionsDefault,\n} from './types'\n\n/**\n * Extended `fetch` with timeout, retry, and other options. Automatically parses as JSON by default on success.\n *\n * @param url request URL\n * @param options (optional) Standard `fetch` options extended with {@link FetchCustomOptions}.\n * Default \"content-type\" header is 'application/json'.\n * @param options.as (optional) determines how to parse the result. Default: {@link FetchAs.json}\n * @param options.method (optional) fetch method. Default: `'get'`\n *\n * @example\n * #### Make a simple HTTP requests\n * ```javascript\n * import { fetch } from '@superutils/fetch'\n *\n * // no need for `response.json()` or `result.data.data` drilling\n * fetch.get('[DUMMYJSON-DOT-COM]/products/1')\n * \t .then(product => console.log(product))\n * ```\n */\nconst fetch = <\n\tT = unknown,\n\tTOptions extends FetchOptions = FetchOptions,\n\tTAs extends FetchAs = TOptions['as'] extends FetchAs\n\t\t? TOptions['as']\n\t\t: FetchAs.response,\n\tTReturn = FetchResult<T>[TAs],\n>(\n\turl: string | URL,\n\toptions: FetchOptions & TOptions = {} as TOptions,\n) => {\n\tif (!isObj(options)) options = {} as TOptions\n\tlet fromPostClient = false\n\tif ((options as unknown as Record<string, boolean>).fromPostClient) {\n\t\tdelete (options as unknown as Record<string, boolean>).fromPostClient\n\t\tfromPostClient = true\n\t}\n\tlet response: Response | undefined\n\t// merge `defaults` with `options` to make sure default values are used where appropriate\n\tconst opts = mergeOptions(\n\t\t{\n\t\t\tabortOnEarlyFinalize: fetch.defaults.abortOnEarlyFinalize,\n\t\t\terrMsgs: fetch.defaults.errMsgs,\n\t\t\ttimeout: TIMEOUT_MAX,\n\t\t\tvalidateUrl: false,\n\t\t},\n\t\toptions,\n\t)\n\t// make sure there's always an abort controller, so that request is aborted when promise is early finalized\n\topts.abortCtrl =\n\t\topts.abortCtrl instanceof AbortController\n\t\t\t? opts.abortCtrl\n\t\t\t: new AbortController()\n\topts.as ??= FetchAs.response\n\topts.method ??= 'get'\n\topts.signal ??= opts.abortCtrl.signal\n\tconst { abortCtrl, as: parseAs, headers, onAbort, onTimeout } = opts\n\topts.onAbort = async () => {\n\t\tconst err: Error =\n\t\t\t(await fallbackIfFails(onAbort, [], undefined))\n\t\t\t?? opts.abortCtrl?.signal?.reason\n\t\t\t?? opts.signal?.reason\n\t\t\t?? opts.errMsgs.aborted\n\n\t\tif (isError(err) && err.name === 'AbortError') {\n\t\t\terr.message = ['This operation was aborted'].includes(err.message)\n\t\t\t\t? opts.errMsgs.aborted\n\t\t\t\t: err.message\n\t\t}\n\t\treturn await interceptErr(\n\t\t\tisError(err) ? err : new Error(err),\n\t\t\turl,\n\t\t\topts,\n\t\t\tresponse,\n\t\t)\n\t}\n\topts.onTimeout = async () => {\n\t\tconst err = await fallbackIfFails(onTimeout, [], undefined)\n\t\treturn await interceptErr(\n\t\t\terr ?? new Error(opts.errMsgs.timedout),\n\t\t\turl,\n\t\t\topts,\n\t\t\tresponse,\n\t\t)\n\t}\n\treturn PromisE_timeout(opts, async () => {\n\t\ttry {\n\t\t\t// invoke body function before executing request interceptors\n\t\t\topts.body = await fallbackIfFails(\n\t\t\t\topts.body as unknown as Promise<PostBody>,\n\t\t\t\t[],\n\t\t\t\t(err: Error) => Promise.reject(err),\n\t\t\t)\n\n\t\t\t// invoke global and local response interceptors to intercept and/or transform `url` and `options`\n\t\t\turl = await executeInterceptors(\n\t\t\t\turl,\n\t\t\t\tabortCtrl.signal,\n\t\t\t\topts.interceptors?.request,\n\t\t\t\topts,\n\t\t\t)\n\n\t\t\tconst { body, errMsgs, validateUrl = false } = opts\n\t\t\topts.signal ??= abortCtrl.signal\n\t\t\tif (validateUrl && !isUrlValid(url, false))\n\t\t\t\tthrow new Error(errMsgs.invalidUrl)\n\n\t\t\tif (fromPostClient) {\n\t\t\t\tlet contentType = headers.get('content-type')\n\t\t\t\tif (!contentType) {\n\t\t\t\t\theaders.set('content-type', ContentType.APPLICATION_JSON)\n\t\t\t\t\tcontentType = ContentType.APPLICATION_JSON\n\t\t\t\t}\n\t\t\t\tconst shouldStringifyBody =\n\t\t\t\t\t['delete', 'patch', 'post', 'put'].includes(\n\t\t\t\t\t\t`${opts.method}`.toLowerCase(),\n\t\t\t\t\t)\n\t\t\t\t\t&& !['undefined', 'string'].includes(typeof body)\n\t\t\t\t\t&& isObj(body, true)\n\t\t\t\t\t&& contentType === ContentType.APPLICATION_JSON\n\t\t\t\t// stringify data/body\n\t\t\t\tif (shouldStringifyBody) opts.body = JSON.stringify(opts.body)\n\t\t\t}\n\n\t\t\t// make the fetch call\n\t\t\tresponse = await getResponse(url, opts)\n\t\t\t// invoke global and local request interceptors to intercept and/or transform `response`\n\t\t\tresponse = await executeInterceptors(\n\t\t\t\tresponse,\n\t\t\t\tabortCtrl.signal,\n\t\t\t\topts.interceptors?.response,\n\t\t\t\turl,\n\t\t\t\topts,\n\t\t\t)\n\t\t\tconst status = response?.status ?? 0\n\t\t\tconst isSuccess = status >= 200 && status < 300\n\t\t\tif (!isSuccess) {\n\t\t\t\tconst jsonError: unknown = await fallbackIfFails(\n\t\t\t\t\t// try to parse error response as json first\n\t\t\t\t\t() => response!.json(),\n\t\t\t\t\t[],\n\t\t\t\t\tundefined,\n\t\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t(jsonError as Error)?.message\n\t\t\t\t\t\t|| `${errMsgs.requestFailed} ${status}`,\n\t\t\t\t\t{ cause: jsonError },\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst parseFunc = response[parseAs as keyof typeof response]\n\t\t\tlet result: unknown = !isFn(parseFunc)\n\t\t\t\t? response\n\t\t\t\t: parseFunc.bind(response)()\n\t\t\tif (isPromise(result))\n\t\t\t\tresult = await result.catch((err: Error) =>\n\t\t\t\t\tPromise.reject(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`${errMsgs.parseFailed} ${parseAs}. ${err?.message}`,\n\t\t\t\t\t\t\t{ cause: err },\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t// invoke global and local request interceptors to intercept and/or transform parsed `result`\n\t\t\tresult = await executeInterceptors(\n\t\t\t\tresult,\n\t\t\t\tabortCtrl.signal,\n\t\t\t\topts.interceptors?.result,\n\t\t\t\turl,\n\t\t\t\topts,\n\t\t\t)\n\t\t\treturn result as TReturn\n\t\t} catch (_err: unknown) {\n\t\t\tlet err = _err as Error\n\n\t\t\terr = await interceptErr(_err as Error, url, opts, response)\n\t\t\treturn Promise.reject(err as FetchError)\n\t\t}\n\t}) as IPromise_Fetch<TReturn>\n}\n/** Default fetch options */\nfetch.defaults = {\n\tabortOnEarlyFinalize: true,\n\terrMsgs: {\n\t\taborted: 'Request aborted',\n\t\tinvalidUrl: 'Invalid URL',\n\t\tparseFailed: 'Failed to parse response as',\n\t\ttimedout: 'Request timed out',\n\t\trequestFailed: 'Request failed with status code:',\n\t} as Required<FetchErrMsgs>, // all error messages must be defined here\n\theaders: new Headers(),\n\tinterceptors: {\n\t\terror: [],\n\t\trequest: [],\n\t\tresponse: [],\n\t\tresult: [],\n\t},\n\ttimeout: 60_000,\n\tvalidateUrl: false,\n} as FetchOptionsDefault\n\nconst interceptErr = async (\n\terr: Error,\n\turl: string | URL,\n\toptions: FetchOptionsInterceptor,\n\tresponse?: Response,\n) => {\n\t// invoke global and local request interceptors to intercept and/or transform `error`\n\tconst fErr = await executeInterceptors(\n\t\tnew FetchError(err?.message ?? err, {\n\t\t\tcause: err?.cause ?? err,\n\t\t\tresponse: response,\n\t\t\toptions: options,\n\t\t\turl,\n\t\t}),\n\t\tundefined, // should execute regardless of abort status\n\t\toptions.interceptors?.error,\n\t\turl,\n\t\toptions,\n\t)\n\treturn fErr\n}\n\nexport default fetch\n","import { DeferredAsyncOptions, deferredCallback } from '@superutils/promise'\nimport fetch from './fetch'\nimport mergeOptions from './mergeOptions'\nimport type {\n\tExtractAs,\n\tExcludeOptions,\n\tFetchArgs,\n\tFetchOptions,\n\tGetFetchResult,\n\tIPromise_Fetch,\n} from './types'\nimport { FetchAs } from './types'\n\n/**\n * Defines client generic parameter T based on fixed options.\n *\n * If `fixedOptions.as` is defined and not `FetcAs.json`, then `T` will be `never`.\n */\nexport type ClientData<FixedOptions> =\n\tExtractAs<[FixedOptions]> extends FetchAs.json ? unknown : never // disallow providing T\n/**\n * Create a reusable fetch client with shared options. The returned function comes attached with a\n * `.deferred()` function for debounce and throttle behavior.\n *\n * The `createClient` utility streamlines the creation of dedicated API clients by generating pre-configured fetch\n * functions. These functions can be equipped with default options like headers, timeouts, or a specific HTTP method,\n * which minimizes code repetition across your application. If a method is not specified during creation, the client\n * will default to `GET`.\n *\n * The returned client also includes a `.deferred()` method, providing the same debounce, throttle, and sequential\n * execution capabilities found in functions like `fetch.get.deferred()`.\n *\n * @example\n * #### Create reusable clients\n * ```javascript\n * import { createClient } from '@superutils/fetch'\n *\n * // Create a \"GET\" client with default headers and a 5-second timeout\n * const apiClient = createClient(\n * \t { method: 'get' }, // fixed options cannot be overridden\n * \t { // default options can be overridden\n * \t headers: {\n * \t \tAuthorization: 'Bearer my-secret-token',\n * \t \t'Content-Type': 'application/json',\n * \t },\n * \t timeout: 5000,\n * \t },\n * \t {// default defer options (can be overridden)\n * \t delay: 300,\n * \t retry: 2, // If request fails, retry up to two more times\n * \t },\n * )\n *\n * // Use it just like the standard fetch\n * apiClient('[DUMMYJSON-DOT-COM]/products/1', {\n * // The 'method' property cannot be overridden as it is used in the fixed options when creating the client.\n * // In TypeScript, the compiler will not allow this property.\n * // In Javascript, it will simply be ignored.\n * // method: 'post',\n * timeout: 3000, // The 'timeout' property can be overridden\n * }).then(console.log, console.warn)\n *\n * // create a deferred client using \"apiClient\"\n * const deferredClient = apiClient.deferred(\n * { retry: 0 }, // disable retrying by overriding the `retry` defer option\n * '[DUMMYJSON-DOT-COM]/products/1',\n * { timeout: 3000 },\n * )\n * deferredClient({ timeout: 10000 }) // timeout is overridden by individual request\n * \t.then(console.log, console.warn)\n * ```\n */\nexport const createClient = <\n\tFixedOptions extends FetchOptions | undefined,\n\tCommonOptions extends ExcludeOptions<FixedOptions> | undefined,\n\tCommonDelay extends number,\n>(\n\t/** Mandatory fetch options that cannot be overriden by individual request */\n\tfixedOptions?: FixedOptions,\n\t/** Common fetch options that can be overriden by individual request */\n\tcommonOptions?: FetchOptions & CommonOptions,\n\tcommonDeferOptions?: DeferredAsyncOptions<unknown, CommonDelay>,\n) => {\n\tfunction client<\n\t\tT extends ClientData<FixedOptions> = never,\n\t\tTOptions extends ExcludeOptions<FixedOptions> | undefined =\n\t\t\t| ExcludeOptions<FixedOptions>\n\t\t\t| undefined,\n\t\tResult = GetFetchResult<[FixedOptions, TOptions, CommonOptions], T>,\n\t>(url: FetchArgs[0], options?: TOptions): IPromise_Fetch<Result> {\n\t\tconst mergedOptions = mergeOptions(\n\t\t\tfetch.defaults,\n\t\t\tcommonOptions,\n\t\t\toptions,\n\t\t\tfixedOptions, // fixed options will always override other options\n\t\t)\n\t\tmergedOptions.as ??= FetchAs.json\n\t\treturn fetch(url, mergedOptions)\n\t}\n\n\t/** Make requests with debounce/throttle behavior */\n\tclient.deferred = <\n\t\tThisArg,\n\t\tDelay extends CommonDelay | number,\n\t\tDefaultUrl extends FetchArgs[0] | undefined = FetchArgs[0] | undefined,\n\t\tDefaultOptions extends ExcludeOptions<FixedOptions> | undefined =\n\t\t\t| ExcludeOptions<FixedOptions>\n\t\t\t| undefined,\n\t>(\n\t\tdeferOptions?: DeferredAsyncOptions<ThisArg, Delay>,\n\t\tdefaultUrl?: DefaultUrl,\n\t\tdefaultOptions?: DefaultOptions,\n\t) => {\n\t\tlet _abortCtrl: AbortController | undefined\n\t\tconst fetchCb = <\n\t\t\tT extends ClientData<FixedOptions> = never,\n\t\t\tTOptions extends ExcludeOptions<FixedOptions> | undefined =\n\t\t\t\t| ExcludeOptions<FixedOptions>\n\t\t\t\t| undefined,\n\t\t\tResult = GetFetchResult<\n\t\t\t\t[FixedOptions, TOptions, DefaultOptions, CommonOptions],\n\t\t\t\tT\n\t\t\t>,\n\t\t>(\n\t\t\t...args: DefaultUrl extends undefined\n\t\t\t\t? [url: FetchArgs[0], options?: TOptions]\n\t\t\t\t: [options?: TOptions]\n\t\t): IPromise_Fetch<Result> => {\n\t\t\tconst mergedOptions = (mergeOptions(\n\t\t\t\tfetch.defaults,\n\t\t\t\tcommonOptions,\n\t\t\t\tdefaultOptions,\n\t\t\t\t(defaultUrl === undefined ? args[1] : args[0]) as TOptions,\n\t\t\t\tfixedOptions, // fixed options will always override other options\n\t\t\t) ?? {}) as FetchOptions\n\t\t\tmergedOptions.as ??= FetchAs.json\n\t\t\t// make sure to abort any previously pending request\n\t\t\t_abortCtrl?.abort?.()\n\t\t\t// ensure AbortController is present in options and propagete external abort signal if provided\n\t\t\t_abortCtrl = new AbortController()\n\n\t\t\treturn fetch(\n\t\t\t\t(defaultUrl ?? args[0]) as FetchArgs[0],\n\t\t\t\tmergedOptions,\n\t\t\t) as unknown as IPromise_Fetch<Result>\n\t\t}\n\n\t\treturn deferredCallback(fetchCb, {\n\t\t\t...commonDeferOptions,\n\t\t\t...deferOptions,\n\t\t} as DeferredAsyncOptions<ThisArg, CommonDelay>) as typeof fetchCb\n\t}\n\n\treturn client\n}\nexport default createClient\n","import { DeferredAsyncOptions, deferredCallback } from '@superutils/promise'\nimport { ClientData } from './createClient'\nimport fetch from './fetch'\nimport mergeOptions from './mergeOptions'\nimport {\n\tExcludePostOptions,\n\tFetchAs,\n\tPostArgs,\n\tPostDeferredCbArgs,\n\tPostOptions,\n\tIPromise_Fetch,\n\tGetFetchResult,\n} from './types'\n\n/**\n * Create a reusable fetch client with shared options. The returned function comes attached with a\n * `.deferred()` function for debounced and throttled request.\n * While `createClient()` is versatile enough for any HTTP method, `createPostClient()` is specifically designed for\n * methods that require a request body, such as `DELETE`, `PATCH`, `POST`, and `PUT`. If a method is not provided, it\n * defaults to `POST`. The generated client accepts an additional second parameter (`data`) for the request payload.\n *\n * Similar to `createClient`, the returned function comes equipped with a `.deferred()` method, enabling debounced,\n * throttled, or sequential execution.\n *\n * @example\n * #### Create reusable clients\n * ```javascript\n * import { createPostClient, FetchAs } from '@superutils/fetch'\n *\n * // Create a POST client with 10-second as the default timeout\n * const postClient = createPostClient(\n * \t{ // fixed options cannot be overrided by client calls\n * \t method: 'post',\n * \t headers: { 'content-type': 'application/json' },\n * \t},\n * \t{ timeout: 10000 }, // common options that can be overriden by client calls\n * )\n *\n * // Invoking `postClient()` automatically applies the pre-configured options\n * postClient(\n * \t '[DUMMYJSON-DOT-COM]/products/add',\n * \t { title: 'New Product' }, // data/body\n * \t {}, // other options\n * ).then(console.log)\n *\n * // create a deferred client using \"postClient\"\n * const updateProduct = postClient.deferred(\n * \t{\n * \t\tdelay: 300, // debounce duration\n * \t\tonResult: console.log, // prints only successful results\n * \t},\n * \t'[DUMMYJSON-DOT-COM]/products/add',\n * \t{ method: 'patch', timeout: 3000 },\n * )\n * updateProduct({ title: 'New title 1' }) // ignored by debounce\n * updateProduct({ title: 'New title 2' }) // executed\n * ```\n */\nexport const createPostClient = <\n\tFixedOptions extends PostOptions | undefined,\n\tCommonOptions extends ExcludePostOptions<FixedOptions> | undefined,\n\tCommonDelay extends number = number,\n>(\n\t/** Mandatory fetch options that cannot be overriden by individual request */\n\tfixedOptions?: FixedOptions,\n\t/** Common fetch options that can be overriden by individual request */\n\tcommonOptions?: PostOptions & CommonOptions,\n\tcommonDeferOptions?: DeferredAsyncOptions<unknown, CommonDelay>,\n) => {\n\t/**\n\t * Executes the HTTP request using the configured client options.\n\t *\n\t * This function is specifically designed for methods that require a request body (e.g., POST, PUT, PATCH),\n\t * allowing the payload to be passed directly as the second argument.\n\t */\n\tfunction client<\n\t\tT extends ClientData<FixedOptions> = never,\n\t\tOptions extends ExcludePostOptions<FixedOptions> | undefined =\n\t\t\t| ExcludePostOptions<FixedOptions>\n\t\t\t| undefined,\n\t\tResult = GetFetchResult<[FixedOptions, Options, CommonOptions], T>,\n\t>(\n\t\turl: PostArgs[0],\n\t\tdata?: PostArgs[1],\n\t\toptions?: Options,\n\t): IPromise_Fetch<Result> {\n\t\tconst mergedOptions = mergeOptions(\n\t\t\tfetch.defaults,\n\t\t\tcommonOptions,\n\t\t\toptions,\n\t\t\tfixedOptions, // fixed options will always override other options\n\t\t) as PostOptions\n\t\tmergedOptions.as ??= FetchAs.json\n\t\tmergedOptions.body = data ?? mergedOptions.body\n\t\tmergedOptions.method ??= 'post'\n\t\t;(mergedOptions as Record<string, boolean>).fromPostClient = true\n\t\treturn fetch(url, mergedOptions)\n\t}\n\n\t/**\n\t * Returns a version of the client configured for debounced, throttled, or sequential execution.\n\t *\n\t * This is particularly useful for optimizing high-frequency operations, such as auto-saving forms\n\t * or managing rapid state updates, by automatically handling request cancellation and execution timing.\n\t */\n\tclient.deferred = <\n\t\tThisArg,\n\t\tDefaultUrl extends PostArgs[0] | undefined,\n\t\tDefaultData extends PostArgs[1] | undefined,\n\t\tDefaultOptions extends ExcludePostOptions<FixedOptions> | undefined =\n\t\t\t| ExcludePostOptions<FixedOptions>\n\t\t\t| undefined,\n\t\tDelay extends CommonDelay | number = number,\n\t>(\n\t\tdeferOptions?: DeferredAsyncOptions<ThisArg, Delay>,\n\t\tdefaultUrl?: DefaultUrl,\n\t\tdefaultData?: DefaultData,\n\t\tdefaultOptions?: DefaultOptions,\n\t) => {\n\t\tlet _abortCtrl: AbortController | undefined\n\t\tconst postCb = <\n\t\t\tT extends ClientData<FixedOptions> = never,\n\t\t\tOptions extends ExcludePostOptions<FixedOptions> | undefined =\n\t\t\t\t| ExcludePostOptions<FixedOptions>\n\t\t\t\t| undefined,\n\t\t\tTReturn = GetFetchResult<\n\t\t\t\t[FixedOptions, Options, DefaultOptions, CommonOptions],\n\t\t\t\tT\n\t\t\t>,\n\t\t>(\n\t\t\t...args: PostDeferredCbArgs<DefaultUrl, DefaultData, Options>\n\t\t): IPromise_Fetch<TReturn> => {\n\t\t\t// add default url to the beginning of the array\n\t\t\tif (defaultUrl !== undefined) args.splice(0, 0, defaultUrl)\n\t\t\t// add default data after the url\n\t\t\tif (defaultData !== undefined) args.splice(1, 0, defaultData)\n\t\t\tconst mergedOptions = (mergeOptions(\n\t\t\t\tfetch.defaults,\n\t\t\t\tcommonOptions,\n\t\t\t\tdefaultOptions,\n\t\t\t\targs[2] as Options,\n\t\t\t\tfixedOptions, // fixed options will always override other options\n\t\t\t) ?? {}) as PostOptions\n\t\t\tmergedOptions.as ??= FetchAs.json\n\t\t\t// make sure to abort any previously pending request\n\t\t\t_abortCtrl?.abort?.()\n\t\t\t// ensure AbortController is present in options and propagete external abort signal if provided\n\t\t\t_abortCtrl = new AbortController()\n\n\t\t\t// attach body to options\n\t\t\tmergedOptions.body = (args[1] ?? mergedOptions.body) as PostArgs[1]\n\t\t\tmergedOptions.method ??= 'post'\n\t\t\t;(mergedOptions as Record<string, boolean>).fromPostClient = true\n\t\t\treturn fetch(args[0] as PostArgs[0], mergedOptions)\n\t\t}\n\n\t\treturn deferredCallback(postCb, {\n\t\t\t...commonDeferOptions,\n\t\t\t...deferOptions,\n\t\t} as typeof deferOptions) as typeof postCb\n\t}\n\n\treturn client\n}\nexport default createPostClient\n","/** This is an entrypoint tailored for IIFE builds for browsers. */\nimport * as promiseExports from '@superutils/promise'\nimport * as fetchExports from './index'\n\n/**\n * Export the fetch function and include all other exports as it's property\n *\n * ### Usage:\n * - `window.superutils.fetch(...)`\n * - `window.superutils.fetch.get(...)`\n * - `window.superutils.fetch.createClient(...)`\n */\nconst fetch = fetchExports.default\n\nObject.keys(fetchExports).forEach(key => {\n\tif (['default', 'fetch'].includes(key)) return\n\t;(fetch as unknown as Record<string, unknown>)[key] ??= (\n\t\tfetchExports as Record<string, unknown>\n\t)[key]\n})\nexport default fetch\n\n/**\n * Include all exports from @supertuils/promise:\n * 1. as if it were imported independantly\n * 2. only adds ~0.5KB (95%+ of the code is already used by @superutils/fetch)\n * 3. eliminates the need to import it separately\n * window.superutils.fetch(...)\n * window.superutils.fetch.get(...)\n * window.superutils.fetch.createClient(...)\n *\n * Usage:\n * window.\n */\nconst PromisE = promiseExports.default\nObject.keys(promiseExports).forEach(key => {\n\tif (['default', 'PromisE'].includes(key)) return\n\t;(PromisE as unknown as Record<string, unknown>)[key] ??= (\n\t\tpromiseExports as Record<string, unknown>\n\t)[key]\n})\nconst w = globalThis as unknown as Record<string, Record<string, unknown>>\nw.superutils ??= {}\nw.superutils.PromisE ??= PromisE\n"]}
package/dist/index.d.cts CHANGED
@@ -52,7 +52,7 @@ type Interceptor<T, TArgs extends unknown[]> = (...args: [value: T, ...TArgs]) =
52
52
  *
53
53
  * // not returning anything or returning undefined will avoid transforming the error.
54
54
  * const logError = fetchErr => console.log(fetchErr)
55
- * const result = await fetch.get('https://dummyjson.com/http/400', {
55
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/http/400', {
56
56
  * interceptors: {
57
57
  * error: [logError]
58
58
  * }
@@ -71,7 +71,7 @@ type Interceptor<T, TArgs extends unknown[]> = (...args: [value: T, ...TArgs]) =
71
71
  * fetchErr.message = 'Custom errormessage'
72
72
  * return Promise.resolve(fetchErr)
73
73
  * }
74
- * const result = await fetch.get('https://dummyjson.com/http/400', {
74
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/http/400', {
75
75
  * interceptors: {
76
76
  * error: [transformError]
77
77
  * }
@@ -95,7 +95,7 @@ type FetchInterceptorError = Interceptor<FetchError, FetchArgsInterceptor>;
95
95
  * const includeAuthToken = (url, options) => {
96
96
  * options.headers.set('x-auth-token', 'my-auth-token')
97
97
  * }
98
- * const result = await fetch.get('https://dummyjson.com/products', {
98
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/products', {
99
99
  * method: 'post',
100
100
  * interceptors: {
101
101
  * result: [apiV1ToV2, includeAuthToken]
@@ -121,12 +121,12 @@ type FetchInterceptorRequest = Interceptor<FetchArgs[0], [
121
121
  * // just a hypothetical scenario ;)
122
122
  * const getUser = async response => {
123
123
  * const authResult = await response.json()
124
- * const userDetails = await fetch.get('https://dummyjson.com/users/1')
124
+ * const userDetails = await fetch.get('[DUMMYJSON-DOT-COM]/users/1')
125
125
  * const userAuth = { ...userDetails, ...authResult }
126
126
  * return new Response(JSON.stringify(userAuth))
127
127
  * }
128
128
  * const user = await fetch.post(
129
- * 'https://dummyjson.com/user/login',
129
+ * '[DUMMYJSON-DOT-COM]/user/login',
130
130
  * { // data/request body
131
131
  * username: 'emilys',
132
132
  * password: 'emilyspass',
@@ -179,7 +179,7 @@ type FetchInterceptorResponse = Interceptor<Response, FetchArgsInterceptor>;
179
179
  * )
180
180
  * }
181
181
  * // now we make the actaul fetch request
182
- * const result = await fetch.get('https://dummyjson.com/users/1', {
182
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/users/1', {
183
183
  * interceptors: {
184
184
  * result: [
185
185
  * ensureBalanceHex,
@@ -489,7 +489,7 @@ type ClientData<FixedOptions> = ExtractAs<[FixedOptions]> extends FetchAs.json ?
489
489
  * )
490
490
  *
491
491
  * // Use it just like the standard fetch
492
- * apiClient('https://dummyjson.com/products/1', {
492
+ * apiClient('[DUMMYJSON-DOT-COM]/products/1', {
493
493
  * // The 'method' property cannot be overridden as it is used in the fixed options when creating the client.
494
494
  * // In TypeScript, the compiler will not allow this property.
495
495
  * // In Javascript, it will simply be ignored.
@@ -500,7 +500,7 @@ type ClientData<FixedOptions> = ExtractAs<[FixedOptions]> extends FetchAs.json ?
500
500
  * // create a deferred client using "apiClient"
501
501
  * const deferredClient = apiClient.deferred(
502
502
  * { retry: 0 }, // disable retrying by overriding the `retry` defer option
503
- * 'https://dummyjson.com/products/1',
503
+ * '[DUMMYJSON-DOT-COM]/products/1',
504
504
  * { timeout: 3000 },
505
505
  * )
506
506
  * deferredClient({ timeout: 10000 }) // timeout is overridden by individual request
@@ -542,7 +542,7 @@ commonOptions?: FetchOptions & CommonOptions, commonDeferOptions?: DeferredAsync
542
542
  *
543
543
  * // Invoking `postClient()` automatically applies the pre-configured options
544
544
  * postClient(
545
- * 'https://dummyjson.com/products/add',
545
+ * '[DUMMYJSON-DOT-COM]/products/add',
546
546
  * { title: 'New Product' }, // data/body
547
547
  * {}, // other options
548
548
  * ).then(console.log)
@@ -553,7 +553,7 @@ commonOptions?: FetchOptions & CommonOptions, commonDeferOptions?: DeferredAsync
553
553
  * delay: 300, // debounce duration
554
554
  * onResult: console.log, // prints only successful results
555
555
  * },
556
- * 'https://dummyjson.com/products/add',
556
+ * '[DUMMYJSON-DOT-COM]/products/add',
557
557
  * { method: 'patch', timeout: 3000 },
558
558
  * )
559
559
  * updateProduct({ title: 'New title 1' }) // ignored by debounce
@@ -601,7 +601,7 @@ declare const executeInterceptors: <T, TArgs extends unknown[]>(value: T, signal
601
601
  * import { fetch } from '@superutils/fetch'
602
602
  *
603
603
  * // no need for `response.json()` or `result.data.data` drilling
604
- * fetch.get('https://dummyjson.com/products/1')
604
+ * fetch.get('[DUMMYJSON-DOT-COM]/products/1')
605
605
  * .then(product => console.log(product))
606
606
  * ```
607
607
  */
@@ -877,7 +877,7 @@ declare const methods: {
877
877
  * ```javascript
878
878
  * import fetch from '@superutils/fetch'
879
879
  *
880
- * fetch('https://dummyjson.com/products/1')
880
+ * fetch('[DUMMYJSON-DOT-COM]/products/1')
881
881
  * .then(response => response.json())
882
882
  * .then(console.log, console.error)
883
883
  * ```
@@ -888,9 +888,9 @@ declare const methods: {
888
888
  * import fetch from '@superutils/fetch'
889
889
  *
890
890
  * // no need for `response.json()` or `result.data.data` drilling
891
- * fetch.get('https://dummyjson.com/products/1')
891
+ * fetch.get('[DUMMYJSON-DOT-COM]/products/1')
892
892
  * .then(product => console.log(product))
893
- * fetch.post('https://dummyjson.com/products/add', { title: 'Product title' })
893
+ * fetch.post('[DUMMYJSON-DOT-COM]/products/add', { title: 'Product title' })
894
894
  * .then(product => console.log(product))
895
895
  * ```
896
896
  *
package/dist/index.d.ts CHANGED
@@ -52,7 +52,7 @@ type Interceptor<T, TArgs extends unknown[]> = (...args: [value: T, ...TArgs]) =
52
52
  *
53
53
  * // not returning anything or returning undefined will avoid transforming the error.
54
54
  * const logError = fetchErr => console.log(fetchErr)
55
- * const result = await fetch.get('https://dummyjson.com/http/400', {
55
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/http/400', {
56
56
  * interceptors: {
57
57
  * error: [logError]
58
58
  * }
@@ -71,7 +71,7 @@ type Interceptor<T, TArgs extends unknown[]> = (...args: [value: T, ...TArgs]) =
71
71
  * fetchErr.message = 'Custom errormessage'
72
72
  * return Promise.resolve(fetchErr)
73
73
  * }
74
- * const result = await fetch.get('https://dummyjson.com/http/400', {
74
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/http/400', {
75
75
  * interceptors: {
76
76
  * error: [transformError]
77
77
  * }
@@ -95,7 +95,7 @@ type FetchInterceptorError = Interceptor<FetchError, FetchArgsInterceptor>;
95
95
  * const includeAuthToken = (url, options) => {
96
96
  * options.headers.set('x-auth-token', 'my-auth-token')
97
97
  * }
98
- * const result = await fetch.get('https://dummyjson.com/products', {
98
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/products', {
99
99
  * method: 'post',
100
100
  * interceptors: {
101
101
  * result: [apiV1ToV2, includeAuthToken]
@@ -121,12 +121,12 @@ type FetchInterceptorRequest = Interceptor<FetchArgs[0], [
121
121
  * // just a hypothetical scenario ;)
122
122
  * const getUser = async response => {
123
123
  * const authResult = await response.json()
124
- * const userDetails = await fetch.get('https://dummyjson.com/users/1')
124
+ * const userDetails = await fetch.get('[DUMMYJSON-DOT-COM]/users/1')
125
125
  * const userAuth = { ...userDetails, ...authResult }
126
126
  * return new Response(JSON.stringify(userAuth))
127
127
  * }
128
128
  * const user = await fetch.post(
129
- * 'https://dummyjson.com/user/login',
129
+ * '[DUMMYJSON-DOT-COM]/user/login',
130
130
  * { // data/request body
131
131
  * username: 'emilys',
132
132
  * password: 'emilyspass',
@@ -179,7 +179,7 @@ type FetchInterceptorResponse = Interceptor<Response, FetchArgsInterceptor>;
179
179
  * )
180
180
  * }
181
181
  * // now we make the actaul fetch request
182
- * const result = await fetch.get('https://dummyjson.com/users/1', {
182
+ * const result = await fetch.get('[DUMMYJSON-DOT-COM]/users/1', {
183
183
  * interceptors: {
184
184
  * result: [
185
185
  * ensureBalanceHex,
@@ -489,7 +489,7 @@ type ClientData<FixedOptions> = ExtractAs<[FixedOptions]> extends FetchAs.json ?
489
489
  * )
490
490
  *
491
491
  * // Use it just like the standard fetch
492
- * apiClient('https://dummyjson.com/products/1', {
492
+ * apiClient('[DUMMYJSON-DOT-COM]/products/1', {
493
493
  * // The 'method' property cannot be overridden as it is used in the fixed options when creating the client.
494
494
  * // In TypeScript, the compiler will not allow this property.
495
495
  * // In Javascript, it will simply be ignored.
@@ -500,7 +500,7 @@ type ClientData<FixedOptions> = ExtractAs<[FixedOptions]> extends FetchAs.json ?
500
500
  * // create a deferred client using "apiClient"
501
501
  * const deferredClient = apiClient.deferred(
502
502
  * { retry: 0 }, // disable retrying by overriding the `retry` defer option
503
- * 'https://dummyjson.com/products/1',
503
+ * '[DUMMYJSON-DOT-COM]/products/1',
504
504
  * { timeout: 3000 },
505
505
  * )
506
506
  * deferredClient({ timeout: 10000 }) // timeout is overridden by individual request
@@ -542,7 +542,7 @@ commonOptions?: FetchOptions & CommonOptions, commonDeferOptions?: DeferredAsync
542
542
  *
543
543
  * // Invoking `postClient()` automatically applies the pre-configured options
544
544
  * postClient(
545
- * 'https://dummyjson.com/products/add',
545
+ * '[DUMMYJSON-DOT-COM]/products/add',
546
546
  * { title: 'New Product' }, // data/body
547
547
  * {}, // other options
548
548
  * ).then(console.log)
@@ -553,7 +553,7 @@ commonOptions?: FetchOptions & CommonOptions, commonDeferOptions?: DeferredAsync
553
553
  * delay: 300, // debounce duration
554
554
  * onResult: console.log, // prints only successful results
555
555
  * },
556
- * 'https://dummyjson.com/products/add',
556
+ * '[DUMMYJSON-DOT-COM]/products/add',
557
557
  * { method: 'patch', timeout: 3000 },
558
558
  * )
559
559
  * updateProduct({ title: 'New title 1' }) // ignored by debounce
@@ -601,7 +601,7 @@ declare const executeInterceptors: <T, TArgs extends unknown[]>(value: T, signal
601
601
  * import { fetch } from '@superutils/fetch'
602
602
  *
603
603
  * // no need for `response.json()` or `result.data.data` drilling
604
- * fetch.get('https://dummyjson.com/products/1')
604
+ * fetch.get('[DUMMYJSON-DOT-COM]/products/1')
605
605
  * .then(product => console.log(product))
606
606
  * ```
607
607
  */
@@ -877,7 +877,7 @@ declare const methods: {
877
877
  * ```javascript
878
878
  * import fetch from '@superutils/fetch'
879
879
  *
880
- * fetch('https://dummyjson.com/products/1')
880
+ * fetch('[DUMMYJSON-DOT-COM]/products/1')
881
881
  * .then(response => response.json())
882
882
  * .then(console.log, console.error)
883
883
  * ```
@@ -888,9 +888,9 @@ declare const methods: {
888
888
  * import fetch from '@superutils/fetch'
889
889
  *
890
890
  * // no need for `response.json()` or `result.data.data` drilling
891
- * fetch.get('https://dummyjson.com/products/1')
891
+ * fetch.get('[DUMMYJSON-DOT-COM]/products/1')
892
892
  * .then(product => console.log(product))
893
- * fetch.post('https://dummyjson.com/products/add', { title: 'Product title' })
893
+ * fetch.post('[DUMMYJSON-DOT-COM]/products/add', { title: 'Product title' })
894
894
  * .then(product => console.log(product))
895
895
  * ```
896
896
  *
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  },
6
6
  "description": "A lightweight `fetch` wrapper for browsers and Node.js, designed to simplify data fetching and reduce boilerplate.",
7
7
  "dependencies": {
8
- "@superutils/core": "^1.2.5",
9
- "@superutils/promise": "^1.3.3"
8
+ "@superutils/core": "^1.2.6",
9
+ "@superutils/promise": "^1.3.4"
10
10
  },
11
11
  "files": [
12
12
  "dist",
@@ -53,6 +53,6 @@
53
53
  "module": "./dist/index.js",
54
54
  "type": "module",
55
55
  "types": "./dist/index.d.ts",
56
- "version": "1.5.3",
57
- "gitHead": "da664cdcf3ce784d931e94a73627a9b259ae6381"
56
+ "version": "1.5.4",
57
+ "gitHead": "3635cab194aaa64c633839fdaab5b243a07d0f66"
58
58
  }