@gengage/assistant-fe 0.1.0 → 0.1.1

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 (148) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +2 -2
  3. package/dist/assistant-fe.css +1 -1
  4. package/dist/chat/api.d.ts +12 -2
  5. package/dist/chat/api.d.ts.map +1 -1
  6. package/dist/chat/catalog.d.ts +246 -896
  7. package/dist/chat/catalog.d.ts.map +1 -1
  8. package/dist/chat/components/AIGroupingCards.d.ts.map +1 -1
  9. package/dist/chat/components/AISuggestedSearchCards.d.ts.map +1 -1
  10. package/dist/chat/components/AITopPicks.d.ts.map +1 -1
  11. package/dist/chat/components/CategoriesContainer.d.ts.map +1 -1
  12. package/dist/chat/components/ChatDrawer.d.ts +11 -2
  13. package/dist/chat/components/ChatDrawer.d.ts.map +1 -1
  14. package/dist/chat/components/ComparisonTable.d.ts +9 -0
  15. package/dist/chat/components/ComparisonTable.d.ts.map +1 -1
  16. package/dist/chat/components/GroundingReviewCard.d.ts.map +1 -1
  17. package/dist/chat/components/HandoffNotice.d.ts +5 -0
  18. package/dist/chat/components/HandoffNotice.d.ts.map +1 -0
  19. package/dist/chat/components/KvkkBanner.d.ts +1 -0
  20. package/dist/chat/components/KvkkBanner.d.ts.map +1 -1
  21. package/dist/chat/components/ProactivePopup.d.ts +2 -0
  22. package/dist/chat/components/ProactivePopup.d.ts.map +1 -1
  23. package/dist/chat/components/ProductSummaryCard.d.ts +4 -0
  24. package/dist/chat/components/ProductSummaryCard.d.ts.map +1 -0
  25. package/dist/chat/components/ReviewHighlights.d.ts +3 -1
  26. package/dist/chat/components/ReviewHighlights.d.ts.map +1 -1
  27. package/dist/chat/components/ThumbnailsColumn.d.ts.map +1 -1
  28. package/dist/chat/components/renderUISpec.d.ts +4 -3
  29. package/dist/chat/components/renderUISpec.d.ts.map +1 -1
  30. package/dist/chat/heartbeat.d.ts +71 -0
  31. package/dist/chat/heartbeat.d.ts.map +1 -0
  32. package/dist/chat/index.d.ts +33 -78
  33. package/dist/chat/index.d.ts.map +1 -1
  34. package/dist/chat/kvkk.d.ts +21 -0
  35. package/dist/chat/kvkk.d.ts.map +1 -0
  36. package/dist/chat/locales/en.d.ts.map +1 -1
  37. package/dist/chat/locales/tr.d.ts.map +1 -1
  38. package/dist/chat/panel-manager.d.ts +81 -0
  39. package/dist/chat/panel-manager.d.ts.map +1 -0
  40. package/dist/chat/session-persistence.d.ts +52 -0
  41. package/dist/chat/session-persistence.d.ts.map +1 -0
  42. package/dist/chat/types.d.ts +33 -1
  43. package/dist/chat/types.d.ts.map +1 -1
  44. package/dist/chat.cjs +1 -1
  45. package/dist/chat.iife.js +48 -10
  46. package/dist/chat.iife.js.map +1 -1
  47. package/dist/chat.js +9 -8
  48. package/dist/chat.js.map +1 -1
  49. package/dist/common/analytics-events.d.ts +2 -0
  50. package/dist/common/analytics-events.d.ts.map +1 -1
  51. package/dist/common/analytics.d.ts.map +1 -1
  52. package/dist/common/api-paths.d.ts +5 -0
  53. package/dist/common/api-paths.d.ts.map +1 -1
  54. package/dist/common/client.d.ts +4 -1
  55. package/dist/common/client.d.ts.map +1 -1
  56. package/dist/common/communication-bridge.d.ts.map +1 -1
  57. package/dist/common/config-schema.d.ts +33 -195
  58. package/dist/common/config-schema.d.ts.map +1 -1
  59. package/dist/common/ga-datalayer.d.ts +62 -0
  60. package/dist/common/ga-datalayer.d.ts.map +1 -0
  61. package/dist/common/index.d.ts +7 -0
  62. package/dist/common/index.d.ts.map +1 -1
  63. package/dist/common/indexed-db.d.ts +1 -1
  64. package/dist/common/indexed-db.d.ts.map +1 -1
  65. package/dist/common/merchant-configs.d.ts +22 -0
  66. package/dist/common/merchant-configs.d.ts.map +1 -0
  67. package/dist/common/overlay.d.ts +5 -0
  68. package/dist/common/overlay.d.ts.map +1 -1
  69. package/dist/common/page-detect.d.ts +31 -0
  70. package/dist/common/page-detect.d.ts.map +1 -0
  71. package/dist/common/preflight.d.ts +3 -1
  72. package/dist/common/preflight.d.ts.map +1 -1
  73. package/dist/common/price-formatter.d.ts +33 -0
  74. package/dist/common/price-formatter.d.ts.map +1 -0
  75. package/dist/common/product-utils.d.ts +26 -0
  76. package/dist/common/product-utils.d.ts.map +1 -0
  77. package/dist/common/quantity-stepper.d.ts +22 -0
  78. package/dist/common/quantity-stepper.d.ts.map +1 -0
  79. package/dist/common/safe-html.d.ts +10 -6
  80. package/dist/common/safe-html.d.ts.map +1 -1
  81. package/dist/common/streaming.d.ts.map +1 -1
  82. package/dist/common/tts-player.d.ts +12 -0
  83. package/dist/common/tts-player.d.ts.map +1 -0
  84. package/dist/common/types.d.ts +51 -0
  85. package/dist/common/types.d.ts.map +1 -1
  86. package/dist/common/v1-protocol-adapter.d.ts +9 -0
  87. package/dist/common/v1-protocol-adapter.d.ts.map +1 -1
  88. package/dist/common/voice-input.d.ts +74 -0
  89. package/dist/common/voice-input.d.ts.map +1 -0
  90. package/dist/common/widget-base.d.ts +17 -1
  91. package/dist/common/widget-base.d.ts.map +1 -1
  92. package/dist/common.cjs +1 -1
  93. package/dist/common.cjs.map +1 -1
  94. package/dist/common.js +564 -244
  95. package/dist/common.js.map +1 -1
  96. package/dist/index-CmlYMq-h.js +4218 -0
  97. package/dist/index-CmlYMq-h.js.map +1 -0
  98. package/dist/index-DK4lqi85.cjs +13 -0
  99. package/dist/index-DK4lqi85.cjs.map +1 -0
  100. package/dist/index.cjs +1 -1
  101. package/dist/index.d.ts +2 -2
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +61 -53
  104. package/dist/qna/catalog.d.ts +30 -96
  105. package/dist/qna/catalog.d.ts.map +1 -1
  106. package/dist/qna/components/TextInput.d.ts.map +1 -1
  107. package/dist/qna/index.d.ts +2 -0
  108. package/dist/qna/index.d.ts.map +1 -1
  109. package/dist/qna.cjs +1 -1
  110. package/dist/qna.cjs.map +1 -1
  111. package/dist/qna.iife.js +46 -8
  112. package/dist/qna.iife.js.map +1 -1
  113. package/dist/qna.js +90 -83
  114. package/dist/qna.js.map +1 -1
  115. package/dist/quantity-stepper-B8kX8GbN.js +209 -0
  116. package/dist/quantity-stepper-B8kX8GbN.js.map +1 -0
  117. package/dist/quantity-stepper-UbAp53Ow.cjs +2 -0
  118. package/dist/quantity-stepper-UbAp53Ow.cjs.map +1 -0
  119. package/dist/schemas-DbbfBnZe.cjs +86 -0
  120. package/dist/schemas-DbbfBnZe.cjs.map +1 -0
  121. package/dist/schemas-SGuXpngy.js +4558 -0
  122. package/dist/schemas-SGuXpngy.js.map +1 -0
  123. package/dist/simrel/api.d.ts.map +1 -1
  124. package/dist/simrel/catalog.d.ts +32 -240
  125. package/dist/simrel/catalog.d.ts.map +1 -1
  126. package/dist/simrel/components/GroupTabs.d.ts.map +1 -1
  127. package/dist/simrel/components/ProductCard.d.ts +2 -0
  128. package/dist/simrel/components/ProductCard.d.ts.map +1 -1
  129. package/dist/simrel/components/renderUISpec.d.ts.map +1 -1
  130. package/dist/simrel/index.d.ts.map +1 -1
  131. package/dist/simrel/types.d.ts +5 -0
  132. package/dist/simrel/types.d.ts.map +1 -1
  133. package/dist/simrel.cjs +1 -1
  134. package/dist/simrel.cjs.map +1 -1
  135. package/dist/simrel.css +1 -1
  136. package/dist/simrel.iife.js +46 -8
  137. package/dist/simrel.iife.js.map +1 -1
  138. package/dist/simrel.js +319 -279
  139. package/dist/simrel.js.map +1 -1
  140. package/package.json +26 -7
  141. package/dist/index-CFA70IGF.js +0 -3626
  142. package/dist/index-CFA70IGF.js.map +0 -1
  143. package/dist/index-Dfl89zpe.cjs +0 -13
  144. package/dist/index-Dfl89zpe.cjs.map +0 -1
  145. package/dist/types-CeON7iBO.cjs +0 -48
  146. package/dist/types-CeON7iBO.cjs.map +0 -1
  147. package/dist/types-yxW8WA7u.js +0 -4132
  148. package/dist/types-yxW8WA7u.js.map +0 -1
@@ -0,0 +1,4558 @@
1
+ const jt = ({ element: e, renderElement: t }) => {
2
+ if (!e.children || e.children.length === 0)
3
+ return null;
4
+ const n = document.createElement("div");
5
+ for (const o of e.children) {
6
+ const r = t(o);
7
+ r && n.appendChild(r);
8
+ }
9
+ return n;
10
+ };
11
+ function Da(e) {
12
+ const t = document.createElement("div");
13
+ if (t.className = e.containerClassName, !e.spec.elements[e.spec.root]) return t;
14
+ const o = e.unknownRenderer ?? jt, r = (s) => {
15
+ const a = e.spec.elements[s];
16
+ if (!a) return null;
17
+ const c = e.registry[a.type];
18
+ return c ? c({
19
+ elementId: s,
20
+ element: a,
21
+ spec: e.spec,
22
+ context: e.context,
23
+ renderElement: r
24
+ }) : o({
25
+ elementId: s,
26
+ element: a,
27
+ spec: e.spec,
28
+ context: e.context,
29
+ renderElement: r
30
+ });
31
+ }, i = r(e.spec.root);
32
+ return i && t.appendChild(i), t;
33
+ }
34
+ function ja(e, t) {
35
+ if (!t) return e;
36
+ const n = { ...e };
37
+ for (const [o, r] of Object.entries(t))
38
+ r && (n[o] = r);
39
+ return n;
40
+ }
41
+ function La(e, t) {
42
+ const n = {
43
+ event_name: "stream.start",
44
+ account_id: e.account_id,
45
+ session_id: e.session_id,
46
+ correlation_id: e.correlation_id,
47
+ payload: {
48
+ endpoint: t.endpoint,
49
+ request_id: t.request_id
50
+ }
51
+ };
52
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
53
+ }
54
+ function Ua(e, t) {
55
+ const n = {
56
+ request_id: t.request_id,
57
+ chunk_index: t.chunk_index
58
+ };
59
+ t.latency_ms !== void 0 && (n.latency_ms = t.latency_ms);
60
+ const o = {
61
+ event_name: "stream.chunk",
62
+ account_id: e.account_id,
63
+ session_id: e.session_id,
64
+ correlation_id: e.correlation_id,
65
+ payload: n
66
+ };
67
+ return e.view_id !== void 0 && (o.view_id = e.view_id), e.user_id !== void 0 && (o.user_id = e.user_id), t.widget !== void 0 && (o.widget = t.widget), e.page_type !== void 0 && (o.page_type = e.page_type), e.sku !== void 0 && (o.sku = e.sku), o;
68
+ }
69
+ function Ma(e, t) {
70
+ const n = {
71
+ event_name: "stream.ui_spec",
72
+ account_id: e.account_id,
73
+ session_id: e.session_id,
74
+ correlation_id: e.correlation_id,
75
+ payload: {
76
+ request_id: t.request_id,
77
+ chunk_index: t.chunk_index,
78
+ component_type: t.component_type
79
+ }
80
+ };
81
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
82
+ }
83
+ function Fa(e, t) {
84
+ const n = {
85
+ event_name: "stream.done",
86
+ account_id: e.account_id,
87
+ session_id: e.session_id,
88
+ correlation_id: e.correlation_id,
89
+ payload: {
90
+ request_id: t.request_id,
91
+ latency_ms: t.latency_ms,
92
+ chunk_count: t.chunk_count
93
+ }
94
+ };
95
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
96
+ }
97
+ function Ja(e, t) {
98
+ const n = {
99
+ event_name: "stream.error",
100
+ account_id: e.account_id,
101
+ session_id: e.session_id,
102
+ correlation_id: e.correlation_id,
103
+ payload: {
104
+ request_id: t.request_id,
105
+ error_code: t.error_code,
106
+ error_message: t.error_message
107
+ }
108
+ };
109
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
110
+ }
111
+ function xa(e, t) {
112
+ const n = {
113
+ model: t.model,
114
+ prompt_tokens: t.prompt_tokens,
115
+ completion_tokens: t.completion_tokens,
116
+ total_tokens: t.total_tokens
117
+ };
118
+ t.provider !== void 0 && (n.provider = t.provider);
119
+ const o = {
120
+ event_name: "llm.usage",
121
+ account_id: e.account_id,
122
+ session_id: e.session_id,
123
+ correlation_id: e.correlation_id,
124
+ payload: n
125
+ };
126
+ return e.view_id !== void 0 && (o.view_id = e.view_id), e.user_id !== void 0 && (o.user_id = e.user_id), e.page_type !== void 0 && (o.page_type = e.page_type), e.sku !== void 0 && (o.sku = e.sku), o;
127
+ }
128
+ function qa(e, t) {
129
+ const n = {
130
+ event_name: "metering.increment",
131
+ account_id: e.account_id,
132
+ session_id: e.session_id,
133
+ correlation_id: e.correlation_id,
134
+ payload: {
135
+ meter_key: t.meter_key,
136
+ quantity: t.quantity,
137
+ unit: t.unit
138
+ }
139
+ };
140
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
141
+ }
142
+ function Lt(e, t) {
143
+ const n = {
144
+ event_name: "metering.summary",
145
+ account_id: e.account_id,
146
+ session_id: e.session_id,
147
+ correlation_id: e.correlation_id,
148
+ payload: {
149
+ meter_key: t.meter_key,
150
+ quantity: t.quantity,
151
+ unit: t.unit
152
+ }
153
+ };
154
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
155
+ }
156
+ function Va(e, t) {
157
+ const n = {
158
+ event_name: "chat.history.snapshot",
159
+ account_id: e.account_id,
160
+ session_id: e.session_id,
161
+ correlation_id: e.correlation_id,
162
+ payload: {
163
+ message_count: t.message_count,
164
+ history_ref: t.history_ref,
165
+ redaction_level: t.redaction_level
166
+ }
167
+ };
168
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
169
+ }
170
+ function Ba(e, t) {
171
+ const n = {
172
+ event_name: "widget.history.snapshot",
173
+ account_id: e.account_id,
174
+ session_id: e.session_id,
175
+ correlation_id: e.correlation_id,
176
+ widget: t.widget,
177
+ payload: {
178
+ message_count: t.message_count,
179
+ history_ref: t.history_ref,
180
+ redaction_level: t.redaction_level
181
+ }
182
+ };
183
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
184
+ }
185
+ function Ga(e, t) {
186
+ const n = {
187
+ event_name: "basket.add",
188
+ account_id: e.account_id,
189
+ session_id: e.session_id,
190
+ correlation_id: e.correlation_id,
191
+ widget: t.attribution_source,
192
+ payload: {
193
+ attribution_source: t.attribution_source,
194
+ attribution_action_id: t.attribution_action_id,
195
+ cart_value: t.cart_value,
196
+ currency: t.currency,
197
+ line_items: t.line_items,
198
+ sku: t.sku
199
+ }
200
+ };
201
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
202
+ }
203
+ function Ut(e, t) {
204
+ const n = {
205
+ event_name: "checkout.start",
206
+ account_id: e.account_id,
207
+ session_id: e.session_id,
208
+ correlation_id: e.correlation_id,
209
+ widget: t.attribution_source,
210
+ payload: {
211
+ attribution_source: t.attribution_source,
212
+ attribution_action_id: t.attribution_action_id,
213
+ cart_value: t.cart_value,
214
+ currency: t.currency,
215
+ line_items: t.line_items
216
+ }
217
+ };
218
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
219
+ }
220
+ function Mt(e, t) {
221
+ const n = {
222
+ event_name: "checkout.complete",
223
+ account_id: e.account_id,
224
+ session_id: e.session_id,
225
+ correlation_id: e.correlation_id,
226
+ widget: t.attribution_source,
227
+ payload: {
228
+ attribution_source: t.attribution_source,
229
+ attribution_action_id: t.attribution_action_id,
230
+ cart_value: t.cart_value,
231
+ currency: t.currency,
232
+ line_items: t.line_items
233
+ }
234
+ };
235
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
236
+ }
237
+ function Wa(e, t) {
238
+ window.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !1 }));
239
+ }
240
+ function X(e, t) {
241
+ const n = (o) => {
242
+ t(o.detail);
243
+ };
244
+ return window.addEventListener(e, n), () => window.removeEventListener(e, n);
245
+ }
246
+ function Ha(e) {
247
+ let t = !1;
248
+ function n() {
249
+ return window.gengage?.chat !== void 0 ? !0 : (t || (console.warn(
250
+ "[gengage] QNA tried to open chat, but chat widget is not initialized. Ensure GengageChat is initialized before calling wireQNAToChat()."
251
+ ), t = !0), e?.onChatUnavailable?.(), !1);
252
+ }
253
+ const o = X("gengage:qna:action", (i) => {
254
+ n() && window.gengage?.chat?.openWithAction(i);
255
+ }), r = X("gengage:qna:open-chat", () => {
256
+ n() && window.gengage?.chat?.open();
257
+ });
258
+ return () => {
259
+ o(), r();
260
+ };
261
+ }
262
+ function Ka() {
263
+ return X("gengage:similar:product-click", ({ sku: e, url: t, sessionId: n }) => {
264
+ n && window.gengage?.chat?.saveSession(n, e), window.location.href = t;
265
+ });
266
+ }
267
+ function Ft() {
268
+ const t = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
269
+ return window.__gengageSessionId = t, sessionStorage.setItem("gengage_session_id", t), window.gengage || (window.gengage = {}), window.gengage.sessionId = t, t;
270
+ }
271
+ function Ya() {
272
+ return window.gengage?.pageContext ?? null;
273
+ }
274
+ function Qa(e) {
275
+ window.gengage || (window.gengage = {}), window.gengage.pageContext = {
276
+ pageType: "other",
277
+ ...window.gengage.pageContext,
278
+ ...e
279
+ }, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
280
+ }
281
+ function Jt(e) {
282
+ return {
283
+ sessionId: e?.sessionId ?? Ft(),
284
+ ...e
285
+ };
286
+ }
287
+ const Ee = {
288
+ "--gengage-chat-offset": "20px",
289
+ "--gengage-chat-launcher-size": "56px",
290
+ "--gengage-chat-width": "400px",
291
+ "--gengage-chat-shell-radius": "12px",
292
+ "--gengage-chat-header-height": "60px",
293
+ "--gengage-chat-conversation-width": "396px",
294
+ "--gengage-chat-panel-min-width": "320px",
295
+ "--gengage-chat-panel-max-width": "860px",
296
+ "--gengage-chat-input-height": "48px",
297
+ "--gengage-qna-pill-radius": "999px",
298
+ "--gengage-qna-input-radius": "14px",
299
+ "--gengage-simrel-card-radius": "14px"
300
+ };
301
+ function xt(e) {
302
+ return e ? { ...Ee, ...e } : { ...Ee };
303
+ }
304
+ const N = "gengage-global-toast-root", Ze = "gengage-global-toast-style", _e = "gengage-global-toast-root--visible", qt = 4200, Vt = 1500, Bt = 15e3;
305
+ let Ie = !1, M = null;
306
+ function Xa(e) {
307
+ return typeof e == "string" && e.toLowerCase().startsWith("tr") ? "Baglanti sorunu olustu. Lutfen tekrar deneyin." : "Connection issue. Please try again.";
308
+ }
309
+ function Gt() {
310
+ Ie || typeof window > "u" || typeof document > "u" || (Ie = !0, X("gengage:global:error", (e) => {
311
+ Wt(e);
312
+ }));
313
+ }
314
+ function Wt(e) {
315
+ if (typeof document > "u") return;
316
+ const t = e.message.trim();
317
+ if (!t) return;
318
+ Xt();
319
+ const n = Yt();
320
+ n.innerHTML = "";
321
+ const o = document.createElement("section");
322
+ o.className = "gengage-global-toast gengage-global-toast--error", o.setAttribute("role", "status"), o.setAttribute("aria-live", "polite");
323
+ const r = document.createElement("div");
324
+ r.className = "gengage-global-toast-title", r.textContent = Kt(e.source);
325
+ const i = document.createElement("div");
326
+ i.className = "gengage-global-toast-message", i.textContent = t, o.appendChild(r), o.appendChild(i), n.appendChild(o), n.classList.add(_e), M && (clearTimeout(M), M = null), M = setTimeout(() => {
327
+ Ht();
328
+ }, Qt(e.durationMs));
329
+ }
330
+ function Ht() {
331
+ if (typeof document > "u") return;
332
+ const e = document.getElementById(N);
333
+ e && (e.classList.remove(_e), e.innerHTML = "", M && (clearTimeout(M), M = null));
334
+ }
335
+ function Kt(e) {
336
+ switch (e) {
337
+ case "chat":
338
+ return "Chat warning";
339
+ case "qna":
340
+ return "QnA warning";
341
+ case "simrel":
342
+ return "Widget warning";
343
+ default:
344
+ return "Connection warning";
345
+ }
346
+ }
347
+ function Yt() {
348
+ const e = document.getElementById(N);
349
+ if (e instanceof HTMLElement) return e;
350
+ const t = document.createElement("div");
351
+ return t.id = N, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
352
+ }
353
+ function Qt(e) {
354
+ return typeof e != "number" || !Number.isFinite(e) ? qt : Math.min(Bt, Math.max(Vt, Math.round(e)));
355
+ }
356
+ function Xt() {
357
+ if (document.getElementById(Ze)) return;
358
+ const e = document.createElement("style");
359
+ e.id = Ze, e.textContent = `
360
+ #${N} {
361
+ position: fixed;
362
+ top: 16px;
363
+ right: 16px;
364
+ z-index: 2147483646;
365
+ pointer-events: none;
366
+ }
367
+ #${N}.${_e} {
368
+ pointer-events: auto;
369
+ }
370
+ #${N} .gengage-global-toast {
371
+ min-width: 260px;
372
+ max-width: min(92vw, 420px);
373
+ border-radius: 12px;
374
+ border: 1px solid #f5c2c7;
375
+ border-left: 4px solid #d93025;
376
+ background: #fff9f9;
377
+ color: #4a1f21;
378
+ box-shadow: 0 10px 30px rgba(38, 18, 18, 0.18);
379
+ padding: 10px 12px;
380
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
381
+ font-size: 13px;
382
+ line-height: 1.4;
383
+ animation: gengage-global-toast-in 180ms ease-out forwards;
384
+ }
385
+ #${N} .gengage-global-toast-title {
386
+ margin: 0 0 4px;
387
+ font-size: 12px;
388
+ font-weight: 700;
389
+ }
390
+ #${N} .gengage-global-toast-message {
391
+ margin: 0;
392
+ font-weight: 500;
393
+ }
394
+ @keyframes gengage-global-toast-in {
395
+ from {
396
+ opacity: 0;
397
+ transform: translateY(-8px);
398
+ }
399
+ to {
400
+ opacity: 1;
401
+ transform: translateY(0);
402
+ }
403
+ }
404
+ `, document.head.appendChild(e);
405
+ }
406
+ class ec {
407
+ constructor() {
408
+ this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
409
+ }
410
+ // ---------------------------------------------------------------------------
411
+ // Public API
412
+ // ---------------------------------------------------------------------------
413
+ async init(t) {
414
+ if (this.isInitialised) {
415
+ console.warn("[gengage] Widget already initialised. Call update() instead.");
416
+ return;
417
+ }
418
+ const n = xt(t.theme);
419
+ this.config = {
420
+ ...t,
421
+ theme: n,
422
+ session: Jt(t.session)
423
+ }, this.root = this._resolveMount(t.mountTarget), this._applyTheme(n), Gt();
424
+ const o = X("gengage:context:update", (r) => this.update(r));
425
+ this._cleanups.push(o);
426
+ try {
427
+ await this.onInit(this.config);
428
+ } catch (r) {
429
+ throw this.destroy(), r;
430
+ }
431
+ this.isInitialised = !0, this.emit("ready");
432
+ }
433
+ update(t) {
434
+ this.isInitialised && (this.config.pageContext ? this.config = {
435
+ ...this.config,
436
+ pageContext: { ...this.config.pageContext, ...t }
437
+ } : t.pageType !== void 0 && (this.config = { ...this.config, pageContext: t }), this.onUpdate(t), this.emit("context-update", this.config.pageContext));
438
+ }
439
+ show() {
440
+ this.isVisible || (this.isVisible = !0, this.root.style.display = "", this.onShow(), this.emit("show"));
441
+ }
442
+ hide() {
443
+ this.isVisible && (this.isVisible = !1, this.root.style.display = "none", this.onHide(), this.emit("hide"));
444
+ }
445
+ destroy() {
446
+ this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((t) => t()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this.config.analyticsClient?.destroy(), this._ownsRoot ? this.root.remove() : this.root.innerHTML = "", this.isInitialised = !1);
447
+ }
448
+ on(t, n) {
449
+ return this._handlers.has(t) || this._handlers.set(t, /* @__PURE__ */ new Set()), this._handlers.get(t).add(n), () => this._handlers.get(t)?.delete(n);
450
+ }
451
+ /** Track a checkout start event. Called by host page to attribute checkout to widget interaction. */
452
+ trackCheckout(t, n) {
453
+ const o = t === "start" ? Ut : Mt;
454
+ this.track(o(this.analyticsContext(), n));
455
+ }
456
+ /** Track a metering summary event. Called by host page for session-level aggregation. */
457
+ flushMeteringSummary(t) {
458
+ this.track(Lt(this.analyticsContext(), t));
459
+ }
460
+ // ---------------------------------------------------------------------------
461
+ // Protected helpers
462
+ // ---------------------------------------------------------------------------
463
+ /** Emit a widget event to all registered handlers. */
464
+ emit(t, ...n) {
465
+ this._handlers.get(t)?.forEach((o) => o(...n));
466
+ }
467
+ /** Register a cleanup function to run on destroy(). */
468
+ addCleanup(t) {
469
+ this._cleanups.push(t);
470
+ }
471
+ /** Track an analytics event (no-op if analyticsClient is not configured). */
472
+ track(t) {
473
+ this.config.analyticsClient?.track(t);
474
+ }
475
+ /** Build the shared analytics context from widget config. */
476
+ analyticsContext() {
477
+ const t = {
478
+ account_id: this.config.accountId,
479
+ session_id: this.config.session?.sessionId ?? "",
480
+ correlation_id: this.config.session?.sessionId ?? ""
481
+ };
482
+ return this.config.session?.viewId !== void 0 && (t.view_id = this.config.session.viewId), this.config.session?.userId !== void 0 && (t.user_id = this.config.session.userId), this.config.pageContext?.pageType !== void 0 && (t.page_type = this.config.pageContext.pageType), this.config.pageContext?.sku !== void 0 && (t.sku = this.config.pageContext.sku), this.config.session?.abTestVariant !== void 0 && (t.ab_test_variant = this.config.session.abTestVariant), this.config.session?.abTestExperimentId !== void 0 && (t.ab_test_experiment_id = this.config.session.abTestExperimentId), t;
483
+ }
484
+ // ---------------------------------------------------------------------------
485
+ // Private helpers
486
+ // ---------------------------------------------------------------------------
487
+ _resolveMount(t) {
488
+ if (t instanceof HTMLElement) return t;
489
+ if (typeof t == "string") {
490
+ const o = document.querySelector(t);
491
+ if (!o) throw new Error(`[gengage] Mount target not found: "${t}"`);
492
+ return o;
493
+ }
494
+ const n = document.createElement("div");
495
+ return n.dataset.gengageWidget = this.constructor.name.toLowerCase(), document.body.appendChild(n), this._ownsRoot = !0, n;
496
+ }
497
+ _applyTheme(t) {
498
+ if (t) {
499
+ for (const [n, o] of Object.entries(t))
500
+ if (o !== void 0) {
501
+ const r = n.startsWith("--") ? n : `--gengage-${en(n)}`;
502
+ this.root.style.setProperty(r, o);
503
+ }
504
+ }
505
+ }
506
+ }
507
+ function en(e) {
508
+ return e.replace(/([A-Z])/g, "-$1").toLowerCase();
509
+ }
510
+ function Te(e) {
511
+ return typeof e == "object" && e !== null && typeof e.type == "string";
512
+ }
513
+ function tn(e) {
514
+ const t = [];
515
+ let n = 0, o = !1, r = !1, i = 0;
516
+ for (let s = 0; s < e.length; s++) {
517
+ const a = e[s];
518
+ if (r) {
519
+ r = !1;
520
+ continue;
521
+ }
522
+ if (a === "\\" && o) {
523
+ r = !0;
524
+ continue;
525
+ }
526
+ if (a === '"') {
527
+ o = !o;
528
+ continue;
529
+ }
530
+ o || (a === "{" && n++, a === "}" && (n--, n === 0 && (t.push(e.slice(i, s + 1)), i = s + 1)));
531
+ }
532
+ return t.length > 0 ? t : [e];
533
+ }
534
+ function Oe(e, t) {
535
+ const n = e.trim();
536
+ if (!n || n.startsWith(":")) return !1;
537
+ const o = n.startsWith("data: ") ? n.slice(6) : n;
538
+ if (o === "[DONE]") return !0;
539
+ try {
540
+ const r = JSON.parse(o);
541
+ return Te(r) ? (t.onEvent(r), r.type === "done" ? (t.onDone?.(), !0) : !1) : !1;
542
+ } catch {
543
+ const r = tn(o);
544
+ if (r.length > 1) {
545
+ for (const i of r)
546
+ try {
547
+ const s = JSON.parse(i);
548
+ if (!Te(s)) continue;
549
+ if (t.onEvent(s), s.type === "done")
550
+ return t.onDone?.(), !0;
551
+ } catch {
552
+ }
553
+ return !1;
554
+ }
555
+ return !1;
556
+ }
557
+ }
558
+ async function nn(e, t) {
559
+ if (!e.ok) {
560
+ t.onError?.(new Error(`HTTP ${e.status}: ${e.statusText}`));
561
+ return;
562
+ }
563
+ if (!e.body) {
564
+ t.onError?.(new Error("Response body is null — streaming not supported"));
565
+ return;
566
+ }
567
+ const n = e.body.getReader(), o = new TextDecoder("utf-8");
568
+ let r = "";
569
+ try {
570
+ for (; ; ) {
571
+ const { done: i, value: s } = await n.read();
572
+ if (i) break;
573
+ r += o.decode(s, { stream: !0 });
574
+ const a = r.split(`
575
+ `);
576
+ r = a.pop() ?? "";
577
+ for (const c of a)
578
+ if (Oe(c, t)) return;
579
+ }
580
+ if (r.trim() && Oe(r, t))
581
+ return;
582
+ } catch (i) {
583
+ if (i instanceof DOMException && i.name === "AbortError") return;
584
+ t.onError?.(i instanceof Error ? i : new Error(String(i)));
585
+ } finally {
586
+ n.releaseLock();
587
+ }
588
+ t.onDone?.();
589
+ }
590
+ function tc(e, t, n) {
591
+ const o = new AbortController(), r = n.signal ? on([n.signal, o.signal]) : o.signal;
592
+ return fetch(e, {
593
+ method: "POST",
594
+ headers: {
595
+ "Content-Type": "application/json",
596
+ ...n.headers
597
+ },
598
+ body: JSON.stringify(t),
599
+ signal: r
600
+ }).then((i) => nn(i, { ...n, signal: r })).catch((i) => {
601
+ i instanceof DOMException && i.name === "AbortError" || n.onError?.(i instanceof Error ? i : new Error(String(i)));
602
+ }), o;
603
+ }
604
+ function on(e) {
605
+ const t = new AbortController(), n = [];
606
+ for (const o of e) {
607
+ if (o.aborted)
608
+ return t.abort(o.reason), t.signal;
609
+ const r = () => t.abort(o.reason);
610
+ o.addEventListener("abort", r, { once: !0 }), n.push(() => o.removeEventListener("abort", r));
611
+ }
612
+ return t.signal.addEventListener(
613
+ "abort",
614
+ () => {
615
+ for (const o of n) o();
616
+ },
617
+ { once: !0 }
618
+ ), t.signal;
619
+ }
620
+ function nc(e) {
621
+ if (typeof e.type != "string") return null;
622
+ if (rn(e))
623
+ return e;
624
+ const n = e;
625
+ switch (n.type) {
626
+ case "outputText":
627
+ return sn(n);
628
+ case "suggestedActions":
629
+ return an(n);
630
+ case "productList":
631
+ return cn(n);
632
+ case "productDetails":
633
+ return un(n);
634
+ case "productDetailsSimilars":
635
+ return dn(n);
636
+ case "comparisonTable":
637
+ return ln(n);
638
+ case "context":
639
+ return fn(n);
640
+ case "chatStreamEnd":
641
+ return pn();
642
+ case "loading":
643
+ return gn(n);
644
+ case "panelLoading":
645
+ return hn(n);
646
+ case "similarLoading":
647
+ return mn(n);
648
+ case "redirect":
649
+ return _n(n);
650
+ case "error":
651
+ return yn(n);
652
+ case "dummy":
653
+ return vn();
654
+ case "launcherAction":
655
+ return wn(n);
656
+ case "text":
657
+ return ye(n);
658
+ case "productItem":
659
+ return bn(n);
660
+ case "text_image":
661
+ return tt(n);
662
+ case "quick_qna":
663
+ return nt(n);
664
+ case "reviewHighlights":
665
+ return kn(n);
666
+ case "aiProductSuggestions":
667
+ return Sn(n);
668
+ case "aiProductGroupings":
669
+ return En(n);
670
+ case "aiSuggestedSearches":
671
+ return Zn(n);
672
+ case "prosAndCons":
673
+ return zn(n);
674
+ case "getGroundingReview":
675
+ return In(n);
676
+ case "voice":
677
+ return On(n);
678
+ case "visitorDataResponse":
679
+ return $n(n);
680
+ case "productListPreview":
681
+ return Tn();
682
+ case "groupList":
683
+ return Pn(n);
684
+ case "formGetInfo":
685
+ case "formTestDrive":
686
+ case "formServiceRequest":
687
+ case "launchFormPage":
688
+ return An(n);
689
+ case "launcherContent":
690
+ return Cn(n);
691
+ case "handoff":
692
+ return Nn(n);
693
+ default:
694
+ return null;
695
+ }
696
+ }
697
+ function rn(e) {
698
+ const t = e.type;
699
+ if (typeof t != "string") return !1;
700
+ switch (t) {
701
+ case "metadata":
702
+ return typeof e.sessionId == "string" && typeof e.model == "string";
703
+ case "text_chunk":
704
+ return typeof e.content == "string";
705
+ case "ui_spec": {
706
+ const n = e.widget;
707
+ if (n !== "chat" && n !== "qna" && n !== "simrel") return !1;
708
+ const o = F(e.spec);
709
+ return o ? typeof o.root == "string" && F(o.elements) !== null : !1;
710
+ }
711
+ case "action": {
712
+ const n = F(e.action);
713
+ return n !== null && typeof n.kind == "string";
714
+ }
715
+ case "error":
716
+ return typeof e.code == "string" && typeof e.message == "string";
717
+ case "done":
718
+ return !0;
719
+ default:
720
+ return !1;
721
+ }
722
+ }
723
+ function sn(e) {
724
+ const t = y(e.payload.text, e.payload.plain_text) ?? "", n = y(e.payload.plain_text, e.payload.text) ?? t;
725
+ if (e.payload.is_error)
726
+ return {
727
+ type: "error",
728
+ code: "BACKEND_ERROR",
729
+ message: n || "Backend returned an error"
730
+ };
731
+ const o = {
732
+ type: "text_chunk",
733
+ content: t,
734
+ final: !0
735
+ }, r = e.payload.product_mentions;
736
+ Array.isArray(r) && r.length > 0 && (o.productMentions = r.filter(
737
+ (a) => typeof a == "object" && a !== null && typeof a.sku == "string" && typeof a.short_name == "string"
738
+ ));
739
+ const i = e.payload.sku_to_product_item;
740
+ i && typeof i == "object" && !Array.isArray(i) && (o.skuToProductItem = i);
741
+ const s = e.payload.conversation_mode;
742
+ return typeof s == "string" && s && (o.conversationMode = s), o;
743
+ }
744
+ function an(e) {
745
+ const t = (e.payload.actions ?? []).map((n) => {
746
+ const o = y(n.title) ?? "", r = D(n.requestDetails, o), i = r ? {
747
+ label: o,
748
+ action: r
749
+ } : null;
750
+ return i ? (typeof n.icon == "string" && (i.icon = n.icon), typeof n.image == "string" && (i.image = n.image), i) : null;
751
+ });
752
+ return ot(t.filter(it), "chat");
753
+ }
754
+ function cn(e) {
755
+ const t = rt(e.payload.product_list ?? [], "chat");
756
+ t.panelHint = "panel";
757
+ const n = t.spec.elements[t.spec.root];
758
+ return n && (typeof e.payload.offset == "number" && (n.props = { ...n.props, offset: e.payload.offset }), typeof e.payload.end_of_list == "boolean" && (n.props = { ...n.props, endOfList: e.payload.end_of_list })), t;
759
+ }
760
+ function un(e) {
761
+ const t = e.payload.productDetails;
762
+ return t ? {
763
+ type: "ui_spec",
764
+ widget: "chat",
765
+ spec: {
766
+ root: "root",
767
+ elements: {
768
+ root: {
769
+ type: "ProductDetailsPanel",
770
+ props: { product: j(t) }
771
+ }
772
+ }
773
+ },
774
+ panelHint: "panel"
775
+ } : Dn("chat");
776
+ }
777
+ function dn(e) {
778
+ const t = rt(e.payload.similarProducts ?? [], "chat"), n = t.spec.elements[t.spec.root];
779
+ return n && (n.props = { ...n.props, similarsAppend: !0 }), { ...t, panelHint: "panel" };
780
+ }
781
+ function ln(e) {
782
+ const t = e.payload.multiple_product_details ?? [], n = e.payload.product_comparison_framework, o = e.payload.table, r = [];
783
+ for (const m of t) {
784
+ const v = j(m);
785
+ r.push(v);
786
+ }
787
+ const i = [];
788
+ if (o) {
789
+ const m = n?.criteria_view ?? n?.criteria_view_short ?? {}, v = n?.compared_field_names ?? Object.keys(o);
790
+ for (const A of v) {
791
+ const H = o[A];
792
+ if (!H || !Array.isArray(H)) continue;
793
+ const le = m[A] ?? A;
794
+ i.push({ label: le, values: H.map((Z) => typeof Z == "string" ? Z : String(Z ?? "")) });
795
+ }
796
+ }
797
+ let s;
798
+ n?.recommended_choice_sku ? s = n.recommended_choice_sku : n?.winner_product && n.winner_product.length > 0 && (s = n.winner_product[0]?.sku);
799
+ const a = s ? r.find((m) => m.sku === s) ?? r[0] : r[0], c = [];
800
+ if (Array.isArray(n?.key_differences))
801
+ for (const m of n.key_differences)
802
+ typeof m == "string" && c.push(m);
803
+ const u = [];
804
+ if (n?.special_considerations)
805
+ for (const m of n.special_considerations)
806
+ typeof m == "string" && u.push(m);
807
+ const l = n?.recommended_choice, f = n?.winner_hits, h = {};
808
+ for (const m of r) {
809
+ const v = m.sku;
810
+ v && (h[v] = {
811
+ title: m.name ?? v,
812
+ type: "launchSingleProduct",
813
+ payload: { sku: v }
814
+ });
815
+ }
816
+ const p = {
817
+ products: r,
818
+ attributes: i,
819
+ highlights: c,
820
+ productActions: h
821
+ };
822
+ return a && (p.recommended = a), u.length > 0 && (p.specialCases = u), l && (p.recommendedText = l), f && (p.winnerHits = f), typeof n?.key_differences == "string" && (p.keyDifferencesHtml = n.key_differences), n?.special_considerations && (p.specialConsiderations = n.special_considerations), {
823
+ type: "ui_spec",
824
+ widget: "chat",
825
+ spec: {
826
+ root: "root",
827
+ elements: {
828
+ root: {
829
+ type: "ComparisonTable",
830
+ props: p
831
+ }
832
+ }
833
+ },
834
+ panelHint: "panel"
835
+ };
836
+ }
837
+ function fn(e) {
838
+ return {
839
+ type: "metadata",
840
+ sessionId: "",
841
+ model: "",
842
+ meta: {
843
+ panel: e.payload.panel,
844
+ messages: e.payload.messages,
845
+ message_id: e.payload.message_id
846
+ }
847
+ };
848
+ }
849
+ function pn() {
850
+ return { type: "done" };
851
+ }
852
+ function gn(e) {
853
+ return {
854
+ type: "metadata",
855
+ sessionId: "",
856
+ model: "",
857
+ meta: {
858
+ loading: !0,
859
+ loadingText: e.payload.text,
860
+ thinkingMessages: e.payload.thinking_messages,
861
+ dynamicLoading: e.payload.is_dynamic === !0
862
+ }
863
+ };
864
+ }
865
+ function hn(e) {
866
+ return {
867
+ type: "metadata",
868
+ sessionId: "",
869
+ model: "",
870
+ meta: {
871
+ loading: !0,
872
+ panelLoading: !0,
873
+ panelPendingType: e.payload?.pending_type,
874
+ loadingText: e.payload?.text
875
+ }
876
+ };
877
+ }
878
+ function mn(e) {
879
+ return {
880
+ type: "metadata",
881
+ sessionId: "",
882
+ model: "",
883
+ meta: {
884
+ loading: !0,
885
+ similarPanelLoading: !0,
886
+ panelPendingType: e.payload?.pending_type,
887
+ loadingText: e.payload?.text
888
+ }
889
+ };
890
+ }
891
+ function _n(e) {
892
+ const t = y(e.payload.url);
893
+ return t ? {
894
+ type: "action",
895
+ action: {
896
+ kind: "navigate",
897
+ url: t,
898
+ newTab: e.payload.new_tab === !0
899
+ }
900
+ } : {
901
+ type: "metadata",
902
+ sessionId: "",
903
+ model: "",
904
+ meta: {
905
+ redirect: e.payload,
906
+ redirectTarget: y(e.payload.to)
907
+ }
908
+ };
909
+ }
910
+ function yn(e) {
911
+ return {
912
+ type: "error",
913
+ code: "BACKEND_ERROR",
914
+ message: y(e.payload?.text, e.payload?.message, e.payload?.error) ?? "Backend returned an error"
915
+ };
916
+ }
917
+ function vn(e) {
918
+ return {
919
+ type: "metadata",
920
+ sessionId: "",
921
+ model: "",
922
+ meta: {
923
+ noop: !0
924
+ }
925
+ };
926
+ }
927
+ function wn(e) {
928
+ const t = e.payload ?? {};
929
+ if (Array.isArray(t.action_list)) {
930
+ const i = {
931
+ action_list: t.action_list
932
+ }, s = typeof t.type == "string" ? t.type : void 0, a = typeof t.theme == "string" ? t.theme : void 0;
933
+ return s !== void 0 && (i.type = s), a !== void 0 && (i.theme = a), nt({
934
+ payload: i
935
+ });
936
+ }
937
+ const o = F(t.action);
938
+ if (o) {
939
+ const i = {
940
+ action: o
941
+ }, s = typeof t.text == "string" ? t.text : void 0, a = typeof t.image_url == "string" ? t.image_url : void 0, c = typeof t.theme == "string" ? t.theme : void 0;
942
+ return s !== void 0 && (i.text = s), a !== void 0 && (i.image_url = a), c !== void 0 && (i.theme = c), tt({
943
+ payload: i
944
+ });
945
+ }
946
+ const r = typeof t.text == "string" ? t.text : "";
947
+ if (r) {
948
+ const i = { text: r }, s = typeof t.type == "string" ? t.type : void 0, a = typeof t.theme == "string" ? t.theme : void 0, c = F(t.payload) ?? void 0;
949
+ return s !== void 0 && (i.type = s), c !== void 0 && (i.payload = c), a !== void 0 && (i.theme = a), ye({
950
+ payload: i
951
+ });
952
+ }
953
+ return {
954
+ type: "metadata",
955
+ sessionId: "",
956
+ model: "",
957
+ meta: {
958
+ launcherAction: t
959
+ }
960
+ };
961
+ }
962
+ function ye(e) {
963
+ const t = {
964
+ text: y(e.payload.text) ?? ""
965
+ };
966
+ return typeof e.payload.theme == "string" && (t.theme = e.payload.theme), e.payload.payload !== void 0 && (t.payload = e.payload.payload), {
967
+ type: "ui_spec",
968
+ widget: "qna",
969
+ spec: {
970
+ root: "root",
971
+ elements: {
972
+ root: {
973
+ type: "QuestionHeading",
974
+ props: t
975
+ }
976
+ }
977
+ }
978
+ };
979
+ }
980
+ function bn(e) {
981
+ return Rn(e.payload, "qna");
982
+ }
983
+ function tt(e) {
984
+ const t = y(e.payload.text) ?? "", n = D(e.payload.action, t);
985
+ if (n) {
986
+ const r = {
987
+ label: t || n.title,
988
+ action: n
989
+ };
990
+ return typeof e.payload.image_url == "string" && (r.image = e.payload.image_url), typeof e.payload.theme == "string" && (r.theme = e.payload.theme), {
991
+ type: "ui_spec",
992
+ widget: "qna",
993
+ spec: {
994
+ root: "root",
995
+ elements: {
996
+ root: {
997
+ type: "ActionButton",
998
+ props: r
999
+ }
1000
+ }
1001
+ }
1002
+ };
1003
+ }
1004
+ const o = {
1005
+ text: t
1006
+ };
1007
+ return typeof e.payload.theme == "string" && (o.theme = e.payload.theme), ye({
1008
+ payload: o
1009
+ });
1010
+ }
1011
+ function nt(e) {
1012
+ const t = (e.payload.action_list ?? []).map((n) => {
1013
+ const o = y(n.title) ?? "", r = D(n.requestDetails, o), i = r ? {
1014
+ label: o,
1015
+ action: r
1016
+ } : null;
1017
+ return i ? (typeof n.icon == "string" && (i.icon = n.icon), typeof n.image == "string" && (i.image = n.image), i) : null;
1018
+ });
1019
+ return ot(t.filter(it), "qna");
1020
+ }
1021
+ function kn(e) {
1022
+ const n = { reviews: (e.payload.reviews ?? []).map((o) => {
1023
+ const r = {};
1024
+ return typeof o.review_class == "string" && (r.review_class = o.review_class), typeof o.review_text == "string" && (r.review_text = o.review_text), (typeof o.review_rating == "string" || typeof o.review_rating == "number") && (r.review_rating = o.review_rating), typeof o.review_tag == "string" && (r.review_tag = o.review_tag), r;
1025
+ }) };
1026
+ return typeof e.payload.sku == "string" && (n.sku = e.payload.sku), {
1027
+ type: "ui_spec",
1028
+ widget: "chat",
1029
+ spec: {
1030
+ root: "root",
1031
+ elements: {
1032
+ root: {
1033
+ type: "ReviewHighlights",
1034
+ props: n
1035
+ }
1036
+ }
1037
+ }
1038
+ };
1039
+ }
1040
+ function zn(e) {
1041
+ const t = {};
1042
+ return Array.isArray(e.payload.pros) && (t.pros = e.payload.pros), Array.isArray(e.payload.cons) && (t.cons = e.payload.cons), typeof e.payload.product_name == "string" && (t.productName = e.payload.product_name), {
1043
+ type: "ui_spec",
1044
+ widget: "chat",
1045
+ spec: {
1046
+ root: "root",
1047
+ elements: {
1048
+ root: {
1049
+ type: "ProsAndCons",
1050
+ props: t
1051
+ }
1052
+ }
1053
+ }
1054
+ };
1055
+ }
1056
+ function $n(e) {
1057
+ return {
1058
+ type: "metadata",
1059
+ sessionId: "",
1060
+ model: "",
1061
+ meta: {
1062
+ visitorDataResponse: e.payload
1063
+ }
1064
+ };
1065
+ }
1066
+ function Sn(e) {
1067
+ const t = e.payload.product_suggestions ?? [], n = [];
1068
+ for (let o = 0; o < t.length; o++) {
1069
+ const r = t[o];
1070
+ if (!r) continue;
1071
+ const i = jn(r);
1072
+ if (!i) continue;
1073
+ const s = { product: i }, a = D(r.requestDetails, i.name);
1074
+ a && (s.action = a), typeof r.role == "string" && (s.role = r.role), typeof r.reason == "string" && (s.reason = r.reason), typeof r.review_highlight == "string" && (s.reviewHighlight = r.review_highlight), Array.isArray(r.labels) && (s.labels = r.labels), typeof r.expert_quality_score == "number" && (s.expertQualityScore = r.expert_quality_score), n.push(s);
1075
+ }
1076
+ return n.length === 0 ? {
1077
+ type: "metadata",
1078
+ sessionId: "",
1079
+ model: "",
1080
+ meta: {
1081
+ aiProductSuggestions: e.payload.product_suggestions ?? []
1082
+ }
1083
+ } : {
1084
+ type: "ui_spec",
1085
+ widget: "chat",
1086
+ spec: {
1087
+ root: "root",
1088
+ elements: {
1089
+ root: {
1090
+ type: "AITopPicks",
1091
+ props: { suggestions: n }
1092
+ }
1093
+ }
1094
+ }
1095
+ };
1096
+ }
1097
+ function En(e) {
1098
+ const t = e.payload.product_groupings ?? [], n = [];
1099
+ for (let o = 0; o < t.length; o++) {
1100
+ const r = t[o];
1101
+ if (!r) continue;
1102
+ const i = y(r.name) ?? "", s = r.sku && r.sku.length > 0 ? { type: "findSimilar", payload: { sku: r.sku } } : void 0, a = D(r.requestDetails ?? s, i);
1103
+ if (!a) continue;
1104
+ const c = { name: i, action: a };
1105
+ if (Array.isArray(r.labels)) {
1106
+ const u = r.labels.filter((l) => typeof l == "string");
1107
+ u.length > 0 && (c.labels = u);
1108
+ }
1109
+ typeof r.image == "string" && (c.image = r.image), n.push(c);
1110
+ }
1111
+ return n.length === 0 ? {
1112
+ type: "metadata",
1113
+ sessionId: "",
1114
+ model: "",
1115
+ meta: {
1116
+ aiProductGroupings: e.payload.product_groupings ?? []
1117
+ }
1118
+ } : {
1119
+ type: "ui_spec",
1120
+ widget: "chat",
1121
+ spec: {
1122
+ root: "root",
1123
+ elements: {
1124
+ root: {
1125
+ type: "AIGroupingCards",
1126
+ props: { entries: n }
1127
+ }
1128
+ }
1129
+ }
1130
+ };
1131
+ }
1132
+ function Zn(e) {
1133
+ const t = e.payload.suggested_searches ?? [], n = [];
1134
+ for (let o = 0; o < t.length; o++) {
1135
+ const r = t[o];
1136
+ if (!r) continue;
1137
+ const i = y(r.short_name, r.chosen_attribute, r.detailed_user_message) ?? `Arama ${o + 1}`, s = {}, a = y(r.detailed_user_message);
1138
+ a && (s.text = a), r.group_skus && Array.isArray(r.group_skus) && (s.group_skus = r.group_skus);
1139
+ const c = y(r.sku, r.representative_product_sku);
1140
+ c && (s.sku = c), s.is_suggested_text = 1;
1141
+ const u = { type: "inputText", payload: s }, l = D(r.requestDetails ?? u, i);
1142
+ if (!l) continue;
1143
+ const f = { shortName: i, action: l }, h = y(r.detailed_user_message);
1144
+ h && h !== i && (f.detailedMessage = h);
1145
+ const p = y(r.why_different);
1146
+ p && (f.whyDifferent = p), typeof r.image == "string" && (f.image = r.image), n.push(f);
1147
+ }
1148
+ return n.length === 0 ? {
1149
+ type: "metadata",
1150
+ sessionId: "",
1151
+ model: "",
1152
+ meta: {
1153
+ aiSuggestedSearches: e.payload.suggested_searches ?? []
1154
+ }
1155
+ } : {
1156
+ type: "ui_spec",
1157
+ widget: "chat",
1158
+ spec: {
1159
+ root: "root",
1160
+ elements: {
1161
+ root: {
1162
+ type: "AISuggestedSearchCards",
1163
+ props: { entries: n }
1164
+ }
1165
+ }
1166
+ }
1167
+ };
1168
+ }
1169
+ function In(e) {
1170
+ const t = D(
1171
+ e.payload.requestDetails,
1172
+ y(e.payload.review_count, e.payload.text, e.payload.title) ?? "Urun yorumlarini goster"
1173
+ );
1174
+ if (!t)
1175
+ return {
1176
+ type: "metadata",
1177
+ sessionId: "",
1178
+ model: "",
1179
+ meta: {
1180
+ groundingReview: e.payload
1181
+ }
1182
+ };
1183
+ const n = { action: t };
1184
+ return e.payload.title && (n.title = e.payload.title), e.payload.text && (n.text = e.payload.text), e.payload.review_count && (n.reviewCount = e.payload.review_count), {
1185
+ type: "ui_spec",
1186
+ widget: "chat",
1187
+ spec: {
1188
+ root: "root",
1189
+ elements: {
1190
+ root: {
1191
+ type: "GroundingReviewCard",
1192
+ props: n
1193
+ }
1194
+ }
1195
+ }
1196
+ };
1197
+ }
1198
+ function Tn() {
1199
+ return {
1200
+ type: "metadata",
1201
+ sessionId: "",
1202
+ model: "",
1203
+ meta: {
1204
+ analyzeAnimation: !0
1205
+ }
1206
+ };
1207
+ }
1208
+ function On(e) {
1209
+ return {
1210
+ type: "metadata",
1211
+ sessionId: "",
1212
+ model: "",
1213
+ meta: {
1214
+ voice: e.payload
1215
+ }
1216
+ };
1217
+ }
1218
+ function Pn(e) {
1219
+ const t = e.payload.group_list ?? [], n = [];
1220
+ for (const r of t) {
1221
+ const i = r.group_name ?? "", s = (r.product_list ?? []).map(j);
1222
+ n.push({ groupName: i, products: s });
1223
+ }
1224
+ const o = [];
1225
+ for (const r of e.payload.filter_tags ?? []) {
1226
+ const i = r.title ?? "";
1227
+ if (!i) continue;
1228
+ const s = D(r.requestDetails, i), a = { title: i };
1229
+ s && (a.action = s), o.push(a);
1230
+ }
1231
+ return {
1232
+ type: "ui_spec",
1233
+ widget: "chat",
1234
+ spec: {
1235
+ root: "root",
1236
+ elements: {
1237
+ root: {
1238
+ type: "CategoriesContainer",
1239
+ props: { groups: n, filterTags: o }
1240
+ }
1241
+ }
1242
+ },
1243
+ panelHint: "panel"
1244
+ };
1245
+ }
1246
+ function An(e) {
1247
+ return {
1248
+ type: "metadata",
1249
+ sessionId: "",
1250
+ model: "",
1251
+ meta: {
1252
+ formType: e.type,
1253
+ formPayload: e.payload ?? {}
1254
+ }
1255
+ };
1256
+ }
1257
+ function Nn(e) {
1258
+ const t = {};
1259
+ return typeof e.payload?.summary == "string" && (t.summary = e.payload.summary), Array.isArray(e.payload?.products_discussed) && (t.products_discussed = e.payload.products_discussed), typeof e.payload?.user_sentiment == "string" && (t.user_sentiment = e.payload.user_sentiment), {
1260
+ type: "ui_spec",
1261
+ widget: "chat",
1262
+ spec: {
1263
+ root: "root",
1264
+ elements: {
1265
+ root: {
1266
+ type: "HandoffNotice",
1267
+ props: t
1268
+ }
1269
+ }
1270
+ }
1271
+ };
1272
+ }
1273
+ function Cn(e) {
1274
+ return {
1275
+ type: "metadata",
1276
+ sessionId: "",
1277
+ model: "",
1278
+ meta: {
1279
+ launcherContent: e.payload ?? {}
1280
+ }
1281
+ };
1282
+ }
1283
+ function ot(e, t) {
1284
+ const n = {}, o = [];
1285
+ for (let r = 0; r < e.length; r++) {
1286
+ const i = e[r];
1287
+ if (!i) continue;
1288
+ const s = `action-${r}`;
1289
+ o.push(s);
1290
+ const a = {
1291
+ label: i.label,
1292
+ action: i.action
1293
+ };
1294
+ i.icon !== void 0 && (a.icon = i.icon), i.image !== void 0 && (a.image = i.image), i.description !== void 0 && (a.description = i.description), n[s] = {
1295
+ type: "ActionButton",
1296
+ props: a
1297
+ };
1298
+ }
1299
+ return n.root = {
1300
+ type: "ActionButtons",
1301
+ props: {
1302
+ buttons: e.map((r) => {
1303
+ const i = {
1304
+ label: r.label,
1305
+ action: r.action
1306
+ };
1307
+ return r.image !== void 0 && (i.image = r.image), r.description !== void 0 && (i.description = r.description), r.icon !== void 0 && (i.icon = r.icon), i;
1308
+ })
1309
+ },
1310
+ children: o
1311
+ }, {
1312
+ type: "ui_spec",
1313
+ widget: t,
1314
+ spec: { root: "root", elements: n }
1315
+ };
1316
+ }
1317
+ function rt(e, t) {
1318
+ const n = {}, o = [];
1319
+ for (let r = 0; r < e.length; r++) {
1320
+ const i = e[r];
1321
+ if (!i) continue;
1322
+ const s = `product-${r}`;
1323
+ o.push(s), n[s] = {
1324
+ type: "ProductCard",
1325
+ props: { product: j(i), index: r }
1326
+ };
1327
+ }
1328
+ return n.root = {
1329
+ type: "ProductGrid",
1330
+ props: { layout: "grid" },
1331
+ children: o
1332
+ }, {
1333
+ type: "ui_spec",
1334
+ widget: t,
1335
+ spec: { root: "root", elements: n }
1336
+ };
1337
+ }
1338
+ function Rn(e, t) {
1339
+ return {
1340
+ type: "ui_spec",
1341
+ widget: t,
1342
+ spec: {
1343
+ root: "root",
1344
+ elements: {
1345
+ root: {
1346
+ type: "ProductCard",
1347
+ props: { product: j(e), index: 0 }
1348
+ }
1349
+ }
1350
+ }
1351
+ };
1352
+ }
1353
+ function Dn(e) {
1354
+ return {
1355
+ type: "ui_spec",
1356
+ widget: e,
1357
+ spec: {
1358
+ root: "root",
1359
+ elements: {
1360
+ root: {
1361
+ type: "ActionButtons",
1362
+ props: { buttons: [] },
1363
+ children: []
1364
+ }
1365
+ }
1366
+ }
1367
+ };
1368
+ }
1369
+ function jn(e) {
1370
+ const t = y(e.sku), n = y(e.short_name), o = F(e.product_item) ?? e;
1371
+ return Ln(o, t, n);
1372
+ }
1373
+ function Ln(e, t, n) {
1374
+ const o = y(e.sku, t), r = y(e.name, n);
1375
+ if (!o || !r) return null;
1376
+ const i = {
1377
+ sku: o,
1378
+ name: r
1379
+ }, s = y(e.brand);
1380
+ s && (i.brand = s);
1381
+ const a = y(e.url);
1382
+ a && (i.url = a);
1383
+ const c = Un(e.images);
1384
+ if (c.length > 0)
1385
+ i.images = c;
1386
+ else {
1387
+ const m = y(e.image, e.image_url, e.imageUrl);
1388
+ m && (i.images = [m]);
1389
+ }
1390
+ const u = K(e.price_discounted);
1391
+ u !== void 0 && (i.price_discounted = u);
1392
+ const l = K(e.price);
1393
+ l !== void 0 && (i.price = l);
1394
+ const f = K(e.rating);
1395
+ f !== void 0 && (i.rating = f);
1396
+ const h = K(e.review_count) ?? K(e.reviewCount);
1397
+ h !== void 0 && (i.review_count = h);
1398
+ const p = y(e.cart_code, e.cartCode);
1399
+ return p && (i.cart_code = p), typeof e.in_stock == "boolean" && (i.in_stock = e.in_stock), typeof e.inStock == "boolean" && (i.in_stock = e.inStock), j(i);
1400
+ }
1401
+ function D(e, t) {
1402
+ const n = F(e);
1403
+ if (!n) return null;
1404
+ const o = n.type;
1405
+ if (typeof o != "string" || o.length === 0) return null;
1406
+ const r = {
1407
+ title: t || o,
1408
+ type: o
1409
+ };
1410
+ return n.payload !== void 0 && (r.payload = n.payload), r;
1411
+ }
1412
+ function F(e) {
1413
+ return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1414
+ }
1415
+ function y(...e) {
1416
+ for (const t of e)
1417
+ if (typeof t == "string") {
1418
+ const n = t.trim();
1419
+ if (n.length > 0) return n;
1420
+ }
1421
+ }
1422
+ function Un(e) {
1423
+ return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.length > 0) : [];
1424
+ }
1425
+ function K(e) {
1426
+ if (typeof e == "number" && Number.isFinite(e)) return e;
1427
+ if (typeof e == "string") {
1428
+ let t;
1429
+ e.includes(".") && e.includes(",") ? t = e.replace(/\./g, "").replace(",", ".") : t = e.replace(",", ".");
1430
+ const n = Number(t);
1431
+ if (Number.isFinite(n)) return n;
1432
+ }
1433
+ }
1434
+ function it(e) {
1435
+ return e != null;
1436
+ }
1437
+ function j(e) {
1438
+ const t = e.price_discounted != null && e.price_discounted > 0 ? e.price_discounted : e.price, n = e.price_discounted != null && e.price_discounted > 0 && e.price != null ? e.price : void 0;
1439
+ let o;
1440
+ n != null && t != null && n > 0 && (o = Math.round((n - t) / n * 100));
1441
+ const r = y(e.brand), i = y(e.name) ?? e.sku, s = r && !i.toLowerCase().startsWith(r.toLowerCase()) ? `${r} ${i}` : i, a = {
1442
+ sku: e.sku,
1443
+ name: s,
1444
+ url: y(e.url) ?? ""
1445
+ }, c = e.images?.[0];
1446
+ return c && (a.imageUrl = c), e.images && e.images.length > 1 && (a.images = e.images), t != null && (a.price = String(t)), n != null && (a.originalPrice = String(n)), o !== void 0 && (a.discountPercent = o), r !== void 0 && (a.brand = r), e.rating !== void 0 && (a.rating = e.rating), e.review_count !== void 0 && (a.reviewCount = e.review_count), e.cart_code !== void 0 && (a.cartCode = e.cart_code), e.in_stock !== void 0 && (a.inStock = e.in_stock), e.variants && e.variants.length > 0 && (a.variants = e.variants), e.discount_reason !== void 0 && (a.discountReason = e.discount_reason), e.promotions && e.promotions.length > 0 && (a.promotions = e.promotions), a;
1447
+ }
1448
+ function oc(e) {
1449
+ return e.results.map(j);
1450
+ }
1451
+ function rc(e) {
1452
+ return e.product_groupings.map((t) => {
1453
+ const n = {
1454
+ name: t.name,
1455
+ products: (t.group_products ?? []).map(j)
1456
+ };
1457
+ return t.highlight !== void 0 && (n.highlight = t.highlight), n;
1458
+ });
1459
+ }
1460
+ const Mn = {
1461
+ process_action: "/process_action",
1462
+ launcher_action: "/launcher_action",
1463
+ similar_products: "/similar_products",
1464
+ product_groupings: "/product_groupings",
1465
+ proactive_action: "/proactive_action"
1466
+ }, Fn = {
1467
+ process_action: "/message",
1468
+ launcher_action: "/message"
1469
+ };
1470
+ function Jn(e) {
1471
+ if (e === void 0)
1472
+ throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");
1473
+ const t = e.trim();
1474
+ return t === "" ? "" : t.replace(/\/+$/, "");
1475
+ }
1476
+ function ic(e, t) {
1477
+ const n = Jn(t?.middlewareUrl);
1478
+ if (t.backendType === "acap") {
1479
+ const o = t.accountId ?? "", r = Fn[e];
1480
+ if (r)
1481
+ return `${n}/api/chat/${o}${r}`;
1482
+ }
1483
+ return `${n}/chat${Mn[e]}`;
1484
+ }
1485
+ function xn() {
1486
+ return typeof window < "u" && Array.isArray(window.dataLayer);
1487
+ }
1488
+ function S(e, t) {
1489
+ const n = {
1490
+ event: e,
1491
+ ...t
1492
+ };
1493
+ xn() && window.dataLayer.push(n);
1494
+ }
1495
+ function qn(e) {
1496
+ S("gengage-on-init", { gengage_widget: e });
1497
+ }
1498
+ function Pe(e) {
1499
+ S("gengage-show", { gengage_widget: e });
1500
+ }
1501
+ function Vn(e) {
1502
+ S("gengage-hide", { gengage_widget: e });
1503
+ }
1504
+ function Bn(e, t) {
1505
+ S("gengage-suggested-question", {
1506
+ gengage_question_title: e,
1507
+ gengage_action_type: t
1508
+ });
1509
+ }
1510
+ function sc(e) {
1511
+ S("gengage-find-similars", { gengage_sku: e });
1512
+ }
1513
+ function ac(e) {
1514
+ S("gengage-compare-preselection", { gengage_sku: e });
1515
+ }
1516
+ function cc(e) {
1517
+ S("gengage-compare-selected", {
1518
+ gengage_skus: e,
1519
+ gengage_product_count: e.length
1520
+ });
1521
+ }
1522
+ function uc() {
1523
+ S("gengage-compare-clear");
1524
+ }
1525
+ function dc(e) {
1526
+ S("gengage-compare-received", {
1527
+ gengage_product_count: e
1528
+ });
1529
+ }
1530
+ function lc(e) {
1531
+ S("gengage-like-product", { gengage_sku: e });
1532
+ }
1533
+ function fc() {
1534
+ S("gengage-like-list");
1535
+ }
1536
+ function pc(e, t) {
1537
+ S("gengage-search", {
1538
+ gengage_search_query: e,
1539
+ gengage_result_count: t
1540
+ });
1541
+ }
1542
+ function Gn(e, t) {
1543
+ S("gengage-product-detail", {
1544
+ gengage_sku: e,
1545
+ gengage_product_name: t
1546
+ });
1547
+ }
1548
+ function Ae(e, t) {
1549
+ S("gengage-cart-add", {
1550
+ gengage_sku: e,
1551
+ gengage_quantity: t
1552
+ });
1553
+ }
1554
+ function gc() {
1555
+ S("gengage-message-sent");
1556
+ }
1557
+ function hc() {
1558
+ S("gengage-message-received");
1559
+ }
1560
+ function mc() {
1561
+ S("gengage-conversation-start");
1562
+ }
1563
+ function Wn() {
1564
+ S("gengage-voice-input");
1565
+ }
1566
+ function Hn(e, t) {
1567
+ S("gengage-error", { gengage_widget: e, gengage_error: t });
1568
+ }
1569
+ let Y = null;
1570
+ function _c() {
1571
+ if (typeof window > "u") return () => {
1572
+ };
1573
+ if (Y) return Y;
1574
+ const e = [];
1575
+ function t(n, o) {
1576
+ const r = (i) => o(i.detail);
1577
+ window.addEventListener(n, r), e.push(() => window.removeEventListener(n, r));
1578
+ }
1579
+ return t("gengage:chat:open", () => Pe("chat")), t("gengage:chat:close", () => Vn("chat")), t("gengage:chat:ready", () => qn("chat")), t("gengage:chat:add-to-cart", ({ sku: n, quantity: o }) => {
1580
+ Ae(n, o);
1581
+ }), t("gengage:similar:add-to-cart", ({ sku: n, quantity: o }) => {
1582
+ Ae(n, o);
1583
+ }), t("gengage:similar:product-click", ({ sku: n }) => {
1584
+ Gn(n);
1585
+ }), t("gengage:qna:action", ({ title: n, type: o }) => {
1586
+ Bn(n, o);
1587
+ }), t("gengage:chat:voice", () => Wn()), t("gengage:qna:open-chat", () => Pe("chat")), t("gengage:global:error", ({ source: n, message: o }) => {
1588
+ Hn(n, o);
1589
+ }), Y = () => {
1590
+ for (const n of e) n();
1591
+ e.length = 0, Y = null;
1592
+ }, Y;
1593
+ }
1594
+ function d(e, t, n) {
1595
+ function o(a, c) {
1596
+ if (a._zod || Object.defineProperty(a, "_zod", {
1597
+ value: {
1598
+ def: c,
1599
+ constr: s,
1600
+ traits: /* @__PURE__ */ new Set()
1601
+ },
1602
+ enumerable: !1
1603
+ }), a._zod.traits.has(e))
1604
+ return;
1605
+ a._zod.traits.add(e), t(a, c);
1606
+ const u = s.prototype, l = Object.keys(u);
1607
+ for (let f = 0; f < l.length; f++) {
1608
+ const h = l[f];
1609
+ h in a || (a[h] = u[h].bind(a));
1610
+ }
1611
+ }
1612
+ const r = n?.Parent ?? Object;
1613
+ class i extends r {
1614
+ }
1615
+ Object.defineProperty(i, "name", { value: e });
1616
+ function s(a) {
1617
+ var c;
1618
+ const u = n?.Parent ? new i() : this;
1619
+ o(u, a), (c = u._zod).deferred ?? (c.deferred = []);
1620
+ for (const l of u._zod.deferred)
1621
+ l();
1622
+ return u;
1623
+ }
1624
+ return Object.defineProperty(s, "init", { value: o }), Object.defineProperty(s, Symbol.hasInstance, {
1625
+ value: (a) => n?.Parent && a instanceof n.Parent ? !0 : a?._zod?.traits?.has(e)
1626
+ }), Object.defineProperty(s, "name", { value: e }), s;
1627
+ }
1628
+ class V extends Error {
1629
+ constructor() {
1630
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
1631
+ }
1632
+ }
1633
+ class st extends Error {
1634
+ constructor(t) {
1635
+ super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
1636
+ }
1637
+ }
1638
+ const at = {};
1639
+ function C(e) {
1640
+ return at;
1641
+ }
1642
+ function ct(e) {
1643
+ const t = Object.values(e).filter((o) => typeof o == "number");
1644
+ return Object.entries(e).filter(([o, r]) => t.indexOf(+o) === -1).map(([o, r]) => r);
1645
+ }
1646
+ function ge(e, t) {
1647
+ return typeof t == "bigint" ? t.toString() : t;
1648
+ }
1649
+ function ve(e) {
1650
+ return {
1651
+ get value() {
1652
+ {
1653
+ const t = e();
1654
+ return Object.defineProperty(this, "value", { value: t }), t;
1655
+ }
1656
+ }
1657
+ };
1658
+ }
1659
+ function we(e) {
1660
+ return e == null;
1661
+ }
1662
+ function be(e) {
1663
+ const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
1664
+ return e.slice(t, n);
1665
+ }
1666
+ function Kn(e, t) {
1667
+ const n = (e.toString().split(".")[1] || "").length, o = t.toString();
1668
+ let r = (o.split(".")[1] || "").length;
1669
+ if (r === 0 && /\d?e-\d?/.test(o)) {
1670
+ const c = o.match(/\d?e-(\d?)/);
1671
+ c?.[1] && (r = Number.parseInt(c[1]));
1672
+ }
1673
+ const i = n > r ? n : r, s = Number.parseInt(e.toFixed(i).replace(".", "")), a = Number.parseInt(t.toFixed(i).replace(".", ""));
1674
+ return s % a / 10 ** i;
1675
+ }
1676
+ const Ne = /* @__PURE__ */ Symbol("evaluating");
1677
+ function _(e, t, n) {
1678
+ let o;
1679
+ Object.defineProperty(e, t, {
1680
+ get() {
1681
+ if (o !== Ne)
1682
+ return o === void 0 && (o = Ne, o = n()), o;
1683
+ },
1684
+ set(r) {
1685
+ Object.defineProperty(e, t, {
1686
+ value: r
1687
+ // configurable: true,
1688
+ });
1689
+ },
1690
+ configurable: !0
1691
+ });
1692
+ }
1693
+ function J(e, t, n) {
1694
+ Object.defineProperty(e, t, {
1695
+ value: n,
1696
+ writable: !0,
1697
+ enumerable: !0,
1698
+ configurable: !0
1699
+ });
1700
+ }
1701
+ function L(...e) {
1702
+ const t = {};
1703
+ for (const n of e) {
1704
+ const o = Object.getOwnPropertyDescriptors(n);
1705
+ Object.assign(t, o);
1706
+ }
1707
+ return Object.defineProperties({}, t);
1708
+ }
1709
+ function Ce(e) {
1710
+ return JSON.stringify(e);
1711
+ }
1712
+ function Yn(e) {
1713
+ return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1714
+ }
1715
+ const ut = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
1716
+ };
1717
+ function re(e) {
1718
+ return typeof e == "object" && e !== null && !Array.isArray(e);
1719
+ }
1720
+ const Qn = ve(() => {
1721
+ if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
1722
+ return !1;
1723
+ try {
1724
+ const e = Function;
1725
+ return new e(""), !0;
1726
+ } catch {
1727
+ return !1;
1728
+ }
1729
+ });
1730
+ function B(e) {
1731
+ if (re(e) === !1)
1732
+ return !1;
1733
+ const t = e.constructor;
1734
+ if (t === void 0 || typeof t != "function")
1735
+ return !0;
1736
+ const n = t.prototype;
1737
+ return !(re(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
1738
+ }
1739
+ function dt(e) {
1740
+ return B(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
1741
+ }
1742
+ const Xn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
1743
+ function G(e) {
1744
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1745
+ }
1746
+ function U(e, t, n) {
1747
+ const o = new e._zod.constr(t ?? e._zod.def);
1748
+ return (!t || n?.parent) && (o._zod.parent = e), o;
1749
+ }
1750
+ function g(e) {
1751
+ const t = e;
1752
+ if (!t)
1753
+ return {};
1754
+ if (typeof t == "string")
1755
+ return { error: () => t };
1756
+ if (t?.message !== void 0) {
1757
+ if (t?.error !== void 0)
1758
+ throw new Error("Cannot specify both `message` and `error` params");
1759
+ t.error = t.message;
1760
+ }
1761
+ return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
1762
+ }
1763
+ function eo(e) {
1764
+ return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
1765
+ }
1766
+ const to = {
1767
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
1768
+ int32: [-2147483648, 2147483647],
1769
+ uint32: [0, 4294967295],
1770
+ float32: [-34028234663852886e22, 34028234663852886e22],
1771
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
1772
+ };
1773
+ function no(e, t) {
1774
+ const n = e._zod.def, o = n.checks;
1775
+ if (o && o.length > 0)
1776
+ throw new Error(".pick() cannot be used on object schemas containing refinements");
1777
+ const i = L(e._zod.def, {
1778
+ get shape() {
1779
+ const s = {};
1780
+ for (const a in t) {
1781
+ if (!(a in n.shape))
1782
+ throw new Error(`Unrecognized key: "${a}"`);
1783
+ t[a] && (s[a] = n.shape[a]);
1784
+ }
1785
+ return J(this, "shape", s), s;
1786
+ },
1787
+ checks: []
1788
+ });
1789
+ return U(e, i);
1790
+ }
1791
+ function oo(e, t) {
1792
+ const n = e._zod.def, o = n.checks;
1793
+ if (o && o.length > 0)
1794
+ throw new Error(".omit() cannot be used on object schemas containing refinements");
1795
+ const i = L(e._zod.def, {
1796
+ get shape() {
1797
+ const s = { ...e._zod.def.shape };
1798
+ for (const a in t) {
1799
+ if (!(a in n.shape))
1800
+ throw new Error(`Unrecognized key: "${a}"`);
1801
+ t[a] && delete s[a];
1802
+ }
1803
+ return J(this, "shape", s), s;
1804
+ },
1805
+ checks: []
1806
+ });
1807
+ return U(e, i);
1808
+ }
1809
+ function ro(e, t) {
1810
+ if (!B(t))
1811
+ throw new Error("Invalid input to extend: expected a plain object");
1812
+ const n = e._zod.def.checks;
1813
+ if (n && n.length > 0) {
1814
+ const i = e._zod.def.shape;
1815
+ for (const s in t)
1816
+ if (Object.getOwnPropertyDescriptor(i, s) !== void 0)
1817
+ throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
1818
+ }
1819
+ const r = L(e._zod.def, {
1820
+ get shape() {
1821
+ const i = { ...e._zod.def.shape, ...t };
1822
+ return J(this, "shape", i), i;
1823
+ }
1824
+ });
1825
+ return U(e, r);
1826
+ }
1827
+ function io(e, t) {
1828
+ if (!B(t))
1829
+ throw new Error("Invalid input to safeExtend: expected a plain object");
1830
+ const n = L(e._zod.def, {
1831
+ get shape() {
1832
+ const o = { ...e._zod.def.shape, ...t };
1833
+ return J(this, "shape", o), o;
1834
+ }
1835
+ });
1836
+ return U(e, n);
1837
+ }
1838
+ function so(e, t) {
1839
+ const n = L(e._zod.def, {
1840
+ get shape() {
1841
+ const o = { ...e._zod.def.shape, ...t._zod.def.shape };
1842
+ return J(this, "shape", o), o;
1843
+ },
1844
+ get catchall() {
1845
+ return t._zod.def.catchall;
1846
+ },
1847
+ checks: []
1848
+ // delete existing checks
1849
+ });
1850
+ return U(e, n);
1851
+ }
1852
+ function ao(e, t, n) {
1853
+ const r = t._zod.def.checks;
1854
+ if (r && r.length > 0)
1855
+ throw new Error(".partial() cannot be used on object schemas containing refinements");
1856
+ const s = L(t._zod.def, {
1857
+ get shape() {
1858
+ const a = t._zod.def.shape, c = { ...a };
1859
+ if (n)
1860
+ for (const u in n) {
1861
+ if (!(u in a))
1862
+ throw new Error(`Unrecognized key: "${u}"`);
1863
+ n[u] && (c[u] = e ? new e({
1864
+ type: "optional",
1865
+ innerType: a[u]
1866
+ }) : a[u]);
1867
+ }
1868
+ else
1869
+ for (const u in a)
1870
+ c[u] = e ? new e({
1871
+ type: "optional",
1872
+ innerType: a[u]
1873
+ }) : a[u];
1874
+ return J(this, "shape", c), c;
1875
+ },
1876
+ checks: []
1877
+ });
1878
+ return U(t, s);
1879
+ }
1880
+ function co(e, t, n) {
1881
+ const o = L(t._zod.def, {
1882
+ get shape() {
1883
+ const r = t._zod.def.shape, i = { ...r };
1884
+ if (n)
1885
+ for (const s in n) {
1886
+ if (!(s in i))
1887
+ throw new Error(`Unrecognized key: "${s}"`);
1888
+ n[s] && (i[s] = new e({
1889
+ type: "nonoptional",
1890
+ innerType: r[s]
1891
+ }));
1892
+ }
1893
+ else
1894
+ for (const s in r)
1895
+ i[s] = new e({
1896
+ type: "nonoptional",
1897
+ innerType: r[s]
1898
+ });
1899
+ return J(this, "shape", i), i;
1900
+ }
1901
+ });
1902
+ return U(t, o);
1903
+ }
1904
+ function x(e, t = 0) {
1905
+ if (e.aborted === !0)
1906
+ return !0;
1907
+ for (let n = t; n < e.issues.length; n++)
1908
+ if (e.issues[n]?.continue !== !0)
1909
+ return !0;
1910
+ return !1;
1911
+ }
1912
+ function q(e, t) {
1913
+ return t.map((n) => {
1914
+ var o;
1915
+ return (o = n).path ?? (o.path = []), n.path.unshift(e), n;
1916
+ });
1917
+ }
1918
+ function te(e) {
1919
+ return typeof e == "string" ? e : e?.message;
1920
+ }
1921
+ function R(e, t, n) {
1922
+ const o = { ...e, path: e.path ?? [] };
1923
+ if (!e.message) {
1924
+ const r = te(e.inst?._zod.def?.error?.(e)) ?? te(t?.error?.(e)) ?? te(n.customError?.(e)) ?? te(n.localeError?.(e)) ?? "Invalid input";
1925
+ o.message = r;
1926
+ }
1927
+ return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
1928
+ }
1929
+ function ke(e) {
1930
+ return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
1931
+ }
1932
+ function ee(...e) {
1933
+ const [t, n, o] = e;
1934
+ return typeof t == "string" ? {
1935
+ message: t,
1936
+ code: "custom",
1937
+ input: n,
1938
+ inst: o
1939
+ } : { ...t };
1940
+ }
1941
+ const lt = (e, t) => {
1942
+ e.name = "$ZodError", Object.defineProperty(e, "_zod", {
1943
+ value: e._zod,
1944
+ enumerable: !1
1945
+ }), Object.defineProperty(e, "issues", {
1946
+ value: t,
1947
+ enumerable: !1
1948
+ }), e.message = JSON.stringify(t, ge, 2), Object.defineProperty(e, "toString", {
1949
+ value: () => e.message,
1950
+ enumerable: !1
1951
+ });
1952
+ }, ft = d("$ZodError", lt), pt = d("$ZodError", lt, { Parent: Error });
1953
+ function uo(e, t = (n) => n.message) {
1954
+ const n = {}, o = [];
1955
+ for (const r of e.issues)
1956
+ r.path.length > 0 ? (n[r.path[0]] = n[r.path[0]] || [], n[r.path[0]].push(t(r))) : o.push(t(r));
1957
+ return { formErrors: o, fieldErrors: n };
1958
+ }
1959
+ function lo(e, t = (n) => n.message) {
1960
+ const n = { _errors: [] }, o = (r) => {
1961
+ for (const i of r.issues)
1962
+ if (i.code === "invalid_union" && i.errors.length)
1963
+ i.errors.map((s) => o({ issues: s }));
1964
+ else if (i.code === "invalid_key")
1965
+ o({ issues: i.issues });
1966
+ else if (i.code === "invalid_element")
1967
+ o({ issues: i.issues });
1968
+ else if (i.path.length === 0)
1969
+ n._errors.push(t(i));
1970
+ else {
1971
+ let s = n, a = 0;
1972
+ for (; a < i.path.length; ) {
1973
+ const c = i.path[a];
1974
+ a === i.path.length - 1 ? (s[c] = s[c] || { _errors: [] }, s[c]._errors.push(t(i))) : s[c] = s[c] || { _errors: [] }, s = s[c], a++;
1975
+ }
1976
+ }
1977
+ };
1978
+ return o(e), n;
1979
+ }
1980
+ const ze = (e) => (t, n, o, r) => {
1981
+ const i = o ? Object.assign(o, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
1982
+ if (s instanceof Promise)
1983
+ throw new V();
1984
+ if (s.issues.length) {
1985
+ const a = new (r?.Err ?? e)(s.issues.map((c) => R(c, i, C())));
1986
+ throw ut(a, r?.callee), a;
1987
+ }
1988
+ return s.value;
1989
+ }, $e = (e) => async (t, n, o, r) => {
1990
+ const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
1991
+ let s = t._zod.run({ value: n, issues: [] }, i);
1992
+ if (s instanceof Promise && (s = await s), s.issues.length) {
1993
+ const a = new (r?.Err ?? e)(s.issues.map((c) => R(c, i, C())));
1994
+ throw ut(a, r?.callee), a;
1995
+ }
1996
+ return s.value;
1997
+ }, ce = (e) => (t, n, o) => {
1998
+ const r = o ? { ...o, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, r);
1999
+ if (i instanceof Promise)
2000
+ throw new V();
2001
+ return i.issues.length ? {
2002
+ success: !1,
2003
+ error: new (e ?? ft)(i.issues.map((s) => R(s, r, C())))
2004
+ } : { success: !0, data: i.value };
2005
+ }, fo = /* @__PURE__ */ ce(pt), ue = (e) => async (t, n, o) => {
2006
+ const r = o ? Object.assign(o, { async: !0 }) : { async: !0 };
2007
+ let i = t._zod.run({ value: n, issues: [] }, r);
2008
+ return i instanceof Promise && (i = await i), i.issues.length ? {
2009
+ success: !1,
2010
+ error: new e(i.issues.map((s) => R(s, r, C())))
2011
+ } : { success: !0, data: i.value };
2012
+ }, po = /* @__PURE__ */ ue(pt), go = (e) => (t, n, o) => {
2013
+ const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
2014
+ return ze(e)(t, n, r);
2015
+ }, ho = (e) => (t, n, o) => ze(e)(t, n, o), mo = (e) => async (t, n, o) => {
2016
+ const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
2017
+ return $e(e)(t, n, r);
2018
+ }, _o = (e) => async (t, n, o) => $e(e)(t, n, o), yo = (e) => (t, n, o) => {
2019
+ const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
2020
+ return ce(e)(t, n, r);
2021
+ }, vo = (e) => (t, n, o) => ce(e)(t, n, o), wo = (e) => async (t, n, o) => {
2022
+ const r = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
2023
+ return ue(e)(t, n, r);
2024
+ }, bo = (e) => async (t, n, o) => ue(e)(t, n, o), ko = /^[cC][^\s-]{8,}$/, zo = /^[0-9a-z]+$/, $o = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, So = /^[0-9a-vA-V]{20}$/, Eo = /^[A-Za-z0-9]{27}$/, Zo = /^[a-zA-Z0-9_-]{21}$/, Io = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, To = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Re = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Oo = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Po = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2025
+ function Ao() {
2026
+ return new RegExp(Po, "u");
2027
+ }
2028
+ const No = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Co = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, Ro = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, Do = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, jo = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, gt = /^[A-Za-z0-9_-]*$/, Lo = /^\+[1-9]\d{6,14}$/, ht = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", Uo = /* @__PURE__ */ new RegExp(`^${ht}$`);
2029
+ function mt(e) {
2030
+ const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
2031
+ return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
2032
+ }
2033
+ function Mo(e) {
2034
+ return new RegExp(`^${mt(e)}$`);
2035
+ }
2036
+ function Fo(e) {
2037
+ const t = mt({ precision: e.precision }), n = ["Z"];
2038
+ e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
2039
+ const o = `${t}(?:${n.join("|")})`;
2040
+ return new RegExp(`^${ht}T(?:${o})$`);
2041
+ }
2042
+ const Jo = (e) => {
2043
+ const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
2044
+ return new RegExp(`^${t}$`);
2045
+ }, xo = /^-?\d+$/, _t = /^-?\d+(?:\.\d+)?$/, qo = /^(?:true|false)$/i, Vo = /^[^A-Z]*$/, Bo = /^[^a-z]*$/, T = /* @__PURE__ */ d("$ZodCheck", (e, t) => {
2046
+ var n;
2047
+ e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
2048
+ }), yt = {
2049
+ number: "number",
2050
+ bigint: "bigint",
2051
+ object: "date"
2052
+ }, vt = /* @__PURE__ */ d("$ZodCheckLessThan", (e, t) => {
2053
+ T.init(e, t);
2054
+ const n = yt[typeof t.value];
2055
+ e._zod.onattach.push((o) => {
2056
+ const r = o._zod.bag, i = (t.inclusive ? r.maximum : r.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
2057
+ t.value < i && (t.inclusive ? r.maximum = t.value : r.exclusiveMaximum = t.value);
2058
+ }), e._zod.check = (o) => {
2059
+ (t.inclusive ? o.value <= t.value : o.value < t.value) || o.issues.push({
2060
+ origin: n,
2061
+ code: "too_big",
2062
+ maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
2063
+ input: o.value,
2064
+ inclusive: t.inclusive,
2065
+ inst: e,
2066
+ continue: !t.abort
2067
+ });
2068
+ };
2069
+ }), wt = /* @__PURE__ */ d("$ZodCheckGreaterThan", (e, t) => {
2070
+ T.init(e, t);
2071
+ const n = yt[typeof t.value];
2072
+ e._zod.onattach.push((o) => {
2073
+ const r = o._zod.bag, i = (t.inclusive ? r.minimum : r.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
2074
+ t.value > i && (t.inclusive ? r.minimum = t.value : r.exclusiveMinimum = t.value);
2075
+ }), e._zod.check = (o) => {
2076
+ (t.inclusive ? o.value >= t.value : o.value > t.value) || o.issues.push({
2077
+ origin: n,
2078
+ code: "too_small",
2079
+ minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
2080
+ input: o.value,
2081
+ inclusive: t.inclusive,
2082
+ inst: e,
2083
+ continue: !t.abort
2084
+ });
2085
+ };
2086
+ }), Go = /* @__PURE__ */ d("$ZodCheckMultipleOf", (e, t) => {
2087
+ T.init(e, t), e._zod.onattach.push((n) => {
2088
+ var o;
2089
+ (o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
2090
+ }), e._zod.check = (n) => {
2091
+ if (typeof n.value != typeof t.value)
2092
+ throw new Error("Cannot mix number and bigint in multiple_of check.");
2093
+ (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Kn(n.value, t.value) === 0) || n.issues.push({
2094
+ origin: typeof n.value,
2095
+ code: "not_multiple_of",
2096
+ divisor: t.value,
2097
+ input: n.value,
2098
+ inst: e,
2099
+ continue: !t.abort
2100
+ });
2101
+ };
2102
+ }), Wo = /* @__PURE__ */ d("$ZodCheckNumberFormat", (e, t) => {
2103
+ T.init(e, t), t.format = t.format || "float64";
2104
+ const n = t.format?.includes("int"), o = n ? "int" : "number", [r, i] = to[t.format];
2105
+ e._zod.onattach.push((s) => {
2106
+ const a = s._zod.bag;
2107
+ a.format = t.format, a.minimum = r, a.maximum = i, n && (a.pattern = xo);
2108
+ }), e._zod.check = (s) => {
2109
+ const a = s.value;
2110
+ if (n) {
2111
+ if (!Number.isInteger(a)) {
2112
+ s.issues.push({
2113
+ expected: o,
2114
+ format: t.format,
2115
+ code: "invalid_type",
2116
+ continue: !1,
2117
+ input: a,
2118
+ inst: e
2119
+ });
2120
+ return;
2121
+ }
2122
+ if (!Number.isSafeInteger(a)) {
2123
+ a > 0 ? s.issues.push({
2124
+ input: a,
2125
+ code: "too_big",
2126
+ maximum: Number.MAX_SAFE_INTEGER,
2127
+ note: "Integers must be within the safe integer range.",
2128
+ inst: e,
2129
+ origin: o,
2130
+ inclusive: !0,
2131
+ continue: !t.abort
2132
+ }) : s.issues.push({
2133
+ input: a,
2134
+ code: "too_small",
2135
+ minimum: Number.MIN_SAFE_INTEGER,
2136
+ note: "Integers must be within the safe integer range.",
2137
+ inst: e,
2138
+ origin: o,
2139
+ inclusive: !0,
2140
+ continue: !t.abort
2141
+ });
2142
+ return;
2143
+ }
2144
+ }
2145
+ a < r && s.issues.push({
2146
+ origin: "number",
2147
+ input: a,
2148
+ code: "too_small",
2149
+ minimum: r,
2150
+ inclusive: !0,
2151
+ inst: e,
2152
+ continue: !t.abort
2153
+ }), a > i && s.issues.push({
2154
+ origin: "number",
2155
+ input: a,
2156
+ code: "too_big",
2157
+ maximum: i,
2158
+ inclusive: !0,
2159
+ inst: e,
2160
+ continue: !t.abort
2161
+ });
2162
+ };
2163
+ }), Ho = /* @__PURE__ */ d("$ZodCheckMaxLength", (e, t) => {
2164
+ var n;
2165
+ T.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
2166
+ const r = o.value;
2167
+ return !we(r) && r.length !== void 0;
2168
+ }), e._zod.onattach.push((o) => {
2169
+ const r = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
2170
+ t.maximum < r && (o._zod.bag.maximum = t.maximum);
2171
+ }), e._zod.check = (o) => {
2172
+ const r = o.value;
2173
+ if (r.length <= t.maximum)
2174
+ return;
2175
+ const s = ke(r);
2176
+ o.issues.push({
2177
+ origin: s,
2178
+ code: "too_big",
2179
+ maximum: t.maximum,
2180
+ inclusive: !0,
2181
+ input: r,
2182
+ inst: e,
2183
+ continue: !t.abort
2184
+ });
2185
+ };
2186
+ }), Ko = /* @__PURE__ */ d("$ZodCheckMinLength", (e, t) => {
2187
+ var n;
2188
+ T.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
2189
+ const r = o.value;
2190
+ return !we(r) && r.length !== void 0;
2191
+ }), e._zod.onattach.push((o) => {
2192
+ const r = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
2193
+ t.minimum > r && (o._zod.bag.minimum = t.minimum);
2194
+ }), e._zod.check = (o) => {
2195
+ const r = o.value;
2196
+ if (r.length >= t.minimum)
2197
+ return;
2198
+ const s = ke(r);
2199
+ o.issues.push({
2200
+ origin: s,
2201
+ code: "too_small",
2202
+ minimum: t.minimum,
2203
+ inclusive: !0,
2204
+ input: r,
2205
+ inst: e,
2206
+ continue: !t.abort
2207
+ });
2208
+ };
2209
+ }), Yo = /* @__PURE__ */ d("$ZodCheckLengthEquals", (e, t) => {
2210
+ var n;
2211
+ T.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
2212
+ const r = o.value;
2213
+ return !we(r) && r.length !== void 0;
2214
+ }), e._zod.onattach.push((o) => {
2215
+ const r = o._zod.bag;
2216
+ r.minimum = t.length, r.maximum = t.length, r.length = t.length;
2217
+ }), e._zod.check = (o) => {
2218
+ const r = o.value, i = r.length;
2219
+ if (i === t.length)
2220
+ return;
2221
+ const s = ke(r), a = i > t.length;
2222
+ o.issues.push({
2223
+ origin: s,
2224
+ ...a ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
2225
+ inclusive: !0,
2226
+ exact: !0,
2227
+ input: o.value,
2228
+ inst: e,
2229
+ continue: !t.abort
2230
+ });
2231
+ };
2232
+ }), de = /* @__PURE__ */ d("$ZodCheckStringFormat", (e, t) => {
2233
+ var n, o;
2234
+ T.init(e, t), e._zod.onattach.push((r) => {
2235
+ const i = r._zod.bag;
2236
+ i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
2237
+ }), t.pattern ? (n = e._zod).check ?? (n.check = (r) => {
2238
+ t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({
2239
+ origin: "string",
2240
+ code: "invalid_format",
2241
+ format: t.format,
2242
+ input: r.value,
2243
+ ...t.pattern ? { pattern: t.pattern.toString() } : {},
2244
+ inst: e,
2245
+ continue: !t.abort
2246
+ });
2247
+ }) : (o = e._zod).check ?? (o.check = () => {
2248
+ });
2249
+ }), Qo = /* @__PURE__ */ d("$ZodCheckRegex", (e, t) => {
2250
+ de.init(e, t), e._zod.check = (n) => {
2251
+ t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
2252
+ origin: "string",
2253
+ code: "invalid_format",
2254
+ format: "regex",
2255
+ input: n.value,
2256
+ pattern: t.pattern.toString(),
2257
+ inst: e,
2258
+ continue: !t.abort
2259
+ });
2260
+ };
2261
+ }), Xo = /* @__PURE__ */ d("$ZodCheckLowerCase", (e, t) => {
2262
+ t.pattern ?? (t.pattern = Vo), de.init(e, t);
2263
+ }), er = /* @__PURE__ */ d("$ZodCheckUpperCase", (e, t) => {
2264
+ t.pattern ?? (t.pattern = Bo), de.init(e, t);
2265
+ }), tr = /* @__PURE__ */ d("$ZodCheckIncludes", (e, t) => {
2266
+ T.init(e, t);
2267
+ const n = G(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
2268
+ t.pattern = o, e._zod.onattach.push((r) => {
2269
+ const i = r._zod.bag;
2270
+ i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(o);
2271
+ }), e._zod.check = (r) => {
2272
+ r.value.includes(t.includes, t.position) || r.issues.push({
2273
+ origin: "string",
2274
+ code: "invalid_format",
2275
+ format: "includes",
2276
+ includes: t.includes,
2277
+ input: r.value,
2278
+ inst: e,
2279
+ continue: !t.abort
2280
+ });
2281
+ };
2282
+ }), nr = /* @__PURE__ */ d("$ZodCheckStartsWith", (e, t) => {
2283
+ T.init(e, t);
2284
+ const n = new RegExp(`^${G(t.prefix)}.*`);
2285
+ t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
2286
+ const r = o._zod.bag;
2287
+ r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
2288
+ }), e._zod.check = (o) => {
2289
+ o.value.startsWith(t.prefix) || o.issues.push({
2290
+ origin: "string",
2291
+ code: "invalid_format",
2292
+ format: "starts_with",
2293
+ prefix: t.prefix,
2294
+ input: o.value,
2295
+ inst: e,
2296
+ continue: !t.abort
2297
+ });
2298
+ };
2299
+ }), or = /* @__PURE__ */ d("$ZodCheckEndsWith", (e, t) => {
2300
+ T.init(e, t);
2301
+ const n = new RegExp(`.*${G(t.suffix)}$`);
2302
+ t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
2303
+ const r = o._zod.bag;
2304
+ r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n);
2305
+ }), e._zod.check = (o) => {
2306
+ o.value.endsWith(t.suffix) || o.issues.push({
2307
+ origin: "string",
2308
+ code: "invalid_format",
2309
+ format: "ends_with",
2310
+ suffix: t.suffix,
2311
+ input: o.value,
2312
+ inst: e,
2313
+ continue: !t.abort
2314
+ });
2315
+ };
2316
+ }), rr = /* @__PURE__ */ d("$ZodCheckOverwrite", (e, t) => {
2317
+ T.init(e, t), e._zod.check = (n) => {
2318
+ n.value = t.tx(n.value);
2319
+ };
2320
+ });
2321
+ class ir {
2322
+ constructor(t = []) {
2323
+ this.content = [], this.indent = 0, this && (this.args = t);
2324
+ }
2325
+ indented(t) {
2326
+ this.indent += 1, t(this), this.indent -= 1;
2327
+ }
2328
+ write(t) {
2329
+ if (typeof t == "function") {
2330
+ t(this, { execution: "sync" }), t(this, { execution: "async" });
2331
+ return;
2332
+ }
2333
+ const o = t.split(`
2334
+ `).filter((s) => s), r = Math.min(...o.map((s) => s.length - s.trimStart().length)), i = o.map((s) => s.slice(r)).map((s) => " ".repeat(this.indent * 2) + s);
2335
+ for (const s of i)
2336
+ this.content.push(s);
2337
+ }
2338
+ compile() {
2339
+ const t = Function, n = this?.args, r = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
2340
+ return new t(...n, r.join(`
2341
+ `));
2342
+ }
2343
+ }
2344
+ const sr = {
2345
+ major: 4,
2346
+ minor: 3,
2347
+ patch: 6
2348
+ }, b = /* @__PURE__ */ d("$ZodType", (e, t) => {
2349
+ var n;
2350
+ e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = sr;
2351
+ const o = [...e._zod.def.checks ?? []];
2352
+ e._zod.traits.has("$ZodCheck") && o.unshift(e);
2353
+ for (const r of o)
2354
+ for (const i of r._zod.onattach)
2355
+ i(e);
2356
+ if (o.length === 0)
2357
+ (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
2358
+ e._zod.run = e._zod.parse;
2359
+ });
2360
+ else {
2361
+ const r = (s, a, c) => {
2362
+ let u = x(s), l;
2363
+ for (const f of a) {
2364
+ if (f._zod.def.when) {
2365
+ if (!f._zod.def.when(s))
2366
+ continue;
2367
+ } else if (u)
2368
+ continue;
2369
+ const h = s.issues.length, p = f._zod.check(s);
2370
+ if (p instanceof Promise && c?.async === !1)
2371
+ throw new V();
2372
+ if (l || p instanceof Promise)
2373
+ l = (l ?? Promise.resolve()).then(async () => {
2374
+ await p, s.issues.length !== h && (u || (u = x(s, h)));
2375
+ });
2376
+ else {
2377
+ if (s.issues.length === h)
2378
+ continue;
2379
+ u || (u = x(s, h));
2380
+ }
2381
+ }
2382
+ return l ? l.then(() => s) : s;
2383
+ }, i = (s, a, c) => {
2384
+ if (x(s))
2385
+ return s.aborted = !0, s;
2386
+ const u = r(a, o, c);
2387
+ if (u instanceof Promise) {
2388
+ if (c.async === !1)
2389
+ throw new V();
2390
+ return u.then((l) => e._zod.parse(l, c));
2391
+ }
2392
+ return e._zod.parse(u, c);
2393
+ };
2394
+ e._zod.run = (s, a) => {
2395
+ if (a.skipChecks)
2396
+ return e._zod.parse(s, a);
2397
+ if (a.direction === "backward") {
2398
+ const u = e._zod.parse({ value: s.value, issues: [] }, { ...a, skipChecks: !0 });
2399
+ return u instanceof Promise ? u.then((l) => i(l, s, a)) : i(u, s, a);
2400
+ }
2401
+ const c = e._zod.parse(s, a);
2402
+ if (c instanceof Promise) {
2403
+ if (a.async === !1)
2404
+ throw new V();
2405
+ return c.then((u) => r(u, o, a));
2406
+ }
2407
+ return r(c, o, a);
2408
+ };
2409
+ }
2410
+ _(e, "~standard", () => ({
2411
+ validate: (r) => {
2412
+ try {
2413
+ const i = fo(e, r);
2414
+ return i.success ? { value: i.data } : { issues: i.error?.issues };
2415
+ } catch {
2416
+ return po(e, r).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
2417
+ }
2418
+ },
2419
+ vendor: "zod",
2420
+ version: 1
2421
+ }));
2422
+ }), Se = /* @__PURE__ */ d("$ZodString", (e, t) => {
2423
+ b.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Jo(e._zod.bag), e._zod.parse = (n, o) => {
2424
+ if (t.coerce)
2425
+ try {
2426
+ n.value = String(n.value);
2427
+ } catch {
2428
+ }
2429
+ return typeof n.value == "string" || n.issues.push({
2430
+ expected: "string",
2431
+ code: "invalid_type",
2432
+ input: n.value,
2433
+ inst: e
2434
+ }), n;
2435
+ };
2436
+ }), w = /* @__PURE__ */ d("$ZodStringFormat", (e, t) => {
2437
+ de.init(e, t), Se.init(e, t);
2438
+ }), ar = /* @__PURE__ */ d("$ZodGUID", (e, t) => {
2439
+ t.pattern ?? (t.pattern = To), w.init(e, t);
2440
+ }), cr = /* @__PURE__ */ d("$ZodUUID", (e, t) => {
2441
+ if (t.version) {
2442
+ const o = {
2443
+ v1: 1,
2444
+ v2: 2,
2445
+ v3: 3,
2446
+ v4: 4,
2447
+ v5: 5,
2448
+ v6: 6,
2449
+ v7: 7,
2450
+ v8: 8
2451
+ }[t.version];
2452
+ if (o === void 0)
2453
+ throw new Error(`Invalid UUID version: "${t.version}"`);
2454
+ t.pattern ?? (t.pattern = Re(o));
2455
+ } else
2456
+ t.pattern ?? (t.pattern = Re());
2457
+ w.init(e, t);
2458
+ }), ur = /* @__PURE__ */ d("$ZodEmail", (e, t) => {
2459
+ t.pattern ?? (t.pattern = Oo), w.init(e, t);
2460
+ }), dr = /* @__PURE__ */ d("$ZodURL", (e, t) => {
2461
+ w.init(e, t), e._zod.check = (n) => {
2462
+ try {
2463
+ const o = n.value.trim(), r = new URL(o);
2464
+ t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(r.hostname) || n.issues.push({
2465
+ code: "invalid_format",
2466
+ format: "url",
2467
+ note: "Invalid hostname",
2468
+ pattern: t.hostname.source,
2469
+ input: n.value,
2470
+ inst: e,
2471
+ continue: !t.abort
2472
+ })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(r.protocol.endsWith(":") ? r.protocol.slice(0, -1) : r.protocol) || n.issues.push({
2473
+ code: "invalid_format",
2474
+ format: "url",
2475
+ note: "Invalid protocol",
2476
+ pattern: t.protocol.source,
2477
+ input: n.value,
2478
+ inst: e,
2479
+ continue: !t.abort
2480
+ })), t.normalize ? n.value = r.href : n.value = o;
2481
+ return;
2482
+ } catch {
2483
+ n.issues.push({
2484
+ code: "invalid_format",
2485
+ format: "url",
2486
+ input: n.value,
2487
+ inst: e,
2488
+ continue: !t.abort
2489
+ });
2490
+ }
2491
+ };
2492
+ }), lr = /* @__PURE__ */ d("$ZodEmoji", (e, t) => {
2493
+ t.pattern ?? (t.pattern = Ao()), w.init(e, t);
2494
+ }), fr = /* @__PURE__ */ d("$ZodNanoID", (e, t) => {
2495
+ t.pattern ?? (t.pattern = Zo), w.init(e, t);
2496
+ }), pr = /* @__PURE__ */ d("$ZodCUID", (e, t) => {
2497
+ t.pattern ?? (t.pattern = ko), w.init(e, t);
2498
+ }), gr = /* @__PURE__ */ d("$ZodCUID2", (e, t) => {
2499
+ t.pattern ?? (t.pattern = zo), w.init(e, t);
2500
+ }), hr = /* @__PURE__ */ d("$ZodULID", (e, t) => {
2501
+ t.pattern ?? (t.pattern = $o), w.init(e, t);
2502
+ }), mr = /* @__PURE__ */ d("$ZodXID", (e, t) => {
2503
+ t.pattern ?? (t.pattern = So), w.init(e, t);
2504
+ }), _r = /* @__PURE__ */ d("$ZodKSUID", (e, t) => {
2505
+ t.pattern ?? (t.pattern = Eo), w.init(e, t);
2506
+ }), yr = /* @__PURE__ */ d("$ZodISODateTime", (e, t) => {
2507
+ t.pattern ?? (t.pattern = Fo(t)), w.init(e, t);
2508
+ }), vr = /* @__PURE__ */ d("$ZodISODate", (e, t) => {
2509
+ t.pattern ?? (t.pattern = Uo), w.init(e, t);
2510
+ }), wr = /* @__PURE__ */ d("$ZodISOTime", (e, t) => {
2511
+ t.pattern ?? (t.pattern = Mo(t)), w.init(e, t);
2512
+ }), br = /* @__PURE__ */ d("$ZodISODuration", (e, t) => {
2513
+ t.pattern ?? (t.pattern = Io), w.init(e, t);
2514
+ }), kr = /* @__PURE__ */ d("$ZodIPv4", (e, t) => {
2515
+ t.pattern ?? (t.pattern = No), w.init(e, t), e._zod.bag.format = "ipv4";
2516
+ }), zr = /* @__PURE__ */ d("$ZodIPv6", (e, t) => {
2517
+ t.pattern ?? (t.pattern = Co), w.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
2518
+ try {
2519
+ new URL(`http://[${n.value}]`);
2520
+ } catch {
2521
+ n.issues.push({
2522
+ code: "invalid_format",
2523
+ format: "ipv6",
2524
+ input: n.value,
2525
+ inst: e,
2526
+ continue: !t.abort
2527
+ });
2528
+ }
2529
+ };
2530
+ }), $r = /* @__PURE__ */ d("$ZodCIDRv4", (e, t) => {
2531
+ t.pattern ?? (t.pattern = Ro), w.init(e, t);
2532
+ }), Sr = /* @__PURE__ */ d("$ZodCIDRv6", (e, t) => {
2533
+ t.pattern ?? (t.pattern = Do), w.init(e, t), e._zod.check = (n) => {
2534
+ const o = n.value.split("/");
2535
+ try {
2536
+ if (o.length !== 2)
2537
+ throw new Error();
2538
+ const [r, i] = o;
2539
+ if (!i)
2540
+ throw new Error();
2541
+ const s = Number(i);
2542
+ if (`${s}` !== i)
2543
+ throw new Error();
2544
+ if (s < 0 || s > 128)
2545
+ throw new Error();
2546
+ new URL(`http://[${r}]`);
2547
+ } catch {
2548
+ n.issues.push({
2549
+ code: "invalid_format",
2550
+ format: "cidrv6",
2551
+ input: n.value,
2552
+ inst: e,
2553
+ continue: !t.abort
2554
+ });
2555
+ }
2556
+ };
2557
+ });
2558
+ function bt(e) {
2559
+ if (e === "")
2560
+ return !0;
2561
+ if (e.length % 4 !== 0)
2562
+ return !1;
2563
+ try {
2564
+ return atob(e), !0;
2565
+ } catch {
2566
+ return !1;
2567
+ }
2568
+ }
2569
+ const Er = /* @__PURE__ */ d("$ZodBase64", (e, t) => {
2570
+ t.pattern ?? (t.pattern = jo), w.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
2571
+ bt(n.value) || n.issues.push({
2572
+ code: "invalid_format",
2573
+ format: "base64",
2574
+ input: n.value,
2575
+ inst: e,
2576
+ continue: !t.abort
2577
+ });
2578
+ };
2579
+ });
2580
+ function Zr(e) {
2581
+ if (!gt.test(e))
2582
+ return !1;
2583
+ const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
2584
+ return bt(n);
2585
+ }
2586
+ const Ir = /* @__PURE__ */ d("$ZodBase64URL", (e, t) => {
2587
+ t.pattern ?? (t.pattern = gt), w.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
2588
+ Zr(n.value) || n.issues.push({
2589
+ code: "invalid_format",
2590
+ format: "base64url",
2591
+ input: n.value,
2592
+ inst: e,
2593
+ continue: !t.abort
2594
+ });
2595
+ };
2596
+ }), Tr = /* @__PURE__ */ d("$ZodE164", (e, t) => {
2597
+ t.pattern ?? (t.pattern = Lo), w.init(e, t);
2598
+ });
2599
+ function Or(e, t = null) {
2600
+ try {
2601
+ const n = e.split(".");
2602
+ if (n.length !== 3)
2603
+ return !1;
2604
+ const [o] = n;
2605
+ if (!o)
2606
+ return !1;
2607
+ const r = JSON.parse(atob(o));
2608
+ return !("typ" in r && r?.typ !== "JWT" || !r.alg || t && (!("alg" in r) || r.alg !== t));
2609
+ } catch {
2610
+ return !1;
2611
+ }
2612
+ }
2613
+ const Pr = /* @__PURE__ */ d("$ZodJWT", (e, t) => {
2614
+ w.init(e, t), e._zod.check = (n) => {
2615
+ Or(n.value, t.alg) || n.issues.push({
2616
+ code: "invalid_format",
2617
+ format: "jwt",
2618
+ input: n.value,
2619
+ inst: e,
2620
+ continue: !t.abort
2621
+ });
2622
+ };
2623
+ }), kt = /* @__PURE__ */ d("$ZodNumber", (e, t) => {
2624
+ b.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? _t, e._zod.parse = (n, o) => {
2625
+ if (t.coerce)
2626
+ try {
2627
+ n.value = Number(n.value);
2628
+ } catch {
2629
+ }
2630
+ const r = n.value;
2631
+ if (typeof r == "number" && !Number.isNaN(r) && Number.isFinite(r))
2632
+ return n;
2633
+ const i = typeof r == "number" ? Number.isNaN(r) ? "NaN" : Number.isFinite(r) ? void 0 : "Infinity" : void 0;
2634
+ return n.issues.push({
2635
+ expected: "number",
2636
+ code: "invalid_type",
2637
+ input: r,
2638
+ inst: e,
2639
+ ...i ? { received: i } : {}
2640
+ }), n;
2641
+ };
2642
+ }), Ar = /* @__PURE__ */ d("$ZodNumberFormat", (e, t) => {
2643
+ Wo.init(e, t), kt.init(e, t);
2644
+ }), Nr = /* @__PURE__ */ d("$ZodBoolean", (e, t) => {
2645
+ b.init(e, t), e._zod.pattern = qo, e._zod.parse = (n, o) => {
2646
+ if (t.coerce)
2647
+ try {
2648
+ n.value = !!n.value;
2649
+ } catch {
2650
+ }
2651
+ const r = n.value;
2652
+ return typeof r == "boolean" || n.issues.push({
2653
+ expected: "boolean",
2654
+ code: "invalid_type",
2655
+ input: r,
2656
+ inst: e
2657
+ }), n;
2658
+ };
2659
+ }), Cr = /* @__PURE__ */ d("$ZodUnknown", (e, t) => {
2660
+ b.init(e, t), e._zod.parse = (n) => n;
2661
+ }), Rr = /* @__PURE__ */ d("$ZodNever", (e, t) => {
2662
+ b.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
2663
+ expected: "never",
2664
+ code: "invalid_type",
2665
+ input: n.value,
2666
+ inst: e
2667
+ }), n);
2668
+ });
2669
+ function De(e, t, n) {
2670
+ e.issues.length && t.issues.push(...q(n, e.issues)), t.value[n] = e.value;
2671
+ }
2672
+ const Dr = /* @__PURE__ */ d("$ZodArray", (e, t) => {
2673
+ b.init(e, t), e._zod.parse = (n, o) => {
2674
+ const r = n.value;
2675
+ if (!Array.isArray(r))
2676
+ return n.issues.push({
2677
+ expected: "array",
2678
+ code: "invalid_type",
2679
+ input: r,
2680
+ inst: e
2681
+ }), n;
2682
+ n.value = Array(r.length);
2683
+ const i = [];
2684
+ for (let s = 0; s < r.length; s++) {
2685
+ const a = r[s], c = t.element._zod.run({
2686
+ value: a,
2687
+ issues: []
2688
+ }, o);
2689
+ c instanceof Promise ? i.push(c.then((u) => De(u, n, s))) : De(c, n, s);
2690
+ }
2691
+ return i.length ? Promise.all(i).then(() => n) : n;
2692
+ };
2693
+ });
2694
+ function ie(e, t, n, o, r) {
2695
+ if (e.issues.length) {
2696
+ if (r && !(n in o))
2697
+ return;
2698
+ t.issues.push(...q(n, e.issues));
2699
+ }
2700
+ e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value;
2701
+ }
2702
+ function zt(e) {
2703
+ const t = Object.keys(e.shape);
2704
+ for (const o of t)
2705
+ if (!e.shape?.[o]?._zod?.traits?.has("$ZodType"))
2706
+ throw new Error(`Invalid element at key "${o}": expected a Zod schema`);
2707
+ const n = eo(e.shape);
2708
+ return {
2709
+ ...e,
2710
+ keys: t,
2711
+ keySet: new Set(t),
2712
+ numKeys: t.length,
2713
+ optionalKeys: new Set(n)
2714
+ };
2715
+ }
2716
+ function $t(e, t, n, o, r, i) {
2717
+ const s = [], a = r.keySet, c = r.catchall._zod, u = c.def.type, l = c.optout === "optional";
2718
+ for (const f in t) {
2719
+ if (a.has(f))
2720
+ continue;
2721
+ if (u === "never") {
2722
+ s.push(f);
2723
+ continue;
2724
+ }
2725
+ const h = c.run({ value: t[f], issues: [] }, o);
2726
+ h instanceof Promise ? e.push(h.then((p) => ie(p, n, f, t, l))) : ie(h, n, f, t, l);
2727
+ }
2728
+ return s.length && n.issues.push({
2729
+ code: "unrecognized_keys",
2730
+ keys: s,
2731
+ input: t,
2732
+ inst: i
2733
+ }), e.length ? Promise.all(e).then(() => n) : n;
2734
+ }
2735
+ const jr = /* @__PURE__ */ d("$ZodObject", (e, t) => {
2736
+ if (b.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
2737
+ const a = t.shape;
2738
+ Object.defineProperty(t, "shape", {
2739
+ get: () => {
2740
+ const c = { ...a };
2741
+ return Object.defineProperty(t, "shape", {
2742
+ value: c
2743
+ }), c;
2744
+ }
2745
+ });
2746
+ }
2747
+ const o = ve(() => zt(t));
2748
+ _(e._zod, "propValues", () => {
2749
+ const a = t.shape, c = {};
2750
+ for (const u in a) {
2751
+ const l = a[u]._zod;
2752
+ if (l.values) {
2753
+ c[u] ?? (c[u] = /* @__PURE__ */ new Set());
2754
+ for (const f of l.values)
2755
+ c[u].add(f);
2756
+ }
2757
+ }
2758
+ return c;
2759
+ });
2760
+ const r = re, i = t.catchall;
2761
+ let s;
2762
+ e._zod.parse = (a, c) => {
2763
+ s ?? (s = o.value);
2764
+ const u = a.value;
2765
+ if (!r(u))
2766
+ return a.issues.push({
2767
+ expected: "object",
2768
+ code: "invalid_type",
2769
+ input: u,
2770
+ inst: e
2771
+ }), a;
2772
+ a.value = {};
2773
+ const l = [], f = s.shape;
2774
+ for (const h of s.keys) {
2775
+ const p = f[h], m = p._zod.optout === "optional", v = p._zod.run({ value: u[h], issues: [] }, c);
2776
+ v instanceof Promise ? l.push(v.then((A) => ie(A, a, h, u, m))) : ie(v, a, h, u, m);
2777
+ }
2778
+ return i ? $t(l, u, a, c, o.value, e) : l.length ? Promise.all(l).then(() => a) : a;
2779
+ };
2780
+ }), Lr = /* @__PURE__ */ d("$ZodObjectJIT", (e, t) => {
2781
+ jr.init(e, t);
2782
+ const n = e._zod.parse, o = ve(() => zt(t)), r = (h) => {
2783
+ const p = new ir(["shape", "payload", "ctx"]), m = o.value, v = (Z) => {
2784
+ const I = Ce(Z);
2785
+ return `shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`;
2786
+ };
2787
+ p.write("const input = payload.value;");
2788
+ const A = /* @__PURE__ */ Object.create(null);
2789
+ let H = 0;
2790
+ for (const Z of m.keys)
2791
+ A[Z] = `key_${H++}`;
2792
+ p.write("const newResult = {};");
2793
+ for (const Z of m.keys) {
2794
+ const I = A[Z], P = Ce(Z), Dt = h[Z]?._zod?.optout === "optional";
2795
+ p.write(`const ${I} = ${v(Z)};`), Dt ? p.write(`
2796
+ if (${I}.issues.length) {
2797
+ if (${P} in input) {
2798
+ payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
2799
+ ...iss,
2800
+ path: iss.path ? [${P}, ...iss.path] : [${P}]
2801
+ })));
2802
+ }
2803
+ }
2804
+
2805
+ if (${I}.value === undefined) {
2806
+ if (${P} in input) {
2807
+ newResult[${P}] = undefined;
2808
+ }
2809
+ } else {
2810
+ newResult[${P}] = ${I}.value;
2811
+ }
2812
+
2813
+ `) : p.write(`
2814
+ if (${I}.issues.length) {
2815
+ payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
2816
+ ...iss,
2817
+ path: iss.path ? [${P}, ...iss.path] : [${P}]
2818
+ })));
2819
+ }
2820
+
2821
+ if (${I}.value === undefined) {
2822
+ if (${P} in input) {
2823
+ newResult[${P}] = undefined;
2824
+ }
2825
+ } else {
2826
+ newResult[${P}] = ${I}.value;
2827
+ }
2828
+
2829
+ `);
2830
+ }
2831
+ p.write("payload.value = newResult;"), p.write("return payload;");
2832
+ const le = p.compile();
2833
+ return (Z, I) => le(h, Z, I);
2834
+ };
2835
+ let i;
2836
+ const s = re, a = !at.jitless, u = a && Qn.value, l = t.catchall;
2837
+ let f;
2838
+ e._zod.parse = (h, p) => {
2839
+ f ?? (f = o.value);
2840
+ const m = h.value;
2841
+ return s(m) ? a && u && p?.async === !1 && p.jitless !== !0 ? (i || (i = r(t.shape)), h = i(h, p), l ? $t([], m, h, p, f, e) : h) : n(h, p) : (h.issues.push({
2842
+ expected: "object",
2843
+ code: "invalid_type",
2844
+ input: m,
2845
+ inst: e
2846
+ }), h);
2847
+ };
2848
+ });
2849
+ function je(e, t, n, o) {
2850
+ for (const i of e)
2851
+ if (i.issues.length === 0)
2852
+ return t.value = i.value, t;
2853
+ const r = e.filter((i) => !x(i));
2854
+ return r.length === 1 ? (t.value = r[0].value, r[0]) : (t.issues.push({
2855
+ code: "invalid_union",
2856
+ input: t.value,
2857
+ inst: n,
2858
+ errors: e.map((i) => i.issues.map((s) => R(s, o, C())))
2859
+ }), t);
2860
+ }
2861
+ const Ur = /* @__PURE__ */ d("$ZodUnion", (e, t) => {
2862
+ b.init(e, t), _(e._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), _(e._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), _(e._zod, "values", () => {
2863
+ if (t.options.every((r) => r._zod.values))
2864
+ return new Set(t.options.flatMap((r) => Array.from(r._zod.values)));
2865
+ }), _(e._zod, "pattern", () => {
2866
+ if (t.options.every((r) => r._zod.pattern)) {
2867
+ const r = t.options.map((i) => i._zod.pattern);
2868
+ return new RegExp(`^(${r.map((i) => be(i.source)).join("|")})$`);
2869
+ }
2870
+ });
2871
+ const n = t.options.length === 1, o = t.options[0]._zod.run;
2872
+ e._zod.parse = (r, i) => {
2873
+ if (n)
2874
+ return o(r, i);
2875
+ let s = !1;
2876
+ const a = [];
2877
+ for (const c of t.options) {
2878
+ const u = c._zod.run({
2879
+ value: r.value,
2880
+ issues: []
2881
+ }, i);
2882
+ if (u instanceof Promise)
2883
+ a.push(u), s = !0;
2884
+ else {
2885
+ if (u.issues.length === 0)
2886
+ return u;
2887
+ a.push(u);
2888
+ }
2889
+ }
2890
+ return s ? Promise.all(a).then((c) => je(c, r, e, i)) : je(a, r, e, i);
2891
+ };
2892
+ }), Mr = /* @__PURE__ */ d("$ZodIntersection", (e, t) => {
2893
+ b.init(e, t), e._zod.parse = (n, o) => {
2894
+ const r = n.value, i = t.left._zod.run({ value: r, issues: [] }, o), s = t.right._zod.run({ value: r, issues: [] }, o);
2895
+ return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([c, u]) => Le(n, c, u)) : Le(n, i, s);
2896
+ };
2897
+ });
2898
+ function he(e, t) {
2899
+ if (e === t)
2900
+ return { valid: !0, data: e };
2901
+ if (e instanceof Date && t instanceof Date && +e == +t)
2902
+ return { valid: !0, data: e };
2903
+ if (B(e) && B(t)) {
2904
+ const n = Object.keys(t), o = Object.keys(e).filter((i) => n.indexOf(i) !== -1), r = { ...e, ...t };
2905
+ for (const i of o) {
2906
+ const s = he(e[i], t[i]);
2907
+ if (!s.valid)
2908
+ return {
2909
+ valid: !1,
2910
+ mergeErrorPath: [i, ...s.mergeErrorPath]
2911
+ };
2912
+ r[i] = s.data;
2913
+ }
2914
+ return { valid: !0, data: r };
2915
+ }
2916
+ if (Array.isArray(e) && Array.isArray(t)) {
2917
+ if (e.length !== t.length)
2918
+ return { valid: !1, mergeErrorPath: [] };
2919
+ const n = [];
2920
+ for (let o = 0; o < e.length; o++) {
2921
+ const r = e[o], i = t[o], s = he(r, i);
2922
+ if (!s.valid)
2923
+ return {
2924
+ valid: !1,
2925
+ mergeErrorPath: [o, ...s.mergeErrorPath]
2926
+ };
2927
+ n.push(s.data);
2928
+ }
2929
+ return { valid: !0, data: n };
2930
+ }
2931
+ return { valid: !1, mergeErrorPath: [] };
2932
+ }
2933
+ function Le(e, t, n) {
2934
+ const o = /* @__PURE__ */ new Map();
2935
+ let r;
2936
+ for (const a of t.issues)
2937
+ if (a.code === "unrecognized_keys") {
2938
+ r ?? (r = a);
2939
+ for (const c of a.keys)
2940
+ o.has(c) || o.set(c, {}), o.get(c).l = !0;
2941
+ } else
2942
+ e.issues.push(a);
2943
+ for (const a of n.issues)
2944
+ if (a.code === "unrecognized_keys")
2945
+ for (const c of a.keys)
2946
+ o.has(c) || o.set(c, {}), o.get(c).r = !0;
2947
+ else
2948
+ e.issues.push(a);
2949
+ const i = [...o].filter(([, a]) => a.l && a.r).map(([a]) => a);
2950
+ if (i.length && r && e.issues.push({ ...r, keys: i }), x(e))
2951
+ return e;
2952
+ const s = he(t.value, n.value);
2953
+ if (!s.valid)
2954
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);
2955
+ return e.value = s.data, e;
2956
+ }
2957
+ const Fr = /* @__PURE__ */ d("$ZodRecord", (e, t) => {
2958
+ b.init(e, t), e._zod.parse = (n, o) => {
2959
+ const r = n.value;
2960
+ if (!B(r))
2961
+ return n.issues.push({
2962
+ expected: "record",
2963
+ code: "invalid_type",
2964
+ input: r,
2965
+ inst: e
2966
+ }), n;
2967
+ const i = [], s = t.keyType._zod.values;
2968
+ if (s) {
2969
+ n.value = {};
2970
+ const a = /* @__PURE__ */ new Set();
2971
+ for (const u of s)
2972
+ if (typeof u == "string" || typeof u == "number" || typeof u == "symbol") {
2973
+ a.add(typeof u == "number" ? u.toString() : u);
2974
+ const l = t.valueType._zod.run({ value: r[u], issues: [] }, o);
2975
+ l instanceof Promise ? i.push(l.then((f) => {
2976
+ f.issues.length && n.issues.push(...q(u, f.issues)), n.value[u] = f.value;
2977
+ })) : (l.issues.length && n.issues.push(...q(u, l.issues)), n.value[u] = l.value);
2978
+ }
2979
+ let c;
2980
+ for (const u in r)
2981
+ a.has(u) || (c = c ?? [], c.push(u));
2982
+ c && c.length > 0 && n.issues.push({
2983
+ code: "unrecognized_keys",
2984
+ input: r,
2985
+ inst: e,
2986
+ keys: c
2987
+ });
2988
+ } else {
2989
+ n.value = {};
2990
+ for (const a of Reflect.ownKeys(r)) {
2991
+ if (a === "__proto__")
2992
+ continue;
2993
+ let c = t.keyType._zod.run({ value: a, issues: [] }, o);
2994
+ if (c instanceof Promise)
2995
+ throw new Error("Async schemas not supported in object keys currently");
2996
+ if (typeof a == "string" && _t.test(a) && c.issues.length) {
2997
+ const f = t.keyType._zod.run({ value: Number(a), issues: [] }, o);
2998
+ if (f instanceof Promise)
2999
+ throw new Error("Async schemas not supported in object keys currently");
3000
+ f.issues.length === 0 && (c = f);
3001
+ }
3002
+ if (c.issues.length) {
3003
+ t.mode === "loose" ? n.value[a] = r[a] : n.issues.push({
3004
+ code: "invalid_key",
3005
+ origin: "record",
3006
+ issues: c.issues.map((f) => R(f, o, C())),
3007
+ input: a,
3008
+ path: [a],
3009
+ inst: e
3010
+ });
3011
+ continue;
3012
+ }
3013
+ const l = t.valueType._zod.run({ value: r[a], issues: [] }, o);
3014
+ l instanceof Promise ? i.push(l.then((f) => {
3015
+ f.issues.length && n.issues.push(...q(a, f.issues)), n.value[c.value] = f.value;
3016
+ })) : (l.issues.length && n.issues.push(...q(a, l.issues)), n.value[c.value] = l.value);
3017
+ }
3018
+ }
3019
+ return i.length ? Promise.all(i).then(() => n) : n;
3020
+ };
3021
+ }), Jr = /* @__PURE__ */ d("$ZodEnum", (e, t) => {
3022
+ b.init(e, t);
3023
+ const n = ct(t.entries), o = new Set(n);
3024
+ e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((r) => Xn.has(typeof r)).map((r) => typeof r == "string" ? G(r) : r.toString()).join("|")})$`), e._zod.parse = (r, i) => {
3025
+ const s = r.value;
3026
+ return o.has(s) || r.issues.push({
3027
+ code: "invalid_value",
3028
+ values: n,
3029
+ input: s,
3030
+ inst: e
3031
+ }), r;
3032
+ };
3033
+ }), xr = /* @__PURE__ */ d("$ZodLiteral", (e, t) => {
3034
+ if (b.init(e, t), t.values.length === 0)
3035
+ throw new Error("Cannot create literal schema with no valid values");
3036
+ const n = new Set(t.values);
3037
+ e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((o) => typeof o == "string" ? G(o) : o ? G(o.toString()) : String(o)).join("|")})$`), e._zod.parse = (o, r) => {
3038
+ const i = o.value;
3039
+ return n.has(i) || o.issues.push({
3040
+ code: "invalid_value",
3041
+ values: t.values,
3042
+ input: i,
3043
+ inst: e
3044
+ }), o;
3045
+ };
3046
+ }), qr = /* @__PURE__ */ d("$ZodTransform", (e, t) => {
3047
+ b.init(e, t), e._zod.parse = (n, o) => {
3048
+ if (o.direction === "backward")
3049
+ throw new st(e.constructor.name);
3050
+ const r = t.transform(n.value, n);
3051
+ if (o.async)
3052
+ return (r instanceof Promise ? r : Promise.resolve(r)).then((s) => (n.value = s, n));
3053
+ if (r instanceof Promise)
3054
+ throw new V();
3055
+ return n.value = r, n;
3056
+ };
3057
+ });
3058
+ function Ue(e, t) {
3059
+ return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
3060
+ }
3061
+ const St = /* @__PURE__ */ d("$ZodOptional", (e, t) => {
3062
+ b.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", _(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), _(e._zod, "pattern", () => {
3063
+ const n = t.innerType._zod.pattern;
3064
+ return n ? new RegExp(`^(${be(n.source)})?$`) : void 0;
3065
+ }), e._zod.parse = (n, o) => {
3066
+ if (t.innerType._zod.optin === "optional") {
3067
+ const r = t.innerType._zod.run(n, o);
3068
+ return r instanceof Promise ? r.then((i) => Ue(i, n.value)) : Ue(r, n.value);
3069
+ }
3070
+ return n.value === void 0 ? n : t.innerType._zod.run(n, o);
3071
+ };
3072
+ }), Vr = /* @__PURE__ */ d("$ZodExactOptional", (e, t) => {
3073
+ St.init(e, t), _(e._zod, "values", () => t.innerType._zod.values), _(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (n, o) => t.innerType._zod.run(n, o);
3074
+ }), Br = /* @__PURE__ */ d("$ZodNullable", (e, t) => {
3075
+ b.init(e, t), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), _(e._zod, "pattern", () => {
3076
+ const n = t.innerType._zod.pattern;
3077
+ return n ? new RegExp(`^(${be(n.source)}|null)$`) : void 0;
3078
+ }), _(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o);
3079
+ }), Gr = /* @__PURE__ */ d("$ZodDefault", (e, t) => {
3080
+ b.init(e, t), e._zod.optin = "optional", _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
3081
+ if (o.direction === "backward")
3082
+ return t.innerType._zod.run(n, o);
3083
+ if (n.value === void 0)
3084
+ return n.value = t.defaultValue, n;
3085
+ const r = t.innerType._zod.run(n, o);
3086
+ return r instanceof Promise ? r.then((i) => Me(i, t)) : Me(r, t);
3087
+ };
3088
+ });
3089
+ function Me(e, t) {
3090
+ return e.value === void 0 && (e.value = t.defaultValue), e;
3091
+ }
3092
+ const Wr = /* @__PURE__ */ d("$ZodPrefault", (e, t) => {
3093
+ b.init(e, t), e._zod.optin = "optional", _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (o.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
3094
+ }), Hr = /* @__PURE__ */ d("$ZodNonOptional", (e, t) => {
3095
+ b.init(e, t), _(e._zod, "values", () => {
3096
+ const n = t.innerType._zod.values;
3097
+ return n ? new Set([...n].filter((o) => o !== void 0)) : void 0;
3098
+ }), e._zod.parse = (n, o) => {
3099
+ const r = t.innerType._zod.run(n, o);
3100
+ return r instanceof Promise ? r.then((i) => Fe(i, e)) : Fe(r, e);
3101
+ };
3102
+ });
3103
+ function Fe(e, t) {
3104
+ return !e.issues.length && e.value === void 0 && e.issues.push({
3105
+ code: "invalid_type",
3106
+ expected: "nonoptional",
3107
+ input: e.value,
3108
+ inst: t
3109
+ }), e;
3110
+ }
3111
+ const Kr = /* @__PURE__ */ d("$ZodCatch", (e, t) => {
3112
+ b.init(e, t), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
3113
+ if (o.direction === "backward")
3114
+ return t.innerType._zod.run(n, o);
3115
+ const r = t.innerType._zod.run(n, o);
3116
+ return r instanceof Promise ? r.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
3117
+ ...n,
3118
+ error: {
3119
+ issues: i.issues.map((s) => R(s, o, C()))
3120
+ },
3121
+ input: n.value
3122
+ }), n.issues = []), n)) : (n.value = r.value, r.issues.length && (n.value = t.catchValue({
3123
+ ...n,
3124
+ error: {
3125
+ issues: r.issues.map((i) => R(i, o, C()))
3126
+ },
3127
+ input: n.value
3128
+ }), n.issues = []), n);
3129
+ };
3130
+ }), Yr = /* @__PURE__ */ d("$ZodPipe", (e, t) => {
3131
+ b.init(e, t), _(e._zod, "values", () => t.in._zod.values), _(e._zod, "optin", () => t.in._zod.optin), _(e._zod, "optout", () => t.out._zod.optout), _(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
3132
+ if (o.direction === "backward") {
3133
+ const i = t.out._zod.run(n, o);
3134
+ return i instanceof Promise ? i.then((s) => ne(s, t.in, o)) : ne(i, t.in, o);
3135
+ }
3136
+ const r = t.in._zod.run(n, o);
3137
+ return r instanceof Promise ? r.then((i) => ne(i, t.out, o)) : ne(r, t.out, o);
3138
+ };
3139
+ });
3140
+ function ne(e, t, n) {
3141
+ return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
3142
+ }
3143
+ const Qr = /* @__PURE__ */ d("$ZodReadonly", (e, t) => {
3144
+ b.init(e, t), _(e._zod, "propValues", () => t.innerType._zod.propValues), _(e._zod, "values", () => t.innerType._zod.values), _(e._zod, "optin", () => t.innerType?._zod?.optin), _(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, o) => {
3145
+ if (o.direction === "backward")
3146
+ return t.innerType._zod.run(n, o);
3147
+ const r = t.innerType._zod.run(n, o);
3148
+ return r instanceof Promise ? r.then(Je) : Je(r);
3149
+ };
3150
+ });
3151
+ function Je(e) {
3152
+ return e.value = Object.freeze(e.value), e;
3153
+ }
3154
+ const Xr = /* @__PURE__ */ d("$ZodCustom", (e, t) => {
3155
+ T.init(e, t), b.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
3156
+ const o = n.value, r = t.fn(o);
3157
+ if (r instanceof Promise)
3158
+ return r.then((i) => xe(i, n, o, e));
3159
+ xe(r, n, o, e);
3160
+ };
3161
+ });
3162
+ function xe(e, t, n, o) {
3163
+ if (!e) {
3164
+ const r = {
3165
+ code: "custom",
3166
+ input: n,
3167
+ inst: o,
3168
+ // incorporates params.error into issue reporting
3169
+ path: [...o._zod.def.path ?? []],
3170
+ // incorporates params.error into issue reporting
3171
+ continue: !o._zod.def.abort
3172
+ // params: inst._zod.def.params,
3173
+ };
3174
+ o._zod.def.params && (r.params = o._zod.def.params), t.issues.push(ee(r));
3175
+ }
3176
+ }
3177
+ var qe;
3178
+ class ei {
3179
+ constructor() {
3180
+ this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
3181
+ }
3182
+ add(t, ...n) {
3183
+ const o = n[0];
3184
+ return this._map.set(t, o), o && typeof o == "object" && "id" in o && this._idmap.set(o.id, t), this;
3185
+ }
3186
+ clear() {
3187
+ return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
3188
+ }
3189
+ remove(t) {
3190
+ const n = this._map.get(t);
3191
+ return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this;
3192
+ }
3193
+ get(t) {
3194
+ const n = t._zod.parent;
3195
+ if (n) {
3196
+ const o = { ...this.get(n) ?? {} };
3197
+ delete o.id;
3198
+ const r = { ...o, ...this._map.get(t) };
3199
+ return Object.keys(r).length ? r : void 0;
3200
+ }
3201
+ return this._map.get(t);
3202
+ }
3203
+ has(t) {
3204
+ return this._map.has(t);
3205
+ }
3206
+ }
3207
+ function ti() {
3208
+ return new ei();
3209
+ }
3210
+ (qe = globalThis).__zod_globalRegistry ?? (qe.__zod_globalRegistry = ti());
3211
+ const Q = globalThis.__zod_globalRegistry;
3212
+ // @__NO_SIDE_EFFECTS__
3213
+ function ni(e, t) {
3214
+ return new e({
3215
+ type: "string",
3216
+ ...g(t)
3217
+ });
3218
+ }
3219
+ // @__NO_SIDE_EFFECTS__
3220
+ function oi(e, t) {
3221
+ return new e({
3222
+ type: "string",
3223
+ format: "email",
3224
+ check: "string_format",
3225
+ abort: !1,
3226
+ ...g(t)
3227
+ });
3228
+ }
3229
+ // @__NO_SIDE_EFFECTS__
3230
+ function Ve(e, t) {
3231
+ return new e({
3232
+ type: "string",
3233
+ format: "guid",
3234
+ check: "string_format",
3235
+ abort: !1,
3236
+ ...g(t)
3237
+ });
3238
+ }
3239
+ // @__NO_SIDE_EFFECTS__
3240
+ function ri(e, t) {
3241
+ return new e({
3242
+ type: "string",
3243
+ format: "uuid",
3244
+ check: "string_format",
3245
+ abort: !1,
3246
+ ...g(t)
3247
+ });
3248
+ }
3249
+ // @__NO_SIDE_EFFECTS__
3250
+ function ii(e, t) {
3251
+ return new e({
3252
+ type: "string",
3253
+ format: "uuid",
3254
+ check: "string_format",
3255
+ abort: !1,
3256
+ version: "v4",
3257
+ ...g(t)
3258
+ });
3259
+ }
3260
+ // @__NO_SIDE_EFFECTS__
3261
+ function si(e, t) {
3262
+ return new e({
3263
+ type: "string",
3264
+ format: "uuid",
3265
+ check: "string_format",
3266
+ abort: !1,
3267
+ version: "v6",
3268
+ ...g(t)
3269
+ });
3270
+ }
3271
+ // @__NO_SIDE_EFFECTS__
3272
+ function ai(e, t) {
3273
+ return new e({
3274
+ type: "string",
3275
+ format: "uuid",
3276
+ check: "string_format",
3277
+ abort: !1,
3278
+ version: "v7",
3279
+ ...g(t)
3280
+ });
3281
+ }
3282
+ // @__NO_SIDE_EFFECTS__
3283
+ function ci(e, t) {
3284
+ return new e({
3285
+ type: "string",
3286
+ format: "url",
3287
+ check: "string_format",
3288
+ abort: !1,
3289
+ ...g(t)
3290
+ });
3291
+ }
3292
+ // @__NO_SIDE_EFFECTS__
3293
+ function ui(e, t) {
3294
+ return new e({
3295
+ type: "string",
3296
+ format: "emoji",
3297
+ check: "string_format",
3298
+ abort: !1,
3299
+ ...g(t)
3300
+ });
3301
+ }
3302
+ // @__NO_SIDE_EFFECTS__
3303
+ function di(e, t) {
3304
+ return new e({
3305
+ type: "string",
3306
+ format: "nanoid",
3307
+ check: "string_format",
3308
+ abort: !1,
3309
+ ...g(t)
3310
+ });
3311
+ }
3312
+ // @__NO_SIDE_EFFECTS__
3313
+ function li(e, t) {
3314
+ return new e({
3315
+ type: "string",
3316
+ format: "cuid",
3317
+ check: "string_format",
3318
+ abort: !1,
3319
+ ...g(t)
3320
+ });
3321
+ }
3322
+ // @__NO_SIDE_EFFECTS__
3323
+ function fi(e, t) {
3324
+ return new e({
3325
+ type: "string",
3326
+ format: "cuid2",
3327
+ check: "string_format",
3328
+ abort: !1,
3329
+ ...g(t)
3330
+ });
3331
+ }
3332
+ // @__NO_SIDE_EFFECTS__
3333
+ function pi(e, t) {
3334
+ return new e({
3335
+ type: "string",
3336
+ format: "ulid",
3337
+ check: "string_format",
3338
+ abort: !1,
3339
+ ...g(t)
3340
+ });
3341
+ }
3342
+ // @__NO_SIDE_EFFECTS__
3343
+ function gi(e, t) {
3344
+ return new e({
3345
+ type: "string",
3346
+ format: "xid",
3347
+ check: "string_format",
3348
+ abort: !1,
3349
+ ...g(t)
3350
+ });
3351
+ }
3352
+ // @__NO_SIDE_EFFECTS__
3353
+ function hi(e, t) {
3354
+ return new e({
3355
+ type: "string",
3356
+ format: "ksuid",
3357
+ check: "string_format",
3358
+ abort: !1,
3359
+ ...g(t)
3360
+ });
3361
+ }
3362
+ // @__NO_SIDE_EFFECTS__
3363
+ function mi(e, t) {
3364
+ return new e({
3365
+ type: "string",
3366
+ format: "ipv4",
3367
+ check: "string_format",
3368
+ abort: !1,
3369
+ ...g(t)
3370
+ });
3371
+ }
3372
+ // @__NO_SIDE_EFFECTS__
3373
+ function _i(e, t) {
3374
+ return new e({
3375
+ type: "string",
3376
+ format: "ipv6",
3377
+ check: "string_format",
3378
+ abort: !1,
3379
+ ...g(t)
3380
+ });
3381
+ }
3382
+ // @__NO_SIDE_EFFECTS__
3383
+ function yi(e, t) {
3384
+ return new e({
3385
+ type: "string",
3386
+ format: "cidrv4",
3387
+ check: "string_format",
3388
+ abort: !1,
3389
+ ...g(t)
3390
+ });
3391
+ }
3392
+ // @__NO_SIDE_EFFECTS__
3393
+ function vi(e, t) {
3394
+ return new e({
3395
+ type: "string",
3396
+ format: "cidrv6",
3397
+ check: "string_format",
3398
+ abort: !1,
3399
+ ...g(t)
3400
+ });
3401
+ }
3402
+ // @__NO_SIDE_EFFECTS__
3403
+ function wi(e, t) {
3404
+ return new e({
3405
+ type: "string",
3406
+ format: "base64",
3407
+ check: "string_format",
3408
+ abort: !1,
3409
+ ...g(t)
3410
+ });
3411
+ }
3412
+ // @__NO_SIDE_EFFECTS__
3413
+ function bi(e, t) {
3414
+ return new e({
3415
+ type: "string",
3416
+ format: "base64url",
3417
+ check: "string_format",
3418
+ abort: !1,
3419
+ ...g(t)
3420
+ });
3421
+ }
3422
+ // @__NO_SIDE_EFFECTS__
3423
+ function ki(e, t) {
3424
+ return new e({
3425
+ type: "string",
3426
+ format: "e164",
3427
+ check: "string_format",
3428
+ abort: !1,
3429
+ ...g(t)
3430
+ });
3431
+ }
3432
+ // @__NO_SIDE_EFFECTS__
3433
+ function zi(e, t) {
3434
+ return new e({
3435
+ type: "string",
3436
+ format: "jwt",
3437
+ check: "string_format",
3438
+ abort: !1,
3439
+ ...g(t)
3440
+ });
3441
+ }
3442
+ // @__NO_SIDE_EFFECTS__
3443
+ function $i(e, t) {
3444
+ return new e({
3445
+ type: "string",
3446
+ format: "datetime",
3447
+ check: "string_format",
3448
+ offset: !1,
3449
+ local: !1,
3450
+ precision: null,
3451
+ ...g(t)
3452
+ });
3453
+ }
3454
+ // @__NO_SIDE_EFFECTS__
3455
+ function Si(e, t) {
3456
+ return new e({
3457
+ type: "string",
3458
+ format: "date",
3459
+ check: "string_format",
3460
+ ...g(t)
3461
+ });
3462
+ }
3463
+ // @__NO_SIDE_EFFECTS__
3464
+ function Ei(e, t) {
3465
+ return new e({
3466
+ type: "string",
3467
+ format: "time",
3468
+ check: "string_format",
3469
+ precision: null,
3470
+ ...g(t)
3471
+ });
3472
+ }
3473
+ // @__NO_SIDE_EFFECTS__
3474
+ function Zi(e, t) {
3475
+ return new e({
3476
+ type: "string",
3477
+ format: "duration",
3478
+ check: "string_format",
3479
+ ...g(t)
3480
+ });
3481
+ }
3482
+ // @__NO_SIDE_EFFECTS__
3483
+ function Ii(e, t) {
3484
+ return new e({
3485
+ type: "number",
3486
+ checks: [],
3487
+ ...g(t)
3488
+ });
3489
+ }
3490
+ // @__NO_SIDE_EFFECTS__
3491
+ function Ti(e, t) {
3492
+ return new e({
3493
+ type: "number",
3494
+ check: "number_format",
3495
+ abort: !1,
3496
+ format: "safeint",
3497
+ ...g(t)
3498
+ });
3499
+ }
3500
+ // @__NO_SIDE_EFFECTS__
3501
+ function Oi(e, t) {
3502
+ return new e({
3503
+ type: "boolean",
3504
+ ...g(t)
3505
+ });
3506
+ }
3507
+ // @__NO_SIDE_EFFECTS__
3508
+ function Pi(e) {
3509
+ return new e({
3510
+ type: "unknown"
3511
+ });
3512
+ }
3513
+ // @__NO_SIDE_EFFECTS__
3514
+ function Ai(e, t) {
3515
+ return new e({
3516
+ type: "never",
3517
+ ...g(t)
3518
+ });
3519
+ }
3520
+ // @__NO_SIDE_EFFECTS__
3521
+ function Be(e, t) {
3522
+ return new vt({
3523
+ check: "less_than",
3524
+ ...g(t),
3525
+ value: e,
3526
+ inclusive: !1
3527
+ });
3528
+ }
3529
+ // @__NO_SIDE_EFFECTS__
3530
+ function fe(e, t) {
3531
+ return new vt({
3532
+ check: "less_than",
3533
+ ...g(t),
3534
+ value: e,
3535
+ inclusive: !0
3536
+ });
3537
+ }
3538
+ // @__NO_SIDE_EFFECTS__
3539
+ function Ge(e, t) {
3540
+ return new wt({
3541
+ check: "greater_than",
3542
+ ...g(t),
3543
+ value: e,
3544
+ inclusive: !1
3545
+ });
3546
+ }
3547
+ // @__NO_SIDE_EFFECTS__
3548
+ function pe(e, t) {
3549
+ return new wt({
3550
+ check: "greater_than",
3551
+ ...g(t),
3552
+ value: e,
3553
+ inclusive: !0
3554
+ });
3555
+ }
3556
+ // @__NO_SIDE_EFFECTS__
3557
+ function We(e, t) {
3558
+ return new Go({
3559
+ check: "multiple_of",
3560
+ ...g(t),
3561
+ value: e
3562
+ });
3563
+ }
3564
+ // @__NO_SIDE_EFFECTS__
3565
+ function Et(e, t) {
3566
+ return new Ho({
3567
+ check: "max_length",
3568
+ ...g(t),
3569
+ maximum: e
3570
+ });
3571
+ }
3572
+ // @__NO_SIDE_EFFECTS__
3573
+ function se(e, t) {
3574
+ return new Ko({
3575
+ check: "min_length",
3576
+ ...g(t),
3577
+ minimum: e
3578
+ });
3579
+ }
3580
+ // @__NO_SIDE_EFFECTS__
3581
+ function Zt(e, t) {
3582
+ return new Yo({
3583
+ check: "length_equals",
3584
+ ...g(t),
3585
+ length: e
3586
+ });
3587
+ }
3588
+ // @__NO_SIDE_EFFECTS__
3589
+ function Ni(e, t) {
3590
+ return new Qo({
3591
+ check: "string_format",
3592
+ format: "regex",
3593
+ ...g(t),
3594
+ pattern: e
3595
+ });
3596
+ }
3597
+ // @__NO_SIDE_EFFECTS__
3598
+ function Ci(e) {
3599
+ return new Xo({
3600
+ check: "string_format",
3601
+ format: "lowercase",
3602
+ ...g(e)
3603
+ });
3604
+ }
3605
+ // @__NO_SIDE_EFFECTS__
3606
+ function Ri(e) {
3607
+ return new er({
3608
+ check: "string_format",
3609
+ format: "uppercase",
3610
+ ...g(e)
3611
+ });
3612
+ }
3613
+ // @__NO_SIDE_EFFECTS__
3614
+ function Di(e, t) {
3615
+ return new tr({
3616
+ check: "string_format",
3617
+ format: "includes",
3618
+ ...g(t),
3619
+ includes: e
3620
+ });
3621
+ }
3622
+ // @__NO_SIDE_EFFECTS__
3623
+ function ji(e, t) {
3624
+ return new nr({
3625
+ check: "string_format",
3626
+ format: "starts_with",
3627
+ ...g(t),
3628
+ prefix: e
3629
+ });
3630
+ }
3631
+ // @__NO_SIDE_EFFECTS__
3632
+ function Li(e, t) {
3633
+ return new or({
3634
+ check: "string_format",
3635
+ format: "ends_with",
3636
+ ...g(t),
3637
+ suffix: e
3638
+ });
3639
+ }
3640
+ // @__NO_SIDE_EFFECTS__
3641
+ function W(e) {
3642
+ return new rr({
3643
+ check: "overwrite",
3644
+ tx: e
3645
+ });
3646
+ }
3647
+ // @__NO_SIDE_EFFECTS__
3648
+ function Ui(e) {
3649
+ return /* @__PURE__ */ W((t) => t.normalize(e));
3650
+ }
3651
+ // @__NO_SIDE_EFFECTS__
3652
+ function Mi() {
3653
+ return /* @__PURE__ */ W((e) => e.trim());
3654
+ }
3655
+ // @__NO_SIDE_EFFECTS__
3656
+ function Fi() {
3657
+ return /* @__PURE__ */ W((e) => e.toLowerCase());
3658
+ }
3659
+ // @__NO_SIDE_EFFECTS__
3660
+ function Ji() {
3661
+ return /* @__PURE__ */ W((e) => e.toUpperCase());
3662
+ }
3663
+ // @__NO_SIDE_EFFECTS__
3664
+ function xi() {
3665
+ return /* @__PURE__ */ W((e) => Yn(e));
3666
+ }
3667
+ // @__NO_SIDE_EFFECTS__
3668
+ function qi(e, t, n) {
3669
+ return new e({
3670
+ type: "array",
3671
+ element: t,
3672
+ // get element() {
3673
+ // return element;
3674
+ // },
3675
+ ...g(n)
3676
+ });
3677
+ }
3678
+ // @__NO_SIDE_EFFECTS__
3679
+ function Vi(e, t, n) {
3680
+ return new e({
3681
+ type: "custom",
3682
+ check: "custom",
3683
+ fn: t,
3684
+ ...g(n)
3685
+ });
3686
+ }
3687
+ // @__NO_SIDE_EFFECTS__
3688
+ function Bi(e) {
3689
+ const t = /* @__PURE__ */ Gi((n) => (n.addIssue = (o) => {
3690
+ if (typeof o == "string")
3691
+ n.issues.push(ee(o, n.value, t._zod.def));
3692
+ else {
3693
+ const r = o;
3694
+ r.fatal && (r.continue = !1), r.code ?? (r.code = "custom"), r.input ?? (r.input = n.value), r.inst ?? (r.inst = t), r.continue ?? (r.continue = !t._zod.def.abort), n.issues.push(ee(r));
3695
+ }
3696
+ }, e(n.value, n)));
3697
+ return t;
3698
+ }
3699
+ // @__NO_SIDE_EFFECTS__
3700
+ function Gi(e, t) {
3701
+ const n = new T({
3702
+ check: "custom",
3703
+ ...g(t)
3704
+ });
3705
+ return n._zod.check = e, n;
3706
+ }
3707
+ function It(e) {
3708
+ let t = e?.target ?? "draft-2020-12";
3709
+ return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
3710
+ processors: e.processors ?? {},
3711
+ metadataRegistry: e?.metadata ?? Q,
3712
+ target: t,
3713
+ unrepresentable: e?.unrepresentable ?? "throw",
3714
+ override: e?.override ?? (() => {
3715
+ }),
3716
+ io: e?.io ?? "output",
3717
+ counter: 0,
3718
+ seen: /* @__PURE__ */ new Map(),
3719
+ cycles: e?.cycles ?? "ref",
3720
+ reused: e?.reused ?? "inline",
3721
+ external: e?.external ?? void 0
3722
+ };
3723
+ }
3724
+ function $(e, t, n = { path: [], schemaPath: [] }) {
3725
+ var o;
3726
+ const r = e._zod.def, i = t.seen.get(e);
3727
+ if (i)
3728
+ return i.count++, n.schemaPath.includes(e) && (i.cycle = n.path), i.schema;
3729
+ const s = { schema: {}, count: 1, cycle: void 0, path: n.path };
3730
+ t.seen.set(e, s);
3731
+ const a = e._zod.toJSONSchema?.();
3732
+ if (a)
3733
+ s.schema = a;
3734
+ else {
3735
+ const l = {
3736
+ ...n,
3737
+ schemaPath: [...n.schemaPath, e],
3738
+ path: n.path
3739
+ };
3740
+ if (e._zod.processJSONSchema)
3741
+ e._zod.processJSONSchema(t, s.schema, l);
3742
+ else {
3743
+ const h = s.schema, p = t.processors[r.type];
3744
+ if (!p)
3745
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);
3746
+ p(e, t, h, l);
3747
+ }
3748
+ const f = e._zod.parent;
3749
+ f && (s.ref || (s.ref = f), $(f, t, l), t.seen.get(f).isParent = !0);
3750
+ }
3751
+ const c = t.metadataRegistry.get(e);
3752
+ return c && Object.assign(s.schema, c), t.io === "input" && E(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && s.schema._prefault && ((o = s.schema).default ?? (o.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
3753
+ }
3754
+ function Tt(e, t) {
3755
+ const n = e.seen.get(t);
3756
+ if (!n)
3757
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
3758
+ const o = /* @__PURE__ */ new Map();
3759
+ for (const s of e.seen.entries()) {
3760
+ const a = e.metadataRegistry.get(s[0])?.id;
3761
+ if (a) {
3762
+ const c = o.get(a);
3763
+ if (c && c !== s[0])
3764
+ throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
3765
+ o.set(a, s[0]);
3766
+ }
3767
+ }
3768
+ const r = (s) => {
3769
+ const a = e.target === "draft-2020-12" ? "$defs" : "definitions";
3770
+ if (e.external) {
3771
+ const f = e.external.registry.get(s[0])?.id, h = e.external.uri ?? ((m) => m);
3772
+ if (f)
3773
+ return { ref: h(f) };
3774
+ const p = s[1].defId ?? s[1].schema.id ?? `schema${e.counter++}`;
3775
+ return s[1].defId = p, { defId: p, ref: `${h("__shared")}#/${a}/${p}` };
3776
+ }
3777
+ if (s[1] === n)
3778
+ return { ref: "#" };
3779
+ const u = `#/${a}/`, l = s[1].schema.id ?? `__schema${e.counter++}`;
3780
+ return { defId: l, ref: u + l };
3781
+ }, i = (s) => {
3782
+ if (s[1].schema.$ref)
3783
+ return;
3784
+ const a = s[1], { ref: c, defId: u } = r(s);
3785
+ a.def = { ...a.schema }, u && (a.defId = u);
3786
+ const l = a.schema;
3787
+ for (const f in l)
3788
+ delete l[f];
3789
+ l.$ref = c;
3790
+ };
3791
+ if (e.cycles === "throw")
3792
+ for (const s of e.seen.entries()) {
3793
+ const a = s[1];
3794
+ if (a.cycle)
3795
+ throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
3796
+
3797
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
3798
+ }
3799
+ for (const s of e.seen.entries()) {
3800
+ const a = s[1];
3801
+ if (t === s[0]) {
3802
+ i(s);
3803
+ continue;
3804
+ }
3805
+ if (e.external) {
3806
+ const u = e.external.registry.get(s[0])?.id;
3807
+ if (t !== s[0] && u) {
3808
+ i(s);
3809
+ continue;
3810
+ }
3811
+ }
3812
+ if (e.metadataRegistry.get(s[0])?.id) {
3813
+ i(s);
3814
+ continue;
3815
+ }
3816
+ if (a.cycle) {
3817
+ i(s);
3818
+ continue;
3819
+ }
3820
+ if (a.count > 1 && e.reused === "ref") {
3821
+ i(s);
3822
+ continue;
3823
+ }
3824
+ }
3825
+ }
3826
+ function Ot(e, t) {
3827
+ const n = e.seen.get(t);
3828
+ if (!n)
3829
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
3830
+ const o = (s) => {
3831
+ const a = e.seen.get(s);
3832
+ if (a.ref === null)
3833
+ return;
3834
+ const c = a.def ?? a.schema, u = { ...c }, l = a.ref;
3835
+ if (a.ref = null, l) {
3836
+ o(l);
3837
+ const h = e.seen.get(l), p = h.schema;
3838
+ if (p.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(p)) : Object.assign(c, p), Object.assign(c, u), s._zod.parent === l)
3839
+ for (const v in c)
3840
+ v === "$ref" || v === "allOf" || v in u || delete c[v];
3841
+ if (p.$ref && h.def)
3842
+ for (const v in c)
3843
+ v === "$ref" || v === "allOf" || v in h.def && JSON.stringify(c[v]) === JSON.stringify(h.def[v]) && delete c[v];
3844
+ }
3845
+ const f = s._zod.parent;
3846
+ if (f && f !== l) {
3847
+ o(f);
3848
+ const h = e.seen.get(f);
3849
+ if (h?.schema.$ref && (c.$ref = h.schema.$ref, h.def))
3850
+ for (const p in c)
3851
+ p === "$ref" || p === "allOf" || p in h.def && JSON.stringify(c[p]) === JSON.stringify(h.def[p]) && delete c[p];
3852
+ }
3853
+ e.override({
3854
+ zodSchema: s,
3855
+ jsonSchema: c,
3856
+ path: a.path ?? []
3857
+ });
3858
+ };
3859
+ for (const s of [...e.seen.entries()].reverse())
3860
+ o(s[0]);
3861
+ const r = {};
3862
+ if (e.target === "draft-2020-12" ? r.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? r.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? r.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
3863
+ const s = e.external.registry.get(t)?.id;
3864
+ if (!s)
3865
+ throw new Error("Schema is missing an `id` property");
3866
+ r.$id = e.external.uri(s);
3867
+ }
3868
+ Object.assign(r, n.def ?? n.schema);
3869
+ const i = e.external?.defs ?? {};
3870
+ for (const s of e.seen.entries()) {
3871
+ const a = s[1];
3872
+ a.def && a.defId && (i[a.defId] = a.def);
3873
+ }
3874
+ e.external || Object.keys(i).length > 0 && (e.target === "draft-2020-12" ? r.$defs = i : r.definitions = i);
3875
+ try {
3876
+ const s = JSON.parse(JSON.stringify(r));
3877
+ return Object.defineProperty(s, "~standard", {
3878
+ value: {
3879
+ ...t["~standard"],
3880
+ jsonSchema: {
3881
+ input: ae(t, "input", e.processors),
3882
+ output: ae(t, "output", e.processors)
3883
+ }
3884
+ },
3885
+ enumerable: !1,
3886
+ writable: !1
3887
+ }), s;
3888
+ } catch {
3889
+ throw new Error("Error converting schema to JSON.");
3890
+ }
3891
+ }
3892
+ function E(e, t) {
3893
+ const n = t ?? { seen: /* @__PURE__ */ new Set() };
3894
+ if (n.seen.has(e))
3895
+ return !1;
3896
+ n.seen.add(e);
3897
+ const o = e._zod.def;
3898
+ if (o.type === "transform")
3899
+ return !0;
3900
+ if (o.type === "array")
3901
+ return E(o.element, n);
3902
+ if (o.type === "set")
3903
+ return E(o.valueType, n);
3904
+ if (o.type === "lazy")
3905
+ return E(o.getter(), n);
3906
+ if (o.type === "promise" || o.type === "optional" || o.type === "nonoptional" || o.type === "nullable" || o.type === "readonly" || o.type === "default" || o.type === "prefault")
3907
+ return E(o.innerType, n);
3908
+ if (o.type === "intersection")
3909
+ return E(o.left, n) || E(o.right, n);
3910
+ if (o.type === "record" || o.type === "map")
3911
+ return E(o.keyType, n) || E(o.valueType, n);
3912
+ if (o.type === "pipe")
3913
+ return E(o.in, n) || E(o.out, n);
3914
+ if (o.type === "object") {
3915
+ for (const r in o.shape)
3916
+ if (E(o.shape[r], n))
3917
+ return !0;
3918
+ return !1;
3919
+ }
3920
+ if (o.type === "union") {
3921
+ for (const r of o.options)
3922
+ if (E(r, n))
3923
+ return !0;
3924
+ return !1;
3925
+ }
3926
+ if (o.type === "tuple") {
3927
+ for (const r of o.items)
3928
+ if (E(r, n))
3929
+ return !0;
3930
+ return !!(o.rest && E(o.rest, n));
3931
+ }
3932
+ return !1;
3933
+ }
3934
+ const Wi = (e, t = {}) => (n) => {
3935
+ const o = It({ ...n, processors: t });
3936
+ return $(e, o), Tt(o, e), Ot(o, e);
3937
+ }, ae = (e, t, n = {}) => (o) => {
3938
+ const { libraryOptions: r, target: i } = o ?? {}, s = It({ ...r ?? {}, target: i, io: t, processors: n });
3939
+ return $(e, s), Tt(s, e), Ot(s, e);
3940
+ }, Hi = {
3941
+ guid: "uuid",
3942
+ url: "uri",
3943
+ datetime: "date-time",
3944
+ json_string: "json-string",
3945
+ regex: ""
3946
+ // do not set
3947
+ }, Ki = (e, t, n, o) => {
3948
+ const r = n;
3949
+ r.type = "string";
3950
+ const { minimum: i, maximum: s, format: a, patterns: c, contentEncoding: u } = e._zod.bag;
3951
+ if (typeof i == "number" && (r.minLength = i), typeof s == "number" && (r.maxLength = s), a && (r.format = Hi[a] ?? a, r.format === "" && delete r.format, a === "time" && delete r.format), u && (r.contentEncoding = u), c && c.size > 0) {
3952
+ const l = [...c];
3953
+ l.length === 1 ? r.pattern = l[0].source : l.length > 1 && (r.allOf = [
3954
+ ...l.map((f) => ({
3955
+ ...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
3956
+ pattern: f.source
3957
+ }))
3958
+ ]);
3959
+ }
3960
+ }, Yi = (e, t, n, o) => {
3961
+ const r = n, { minimum: i, maximum: s, format: a, multipleOf: c, exclusiveMaximum: u, exclusiveMinimum: l } = e._zod.bag;
3962
+ typeof a == "string" && a.includes("int") ? r.type = "integer" : r.type = "number", typeof l == "number" && (t.target === "draft-04" || t.target === "openapi-3.0" ? (r.minimum = l, r.exclusiveMinimum = !0) : r.exclusiveMinimum = l), typeof i == "number" && (r.minimum = i, typeof l == "number" && t.target !== "draft-04" && (l >= i ? delete r.minimum : delete r.exclusiveMinimum)), typeof u == "number" && (t.target === "draft-04" || t.target === "openapi-3.0" ? (r.maximum = u, r.exclusiveMaximum = !0) : r.exclusiveMaximum = u), typeof s == "number" && (r.maximum = s, typeof u == "number" && t.target !== "draft-04" && (u <= s ? delete r.maximum : delete r.exclusiveMaximum)), typeof c == "number" && (r.multipleOf = c);
3963
+ }, Qi = (e, t, n, o) => {
3964
+ n.type = "boolean";
3965
+ }, Xi = (e, t, n, o) => {
3966
+ n.not = {};
3967
+ }, es = (e, t, n, o) => {
3968
+ }, ts = (e, t, n, o) => {
3969
+ const r = e._zod.def, i = ct(r.entries);
3970
+ i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), n.enum = i;
3971
+ }, ns = (e, t, n, o) => {
3972
+ const r = e._zod.def, i = [];
3973
+ for (const s of r.values)
3974
+ if (s === void 0) {
3975
+ if (t.unrepresentable === "throw")
3976
+ throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3977
+ } else if (typeof s == "bigint") {
3978
+ if (t.unrepresentable === "throw")
3979
+ throw new Error("BigInt literals cannot be represented in JSON Schema");
3980
+ i.push(Number(s));
3981
+ } else
3982
+ i.push(s);
3983
+ if (i.length !== 0) if (i.length === 1) {
3984
+ const s = i[0];
3985
+ n.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [s] : n.const = s;
3986
+ } else
3987
+ i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), i.every((s) => typeof s == "boolean") && (n.type = "boolean"), i.every((s) => s === null) && (n.type = "null"), n.enum = i;
3988
+ }, os = (e, t, n, o) => {
3989
+ if (t.unrepresentable === "throw")
3990
+ throw new Error("Custom types cannot be represented in JSON Schema");
3991
+ }, rs = (e, t, n, o) => {
3992
+ if (t.unrepresentable === "throw")
3993
+ throw new Error("Transforms cannot be represented in JSON Schema");
3994
+ }, is = (e, t, n, o) => {
3995
+ const r = n, i = e._zod.def, { minimum: s, maximum: a } = e._zod.bag;
3996
+ typeof s == "number" && (r.minItems = s), typeof a == "number" && (r.maxItems = a), r.type = "array", r.items = $(i.element, t, { ...o, path: [...o.path, "items"] });
3997
+ }, ss = (e, t, n, o) => {
3998
+ const r = n, i = e._zod.def;
3999
+ r.type = "object", r.properties = {};
4000
+ const s = i.shape;
4001
+ for (const u in s)
4002
+ r.properties[u] = $(s[u], t, {
4003
+ ...o,
4004
+ path: [...o.path, "properties", u]
4005
+ });
4006
+ const a = new Set(Object.keys(s)), c = new Set([...a].filter((u) => {
4007
+ const l = i.shape[u]._zod;
4008
+ return t.io === "input" ? l.optin === void 0 : l.optout === void 0;
4009
+ }));
4010
+ c.size > 0 && (r.required = Array.from(c)), i.catchall?._zod.def.type === "never" ? r.additionalProperties = !1 : i.catchall ? i.catchall && (r.additionalProperties = $(i.catchall, t, {
4011
+ ...o,
4012
+ path: [...o.path, "additionalProperties"]
4013
+ })) : t.io === "output" && (r.additionalProperties = !1);
4014
+ }, as = (e, t, n, o) => {
4015
+ const r = e._zod.def, i = r.inclusive === !1, s = r.options.map((a, c) => $(a, t, {
4016
+ ...o,
4017
+ path: [...o.path, i ? "oneOf" : "anyOf", c]
4018
+ }));
4019
+ i ? n.oneOf = s : n.anyOf = s;
4020
+ }, cs = (e, t, n, o) => {
4021
+ const r = e._zod.def, i = $(r.left, t, {
4022
+ ...o,
4023
+ path: [...o.path, "allOf", 0]
4024
+ }), s = $(r.right, t, {
4025
+ ...o,
4026
+ path: [...o.path, "allOf", 1]
4027
+ }), a = (u) => "allOf" in u && Object.keys(u).length === 1, c = [
4028
+ ...a(i) ? i.allOf : [i],
4029
+ ...a(s) ? s.allOf : [s]
4030
+ ];
4031
+ n.allOf = c;
4032
+ }, us = (e, t, n, o) => {
4033
+ const r = n, i = e._zod.def;
4034
+ r.type = "object";
4035
+ const s = i.keyType, c = s._zod.bag?.patterns;
4036
+ if (i.mode === "loose" && c && c.size > 0) {
4037
+ const l = $(i.valueType, t, {
4038
+ ...o,
4039
+ path: [...o.path, "patternProperties", "*"]
4040
+ });
4041
+ r.patternProperties = {};
4042
+ for (const f of c)
4043
+ r.patternProperties[f.source] = l;
4044
+ } else
4045
+ (t.target === "draft-07" || t.target === "draft-2020-12") && (r.propertyNames = $(i.keyType, t, {
4046
+ ...o,
4047
+ path: [...o.path, "propertyNames"]
4048
+ })), r.additionalProperties = $(i.valueType, t, {
4049
+ ...o,
4050
+ path: [...o.path, "additionalProperties"]
4051
+ });
4052
+ const u = s._zod.values;
4053
+ if (u) {
4054
+ const l = [...u].filter((f) => typeof f == "string" || typeof f == "number");
4055
+ l.length > 0 && (r.required = l);
4056
+ }
4057
+ }, ds = (e, t, n, o) => {
4058
+ const r = e._zod.def, i = $(r.innerType, t, o), s = t.seen.get(e);
4059
+ t.target === "openapi-3.0" ? (s.ref = r.innerType, n.nullable = !0) : n.anyOf = [i, { type: "null" }];
4060
+ }, ls = (e, t, n, o) => {
4061
+ const r = e._zod.def;
4062
+ $(r.innerType, t, o);
4063
+ const i = t.seen.get(e);
4064
+ i.ref = r.innerType;
4065
+ }, fs = (e, t, n, o) => {
4066
+ const r = e._zod.def;
4067
+ $(r.innerType, t, o);
4068
+ const i = t.seen.get(e);
4069
+ i.ref = r.innerType, n.default = JSON.parse(JSON.stringify(r.defaultValue));
4070
+ }, ps = (e, t, n, o) => {
4071
+ const r = e._zod.def;
4072
+ $(r.innerType, t, o);
4073
+ const i = t.seen.get(e);
4074
+ i.ref = r.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(r.defaultValue)));
4075
+ }, gs = (e, t, n, o) => {
4076
+ const r = e._zod.def;
4077
+ $(r.innerType, t, o);
4078
+ const i = t.seen.get(e);
4079
+ i.ref = r.innerType;
4080
+ let s;
4081
+ try {
4082
+ s = r.catchValue(void 0);
4083
+ } catch {
4084
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
4085
+ }
4086
+ n.default = s;
4087
+ }, hs = (e, t, n, o) => {
4088
+ const r = e._zod.def, i = t.io === "input" ? r.in._zod.def.type === "transform" ? r.out : r.in : r.out;
4089
+ $(i, t, o);
4090
+ const s = t.seen.get(e);
4091
+ s.ref = i;
4092
+ }, ms = (e, t, n, o) => {
4093
+ const r = e._zod.def;
4094
+ $(r.innerType, t, o);
4095
+ const i = t.seen.get(e);
4096
+ i.ref = r.innerType, n.readOnly = !0;
4097
+ }, Pt = (e, t, n, o) => {
4098
+ const r = e._zod.def;
4099
+ $(r.innerType, t, o);
4100
+ const i = t.seen.get(e);
4101
+ i.ref = r.innerType;
4102
+ }, _s = /* @__PURE__ */ d("ZodISODateTime", (e, t) => {
4103
+ yr.init(e, t), z.init(e, t);
4104
+ });
4105
+ function ys(e) {
4106
+ return /* @__PURE__ */ $i(_s, e);
4107
+ }
4108
+ const vs = /* @__PURE__ */ d("ZodISODate", (e, t) => {
4109
+ vr.init(e, t), z.init(e, t);
4110
+ });
4111
+ function ws(e) {
4112
+ return /* @__PURE__ */ Si(vs, e);
4113
+ }
4114
+ const bs = /* @__PURE__ */ d("ZodISOTime", (e, t) => {
4115
+ wr.init(e, t), z.init(e, t);
4116
+ });
4117
+ function ks(e) {
4118
+ return /* @__PURE__ */ Ei(bs, e);
4119
+ }
4120
+ const zs = /* @__PURE__ */ d("ZodISODuration", (e, t) => {
4121
+ br.init(e, t), z.init(e, t);
4122
+ });
4123
+ function $s(e) {
4124
+ return /* @__PURE__ */ Zi(zs, e);
4125
+ }
4126
+ const Ss = (e, t) => {
4127
+ ft.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
4128
+ format: {
4129
+ value: (n) => lo(e, n)
4130
+ // enumerable: false,
4131
+ },
4132
+ flatten: {
4133
+ value: (n) => uo(e, n)
4134
+ // enumerable: false,
4135
+ },
4136
+ addIssue: {
4137
+ value: (n) => {
4138
+ e.issues.push(n), e.message = JSON.stringify(e.issues, ge, 2);
4139
+ }
4140
+ // enumerable: false,
4141
+ },
4142
+ addIssues: {
4143
+ value: (n) => {
4144
+ e.issues.push(...n), e.message = JSON.stringify(e.issues, ge, 2);
4145
+ }
4146
+ // enumerable: false,
4147
+ },
4148
+ isEmpty: {
4149
+ get() {
4150
+ return e.issues.length === 0;
4151
+ }
4152
+ // enumerable: false,
4153
+ }
4154
+ });
4155
+ }, O = d("ZodError", Ss, {
4156
+ Parent: Error
4157
+ }), Es = /* @__PURE__ */ ze(O), Zs = /* @__PURE__ */ $e(O), Is = /* @__PURE__ */ ce(O), Ts = /* @__PURE__ */ ue(O), Os = /* @__PURE__ */ go(O), Ps = /* @__PURE__ */ ho(O), As = /* @__PURE__ */ mo(O), Ns = /* @__PURE__ */ _o(O), Cs = /* @__PURE__ */ yo(O), Rs = /* @__PURE__ */ vo(O), Ds = /* @__PURE__ */ wo(O), js = /* @__PURE__ */ bo(O), k = /* @__PURE__ */ d("ZodType", (e, t) => (b.init(e, t), Object.assign(e["~standard"], {
4158
+ jsonSchema: {
4159
+ input: ae(e, "input"),
4160
+ output: ae(e, "output")
4161
+ }
4162
+ }), e.toJSONSchema = Wi(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(L(t, {
4163
+ checks: [
4164
+ ...t.checks ?? [],
4165
+ ...n.map((o) => typeof o == "function" ? { _zod: { check: o, def: { check: "custom" }, onattach: [] } } : o)
4166
+ ]
4167
+ }), {
4168
+ parent: !0
4169
+ }), e.with = e.check, e.clone = (n, o) => U(e, n, o), e.brand = () => e, e.register = ((n, o) => (n.add(e, o), e)), e.parse = (n, o) => Es(e, n, o, { callee: e.parse }), e.safeParse = (n, o) => Is(e, n, o), e.parseAsync = async (n, o) => Zs(e, n, o, { callee: e.parseAsync }), e.safeParseAsync = async (n, o) => Ts(e, n, o), e.spa = e.safeParseAsync, e.encode = (n, o) => Os(e, n, o), e.decode = (n, o) => Ps(e, n, o), e.encodeAsync = async (n, o) => As(e, n, o), e.decodeAsync = async (n, o) => Ns(e, n, o), e.safeEncode = (n, o) => Cs(e, n, o), e.safeDecode = (n, o) => Rs(e, n, o), e.safeEncodeAsync = async (n, o) => Ds(e, n, o), e.safeDecodeAsync = async (n, o) => js(e, n, o), e.refine = (n, o) => e.check(Na(n, o)), e.superRefine = (n) => e.check(Ca(n)), e.overwrite = (n) => e.check(/* @__PURE__ */ W(n)), e.optional = () => Qe(e), e.exactOptional = () => wa(e), e.nullable = () => Xe(e), e.nullish = () => Qe(Xe(e)), e.nonoptional = (n) => Ea(e, n), e.array = () => ca(e), e.or = (n) => la([e, n]), e.and = (n) => pa(e, n), e.transform = (n) => et(e, ya(n)), e.default = (n) => za(e, n), e.prefault = (n) => Sa(e, n), e.catch = (n) => Ia(e, n), e.pipe = (n) => et(e, n), e.readonly = () => Pa(e), e.describe = (n) => {
4170
+ const o = e.clone();
4171
+ return Q.add(o, { description: n }), o;
4172
+ }, Object.defineProperty(e, "description", {
4173
+ get() {
4174
+ return Q.get(e)?.description;
4175
+ },
4176
+ configurable: !0
4177
+ }), e.meta = (...n) => {
4178
+ if (n.length === 0)
4179
+ return Q.get(e);
4180
+ const o = e.clone();
4181
+ return Q.add(o, n[0]), o;
4182
+ }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e.apply = (n) => n(e), e)), At = /* @__PURE__ */ d("_ZodString", (e, t) => {
4183
+ Se.init(e, t), k.init(e, t), e._zod.processJSONSchema = (o, r, i) => Ki(e, o, r);
4184
+ const n = e._zod.bag;
4185
+ e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(/* @__PURE__ */ Ni(...o)), e.includes = (...o) => e.check(/* @__PURE__ */ Di(...o)), e.startsWith = (...o) => e.check(/* @__PURE__ */ ji(...o)), e.endsWith = (...o) => e.check(/* @__PURE__ */ Li(...o)), e.min = (...o) => e.check(/* @__PURE__ */ se(...o)), e.max = (...o) => e.check(/* @__PURE__ */ Et(...o)), e.length = (...o) => e.check(/* @__PURE__ */ Zt(...o)), e.nonempty = (...o) => e.check(/* @__PURE__ */ se(1, ...o)), e.lowercase = (o) => e.check(/* @__PURE__ */ Ci(o)), e.uppercase = (o) => e.check(/* @__PURE__ */ Ri(o)), e.trim = () => e.check(/* @__PURE__ */ Mi()), e.normalize = (...o) => e.check(/* @__PURE__ */ Ui(...o)), e.toLowerCase = () => e.check(/* @__PURE__ */ Fi()), e.toUpperCase = () => e.check(/* @__PURE__ */ Ji()), e.slugify = () => e.check(/* @__PURE__ */ xi());
4186
+ }), Ls = /* @__PURE__ */ d("ZodString", (e, t) => {
4187
+ Se.init(e, t), At.init(e, t), e.email = (n) => e.check(/* @__PURE__ */ oi(Us, n)), e.url = (n) => e.check(/* @__PURE__ */ ci(Ms, n)), e.jwt = (n) => e.check(/* @__PURE__ */ zi(ta, n)), e.emoji = (n) => e.check(/* @__PURE__ */ ui(Fs, n)), e.guid = (n) => e.check(/* @__PURE__ */ Ve(He, n)), e.uuid = (n) => e.check(/* @__PURE__ */ ri(oe, n)), e.uuidv4 = (n) => e.check(/* @__PURE__ */ ii(oe, n)), e.uuidv6 = (n) => e.check(/* @__PURE__ */ si(oe, n)), e.uuidv7 = (n) => e.check(/* @__PURE__ */ ai(oe, n)), e.nanoid = (n) => e.check(/* @__PURE__ */ di(Js, n)), e.guid = (n) => e.check(/* @__PURE__ */ Ve(He, n)), e.cuid = (n) => e.check(/* @__PURE__ */ li(xs, n)), e.cuid2 = (n) => e.check(/* @__PURE__ */ fi(qs, n)), e.ulid = (n) => e.check(/* @__PURE__ */ pi(Vs, n)), e.base64 = (n) => e.check(/* @__PURE__ */ wi(Qs, n)), e.base64url = (n) => e.check(/* @__PURE__ */ bi(Xs, n)), e.xid = (n) => e.check(/* @__PURE__ */ gi(Bs, n)), e.ksuid = (n) => e.check(/* @__PURE__ */ hi(Gs, n)), e.ipv4 = (n) => e.check(/* @__PURE__ */ mi(Ws, n)), e.ipv6 = (n) => e.check(/* @__PURE__ */ _i(Hs, n)), e.cidrv4 = (n) => e.check(/* @__PURE__ */ yi(Ks, n)), e.cidrv6 = (n) => e.check(/* @__PURE__ */ vi(Ys, n)), e.e164 = (n) => e.check(/* @__PURE__ */ ki(ea, n)), e.datetime = (n) => e.check(ys(n)), e.date = (n) => e.check(ws(n)), e.time = (n) => e.check(ks(n)), e.duration = (n) => e.check($s(n));
4188
+ });
4189
+ function yc(e) {
4190
+ return /* @__PURE__ */ ni(Ls, e);
4191
+ }
4192
+ const z = /* @__PURE__ */ d("ZodStringFormat", (e, t) => {
4193
+ w.init(e, t), At.init(e, t);
4194
+ }), Us = /* @__PURE__ */ d("ZodEmail", (e, t) => {
4195
+ ur.init(e, t), z.init(e, t);
4196
+ }), He = /* @__PURE__ */ d("ZodGUID", (e, t) => {
4197
+ ar.init(e, t), z.init(e, t);
4198
+ }), oe = /* @__PURE__ */ d("ZodUUID", (e, t) => {
4199
+ cr.init(e, t), z.init(e, t);
4200
+ }), Ms = /* @__PURE__ */ d("ZodURL", (e, t) => {
4201
+ dr.init(e, t), z.init(e, t);
4202
+ }), Fs = /* @__PURE__ */ d("ZodEmoji", (e, t) => {
4203
+ lr.init(e, t), z.init(e, t);
4204
+ }), Js = /* @__PURE__ */ d("ZodNanoID", (e, t) => {
4205
+ fr.init(e, t), z.init(e, t);
4206
+ }), xs = /* @__PURE__ */ d("ZodCUID", (e, t) => {
4207
+ pr.init(e, t), z.init(e, t);
4208
+ }), qs = /* @__PURE__ */ d("ZodCUID2", (e, t) => {
4209
+ gr.init(e, t), z.init(e, t);
4210
+ }), Vs = /* @__PURE__ */ d("ZodULID", (e, t) => {
4211
+ hr.init(e, t), z.init(e, t);
4212
+ }), Bs = /* @__PURE__ */ d("ZodXID", (e, t) => {
4213
+ mr.init(e, t), z.init(e, t);
4214
+ }), Gs = /* @__PURE__ */ d("ZodKSUID", (e, t) => {
4215
+ _r.init(e, t), z.init(e, t);
4216
+ }), Ws = /* @__PURE__ */ d("ZodIPv4", (e, t) => {
4217
+ kr.init(e, t), z.init(e, t);
4218
+ }), Hs = /* @__PURE__ */ d("ZodIPv6", (e, t) => {
4219
+ zr.init(e, t), z.init(e, t);
4220
+ }), Ks = /* @__PURE__ */ d("ZodCIDRv4", (e, t) => {
4221
+ $r.init(e, t), z.init(e, t);
4222
+ }), Ys = /* @__PURE__ */ d("ZodCIDRv6", (e, t) => {
4223
+ Sr.init(e, t), z.init(e, t);
4224
+ }), Qs = /* @__PURE__ */ d("ZodBase64", (e, t) => {
4225
+ Er.init(e, t), z.init(e, t);
4226
+ }), Xs = /* @__PURE__ */ d("ZodBase64URL", (e, t) => {
4227
+ Ir.init(e, t), z.init(e, t);
4228
+ }), ea = /* @__PURE__ */ d("ZodE164", (e, t) => {
4229
+ Tr.init(e, t), z.init(e, t);
4230
+ }), ta = /* @__PURE__ */ d("ZodJWT", (e, t) => {
4231
+ Pr.init(e, t), z.init(e, t);
4232
+ }), Nt = /* @__PURE__ */ d("ZodNumber", (e, t) => {
4233
+ kt.init(e, t), k.init(e, t), e._zod.processJSONSchema = (o, r, i) => Yi(e, o, r), e.gt = (o, r) => e.check(/* @__PURE__ */ Ge(o, r)), e.gte = (o, r) => e.check(/* @__PURE__ */ pe(o, r)), e.min = (o, r) => e.check(/* @__PURE__ */ pe(o, r)), e.lt = (o, r) => e.check(/* @__PURE__ */ Be(o, r)), e.lte = (o, r) => e.check(/* @__PURE__ */ fe(o, r)), e.max = (o, r) => e.check(/* @__PURE__ */ fe(o, r)), e.int = (o) => e.check(Ke(o)), e.safe = (o) => e.check(Ke(o)), e.positive = (o) => e.check(/* @__PURE__ */ Ge(0, o)), e.nonnegative = (o) => e.check(/* @__PURE__ */ pe(0, o)), e.negative = (o) => e.check(/* @__PURE__ */ Be(0, o)), e.nonpositive = (o) => e.check(/* @__PURE__ */ fe(0, o)), e.multipleOf = (o, r) => e.check(/* @__PURE__ */ We(o, r)), e.step = (o, r) => e.check(/* @__PURE__ */ We(o, r)), e.finite = () => e;
4234
+ const n = e._zod.bag;
4235
+ e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
4236
+ });
4237
+ function vc(e) {
4238
+ return /* @__PURE__ */ Ii(Nt, e);
4239
+ }
4240
+ const na = /* @__PURE__ */ d("ZodNumberFormat", (e, t) => {
4241
+ Ar.init(e, t), Nt.init(e, t);
4242
+ });
4243
+ function Ke(e) {
4244
+ return /* @__PURE__ */ Ti(na, e);
4245
+ }
4246
+ const oa = /* @__PURE__ */ d("ZodBoolean", (e, t) => {
4247
+ Nr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => Qi(e, n, o);
4248
+ });
4249
+ function wc(e) {
4250
+ return /* @__PURE__ */ Oi(oa, e);
4251
+ }
4252
+ const ra = /* @__PURE__ */ d("ZodUnknown", (e, t) => {
4253
+ Cr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => es();
4254
+ });
4255
+ function Ye() {
4256
+ return /* @__PURE__ */ Pi(ra);
4257
+ }
4258
+ const ia = /* @__PURE__ */ d("ZodNever", (e, t) => {
4259
+ Rr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => Xi(e, n, o);
4260
+ });
4261
+ function sa(e) {
4262
+ return /* @__PURE__ */ Ai(ia, e);
4263
+ }
4264
+ const aa = /* @__PURE__ */ d("ZodArray", (e, t) => {
4265
+ Dr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => is(e, n, o, r), e.element = t.element, e.min = (n, o) => e.check(/* @__PURE__ */ se(n, o)), e.nonempty = (n) => e.check(/* @__PURE__ */ se(1, n)), e.max = (n, o) => e.check(/* @__PURE__ */ Et(n, o)), e.length = (n, o) => e.check(/* @__PURE__ */ Zt(n, o)), e.unwrap = () => e.element;
4266
+ });
4267
+ function ca(e, t) {
4268
+ return /* @__PURE__ */ qi(aa, e, t);
4269
+ }
4270
+ const ua = /* @__PURE__ */ d("ZodObject", (e, t) => {
4271
+ Lr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => ss(e, n, o, r), _(e, "shape", () => t.shape), e.keyof = () => ha(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: Ye() }), e.loose = () => e.clone({ ...e._zod.def, catchall: Ye() }), e.strict = () => e.clone({ ...e._zod.def, catchall: sa() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => ro(e, n), e.safeExtend = (n) => io(e, n), e.merge = (n) => so(e, n), e.pick = (n) => no(e, n), e.omit = (n) => oo(e, n), e.partial = (...n) => ao(Ct, e, n[0]), e.required = (...n) => co(Rt, e, n[0]);
4272
+ });
4273
+ function bc(e, t) {
4274
+ const n = {
4275
+ type: "object",
4276
+ shape: e ?? {},
4277
+ ...g(t)
4278
+ };
4279
+ return new ua(n);
4280
+ }
4281
+ const da = /* @__PURE__ */ d("ZodUnion", (e, t) => {
4282
+ Ur.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => as(e, n, o, r), e.options = t.options;
4283
+ });
4284
+ function la(e, t) {
4285
+ return new da({
4286
+ type: "union",
4287
+ options: e,
4288
+ ...g(t)
4289
+ });
4290
+ }
4291
+ const fa = /* @__PURE__ */ d("ZodIntersection", (e, t) => {
4292
+ Mr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => cs(e, n, o, r);
4293
+ });
4294
+ function pa(e, t) {
4295
+ return new fa({
4296
+ type: "intersection",
4297
+ left: e,
4298
+ right: t
4299
+ });
4300
+ }
4301
+ const ga = /* @__PURE__ */ d("ZodRecord", (e, t) => {
4302
+ Fr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => us(e, n, o, r), e.keyType = t.keyType, e.valueType = t.valueType;
4303
+ });
4304
+ function kc(e, t, n) {
4305
+ return new ga({
4306
+ type: "record",
4307
+ keyType: e,
4308
+ valueType: t,
4309
+ ...g(n)
4310
+ });
4311
+ }
4312
+ const me = /* @__PURE__ */ d("ZodEnum", (e, t) => {
4313
+ Jr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (o, r, i) => ts(e, o, r), e.enum = t.entries, e.options = Object.values(t.entries);
4314
+ const n = new Set(Object.keys(t.entries));
4315
+ e.extract = (o, r) => {
4316
+ const i = {};
4317
+ for (const s of o)
4318
+ if (n.has(s))
4319
+ i[s] = t.entries[s];
4320
+ else
4321
+ throw new Error(`Key ${s} not found in enum`);
4322
+ return new me({
4323
+ ...t,
4324
+ checks: [],
4325
+ ...g(r),
4326
+ entries: i
4327
+ });
4328
+ }, e.exclude = (o, r) => {
4329
+ const i = { ...t.entries };
4330
+ for (const s of o)
4331
+ if (n.has(s))
4332
+ delete i[s];
4333
+ else
4334
+ throw new Error(`Key ${s} not found in enum`);
4335
+ return new me({
4336
+ ...t,
4337
+ checks: [],
4338
+ ...g(r),
4339
+ entries: i
4340
+ });
4341
+ };
4342
+ });
4343
+ function ha(e, t) {
4344
+ const n = Array.isArray(e) ? Object.fromEntries(e.map((o) => [o, o])) : e;
4345
+ return new me({
4346
+ type: "enum",
4347
+ entries: n,
4348
+ ...g(t)
4349
+ });
4350
+ }
4351
+ const ma = /* @__PURE__ */ d("ZodLiteral", (e, t) => {
4352
+ xr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => ns(e, n, o), e.values = new Set(t.values), Object.defineProperty(e, "value", {
4353
+ get() {
4354
+ if (t.values.length > 1)
4355
+ throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
4356
+ return t.values[0];
4357
+ }
4358
+ });
4359
+ });
4360
+ function zc(e, t) {
4361
+ return new ma({
4362
+ type: "literal",
4363
+ values: Array.isArray(e) ? e : [e],
4364
+ ...g(t)
4365
+ });
4366
+ }
4367
+ const _a = /* @__PURE__ */ d("ZodTransform", (e, t) => {
4368
+ qr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => rs(e, n), e._zod.parse = (n, o) => {
4369
+ if (o.direction === "backward")
4370
+ throw new st(e.constructor.name);
4371
+ n.addIssue = (i) => {
4372
+ if (typeof i == "string")
4373
+ n.issues.push(ee(i, n.value, t));
4374
+ else {
4375
+ const s = i;
4376
+ s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(ee(s));
4377
+ }
4378
+ };
4379
+ const r = t.transform(n.value, n);
4380
+ return r instanceof Promise ? r.then((i) => (n.value = i, n)) : (n.value = r, n);
4381
+ };
4382
+ });
4383
+ function ya(e) {
4384
+ return new _a({
4385
+ type: "transform",
4386
+ transform: e
4387
+ });
4388
+ }
4389
+ const Ct = /* @__PURE__ */ d("ZodOptional", (e, t) => {
4390
+ St.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => Pt(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
4391
+ });
4392
+ function Qe(e) {
4393
+ return new Ct({
4394
+ type: "optional",
4395
+ innerType: e
4396
+ });
4397
+ }
4398
+ const va = /* @__PURE__ */ d("ZodExactOptional", (e, t) => {
4399
+ Vr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => Pt(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
4400
+ });
4401
+ function wa(e) {
4402
+ return new va({
4403
+ type: "optional",
4404
+ innerType: e
4405
+ });
4406
+ }
4407
+ const ba = /* @__PURE__ */ d("ZodNullable", (e, t) => {
4408
+ Br.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => ds(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
4409
+ });
4410
+ function Xe(e) {
4411
+ return new ba({
4412
+ type: "nullable",
4413
+ innerType: e
4414
+ });
4415
+ }
4416
+ const ka = /* @__PURE__ */ d("ZodDefault", (e, t) => {
4417
+ Gr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => fs(e, n, o, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
4418
+ });
4419
+ function za(e, t) {
4420
+ return new ka({
4421
+ type: "default",
4422
+ innerType: e,
4423
+ get defaultValue() {
4424
+ return typeof t == "function" ? t() : dt(t);
4425
+ }
4426
+ });
4427
+ }
4428
+ const $a = /* @__PURE__ */ d("ZodPrefault", (e, t) => {
4429
+ Wr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => ps(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
4430
+ });
4431
+ function Sa(e, t) {
4432
+ return new $a({
4433
+ type: "prefault",
4434
+ innerType: e,
4435
+ get defaultValue() {
4436
+ return typeof t == "function" ? t() : dt(t);
4437
+ }
4438
+ });
4439
+ }
4440
+ const Rt = /* @__PURE__ */ d("ZodNonOptional", (e, t) => {
4441
+ Hr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => ls(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
4442
+ });
4443
+ function Ea(e, t) {
4444
+ return new Rt({
4445
+ type: "nonoptional",
4446
+ innerType: e,
4447
+ ...g(t)
4448
+ });
4449
+ }
4450
+ const Za = /* @__PURE__ */ d("ZodCatch", (e, t) => {
4451
+ Kr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => gs(e, n, o, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
4452
+ });
4453
+ function Ia(e, t) {
4454
+ return new Za({
4455
+ type: "catch",
4456
+ innerType: e,
4457
+ catchValue: typeof t == "function" ? t : () => t
4458
+ });
4459
+ }
4460
+ const Ta = /* @__PURE__ */ d("ZodPipe", (e, t) => {
4461
+ Yr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => hs(e, n, o, r), e.in = t.in, e.out = t.out;
4462
+ });
4463
+ function et(e, t) {
4464
+ return new Ta({
4465
+ type: "pipe",
4466
+ in: e,
4467
+ out: t
4468
+ // ...util.normalizeParams(params),
4469
+ });
4470
+ }
4471
+ const Oa = /* @__PURE__ */ d("ZodReadonly", (e, t) => {
4472
+ Qr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => ms(e, n, o, r), e.unwrap = () => e._zod.def.innerType;
4473
+ });
4474
+ function Pa(e) {
4475
+ return new Oa({
4476
+ type: "readonly",
4477
+ innerType: e
4478
+ });
4479
+ }
4480
+ const Aa = /* @__PURE__ */ d("ZodCustom", (e, t) => {
4481
+ Xr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, o, r) => os(e, n);
4482
+ });
4483
+ function Na(e, t = {}) {
4484
+ return /* @__PURE__ */ Vi(Aa, e, t);
4485
+ }
4486
+ function Ca(e) {
4487
+ return /* @__PURE__ */ Bi(e);
4488
+ }
4489
+ export {
4490
+ Ut as $,
4491
+ Jn as A,
4492
+ ec as B,
4493
+ kc as C,
4494
+ fc as D,
4495
+ gc as E,
4496
+ mc as F,
4497
+ lc as G,
4498
+ uc as H,
4499
+ ac as I,
4500
+ sc as J,
4501
+ cc as K,
4502
+ hc as L,
4503
+ qa as M,
4504
+ Va as N,
4505
+ Wn as O,
4506
+ xa as P,
4507
+ Ma as Q,
4508
+ dc as R,
4509
+ pc as S,
4510
+ Ua as T,
4511
+ zc as U,
4512
+ Jt as V,
4513
+ Ha as W,
4514
+ Ee as X,
4515
+ Ft as Y,
4516
+ Mt as Z,
4517
+ ha as _,
4518
+ nc as a,
4519
+ jt as a0,
4520
+ Ht as a1,
4521
+ Ya as a2,
4522
+ X as a3,
4523
+ Lt as a4,
4524
+ j as a5,
4525
+ Gt as a6,
4526
+ Wt as a7,
4527
+ tc as a8,
4528
+ Qa as a9,
4529
+ _c as aa,
4530
+ Ka as ab,
4531
+ xt as ac,
4532
+ ic as b,
4533
+ nn as c,
4534
+ wc as d,
4535
+ Ye as e,
4536
+ ca as f,
4537
+ La as g,
4538
+ Fa as h,
4539
+ Pe as i,
4540
+ Wa as j,
4541
+ Xa as k,
4542
+ Ja as l,
4543
+ ja as m,
4544
+ Bn as n,
4545
+ bc as o,
4546
+ oc as p,
4547
+ rc as q,
4548
+ Da as r,
4549
+ yc as s,
4550
+ qn as t,
4551
+ la as u,
4552
+ vc as v,
4553
+ Ba as w,
4554
+ Gn as x,
4555
+ Ae as y,
4556
+ Ga as z
4557
+ };
4558
+ //# sourceMappingURL=schemas-SGuXpngy.js.map