@scalar/api-reference 1.28.6 → 1.28.7

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.
@@ -2,14 +2,14 @@ import N from "fuse.js";
2
2
  import { ref as h, watch as R, computed as V } from "vue";
3
3
  import { extractRequestBody as A } from "../../helpers/specHelpers.js";
4
4
  import { useOperation as B } from "../../hooks/useOperation.js";
5
- import { useNavState as P } from "../../hooks/useNavState.js";
6
- import { useSidebar as z } from "../../hooks/useSidebar.js";
5
+ import { useSidebar as P } from "../../hooks/useSidebar.js";
6
+ import { useNavState as z } from "../../hooks/useNavState.js";
7
7
  import { getHeadingsFromMarkdown as G } from "../../helpers/getHeadingsFromMarkdown.js";
8
8
  import { getModels as J } from "../../helpers/getModels.js";
9
9
  function te({
10
10
  specification: a
11
11
  }) {
12
- const { getHeadingId: T, getWebhookId: j, getModelId: L, getOperationId: W, getTagId: q } = P(), { hideModels: C } = z(), o = h([]), r = h([]), d = h(0), s = h(""), i = new N(o.value, {
12
+ const { hideModels: T } = P(), { getHeadingId: j, getWebhookId: L, getModelId: W, getOperationId: q, getTagId: C } = z(), o = h([]), r = h([]), d = h(0), s = h(""), i = new N(o.value, {
13
13
  keys: ["title", "description", "body"]
14
14
  }), p = () => {
15
15
  d.value = 0, r.value = i.search(s.value);
@@ -37,14 +37,14 @@ function te({
37
37
  type: "heading",
38
38
  title: `Info > ${e.value}`,
39
39
  description: "",
40
- href: `#${T(e)}`,
40
+ href: `#${j(e)}`,
41
41
  tag: e.slug,
42
42
  body: ""
43
43
  });
44
44
  }), o.value = o.value.concat(l)), ($ = (D = a.value) == null ? void 0 : D.tags) == null || $.forEach((e) => {
45
45
  const S = {
46
46
  title: e["x-displayName"] ?? e.name,
47
- href: `#${q(e)}`,
47
+ href: `#${C(e)}`,
48
48
  description: e.description,
49
49
  type: "tag",
50
50
  tag: e.name,
@@ -57,7 +57,7 @@ function te({
57
57
  const O = {
58
58
  type: "req",
59
59
  title: t.name ?? t.path,
60
- href: `#${W(t, e)}`,
60
+ href: `#${q(t, e)}`,
61
61
  operationId: t.operationId,
62
62
  description: t.description ?? "",
63
63
  httpVerb: t.httpVerb,
@@ -75,7 +75,7 @@ function te({
75
75
  m.push({
76
76
  type: "webhook",
77
77
  title: "Webhook",
78
- href: `#${j({ name: e, method: t })}`,
78
+ href: `#${L({ name: e, method: t })}`,
79
79
  description: `${(c = n[e][t]) == null ? void 0 : c.name}`,
80
80
  httpVerb: t,
81
81
  tag: e,
@@ -83,12 +83,12 @@ function te({
83
83
  });
84
84
  }), o.value = o.value.concat(m);
85
85
  });
86
- const v = C.value ? {} : J(a.value), b = [];
86
+ const v = T.value ? {} : J(a.value), b = [];
87
87
  v && (Object.keys(v).forEach((e) => {
88
88
  b.push({
89
89
  type: "model",
90
90
  title: "Model",
91
- href: `#${L({ name: e })}`,
91
+ href: `#${W({ name: e })}`,
92
92
  description: v[e].title ?? e,
93
93
  tag: e,
94
94
  body: ""
@@ -1,7 +1,5 @@
1
- export * from './useClientStore';
2
1
  export * from './useNavState.js';
3
2
  export * from './useOperation.js';
4
3
  export * from './useReactiveSpec.js';
5
- export * from './useRefOnMount';
6
4
  export * from './useSidebar.js';
7
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA"}
@@ -1,3 +1,4 @@
1
+ import type { NavState } from '../hooks/useNavState.js';
1
2
  import { type ApiReferenceConfiguration, type ApiReferenceConfigurationWithSources } from '@scalar/types/api-reference';
2
3
  import { type Ref } from 'vue';
3
4
  type UseMultipleDocumentsProps = {
@@ -8,8 +9,8 @@ type UseMultipleDocumentsProps = {
8
9
  configuration: Ref<Partial<ApiReferenceConfiguration> | Partial<ApiReferenceConfiguration>[] | Partial<ApiReferenceConfigurationWithSources> | undefined>;
9
10
  /** The initial index to pre-select a document, if there is no query parameter available */
10
11
  initialIndex?: number;
11
- };
12
- export declare const useMultipleDocuments: ({ configuration, initialIndex }: UseMultipleDocumentsProps) => {
12
+ } & NavState;
13
+ export declare const useMultipleDocuments: ({ configuration, initialIndex, isIntersectionEnabled, hash, hashPrefix, }: UseMultipleDocumentsProps) => {
13
14
  selectedConfiguration: import("vue").ComputedRef<{
14
15
  hideClientButton: boolean;
15
16
  showSidebar: boolean;
@@ -87,6 +88,9 @@ export declare const useMultipleDocuments: ({ configuration, initialIndex }: Use
87
88
  slug?: string | undefined;
88
89
  }[]>;
89
90
  selectedDocumentIndex: Ref<number, number>;
91
+ isIntersectionEnabled: Ref<boolean, boolean>;
92
+ hash: Ref<string, string>;
93
+ hashPrefix: Ref<string, string>;
90
94
  };
91
95
  export {};
92
96
  //# sourceMappingURL=useMultipleDocuments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EAI1C,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CACd,OAAO,CAAC,yBAAyB,CAAC,GAClC,OAAO,CAAC,yBAAyB,CAAC,EAAE,GACpC,OAAO,CAAC,oCAAoC,CAAC,GAC7C,SAAS,CACZ,CAAA;IACD,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAsCD,eAAO,MAAM,oBAAoB,oCAAqC,yBAAyB;;;;;;;;;;;;;;;mDAgHwryB,GAAG;;;;eAAoJ,CAAC;mBAAqC,CAAC,mCAAmC,GAAG;iBAA0E,CAAC;gBAAkC,CAAC;;;;;;;;;;;;;;;;;;;yCAAwsC,GAAI;2CAA6E,GAAI;;;;;gBAA0J,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qBAA0D,GAAG;qCAAuE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;;mDA5G5h4B,GAAG;;;;;CA2GtC,CAAA"}
1
+ {"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EAI1C,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CACd,OAAO,CAAC,yBAAyB,CAAC,GAClC,OAAO,CAAC,yBAAyB,CAAC,EAAE,GACpC,OAAO,CAAC,oCAAoC,CAAC,GAC7C,SAAS,CACZ,CAAA;IACD,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,QAAQ,CAAA;AAsCZ,eAAO,MAAM,oBAAoB,8EAM9B,yBAAyB;;;;;;;;;;;;;;;mDAgI63xB,GAAG;;;;eAAoJ,CAAC;mBAAqC,CAAC,mCAAmC,GAAG;iBAA0E,CAAC;gBAAkC,CAAC;;;;;;;;;;;;;;;;;;;yCAAwsC,GAAI;2CAA6E,GAAI;;;;;gBAA0J,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qBAA0D,GAAG;qCAAuE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;;mDA9H3q3B,GAAE;;;;;;;;CA6HxB,CAAA"}
@@ -1,57 +1,67 @@
1
- import { useNavState as h } from "./useNavState.js";
2
- import { isDefined as w } from "@scalar/oas-utils/helpers";
3
- import { isConfigurationWithSources as o, apiReferenceConfigurationSchema as m } from "@scalar/types/api-reference";
4
- import S from "github-slugger";
5
- import { computed as v, ref as I, watch as b } from "vue";
6
- const f = "api", p = new S(), R = (e, s = 0) => {
1
+ import { isDefined as S } from "@scalar/oas-utils/helpers";
2
+ import { isConfigurationWithSources as p, apiReferenceConfigurationSchema as m } from "@scalar/types/api-reference";
3
+ import y from "github-slugger";
4
+ import { computed as v, ref as R, watch as b } from "vue";
5
+ const d = "api", w = new y(), A = (e, r = 0) => {
7
6
  if (!(!(e != null && e.url) && !(e != null && e.content)))
8
- return p.reset(), e.title ? {
7
+ return w.reset(), e.title ? {
9
8
  ...e,
10
- slug: e.slug || p.slug(e.title),
9
+ slug: e.slug || w.slug(e.title),
11
10
  title: e.title
12
11
  } : e.slug ? {
13
12
  ...e,
14
13
  title: e.slug
15
14
  } : {
16
15
  ...e,
17
- slug: `api-${s + 1}`,
18
- title: `API #${s + 1}`
16
+ slug: `api-${r + 1}`,
17
+ title: `API #${r + 1}`
19
18
  };
20
- }, T = ({ configuration: e, initialIndex: s }) => {
21
- const { isIntersectionEnabled: i } = h(), n = v(() => {
19
+ }, N = ({
20
+ configuration: e,
21
+ initialIndex: r,
22
+ isIntersectionEnabled: s,
23
+ hash: o,
24
+ hashPrefix: f
25
+ }) => {
26
+ const a = v(() => {
22
27
  var l;
23
- return e.value ? (o(e.value) ? ((l = e.value) == null ? void 0 : l.sources) ?? [] : [e.value].flat().map((t) => t)).map((t, a) => t && R(t, a)).filter(w) : [];
24
- }), c = (u) => {
25
- if (n.value.length === 1)
28
+ return e.value ? (p(e.value) ? ((l = e.value) == null ? void 0 : l.sources) ?? [] : [e.value].flat().map((t) => t)).map((t, n) => t && A(t, n)).filter(S) : [];
29
+ }), g = (i) => {
30
+ if (typeof window > "u" || a.value.length === 1)
26
31
  return;
27
- const l = new URL(window.location.href), t = n.value[u], a = (t == null ? void 0 : t.slug) ?? u.toString();
28
- l.searchParams.set(f, a), l.hash = "", window.history.replaceState({}, "", l.toString()), i.value = !1, window.scrollTo({ top: 0, behavior: "instant" }), setTimeout(() => i.value = !0, 300);
29
- }, r = I((() => {
30
- const l = new URL(window.location.href).searchParams.get(f) || "0", t = n.value.findIndex((g) => g.slug === l);
32
+ const l = new URL(window.location.href), t = a.value[i], n = (t == null ? void 0 : t.slug) ?? i.toString();
33
+ l.searchParams.set(d, n), l.hash = "", window.history.replaceState({}, "", l.toString()), o.value = "", f.value = "", s.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" });
34
+ }, u = R((() => {
35
+ if (typeof window > "u")
36
+ return typeof r == "number" ? r : 0;
37
+ const l = new URL(window.location.href).searchParams.get(d) || "0", t = a.value.findIndex((h) => h.slug === l);
31
38
  if (t !== -1)
32
39
  return t;
33
- const a = Number.parseInt(l, 10);
34
- return !isNaN(a) && a >= 0 && a < n.value.length ? a : typeof s == "number" ? s : 0;
35
- })()), d = v(() => {
40
+ const n = Number.parseInt(l, 10);
41
+ return !isNaN(n) && n >= 0 && n < a.value.length ? n : typeof r == "number" ? r : 0;
42
+ })()), c = v(() => {
36
43
  var l, t;
37
- if (e.value && o(e.value))
44
+ if (e.value && p(e.value))
38
45
  return m.parse({
39
46
  ...e.value,
40
- ...(t = (l = e.value) == null ? void 0 : l.sources) == null ? void 0 : t[r.value],
41
- ...n.value[r.value]
47
+ ...(t = (l = e.value) == null ? void 0 : l.sources) == null ? void 0 : t[u.value],
48
+ ...a.value[u.value]
42
49
  });
43
- const u = [e.value].flat()[r.value] ?? {};
50
+ const i = [e.value].flat()[u.value] ?? {};
44
51
  return m.parse({
45
- ...u,
46
- ...n.value[r.value]
52
+ ...i,
53
+ ...a.value[u.value]
47
54
  });
48
55
  });
49
- return b(r, c, { flush: "sync" }), {
50
- selectedConfiguration: d,
51
- availableDocuments: n,
52
- selectedDocumentIndex: r
56
+ return b(u, g, { flush: "sync" }), {
57
+ selectedConfiguration: c,
58
+ availableDocuments: a,
59
+ selectedDocumentIndex: u,
60
+ isIntersectionEnabled: s,
61
+ hash: o,
62
+ hashPrefix: f
53
63
  };
54
64
  };
55
65
  export {
56
- T as useMultipleDocuments
66
+ N as useMultipleDocuments
57
67
  };
@@ -1,4 +1,14 @@
1
- import type { Heading, PathRouting, Tag, TransformedOperation } from '@scalar/types/legacy';
1
+ import type { Heading, Tag, TransformedOperation } from '@scalar/types/legacy';
2
+ import { type InjectionKey, type Ref } from 'vue';
3
+ export type NavState = {
4
+ /** The URL hash without the #, also the "hash" pulled from pathRouting */
5
+ hash: Ref<string>;
6
+ /** The prefix for the hash, used in ORG */
7
+ hashPrefix: Ref<string>;
8
+ /** Whether the intersection observer is enabled and updating the hash as we scroll */
9
+ isIntersectionEnabled: Ref<boolean>;
10
+ };
11
+ export declare const NAV_STATE_SYMBOL: InjectionKey<NavState>;
2
12
  /**
3
13
  * Hook which provides reactive hash state from the URL
4
14
  * Also hash is only readable by the client so keep that in mind for SSR
@@ -7,7 +17,7 @@ import type { Heading, PathRouting, Tag, TransformedOperation } from '@scalar/ty
7
17
  * when clicking on sidebar links or going backwards
8
18
  */
9
19
  export declare const useNavState: () => {
10
- hash: import("vue").Ref<string, string>;
20
+ hash: Ref<string, string>;
11
21
  /** Sets the prefix for the hash */
12
22
  setHashPrefix: (prefix: string) => void;
13
23
  /**
@@ -42,8 +52,7 @@ export declare const useNavState: () => {
42
52
  getPathRoutingId: (pathName: string) => string;
43
53
  getSectionId: (hashStr?: string) => string;
44
54
  getTagId: (tag: Tag) => string;
45
- isIntersectionEnabled: import("vue").Ref<boolean, boolean>;
46
- pathRouting: import("vue").Ref<PathRouting | undefined, PathRouting | undefined>;
55
+ isIntersectionEnabled: Ref<boolean, boolean>;
47
56
  updateHash: () => void;
48
57
  };
49
58
  //# sourceMappingURL=useNavState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AA6E3F;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;IA4DpB,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BAtF0B,MAAM;IAwFnC;;;;;OAKG;oCApGgC,MAAM;IAsGzC;;;OAGG;uCA3HmC,MAAM;IA6H5C,0DAA0D;;6BAnC5B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;yBA9BrC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BAXb,OAAO;gCA6BH,oBAAoB,aAAa,GAAG;iCAxGrC,MAAM;;oBAiGjB,GAAG;;;;CAmE3B,CAAA"}
1
+ {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAE9E,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,GAAG,EAAe,MAAM,KAAK,CAAA;AAE9D,MAAM,MAAM,QAAQ,GAAG;IACrB,0EAA0E;IAC1E,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjB,2CAA2C;IAC3C,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACvB,sFAAsF;IACtF,qBAAqB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACpC,CAAA;AACD,eAAO,MAAM,gBAAgB,EAAe,YAAY,CAAC,QAAQ,CAAC,CAAA;AAOlE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;IAiIpB,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BA7E4B,MAAM;IA+ErC;;;;;OAKG;oCA3FkC,MAAM;IA6F3C;;;OAGG;uCAlHqC,MAAM;IAoH9C,0DAA0D;;6BAnC5B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;yBA9BrC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BAXb,OAAO;gCA6BH,oBAAoB,aAAa,GAAG;iCA/FnC,MAAM;;oBAwFnB,GAAG;;;CAkE3B,CAAA"}
@@ -1,76 +1,80 @@
1
- import { useConfig as f } from "./useConfig.js";
2
- import { ssrState as p, combineUrlAndPath as v } from "@scalar/oas-utils/helpers";
3
- import { slug as c } from "github-slugger";
4
- import { ref as s } from "vue";
5
- const u = s(""), l = s(p.hash ?? ""), r = s(), m = s(!1), h = (t) => {
6
- var n;
7
- if (!r.value)
8
- return "";
9
- const a = new RegExp("^" + ((n = r.value) == null ? void 0 : n.basePath) + "/?");
10
- return decodeURIComponent(t.replace(a, ""));
11
- }, w = (t = l.value) => {
12
- var i;
13
- const a = (i = t.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = t.startsWith("model") ? "models" : "", o = t.startsWith("webhook") ? "webhooks" : "";
14
- return a || n || o;
15
- }, I = () => {
16
- l.value = r.value ? h(window.location.pathname) : (
17
- // Must remove the prefix from the hash as the internal hash value should be pure
18
- decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(u.value.length)
19
- );
20
- }, $ = (t, a = window.location.href) => {
21
- const n = new URL(a);
22
- r.value ? n.pathname = v(r.value.basePath, t) : n.hash = u.value + t, l.value = t, window.history.replaceState({}, "", n);
23
- }, S = (t, a = window.location.href, n = window.location.search) => {
24
- const o = new URL(a);
25
- return o.hash = u.value + t, o.search = n, o.toString();
26
- }, U = (t = l.value) => `${u.value}${t}`, b = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(u.value.length)), x = () => {
27
- const t = f(), a = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", n = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${c(e.name)}` : "models", o = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${c(e.name)}`;
1
+ import { useConfig as $ } from "./useConfig.js";
2
+ import { combineUrlAndPath as R } from "@scalar/oas-utils/helpers";
3
+ import { slug as l } from "github-slugger";
4
+ import { ref as i, inject as b } from "vue";
5
+ const y = Symbol(), U = i(!1), P = i(""), k = i(""), C = () => {
6
+ const { isIntersectionEnabled: h, hash: r, hashPrefix: o } = b(y, {
7
+ isIntersectionEnabled: U,
8
+ hash: P,
9
+ hashPrefix: k
10
+ }), t = $(), c = (e) => {
11
+ var n;
12
+ if (!t.value.pathRouting)
13
+ return "";
14
+ const a = new RegExp("^" + ((n = t.value.pathRouting) == null ? void 0 : n.basePath) + "/?");
15
+ return decodeURIComponent(e.replace(a, ""));
16
+ }, d = (e = r.value) => {
17
+ var g;
18
+ const a = (g = e.match(/(tag\/[^/]+)/)) == null ? void 0 : g[0], n = e.startsWith("model") ? "models" : "", u = e.startsWith("webhook") ? "webhooks" : "";
19
+ return a || n || u;
20
+ }, f = () => {
21
+ r.value = t.value.pathRouting ? c(window.location.pathname) : (
22
+ // Must remove the prefix from the hash as the internal hash value should be pure
23
+ decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(o.value.length)
24
+ );
25
+ }, p = (e, a = window.location.href) => {
26
+ const n = new URL(a);
27
+ t.value.pathRouting ? n.pathname = R(t.value.pathRouting.basePath, e) : n.hash = o.value + e, r.value = e, window.history.replaceState({}, "", n);
28
+ }, m = (e, a = window.location.href, n = window.location.search) => {
29
+ const u = new URL(a);
30
+ return u.hash = o.value + e, u.search = n, u.toString();
31
+ }, v = (e = r.value) => `${o.value}${e}`, I = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(o.value.length)), w = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", S = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${l(e.name)}` : "models", s = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${l(e.name)}`;
28
32
  return {
29
- hash: l,
33
+ hash: r,
30
34
  /** Sets the prefix for the hash */
31
35
  setHashPrefix: (e) => {
32
- u.value = e;
36
+ o.value = e;
33
37
  },
34
38
  /**
35
39
  * Gets the full hash with the prefix
36
40
  * @param hashTarget The hash to target with the return
37
41
  * @returns The full hash
38
42
  */
39
- getFullHash: U,
43
+ getFullHash: v,
40
44
  /**
41
45
  * Gets the hashed url with the prefix
42
46
  * @param replacementHash The hash to replace the current hash with
43
47
  * @param url The url to get the hashed url from
44
48
  * @returns The hashed url
45
49
  */
46
- getHashedUrl: S,
50
+ getHashedUrl: m,
47
51
  /**
48
52
  * Replaces the URL state with the new url and hash
49
53
  * Replacement is used so that hash changes don't trigger the url hash watcher and cause a scroll
50
54
  */
51
- replaceUrlState: $,
55
+ replaceUrlState: p,
52
56
  /** Gets the portion of the hash used by the references */
53
- getReferenceHash: b,
54
- getWebhookId: (e) => e != null && e.name ? typeof t.value.generateWebhookSlug == "function" ? `webhook/${t.value.generateWebhookSlug(e)}` : `webhook/${e.method}/${c(e.name)}` : "webhooks",
55
- getModelId: n,
56
- getHeadingId: a,
57
- getOperationId: (e, g) => {
58
- var d;
59
- return typeof t.value.generateOperationSlug == "function" ? `${o(g)}/${t.value.generateOperationSlug({
57
+ getReferenceHash: I,
58
+ getWebhookId: (e) => e != null && e.name ? typeof t.value.generateWebhookSlug == "function" ? `webhook/${t.value.generateWebhookSlug(e)}` : `webhook/${e.method}/${l(e.name)}` : "webhooks",
59
+ getModelId: S,
60
+ getHeadingId: w,
61
+ getOperationId: (e, a) => {
62
+ var n;
63
+ return typeof t.value.generateOperationSlug == "function" ? `${s(a)}/${t.value.generateOperationSlug({
60
64
  path: e.path,
61
65
  operationId: e.operationId,
62
66
  method: e.httpVerb,
63
- summary: (d = e.information) == null ? void 0 : d.summary
64
- })}` : `${o(g)}/${e.httpVerb}${e.path}`;
67
+ summary: (n = e.information) == null ? void 0 : n.summary
68
+ })}` : `${s(a)}/${e.httpVerb}${e.path}`;
65
69
  },
66
- getPathRoutingId: h,
67
- getSectionId: w,
68
- getTagId: o,
69
- isIntersectionEnabled: m,
70
- pathRouting: r,
71
- updateHash: I
70
+ getPathRoutingId: c,
71
+ getSectionId: d,
72
+ getTagId: s,
73
+ isIntersectionEnabled: h,
74
+ updateHash: f
72
75
  };
73
76
  };
74
77
  export {
75
- x as useNavState
78
+ y as NAV_STATE_SYMBOL,
79
+ C as useNavState
76
80
  };