@instockng/storefront-ui 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/components/ui/button.d.ts +1 -1
  2. package/dist/index100.mjs +1 -1
  3. package/dist/index101.mjs +3 -3
  4. package/dist/index102.mjs +3 -3
  5. package/dist/index110.mjs +1 -1
  6. package/dist/index18.mjs +12 -21
  7. package/dist/index20.mjs +4 -9
  8. package/dist/index21.mjs +1 -1
  9. package/dist/index28.mjs +11 -11
  10. package/dist/index29.mjs +1 -1
  11. package/dist/index30.mjs +1 -1
  12. package/dist/index31.mjs +1 -1
  13. package/dist/index32.mjs +1 -1
  14. package/dist/index33.mjs +3 -3
  15. package/dist/index36.mjs +1 -1
  16. package/dist/index40.mjs +36 -23
  17. package/dist/index41.mjs +44 -36
  18. package/dist/index42.mjs +99 -44
  19. package/dist/index43.mjs +97 -99
  20. package/dist/index44.mjs +47 -78
  21. package/dist/index45.mjs +54 -53
  22. package/dist/index46.mjs +63 -55
  23. package/dist/index47.mjs +56 -79
  24. package/dist/index48.mjs +57 -63
  25. package/dist/index49.mjs +15 -70
  26. package/dist/index50.mjs +14 -14
  27. package/dist/index51.mjs +59 -13
  28. package/dist/index52.mjs +99 -36
  29. package/dist/index53.mjs +97 -97
  30. package/dist/index54.mjs +4 -132
  31. package/dist/index55.mjs +21 -73
  32. package/dist/index56.mjs +74 -14
  33. package/dist/index57.mjs +14 -62
  34. package/dist/index58.mjs +62 -4
  35. package/dist/index59.mjs +234 -3
  36. package/dist/index60.mjs +6 -2
  37. package/dist/index61.mjs +130 -30
  38. package/dist/index62.mjs +64 -39
  39. package/dist/index63.mjs +80 -228
  40. package/dist/index64.mjs +28 -5
  41. package/dist/index65.mjs +7 -132
  42. package/dist/index66.mjs +69 -62
  43. package/dist/index67.mjs +3 -86
  44. package/dist/index68.mjs +2 -29
  45. package/dist/index69.mjs +81 -7
  46. package/dist/index70.mjs +51 -72
  47. package/dist/index71.mjs +5 -3
  48. package/dist/index72.mjs +5 -2
  49. package/dist/index73.mjs +169 -73
  50. package/dist/index74.mjs +50 -51
  51. package/dist/index75.mjs +69 -6
  52. package/dist/index76.mjs +34 -5
  53. package/dist/index77.mjs +41 -177
  54. package/dist/index78.mjs +4 -53
  55. package/dist/index79.mjs +2 -69
  56. package/dist/index80.mjs +1 -1
  57. package/dist/index81.mjs +1 -1
  58. package/dist/index82.mjs +5 -5
  59. package/dist/index84.mjs +2 -2
  60. package/dist/index86.mjs +2 -2
  61. package/dist/index88.mjs +1 -1
  62. package/dist/index90.mjs +4 -4
  63. package/dist/index91.mjs +3 -3
  64. package/dist/index92.mjs +1 -1
  65. package/dist/index93.mjs +3 -3
  66. package/dist/index98.mjs +1 -1
  67. package/dist/styles.css +1 -1
  68. package/package.json +10 -9
  69. package/dist/test-utils/MockCartProvider.d.ts +0 -21
  70. package/dist/test-utils/MockCartProvider.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
4
+ variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
5
  size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, asChild, loading, children, disabled, type, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
package/dist/index100.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import i from "./index107.mjs";
3
3
  import m from "./index108.mjs";
4
- import f from "./index63.mjs";
4
+ import f from "./index59.mjs";
5
5
  const h = (t, o, a = 3) => {
6
6
  let r = 0;
7
7
  const c = i(50, 250);
package/dist/index101.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import n from "./index87.mjs";
3
- import m from "./index63.mjs";
3
+ import m from "./index59.mjs";
4
4
  import c from "./index109.mjs";
5
5
  import h from "./index110.mjs";
6
6
  import w from "./index83.mjs";
7
- import b from "./index66.mjs";
8
- import C from "./index77.mjs";
7
+ import b from "./index62.mjs";
8
+ import C from "./index73.mjs";
9
9
  import g from "./index80.mjs";
10
10
  const E = (a) => {
11
11
  const e = b({}, a);
package/dist/index102.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import a from "./index69.mjs";
3
- import s from "./index74.mjs";
4
- import m from "./index63.mjs";
2
+ import a from "./index65.mjs";
3
+ import s from "./index70.mjs";
4
+ import m from "./index59.mjs";
5
5
  const h = (e, t) => {
6
6
  const { length: l } = e = e ? e.filter(Boolean) : [];
7
7
  if (t || l) {
package/dist/index110.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import r from "./index63.mjs";
2
+ import r from "./index59.mjs";
3
3
  import c from "./index87.mjs";
4
4
  const p = c.hasStandardBrowserEnv ? (
5
5
  // Standard browser envs support document.cookie
package/dist/index18.mjs CHANGED
@@ -3,14 +3,8 @@ import { jsx as r } from "react/jsx-runtime";
3
3
  import { createContext as p, useEffect as C, useMemo as f, useContext as m } from "react";
4
4
  import { QueryClient as d, QueryClientProvider as x } from "@tanstack/react-query";
5
5
  import { initializeApiClient as u } from "./index20.mjs";
6
- const s = p(null);
7
- function a({
8
- children: e,
9
- baseURL: t = "https://oms-api.instock.ng",
10
- authToken: l,
11
- onError: i,
12
- queryClient: n
13
- }) {
6
+ const l = p(null);
7
+ function a({ children: e, baseURL: t = "https://oms-api.instock.ng", authToken: s, onError: i, queryClient: n }) {
14
8
  const o = {
15
9
  baseURL: t,
16
10
  onError: i
@@ -18,22 +12,19 @@ function a({
18
12
  u(o), C(() => {
19
13
  u(o);
20
14
  }, [t, i]);
21
- const c = f(
22
- () => n || new d({
23
- defaultOptions: {
24
- queries: {
25
- retry: 1,
26
- refetchOnWindowFocus: !1,
27
- staleTime: 5e3
28
- }
15
+ const c = f(() => n || new d({
16
+ defaultOptions: {
17
+ queries: {
18
+ retry: 1,
19
+ refetchOnWindowFocus: !1,
20
+ staleTime: 5e3
29
21
  }
30
- }),
31
- [n]
32
- );
33
- return /* @__PURE__ */ r(x, { client: c, children: /* @__PURE__ */ r(s.Provider, { value: { baseURL: t, authToken: l }, children: e }) });
22
+ }
23
+ }), [n]);
24
+ return r(x, { client: c, children: r(l.Provider, { value: { baseURL: t, authToken: s }, children: e }) });
34
25
  }
35
26
  function y() {
36
- const e = m(s);
27
+ const e = m(l);
37
28
  if (!e)
38
29
  throw new Error("useApiClientContext must be used within ApiClientProvider");
39
30
  return e;
package/dist/index20.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import "./index41.mjs";
3
- import r from "./index42.mjs";
2
+ import "./index40.mjs";
3
+ import r from "./index41.mjs";
4
4
  let e = null;
5
5
  function p(t) {
6
6
  return e = r.create({
@@ -8,16 +8,11 @@ function p(t) {
8
8
  headers: {
9
9
  "Content-Type": "application/json"
10
10
  }
11
- }), e.interceptors.response.use(
12
- (i) => i,
13
- (i) => (t.onError && t.onError(i), Promise.reject(i))
14
- ), e;
11
+ }), e.interceptors.response.use((i) => i, (i) => (t.onError && t.onError(i), Promise.reject(i))), e;
15
12
  }
16
13
  function l() {
17
14
  if (!e)
18
- throw new Error(
19
- "API client not initialized. Make sure to wrap your app with ApiClientProvider."
20
- );
15
+ throw new Error("API client not initialized. Make sure to wrap your app with ApiClientProvider.");
21
16
  return e;
22
17
  }
23
18
  function a() {
package/dist/index21.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { hc as e } from "./index43.mjs";
2
+ import { hc as e } from "./index42.mjs";
3
3
  function n(s) {
4
4
  const r = `${s}/v1`;
5
5
  return {
package/dist/index28.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  'use client';
2
- import { useCreateOrder as s, useDeleteOrder as r, useGetOrder as u, useListOrders as o, useUpdateOrder as a, useUpdateOrderStatus as n } from "./index44.mjs";
3
- import { useCreateBrand as i, useDeleteBrand as p, useGetBrand as C, useListBrands as D, useUpdateBrand as c } from "./index45.mjs";
4
- import { useCreateProduct as G, useDeleteProduct as f, useGetProduct as m, useListProducts as v, useUpdateProduct as x } from "./index46.mjs";
5
- import { useCreateVariant as L, useDeleteVariant as S, useGetVariantInventory as U, useListProductVariants as O, useSearchVariants as V, useUpdateVariant as h } from "./index47.mjs";
6
- import { useCreateWarehouse as I, useDeleteWarehouse as P, useGetWarehouseInventory as A, useListWarehouses as W, useUpdateWarehouse as Z } from "./index48.mjs";
7
- import { useAdjustInventory as k, useGetInventoryTransactions as w, useGetLowStockVariants as T, useListInventory as j, useTransferInventory as E } from "./index49.mjs";
8
- import { useGetCustomerHistory as g } from "./index50.mjs";
9
- import { useGetStats as z } from "./index51.mjs";
10
- import { useCleanupExpiredCarts as J, useGetAbandonedCart as K, useGetAbandonedCartStats as M, useListAbandonedCarts as N } from "./index52.mjs";
11
- import { useBulkGenerateDiscountCodes as R, useCreateDiscountCode as X, useDeleteDiscountCode as Y, useGetDiscountCode as _, useGetDiscountCodeAnalytics as $, useGetDiscountCodeOverviewStats as ee, useListDiscountCodes as te, useUpdateDiscountCode as se } from "./index53.mjs";
12
- import { useCreateDeliveryZone as ue, useCreateState as oe, useDeleteDeliveryZone as ae, useDeleteState as ne, useListDeliveryZones as de, useListStates as ie, useUpdateDeliveryZone as pe, useUpdateState as Ce } from "./index54.mjs";
2
+ import { useCreateOrder as s, useDeleteOrder as r, useGetOrder as u, useListOrders as o, useUpdateOrder as a, useUpdateOrderStatus as n } from "./index43.mjs";
3
+ import { useCreateBrand as i, useDeleteBrand as p, useGetBrand as C, useListBrands as D, useUpdateBrand as c } from "./index44.mjs";
4
+ import { useCreateProduct as G, useDeleteProduct as f, useGetProduct as m, useListProducts as v, useUpdateProduct as x } from "./index45.mjs";
5
+ import { useCreateVariant as L, useDeleteVariant as S, useGetVariantInventory as U, useListProductVariants as O, useSearchVariants as V, useUpdateVariant as h } from "./index46.mjs";
6
+ import { useCreateWarehouse as I, useDeleteWarehouse as P, useGetWarehouseInventory as A, useListWarehouses as W, useUpdateWarehouse as Z } from "./index47.mjs";
7
+ import { useAdjustInventory as k, useGetInventoryTransactions as w, useGetLowStockVariants as T, useListInventory as j, useTransferInventory as E } from "./index48.mjs";
8
+ import { useGetCustomerHistory as g } from "./index49.mjs";
9
+ import { useGetStats as z } from "./index50.mjs";
10
+ import { useCleanupExpiredCarts as J, useGetAbandonedCart as K, useGetAbandonedCartStats as M, useListAbandonedCarts as N } from "./index51.mjs";
11
+ import { useBulkGenerateDiscountCodes as R, useCreateDiscountCode as X, useDeleteDiscountCode as Y, useGetDiscountCode as _, useGetDiscountCodeAnalytics as $, useGetDiscountCodeOverviewStats as ee, useListDiscountCodes as te, useUpdateDiscountCode as se } from "./index52.mjs";
12
+ import { useCreateDeliveryZone as ue, useCreateState as oe, useDeleteDeliveryZone as ae, useDeleteState as ne, useListDeliveryZones as de, useListStates as ie, useUpdateDeliveryZone as pe, useUpdateState as Ce } from "./index53.mjs";
13
13
  export {
14
14
  k as useAdjustInventory,
15
15
  R as useBulkGenerateDiscountCodes,
package/dist/index29.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useQueryClient as s, useMutation as i } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as o } from "./index58.mjs";
3
+ import { useQueryUnwrapped as o } from "./index54.mjs";
4
4
  import { queryKeys as r } from "./index26.mjs";
5
5
  import { updateCart as c, createCart as l, applyDiscount as y, removeDiscount as m, addCartItem as C, updateCartItem as p, removeCartItem as q, checkoutCart as d, fetchCart as f } from "./index23.mjs";
6
6
  function b(e, t) {
package/dist/index30.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useMutation as t } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as u } from "./index58.mjs";
3
+ import { useQueryUnwrapped as u } from "./index54.mjs";
4
4
  import { queryKeys as n } from "./index26.mjs";
5
5
  import { confirmOrder as i, fetchOrder as m } from "./index24.mjs";
6
6
  function y(e, r, o) {
package/dist/index31.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useQueryUnwrapped as u } from "./index58.mjs";
2
+ import { useQueryUnwrapped as u } from "./index54.mjs";
3
3
  import { queryKeys as t } from "./index26.mjs";
4
4
  import { fetchProductsByBrand as o, fetchProductBySlug as c } from "./index22.mjs";
5
5
  function n(r, e) {
package/dist/index32.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useQueryUnwrapped as o } from "./index58.mjs";
2
+ import { useQueryUnwrapped as o } from "./index54.mjs";
3
3
  import { queryKeys as i } from "./index26.mjs";
4
4
  import { fetchDeliveryZones as t } from "./index25.mjs";
5
5
  function p(e, r) {
package/dist/index33.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import { p as S } from "./index55.mjs";
3
- import { t as U } from "./index56.mjs";
4
- import he from "./index57.mjs";
2
+ import { p as S } from "./index56.mjs";
3
+ import { t as U } from "./index57.mjs";
4
+ import he from "./index58.mjs";
5
5
  const fe = Object.prototype.toString, de = Error.prototype.toString, pe = RegExp.prototype.toString, me = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", ye = /^Symbol\((.*)\)(.*)$/;
6
6
  function ge(n) {
7
7
  return n != +n ? "NaN" : n === 0 && 1 / n < 0 ? "-0" : "" + n;
package/dist/index36.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import * as l from "react";
3
- import { composeRefs as m } from "./index40.mjs";
3
+ import { composeRefs as m } from "./index55.mjs";
4
4
  import { jsx as u } from "react/jsx-runtime";
5
5
  // @__NO_SIDE_EFFECTS__
6
6
  function y(e) {
package/dist/index40.mjs CHANGED
@@ -1,26 +1,39 @@
1
1
  'use client';
2
- import "react";
3
- function i(n, o) {
4
- if (typeof n == "function")
5
- return n(o);
6
- n != null && (n.current = o);
7
- }
8
- function f(...n) {
9
- return (o) => {
10
- let u = !1;
11
- const c = n.map((t) => {
12
- const e = i(t, o);
13
- return !u && typeof e == "function" && (u = !0), e;
14
- });
15
- if (u)
16
- return () => {
17
- for (let t = 0; t < c.length; t++) {
18
- const e = c[t];
19
- typeof e == "function" ? e() : i(n[t], null);
20
- }
21
- };
22
- };
23
- }
2
+ import o from "./index41.mjs";
3
+ const {
4
+ Axios: e,
5
+ AxiosError: a,
6
+ CanceledError: s,
7
+ isCancel: t,
8
+ CancelToken: i,
9
+ VERSION: l,
10
+ all: n,
11
+ Cancel: d,
12
+ isAxiosError: x,
13
+ spread: C,
14
+ toFormData: c,
15
+ AxiosHeaders: m,
16
+ HttpStatusCode: p,
17
+ formToJSON: A,
18
+ getAdapter: f,
19
+ mergeConfig: E
20
+ } = o;
24
21
  export {
25
- f as composeRefs
22
+ e as Axios,
23
+ a as AxiosError,
24
+ m as AxiosHeaders,
25
+ d as Cancel,
26
+ i as CancelToken,
27
+ s as CanceledError,
28
+ p as HttpStatusCode,
29
+ l as VERSION,
30
+ n as all,
31
+ o as default,
32
+ A as formToJSON,
33
+ f as getAdapter,
34
+ x as isAxiosError,
35
+ t as isCancel,
36
+ E as mergeConfig,
37
+ C as spread,
38
+ c as toFormData
26
39
  };
package/dist/index41.mjs CHANGED
@@ -1,39 +1,47 @@
1
1
  'use client';
2
- import o from "./index42.mjs";
3
- const {
4
- Axios: e,
5
- AxiosError: a,
6
- CanceledError: s,
7
- isCancel: t,
8
- CancelToken: i,
9
- VERSION: l,
10
- all: n,
11
- Cancel: d,
12
- isAxiosError: x,
13
- spread: C,
14
- toFormData: c,
15
- AxiosHeaders: m,
16
- HttpStatusCode: p,
17
- formToJSON: A,
18
- getAdapter: f,
19
- mergeConfig: E
20
- } = o;
2
+ import a from "./index59.mjs";
3
+ import p from "./index60.mjs";
4
+ import m from "./index61.mjs";
5
+ import i from "./index62.mjs";
6
+ import f from "./index63.mjs";
7
+ import l from "./index64.mjs";
8
+ import c from "./index65.mjs";
9
+ import d from "./index66.mjs";
10
+ import u from "./index67.mjs";
11
+ import { VERSION as x } from "./index68.mjs";
12
+ import C from "./index69.mjs";
13
+ import A from "./index70.mjs";
14
+ import E from "./index71.mjs";
15
+ import O from "./index72.mjs";
16
+ import S from "./index73.mjs";
17
+ import H from "./index74.mjs";
18
+ import T from "./index75.mjs";
19
+ function n(o) {
20
+ const t = new m(o), e = p(m.prototype.request, t);
21
+ return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
22
+ return n(i(o, s));
23
+ }, e;
24
+ }
25
+ const r = n(f);
26
+ r.Axios = m;
27
+ r.CanceledError = c;
28
+ r.CancelToken = d;
29
+ r.isCancel = u;
30
+ r.VERSION = x;
31
+ r.toFormData = C;
32
+ r.AxiosError = A;
33
+ r.Cancel = r.CanceledError;
34
+ r.all = function(t) {
35
+ return Promise.all(t);
36
+ };
37
+ r.spread = E;
38
+ r.isAxiosError = O;
39
+ r.mergeConfig = i;
40
+ r.AxiosHeaders = S;
41
+ r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
42
+ r.getAdapter = H.getAdapter;
43
+ r.HttpStatusCode = T;
44
+ r.default = r;
21
45
  export {
22
- e as Axios,
23
- a as AxiosError,
24
- m as AxiosHeaders,
25
- d as Cancel,
26
- i as CancelToken,
27
- s as CanceledError,
28
- p as HttpStatusCode,
29
- l as VERSION,
30
- n as all,
31
- o as default,
32
- A as formToJSON,
33
- f as getAdapter,
34
- x as isAxiosError,
35
- t as isCancel,
36
- E as mergeConfig,
37
- C as spread,
38
- c as toFormData
46
+ r as default
39
47
  };
package/dist/index42.mjs CHANGED
@@ -1,47 +1,102 @@
1
1
  'use client';
2
- import a from "./index63.mjs";
3
- import p from "./index64.mjs";
4
- import m from "./index65.mjs";
5
- import i from "./index66.mjs";
6
- import f from "./index67.mjs";
7
- import l from "./index68.mjs";
8
- import c from "./index69.mjs";
9
- import d from "./index70.mjs";
10
- import u from "./index71.mjs";
11
- import { VERSION as x } from "./index72.mjs";
12
- import C from "./index73.mjs";
13
- import A from "./index74.mjs";
14
- import E from "./index75.mjs";
15
- import O from "./index76.mjs";
16
- import S from "./index77.mjs";
17
- import H from "./index78.mjs";
18
- import T from "./index79.mjs";
19
- function n(o) {
20
- const t = new m(o), e = p(m.prototype.request, t);
21
- return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
22
- return n(i(o, s));
23
- }, e;
24
- }
25
- const r = n(f);
26
- r.Axios = m;
27
- r.CanceledError = c;
28
- r.CancelToken = d;
29
- r.isCancel = u;
30
- r.VERSION = x;
31
- r.toFormData = C;
32
- r.AxiosError = A;
33
- r.Cancel = r.CanceledError;
34
- r.all = function(t) {
35
- return Promise.all(t);
36
- };
37
- r.spread = E;
38
- r.isAxiosError = O;
39
- r.mergeConfig = i;
40
- r.AxiosHeaders = S;
41
- r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
42
- r.getAdapter = H.getAdapter;
43
- r.HttpStatusCode = T;
44
- r.default = r;
2
+ var p = Object.defineProperty;
3
+ var k = (r, e, i) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
4
+ var h = (r, e, i) => k(r, typeof e != "symbol" ? e + "" : e, i);
5
+ import { serialize as j } from "./index76.mjs";
6
+ import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./index77.mjs";
7
+ var v = (r, e) => new Proxy(() => {
8
+ }, {
9
+ get(t, s) {
10
+ if (!(typeof s != "string" || s === "then"))
11
+ return v(r, [...e, s]);
12
+ },
13
+ apply(t, s, a) {
14
+ return r({
15
+ path: e,
16
+ args: a
17
+ });
18
+ }
19
+ }), T = class {
20
+ constructor(r, e) {
21
+ h(this, "url");
22
+ h(this, "method");
23
+ h(this, "queryParams");
24
+ h(this, "pathParams", {});
25
+ h(this, "rBody");
26
+ h(this, "cType");
27
+ h(this, "fetch", async (r, e) => {
28
+ if (r) {
29
+ if (r.query && (this.queryParams = S(r.query)), r.form) {
30
+ const o = new FormData();
31
+ for (const [c, f] of Object.entries(r.form))
32
+ if (Array.isArray(f))
33
+ for (const l of f)
34
+ o.append(c, l);
35
+ else
36
+ o.append(c, f);
37
+ this.rBody = o;
38
+ }
39
+ r.json && (this.rBody = JSON.stringify(r.json), this.cType = "application/json"), r.param && (this.pathParams = r.param);
40
+ }
41
+ let i = this.method.toUpperCase();
42
+ const t = {
43
+ ...r == null ? void 0 : r.header,
44
+ ...typeof (e == null ? void 0 : e.headers) == "function" ? await e.headers() : e == null ? void 0 : e.headers
45
+ };
46
+ if (r != null && r.cookie) {
47
+ const o = [];
48
+ for (const [c, f] of Object.entries(r.cookie))
49
+ o.push(j(c, f, { path: "/" }));
50
+ t.Cookie = o.join(",");
51
+ }
52
+ this.cType && (t["Content-Type"] = this.cType);
53
+ const s = new Headers(t ?? void 0);
54
+ let a = this.url;
55
+ a = w(a), a = P(a, this.pathParams), this.queryParams && (a = a + "?" + this.queryParams.toString()), i = this.method.toUpperCase();
56
+ const u = !(i === "GET" || i === "HEAD");
57
+ return ((e == null ? void 0 : e.fetch) || fetch)(a, {
58
+ body: u ? this.rBody : void 0,
59
+ method: i,
60
+ headers: s,
61
+ ...e == null ? void 0 : e.init
62
+ });
63
+ });
64
+ this.url = r, this.method = e;
65
+ }
66
+ }, E = (r, e) => v(function i(t) {
67
+ var l;
68
+ const s = [...t.path], a = s.slice(-3).reverse();
69
+ if (a[0] === "toString")
70
+ return a[1] === "name" ? a[2] || "" : i.toString();
71
+ if (a[0] === "valueOf")
72
+ return a[1] === "name" ? a[2] || "" : i;
73
+ let u = "";
74
+ if (/^\$/.test(a[0])) {
75
+ const n = s.pop();
76
+ n && (u = n.replace(/^\$/, ""));
77
+ }
78
+ const o = s.join("/"), c = U(r, o);
79
+ if (u === "url") {
80
+ let n = c;
81
+ return t.args[0] && (t.args[0].param && (n = P(c, t.args[0].param)), t.args[0].query && (n = n + "?" + S(t.args[0].query).toString())), n = w(n), new URL(n);
82
+ }
83
+ if (u === "ws") {
84
+ const n = x(
85
+ t.args[0] && t.args[0].param ? P(c, t.args[0].param) : c,
86
+ "ws"
87
+ ), y = new URL(n), b = (l = t.args[0]) == null ? void 0 : l.query;
88
+ return b && Object.entries(b).forEach(([m, d]) => {
89
+ Array.isArray(d) ? d.forEach((q) => y.searchParams.append(m, q)) : y.searchParams.set(m, d);
90
+ }), ((...m) => (e == null ? void 0 : e.webSocket) !== void 0 && typeof e.webSocket == "function" ? e.webSocket(...m) : new WebSocket(...m))(y.toString());
91
+ }
92
+ const f = new T(c, u);
93
+ if (u) {
94
+ e ?? (e = {});
95
+ const n = C(e, { ...t.args[1] });
96
+ return f.fetch(t.args[0], n);
97
+ }
98
+ return f;
99
+ }, []);
45
100
  export {
46
- r as default
101
+ E as hc
47
102
  };