zudoku 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/app/tailwind.js +14 -0
  2. package/dist/app/tailwind.js.map +1 -1
  3. package/dist/lib/components/Heading.d.ts +1 -1
  4. package/dist/lib/components/Layout.js +2 -9
  5. package/dist/lib/components/Layout.js.map +1 -1
  6. package/dist/lib/components/Main.js +3 -1
  7. package/dist/lib/components/Main.js.map +1 -1
  8. package/dist/lib/components/Pagination.d.ts +10 -0
  9. package/dist/lib/components/Pagination.js +10 -0
  10. package/dist/lib/components/Pagination.js.map +1 -0
  11. package/dist/lib/components/TopNavigation.js +18 -2
  12. package/dist/lib/components/TopNavigation.js.map +1 -1
  13. package/dist/lib/components/navigation/SidebarItem.d.ts +1 -0
  14. package/dist/lib/components/navigation/SidebarItem.js +7 -3
  15. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  16. package/dist/lib/{plugins/markdown → components/navigation}/Toc.js +5 -7
  17. package/dist/lib/components/navigation/Toc.js.map +1 -0
  18. package/dist/lib/oas/graphql/index.d.ts +2 -1
  19. package/dist/lib/oas/graphql/index.js +74 -14
  20. package/dist/lib/oas/graphql/index.js.map +1 -1
  21. package/dist/lib/oas/parser/dereference/index.js +2 -0
  22. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  23. package/dist/lib/oas/parser/index.d.ts +5 -3
  24. package/dist/lib/oas/parser/index.js +0 -22
  25. package/dist/lib/oas/parser/index.js.map +1 -1
  26. package/dist/lib/plugins/api-catalog/index.js +19 -17
  27. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  28. package/dist/lib/plugins/markdown/MdxPage.js +3 -3
  29. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  30. package/dist/lib/plugins/openapi/ColorizedParam.js +1 -1
  31. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  32. package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
  33. package/dist/lib/plugins/openapi/OperationList.js +28 -8
  34. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  35. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  36. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  37. package/dist/lib/plugins/openapi/ParameterListItem.js +2 -1
  38. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  39. package/dist/lib/plugins/openapi/SchemaList.d.ts +1 -0
  40. package/dist/lib/plugins/openapi/SchemaList.js +52 -0
  41. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -0
  42. package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +1 -1
  43. package/dist/lib/plugins/openapi/client/GraphQLClient.js +1 -1
  44. package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -1
  45. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +6 -2
  46. package/dist/lib/plugins/openapi/client/useCreateQuery.js +5 -5
  47. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  48. package/dist/lib/plugins/openapi/components/EnumValues.js +1 -1
  49. package/dist/lib/plugins/openapi/components/EnumValues.js.map +1 -1
  50. package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
  51. package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
  52. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  53. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +67 -11
  54. package/dist/lib/plugins/openapi/graphql/graphql.js +34 -5
  55. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  56. package/dist/lib/plugins/openapi/index.js +12 -0
  57. package/dist/lib/plugins/openapi/index.js.map +1 -1
  58. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +1 -2
  59. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +2 -2
  60. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -1
  61. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +0 -1
  62. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +1 -1
  63. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -1
  64. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.d.ts +4 -0
  65. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js +12 -0
  66. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js.map +1 -0
  67. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.d.ts +2 -4
  68. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +12 -9
  69. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
  70. package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -2
  71. package/dist/lib/plugins/openapi/schema/SchemaView.js +30 -52
  72. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  73. package/dist/lib/plugins/openapi/schema/utils.d.ts +1 -0
  74. package/dist/lib/plugins/openapi/schema/utils.js +3 -1
  75. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  76. package/dist/lib/plugins/openapi/util/getRoutes.js +9 -3
  77. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  78. package/dist/lib/util/useOnScreen.d.ts +3 -2
  79. package/dist/lib/util/useOnScreen.js +3 -3
  80. package/dist/lib/util/useOnScreen.js.map +1 -1
  81. package/dist/vite/api/schema-codegen.js +2 -2
  82. package/dist/vite/api/schema-codegen.js.map +1 -1
  83. package/dist/vite/api/schema-codegen.test.js +5 -0
  84. package/dist/vite/api/schema-codegen.test.js.map +1 -1
  85. package/dist/vite/plugin-api.js +8 -7
  86. package/dist/vite/plugin-api.js.map +1 -1
  87. package/lib/{AuthenticationPlugin-Duy_R1TU.js → AuthenticationPlugin-foqdvvkf.js} +2 -2
  88. package/lib/{AuthenticationPlugin-Duy_R1TU.js.map → AuthenticationPlugin-foqdvvkf.js.map} +1 -1
  89. package/lib/{Callout-B2vsR09t.js → Callout-D5frCCJ0.js} +2 -2
  90. package/lib/{Callout-B2vsR09t.js.map → Callout-D5frCCJ0.js.map} +1 -1
  91. package/lib/{Dialog-sbgekbjb.js → Dialog-Dv6WG8RN.js} +5 -5
  92. package/lib/{Dialog-sbgekbjb.js.map → Dialog-Dv6WG8RN.js.map} +1 -1
  93. package/lib/{Markdown-DIZ8nBVC.js → Markdown-aF5FdsNi.js} +1339 -1335
  94. package/lib/{Markdown-DIZ8nBVC.js.map → Markdown-aF5FdsNi.js.map} +1 -1
  95. package/lib/MdxPage-ZW1StNhp.js +83 -0
  96. package/lib/MdxPage-ZW1StNhp.js.map +1 -0
  97. package/lib/{OasProvider-D1A10JeA.js → OasProvider-Cld9RAMQ.js} +3 -3
  98. package/lib/{OasProvider-D1A10JeA.js.map → OasProvider-Cld9RAMQ.js.map} +1 -1
  99. package/lib/OperationList-D-OfzJm6.js +5065 -0
  100. package/lib/OperationList-D-OfzJm6.js.map +1 -0
  101. package/lib/Pagination-CYB3nVYx.js +46 -0
  102. package/lib/Pagination-CYB3nVYx.js.map +1 -0
  103. package/lib/SchemaList-Ci1WxRh0.js +148 -0
  104. package/lib/SchemaList-Ci1WxRh0.js.map +1 -0
  105. package/lib/SchemaView-Brn-YxHY.js +345 -0
  106. package/lib/SchemaView-Brn-YxHY.js.map +1 -0
  107. package/lib/{Select-fAYcJ0OU.js → Select-DVFRKf1R.js} +3 -3
  108. package/lib/{Select-fAYcJ0OU.js.map → Select-DVFRKf1R.js.map} +1 -1
  109. package/lib/{SlotletProvider-BEwNY8q0.js → SlotletProvider-DXvc0aY6.js} +2 -2
  110. package/lib/{SlotletProvider-BEwNY8q0.js.map → SlotletProvider-DXvc0aY6.js.map} +1 -1
  111. package/lib/Toc-YBsgI72s.js +92 -0
  112. package/lib/Toc-YBsgI72s.js.map +1 -0
  113. package/lib/{createServer-DjgKDpGV.js → createServer-mMau3eV_.js} +1732 -1664
  114. package/lib/{createServer-DjgKDpGV.js.map → createServer-mMau3eV_.js.map} +1 -1
  115. package/lib/{hook-Cge6LiTK.js → hook-CqpVYDqN.js} +28 -28
  116. package/lib/{hook-Cge6LiTK.js.map → hook-CqpVYDqN.js.map} +1 -1
  117. package/lib/index-Bt7MKhZq.js +2514 -0
  118. package/lib/index-Bt7MKhZq.js.map +1 -0
  119. package/lib/{index-B0y3fTg-.js → index-CjPMxpOV.js} +771 -730
  120. package/lib/index-CjPMxpOV.js.map +1 -0
  121. package/lib/{mutation-EChriCeF.js → mutation-8LjrN7uz.js} +2 -2
  122. package/lib/{mutation-EChriCeF.js.map → mutation-8LjrN7uz.js.map} +1 -1
  123. package/lib/ui/Command.js +1 -1
  124. package/lib/zudoku.auth-auth0.js +1 -1
  125. package/lib/zudoku.auth-clerk.js +2 -2
  126. package/lib/zudoku.auth-openid.js +2 -2
  127. package/lib/zudoku.components.js +31 -1454
  128. package/lib/zudoku.components.js.map +1 -1
  129. package/lib/zudoku.hooks.js +1 -1
  130. package/lib/zudoku.plugin-api-catalog.js +80 -77
  131. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  132. package/lib/zudoku.plugin-api-keys.js +3 -3
  133. package/lib/zudoku.plugin-custom-pages.js +1 -1
  134. package/lib/zudoku.plugin-markdown.js +1 -1
  135. package/lib/zudoku.plugin-openapi.js +2 -2
  136. package/lib/zudoku.plugin-search-pagefind.js +3 -3
  137. package/package.json +4 -3
  138. package/src/app/tailwind.ts +14 -0
  139. package/src/lib/components/Layout.tsx +4 -16
  140. package/src/lib/components/Main.tsx +3 -1
  141. package/src/lib/components/Pagination.tsx +47 -0
  142. package/src/lib/components/TopNavigation.tsx +29 -2
  143. package/src/lib/components/navigation/SidebarItem.tsx +10 -4
  144. package/src/lib/{plugins/markdown → components/navigation}/Toc.tsx +5 -14
  145. package/src/lib/oas/graphql/index.ts +118 -45
  146. package/src/lib/oas/parser/dereference/index.ts +2 -0
  147. package/src/lib/oas/parser/index.ts +7 -29
  148. package/src/lib/plugins/api-catalog/index.tsx +40 -35
  149. package/src/lib/plugins/markdown/MdxPage.tsx +6 -36
  150. package/src/lib/plugins/openapi/ColorizedParam.tsx +1 -1
  151. package/src/lib/plugins/openapi/OperationList.tsx +36 -15
  152. package/src/lib/plugins/openapi/OperationListItem.tsx +7 -2
  153. package/src/lib/plugins/openapi/ParameterListItem.tsx +2 -0
  154. package/src/lib/plugins/openapi/SchemaList.tsx +151 -0
  155. package/src/lib/plugins/openapi/client/GraphQLClient.tsx +1 -1
  156. package/src/lib/plugins/openapi/client/useCreateQuery.ts +12 -5
  157. package/src/lib/plugins/openapi/components/EnumValues.tsx +1 -1
  158. package/src/lib/plugins/openapi/graphql/gql.ts +15 -6
  159. package/src/lib/plugins/openapi/graphql/graphql.ts +104 -15
  160. package/src/lib/plugins/openapi/index.tsx +13 -0
  161. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +1 -8
  162. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +1 -2
  163. package/src/lib/plugins/openapi/schema/SchemaExampleAndDefault.tsx +36 -0
  164. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +20 -21
  165. package/src/lib/plugins/openapi/schema/SchemaView.tsx +69 -141
  166. package/src/lib/plugins/openapi/schema/utils.ts +7 -1
  167. package/src/lib/plugins/openapi/util/getRoutes.tsx +9 -6
  168. package/src/lib/util/useOnScreen.ts +6 -4
  169. package/dist/lib/plugins/markdown/Toc.js.map +0 -1
  170. package/lib/MdxPage-JEdbfW-f.js +0 -195
  171. package/lib/MdxPage-JEdbfW-f.js.map +0 -1
  172. package/lib/OperationList-yOmYzMIp.js +0 -5379
  173. package/lib/OperationList-yOmYzMIp.js.map +0 -1
  174. package/lib/index-B0y3fTg-.js.map +0 -1
  175. package/lib/index.esm-CltAN0Tf.js +0 -711
  176. package/lib/index.esm-CltAN0Tf.js.map +0 -1
  177. /package/dist/lib/{plugins/markdown → components/navigation}/Toc.d.ts +0 -0
@@ -1,711 +0,0 @@
1
- var ie = Object.defineProperty;
2
- var le = (e, t, r) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var T = (e, t, r) => le(e, typeof t != "symbol" ? t + "" : t, r);
4
- import m, { Component as F } from "react";
5
- import { g as U } from "./_commonjsHelpers-BkfeUUK-.js";
6
- const R = {}, Q = m.createContext(R);
7
- function ce(e) {
8
- const t = m.useContext(Q);
9
- return m.useMemo(
10
- function() {
11
- return typeof e == "function" ? e(t) : { ...t, ...e };
12
- },
13
- [t, e]
14
- );
15
- }
16
- function Fe(e) {
17
- let t;
18
- return e.disableParentContext ? t = typeof e.components == "function" ? e.components(R) : e.components || R : t = ce(e.components), m.createElement(
19
- Q.Provider,
20
- { value: t },
21
- e.children
22
- );
23
- }
24
- var P, V;
25
- function ue() {
26
- if (V) return P;
27
- V = 1;
28
- var e = typeof Element < "u", t = typeof Map == "function", r = typeof Set == "function", n = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
29
- function i(s, a) {
30
- if (s === a) return !0;
31
- if (s && a && typeof s == "object" && typeof a == "object") {
32
- if (s.constructor !== a.constructor) return !1;
33
- var l, o, c;
34
- if (Array.isArray(s)) {
35
- if (l = s.length, l != a.length) return !1;
36
- for (o = l; o-- !== 0; )
37
- if (!i(s[o], a[o])) return !1;
38
- return !0;
39
- }
40
- var u;
41
- if (t && s instanceof Map && a instanceof Map) {
42
- if (s.size !== a.size) return !1;
43
- for (u = s.entries(); !(o = u.next()).done; )
44
- if (!a.has(o.value[0])) return !1;
45
- for (u = s.entries(); !(o = u.next()).done; )
46
- if (!i(o.value[1], a.get(o.value[0]))) return !1;
47
- return !0;
48
- }
49
- if (r && s instanceof Set && a instanceof Set) {
50
- if (s.size !== a.size) return !1;
51
- for (u = s.entries(); !(o = u.next()).done; )
52
- if (!a.has(o.value[0])) return !1;
53
- return !0;
54
- }
55
- if (n && ArrayBuffer.isView(s) && ArrayBuffer.isView(a)) {
56
- if (l = s.length, l != a.length) return !1;
57
- for (o = l; o-- !== 0; )
58
- if (s[o] !== a[o]) return !1;
59
- return !0;
60
- }
61
- if (s.constructor === RegExp) return s.source === a.source && s.flags === a.flags;
62
- if (s.valueOf !== Object.prototype.valueOf && typeof s.valueOf == "function" && typeof a.valueOf == "function") return s.valueOf() === a.valueOf();
63
- if (s.toString !== Object.prototype.toString && typeof s.toString == "function" && typeof a.toString == "function") return s.toString() === a.toString();
64
- if (c = Object.keys(s), l = c.length, l !== Object.keys(a).length) return !1;
65
- for (o = l; o-- !== 0; )
66
- if (!Object.prototype.hasOwnProperty.call(a, c[o])) return !1;
67
- if (e && s instanceof Element) return !1;
68
- for (o = l; o-- !== 0; )
69
- if (!((c[o] === "_owner" || c[o] === "__v" || c[o] === "__o") && s.$$typeof) && !i(s[c[o]], a[c[o]]))
70
- return !1;
71
- return !0;
72
- }
73
- return s !== s && a !== a;
74
- }
75
- return P = function(a, l) {
76
- try {
77
- return i(a, l);
78
- } catch (o) {
79
- if ((o.message || "").match(/stack|recursion/i))
80
- return console.warn("react-fast-compare cannot handle circular refs"), !1;
81
- throw o;
82
- }
83
- }, P;
84
- }
85
- var fe = ue();
86
- const pe = /* @__PURE__ */ U(fe);
87
- var $, B;
88
- function de() {
89
- if (B) return $;
90
- B = 1;
91
- var e = function(t, r, n, i, s, a, l, o) {
92
- if (process.env.NODE_ENV !== "production" && r === void 0)
93
- throw new Error("invariant requires an error message argument");
94
- if (!t) {
95
- var c;
96
- if (r === void 0)
97
- c = new Error(
98
- "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
99
- );
100
- else {
101
- var u = [n, i, s, a, l, o], f = 0;
102
- c = new Error(
103
- r.replace(/%s/g, function() {
104
- return u[f++];
105
- })
106
- ), c.name = "Invariant Violation";
107
- }
108
- throw c.framesToPop = 1, c;
109
- }
110
- };
111
- return $ = e, $;
112
- }
113
- var me = de();
114
- const Y = /* @__PURE__ */ U(me);
115
- var I, X;
116
- function he() {
117
- return X || (X = 1, I = function(t, r, n, i) {
118
- var s = n ? n.call(i, t, r) : void 0;
119
- if (s !== void 0)
120
- return !!s;
121
- if (t === r)
122
- return !0;
123
- if (typeof t != "object" || !t || typeof r != "object" || !r)
124
- return !1;
125
- var a = Object.keys(t), l = Object.keys(r);
126
- if (a.length !== l.length)
127
- return !1;
128
- for (var o = Object.prototype.hasOwnProperty.bind(r), c = 0; c < a.length; c++) {
129
- var u = a[c];
130
- if (!o(u))
131
- return !1;
132
- var f = t[u], h = r[u];
133
- if (s = n ? n.call(i, f, h, u) : void 0, s === !1 || s === void 0 && f !== h)
134
- return !1;
135
- }
136
- return !0;
137
- }), I;
138
- }
139
- var ye = he();
140
- const Te = /* @__PURE__ */ U(ye);
141
- var ee = /* @__PURE__ */ ((e) => (e.BASE = "base", e.BODY = "body", e.HEAD = "head", e.HTML = "html", e.LINK = "link", e.META = "meta", e.NOSCRIPT = "noscript", e.SCRIPT = "script", e.STYLE = "style", e.TITLE = "title", e.FRAGMENT = "Symbol(react.fragment)", e))(ee || {}), M = {
142
- link: { rel: ["amphtml", "canonical", "alternate"] },
143
- script: { type: ["application/ld+json"] },
144
- meta: {
145
- charset: "",
146
- name: ["generator", "robots", "description"],
147
- property: [
148
- "og:type",
149
- "og:title",
150
- "og:url",
151
- "og:image",
152
- "og:image:alt",
153
- "og:description",
154
- "twitter:url",
155
- "twitter:title",
156
- "twitter:description",
157
- "twitter:image",
158
- "twitter:image:alt",
159
- "twitter:card",
160
- "twitter:site"
161
- ]
162
- }
163
- }, Z = Object.values(ee), K = {
164
- accesskey: "accessKey",
165
- charset: "charSet",
166
- class: "className",
167
- contenteditable: "contentEditable",
168
- contextmenu: "contextMenu",
169
- "http-equiv": "httpEquiv",
170
- itemprop: "itemProp",
171
- tabindex: "tabIndex"
172
- }, ve = Object.entries(K).reduce(
173
- (e, [t, r]) => (e[r] = t, e),
174
- {}
175
- ), y = "data-rh", C = {
176
- DEFAULT_TITLE: "defaultTitle",
177
- DEFER: "defer",
178
- ENCODE_SPECIAL_CHARACTERS: "encodeSpecialCharacters",
179
- ON_CHANGE_CLIENT_STATE: "onChangeClientState",
180
- TITLE_TEMPLATE: "titleTemplate",
181
- PRIORITIZE_SEO_TAGS: "prioritizeSeoTags"
182
- }, E = (e, t) => {
183
- for (let r = e.length - 1; r >= 0; r -= 1) {
184
- const n = e[r];
185
- if (Object.prototype.hasOwnProperty.call(n, t))
186
- return n[t];
187
- }
188
- return null;
189
- }, ge = (e) => {
190
- let t = E(
191
- e,
192
- "title"
193
- /* TITLE */
194
- );
195
- const r = E(e, C.TITLE_TEMPLATE);
196
- if (Array.isArray(t) && (t = t.join("")), r && t)
197
- return r.replace(/%s/g, () => t);
198
- const n = E(e, C.DEFAULT_TITLE);
199
- return t || n || void 0;
200
- }, Ae = (e) => E(e, C.ON_CHANGE_CLIENT_STATE) || (() => {
201
- }), D = (e, t) => t.filter((r) => typeof r[e] < "u").map((r) => r[e]).reduce((r, n) => ({ ...r, ...n }), {}), Ce = (e, t) => t.filter((r) => typeof r.base < "u").map((r) => r.base).reverse().reduce((r, n) => {
202
- if (!r.length) {
203
- const i = Object.keys(n);
204
- for (let s = 0; s < i.length; s += 1) {
205
- const l = i[s].toLowerCase();
206
- if (e.indexOf(l) !== -1 && n[l])
207
- return r.concat(n);
208
- }
209
- }
210
- return r;
211
- }, []), Ee = (e) => console && typeof console.warn == "function" && console.warn(e), b = (e, t, r) => {
212
- const n = {};
213
- return r.filter((i) => Array.isArray(i[e]) ? !0 : (typeof i[e] < "u" && Ee(
214
- `Helmet: ${e} should be of type "Array". Instead found type "${typeof i[e]}"`
215
- ), !1)).map((i) => i[e]).reverse().reduce((i, s) => {
216
- const a = {};
217
- s.filter((o) => {
218
- let c;
219
- const u = Object.keys(o);
220
- for (let h = 0; h < u.length; h += 1) {
221
- const p = u[h], v = p.toLowerCase();
222
- t.indexOf(v) !== -1 && !(c === "rel" && o[c].toLowerCase() === "canonical") && !(v === "rel" && o[v].toLowerCase() === "stylesheet") && (c = v), t.indexOf(p) !== -1 && (p === "innerHTML" || p === "cssText" || p === "itemprop") && (c = p);
223
- }
224
- if (!c || !o[c])
225
- return !1;
226
- const f = o[c].toLowerCase();
227
- return n[c] || (n[c] = {}), a[c] || (a[c] = {}), n[c][f] ? !1 : (a[c][f] = !0, !0);
228
- }).reverse().forEach((o) => i.push(o));
229
- const l = Object.keys(a);
230
- for (let o = 0; o < l.length; o += 1) {
231
- const c = l[o], u = {
232
- ...n[c],
233
- ...a[c]
234
- };
235
- n[c] = u;
236
- }
237
- return i;
238
- }, []).reverse();
239
- }, be = (e, t) => {
240
- if (Array.isArray(e) && e.length) {
241
- for (let r = 0; r < e.length; r += 1)
242
- if (e[r][t])
243
- return !0;
244
- }
245
- return !1;
246
- }, Oe = (e) => ({
247
- baseTag: Ce([
248
- "href"
249
- /* HREF */
250
- ], e),
251
- bodyAttributes: D("bodyAttributes", e),
252
- defer: E(e, C.DEFER),
253
- encode: E(e, C.ENCODE_SPECIAL_CHARACTERS),
254
- htmlAttributes: D("htmlAttributes", e),
255
- linkTags: b(
256
- "link",
257
- [
258
- "rel",
259
- "href"
260
- /* HREF */
261
- ],
262
- e
263
- ),
264
- metaTags: b(
265
- "meta",
266
- [
267
- "name",
268
- "charset",
269
- "http-equiv",
270
- "property",
271
- "itemprop"
272
- /* ITEM_PROP */
273
- ],
274
- e
275
- ),
276
- noscriptTags: b("noscript", [
277
- "innerHTML"
278
- /* INNER_HTML */
279
- ], e),
280
- onChangeClientState: Ae(e),
281
- scriptTags: b(
282
- "script",
283
- [
284
- "src",
285
- "innerHTML"
286
- /* INNER_HTML */
287
- ],
288
- e
289
- ),
290
- styleTags: b("style", [
291
- "cssText"
292
- /* CSS_TEXT */
293
- ], e),
294
- title: ge(e),
295
- titleAttributes: D("titleAttributes", e),
296
- prioritizeSeoTags: be(e, C.PRIORITIZE_SEO_TAGS)
297
- }), te = (e) => Array.isArray(e) ? e.join("") : e, we = (e, t) => {
298
- const r = Object.keys(e);
299
- for (let n = 0; n < r.length; n += 1)
300
- if (t[r[n]] && t[r[n]].includes(e[r[n]]))
301
- return !0;
302
- return !1;
303
- }, H = (e, t) => Array.isArray(e) ? e.reduce(
304
- (r, n) => (we(n, t) ? r.priority.push(n) : r.default.push(n), r),
305
- { priority: [], default: [] }
306
- ) : { default: e, priority: [] }, G = (e, t) => ({
307
- ...e,
308
- [t]: void 0
309
- }), Se = [
310
- "noscript",
311
- "script",
312
- "style"
313
- /* STYLE */
314
- ], k = (e, t = !0) => t === !1 ? String(e) : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;"), re = (e) => Object.keys(e).reduce((t, r) => {
315
- const n = typeof e[r] < "u" ? `${r}="${e[r]}"` : `${r}`;
316
- return t ? `${t} ${n}` : n;
317
- }, ""), xe = (e, t, r, n) => {
318
- const i = re(r), s = te(t);
319
- return i ? `<${e} ${y}="true" ${i}>${k(
320
- s,
321
- n
322
- )}</${e}>` : `<${e} ${y}="true">${k(
323
- s,
324
- n
325
- )}</${e}>`;
326
- }, Pe = (e, t, r = !0) => t.reduce((n, i) => {
327
- const s = i, a = Object.keys(s).filter(
328
- (c) => !(c === "innerHTML" || c === "cssText")
329
- ).reduce((c, u) => {
330
- const f = typeof s[u] > "u" ? u : `${u}="${k(s[u], r)}"`;
331
- return c ? `${c} ${f}` : f;
332
- }, ""), l = s.innerHTML || s.cssText || "", o = Se.indexOf(e) === -1;
333
- return `${n}<${e} ${y}="true" ${a}${o ? "/>" : `>${l}</${e}>`}`;
334
- }, ""), ne = (e, t = {}) => Object.keys(e).reduce((r, n) => {
335
- const i = K[n];
336
- return r[i || n] = e[n], r;
337
- }, t), $e = (e, t, r) => {
338
- const n = {
339
- key: t,
340
- [y]: !0
341
- }, i = ne(r, n);
342
- return [m.createElement("title", i, t)];
343
- }, x = (e, t) => t.map((r, n) => {
344
- const i = {
345
- key: n,
346
- [y]: !0
347
- };
348
- return Object.keys(r).forEach((s) => {
349
- const l = K[s] || s;
350
- if (l === "innerHTML" || l === "cssText") {
351
- const o = r.innerHTML || r.cssText;
352
- i.dangerouslySetInnerHTML = { __html: o };
353
- } else
354
- i[l] = r[s];
355
- }), m.createElement(e, i);
356
- }), d = (e, t, r = !0) => {
357
- switch (e) {
358
- case "title":
359
- return {
360
- toComponent: () => $e(e, t.title, t.titleAttributes),
361
- toString: () => xe(e, t.title, t.titleAttributes, r)
362
- };
363
- case "bodyAttributes":
364
- case "htmlAttributes":
365
- return {
366
- toComponent: () => ne(t),
367
- toString: () => re(t)
368
- };
369
- default:
370
- return {
371
- toComponent: () => x(e, t),
372
- toString: () => Pe(e, t, r)
373
- };
374
- }
375
- }, Ie = ({ metaTags: e, linkTags: t, scriptTags: r, encode: n }) => {
376
- const i = H(e, M.meta), s = H(t, M.link), a = H(r, M.script);
377
- return {
378
- priorityMethods: {
379
- toComponent: () => [
380
- ...x("meta", i.priority),
381
- ...x("link", s.priority),
382
- ...x("script", a.priority)
383
- ],
384
- toString: () => (
385
- // generate all the tags as strings and concatenate them
386
- `${d("meta", i.priority, n)} ${d(
387
- "link",
388
- s.priority,
389
- n
390
- )} ${d("script", a.priority, n)}`
391
- )
392
- },
393
- metaTags: i.default,
394
- linkTags: s.default,
395
- scriptTags: a.default
396
- };
397
- }, Me = (e) => {
398
- const {
399
- baseTag: t,
400
- bodyAttributes: r,
401
- encode: n = !0,
402
- htmlAttributes: i,
403
- noscriptTags: s,
404
- styleTags: a,
405
- title: l = "",
406
- titleAttributes: o,
407
- prioritizeSeoTags: c
408
- } = e;
409
- let { linkTags: u, metaTags: f, scriptTags: h } = e, p = {
410
- toComponent: () => {
411
- },
412
- toString: () => ""
413
- };
414
- return c && ({ priorityMethods: p, linkTags: u, metaTags: f, scriptTags: h } = Ie(e)), {
415
- priority: p,
416
- base: d("base", t, n),
417
- bodyAttributes: d("bodyAttributes", r, n),
418
- htmlAttributes: d("htmlAttributes", i, n),
419
- link: d("link", u, n),
420
- meta: d("meta", f, n),
421
- noscript: d("noscript", s, n),
422
- script: d("script", h, n),
423
- style: d("style", a, n),
424
- title: d("title", { title: l, titleAttributes: o }, n)
425
- };
426
- }, j = Me, S = [], se = !!(typeof window < "u" && window.document && window.document.createElement), q = class {
427
- constructor(e, t) {
428
- T(this, "instances", []);
429
- T(this, "canUseDOM", se);
430
- T(this, "context");
431
- T(this, "value", {
432
- setHelmet: (e) => {
433
- this.context.helmet = e;
434
- },
435
- helmetInstances: {
436
- get: () => this.canUseDOM ? S : this.instances,
437
- add: (e) => {
438
- (this.canUseDOM ? S : this.instances).push(e);
439
- },
440
- remove: (e) => {
441
- const t = (this.canUseDOM ? S : this.instances).indexOf(e);
442
- (this.canUseDOM ? S : this.instances).splice(t, 1);
443
- }
444
- }
445
- });
446
- this.context = e, this.canUseDOM = t || !1, t || (e.helmet = j({
447
- baseTag: [],
448
- bodyAttributes: {},
449
- htmlAttributes: {},
450
- linkTags: [],
451
- metaTags: [],
452
- noscriptTags: [],
453
- scriptTags: [],
454
- styleTags: [],
455
- title: "",
456
- titleAttributes: {}
457
- }));
458
- }
459
- }, De = {}, oe = m.createContext(De), g, He = (g = class extends F {
460
- constructor(r) {
461
- super(r);
462
- T(this, "helmetData");
463
- this.helmetData = new q(this.props.context || {}, g.canUseDOM);
464
- }
465
- render() {
466
- return /* @__PURE__ */ m.createElement(oe.Provider, { value: this.helmetData.value }, this.props.children);
467
- }
468
- }, T(g, "canUseDOM", se), g), A = (e, t) => {
469
- const r = document.head || document.querySelector(
470
- "head"
471
- /* HEAD */
472
- ), n = r.querySelectorAll(`${e}[${y}]`), i = [].slice.call(n), s = [];
473
- let a;
474
- return t && t.length && t.forEach((l) => {
475
- const o = document.createElement(e);
476
- for (const c in l)
477
- if (Object.prototype.hasOwnProperty.call(l, c))
478
- if (c === "innerHTML")
479
- o.innerHTML = l.innerHTML;
480
- else if (c === "cssText")
481
- o.styleSheet ? o.styleSheet.cssText = l.cssText : o.appendChild(document.createTextNode(l.cssText));
482
- else {
483
- const u = c, f = typeof l[u] > "u" ? "" : l[u];
484
- o.setAttribute(c, f);
485
- }
486
- o.setAttribute(y, "true"), i.some((c, u) => (a = u, o.isEqualNode(c))) ? i.splice(a, 1) : s.push(o);
487
- }), i.forEach((l) => {
488
- var o;
489
- return (o = l.parentNode) == null ? void 0 : o.removeChild(l);
490
- }), s.forEach((l) => r.appendChild(l)), {
491
- oldTags: i,
492
- newTags: s
493
- };
494
- }, L = (e, t) => {
495
- const r = document.getElementsByTagName(e)[0];
496
- if (!r)
497
- return;
498
- const n = r.getAttribute(y), i = n ? n.split(",") : [], s = [...i], a = Object.keys(t);
499
- for (const l of a) {
500
- const o = t[l] || "";
501
- r.getAttribute(l) !== o && r.setAttribute(l, o), i.indexOf(l) === -1 && i.push(l);
502
- const c = s.indexOf(l);
503
- c !== -1 && s.splice(c, 1);
504
- }
505
- for (let l = s.length - 1; l >= 0; l -= 1)
506
- r.removeAttribute(s[l]);
507
- i.length === s.length ? r.removeAttribute(y) : r.getAttribute(y) !== a.join(",") && r.setAttribute(y, a.join(","));
508
- }, _e = (e, t) => {
509
- typeof e < "u" && document.title !== e && (document.title = te(e)), L("title", t);
510
- }, W = (e, t) => {
511
- const {
512
- baseTag: r,
513
- bodyAttributes: n,
514
- htmlAttributes: i,
515
- linkTags: s,
516
- metaTags: a,
517
- noscriptTags: l,
518
- onChangeClientState: o,
519
- scriptTags: c,
520
- styleTags: u,
521
- title: f,
522
- titleAttributes: h
523
- } = e;
524
- L("body", n), L("html", i), _e(f, h);
525
- const p = {
526
- baseTag: A("base", r),
527
- linkTags: A("link", s),
528
- metaTags: A("meta", a),
529
- noscriptTags: A("noscript", l),
530
- scriptTags: A("script", c),
531
- styleTags: A("style", u)
532
- }, v = {}, z = {};
533
- Object.keys(p).forEach((w) => {
534
- const { newTags: N, oldTags: ae } = p[w];
535
- N.length && (v[w] = N), ae.length && (z[w] = p[w].oldTags);
536
- }), t && t(), o(e, v, z);
537
- }, O = null, Re = (e) => {
538
- O && cancelAnimationFrame(O), e.defer ? O = requestAnimationFrame(() => {
539
- W(e, () => {
540
- O = null;
541
- });
542
- }) : (W(e), O = null);
543
- }, ke = Re, J = class extends F {
544
- constructor() {
545
- super(...arguments);
546
- T(this, "rendered", !1);
547
- }
548
- shouldComponentUpdate(t) {
549
- return !Te(t, this.props);
550
- }
551
- componentDidUpdate() {
552
- this.emitChange();
553
- }
554
- componentWillUnmount() {
555
- const { helmetInstances: t } = this.props.context;
556
- t.remove(this), this.emitChange();
557
- }
558
- emitChange() {
559
- const { helmetInstances: t, setHelmet: r } = this.props.context;
560
- let n = null;
561
- const i = Oe(
562
- t.get().map((s) => {
563
- const a = { ...s.props };
564
- return delete a.context, a;
565
- })
566
- );
567
- He.canUseDOM ? ke(i) : j && (n = j(i)), r(n);
568
- }
569
- // componentWillMount will be deprecated
570
- // for SSR, initialize on first render
571
- // constructor is also unsafe in StrictMode
572
- init() {
573
- if (this.rendered)
574
- return;
575
- this.rendered = !0;
576
- const { helmetInstances: t } = this.props.context;
577
- t.add(this), this.emitChange();
578
- }
579
- render() {
580
- return this.init(), null;
581
- }
582
- }, _, Ue = (_ = class extends F {
583
- shouldComponentUpdate(e) {
584
- return !pe(G(this.props, "helmetData"), G(e, "helmetData"));
585
- }
586
- mapNestedChildrenToProps(e, t) {
587
- if (!t)
588
- return null;
589
- switch (e.type) {
590
- case "script":
591
- case "noscript":
592
- return {
593
- innerHTML: t
594
- };
595
- case "style":
596
- return {
597
- cssText: t
598
- };
599
- default:
600
- throw new Error(
601
- `<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`
602
- );
603
- }
604
- }
605
- flattenArrayTypeChildren(e, t, r, n) {
606
- return {
607
- ...t,
608
- [e.type]: [
609
- ...t[e.type] || [],
610
- {
611
- ...r,
612
- ...this.mapNestedChildrenToProps(e, n)
613
- }
614
- ]
615
- };
616
- }
617
- mapObjectTypeChildren(e, t, r, n) {
618
- switch (e.type) {
619
- case "title":
620
- return {
621
- ...t,
622
- [e.type]: n,
623
- titleAttributes: { ...r }
624
- };
625
- case "body":
626
- return {
627
- ...t,
628
- bodyAttributes: { ...r }
629
- };
630
- case "html":
631
- return {
632
- ...t,
633
- htmlAttributes: { ...r }
634
- };
635
- default:
636
- return {
637
- ...t,
638
- [e.type]: { ...r }
639
- };
640
- }
641
- }
642
- mapArrayTypeChildrenToProps(e, t) {
643
- let r = { ...t };
644
- return Object.keys(e).forEach((n) => {
645
- r = {
646
- ...r,
647
- [n]: e[n]
648
- };
649
- }), r;
650
- }
651
- warnOnInvalidChildren(e, t) {
652
- return Y(
653
- Z.some((r) => e.type === r),
654
- typeof e.type == "function" ? "You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information." : `Only elements types ${Z.join(
655
- ", "
656
- )} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`
657
- ), Y(
658
- !t || typeof t == "string" || Array.isArray(t) && !t.some((r) => typeof r != "string"),
659
- `Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`}</${e.type}> ) Refer to our API for more information.`
660
- ), !0;
661
- }
662
- mapChildrenToProps(e, t) {
663
- let r = {};
664
- return m.Children.forEach(e, (n) => {
665
- if (!n || !n.props)
666
- return;
667
- const { children: i, ...s } = n.props, a = Object.keys(s).reduce((o, c) => (o[ve[c] || c] = s[c], o), {});
668
- let { type: l } = n;
669
- switch (typeof l == "symbol" ? l = l.toString() : this.warnOnInvalidChildren(n, i), l) {
670
- case "Symbol(react.fragment)":
671
- t = this.mapChildrenToProps(i, t);
672
- break;
673
- case "link":
674
- case "meta":
675
- case "noscript":
676
- case "script":
677
- case "style":
678
- r = this.flattenArrayTypeChildren(
679
- n,
680
- r,
681
- a,
682
- i
683
- );
684
- break;
685
- default:
686
- t = this.mapObjectTypeChildren(n, t, a, i);
687
- break;
688
- }
689
- }), this.mapArrayTypeChildrenToProps(r, t);
690
- }
691
- render() {
692
- const { children: e, ...t } = this.props;
693
- let r = { ...t }, { helmetData: n } = t;
694
- if (e && (r = this.mapChildrenToProps(e, r)), n && !(n instanceof q)) {
695
- const i = n;
696
- n = new q(i.context, !0), delete r.helmetData;
697
- }
698
- return n ? /* @__PURE__ */ m.createElement(J, { ...r, context: n.value }) : /* @__PURE__ */ m.createElement(oe.Consumer, null, (i) => /* @__PURE__ */ m.createElement(J, { ...r, context: i }));
699
- }
700
- }, T(_, "defaultProps", {
701
- defer: !0,
702
- encodeSpecialCharacters: !0,
703
- prioritizeSeoTags: !1
704
- }), _);
705
- export {
706
- Ue as H,
707
- Fe as M,
708
- He as a,
709
- ce as u
710
- };
711
- //# sourceMappingURL=index.esm-CltAN0Tf.js.map