@chaibuilder/pages 0.16.14 → 0.16.15

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 (94) hide show
  1. package/dist/{2AITGKQY-B7xwscsX.js → 2AITGKQY-2rt9M99C.js} +5 -5
  2. package/dist/{2AITGKQY-B9AnRLq_.cjs → 2AITGKQY-Cs6RBSPQ.cjs} +1 -1
  3. package/dist/{NCMVHL6D-CRMC-wXy.cjs → NCMVHL6D-CsC6nsSQ.cjs} +1 -1
  4. package/dist/{NCMVHL6D-B1mwht0Q.js → NCMVHL6D-vUfYKc6i.js} +4 -4
  5. package/dist/{ZDWCUMSJ-BqqPEOij.cjs → ZDWCUMSJ-B2OZjsr6.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-CxKNtXtp.js → ZDWCUMSJ-CzEWKlEU.js} +1 -1
  7. package/dist/active-in-another-tab-B0N5S-Bh.js +34 -0
  8. package/dist/active-in-another-tab-BK3cZf-x.cjs +1 -0
  9. package/dist/{add-new-language-page-D2a6GK-7.cjs → add-new-language-page-Dt1j-8Zg.cjs} +1 -1
  10. package/dist/{add-new-language-page-DD0qvJJs.js → add-new-language-page-YlqcCdlK.js} +20 -20
  11. package/dist/{add-new-page-01GDCaa4.cjs → add-new-page-DqhQUQBz.cjs} +1 -1
  12. package/dist/{add-new-page-CYtuChN1.js → add-new-page-aYomeid4.js} +1 -1
  13. package/dist/{ai-panel-content-DfdnvlS8.js → ai-panel-content-C6cH9rrC.js} +2 -2
  14. package/dist/{ai-panel-content-Ouz6pu_0.cjs → ai-panel-content-MOZmNIKP.cjs} +1 -1
  15. package/dist/{ai-panel-default-lang-Bi2fH1so.js → ai-panel-default-lang-BZHkFsox.js} +3 -3
  16. package/dist/{ai-panel-default-lang-N1pb8rzQ.cjs → ai-panel-default-lang-DOk_Q0IO.cjs} +2 -2
  17. package/dist/{ai-panel-other-lang-2JPRSyO1.js → ai-panel-other-lang-D2A46FTg.js} +3 -3
  18. package/dist/{ai-panel-other-lang-BysU1464.cjs → ai-panel-other-lang-qHrdvAMa.cjs} +1 -1
  19. package/dist/{ai-prompt-input-JeIqWZco.cjs → ai-prompt-input-BZSjjNJd.cjs} +1 -1
  20. package/dist/{ai-prompt-input-DadL_cng.js → ai-prompt-input-C6gDvvLQ.js} +2 -2
  21. package/dist/{ai-translation-prompt-CQb1L7NM.cjs → ai-translation-prompt-BqXo2CLp.cjs} +1 -1
  22. package/dist/{ai-translation-prompt-B0si-R0R.js → ai-translation-prompt-DTR0wbGt.js} +1 -1
  23. package/dist/continue-editing-in-this-client-C3T6Jzhi.cjs +1 -0
  24. package/dist/continue-editing-in-this-client-D2S1yCOM.js +24 -0
  25. package/dist/delete-page-BF1k60U2.js +70 -0
  26. package/dist/delete-page-x0DWKzsR.cjs +1 -0
  27. package/dist/{digital-asset-manager-B5FQGtGY.cjs → digital-asset-manager-BmlFt2T_.cjs} +1 -1
  28. package/dist/{digital-asset-manager-jfnmWRJj.js → digital-asset-manager-C8udwDBW.js} +1 -1
  29. package/dist/{duplicate-page-BNjfZ7Wd.cjs → duplicate-page-Dt_QZkTk.cjs} +1 -1
  30. package/dist/{duplicate-page-CERjaPIW.js → duplicate-page-u_6vUVo1.js} +13 -13
  31. package/dist/{dynamic-page-selector-Bpz_bvRu.cjs → dynamic-page-selector-Cgs_Y_Kl.cjs} +1 -1
  32. package/dist/{dynamic-page-selector-XEWV4iCf.js → dynamic-page-selector-DxBHmglP.js} +1 -1
  33. package/dist/index-BeWL6Sj6.cjs +5 -0
  34. package/dist/index-DI2Rwk5v.js +4820 -0
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.d.ts +1 -34
  37. package/dist/index.js +21 -22
  38. package/dist/{json-diff-viewer-H-2DkGza.cjs → json-diff-viewer-D2g0Yab2.cjs} +1 -1
  39. package/dist/{json-diff-viewer-DyvKomxd.js → json-diff-viewer-QdUwk7yF.js} +6 -6
  40. package/dist/{lang-panel-BWP5A-FD.js → lang-panel-B8OD0GiA.js} +24 -24
  41. package/dist/{lang-panel-DcZ7u4em.cjs → lang-panel-M2Zb01lF.cjs} +1 -1
  42. package/dist/{mark-as-template-1oVraE1x.js → mark-as-template-CJ1mlxYT.js} +7 -7
  43. package/dist/{mark-as-template-B_FyVRRO.cjs → mark-as-template-DONU52b1.cjs} +1 -1
  44. package/dist/{no-language-page-content-JO4YYUx7.cjs → no-language-page-content-DD9Ok2Ku.cjs} +1 -1
  45. package/dist/{no-language-page-content-CEci_4j7.js → no-language-page-content-Dtm37LTJ.js} +1 -1
  46. package/dist/no-language-page-dialog-D3dvenZ7.cjs +1 -0
  47. package/dist/no-language-page-dialog-Dj_z2_hF.js +10 -0
  48. package/dist/{page-creator-DJJFl7px.js → page-creator-DIMFISo4.js} +52 -52
  49. package/dist/{page-creator-BGgoOA92.cjs → page-creator-DTC66ujU.cjs} +1 -1
  50. package/dist/page-lock-CI6BYvF_.cjs +1 -0
  51. package/dist/page-lock-DUlNr3os.js +30 -0
  52. package/dist/page-locked-dialog-BKwULMV7.js +133 -0
  53. package/dist/page-locked-dialog-DorIbva0.cjs +1 -0
  54. package/dist/page-manager-new-lNVrLOJp.cjs +1 -0
  55. package/dist/page-manager-new-znvqI9_L.js +354 -0
  56. package/dist/{page-manager-search-and-filter-DbUoW8Di.js → page-manager-search-and-filter-C-_w7N27.js} +1 -1
  57. package/dist/{page-manager-search-and-filter-Dgh8iyGp.cjs → page-manager-search-and-filter-pe0q0qnZ.cjs} +1 -1
  58. package/dist/{page-revisions-content-CwoXXE53.cjs → page-revisions-content-Caaj5TEI.cjs} +1 -1
  59. package/dist/{page-revisions-content-CxEJGxLY.js → page-revisions-content-CyLjyxNU.js} +19 -19
  60. package/dist/pages.css +1 -1
  61. package/dist/{publish-pages-content-CfAlmivf.js → publish-pages-content-Bih1W9C4.js} +88 -88
  62. package/dist/publish-pages-content-D5beVcQI.cjs +1 -0
  63. package/dist/{save-to-lib-BCaBfh0I.js → save-to-lib-BwpkJcT2.js} +1 -1
  64. package/dist/{save-to-lib-DpyJA0y1.cjs → save-to-lib-DPAERsi4.cjs} +1 -1
  65. package/dist/{selected-block-display-BmNhvYKu.js → selected-block-display-GXSf3y2s.js} +1 -1
  66. package/dist/{selected-block-display-CqnwyGRp.cjs → selected-block-display-s99Y91qI.cjs} +1 -1
  67. package/dist/{seo-panel-BH8fcGqr.js → seo-panel-BurZA566.js} +61 -61
  68. package/dist/{seo-panel-D-nKfsRJ.cjs → seo-panel-BxUfalVy.cjs} +1 -1
  69. package/dist/{shared-json-ld-m_OsVv8h.cjs → shared-json-ld-BYAdrPeC.cjs} +1 -1
  70. package/dist/{shared-json-ld-zTDoJzUv.js → shared-json-ld-DHWdJvQd.js} +39 -39
  71. package/dist/{slug-input-vzNtu37S.cjs → slug-input-CR2B1kDJ.cjs} +1 -1
  72. package/dist/{slug-input-CumDDlCk.js → slug-input-Z_ny7bgX.js} +1 -1
  73. package/dist/take-over-request-CnEpToCM.cjs +1 -0
  74. package/dist/take-over-request-DF2JsIes.js +63 -0
  75. package/dist/{theme-panel-footer-CdUmjB-e.js → theme-panel-footer-5mxFeEua.js} +4 -4
  76. package/dist/{theme-panel-footer-CKccBcd9.cjs → theme-panel-footer-C2CjHoBu.cjs} +1 -1
  77. package/dist/{unmark-as-template-BNFOsxIg.cjs → unmark-as-template-Dn90g1eh.cjs} +1 -1
  78. package/dist/{unmark-as-template-6ew-7bf8.js → unmark-as-template-JRRUYTOY.js} +1 -1
  79. package/dist/{unpublish-page-BZQpTpU3.cjs → unpublish-page-C3C_rTRd.cjs} +1 -1
  80. package/dist/{unpublish-page-BomE76Wg.js → unpublish-page-FZ8rbi7u.js} +9 -9
  81. package/dist/{web-preview-jo8lnpEx.js → web-preview-CGBKG162.js} +1 -1
  82. package/dist/{web-preview-C5QTX7bS.cjs → web-preview-NdxC92Fk.cjs} +1 -1
  83. package/package.json +3 -3
  84. package/dist/delete-page-C8Nt7IYF.cjs +0 -1
  85. package/dist/delete-page-_96Di9yN.js +0 -40
  86. package/dist/index-Pdb5tSRL.cjs +0 -5
  87. package/dist/index-e9WlBH0R.js +0 -4960
  88. package/dist/page-lock-request-BoYzkcyt.cjs +0 -1
  89. package/dist/page-lock-request-WzpcD2ZN.js +0 -75
  90. package/dist/page-locked-by-dialog-Djvjp2Hx.js +0 -68
  91. package/dist/page-locked-by-dialog-bvI27OZ6.cjs +0 -1
  92. package/dist/page-manager-new-CMfGorRQ.cjs +0 -1
  93. package/dist/page-manager-new-DmVX0qLk.js +0 -354
  94. package/dist/publish-pages-content-BRu7qwAo.cjs +0 -1
@@ -0,0 +1,4820 @@
1
+ var Vn = (e) => {
2
+ throw TypeError(e);
3
+ };
4
+ var Hn = (e, t, n) => t.has(e) || Vn("Cannot " + n);
5
+ var A = (e, t, n) => (Hn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), O = (e, t, n) => t.has(e) ? Vn("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), G = (e, t, n, s) => (Hn(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
6
+ import { jsxs as m, Fragment as me, jsx as c } from "react/jsx-runtime";
7
+ import { get as H, reverse as Or, sortBy as Dr, find as ae, noop as ms, groupBy as xr, values as Es, first as ps, minBy as ys, keyBy as Rr, map as Kt, isEmpty as Te, compact as As, each as kr, upperCase as qn, filter as Ts, includes as Ur, has as Yt, pick as In, keys as Mr, pickBy as Br, endsWith as Fr, isArray as Kr, startCase as Vr, isFunction as Hr, cloneDeep as qr, isEqual as $r } from "lodash-es";
8
+ import * as Q from "react";
9
+ import Qr, { useMemo as q, useCallback as z, useState as K, useEffect as se, useRef as Ie, lazy as V, Suspense as X, createContext as zr, Component as jr, createElement as $n } from "react";
10
+ import { atom as pe, useAtom as ie } from "jotai";
11
+ import { useQuery as oe, useMutation as Y, useQueryClient as J, onlineManager as Ss, QueryClient as Wr, QueryClientProvider as Yr } from "@tanstack/react-query";
12
+ import { useLanguages as _e, useSavePage as ke, useTranslation as Pe, mergeClasses as Vt, usePermissions as _s, PERMISSIONS as Jr, useRightPanel as Zr, useChaiFeatureFlag as Xr, useIsPageLoaded as ea, registerChaiLibrary as ta, getBlocksFromHTML as na, registerChaiSidebarPanel as Gt, registerChaiFeatureFlag as rn, registerChaiTopBar as sa, registerChaiMediaManager as ra, registerChaiSaveToLibrary as aa, ChaiBuilderEditor as ia } from "@chaibuilder/sdk";
13
+ import { Tooltip as Jt, TooltipTrigger as Zt, Button as M, TooltipContent as Xt, Sheet as Ps, SheetContent as ws, SheetHeader as oa, SheetTitle as la, SheetDescription as ca, DropdownMenu as Ln, DropdownMenuTrigger as Nn, DropdownMenuContent as Cn, DropdownMenuItem as fe, Separator as ua, TooltipProvider as vs, SheetTrigger as da, Skeleton as Ot, Dialog as bs, HoverCard as fa, HoverCardTrigger as ha, HoverCardContent as ga, AlertDialog as ma, AlertDialogTrigger as Ea, AlertDialogContent as pa, AlertDialogHeader as ya, AlertDialogTitle as Aa, AlertDialogDescription as Ta, AlertDialogFooter as Sa, AlertDialogCancel as _a, AlertDialogAction as Pa, Popover as wa, PopoverTrigger as va, DialogContent as ba, DialogHeader as Ia, DialogTitle as La, Tabs as Na, TabsList as Ca, TabsTrigger as an, TabsContent as on, Textarea as Qn, Alert as Ga, AlertDescription as Oa } from "@chaibuilder/sdk/ui";
14
+ import { LogsIcon as Da, Folder as xa, Languages as zn, ChevronDown as En, Star as Ra, Plus as Is, History as ka, Play as Ua, Palette as Ma, CheckCircle as Ba, Loader as Ht, Save as Fa, Send as jn, Rocket as Wn, CopyPlusIcon as Ka, Pencil as Va, Power as Ha, Trash as qa, SquareLibrary as Yn, Hash as $a, File as Qa, MoreHorizontal as Jn, ExternalLink as za, LanguagesIcon as ja, User as Wa, X as Zn, Trash2 as Ya, ImageIcon as Xn, Code as Ja, Eye as Za, Share2 as Xa, FileCode2 as ei, AlertTriangle as ti } from "lucide-react";
15
+ import { toast as k } from "sonner";
16
+ import { useRegisteredChaiBlocks as ni, getDefaultBlockProps as si } from "@chaibuilder/runtime";
17
+ import { loadWebBlocks as ri } from "@chaibuilder/sdk/web-blocks";
18
+ const Dt = {
19
+ ab: "Abkhazian",
20
+ aa: "Afar",
21
+ af: "Afrikaans",
22
+ ak: "Akan",
23
+ sq: "Albanian",
24
+ am: "Amharic",
25
+ ar: "Arabic",
26
+ an: "Aragonese",
27
+ hy: "Armenian",
28
+ as: "Assamese",
29
+ av: "Avaric",
30
+ ae: "Avestan",
31
+ ay: "Aymara",
32
+ az: "Azerbaijani",
33
+ bm: "Bambara",
34
+ ba: "Bashkir",
35
+ eu: "Basque",
36
+ be: "Belarusian",
37
+ bn: "Bengali",
38
+ bh: "Bihari",
39
+ bi: "Bislama",
40
+ bs: "Bosnian",
41
+ br: "Breton",
42
+ bg: "Bulgarian",
43
+ my: "Burmese",
44
+ ca: "Catalan",
45
+ ch: "Chamorro",
46
+ ce: "Chechen",
47
+ ny: "Chichewa",
48
+ zh: "Chinese",
49
+ "zh-Hans": "Chinese (Simplified)",
50
+ "zh-Hant": "Chinese (Traditional)",
51
+ cv: "Chuvash",
52
+ kw: "Cornish",
53
+ co: "Corsican",
54
+ cr: "Cree",
55
+ hr: "Croatian",
56
+ cs: "Czech",
57
+ da: "Danish",
58
+ dv: "Maldivian",
59
+ nl: "Dutch",
60
+ dz: "Dzongkha",
61
+ en: "English",
62
+ eo: "Esperanto",
63
+ et: "Estonian",
64
+ ee: "Ewe",
65
+ fo: "Faroese",
66
+ fj: "Fijian",
67
+ fi: "Finnish",
68
+ fr: "French",
69
+ ff: "Fula, Pular",
70
+ gl: "Galician",
71
+ gd: "Gaelic (Scottish)",
72
+ gv: "Manx",
73
+ ka: "Georgian",
74
+ de: "German",
75
+ el: "Greek",
76
+ kl: "Kalaallisut",
77
+ gn: "Guarani",
78
+ gu: "Gujarati",
79
+ ht: "Haitian Creole",
80
+ ha: "Hausa",
81
+ he: "Hebrew",
82
+ hz: "Herero",
83
+ hi: "Hindi",
84
+ ho: "Hiri Motu",
85
+ hu: "Hungarian",
86
+ is: "Icelandic",
87
+ io: "Ido",
88
+ ig: "Igbo",
89
+ id: "Indonesian",
90
+ ia: "Interlingua",
91
+ ie: "Interlingue",
92
+ iu: "Inuktitut",
93
+ ik: "Inupiak",
94
+ ga: "Irish",
95
+ it: "Italian",
96
+ ja: "Japanese",
97
+ jv: "Javanese",
98
+ kn: "Kannada",
99
+ kr: "Kanuri",
100
+ ks: "Kashmiri",
101
+ kk: "Kazakh",
102
+ km: "Khmer",
103
+ ki: "Kikuyu",
104
+ rw: "Kinyarwanda",
105
+ rn: "Kirundi",
106
+ ky: "Kyrgyz",
107
+ kv: "Komi",
108
+ kg: "Kongo",
109
+ ko: "Korean",
110
+ ku: "Kurdish",
111
+ kj: "Kwanyama",
112
+ lo: "Lao",
113
+ la: "Latin",
114
+ lv: "Latvian",
115
+ li: "Limburgish",
116
+ ln: "Lingala",
117
+ lt: "Lithuanian",
118
+ lu: "Luga-Katanga",
119
+ lg: "Luganda, Ganda",
120
+ lb: "Luxembourgish",
121
+ mk: "Macedonian",
122
+ mg: "Malagasy",
123
+ ms: "Malay",
124
+ ml: "Malayalam",
125
+ mt: "Maltese",
126
+ mi: "Maori",
127
+ mr: "Marathi",
128
+ mh: "Marshallese",
129
+ mo: "Moldavian",
130
+ mn: "Mongolian",
131
+ na: "Nauru",
132
+ nv: "Navajo",
133
+ ng: "Ndonga",
134
+ nd: "Northern Ndebele",
135
+ ne: "Nepali",
136
+ no: "Norwegian",
137
+ nb: "Norwegian bokmål",
138
+ nn: "Norwegian nynorsk",
139
+ ii: "Sichuan Yi",
140
+ oc: "Occitan",
141
+ oj: "Ojibwe",
142
+ cu: "Old Church Slavonic",
143
+ or: "Oriya",
144
+ om: "Oromo",
145
+ os: "Ossetian",
146
+ pi: "Pāli",
147
+ ps: "Pashto, Pushto",
148
+ fa: "Persian (Farsi)",
149
+ pl: "Polish",
150
+ pt: "Portuguese",
151
+ pa: "Punjabi (Eastern)",
152
+ qu: "Quechua",
153
+ rm: "Romansh",
154
+ ro: "Romanian",
155
+ ru: "Russian",
156
+ se: "Sami",
157
+ sm: "Samoan",
158
+ sg: "Sango",
159
+ sa: "Sanskrit",
160
+ sr: "Serbian",
161
+ sh: "Serbo-Croatian",
162
+ st: "Sesotho",
163
+ tn: "Setswana",
164
+ sn: "Shona",
165
+ sd: "Sindhi",
166
+ si: "Sinhalese",
167
+ ss: "Swati",
168
+ sk: "Slovak",
169
+ sl: "Slovenian",
170
+ so: "Somali",
171
+ nr: "Southern Ndebele",
172
+ es: "Spanish",
173
+ su: "Sundanese",
174
+ sw: "Swahili (Kiswahili)",
175
+ sv: "Swedish",
176
+ tl: "Tagalog",
177
+ ty: "Tahitian",
178
+ tg: "Tajik",
179
+ ta: "Tamil",
180
+ tt: "Tatar",
181
+ te: "Telugu",
182
+ th: "Thai",
183
+ bo: "Tibetan",
184
+ ti: "Tigrinya",
185
+ to: "Tonga",
186
+ ts: "Tsonga",
187
+ tr: "Turkish",
188
+ tk: "Turkmen",
189
+ tw: "Twi",
190
+ ug: "Uyghur",
191
+ uk: "Ukrainian",
192
+ ur: "Urdu",
193
+ uz: "Uzbek",
194
+ ve: "Venda",
195
+ vi: "Vietnamese",
196
+ vo: "Volapük",
197
+ wa: "Wallon",
198
+ cy: "Welsh",
199
+ wo: "Wolof",
200
+ fy: "Western Frisian",
201
+ xh: "Xhosa",
202
+ yi: "Yiddish",
203
+ yo: "Yoruba",
204
+ za: "Zhuang, Chuang",
205
+ zu: "Zulu"
206
+ }, E = {
207
+ GET_GLOBAL_JSONLD_ITEMS: "GET_GLOBAL_JSONLD_ITEMS",
208
+ GENERATE_SEO_FIELD: "GENERATE_SEO_FIELD",
209
+ UPDATE_PAGE_METADATA: "UPDATE_PAGE_METADATA",
210
+ GET_BLOCK_ASYNC_PROPS: "GET_BLOCK_ASYNC_PROPS",
211
+ ASK_AI: "ASK_AI",
212
+ GET_DRAFT_PAGE: "GET_DRAFT_PAGE",
213
+ CREATE_PAGE: "CREATE_PAGE",
214
+ UPDATE_PAGE: "UPDATE_PAGE",
215
+ DELETE_PAGE: "DELETE_PAGE",
216
+ DUPLICATE_PAGE: "DUPLICATE_PAGE",
217
+ CHANGE_SLUG: "CHANGE_SLUG",
218
+ TAKE_OFFLINE: "TAKE_OFFLINE",
219
+ PUBLISH_PAGE: "PUBLISH_PAGE",
220
+ PUBLISH_CHANGES: "PUBLISH_CHANGES",
221
+ ADD_NEW_LANGUAGE: "ADD_NEW_LANGUAGE",
222
+ EDIT_LANGUAGE: "EDIT_LANGUAGE",
223
+ DELETE_LANGUAGE: "DELETE_LANGUAGE",
224
+ GET_CHANGES: "GET_CHANGES",
225
+ GET_SERVER_BLOCK: "GET_SERVER_BLOCK",
226
+ GET_LANGUAGE_PAGES: "GET_LANGUAGE_PAGES",
227
+ GET_PROJECT_PAGES: "GET_PROJECT_PAGES",
228
+ GET_WEBSITE_PAGES: "GET_WEBSITE_PAGES",
229
+ UPDATE_WEBSITE_SETTINGS: "UPDATE_WEBSITE_SETTINGS",
230
+ GET_COLLECTIONS: "GET_COLLECTIONS",
231
+ GET_PAGE_TYPES: "GET_PAGE_TYPES",
232
+ SEARCH_PAGES: "SEARCH_PAGES",
233
+ GET_WEBSITE_DRAFT_SETTINGS: "GET_WEBSITE_DRAFT_SETTINGS",
234
+ AI_CONTEXT: "AI_CONTEXT",
235
+ GET_WEBSITE_DATA: "GET_WEBSITE_DATA",
236
+ UPDATE_WEBSITE_DATA: "UPDATE_WEBSITE_DATA",
237
+ GET_CHAI_USER: "GET_CHAI_USER",
238
+ GET_SEO_FIELDS: "GET_SEO_FIELDS",
239
+ GET_BUILDER_PAGE_DATA: "GET_BUILDER_PAGE_DATA",
240
+ GET_PAGE_REVISIONS: "GET_PAGE_REVISIONS",
241
+ DELETE_PAGE_REVISION: "DELETE_PAGE_REVISION",
242
+ RESTORE_PAGE_REVISION: "RESTORE_PAGE_REVISION",
243
+ GET_REVISION_DATA: "GET_REVISION_DATA",
244
+ GET_PAGE_DATA: "GET_PAGE_DATA",
245
+ GET_COMPARE_DATA: "GET_COMPARE_DATA",
246
+ GET_ROLE_AND_PERMISSIONS: "GET_ROLE_AND_PERMISSIONS",
247
+ UPSERT_LIBRARY_ITEM: "UPSERT_LIBRARY_ITEM",
248
+ GET_LIBRARIES: "GET_LIBRARIES",
249
+ GET_LIBRARY_ITEM: "GET_LIBRARY_ITEM",
250
+ GET_LIBRARY_ITEMS: "GET_LIBRARY_ITEMS",
251
+ DELETE_LIBRARY_ITEM: "DELETE_LIBRARY_ITEM",
252
+ MARK_AS_TEMPLATE: "MARK_AS_TEMPLATE",
253
+ UNMARK_AS_TEMPLATE: "UNMARK_AS_TEMPLATE",
254
+ GET_TEMPLATES_BY_TYPE: "GET_TEMPLATES_BY_TYPE",
255
+ GET_DYNAMIC_PAGES: "GET_DYNAMIC_PAGES",
256
+ GET_APP_SHARED_JSONLD: "GET_APP_SHARED_JSONLD",
257
+ UPDATE_APP_SHARED_JSONLD: "UPDATE_APP_SHARED_JSONLD",
258
+ ADD_GLOBAL_SCHEMA: "ADD_GLOBAL_SCHEMA",
259
+ UPDATE_GLOBAL_SCHEMA: "UPDATE_GLOBAL_SCHEMA",
260
+ DELETE_GLOBAL_SCHEMA: "DELETE_GLOBAL_SCHEMA",
261
+ TOGGLE_PAGE_GLOBAL_SCHEMA: "TOGGLE_PAGE_GLOBAL_SCHEMA",
262
+ APPLY_SCHEMA_TO_ALL_PAGES: "APPLY_SCHEMA_TO_ALL_PAGES",
263
+ REMOVE_SCHEMA_FROM_ALL_PAGES: "REMOVE_SCHEMA_FROM_ALL_PAGES",
264
+ // DAM Actions
265
+ UPLOAD_ASSET: "UPLOAD_ASSET",
266
+ DELETE_ASSET: "DELETE_ASSET",
267
+ UPDATE_ASSET: "UPDATE_ASSET",
268
+ GET_ASSETS: "GET_ASSETS",
269
+ GET_ASSET: "GET_ASSET"
270
+ }, ai = pe({}), Gn = () => ie(ai), le = (e, t) => {
271
+ const [n] = Gn();
272
+ return q(() => H(n, e, t), [n, e, t]);
273
+ }, C = () => le("apiUrl", "/chai/api"), Ls = () => le("usersApiUrl", "/chai/users"), Kc = () => le("assetsApiUrl", "/chai/assets"), Ns = () => le("websocket", null), Cs = async (e, t, n = {}) => await fetch(e, {
274
+ method: "POST",
275
+ headers: {
276
+ "Content-Type": "application/json",
277
+ ...n
278
+ },
279
+ body: JSON.stringify(t)
280
+ });
281
+ if (import.meta.vitest) {
282
+ const { it: e, expect: t } = import.meta.vitest;
283
+ e("should fetch API", async () => {
284
+ const n = await Cs("/v1/api/chai", {
285
+ action: "test"
286
+ });
287
+ t(n).toBeDefined();
288
+ });
289
+ }
290
+ const Vc = () => {
291
+ const e = L(), t = C();
292
+ return z(
293
+ async ({
294
+ body: n,
295
+ headers: s = {},
296
+ url: r = t,
297
+ streamResponse: a = !1
298
+ }) => e(r, n, s, a),
299
+ [e]
300
+ );
301
+ }, L = () => {
302
+ const e = le("onLogout"), t = le("getAccessToken"), n = C();
303
+ return z(
304
+ async (s = n, r, a = {}, i = !1) => {
305
+ const o = await t();
306
+ try {
307
+ const l = H(r, "action", "").toLowerCase(), d = await Cs(s + (l ? `?action=${l}` : ""), r, {
308
+ ...a,
309
+ Authorization: `Bearer ${o}`
310
+ });
311
+ if (i)
312
+ return d;
313
+ if (d.status === 401)
314
+ return console.log("401 Response", d), e(), window.location.reload(), null;
315
+ if (!d.ok) {
316
+ const u = await d.json();
317
+ throw console.error(`API Error (${d.status}):`, u), {
318
+ status: d.status,
319
+ statusText: d.statusText,
320
+ ...u,
321
+ message: u.error || u.message || `Server error: ${d.status}`
322
+ };
323
+ }
324
+ return await d.json();
325
+ } catch (l) {
326
+ throw console.error("API request failed:", r, l), l;
327
+ }
328
+ },
329
+ [e, t]
330
+ );
331
+ };
332
+ function we() {
333
+ const [e, t] = K(
334
+ new URLSearchParams(window.location.search)
335
+ );
336
+ return se(() => {
337
+ const n = () => {
338
+ t(new URLSearchParams(window.location.search));
339
+ };
340
+ return window.addEventListener("popstate", n), () => {
341
+ window.removeEventListener("popstate", n);
342
+ };
343
+ }, []), [e, t];
344
+ }
345
+ const Me = (e) => {
346
+ const t = C(), [n] = we(), s = e ?? n.get("page"), r = L();
347
+ return oe({
348
+ queryKey: [E.GET_LANGUAGE_PAGES, s],
349
+ staleTime: 1 / 0,
350
+ gcTime: 0,
351
+ placeholderData: [],
352
+ queryFn: async () => {
353
+ if (!s) return null;
354
+ const a = await r(t, {
355
+ action: E.GET_LANGUAGE_PAGES,
356
+ data: { id: s }
357
+ });
358
+ return Or(Dr(a, "primaryPage"));
359
+ },
360
+ enabled: !!s
361
+ });
362
+ }, ii = pe(
363
+ null
364
+ ), Gs = () => ie(ii), On = () => {
365
+ const [e] = Gs();
366
+ return (e == null ? void 0 : e.slug) || "";
367
+ };
368
+ function oi(e, t) {
369
+ const [n, s] = K(e);
370
+ return se(() => {
371
+ const r = setTimeout(() => s(e), t);
372
+ return () => clearTimeout(r);
373
+ }, [e, t]), n;
374
+ }
375
+ const li = ({ query: e, uuid: t }) => {
376
+ const { selectedLang: n, fallbackLang: s } = _e(), { data: r } = ce(), a = r == null ? void 0 : r.pageType, i = C(), o = L(), { data: l, isFetching: d } = oe({
377
+ queryKey: [E.GET_DYNAMIC_PAGES, e, a, t],
378
+ staleTime: 60 * 60 * 1e3,
379
+ placeholderData: [],
380
+ queryFn: async () => await o(i, {
381
+ action: E.GET_DYNAMIC_PAGES,
382
+ data: { query: e, pageType: a, uuid: t }
383
+ }) || [],
384
+ enabled: !!a
385
+ }), u = q(() => n === "" ? l.filter((f) => f.lang === "" || f.lang === s) : l.filter((f) => f.lang === n), [n, s, l]);
386
+ return { allLangPages: l, data: u, isFetching: d };
387
+ }, ci = () => {
388
+ const { selectedLang: e, fallbackLang: t } = _e(), [n, s] = Gs(), [r, a] = K(""), i = oi(r, 500), { allLangPages: o, data: l, isFetching: d } = li({ query: i }), u = z((h) => s(h), [s]), f = z((h) => a(h), [a]), g = z(() => {
389
+ if (!n) return;
390
+ const h = !(n != null && n.primaryPage), p = e.length === 0, T = h ? n == null ? void 0 : n.id : n == null ? void 0 : n.primaryPage, D = o.filter(
391
+ (y) => (y == null ? void 0 : y.primaryPage) === T || y.id === T
392
+ ).find((y) => p ? y.lang === e || y.lang === t : y.lang === e);
393
+ s(D || n);
394
+ }, [n, e, o, s, t]);
395
+ return {
396
+ isFetching: d,
397
+ dynamicPage: n,
398
+ searchQuery: r,
399
+ selectedLang: e,
400
+ dynamicPages: l,
401
+ allLangPages: o,
402
+ updateDynamicPage: u,
403
+ updateSearchQuery: f,
404
+ onChangeLanguage: g
405
+ };
406
+ }, ui = pe({ lastSaved: void 0 }), Os = () => ie(ui), ce = () => {
407
+ const [e] = we(), t = e.get("page"), { data: n, isFetching: s } = Me();
408
+ return { data: q(() => ({ ...ae(n, { id: t }) || {} }), [n, t]), isFetching: s };
409
+ }, Ne = () => {
410
+ const [e] = we(), t = e.get("lang") ?? "", { data: n, isFetching: s } = Me();
411
+ return { data: q(() => ae(n, { lang: t }) || {}, [n, t]), isFetching: s };
412
+ }, di = pe({}), fi = () => ie(di), hi = () => {
413
+ const { data: e } = Ne(), t = On(), n = le("getLiveUrl", ms), s = e == null ? void 0 : e.slug, r = n(s || "/");
414
+ return t ? r + t : r;
415
+ }, Be = () => {
416
+ const e = C(), t = L();
417
+ return oe({
418
+ queryKey: [E.GET_WEBSITE_DRAFT_SETTINGS],
419
+ staleTime: 5 * 60 * 1e3,
420
+ placeholderData: {
421
+ languages: [],
422
+ theme: { fontFamily: "", borderRadius: "", colors: {} },
423
+ appKey: "",
424
+ fallbackLang: ""
425
+ },
426
+ queryFn: async () => t(e, {
427
+ action: E.GET_WEBSITE_DRAFT_SETTINGS,
428
+ data: { draft: !0 }
429
+ })
430
+ });
431
+ };
432
+ function Ds(e, t, n = !1) {
433
+ const s = e.toString() ? `?${e.toString()}` : "/";
434
+ n ? window.history.replaceState(null, "", s) : window.history.pushState({}, "", s), t(e), window.dispatchEvent(new PopStateEvent("popstate"));
435
+ }
436
+ const Dn = pe(null), xn = () => {
437
+ const e = le("currentUser"), t = le("onLogout");
438
+ return {
439
+ isLoggedIn: !!e,
440
+ user: e,
441
+ logout: t
442
+ };
443
+ }, ee = {
444
+ LOCKED: "LOCKED",
445
+ EDITING: "EDITING",
446
+ CHECKING: "CHECKING",
447
+ TAKE_OVER_REQUESTED: "TAKE_OVER_REQUESTED",
448
+ ACTIVE_IN_ANOTHER_TAB: "ACTIVE_IN_ANOTHER_TAB",
449
+ FORCE_TAKE_OVER: "FORCE_TAKE_OVER",
450
+ CONNECTION_LOST: "CONNECTION_LOST"
451
+ }, ne = {
452
+ FORCE_TAKE_OVER: "FORCE_TAKE_OVER",
453
+ TAKE_OVER_REQUEST: "TAKE_OVER_REQUEST",
454
+ TAKE_OVER_APPROVED: "TAKE_OVER_APPROVED",
455
+ TAKE_OVER_REJECTED: "TAKE_OVER_REJECTED",
456
+ FORCE_TAKE_OVER_REQUEST: "FORCE_TAKE_OVER_REQUEST",
457
+ CONTINUE_EDITING_IN_THIS_CLIENT: "CONTINUE_EDITING_IN_THIS_CLIENT",
458
+ CONTINUE_EDITING_IN_THIS_TAB_REQUEST: "CONTINUE_EDITING_IN_THIS_TAB_REQUEST"
459
+ }, gi = ["sync", "join", "leave"], mi = [
460
+ ne.FORCE_TAKE_OVER,
461
+ ne.TAKE_OVER_REQUEST,
462
+ ne.TAKE_OVER_APPROVED,
463
+ ne.TAKE_OVER_REJECTED,
464
+ ne.FORCE_TAKE_OVER_REQUEST,
465
+ ne.CONTINUE_EDITING_IN_THIS_CLIENT,
466
+ ne.CONTINUE_EDITING_IN_THIS_TAB_REQUEST
467
+ ], Ei = pe({}), xs = pe(null), pi = pe(ee.CHECKING), yi = pe({}), Ai = (e) => {
468
+ const t = {}, n = xr(Es(e).map(ps).filter(Boolean), "pageId");
469
+ return Object.entries(n).forEach(
470
+ ([s, r]) => t[s] = ys(r, "onlineAt")
471
+ ), t;
472
+ }, Ti = (e) => {
473
+ const t = ys(Es(e).map(ps).filter(Boolean), "onlineAt"), n = t == null ? void 0 : t.onlineAt;
474
+ return n ? n - 100 : +/* @__PURE__ */ new Date() - 1e3 * 60 * 60 * 4;
475
+ }, en = () => {
476
+ const { user: e } = xn();
477
+ return e == null ? void 0 : e.id;
478
+ }, Si = () => {
479
+ const { data: e } = Be();
480
+ return `WEBSITE:${e == null ? void 0 : e.appKey}`;
481
+ }, Nt = () => {
482
+ const { data: e } = ce();
483
+ return e == null ? void 0 : e.id;
484
+ }, Ue = crypto.randomUUID();
485
+ let ln = null;
486
+ const Rs = () => {
487
+ const [e, t] = ie(Ei);
488
+ return { pageToUser: e, setPageToUser: t };
489
+ }, he = () => {
490
+ const [e, t] = ie(pi), n = [ee.LOCKED, ee.ACTIVE_IN_ANOTHER_TAB].includes(e), s = [ee.EDITING].includes(e);
491
+ return { pageStatus: e, setPageStatus: t, isLocked: n, isEditing: s };
492
+ }, ks = () => {
493
+ const [e, t] = ie(yi);
494
+ return { pageLockMeta: e, setPageLockMeta: t };
495
+ }, _i = () => {
496
+ const e = Nt(), { pageToUser: t } = Rs();
497
+ return q(() => t[e], [t, e]);
498
+ }, Rn = () => {
499
+ const e = Ns(), { setPageStatus: t } = he(), [n] = ie(xs);
500
+ return se(() => {
501
+ if (clearTimeout(ln), !e)
502
+ return ln = setTimeout(() => {
503
+ e || t(ee.EDITING);
504
+ }, 500), () => clearTimeout(ln);
505
+ }, [e, t]), n;
506
+ }, Pi = () => {
507
+ const e = Nt(), t = en(), n = Rn(), { setPageToUser: s } = Rs(), { setPageStatus: r, pageStatus: a } = he(), i = Ie(e);
508
+ return i.current = e, z(
509
+ (o) => {
510
+ const l = o || n;
511
+ if (!l) return [];
512
+ const d = l == null ? void 0 : l.presenceState(), u = Ai(d);
513
+ s(u);
514
+ const f = u[i.current];
515
+ if (!f)
516
+ r(ee.CHECKING);
517
+ else if (!t)
518
+ r(ee.CHECKING);
519
+ else if (f.userId === t && f.clientId === Ue) {
520
+ if (a === ee.TAKE_OVER_REQUESTED)
521
+ return;
522
+ r(ee.EDITING);
523
+ } else f.userId === t && f.clientId !== Ue ? r(ee.ACTIVE_IN_ANOTHER_TAB) : r(ee.LOCKED);
524
+ },
525
+ [n, s, r, t, a]
526
+ );
527
+ }, wi = () => {
528
+ const e = en(), t = Nt(), n = Rn(), s = _i(), { setPageLockMeta: r } = ks(), a = Ie(t);
529
+ return a.current = t, z(
530
+ async (i, o) => {
531
+ if (!n) return;
532
+ const l = o || {};
533
+ l.userId = e, l.pageId = a.current, l.senderClientId = Ue, l.receiverClientId = (o == null ? void 0 : o.requestingClientId) || (s == null ? void 0 : s.clientId), await n.send({ event: i, payload: l, type: "broadcast" }), r({});
534
+ },
535
+ [n, e, s, r]
536
+ );
537
+ }, vi = () => {
538
+ const e = en(), t = Nt(), n = Rn(), { setPageStatus: s } = he(), { setPageLockMeta: r } = ks(), a = wi(), i = Ie(t), { savePageAsync: o } = ke();
539
+ return i.current = t, z(
540
+ (l) => async ({ payload: d }) => {
541
+ const u = d || {};
542
+ if (!(!(u != null && u.pageId) || (u == null ? void 0 : u.pageId) !== i.current || (u == null ? void 0 : u.receiverClientId) !== Ue))
543
+ switch (r({}), l) {
544
+ case ne.FORCE_TAKE_OVER_REQUEST:
545
+ case ne.CONTINUE_EDITING_IN_THIS_TAB_REQUEST: {
546
+ try {
547
+ await o(!0);
548
+ } catch (f) {
549
+ console.error("Failed to save page before releasing lock:", f);
550
+ }
551
+ await a(ne.CONTINUE_EDITING_IN_THIS_CLIENT, { requestingClientId: u == null ? void 0 : u.senderClientId }), setTimeout(() => r({ type: l }), 0);
552
+ break;
553
+ }
554
+ case ne.TAKE_OVER_REQUEST: {
555
+ r({ requestingUserId: u == null ? void 0 : u.userId, requestingClientId: u == null ? void 0 : u.senderClientId }), s(ee.TAKE_OVER_REQUESTED);
556
+ break;
557
+ }
558
+ case ne.CONTINUE_EDITING_IN_THIS_CLIENT: {
559
+ const f = Ti(n == null ? void 0 : n.presenceState());
560
+ s(ee.CHECKING), await (n == null ? void 0 : n.track({ onlineAt: f, pageId: i.current, userId: e, clientId: Ue }));
561
+ break;
562
+ }
563
+ case ne.TAKE_OVER_REJECTED: {
564
+ r({ type: ne.TAKE_OVER_REJECTED });
565
+ break;
566
+ }
567
+ }
568
+ },
569
+ [a, r, s, n, e, o]
570
+ );
571
+ }, Hc = () => {
572
+ const e = Ns(), t = en(), n = Nt(), s = Si(), [r, a] = ie(xs), { setPageStatus: i } = he(), o = vi(), l = Pi(), d = Ie(o), u = Ie(l);
573
+ se(() => {
574
+ d.current = o, u.current = l;
575
+ }, [o, l]), se(() => {
576
+ if (!e || !t || !s || r && r.topic === s) return;
577
+ const f = e.channel(s, {
578
+ config: { presence: { key: Ue } }
579
+ });
580
+ return mi.forEach((g) => {
581
+ f.on("broadcast", { event: g }, (h) => {
582
+ d.current(g)(h);
583
+ });
584
+ }), gi.forEach((g) => {
585
+ f.on("presence", { event: g }, () => {
586
+ u.current(f);
587
+ });
588
+ }), f.subscribe(async (g) => {
589
+ g === "SUBSCRIBED" ? a(f) : (g === "CHANNEL_ERROR" || g === "TIMED_OUT") && (k.error("Realtime connection failed. Please reload the page.", {
590
+ id: "realtime-connection-error",
591
+ duration: 1 / 0,
592
+ action: {
593
+ label: "Reload",
594
+ onClick: () => window.location.reload()
595
+ },
596
+ position: "top-center"
597
+ }), a(null), i(ee.CONNECTION_LOST));
598
+ }), () => {
599
+ f.unsubscribe(), a(null);
600
+ };
601
+ }, [e, t, s, a]), se(() => (r && n && t && r.track({
602
+ pageId: n,
603
+ userId: t,
604
+ clientId: Ue,
605
+ onlineAt: +/* @__PURE__ */ new Date()
606
+ }), () => {
607
+ r && n && r.untrack();
608
+ }), [r, n, t]);
609
+ }, kn = () => {
610
+ const { data: e } = Be();
611
+ return q(
612
+ () => (e == null ? void 0 : e.fallbackLang) || "en",
613
+ [e]
614
+ );
615
+ }, Us = () => {
616
+ const e = L(), t = C();
617
+ return oe({
618
+ queryKey: [E.GET_WEBSITE_PAGES],
619
+ staleTime: 1e3 * 60 * 5,
620
+ queryFn: async () => e(t, { action: E.GET_WEBSITE_PAGES }) || [],
621
+ placeholderData: (n) => n || []
622
+ });
623
+ }, qc = (e) => {
624
+ const t = L(), n = C(), s = kn();
625
+ return oe({
626
+ queryKey: [E.GET_WEBSITE_PAGES, e, s],
627
+ staleTime: 1e3 * 60 * 5,
628
+ enabled: !!e,
629
+ queryFn: async () => {
630
+ if (s === e) return {};
631
+ const r = await t(n, { action: E.GET_WEBSITE_PAGES, data: { lang: e } }) || [];
632
+ return Rr(
633
+ Kt(r, (a) => ({ ...a, lang: e })),
634
+ "primaryPage"
635
+ );
636
+ },
637
+ placeholderData: (r) => r || {}
638
+ });
639
+ }, bi = V(() => import("./page-manager-new-znvqI9_L.js")), Ms = ({ children: e }) => {
640
+ const { t } = Pe(), [n, s] = we(), r = n.get("page"), { data: a, isFetching: i } = ce(), { data: o, isFetching: l } = Us(), [d, u] = K(!1), [f, g] = K(!0), { savePage: h } = ke(), p = !!r && !Te(a), { isLocked: T } = he(), S = q(() => {
641
+ if (!o || l) return !1;
642
+ const v = o.find((U) => U.slug === "/");
643
+ return v == null ? void 0 : v.id;
644
+ }, [o, l]);
645
+ se(() => {
646
+ if (l || !S || o.some((b) => b.id === r)) return;
647
+ const U = new URLSearchParams({ page: S });
648
+ Ds(U, s), !l && o && g(!1);
649
+ }, [r, l, o, S, s]);
650
+ const D = !f && !r, y = !f && !i && Te(a), w = d || D || y;
651
+ return /* @__PURE__ */ m(me, { children: [
652
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-x-1", children: /* @__PURE__ */ c("div", { className: "relative", children: /* @__PURE__ */ m(Jt, { children: [
653
+ /* @__PURE__ */ c(
654
+ Zt,
655
+ {
656
+ asChild: !0,
657
+ onClick: () => {
658
+ T || h(), u(!0);
659
+ },
660
+ children: e || /* @__PURE__ */ c(M, { variant: "outline", className: "flex w-full items-center space-x-2 py-1", children: /* @__PURE__ */ c(Da, { className: "h-4 w-4" }) }, "template-viewer")
661
+ }
662
+ ),
663
+ /* @__PURE__ */ c(Xt, { side: "right", children: /* @__PURE__ */ c("p", { children: t("Open pages manager") }) })
664
+ ] }) }) }),
665
+ /* @__PURE__ */ c(Ps, { open: w, onOpenChange: (v) => !v && p && u(!1), children: /* @__PURE__ */ m(
666
+ ws,
667
+ {
668
+ side: "left",
669
+ "aria-describedby": "pages-manager-description",
670
+ className: `z-50 !min-w-[50vh] !max-w-[800px] border-border p-0 ${p ? "" : "sheet-hide-close-btn"}`,
671
+ children: [
672
+ /* @__PURE__ */ m(oa, { className: "mb-3 px-4 pt-4", children: [
673
+ /* @__PURE__ */ m(la, { className: "flex items-center gap-2 text-sm font-semibold", children: [
674
+ /* @__PURE__ */ c("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ c(xa, { className: "h-4 w-4" }) }),
675
+ /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
676
+ /* @__PURE__ */ c("span", { className: "text-sm font-semibold", children: t("Pages") }),
677
+ /* @__PURE__ */ c("span", { id: "pages-manager-description", className: "text-xs font-normal text-muted-foreground", children: t("Manage your site structure") })
678
+ ] })
679
+ ] }),
680
+ /* @__PURE__ */ c(ca, { className: "sr-only", children: t("Manage your site structure") })
681
+ ] }),
682
+ /* @__PURE__ */ c("div", { className: "h-[calc(100vh-80px)] overflow-y-auto", children: w && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(bi, { close: () => u(!1) }) }) })
683
+ ]
684
+ }
685
+ ) })
686
+ ] });
687
+ }, Ii = V(() => import("./add-new-language-page-YlqcCdlK.js")), Li = () => {
688
+ const e = le("topLeftCorner", null);
689
+ return e ? /* @__PURE__ */ c("div", { className: "max-h-9 w-full overflow-hidden pr-2", children: Qr.createElement(e, {}) }) : null;
690
+ }, Ni = ({
691
+ showAdd: e = !0,
692
+ variant: t = "ghost",
693
+ goToDefaultLang: n = !1
694
+ }) => {
695
+ const { fallbackLang: s, languages: r, selectedLang: a, setSelectedLang: i } = _e(), o = Te(a) ? s : a, [, l] = we(), { isLocked: d } = he(), { t: u } = Pe();
696
+ se(() => {
697
+ const y = new URLSearchParams(window.location.search), w = y.get("lang");
698
+ w && (r.includes(w) ? i(w) : (y.delete("lang"), l(y), i("")));
699
+ }, [r, l, i]);
700
+ const [, f] = ie(Dn), { data: g } = ce(), { data: h } = Be(), { data: p } = Me(), T = q(() => {
701
+ const y = As(
702
+ Kt(H(h, "languages"), (w) => {
703
+ const v = ae(p, { lang: w });
704
+ return {
705
+ key: w,
706
+ value: H(Dt, w, w),
707
+ isLangPageAdded: !!v
708
+ };
709
+ })
710
+ ).filter(Boolean);
711
+ return [
712
+ {
713
+ key: s,
714
+ value: H(Dt, s),
715
+ isLangPageAdded: !0
716
+ },
717
+ ...y
718
+ ];
719
+ }, [s, p, h]), S = (y) => {
720
+ if (document.querySelector('[data-panel-id="seo"]')) {
721
+ const v = new CustomEvent("seo-language-switch-check", {
722
+ detail: {
723
+ fromLang: o,
724
+ toLang: y,
725
+ switchHandler: () => D(y)
726
+ }
727
+ });
728
+ window.dispatchEvent(v);
729
+ return;
730
+ }
731
+ D(y);
732
+ }, D = (y) => {
733
+ i(y);
734
+ const w = new URLSearchParams(window.location.search);
735
+ y === s ? w.delete("lang") : w.set("lang", y), Ds(w, l);
736
+ };
737
+ return Te(r) ? null : d ? /* @__PURE__ */ m(M, { variant: "ghost", size: "sm", className: "ml-px h-max cursor-not-allowed gap-2 py-1.5 opacity-50", children: [
738
+ /* @__PURE__ */ c(zn, { className: "h-4 w-4" }),
739
+ H(Dt, o, o),
740
+ /* @__PURE__ */ c(En, { className: "h-4 w-4" })
741
+ ] }) : n ? /* @__PURE__ */ c(M, { onClick: () => D(s), variant: "link", size: "sm", children: u("Switch to default language") }) : /* @__PURE__ */ c(me, { children: /* @__PURE__ */ m(Ln, { children: [
742
+ /* @__PURE__ */ c(Nn, { asChild: !0, className: "focus:outline-none", children: /* @__PURE__ */ m(
743
+ M,
744
+ {
745
+ disabled: !!d,
746
+ variant: t,
747
+ size: "sm",
748
+ className: "ml-px h-max gap-2 py-1.5",
749
+ children: [
750
+ /* @__PURE__ */ c(zn, { className: "h-4 w-4" }),
751
+ H(Dt, o, o),
752
+ /* @__PURE__ */ c(En, { className: "h-4 w-4" })
753
+ ]
754
+ }
755
+ ) }),
756
+ /* @__PURE__ */ m(Cn, { className: "space-y-1 border-border", children: [
757
+ Kt(
758
+ T.filter((y) => y.isLangPageAdded),
759
+ (y) => /* @__PURE__ */ m(
760
+ fe,
761
+ {
762
+ className: Vt(
763
+ "flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",
764
+ y.key === o && "!bg-gray-200 text-gray-700"
765
+ ),
766
+ onClick: () => S(y.key),
767
+ children: [
768
+ /* @__PURE__ */ c("div", { className: "text-slate-600", children: y.value }),
769
+ y.key === s && /* @__PURE__ */ m("small", { className: "flex items-center gap-x-1 text-[9px] leading-none text-orange-500", children: [
770
+ /* @__PURE__ */ c(Ra, { fill: "orange", className: "h-2 w-2" }),
771
+ "Primary"
772
+ ] })
773
+ ]
774
+ },
775
+ y.value
776
+ )
777
+ ),
778
+ e && !Te(T.filter((y) => !y.isLangPageAdded)) && /* @__PURE__ */ m(me, { children: [
779
+ /* @__PURE__ */ c(ua, {}),
780
+ /* @__PURE__ */ m(
781
+ M,
782
+ {
783
+ size: "sm",
784
+ variant: "ghost",
785
+ onClick: () => {
786
+ g && f({
787
+ edit: !1,
788
+ primaryPage: g.id
789
+ });
790
+ },
791
+ className: "text-xs font-normal duration-200 hover:bg-slate-300 hover:text-slate-800",
792
+ children: [
793
+ /* @__PURE__ */ c(Is, { className: "mr-1 h-3 w-3" }),
794
+ " Add Langauge"
795
+ ]
796
+ }
797
+ )
798
+ ] })
799
+ ] })
800
+ ] }) });
801
+ };
802
+ function Ci() {
803
+ const [e, t] = ie(Dn);
804
+ return /* @__PURE__ */ m("div", { className: "relative z-10 flex items-center justify-end gap-1", children: [
805
+ /* @__PURE__ */ c(Li, {}),
806
+ /* @__PURE__ */ c(Ms, {}),
807
+ e && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
808
+ Ii,
809
+ {
810
+ isOpen: !0,
811
+ id: e == null ? void 0 : e.id,
812
+ edit: !!(e != null && e.id),
813
+ primaryPage: e == null ? void 0 : e.primaryPage,
814
+ preselectedLang: e == null ? void 0 : e.preselectedLang,
815
+ onClose: () => t(null)
816
+ }
817
+ ) })
818
+ ] });
819
+ }
820
+ function Gi() {
821
+ return /* @__PURE__ */ c("div", { className: "mt-2 space-y-2", children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ m("div", { className: "flex items-start gap-3 rounded-md border p-2", children: [
822
+ /* @__PURE__ */ m("div", { className: "flex-1 space-y-1", children: [
823
+ /* @__PURE__ */ c(Ot, { className: "h-4 w-3/4" }),
824
+ /* @__PURE__ */ c(Ot, { className: "h-3 w-1/2" }),
825
+ /* @__PURE__ */ c(Ot, { className: "mt-1 h-5 w-20" })
826
+ ] }),
827
+ /* @__PURE__ */ c(Ot, { className: "h-8 w-8 rounded-full" })
828
+ ] }, t)) });
829
+ }
830
+ const Oi = Q.lazy(() => import("./page-revisions-content-CyLjyxNU.js"));
831
+ function Di() {
832
+ const [e, t] = Q.useState(!1);
833
+ return /* @__PURE__ */ c(vs, { children: /* @__PURE__ */ m(Jt, { delayDuration: 0, children: [
834
+ /* @__PURE__ */ m(Ps, { open: e, onOpenChange: t, children: [
835
+ /* @__PURE__ */ c(da, { asChild: !0, children: /* @__PURE__ */ c(Zt, { asChild: !0, children: /* @__PURE__ */ m("span", { className: "flex items-center gap-2", children: [
836
+ /* @__PURE__ */ m(M, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
837
+ /* @__PURE__ */ c(ka, { className: "h-4 w-4" }),
838
+ /* @__PURE__ */ c("span", { className: "sr-only", children: "View revision history" })
839
+ ] }),
840
+ /* @__PURE__ */ c("div", { className: "h-4 w-px bg-gray-200 dark:bg-gray-700" })
841
+ ] }) }) }),
842
+ /* @__PURE__ */ c(ws, { className: "flex h-[100vh] flex-col", children: e && /* @__PURE__ */ c(X, { fallback: /* @__PURE__ */ c(Gi, {}), children: /* @__PURE__ */ c(Oi, { isOpen: e }) }) })
843
+ ] }),
844
+ /* @__PURE__ */ c(Xt, { side: "bottom", children: /* @__PURE__ */ c("p", { children: "Revision history" }) })
845
+ ] }) });
846
+ }
847
+ const cn = ({
848
+ permission: e,
849
+ permissions: t,
850
+ children: n,
851
+ fallback: s = null
852
+ }) => {
853
+ const { hasPermission: r } = _s();
854
+ return e && !r(e) || t && !t.some((a) => r(a)) ? s : n;
855
+ }, xi = {
856
+ SLUG_ALREADY_USED: "This slug is already in use. Please choose a different one."
857
+ }, Ce = () => {
858
+ const e = C(), t = L();
859
+ return oe({
860
+ queryKey: [E.GET_PAGE_TYPES],
861
+ staleTime: 1 / 0,
862
+ placeholderData: [],
863
+ queryFn: async () => t(e, { action: E.GET_PAGE_TYPES })
864
+ });
865
+ }, Ri = (e) => {
866
+ const { data: t } = Ce();
867
+ return q(() => t == null ? void 0 : t.find((n) => n.key === e), [t, e]);
868
+ }, ki = () => {
869
+ const e = C(), t = L();
870
+ return Y({
871
+ mutationFn: async ({ pageType: n, query: s }) => {
872
+ try {
873
+ return t(e, {
874
+ action: E.SEARCH_PAGES,
875
+ data: {
876
+ pageType: n,
877
+ query: Array.isArray(s) && s.length > 0 ? s[0] : s
878
+ }
879
+ }) || [];
880
+ } catch (r) {
881
+ return console.error(r), [];
882
+ }
883
+ }
884
+ });
885
+ }, $c = () => {
886
+ const e = C(), t = J(), n = L(), { data: s } = Ce();
887
+ return Y({
888
+ mutationFn: async (r) => await n(e, {
889
+ action: E.CREATE_PAGE,
890
+ data: r
891
+ }),
892
+ onSuccess: (r, a) => {
893
+ var o;
894
+ a && (a != null && a.primaryPage) ? (t.invalidateQueries({
895
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
896
+ }), t.invalidateQueries({
897
+ queryKey: [E.GET_WEBSITE_PAGES, a == null ? void 0 : a.lang]
898
+ })) : t.invalidateQueries({
899
+ queryKey: [E.GET_WEBSITE_PAGES]
900
+ });
901
+ const i = a.template ? `Page created from "${a.template.name}" template` : a.hasSlug === !1 ? "New " + ((o = ae(s, { key: a.pageType })) == null ? void 0 : o.name) + " added successfully" : "New page added successfully";
902
+ k.success(i);
903
+ },
904
+ onError: (r, a) => {
905
+ const i = ae(s, { key: a.pageType });
906
+ k.error(`Failed to add new ${i != null && i.hasSlug ? "page" : i.name}.`, {
907
+ description: H(xi, r.message, r.message)
908
+ });
909
+ }
910
+ });
911
+ }, Qc = () => {
912
+ const e = C(), t = J(), n = L(), { data: s } = Ne(), { data: r } = Ce();
913
+ return Y({
914
+ mutationFn: async (a) => await n(e, {
915
+ action: E.UPDATE_PAGE,
916
+ data: a
917
+ }),
918
+ onSuccess: (a, i) => {
919
+ (s == null ? void 0 : s.id) === (i == null ? void 0 : i.id) && t.invalidateQueries({
920
+ queryKey: [E.GET_LANGUAGE_PAGES]
921
+ }), i && (i != null && i.primaryPage || i != null && i.seo) ? (t.invalidateQueries({
922
+ queryKey: [E.GET_LANGUAGE_PAGES, i == null ? void 0 : i.primaryPage]
923
+ }), t.invalidateQueries({
924
+ queryKey: [E.GET_WEBSITE_PAGES]
925
+ })) : t.invalidateQueries({
926
+ queryKey: [E.GET_WEBSITE_PAGES]
927
+ });
928
+ },
929
+ onError: (a, i) => {
930
+ const o = ae(r, { key: i.pageType });
931
+ k.error(`Failed to update ${o != null && o.hasSlug ? "page" : o.name}.`, {
932
+ description: a.message
933
+ });
934
+ }
935
+ });
936
+ }, zc = () => {
937
+ const e = C(), t = J(), n = L(), { data: s } = Ce();
938
+ return Y({
939
+ mutationFn: async (r) => n(e, {
940
+ action: E.DELETE_PAGE,
941
+ data: { id: r == null ? void 0 : r.id }
942
+ }),
943
+ onSuccess: (r, a) => {
944
+ if (r.code === "PAGE_LOCKED") {
945
+ k.error("Delete not allowed", {
946
+ description: "Page is currently being edited by another user."
947
+ });
948
+ return;
949
+ }
950
+ a && (a != null && a.primaryPage) ? (t.invalidateQueries({
951
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
952
+ }), t.invalidateQueries({
953
+ queryKey: [E.GET_WEBSITE_PAGES]
954
+ })) : t.invalidateQueries({
955
+ queryKey: [E.GET_WEBSITE_PAGES]
956
+ });
957
+ },
958
+ onError: (r, a) => {
959
+ const i = ae(s, { key: a.pageType });
960
+ k.error(`Failed to delete ${i != null && i.hasSlug ? "page" : i.name}.`, {
961
+ description: r.message
962
+ });
963
+ }
964
+ });
965
+ }, jc = () => {
966
+ const e = C(), t = J(), n = L(), { data: s } = Ce();
967
+ return Y({
968
+ mutationFn: async (r) => n(e, {
969
+ action: E.TAKE_OFFLINE,
970
+ data: { id: r == null ? void 0 : r.id }
971
+ }),
972
+ onSuccess: (r, a) => {
973
+ a && (a != null && a.primaryPage) ? t.invalidateQueries({
974
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
975
+ }) : t.invalidateQueries({
976
+ queryKey: [E.GET_WEBSITE_PAGES]
977
+ });
978
+ const i = ae(s, { key: a.pageType });
979
+ k.success(
980
+ i != null && i.hasSlug ? "Page unpublished successfully." : "New " + i.name + " added successfully."
981
+ );
982
+ },
983
+ onError: (r, a) => {
984
+ const i = ae(s, { key: a.pageType });
985
+ k.error(`Failed to take offline ${i != null && i.hasSlug ? "page" : i.name}.`, {
986
+ description: r.message
987
+ });
988
+ }
989
+ });
990
+ }, Bs = () => {
991
+ const e = C(), t = L(), n = J(), { data: s } = ce(), { savePageAsync: r } = ke();
992
+ return Y({
993
+ mutationFn: async ({ ids: a }) => (await r(), t(e, {
994
+ action: E.PUBLISH_CHANGES,
995
+ data: { ids: a }
996
+ })),
997
+ onSuccess: () => {
998
+ n.invalidateQueries({
999
+ queryKey: [E.GET_CHANGES]
1000
+ }), n.invalidateQueries({
1001
+ queryKey: [E.GET_WEBSITE_PAGES]
1002
+ }), n.invalidateQueries({
1003
+ queryKey: [E.GET_LANGUAGE_PAGES, s == null ? void 0 : s.id]
1004
+ });
1005
+ },
1006
+ onError: (a) => {
1007
+ console.log("##", a), k.error("Failed to publish pages.");
1008
+ }
1009
+ });
1010
+ }, Wc = () => {
1011
+ const e = C(), t = L(), n = J();
1012
+ return Y({
1013
+ mutationFn: async (s) => {
1014
+ var r;
1015
+ return t(e, {
1016
+ action: E.MARK_AS_TEMPLATE,
1017
+ data: {
1018
+ id: (r = s.page) == null ? void 0 : r.id,
1019
+ name: s.name,
1020
+ description: s.description,
1021
+ pageType: s.pageType,
1022
+ previewImage: s.previewImage
1023
+ }
1024
+ });
1025
+ },
1026
+ onSuccess: () => {
1027
+ n.invalidateQueries({
1028
+ queryKey: [E.GET_WEBSITE_PAGES]
1029
+ }), k.success("Page marked as template successfully.");
1030
+ },
1031
+ onError: () => {
1032
+ k.error("Failed to mark page as template.");
1033
+ }
1034
+ });
1035
+ }, Yc = () => {
1036
+ const e = C(), t = L(), n = J();
1037
+ return Y({
1038
+ mutationFn: async (s) => t(e, {
1039
+ action: E.UNMARK_AS_TEMPLATE,
1040
+ data: { id: s == null ? void 0 : s.id }
1041
+ }),
1042
+ onSuccess: () => {
1043
+ n.invalidateQueries({
1044
+ queryKey: [E.GET_WEBSITE_PAGES]
1045
+ }), k.success("Page unmarked as template successfully.");
1046
+ },
1047
+ onError: () => {
1048
+ k.error("Failed to unmark page as template.");
1049
+ }
1050
+ });
1051
+ }, Jc = () => {
1052
+ const e = C(), t = L(), n = J();
1053
+ return Y({
1054
+ mutationFn: async ({ id: s, slug: r }) => t(e, {
1055
+ action: E.CHANGE_SLUG,
1056
+ data: { id: s, slug: r }
1057
+ }),
1058
+ onSuccess: (s, { primaryPage: r }) => {
1059
+ k.success("Slug changed successfully."), r ? n.invalidateQueries({
1060
+ queryKey: [E.GET_LANGUAGE_PAGES, r]
1061
+ }) : n.invalidateQueries({
1062
+ queryKey: [E.GET_WEBSITE_PAGES]
1063
+ });
1064
+ },
1065
+ onError: () => {
1066
+ k.error("Failed to change slug");
1067
+ }
1068
+ });
1069
+ }, Ui = V(() => import("./publish-pages-content-Bih1W9C4.js"));
1070
+ function Mi({
1071
+ showModal: e = !1,
1072
+ onClose: t = () => console.log("Cancelled")
1073
+ }) {
1074
+ const { mutate: n, isPending: s } = Bs();
1075
+ return /* @__PURE__ */ c(bs, { open: e, onOpenChange: s ? () => {
1076
+ } : t, children: e && /* @__PURE__ */ c(X, { fallback: /* @__PURE__ */ c("div", { className: "h-96 w-96 animate-pulse bg-gray-100" }), children: /* @__PURE__ */ c(Ui, { onClose: t, isPending: s, publishPage: n }) }) });
1077
+ }
1078
+ const de = {
1079
+ ...Jr,
1080
+ //pages
1081
+ ADD_PAGE: "add_page",
1082
+ EDIT_PAGE: "edit_page",
1083
+ EDIT_SLUG: "edit_slug",
1084
+ DELETE_PAGE: "delete_page",
1085
+ CHANGE_PAGE_TYPE: "change_page_type",
1086
+ PUBLISH_PAGE: "publish_page",
1087
+ UNPUBLISH_PAGE: "unpublish_page",
1088
+ MARK_AS_TEMPLATE: "mark_as_template",
1089
+ UNMARK_AS_TEMPLATE: "unmark_as_template",
1090
+ //PARTIALS
1091
+ ADD_PARTIAL: "add_partial",
1092
+ EDIT_PARTIAL: "edit_partial",
1093
+ DELETE_PARTIAL: "delete_partial",
1094
+ PUBLISH_PARTIAL: "publish_partial",
1095
+ UNPUBLISH_PARTIAL: "unpublish_partial",
1096
+ //SEO
1097
+ EDIT_SEO: "edit_seo",
1098
+ // revisions
1099
+ RESTORE_REVISION: "restore_revision",
1100
+ DELETE_REVISION: "delete_revision",
1101
+ //theme
1102
+ PUBLISH_THEME: "publish_theme",
1103
+ EDIT_SETTINGS: "edit_settings",
1104
+ // library and templates
1105
+ ADD_LIBRARY_BLOCK: "create_library_block",
1106
+ ADD_LIBRARY_TEMPLATE: "add_library_template",
1107
+ EDIT_LIBRARY_BLOCK: "edit_library_block",
1108
+ EDIT_LIBRARY_TEMPLATE: "edit_library_template",
1109
+ DELETE_LIBRARY_BLOCK: "delete_library_block",
1110
+ DELETE_LIBRARY_TEMPLATE: "delete_library_template",
1111
+ //media
1112
+ ADD_MEDIA: "add_media",
1113
+ EDIT_MEDIA: "edit_media",
1114
+ DELETE_MEDIA: "delete_media"
1115
+ }, Bi = (e) => {
1116
+ const { fallbackLang: t } = _e(), { data: n } = Be(), { data: s, isFetching: r } = Me(), a = q(() => {
1117
+ const i = { [t]: !0 };
1118
+ return kr(H(n, "languages"), (o) => {
1119
+ const l = ae(s, { lang: o });
1120
+ i[o] = !!l;
1121
+ }), i;
1122
+ }, [t, s, n]);
1123
+ return r || Te(e) || e && a[e];
1124
+ }, Fi = {
1125
+ particleCount: 350,
1126
+ spread: 120,
1127
+ origin: { y: 0.6 },
1128
+ angle: 90
1129
+ }, Ki = {
1130
+ TOP_RIGHT: {
1131
+ angle: 225,
1132
+ origin: { x: 0.9, y: 0 }
1133
+ },
1134
+ BOTTOM_RIGHT: {
1135
+ angle: 100,
1136
+ origin: { x: 0.9, y: 0.9 }
1137
+ }
1138
+ }, Vi = async () => {
1139
+ const { default: e } = await import("./confetti.module-DCmCkDyV.js");
1140
+ return e;
1141
+ }, un = (e) => {
1142
+ let t = Ki[e];
1143
+ t || (t = {});
1144
+ const n = { ...Fi, ...t };
1145
+ Vi().then((s) => s(n));
1146
+ };
1147
+ function Un({
1148
+ children: e,
1149
+ content: t,
1150
+ side: n = "bottom",
1151
+ delayDuration: s = 700,
1152
+ showTooltip: r = !0
1153
+ }) {
1154
+ return r ? /* @__PURE__ */ c(vs, { children: /* @__PURE__ */ m(Jt, { delayDuration: s, children: [
1155
+ /* @__PURE__ */ c(Zt, { asChild: !0, children: e }),
1156
+ /* @__PURE__ */ c(Xt, { side: n, sideOffset: 10, children: /* @__PURE__ */ c("p", { children: t }) })
1157
+ ] }) }) : e;
1158
+ }
1159
+ const Hi = V(() => import("./unpublish-page-FZ8rbi7u.js")), qi = V(() => import("./translation-warning-modal-DalBhNQy.js")), $i = () => {
1160
+ const { t: e } = Pe(), { selectedLang: t, fallbackLang: n } = _e(), s = le("getPreviewUrl", async (g) => g), [r, a] = K(""), { data: i } = ce(), { data: o } = Me(), { data: l } = Ce(), d = q(
1161
+ () => {
1162
+ var g;
1163
+ return (g = o == null ? void 0 : o.find((h) => (h == null ? void 0 : h.lang) === t)) == null ? void 0 : g.slug;
1164
+ },
1165
+ [t, o]
1166
+ ), u = z((g) => {
1167
+ var h;
1168
+ return (h = ae(l, { key: g })) == null ? void 0 : h.hasSlug;
1169
+ }, [l]), f = t === n ? "" : t;
1170
+ return se(() => {
1171
+ (async () => {
1172
+ if (typeof s == "function") {
1173
+ const g = !u(i == null ? void 0 : i.pageType), h = await s(
1174
+ g ? `${f !== "" ? f + "/" : ""}${i == null ? void 0 : i.id}` : d || ""
1175
+ );
1176
+ a(h);
1177
+ } else
1178
+ a("");
1179
+ })();
1180
+ }, [s, d, i == null ? void 0 : i.pageType, u, i == null ? void 0 : i.id, f]), /* @__PURE__ */ c(me, { children: /* @__PURE__ */ c(Un, { content: e("Open preview in new tab"), delayDuration: 0, children: /* @__PURE__ */ c("a", { href: r, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ c(M, { variant: "ghost", size: "sm", className: "gap-2", children: /* @__PURE__ */ c(Ua, { className: "h-4 w-4" }) }) }) }) });
1181
+ }, Qi = () => {
1182
+ const { t: e } = Pe(), [t, n] = Zr();
1183
+ return /* @__PURE__ */ m(me, { children: [
1184
+ /* @__PURE__ */ c(Un, { content: e("Theme"), delayDuration: 0, children: /* @__PURE__ */ c(
1185
+ M,
1186
+ {
1187
+ variant: t === "theme" ? "outline" : "ghost",
1188
+ size: "icon",
1189
+ className: "gap-2",
1190
+ onClick: () => n(t === "theme" ? "block" : "theme"),
1191
+ children: /* @__PURE__ */ c(Ma, { className: "h-4 w-4" })
1192
+ }
1193
+ ) }),
1194
+ /* @__PURE__ */ c("div", { className: "h-4 w-px bg-gray-200 dark:bg-gray-700" })
1195
+ ] });
1196
+ }, zi = () => {
1197
+ const { t: e } = Pe(), [t, n] = K(!1), { isLocked: s } = he(), { savePageAsync: r, saveState: a } = ke();
1198
+ se(() => {
1199
+ const u = (f) => {
1200
+ a === "UNSAVED" && (f.preventDefault(), f.returnValue = !1);
1201
+ };
1202
+ return a === "UNSAVED" && window.addEventListener("beforeunload", u), () => {
1203
+ window.removeEventListener("beforeunload", u);
1204
+ };
1205
+ }, [a]);
1206
+ const i = z(async () => {
1207
+ t || (n(!0), await r(), n(!1));
1208
+ }, [r, t]), { buttonIcon: o, buttonClass: l, tooltipContent: d } = q(() => {
1209
+ switch (a) {
1210
+ case "UNSAVED":
1211
+ return {
1212
+ tooltipContent: e("Save draft"),
1213
+ buttonIcon: /* @__PURE__ */ c(Fa, { className: "h-4 w-4" }),
1214
+ buttonClass: "gap-x-1"
1215
+ };
1216
+ case "SAVING":
1217
+ return {
1218
+ tooltipContent: e("Saving"),
1219
+ buttonIcon: /* @__PURE__ */ c(Ht, { className: "h-4 w-4 animate-spin text-sky-700" }),
1220
+ buttonClass: "gap-x-1"
1221
+ };
1222
+ case "SAVED":
1223
+ return {
1224
+ tooltipContent: e("Saved"),
1225
+ buttonIcon: /* @__PURE__ */ c(Ba, { className: "h-4 w-4" }),
1226
+ buttonClass: "text-green-500 gap-x-1"
1227
+ };
1228
+ }
1229
+ }, [a, e]);
1230
+ return s ? null : /* @__PURE__ */ m(M, { size: "sm", variant: "ghost", onClick: i, className: `${l} w-24 max-w-24`, children: [
1231
+ o,
1232
+ " ",
1233
+ d
1234
+ ] });
1235
+ }, ji = () => {
1236
+ const { t: e } = Pe(), { selectedLang: t } = _e(), { data: n } = Ne(), { data: s } = Me(), [r, a] = K(!1), [i, o] = K(!1), [l, d] = K(null), { savePageAsync: u } = ke(), [f, g] = K(!1), { data: h } = ce(), { mutate: p, isPending: T } = Bs(), { needTranslations: S } = ke(), D = S(), { buttonText: y, buttonClassName: w, isPublished: v } = q(() => {
1237
+ const P = h && (h == null ? void 0 : h.online);
1238
+ return {
1239
+ buttonClassName: P ? "hover:bg-green-600 bg-green-500" : "",
1240
+ isPublished: P,
1241
+ buttonText: e(P ? "Published" : "Publish")
1242
+ };
1243
+ }, [h, e]), U = async () => {
1244
+ if (D) {
1245
+ g(!0);
1246
+ return;
1247
+ }
1248
+ b();
1249
+ }, b = () => {
1250
+ const P = [n == null ? void 0 : n.id, n == null ? void 0 : n.primaryPage];
1251
+ p({ ids: As(P) }, { onSuccess: () => un("TOP_RIGHT") });
1252
+ }, ye = () => {
1253
+ g(!1), b();
1254
+ }, Ae = async () => {
1255
+ g(!1), await u();
1256
+ }, B = q(() => Kt(s ?? [], "id"), [s]);
1257
+ return /* @__PURE__ */ m(me, { children: [
1258
+ /* @__PURE__ */ m("div", { className: "flex", children: [
1259
+ /* @__PURE__ */ m(
1260
+ M,
1261
+ {
1262
+ size: "sm",
1263
+ onClick: U,
1264
+ disabled: T || !(h != null && h.id),
1265
+ className: `relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${w}`,
1266
+ onMouseEnter: () => o(!0),
1267
+ onMouseLeave: () => o(!1),
1268
+ children: [
1269
+ /* @__PURE__ */ c(
1270
+ "span",
1271
+ {
1272
+ className: `flex items-center transition-transform duration-300 ease-in-out ${i ? "-translate-y-10" : ""}`,
1273
+ children: v ? /* @__PURE__ */ c(jn, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Wn, { className: "h-4 w-4" })
1274
+ }
1275
+ ),
1276
+ /* @__PURE__ */ c(
1277
+ "span",
1278
+ {
1279
+ className: `absolute inset-0 left-3 flex items-center transition-transform duration-300 ease-in-out ${i ? "" : "translate-y-10"}`,
1280
+ children: v ? /* @__PURE__ */ c(Wn, { className: "h-4 w-4" }) : /* @__PURE__ */ c(jn, { className: "h-4 w-4" })
1281
+ }
1282
+ ),
1283
+ /* @__PURE__ */ c("span", { children: y }),
1284
+ t ? `(${qn(t)})` : ""
1285
+ ]
1286
+ }
1287
+ ),
1288
+ /* @__PURE__ */ m(Ln, { children: [
1289
+ /* @__PURE__ */ c(Nn, { asChild: !0, children: /* @__PURE__ */ c(
1290
+ M,
1291
+ {
1292
+ size: "sm",
1293
+ disabled: T || !(h != null && h.id),
1294
+ className: `rounded-l-none border-l border-white/50 px-2 text-white ${w}`,
1295
+ children: /* @__PURE__ */ c(En, { className: "h-4 w-4" })
1296
+ }
1297
+ ) }),
1298
+ /* @__PURE__ */ m(Cn, { align: "end", className: "w-52", children: [
1299
+ /* @__PURE__ */ m(
1300
+ fe,
1301
+ {
1302
+ disabled: T,
1303
+ className: "cursor-pointer text-xs",
1304
+ onClick: () => p({ ids: B }, { onSuccess: () => un("TOP_RIGHT") }),
1305
+ children: [
1306
+ e("Publish"),
1307
+ " with translation pages"
1308
+ ]
1309
+ }
1310
+ ),
1311
+ !v && /* @__PURE__ */ m(
1312
+ fe,
1313
+ {
1314
+ disabled: T,
1315
+ className: "cursor-pointer text-xs",
1316
+ onClick: () => p({ ids: [h == null ? void 0 : h.id] }, { onSuccess: () => un("TOP_RIGHT") }),
1317
+ children: [
1318
+ e("Publish"),
1319
+ " page"
1320
+ ]
1321
+ }
1322
+ ),
1323
+ /* @__PURE__ */ m(fe, { onClick: () => a(!0), className: "cursor-pointer text-xs", children: [
1324
+ e("Open"),
1325
+ " publish menu"
1326
+ ] }),
1327
+ v && /* @__PURE__ */ m(fe, { onClick: () => d(n), className: "cursor-pointer text-xs", children: [
1328
+ e("Unpublish"),
1329
+ " page ",
1330
+ t ? `(${qn(t)})` : ""
1331
+ ] })
1332
+ ] })
1333
+ ] })
1334
+ ] }),
1335
+ /* @__PURE__ */ c(Mi, { showModal: r, onClose: () => a(!1) }),
1336
+ l && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Hi, { page: l, onClose: () => d(null) }) }),
1337
+ f && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
1338
+ qi,
1339
+ {
1340
+ isOpen: f,
1341
+ onClose: Ae,
1342
+ onContinue: ye,
1343
+ isPending: T
1344
+ }
1345
+ ) })
1346
+ ] });
1347
+ };
1348
+ function Wi() {
1349
+ const { isLocked: e } = he(), [t] = we(), n = t.get("lang"), s = Bi(n);
1350
+ return e || !s ? /* @__PURE__ */ c("div", {}) : /* @__PURE__ */ m("div", { className: "flex items-center justify-end gap-1", children: [
1351
+ /* @__PURE__ */ c(Di, {}),
1352
+ /* @__PURE__ */ c(cn, { permission: de.EDIT_THEME, children: /* @__PURE__ */ c(Qi, {}) }),
1353
+ /* @__PURE__ */ c($i, {}),
1354
+ /* @__PURE__ */ c(cn, { permission: de.SAVE_PAGE, children: /* @__PURE__ */ c(zi, {}) }),
1355
+ /* @__PURE__ */ c(cn, { permission: de.PUBLISH_PAGE, children: /* @__PURE__ */ c(ji, {}) })
1356
+ ] });
1357
+ }
1358
+ const Yi = ({
1359
+ page: e,
1360
+ setDuplicatePage: t,
1361
+ setAddEditPage: n,
1362
+ setUnpublishPage: s,
1363
+ setDeletePage: r,
1364
+ setMarkAsTemplate: a,
1365
+ setUnmarkAsTemplate: i,
1366
+ children: o,
1367
+ isLanguagePage: l
1368
+ }) => {
1369
+ const { t: d } = Pe(), { hasPermission: u } = _s(), { data: f } = Ce(), g = q(() => ae(f, { key: e.pageType }), [f, e.pageType]), h = q(() => !!e.isTemplate, [e.isTemplate]), p = q(() => !!(g != null && g.hasSlug), [g == null ? void 0 : g.hasSlug]);
1370
+ return !u(de.EDIT_PAGE) && !u(de.DELETE_PAGE) && !u(de.UNPUBLISH_PAGE) || !e ? null : /* @__PURE__ */ m(Ln, { children: [
1371
+ /* @__PURE__ */ c(Nn, { asChild: !0, onClick: (S) => S.stopPropagation(), children: o }),
1372
+ /* @__PURE__ */ m(Cn, { align: "center", className: "text-sm", children: [
1373
+ u(de.ADD_PAGE) && !l && /* @__PURE__ */ m(
1374
+ fe,
1375
+ {
1376
+ className: "flex cursor-pointer items-center gap-2",
1377
+ onClick: (S) => {
1378
+ S.stopPropagation(), t(e);
1379
+ },
1380
+ children: [
1381
+ /* @__PURE__ */ c(Ka, { className: "size-3" }),
1382
+ "Duplicate page"
1383
+ ]
1384
+ }
1385
+ ),
1386
+ u(de.EDIT_PAGE) && /* @__PURE__ */ m(
1387
+ fe,
1388
+ {
1389
+ className: "flex cursor-pointer items-center gap-2",
1390
+ onClick: (S) => {
1391
+ S.stopPropagation(), n({
1392
+ ...e,
1393
+ global: !(g != null && g.hasSlug)
1394
+ });
1395
+ },
1396
+ children: [
1397
+ /* @__PURE__ */ c(Va, { className: "size-3" }),
1398
+ "Edit"
1399
+ ]
1400
+ }
1401
+ ),
1402
+ (e == null ? void 0 : e.online) && u(de.UNPUBLISH_PAGE) && /* @__PURE__ */ m(
1403
+ fe,
1404
+ {
1405
+ className: "flex cursor-pointer items-center gap-2",
1406
+ onClick: (S) => {
1407
+ S.stopPropagation(), s(e);
1408
+ },
1409
+ children: [
1410
+ /* @__PURE__ */ c(Ha, { className: "size-3" }),
1411
+ d("Unpublish")
1412
+ ]
1413
+ }
1414
+ ),
1415
+ u(de.DELETE_PAGE) && /* @__PURE__ */ m(
1416
+ fe,
1417
+ {
1418
+ className: "flex cursor-pointer items-center gap-2",
1419
+ onClick: (S) => {
1420
+ S.stopPropagation(), r(e);
1421
+ },
1422
+ children: [
1423
+ /* @__PURE__ */ c(qa, { className: "size-3" }),
1424
+ d("Delete")
1425
+ ]
1426
+ }
1427
+ ),
1428
+ u(de.MARK_AS_TEMPLATE) && p && !l && /* @__PURE__ */ c(me, { children: h ? /* @__PURE__ */ m(
1429
+ fe,
1430
+ {
1431
+ className: "flex cursor-pointer items-center gap-2",
1432
+ onClick: (S) => {
1433
+ S.stopPropagation(), i(e);
1434
+ },
1435
+ children: [
1436
+ /* @__PURE__ */ c(Yn, { className: "size-3" }),
1437
+ d("Unmark as template")
1438
+ ]
1439
+ }
1440
+ ) : /* @__PURE__ */ m(
1441
+ fe,
1442
+ {
1443
+ className: "flex cursor-pointer items-center gap-2",
1444
+ onClick: (S) => {
1445
+ S.stopPropagation(), a(e);
1446
+ },
1447
+ children: [
1448
+ /* @__PURE__ */ c(Yn, { className: "size-3" }),
1449
+ d("Mark as template")
1450
+ ]
1451
+ }
1452
+ ) })
1453
+ ] })
1454
+ ] });
1455
+ }, Ji = V(() => import("./add-new-page-aYomeid4.js")), Zi = V(() => import("./delete-page-BF1k60U2.js")), Xi = V(() => import("./duplicate-page-u_6vUVo1.js")), eo = V(() => import("./mark-as-template-CJ1mlxYT.js")), to = V(() => import("./unmark-as-template-JRRUYTOY.js")), no = V(() => import("./unpublish-page-FZ8rbi7u.js")), so = () => {
1456
+ const [e, t] = K(null), [n, s] = K(null), [r, a] = K(null), [i, o] = K(null), [l, d] = K(null), [u, f] = K(null), { data: g, isFetching: h } = Ne(), { selectedLang: p, fallbackLang: T } = _e(), { data: S } = Me(), D = S == null ? void 0 : S.find((b) => b.lang === p), { isLocked: y } = he(), w = !(g != null && g.slug), [, v] = ie(Dn);
1457
+ if (!g) return null;
1458
+ const U = (b) => {
1459
+ p.length > 0 && p !== T ? v({
1460
+ edit: !0,
1461
+ id: b == null ? void 0 : b.id,
1462
+ primaryPage: b == null ? void 0 : b.primaryPage
1463
+ }) : f(b);
1464
+ };
1465
+ return /* @__PURE__ */ m(me, { children: [
1466
+ /* @__PURE__ */ m("div", { className: "flex items-center justify-between rounded px-[2px] transition-colors duration-200", children: [
1467
+ /* @__PURE__ */ c(Ms, { children: /* @__PURE__ */ c(
1468
+ M,
1469
+ {
1470
+ className: "flex h-7 max-w-[200px] cursor-pointer items-center truncate rounded px-1 text-xs font-medium",
1471
+ variant: "ghost",
1472
+ children: h ? /* @__PURE__ */ c(Ht, { className: "h-4 w-4 animate-spin text-slate-400" }) : /* @__PURE__ */ m("span", { className: "flex w-full cursor-pointer items-end overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-xs font-medium", children: [
1473
+ w ? /* @__PURE__ */ c($a, { className: "mr-1 h-4 w-4" }) : /* @__PURE__ */ c(Qa, { className: "mr-1 h-4 w-4" }),
1474
+ H(D || g, "name") ?? ""
1475
+ ] })
1476
+ }
1477
+ ) }),
1478
+ y ? /* @__PURE__ */ c(
1479
+ M,
1480
+ {
1481
+ variant: "ghost",
1482
+ size: "icon",
1483
+ className: "h-7 w-7 cursor-not-allowed rounded opacity-50 hover:bg-transparent",
1484
+ children: /* @__PURE__ */ c(Jn, { className: "h-4 w-4" })
1485
+ }
1486
+ ) : /* @__PURE__ */ c(
1487
+ Yi,
1488
+ {
1489
+ page: g,
1490
+ setDuplicatePage: (b) => d(b),
1491
+ setAddEditPage: (b) => U(b),
1492
+ setUnpublishPage: (b) => s(b),
1493
+ setDeletePage: (b) => t(b),
1494
+ setMarkAsTemplate: (b) => a(b),
1495
+ setUnmarkAsTemplate: (b) => o(b),
1496
+ isLanguagePage: p.length > 0 && p !== T,
1497
+ children: /* @__PURE__ */ c(M, { variant: "ghost", size: "icon", className: "h-7 w-7 rounded", children: /* @__PURE__ */ c(Jn, { className: "h-4 w-4" }) })
1498
+ }
1499
+ )
1500
+ ] }),
1501
+ u && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
1502
+ Ji,
1503
+ {
1504
+ closePanel: () => f(null),
1505
+ editPage: () => {
1506
+ },
1507
+ addEditPage: u,
1508
+ setAddEditPage: f
1509
+ }
1510
+ ) }),
1511
+ e && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Zi, { page: e, onClose: () => t(null) }) }),
1512
+ n && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(no, { page: n, onClose: () => s(null) }) }),
1513
+ r && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(eo, { page: r, onClose: () => a(null) }) }),
1514
+ i && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(to, { page: i, onClose: () => o(null) }) }),
1515
+ l && /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
1516
+ Xi,
1517
+ {
1518
+ page: l,
1519
+ onClose: () => d(null),
1520
+ closePanel: () => f(null)
1521
+ }
1522
+ ) })
1523
+ ] });
1524
+ }, Fs = ({ children: e, className: t = "" }) => /* @__PURE__ */ c(
1525
+ "div",
1526
+ {
1527
+ className: Vt(
1528
+ "fixed bottom-0 left-0 right-0 top-[50px] z-[20] flex w-screen flex-col items-center justify-center bg-black/40 transition-all",
1529
+ t
1530
+ ),
1531
+ children: e
1532
+ }
1533
+ ), ro = ({ hasDynamicPage: e }) => /* @__PURE__ */ c(Fs, { children: /* @__PURE__ */ m("div", { className: "flex min-w-[300px] max-w-[400px] flex-col items-center justify-center rounded-lg border bg-white p-4 shadow-lg", children: [
1534
+ /* @__PURE__ */ c("h1", { className: "text-lg font-medium", children: e ? "Select a page" : "No pages found" }),
1535
+ /* @__PURE__ */ c("p", { className: "pt-2 text-center text-sm font-light text-gray-600", children: e ? "Please select a page from the list in the top header. This will enable you to edit the page." : "Please add a new page" })
1536
+ ] }) }), ao = V(() => import("./dynamic-page-selector-DxBHmglP.js")), io = () => {
1537
+ const { dynamicPage: e, allLangPages: t, isFetching: n } = ci(), s = t.length > 0;
1538
+ return n ? null : /* @__PURE__ */ m("div", { className: "relative", children: [
1539
+ !e && /* @__PURE__ */ c(ro, { hasDynamicPage: s }),
1540
+ /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(ao, {}) })
1541
+ ] });
1542
+ }, oo = () => {
1543
+ const { data: e, isFetching: t } = Ne(), { data: n, isFetching: s } = ce(), r = H(n, "dynamic", !1), a = On(), i = Xr("dynamic-page-selector"), o = e == null ? void 0 : e.slug, l = !o, d = hi(), u = t || s, g = (l ? `Partial: ${e == null ? void 0 : e.name} ` : `${o}${a}`).replace(window.location.host, "");
1544
+ return /* @__PURE__ */ m("div", { className: "relative flex items-center gap-x-1", children: [
1545
+ /* @__PURE__ */ c(
1546
+ "div",
1547
+ {
1548
+ className: Vt(
1549
+ "flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",
1550
+ u && "max-w-0 overflow-hidden opacity-0"
1551
+ ),
1552
+ children: /* @__PURE__ */ c(so, {})
1553
+ }
1554
+ ),
1555
+ /* @__PURE__ */ m(
1556
+ "div",
1557
+ {
1558
+ className: Vt(
1559
+ "flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800" + (l ? " pr-2" : ""),
1560
+ u && "max-w-0 overflow-hidden opacity-0"
1561
+ ),
1562
+ children: [
1563
+ /* @__PURE__ */ c(Ni, {}),
1564
+ /* @__PURE__ */ m("div", { className: "flex w-full items-center overflow-hidden", children: [
1565
+ /* @__PURE__ */ c(
1566
+ "div",
1567
+ {
1568
+ className: `w-full max-w-[200px] overflow-hidden overflow-ellipsis whitespace-nowrap pl-1 text-xs ${l ? "italic text-gray-400" : "font-mono text-gray-500"}`,
1569
+ children: g === "/" ? /* @__PURE__ */ m("span", { className: "text-gray-900", children: [
1570
+ "/",
1571
+ /* @__PURE__ */ c("span", { className: "text-[11px] font-light italic text-gray-400", children: "(Homepage)" })
1572
+ ] }) : g
1573
+ }
1574
+ ),
1575
+ !l && /* @__PURE__ */ c("a", { href: d, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ c("div", { className: "ml-2 mr-px flex-shrink-0 rounded-sm p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300", children: /* @__PURE__ */ c(za, { className: "h-4 w-4", strokeWidth: 1 }) }) })
1576
+ ] })
1577
+ ]
1578
+ }
1579
+ ),
1580
+ r && i && /* @__PURE__ */ c(io, {})
1581
+ ] });
1582
+ }, lo = () => /* @__PURE__ */ m("div", { className: "flex h-full w-full items-center justify-between px-2", children: [
1583
+ /* @__PURE__ */ c(Ci, {}),
1584
+ /* @__PURE__ */ c(oo, {}),
1585
+ /* @__PURE__ */ c(Wi, {})
1586
+ ] }), Ks = () => {
1587
+ const e = J(), { data: t } = oe({
1588
+ queryKey: [E.AI_CONTEXT],
1589
+ initialData: "",
1590
+ queryFn: () => "",
1591
+ staleTime: 0
1592
+ });
1593
+ return { setAiContext: z(
1594
+ (s) => {
1595
+ e.setQueryData([E.AI_CONTEXT], s);
1596
+ },
1597
+ [e]
1598
+ ), aiContext: t };
1599
+ }, co = () => {
1600
+ const e = C(), { aiContext: t } = Ks(), n = L();
1601
+ return z(
1602
+ async (s, r, a, i) => n(e, {
1603
+ action: E.ASK_AI,
1604
+ data: { type: s, prompt: r, blocks: a, context: t, lang: i }
1605
+ }),
1606
+ [e, t, n]
1607
+ );
1608
+ }, uo = (e, t) => t.map((n) => {
1609
+ if (Yt(e, n._type)) {
1610
+ const s = si(n._type);
1611
+ return {
1612
+ ...s,
1613
+ ...In(n, [
1614
+ ...Mr(s),
1615
+ "_type",
1616
+ "_id",
1617
+ "_name",
1618
+ "_parent",
1619
+ "_bindings"
1620
+ ]),
1621
+ ...Br(n, (r, a) => Fr(a, "_attrs")),
1622
+ ...n
1623
+ };
1624
+ }
1625
+ return n;
1626
+ }), fo = (e) => {
1627
+ const t = ni();
1628
+ return q(() => {
1629
+ if (!e || Te(e)) return { blocks: [] };
1630
+ const n = Ts(
1631
+ e,
1632
+ (s) => !Ur(s == null ? void 0 : s._type, "@chai/")
1633
+ );
1634
+ return { blocks: uo(t, n) };
1635
+ }, [e, t]);
1636
+ }, ho = () => {
1637
+ const [e] = we(), t = e.get("page"), n = C(), { setAiContext: s } = Ks(), [, r] = Os(), [, a] = fi(), [, i] = ea(), o = L();
1638
+ return oe({
1639
+ queryKey: [E.GET_DRAFT_PAGE, t],
1640
+ staleTime: 1 / 0,
1641
+ gcTime: 0,
1642
+ queryFn: async () => {
1643
+ i(!1);
1644
+ const l = await o(n, {
1645
+ action: E.GET_DRAFT_PAGE,
1646
+ data: { id: t, draft: !0 }
1647
+ }), d = l.blocks ?? [], u = ae(d, { _type: "@chai/ai-context" });
1648
+ return s(H(u, "_value", "") || ""), r((f) => ({ ...f, lastSaved: l.lastSaved })), a(H(l, "metadata", {})), setTimeout(() => i(!0), 500), d;
1649
+ },
1650
+ enabled: !!t
1651
+ });
1652
+ }, go = () => {
1653
+ const { data: e } = ce(), { data: t } = Ne(), n = C(), s = L(), r = kn(), a = On();
1654
+ return oe({
1655
+ queryKey: [E.GET_BUILDER_PAGE_DATA, t == null ? void 0 : t.id, a],
1656
+ staleTime: 1 / 0,
1657
+ gcTime: 0,
1658
+ queryFn: async () => s(n, {
1659
+ action: E.GET_BUILDER_PAGE_DATA,
1660
+ data: {
1661
+ pageType: e == null ? void 0 : e.pageType,
1662
+ lang: (t == null ? void 0 : t.lang) || r,
1663
+ dynamic: e == null ? void 0 : e.dynamic,
1664
+ pageProps: {
1665
+ slug: (t == null ? void 0 : t.slug) + a,
1666
+ searchParams: {},
1667
+ pageType: t == null ? void 0 : t.pageType,
1668
+ fallbackLang: r,
1669
+ lastSaved: t.lastSaved,
1670
+ pageId: e.id,
1671
+ primaryPageId: t.primaryPage || e.id,
1672
+ pageBaseSlug: t == null ? void 0 : t.slug,
1673
+ dynamic: e == null ? void 0 : e.dynamic,
1674
+ //
1675
+ languagePageId: t.id,
1676
+ metadata: e.metadata || {}
1677
+ }
1678
+ }
1679
+ }),
1680
+ enabled: !!(e != null && e.pageType) && !!t.id
1681
+ });
1682
+ }, mo = () => {
1683
+ const e = C(), t = J(), n = L();
1684
+ return Y({
1685
+ mutationFn: async (s) => n(e, {
1686
+ action: E.UPDATE_WEBSITE_SETTINGS,
1687
+ data: s
1688
+ }),
1689
+ onSuccess: (s, r) => {
1690
+ var a;
1691
+ t.invalidateQueries({
1692
+ queryKey: [E.GET_WEBSITE_DRAFT_SETTINGS]
1693
+ }), (a = r == null ? void 0 : r.settings) != null && a.theme || k.success("Website settings updated successfully.");
1694
+ },
1695
+ onError: (s) => {
1696
+ k.error("Failed to update website settings", {
1697
+ description: s.message
1698
+ });
1699
+ }
1700
+ });
1701
+ }, Zc = () => {
1702
+ const e = C(), t = J(), n = L(), { selectedLang: s } = _e();
1703
+ return Y({
1704
+ mutationFn: async (r) => n(e, { action: E.ADD_GLOBAL_SCHEMA, data: { ...r, lang: s } }),
1705
+ onSuccess: () => {
1706
+ t.invalidateQueries({
1707
+ queryKey: [E.GET_GLOBAL_JSONLD_ITEMS]
1708
+ }), k.success("Schema added successfully.");
1709
+ },
1710
+ onError: (r) => {
1711
+ k.error("Failed to add schema", {
1712
+ description: r.message
1713
+ });
1714
+ }
1715
+ });
1716
+ }, Xc = () => {
1717
+ const e = C(), t = J(), n = L(), { selectedLang: s } = _e();
1718
+ return Y({
1719
+ mutationFn: async (r) => n(e, { action: E.UPDATE_GLOBAL_SCHEMA, data: { ...r, lang: s } }),
1720
+ onSuccess: () => {
1721
+ t.invalidateQueries({
1722
+ queryKey: [E.GET_GLOBAL_JSONLD_ITEMS]
1723
+ }), k.success("Schema updated successfully.");
1724
+ },
1725
+ onError: (r) => {
1726
+ k.error("Failed to update schema", {
1727
+ description: r.message
1728
+ });
1729
+ }
1730
+ });
1731
+ }, eu = () => {
1732
+ const e = C(), t = J(), n = L();
1733
+ return Y({
1734
+ mutationFn: async (s) => n(e, { action: E.DELETE_GLOBAL_SCHEMA, data: { id: s } }),
1735
+ onSuccess: () => {
1736
+ t.invalidateQueries({
1737
+ queryKey: [E.GET_GLOBAL_JSONLD_ITEMS]
1738
+ }), k.success("Schema deleted successfully.");
1739
+ },
1740
+ onError: (s) => {
1741
+ k.error("Failed to delete schema", {
1742
+ description: s.message
1743
+ });
1744
+ }
1745
+ });
1746
+ }, tu = () => {
1747
+ const e = C(), t = L();
1748
+ return Y({
1749
+ mutationFn: async (n) => t(e, { action: E.TOGGLE_PAGE_GLOBAL_SCHEMA, data: n }),
1750
+ onError: (n) => {
1751
+ k.error("Failed to toggle schema", {
1752
+ description: n.message
1753
+ });
1754
+ }
1755
+ });
1756
+ }, nu = () => {
1757
+ const e = C(), t = L();
1758
+ return Y({
1759
+ mutationFn: async (n) => t(e, { action: E.APPLY_SCHEMA_TO_ALL_PAGES, data: { schemaId: n } }),
1760
+ onSuccess: (n) => {
1761
+ k.success(`Schema applied to ${n.count} page(s)`);
1762
+ },
1763
+ onError: (n) => {
1764
+ k.error("Failed to apply schema to all pages", {
1765
+ description: n.message
1766
+ });
1767
+ }
1768
+ });
1769
+ }, su = () => {
1770
+ const e = C(), t = L();
1771
+ return Y({
1772
+ mutationFn: async (n) => t(e, { action: E.REMOVE_SCHEMA_FROM_ALL_PAGES, data: { schemaId: n } }),
1773
+ onSuccess: (n) => {
1774
+ k.success(`Schema removed from ${n.count} page(s)`);
1775
+ },
1776
+ onError: (n) => {
1777
+ k.error("Failed to remove schema from all pages", {
1778
+ description: n.message
1779
+ });
1780
+ }
1781
+ });
1782
+ }, es = {
1783
+ async getUILibraryBlock(e, t, n) {
1784
+ const s = await t(n, {
1785
+ action: "GET_LIBRARY_ITEM",
1786
+ data: { id: e.id }
1787
+ }), r = H(s, "html", ""), a = H(s, "blocks", []);
1788
+ return Kr(a) ? a : na(r);
1789
+ },
1790
+ async getUILibraryBlocks(e, t, n) {
1791
+ try {
1792
+ return (await t(n, {
1793
+ action: "GET_LIBRARY_ITEMS",
1794
+ data: { id: e.id }
1795
+ })).map((r) => ({
1796
+ ...r
1797
+ }));
1798
+ } catch (s) {
1799
+ return console.error(s), [];
1800
+ }
1801
+ }
1802
+ }, Eo = () => {
1803
+ const e = C(), t = L();
1804
+ return oe({
1805
+ queryKey: ["uiLibraries"],
1806
+ staleTime: "static",
1807
+ queryFn: async () => {
1808
+ const s = (await t(e, { action: "GET_LIBRARIES" })).map((r) => ({
1809
+ ...r
1810
+ }));
1811
+ return s.forEach((r) => {
1812
+ ta(r.id, {
1813
+ name: r.isSiteLibrary ? r.name + " (Current Site) " : r.name,
1814
+ description: r.description,
1815
+ getBlocksList: (a) => es.getUILibraryBlocks(a, t, e),
1816
+ getBlock: ({ block: a }) => es.getUILibraryBlock(a, t, e)
1817
+ });
1818
+ }), s;
1819
+ }
1820
+ });
1821
+ }, po = () => {
1822
+ const e = Ls(), t = L(), { user: n } = xn(), s = n == null ? void 0 : n.id;
1823
+ return oe({
1824
+ queryKey: [E.GET_ROLE_AND_PERMISSIONS, s],
1825
+ queryFn: () => t(e, {
1826
+ action: E.GET_ROLE_AND_PERMISSIONS,
1827
+ data: { userId: s }
1828
+ }),
1829
+ enabled: !!s,
1830
+ staleTime: 1 / 0
1831
+ });
1832
+ }, yo = () => {
1833
+ const e = C(), t = L(), [, n] = Os();
1834
+ return { onSave: async ({
1835
+ page: r,
1836
+ blocks: a,
1837
+ needTranslations: i
1838
+ }) => {
1839
+ try {
1840
+ const o = await t(e, {
1841
+ action: "UPDATE_PAGE",
1842
+ data: { id: r, blocks: a, needTranslations: i }
1843
+ });
1844
+ return o.code === "PAGE_LOCKED" ? !0 : (n((l) => ({
1845
+ ...l,
1846
+ lastSaved: (/* @__PURE__ */ new Date()).toISOString()
1847
+ })), o);
1848
+ } catch (o) {
1849
+ return console.error(o), new Error("Failed to save blocks");
1850
+ }
1851
+ } };
1852
+ }, Ao = () => {
1853
+ const { data: e } = Us(), t = C(), n = L();
1854
+ return {
1855
+ getPartialBlocks: z(async () => {
1856
+ const s = {};
1857
+ for (const r of e ?? [])
1858
+ Te(r == null ? void 0 : r.slug) && (s[r.id] = {
1859
+ type: r.pageType,
1860
+ name: Vr(r.name ?? r.slug),
1861
+ description: ""
1862
+ });
1863
+ return s;
1864
+ }, [e]),
1865
+ getPartialBlockBlocks: z(
1866
+ async (s) => {
1867
+ if (!s) return [];
1868
+ try {
1869
+ const r = await n(t, {
1870
+ action: "GET_DRAFT_PAGE",
1871
+ data: { id: s, draft: !0, editor: !1 }
1872
+ });
1873
+ return Ts(r.blocks, (a) => Yt(a, "_id"));
1874
+ } catch (r) {
1875
+ return console.error(r), [];
1876
+ }
1877
+ },
1878
+ [n, t]
1879
+ )
1880
+ };
1881
+ }, To = V(() => import("./ai-panel-content-C6cH9rrC.js").then((e) => e.b)), Vs = "chai-chat-panel", So = ({ className: e = "h-full w-full" }) => /* @__PURE__ */ m("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", version: "1.1", className: e, children: [
1882
+ /* @__PURE__ */ c("title", { children: "ai" }),
1883
+ /* @__PURE__ */ c("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ c("g", { id: "icon", fill: "currentColor", transform: "translate(64.000000, 64.000000)", children: /* @__PURE__ */ c(
1884
+ "path",
1885
+ {
1886
+ d: "M320,64 L320,320 L64,320 L64,64 L320,64 Z M171.749388,128 L146.817842,128 L99.4840387,256 L121.976629,256 L130.913039,230.977 L187.575039,230.977 L196.319607,256 L220.167172,256 L171.749388,128 Z M260.093778,128 L237.691519,128 L237.691519,256 L260.093778,256 L260.093778,128 Z M159.094727,149.47526 L181.409039,213.333 L137.135039,213.333 L159.094727,149.47526 Z M341.333333,256 L384,256 L384,298.666667 L341.333333,298.666667 L341.333333,256 Z M85.3333333,341.333333 L128,341.333333 L128,384 L85.3333333,384 L85.3333333,341.333333 Z M170.666667,341.333333 L213.333333,341.333333 L213.333333,384 L170.666667,384 L170.666667,341.333333 Z M85.3333333,0 L128,0 L128,42.6666667 L85.3333333,42.6666667 L85.3333333,0 Z M256,341.333333 L298.666667,341.333333 L298.666667,384 L256,384 L256,341.333333 Z M170.666667,0 L213.333333,0 L213.333333,42.6666667 L170.666667,42.6666667 L170.666667,0 Z M256,0 L298.666667,0 L298.666667,42.6666667 L256,42.6666667 L256,0 Z M341.333333,170.666667 L384,170.666667 L384,213.333333 L341.333333,213.333333 L341.333333,170.666667 Z M0,256 L42.6666667,256 L42.6666667,298.666667 L0,298.666667 L0,256 Z M341.333333,85.3333333 L384,85.3333333 L384,128 L341.333333,128 L341.333333,85.3333333 Z M0,170.666667 L42.6666667,170.666667 L42.6666667,213.333333 L0,213.333333 L0,170.666667 Z M0,85.3333333 L42.6666667,85.3333333 L42.6666667,128 L0,128 L0,85.3333333 Z",
1887
+ id: "Combined-Shape"
1888
+ }
1889
+ ) }) })
1890
+ ] }), _o = ({ isActive: e, show: t }) => /* @__PURE__ */ c(M, { size: "icon", className: "p-0 [&_svg]:size-6", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ c(So, { className: e ? "h-5 w-5 text-white" : "h-5 w-5 text-primary" }) }), Po = {
1891
+ id: Vs,
1892
+ label: "AI Assistant",
1893
+ button: _o,
1894
+ panel: To,
1895
+ position: "top"
1896
+ }, wo = V(() => import("./lang-panel-B8OD0GiA.js")), vo = ({ isActive: e, show: t }) => {
1897
+ const { data: n } = Be();
1898
+ return !Yt(n, "languages") || !H(n, "languages", []).length ? null : /* @__PURE__ */ c(M, { size: "sm", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ c(ja, { className: "h-4 w-4" }) });
1899
+ }, Hs = "lang", bo = {
1900
+ id: Hs,
1901
+ label: "Languages",
1902
+ position: "top",
1903
+ panel: wo,
1904
+ button: vo,
1905
+ view: "modal",
1906
+ width: 400
1907
+ }, Io = V(() => import("./seo-panel-BurZA566.js")), qs = "seo", Lo = ({ isActive: e, show: t }) => {
1908
+ const { data: n } = ce(), s = Ri(n == null ? void 0 : n.pageType);
1909
+ return !Yt(s, "hasSlug") || !s.hasSlug ? null : /* @__PURE__ */ c(M, { size: "icon", className: "my-1 p-0", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ m(
1910
+ "svg",
1911
+ {
1912
+ stroke: "currentColor",
1913
+ fill: "none",
1914
+ style: { height: "20px", width: "20px" },
1915
+ strokeWidth: "2",
1916
+ viewBox: "0 0 24 24",
1917
+ strokeLinecap: "round",
1918
+ strokeLinejoin: "round",
1919
+ children: [
1920
+ /* @__PURE__ */ c("path", { d: "M7 8h-3a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-3" }),
1921
+ /* @__PURE__ */ c("path", { d: "M14 16h-4v-8h4" }),
1922
+ /* @__PURE__ */ c("path", { d: "M11 12h2" }),
1923
+ /* @__PURE__ */ c("path", { d: "M17 8m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" })
1924
+ ]
1925
+ }
1926
+ ) });
1927
+ }, No = {
1928
+ id: qs,
1929
+ label: "SEO",
1930
+ panel: Io,
1931
+ button: Lo,
1932
+ position: "top",
1933
+ width: 600,
1934
+ view: "modal"
1935
+ }, $s = "user-info", Co = () => {
1936
+ const { t: e } = Pe(), { user: t, logout: n } = xn(), s = le("onLogout", ms);
1937
+ return t ? /* @__PURE__ */ m(fa, { children: [
1938
+ /* @__PURE__ */ c(ha, { asChild: !0, children: /* @__PURE__ */ c(M, { variant: "ghost", className: "text-sm font-medium", children: /* @__PURE__ */ c(Wa, { className: "h-4 w-4" }) }) }),
1939
+ /* @__PURE__ */ m(ga, { className: "w-auto space-y-2 p-4", children: [
1940
+ /* @__PURE__ */ c("div", { className: "text-sm font-medium", children: t.name ?? t.email }),
1941
+ /* @__PURE__ */ c("div", { className: "text-xs text-muted-foreground", children: t.email }),
1942
+ /* @__PURE__ */ m(ma, { children: [
1943
+ /* @__PURE__ */ c(Ea, { asChild: !0, children: /* @__PURE__ */ c(M, { variant: "outline", size: "sm", className: "w-full", children: e("Logout") }) }),
1944
+ /* @__PURE__ */ m(pa, { children: [
1945
+ /* @__PURE__ */ m(ya, { children: [
1946
+ /* @__PURE__ */ c(Aa, { children: e("Are you sure you want to logout?") }),
1947
+ /* @__PURE__ */ c(Ta, { children: e("You will be redirected to the login page.") })
1948
+ ] }),
1949
+ /* @__PURE__ */ m(Sa, { children: [
1950
+ /* @__PURE__ */ c(_a, { children: e("Cancel") }),
1951
+ /* @__PURE__ */ c(
1952
+ Pa,
1953
+ {
1954
+ onClick: () => {
1955
+ n(), Hr(s) && s();
1956
+ },
1957
+ children: e("Logout")
1958
+ }
1959
+ )
1960
+ ] })
1961
+ ] })
1962
+ ] })
1963
+ ] })
1964
+ ] }) : null;
1965
+ }, Go = {
1966
+ id: $s,
1967
+ label: "User Info",
1968
+ button: Co,
1969
+ position: "bottom"
1970
+ }, Oo = () => {
1971
+ Gt(qs, No), Gt(Hs, bo), Gt($s, Go), (localStorage.getItem("chai-feature-flags") ?? "").includes("enable-ai-chat-panel") && Gt(Vs, Po);
1972
+ };
1973
+ var _ = {
1974
+ context: void 0,
1975
+ registry: void 0,
1976
+ effects: void 0,
1977
+ done: !1,
1978
+ getContextId() {
1979
+ return ts(this.context.count);
1980
+ },
1981
+ getNextContextId() {
1982
+ return ts(this.context.count++);
1983
+ }
1984
+ };
1985
+ function ts(e) {
1986
+ const t = String(e), n = t.length - 1;
1987
+ return _.context.id + (n ? String.fromCharCode(96 + n) : "") + t;
1988
+ }
1989
+ function lt(e) {
1990
+ _.context = e;
1991
+ }
1992
+ var Qs = !1, Do = (e, t) => e === t, qt = Symbol("solid-proxy"), zs = typeof Proxy == "function", js = Symbol("solid-track"), $t = {
1993
+ equals: Do
1994
+ }, Ws = nr, ve = 1, Qt = 2, Ys = {
1995
+ owned: null,
1996
+ cleanups: null,
1997
+ context: null,
1998
+ owner: null
1999
+ }, dn = {}, N = null, fn = null, xo = null, x = null, te = null, Se = null, tn = 0;
2000
+ function xe(e, t) {
2001
+ const n = x, s = N, r = e.length === 0, a = t === void 0 ? s : t, i = r ? Ys : {
2002
+ owned: null,
2003
+ cleanups: null,
2004
+ context: a ? a.context : null,
2005
+ owner: a
2006
+ }, o = r ? e : () => e(() => Z(() => ft(i)));
2007
+ N = i, x = null;
2008
+ try {
2009
+ return Ee(o, !0);
2010
+ } finally {
2011
+ x = n, N = s;
2012
+ }
2013
+ }
2014
+ function F(e, t) {
2015
+ t = t ? Object.assign({}, $t, t) : $t;
2016
+ const n = {
2017
+ value: e,
2018
+ observers: null,
2019
+ observerSlots: null,
2020
+ comparator: t.equals || void 0
2021
+ }, s = (r) => (typeof r == "function" && (r = r(n.value)), tr(n, r));
2022
+ return [er.bind(n), s];
2023
+ }
2024
+ function Ro(e, t, n) {
2025
+ const s = nn(e, t, !0, ve);
2026
+ at(s);
2027
+ }
2028
+ function Re(e, t, n) {
2029
+ const s = nn(e, t, !1, ve);
2030
+ at(s);
2031
+ }
2032
+ function Js(e, t, n) {
2033
+ Ws = qo;
2034
+ const s = nn(e, t, !1, ve);
2035
+ (!n || !n.render) && (s.user = !0), Se ? Se.push(s) : at(s);
2036
+ }
2037
+ function W(e, t, n) {
2038
+ n = n ? Object.assign({}, $t, n) : $t;
2039
+ const s = nn(e, t, !0, 0);
2040
+ return s.observers = null, s.observerSlots = null, s.comparator = n.equals || void 0, at(s), er.bind(s);
2041
+ }
2042
+ function ko(e) {
2043
+ return e && typeof e == "object" && "then" in e;
2044
+ }
2045
+ function Uo(e, t, n) {
2046
+ let s, r, a;
2047
+ s = !0, r = e, a = {};
2048
+ let i = null, o = dn, l = null, d = !1, u = "initialValue" in a, f = typeof s == "function" && W(s);
2049
+ const g = /* @__PURE__ */ new Set(), [h, p] = (a.storage || F)(a.initialValue), [T, S] = F(void 0), [D, y] = F(void 0, {
2050
+ equals: !1
2051
+ }), [w, v] = F(u ? "ready" : "unresolved");
2052
+ _.context && (l = _.getNextContextId(), a.ssrLoadFrom === "initial" ? o = a.initialValue : _.load && _.has(l) && (o = _.load(l)));
2053
+ function U(P, I, j, $) {
2054
+ return i === P && (i = null, $ !== void 0 && (u = !0), (P === o || I === o) && a.onHydrated && queueMicrotask(() => a.onHydrated($, {
2055
+ value: I
2056
+ })), o = dn, b(I, j)), I;
2057
+ }
2058
+ function b(P, I) {
2059
+ Ee(() => {
2060
+ I === void 0 && p(() => P), v(I !== void 0 ? "errored" : u ? "ready" : "unresolved"), S(I);
2061
+ for (const j of g.keys()) j.decrement();
2062
+ g.clear();
2063
+ }, !1);
2064
+ }
2065
+ function ye() {
2066
+ const P = Ko, I = h(), j = T();
2067
+ if (j !== void 0 && !i) throw j;
2068
+ return x && x.user, I;
2069
+ }
2070
+ function Ae(P = !0) {
2071
+ if (P !== !1 && d) return;
2072
+ d = !1;
2073
+ const I = f ? f() : s;
2074
+ if (I == null || I === !1) {
2075
+ U(i, Z(h));
2076
+ return;
2077
+ }
2078
+ let j;
2079
+ const $ = o !== dn ? o : Z(() => {
2080
+ try {
2081
+ return r(I, {
2082
+ value: h(),
2083
+ refetching: P
2084
+ });
2085
+ } catch (ue) {
2086
+ j = ue;
2087
+ }
2088
+ });
2089
+ if (j !== void 0) {
2090
+ U(i, void 0, Bt(j), I);
2091
+ return;
2092
+ } else if (!ko($))
2093
+ return U(i, $, void 0, I), $;
2094
+ return i = $, "v" in $ ? ($.s === 1 ? U(i, $.v, void 0, I) : U(i, void 0, Bt($.v), I), $) : (d = !0, queueMicrotask(() => d = !1), Ee(() => {
2095
+ v(u ? "refreshing" : "pending"), y();
2096
+ }, !1), $.then((ue) => U($, ue, void 0, I), (ue) => U($, void 0, Bt(ue), I)));
2097
+ }
2098
+ Object.defineProperties(ye, {
2099
+ state: {
2100
+ get: () => w()
2101
+ },
2102
+ error: {
2103
+ get: () => T()
2104
+ },
2105
+ loading: {
2106
+ get() {
2107
+ const P = w();
2108
+ return P === "pending" || P === "refreshing";
2109
+ }
2110
+ },
2111
+ latest: {
2112
+ get() {
2113
+ if (!u) return ye();
2114
+ const P = T();
2115
+ if (P && !i) throw P;
2116
+ return h();
2117
+ }
2118
+ }
2119
+ });
2120
+ let B = N;
2121
+ return f ? Ro(() => (B = N, Ae(!1))) : Ae(!1), [ye, {
2122
+ refetch: (P) => Zs(B, () => Ae(P)),
2123
+ mutate: p
2124
+ }];
2125
+ }
2126
+ function ru(e) {
2127
+ return Ee(e, !1);
2128
+ }
2129
+ function Z(e) {
2130
+ if (x === null) return e();
2131
+ const t = x;
2132
+ x = null;
2133
+ try {
2134
+ return e();
2135
+ } finally {
2136
+ x = t;
2137
+ }
2138
+ }
2139
+ function au(e, t, n) {
2140
+ const s = Array.isArray(e);
2141
+ let r, a = n && n.defer;
2142
+ return (i) => {
2143
+ let o;
2144
+ if (s) {
2145
+ o = Array(e.length);
2146
+ for (let d = 0; d < e.length; d++) o[d] = e[d]();
2147
+ } else o = e();
2148
+ if (a)
2149
+ return a = !1, i;
2150
+ const l = Z(() => t(o, r, i));
2151
+ return r = o, l;
2152
+ };
2153
+ }
2154
+ function Mo(e) {
2155
+ Js(() => Z(e));
2156
+ }
2157
+ function dt(e) {
2158
+ return N === null || (N.cleanups === null ? N.cleanups = [e] : N.cleanups.push(e)), e;
2159
+ }
2160
+ function ns() {
2161
+ return N;
2162
+ }
2163
+ function Zs(e, t) {
2164
+ const n = N, s = x;
2165
+ N = e, x = null;
2166
+ try {
2167
+ return Ee(t, !0);
2168
+ } catch (r) {
2169
+ Mn(r);
2170
+ } finally {
2171
+ N = n, x = s;
2172
+ }
2173
+ }
2174
+ function Bo(e) {
2175
+ const t = x, n = N;
2176
+ return Promise.resolve().then(() => {
2177
+ x = t, N = n;
2178
+ let s;
2179
+ return Ee(e, !1), x = N = null, s ? s.done : void 0;
2180
+ });
2181
+ }
2182
+ var [Fo, iu] = /* @__PURE__ */ F(!1);
2183
+ function ou() {
2184
+ return [Fo, Bo];
2185
+ }
2186
+ function lu(e, t) {
2187
+ const n = Symbol("context");
2188
+ return {
2189
+ id: n,
2190
+ Provider: $o(n),
2191
+ defaultValue: e
2192
+ };
2193
+ }
2194
+ function cu(e) {
2195
+ let t;
2196
+ return N && N.context && (t = N.context[e.id]) !== void 0 ? t : e.defaultValue;
2197
+ }
2198
+ function Xs(e) {
2199
+ const t = W(e), n = W(() => pn(t()));
2200
+ return n.toArray = () => {
2201
+ const s = n();
2202
+ return Array.isArray(s) ? s : s != null ? [s] : [];
2203
+ }, n;
2204
+ }
2205
+ var Ko;
2206
+ function er() {
2207
+ if (this.sources && this.state)
2208
+ if (this.state === ve) at(this);
2209
+ else {
2210
+ const e = te;
2211
+ te = null, Ee(() => jt(this), !1), te = e;
2212
+ }
2213
+ if (x) {
2214
+ const e = this.observers ? this.observers.length : 0;
2215
+ x.sources ? (x.sources.push(this), x.sourceSlots.push(e)) : (x.sources = [this], x.sourceSlots = [e]), this.observers ? (this.observers.push(x), this.observerSlots.push(x.sources.length - 1)) : (this.observers = [x], this.observerSlots = [x.sources.length - 1]);
2216
+ }
2217
+ return this.value;
2218
+ }
2219
+ function tr(e, t, n) {
2220
+ let s = e.value;
2221
+ return (!e.comparator || !e.comparator(s, t)) && (e.value = t, e.observers && e.observers.length && Ee(() => {
2222
+ for (let r = 0; r < e.observers.length; r += 1) {
2223
+ const a = e.observers[r], i = fn && fn.running;
2224
+ i && fn.disposed.has(a), (i ? !a.tState : !a.state) && (a.pure ? te.push(a) : Se.push(a), a.observers && sr(a)), i || (a.state = ve);
2225
+ }
2226
+ if (te.length > 1e6)
2227
+ throw te = [], new Error();
2228
+ }, !1)), t;
2229
+ }
2230
+ function at(e) {
2231
+ if (!e.fn) return;
2232
+ ft(e);
2233
+ const t = tn;
2234
+ Vo(e, e.value, t);
2235
+ }
2236
+ function Vo(e, t, n) {
2237
+ let s;
2238
+ const r = N, a = x;
2239
+ x = N = e;
2240
+ try {
2241
+ s = e.fn(t);
2242
+ } catch (i) {
2243
+ return e.pure && (e.state = ve, e.owned && e.owned.forEach(ft), e.owned = null), e.updatedAt = n + 1, Mn(i);
2244
+ } finally {
2245
+ x = a, N = r;
2246
+ }
2247
+ (!e.updatedAt || e.updatedAt <= n) && (e.updatedAt != null && "observers" in e ? tr(e, s) : e.value = s, e.updatedAt = n);
2248
+ }
2249
+ function nn(e, t, n, s = ve, r) {
2250
+ const a = {
2251
+ fn: e,
2252
+ state: s,
2253
+ updatedAt: null,
2254
+ owned: null,
2255
+ sources: null,
2256
+ sourceSlots: null,
2257
+ cleanups: null,
2258
+ value: t,
2259
+ owner: N,
2260
+ context: N ? N.context : null,
2261
+ pure: n
2262
+ };
2263
+ return N === null || N !== Ys && (N.owned ? N.owned.push(a) : N.owned = [a]), a;
2264
+ }
2265
+ function zt(e) {
2266
+ if (e.state === 0) return;
2267
+ if (e.state === Qt) return jt(e);
2268
+ if (e.suspense && Z(e.suspense.inFallback)) return e.suspense.effects.push(e);
2269
+ const t = [e];
2270
+ for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < tn); )
2271
+ e.state && t.push(e);
2272
+ for (let n = t.length - 1; n >= 0; n--)
2273
+ if (e = t[n], e.state === ve)
2274
+ at(e);
2275
+ else if (e.state === Qt) {
2276
+ const s = te;
2277
+ te = null, Ee(() => jt(e, t[0]), !1), te = s;
2278
+ }
2279
+ }
2280
+ function Ee(e, t) {
2281
+ if (te) return e();
2282
+ let n = !1;
2283
+ t || (te = []), Se ? n = !0 : Se = [], tn++;
2284
+ try {
2285
+ const s = e();
2286
+ return Ho(n), s;
2287
+ } catch (s) {
2288
+ n || (Se = null), te = null, Mn(s);
2289
+ }
2290
+ }
2291
+ function Ho(e) {
2292
+ if (te && (nr(te), te = null), e) return;
2293
+ const t = Se;
2294
+ Se = null, t.length && Ee(() => Ws(t), !1);
2295
+ }
2296
+ function nr(e) {
2297
+ for (let t = 0; t < e.length; t++) zt(e[t]);
2298
+ }
2299
+ function qo(e) {
2300
+ let t, n = 0;
2301
+ for (t = 0; t < e.length; t++) {
2302
+ const s = e[t];
2303
+ s.user ? e[n++] = s : zt(s);
2304
+ }
2305
+ if (_.context) {
2306
+ if (_.count) {
2307
+ _.effects || (_.effects = []), _.effects.push(...e.slice(0, n));
2308
+ return;
2309
+ }
2310
+ lt();
2311
+ }
2312
+ for (_.effects && (_.done || !_.count) && (e = [..._.effects, ...e], n += _.effects.length, delete _.effects), t = 0; t < n; t++) zt(e[t]);
2313
+ }
2314
+ function jt(e, t) {
2315
+ e.state = 0;
2316
+ for (let n = 0; n < e.sources.length; n += 1) {
2317
+ const s = e.sources[n];
2318
+ if (s.sources) {
2319
+ const r = s.state;
2320
+ r === ve ? s !== t && (!s.updatedAt || s.updatedAt < tn) && zt(s) : r === Qt && jt(s, t);
2321
+ }
2322
+ }
2323
+ }
2324
+ function sr(e) {
2325
+ for (let t = 0; t < e.observers.length; t += 1) {
2326
+ const n = e.observers[t];
2327
+ n.state || (n.state = Qt, n.pure ? te.push(n) : Se.push(n), n.observers && sr(n));
2328
+ }
2329
+ }
2330
+ function ft(e) {
2331
+ let t;
2332
+ if (e.sources)
2333
+ for (; e.sources.length; ) {
2334
+ const n = e.sources.pop(), s = e.sourceSlots.pop(), r = n.observers;
2335
+ if (r && r.length) {
2336
+ const a = r.pop(), i = n.observerSlots.pop();
2337
+ s < r.length && (a.sourceSlots[i] = s, r[s] = a, n.observerSlots[s] = i);
2338
+ }
2339
+ }
2340
+ if (e.tOwned) {
2341
+ for (t = e.tOwned.length - 1; t >= 0; t--) ft(e.tOwned[t]);
2342
+ delete e.tOwned;
2343
+ }
2344
+ if (e.owned) {
2345
+ for (t = e.owned.length - 1; t >= 0; t--) ft(e.owned[t]);
2346
+ e.owned = null;
2347
+ }
2348
+ if (e.cleanups) {
2349
+ for (t = e.cleanups.length - 1; t >= 0; t--) e.cleanups[t]();
2350
+ e.cleanups = null;
2351
+ }
2352
+ e.state = 0;
2353
+ }
2354
+ function Bt(e) {
2355
+ return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
2356
+ cause: e
2357
+ });
2358
+ }
2359
+ function Mn(e, t = N) {
2360
+ throw Bt(e);
2361
+ }
2362
+ function pn(e) {
2363
+ if (typeof e == "function" && !e.length) return pn(e());
2364
+ if (Array.isArray(e)) {
2365
+ const t = [];
2366
+ for (let n = 0; n < e.length; n++) {
2367
+ const s = pn(e[n]);
2368
+ Array.isArray(s) ? t.push.apply(t, s) : t.push(s);
2369
+ }
2370
+ return t;
2371
+ }
2372
+ return e;
2373
+ }
2374
+ function $o(e, t) {
2375
+ return function(s) {
2376
+ let r;
2377
+ return Re(() => r = Z(() => (N.context = {
2378
+ ...N.context,
2379
+ [e]: s.value
2380
+ }, Xs(() => s.children))), void 0), r;
2381
+ };
2382
+ }
2383
+ var yn = Symbol("fallback");
2384
+ function Wt(e) {
2385
+ for (let t = 0; t < e.length; t++) e[t]();
2386
+ }
2387
+ function Qo(e, t, n = {}) {
2388
+ let s = [], r = [], a = [], i = 0, o = t.length > 1 ? [] : null;
2389
+ return dt(() => Wt(a)), () => {
2390
+ let l = e() || [], d = l.length, u, f;
2391
+ return l[js], Z(() => {
2392
+ let h, p, T, S, D, y, w, v, U;
2393
+ if (d === 0)
2394
+ i !== 0 && (Wt(a), a = [], s = [], r = [], i = 0, o && (o = [])), n.fallback && (s = [yn], r[0] = xe((b) => (a[0] = b, n.fallback())), i = 1);
2395
+ else if (i === 0) {
2396
+ for (r = new Array(d), f = 0; f < d; f++)
2397
+ s[f] = l[f], r[f] = xe(g);
2398
+ i = d;
2399
+ } else {
2400
+ for (T = new Array(d), S = new Array(d), o && (D = new Array(d)), y = 0, w = Math.min(i, d); y < w && s[y] === l[y]; y++) ;
2401
+ for (w = i - 1, v = d - 1; w >= y && v >= y && s[w] === l[v]; w--, v--)
2402
+ T[v] = r[w], S[v] = a[w], o && (D[v] = o[w]);
2403
+ for (h = /* @__PURE__ */ new Map(), p = new Array(v + 1), f = v; f >= y; f--)
2404
+ U = l[f], u = h.get(U), p[f] = u === void 0 ? -1 : u, h.set(U, f);
2405
+ for (u = y; u <= w; u++)
2406
+ U = s[u], f = h.get(U), f !== void 0 && f !== -1 ? (T[f] = r[u], S[f] = a[u], o && (D[f] = o[u]), f = p[f], h.set(U, f)) : a[u]();
2407
+ for (f = y; f < d; f++)
2408
+ f in T ? (r[f] = T[f], a[f] = S[f], o && (o[f] = D[f], o[f](f))) : r[f] = xe(g);
2409
+ r = r.slice(0, i = d), s = l.slice(0);
2410
+ }
2411
+ return r;
2412
+ });
2413
+ function g(h) {
2414
+ if (a[f] = h, o) {
2415
+ const [p, T] = F(f);
2416
+ return o[f] = T, t(l[f], p);
2417
+ }
2418
+ return t(l[f]);
2419
+ }
2420
+ };
2421
+ }
2422
+ function zo(e, t, n = {}) {
2423
+ let s = [], r = [], a = [], i = [], o = 0, l;
2424
+ return dt(() => Wt(a)), () => {
2425
+ const d = e() || [], u = d.length;
2426
+ return d[js], Z(() => {
2427
+ if (u === 0)
2428
+ return o !== 0 && (Wt(a), a = [], s = [], r = [], o = 0, i = []), n.fallback && (s = [yn], r[0] = xe((g) => (a[0] = g, n.fallback())), o = 1), r;
2429
+ for (s[0] === yn && (a[0](), a = [], s = [], r = [], o = 0), l = 0; l < u; l++)
2430
+ l < s.length && s[l] !== d[l] ? i[l](() => d[l]) : l >= s.length && (r[l] = xe(f));
2431
+ for (; l < s.length; l++)
2432
+ a[l]();
2433
+ return o = i.length = a.length = u, s = d.slice(0), r = r.slice(0, o);
2434
+ });
2435
+ function f(g) {
2436
+ a[l] = g;
2437
+ const [h, p] = F(d[l]);
2438
+ return i[l] = p, t(h, l);
2439
+ }
2440
+ };
2441
+ }
2442
+ function rr(e, t) {
2443
+ return Z(() => e(t || {}));
2444
+ }
2445
+ function xt() {
2446
+ return !0;
2447
+ }
2448
+ var An = {
2449
+ get(e, t, n) {
2450
+ return t === qt ? n : e.get(t);
2451
+ },
2452
+ has(e, t) {
2453
+ return t === qt ? !0 : e.has(t);
2454
+ },
2455
+ set: xt,
2456
+ deleteProperty: xt,
2457
+ getOwnPropertyDescriptor(e, t) {
2458
+ return {
2459
+ configurable: !0,
2460
+ enumerable: !0,
2461
+ get() {
2462
+ return e.get(t);
2463
+ },
2464
+ set: xt,
2465
+ deleteProperty: xt
2466
+ };
2467
+ },
2468
+ ownKeys(e) {
2469
+ return e.keys();
2470
+ }
2471
+ };
2472
+ function hn(e) {
2473
+ return (e = typeof e == "function" ? e() : e) ? e : {};
2474
+ }
2475
+ function jo() {
2476
+ for (let e = 0, t = this.length; e < t; ++e) {
2477
+ const n = this[e]();
2478
+ if (n !== void 0) return n;
2479
+ }
2480
+ }
2481
+ function ar(...e) {
2482
+ let t = !1;
2483
+ for (let i = 0; i < e.length; i++) {
2484
+ const o = e[i];
2485
+ t = t || !!o && qt in o, e[i] = typeof o == "function" ? (t = !0, W(o)) : o;
2486
+ }
2487
+ if (zs && t)
2488
+ return new Proxy({
2489
+ get(i) {
2490
+ for (let o = e.length - 1; o >= 0; o--) {
2491
+ const l = hn(e[o])[i];
2492
+ if (l !== void 0) return l;
2493
+ }
2494
+ },
2495
+ has(i) {
2496
+ for (let o = e.length - 1; o >= 0; o--)
2497
+ if (i in hn(e[o])) return !0;
2498
+ return !1;
2499
+ },
2500
+ keys() {
2501
+ const i = [];
2502
+ for (let o = 0; o < e.length; o++) i.push(...Object.keys(hn(e[o])));
2503
+ return [...new Set(i)];
2504
+ }
2505
+ }, An);
2506
+ const n = {}, s = /* @__PURE__ */ Object.create(null);
2507
+ for (let i = e.length - 1; i >= 0; i--) {
2508
+ const o = e[i];
2509
+ if (!o) continue;
2510
+ const l = Object.getOwnPropertyNames(o);
2511
+ for (let d = l.length - 1; d >= 0; d--) {
2512
+ const u = l[d];
2513
+ if (u === "__proto__" || u === "constructor") continue;
2514
+ const f = Object.getOwnPropertyDescriptor(o, u);
2515
+ if (!s[u])
2516
+ s[u] = f.get ? {
2517
+ enumerable: !0,
2518
+ configurable: !0,
2519
+ get: jo.bind(n[u] = [f.get.bind(o)])
2520
+ } : f.value !== void 0 ? f : void 0;
2521
+ else {
2522
+ const g = n[u];
2523
+ g && (f.get ? g.push(f.get.bind(o)) : f.value !== void 0 && g.push(() => f.value));
2524
+ }
2525
+ }
2526
+ }
2527
+ const r = {}, a = Object.keys(s);
2528
+ for (let i = a.length - 1; i >= 0; i--) {
2529
+ const o = a[i], l = s[o];
2530
+ l && l.get ? Object.defineProperty(r, o, l) : r[o] = l ? l.value : void 0;
2531
+ }
2532
+ return r;
2533
+ }
2534
+ function Wo(e, ...t) {
2535
+ if (zs && qt in e) {
2536
+ const r = new Set(t.length > 1 ? t.flat() : t[0]), a = t.map((i) => new Proxy({
2537
+ get(o) {
2538
+ return i.includes(o) ? e[o] : void 0;
2539
+ },
2540
+ has(o) {
2541
+ return i.includes(o) && o in e;
2542
+ },
2543
+ keys() {
2544
+ return i.filter((o) => o in e);
2545
+ }
2546
+ }, An));
2547
+ return a.push(new Proxy({
2548
+ get(i) {
2549
+ return r.has(i) ? void 0 : e[i];
2550
+ },
2551
+ has(i) {
2552
+ return r.has(i) ? !1 : i in e;
2553
+ },
2554
+ keys() {
2555
+ return Object.keys(e).filter((i) => !r.has(i));
2556
+ }
2557
+ }, An)), a;
2558
+ }
2559
+ const n = {}, s = t.map(() => ({}));
2560
+ for (const r of Object.getOwnPropertyNames(e)) {
2561
+ const a = Object.getOwnPropertyDescriptor(e, r), i = !a.get && !a.set && a.enumerable && a.writable && a.configurable;
2562
+ let o = !1, l = 0;
2563
+ for (const d of t)
2564
+ d.includes(r) && (o = !0, i ? s[l][r] = a.value : Object.defineProperty(s[l], r, a)), ++l;
2565
+ o || (i ? n[r] = a.value : Object.defineProperty(n, r, a));
2566
+ }
2567
+ return [...s, n];
2568
+ }
2569
+ function ir(e) {
2570
+ let t, n;
2571
+ const s = (r) => {
2572
+ const a = _.context;
2573
+ if (a) {
2574
+ const [o, l] = F();
2575
+ _.count || (_.count = 0), _.count++, (n || (n = e())).then((d) => {
2576
+ !_.done && lt(a), _.count--, l(() => d.default), lt();
2577
+ }), t = o;
2578
+ } else if (!t) {
2579
+ const [o] = Uo(() => (n || (n = e())).then((l) => l.default));
2580
+ t = o;
2581
+ }
2582
+ let i;
2583
+ return W(() => (i = t()) ? Z(() => {
2584
+ if (!a || _.done) return i(r);
2585
+ const o = _.context;
2586
+ lt(a);
2587
+ const l = i(r);
2588
+ return lt(o), l;
2589
+ }) : "");
2590
+ };
2591
+ return s.preload = () => n || ((n = e()).then((r) => t = () => r.default), n), s;
2592
+ }
2593
+ var Yo = 0;
2594
+ function uu() {
2595
+ return _.context ? _.getNextContextId() : `cl-${Yo++}`;
2596
+ }
2597
+ var or = (e) => `Stale read from <${e}>.`;
2598
+ function du(e) {
2599
+ const t = "fallback" in e && {
2600
+ fallback: () => e.fallback
2601
+ };
2602
+ return W(Qo(() => e.each, e.children, t || void 0));
2603
+ }
2604
+ function fu(e) {
2605
+ const t = "fallback" in e && {
2606
+ fallback: () => e.fallback
2607
+ };
2608
+ return W(zo(() => e.each, e.children, t || void 0));
2609
+ }
2610
+ function hu(e) {
2611
+ const t = e.keyed, n = W(() => e.when, void 0, void 0), s = t ? n : W(n, void 0, {
2612
+ equals: (r, a) => !r == !a
2613
+ });
2614
+ return W(() => {
2615
+ const r = s();
2616
+ if (r) {
2617
+ const a = e.children;
2618
+ return typeof a == "function" && a.length > 0 ? Z(() => a(t ? r : () => {
2619
+ if (!Z(s)) throw or("Show");
2620
+ return n();
2621
+ })) : a;
2622
+ }
2623
+ return e.fallback;
2624
+ }, void 0, void 0);
2625
+ }
2626
+ function gu(e) {
2627
+ const t = Xs(() => e.children), n = W(() => {
2628
+ const s = t(), r = Array.isArray(s) ? s : [s];
2629
+ let a = () => {
2630
+ };
2631
+ for (let i = 0; i < r.length; i++) {
2632
+ const o = i, l = r[i], d = a, u = W(() => d() ? void 0 : l.when, void 0, void 0), f = l.keyed ? u : W(u, void 0, {
2633
+ equals: (g, h) => !g == !h
2634
+ });
2635
+ a = () => d() || (f() ? [o, u, l] : void 0);
2636
+ }
2637
+ return a;
2638
+ });
2639
+ return W(() => {
2640
+ const s = n()();
2641
+ if (!s) return e.fallback;
2642
+ const [r, a, i] = s, o = i.children;
2643
+ return typeof o == "function" && o.length > 0 ? Z(() => o(i.keyed ? a() : () => {
2644
+ var d;
2645
+ if (((d = Z(n)()) == null ? void 0 : d[0]) !== r) throw or("Match");
2646
+ return a();
2647
+ })) : o;
2648
+ }, void 0, void 0);
2649
+ }
2650
+ function mu(e) {
2651
+ return e;
2652
+ }
2653
+ var Jo = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"], Zo = /* @__PURE__ */ new Set(["className", "value", "readOnly", "noValidate", "formNoValidate", "isMap", "noModule", "playsInline", ...Jo]), Xo = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]), el = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
2654
+ className: "class",
2655
+ htmlFor: "for"
2656
+ }), tl = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
2657
+ class: "className",
2658
+ novalidate: {
2659
+ $: "noValidate",
2660
+ FORM: 1
2661
+ },
2662
+ formnovalidate: {
2663
+ $: "formNoValidate",
2664
+ BUTTON: 1,
2665
+ INPUT: 1
2666
+ },
2667
+ ismap: {
2668
+ $: "isMap",
2669
+ IMG: 1
2670
+ },
2671
+ nomodule: {
2672
+ $: "noModule",
2673
+ SCRIPT: 1
2674
+ },
2675
+ playsinline: {
2676
+ $: "playsInline",
2677
+ VIDEO: 1
2678
+ },
2679
+ readonly: {
2680
+ $: "readOnly",
2681
+ INPUT: 1,
2682
+ TEXTAREA: 1
2683
+ }
2684
+ });
2685
+ function nl(e, t) {
2686
+ const n = tl[e];
2687
+ return typeof n == "object" ? n[t] ? n.$ : void 0 : n;
2688
+ }
2689
+ var sl = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]), rl = /* @__PURE__ */ new Set([
2690
+ "altGlyph",
2691
+ "altGlyphDef",
2692
+ "altGlyphItem",
2693
+ "animate",
2694
+ "animateColor",
2695
+ "animateMotion",
2696
+ "animateTransform",
2697
+ "circle",
2698
+ "clipPath",
2699
+ "color-profile",
2700
+ "cursor",
2701
+ "defs",
2702
+ "desc",
2703
+ "ellipse",
2704
+ "feBlend",
2705
+ "feColorMatrix",
2706
+ "feComponentTransfer",
2707
+ "feComposite",
2708
+ "feConvolveMatrix",
2709
+ "feDiffuseLighting",
2710
+ "feDisplacementMap",
2711
+ "feDistantLight",
2712
+ "feDropShadow",
2713
+ "feFlood",
2714
+ "feFuncA",
2715
+ "feFuncB",
2716
+ "feFuncG",
2717
+ "feFuncR",
2718
+ "feGaussianBlur",
2719
+ "feImage",
2720
+ "feMerge",
2721
+ "feMergeNode",
2722
+ "feMorphology",
2723
+ "feOffset",
2724
+ "fePointLight",
2725
+ "feSpecularLighting",
2726
+ "feSpotLight",
2727
+ "feTile",
2728
+ "feTurbulence",
2729
+ "filter",
2730
+ "font",
2731
+ "font-face",
2732
+ "font-face-format",
2733
+ "font-face-name",
2734
+ "font-face-src",
2735
+ "font-face-uri",
2736
+ "foreignObject",
2737
+ "g",
2738
+ "glyph",
2739
+ "glyphRef",
2740
+ "hkern",
2741
+ "image",
2742
+ "line",
2743
+ "linearGradient",
2744
+ "marker",
2745
+ "mask",
2746
+ "metadata",
2747
+ "missing-glyph",
2748
+ "mpath",
2749
+ "path",
2750
+ "pattern",
2751
+ "polygon",
2752
+ "polyline",
2753
+ "radialGradient",
2754
+ "rect",
2755
+ "set",
2756
+ "stop",
2757
+ "svg",
2758
+ "switch",
2759
+ "symbol",
2760
+ "text",
2761
+ "textPath",
2762
+ "tref",
2763
+ "tspan",
2764
+ "use",
2765
+ "view",
2766
+ "vkern"
2767
+ ]), al = {
2768
+ xlink: "http://www.w3.org/1999/xlink",
2769
+ xml: "http://www.w3.org/XML/1998/namespace"
2770
+ }, Eu = (e) => W(() => e());
2771
+ function il(e, t, n) {
2772
+ let s = n.length, r = t.length, a = s, i = 0, o = 0, l = t[r - 1].nextSibling, d = null;
2773
+ for (; i < r || o < a; ) {
2774
+ if (t[i] === n[o]) {
2775
+ i++, o++;
2776
+ continue;
2777
+ }
2778
+ for (; t[r - 1] === n[a - 1]; )
2779
+ r--, a--;
2780
+ if (r === i) {
2781
+ const u = a < s ? o ? n[o - 1].nextSibling : n[a - o] : l;
2782
+ for (; o < a; ) e.insertBefore(n[o++], u);
2783
+ } else if (a === o)
2784
+ for (; i < r; )
2785
+ (!d || !d.has(t[i])) && t[i].remove(), i++;
2786
+ else if (t[i] === n[a - 1] && n[o] === t[r - 1]) {
2787
+ const u = t[--r].nextSibling;
2788
+ e.insertBefore(n[o++], t[i++].nextSibling), e.insertBefore(n[--a], u), t[r] = n[a];
2789
+ } else {
2790
+ if (!d) {
2791
+ d = /* @__PURE__ */ new Map();
2792
+ let f = o;
2793
+ for (; f < a; ) d.set(n[f], f++);
2794
+ }
2795
+ const u = d.get(t[i]);
2796
+ if (u != null)
2797
+ if (o < u && u < a) {
2798
+ let f = i, g = 1, h;
2799
+ for (; ++f < r && f < a && !((h = d.get(t[f])) == null || h !== u + g); )
2800
+ g++;
2801
+ if (g > u - o) {
2802
+ const p = t[i];
2803
+ for (; o < u; ) e.insertBefore(n[o++], p);
2804
+ } else e.replaceChild(n[o++], t[i++]);
2805
+ } else i++;
2806
+ else t[i++].remove();
2807
+ }
2808
+ }
2809
+ }
2810
+ var ct = "_$DX_DELEGATE";
2811
+ function lr(e, t, n, s = {}) {
2812
+ let r;
2813
+ return xe((a) => {
2814
+ r = a, t === document ? e() : Sn(t, e(), t.firstChild ? null : void 0, n);
2815
+ }, s.owner), () => {
2816
+ r(), t.textContent = "";
2817
+ };
2818
+ }
2819
+ function pu(e, t, n, s) {
2820
+ let r;
2821
+ const a = () => {
2822
+ const o = document.createElement("template");
2823
+ return o.innerHTML = e, o.content.firstChild;
2824
+ }, i = () => (r || (r = a())).cloneNode(!0);
2825
+ return i.cloneNode = i, i;
2826
+ }
2827
+ function ol(e, t = window.document) {
2828
+ const n = t[ct] || (t[ct] = /* @__PURE__ */ new Set());
2829
+ for (let s = 0, r = e.length; s < r; s++) {
2830
+ const a = e[s];
2831
+ n.has(a) || (n.add(a), t.addEventListener(a, cr));
2832
+ }
2833
+ }
2834
+ function yu(e = window.document) {
2835
+ if (e[ct]) {
2836
+ for (let t of e[ct].keys()) e.removeEventListener(t, cr);
2837
+ delete e[ct];
2838
+ }
2839
+ }
2840
+ function Tn(e, t, n) {
2841
+ Fe(e) || (n == null ? e.removeAttribute(t) : e.setAttribute(t, n));
2842
+ }
2843
+ function ll(e, t, n, s) {
2844
+ Fe(e) || (s == null ? e.removeAttributeNS(t, n) : e.setAttributeNS(t, n, s));
2845
+ }
2846
+ function cl(e, t, n) {
2847
+ Fe(e) || (n ? e.setAttribute(t, "") : e.removeAttribute(t));
2848
+ }
2849
+ function ul(e, t) {
2850
+ Fe(e) || (t == null ? e.removeAttribute("class") : e.className = t);
2851
+ }
2852
+ function dl(e, t, n, s) {
2853
+ if (s)
2854
+ Array.isArray(n) ? (e[`$$${t}`] = n[0], e[`$$${t}Data`] = n[1]) : e[`$$${t}`] = n;
2855
+ else if (Array.isArray(n)) {
2856
+ const r = n[0];
2857
+ e.addEventListener(t, n[0] = (a) => r.call(e, n[1], a));
2858
+ } else e.addEventListener(t, n, typeof n != "function" && n);
2859
+ }
2860
+ function fl(e, t, n = {}) {
2861
+ const s = Object.keys(t || {}), r = Object.keys(n);
2862
+ let a, i;
2863
+ for (a = 0, i = r.length; a < i; a++) {
2864
+ const o = r[a];
2865
+ !o || o === "undefined" || t[o] || (ss(e, o, !1), delete n[o]);
2866
+ }
2867
+ for (a = 0, i = s.length; a < i; a++) {
2868
+ const o = s[a], l = !!t[o];
2869
+ !o || o === "undefined" || n[o] === l || !l || (ss(e, o, !0), n[o] = l);
2870
+ }
2871
+ return n;
2872
+ }
2873
+ function hl(e, t, n) {
2874
+ if (!t) return n ? Tn(e, "style") : t;
2875
+ const s = e.style;
2876
+ if (typeof t == "string") return s.cssText = t;
2877
+ typeof n == "string" && (s.cssText = n = void 0), n || (n = {}), t || (t = {});
2878
+ let r, a;
2879
+ for (a in n)
2880
+ t[a] == null && s.removeProperty(a), delete n[a];
2881
+ for (a in t)
2882
+ r = t[a], r !== n[a] && (s.setProperty(a, r), n[a] = r);
2883
+ return n;
2884
+ }
2885
+ function gl(e, t = {}, n, s) {
2886
+ const r = {};
2887
+ return s || Re(() => r.children = ht(e, t.children, r.children)), Re(() => typeof t.ref == "function" && ml(t.ref, e)), Re(() => El(e, t, n, !0, r, !0)), r;
2888
+ }
2889
+ function ml(e, t, n) {
2890
+ return Z(() => e(t, n));
2891
+ }
2892
+ function Sn(e, t, n, s) {
2893
+ if (n !== void 0 && !s && (s = []), typeof t != "function") return ht(e, t, s, n);
2894
+ Re((r) => ht(e, t(), r, n), s);
2895
+ }
2896
+ function El(e, t, n, s, r = {}, a = !1) {
2897
+ t || (t = {});
2898
+ for (const i in r)
2899
+ if (!(i in t)) {
2900
+ if (i === "children") continue;
2901
+ r[i] = rs(e, i, null, r[i], n, a, t);
2902
+ }
2903
+ for (const i in t) {
2904
+ if (i === "children")
2905
+ continue;
2906
+ const o = t[i];
2907
+ r[i] = rs(e, i, o, r[i], n, a, t);
2908
+ }
2909
+ }
2910
+ function pl(e) {
2911
+ let t, n;
2912
+ return !Fe() || !(t = _.registry.get(n = Al())) ? e() : (_.completed && _.completed.add(t), _.registry.delete(n), t);
2913
+ }
2914
+ function Fe(e) {
2915
+ return !!_.context && !_.done && (!e || e.isConnected);
2916
+ }
2917
+ function yl(e) {
2918
+ return e.toLowerCase().replace(/-([a-z])/g, (t, n) => n.toUpperCase());
2919
+ }
2920
+ function ss(e, t, n) {
2921
+ const s = t.trim().split(/\s+/);
2922
+ for (let r = 0, a = s.length; r < a; r++) e.classList.toggle(s[r], n);
2923
+ }
2924
+ function rs(e, t, n, s, r, a, i) {
2925
+ let o, l, d, u, f;
2926
+ if (t === "style") return hl(e, n, s);
2927
+ if (t === "classList") return fl(e, n, s);
2928
+ if (n === s) return s;
2929
+ if (t === "ref")
2930
+ a || n(e);
2931
+ else if (t.slice(0, 3) === "on:") {
2932
+ const g = t.slice(3);
2933
+ s && e.removeEventListener(g, s, typeof s != "function" && s), n && e.addEventListener(g, n, typeof n != "function" && n);
2934
+ } else if (t.slice(0, 10) === "oncapture:") {
2935
+ const g = t.slice(10);
2936
+ s && e.removeEventListener(g, s, !0), n && e.addEventListener(g, n, !0);
2937
+ } else if (t.slice(0, 2) === "on") {
2938
+ const g = t.slice(2).toLowerCase(), h = sl.has(g);
2939
+ if (!h && s) {
2940
+ const p = Array.isArray(s) ? s[0] : s;
2941
+ e.removeEventListener(g, p);
2942
+ }
2943
+ (h || n) && (dl(e, g, n, h), h && ol([g]));
2944
+ } else if (t.slice(0, 5) === "attr:")
2945
+ Tn(e, t.slice(5), n);
2946
+ else if (t.slice(0, 5) === "bool:")
2947
+ cl(e, t.slice(5), n);
2948
+ else if ((f = t.slice(0, 5) === "prop:") || (d = Xo.has(t)) || !r && ((u = nl(t, e.tagName)) || (l = Zo.has(t))) || (o = e.nodeName.includes("-") || "is" in i)) {
2949
+ if (f)
2950
+ t = t.slice(5), l = !0;
2951
+ else if (Fe(e)) return n;
2952
+ t === "class" || t === "className" ? ul(e, n) : o && !l && !d ? e[yl(t)] = n : e[u || t] = n;
2953
+ } else {
2954
+ const g = r && t.indexOf(":") > -1 && al[t.split(":")[0]];
2955
+ g ? ll(e, g, t, n) : Tn(e, el[t] || t, n);
2956
+ }
2957
+ return n;
2958
+ }
2959
+ function cr(e) {
2960
+ if (_.registry && _.events && _.events.find(([l, d]) => d === e))
2961
+ return;
2962
+ let t = e.target;
2963
+ const n = `$$${e.type}`, s = e.target, r = e.currentTarget, a = (l) => Object.defineProperty(e, "target", {
2964
+ configurable: !0,
2965
+ value: l
2966
+ }), i = () => {
2967
+ const l = t[n];
2968
+ if (l && !t.disabled) {
2969
+ const d = t[`${n}Data`];
2970
+ if (d !== void 0 ? l.call(t, d, e) : l.call(t, e), e.cancelBubble) return;
2971
+ }
2972
+ return t.host && typeof t.host != "string" && !t.host._$host && t.contains(e.target) && a(t.host), !0;
2973
+ }, o = () => {
2974
+ for (; i() && (t = t._$host || t.parentNode || t.host); ) ;
2975
+ };
2976
+ if (Object.defineProperty(e, "currentTarget", {
2977
+ configurable: !0,
2978
+ get() {
2979
+ return t || document;
2980
+ }
2981
+ }), _.registry && !_.done && (_.done = _$HY.done = !0), e.composedPath) {
2982
+ const l = e.composedPath();
2983
+ a(l[0]);
2984
+ for (let d = 0; d < l.length - 2 && (t = l[d], !!i()); d++) {
2985
+ if (t._$host) {
2986
+ t = t._$host, o();
2987
+ break;
2988
+ }
2989
+ if (t.parentNode === r)
2990
+ break;
2991
+ }
2992
+ } else o();
2993
+ a(s);
2994
+ }
2995
+ function ht(e, t, n, s, r) {
2996
+ const a = Fe(e);
2997
+ if (a) {
2998
+ !n && (n = [...e.childNodes]);
2999
+ let l = [];
3000
+ for (let d = 0; d < n.length; d++) {
3001
+ const u = n[d];
3002
+ u.nodeType === 8 && u.data.slice(0, 2) === "!$" ? u.remove() : l.push(u);
3003
+ }
3004
+ n = l;
3005
+ }
3006
+ for (; typeof n == "function"; ) n = n();
3007
+ if (t === n) return n;
3008
+ const i = typeof t, o = s !== void 0;
3009
+ if (e = o && n[0] && n[0].parentNode || e, i === "string" || i === "number") {
3010
+ if (a || i === "number" && (t = t.toString(), t === n))
3011
+ return n;
3012
+ if (o) {
3013
+ let l = n[0];
3014
+ l && l.nodeType === 3 ? l.data !== t && (l.data = t) : l = document.createTextNode(t), n = Ke(e, n, s, l);
3015
+ } else
3016
+ n !== "" && typeof n == "string" ? n = e.firstChild.data = t : n = e.textContent = t;
3017
+ } else if (t == null || i === "boolean") {
3018
+ if (a) return n;
3019
+ n = Ke(e, n, s);
3020
+ } else {
3021
+ if (i === "function")
3022
+ return Re(() => {
3023
+ let l = t();
3024
+ for (; typeof l == "function"; ) l = l();
3025
+ n = ht(e, l, n, s);
3026
+ }), () => n;
3027
+ if (Array.isArray(t)) {
3028
+ const l = [], d = n && Array.isArray(n);
3029
+ if (_n(l, t, n, r))
3030
+ return Re(() => n = ht(e, l, n, s, !0)), () => n;
3031
+ if (a) {
3032
+ if (!l.length) return n;
3033
+ if (s === void 0) return n = [...e.childNodes];
3034
+ let u = l[0];
3035
+ if (u.parentNode !== e) return n;
3036
+ const f = [u];
3037
+ for (; (u = u.nextSibling) !== s; ) f.push(u);
3038
+ return n = f;
3039
+ }
3040
+ if (l.length === 0) {
3041
+ if (n = Ke(e, n, s), o) return n;
3042
+ } else d ? n.length === 0 ? as(e, l, s) : il(e, n, l) : (n && Ke(e), as(e, l));
3043
+ n = l;
3044
+ } else if (t.nodeType) {
3045
+ if (a && t.parentNode) return n = o ? [t] : t;
3046
+ if (Array.isArray(n)) {
3047
+ if (o) return n = Ke(e, n, s, t);
3048
+ Ke(e, n, null, t);
3049
+ } else n == null || n === "" || !e.firstChild ? e.appendChild(t) : e.replaceChild(t, e.firstChild);
3050
+ n = t;
3051
+ }
3052
+ }
3053
+ return n;
3054
+ }
3055
+ function _n(e, t, n, s) {
3056
+ let r = !1;
3057
+ for (let a = 0, i = t.length; a < i; a++) {
3058
+ let o = t[a], l = n && n[e.length], d;
3059
+ if (!(o == null || o === !0 || o === !1)) if ((d = typeof o) == "object" && o.nodeType)
3060
+ e.push(o);
3061
+ else if (Array.isArray(o))
3062
+ r = _n(e, o, l) || r;
3063
+ else if (d === "function")
3064
+ if (s) {
3065
+ for (; typeof o == "function"; ) o = o();
3066
+ r = _n(e, Array.isArray(o) ? o : [o], Array.isArray(l) ? l : [l]) || r;
3067
+ } else
3068
+ e.push(o), r = !0;
3069
+ else {
3070
+ const u = String(o);
3071
+ l && l.nodeType === 3 && l.data === u ? e.push(l) : e.push(document.createTextNode(u));
3072
+ }
3073
+ }
3074
+ return r;
3075
+ }
3076
+ function as(e, t, n = null) {
3077
+ for (let s = 0, r = t.length; s < r; s++) e.insertBefore(t[s], n);
3078
+ }
3079
+ function Ke(e, t, n, s) {
3080
+ if (n === void 0) return e.textContent = "";
3081
+ const r = s || document.createTextNode("");
3082
+ if (t.length) {
3083
+ let a = !1;
3084
+ for (let i = t.length - 1; i >= 0; i--) {
3085
+ const o = t[i];
3086
+ if (r !== o) {
3087
+ const l = o.parentNode === e;
3088
+ !a && !i ? l ? e.replaceChild(r, o) : e.insertBefore(r, n) : l && o.remove();
3089
+ } else a = !0;
3090
+ }
3091
+ } else e.insertBefore(r, n);
3092
+ return [r];
3093
+ }
3094
+ function Al() {
3095
+ return _.getNextContextId();
3096
+ }
3097
+ var Tl = "http://www.w3.org/2000/svg";
3098
+ function ur(e, t = !1) {
3099
+ return t ? document.createElementNS(Tl, e) : document.createElement(e);
3100
+ }
3101
+ function Au(e) {
3102
+ const {
3103
+ useShadow: t
3104
+ } = e, n = document.createTextNode(""), s = () => e.mount || document.body, r = ns();
3105
+ let a, i = !!_.context;
3106
+ return Js(() => {
3107
+ i && (ns().user = i = !1), a || (a = Zs(r, () => W(() => e.children)));
3108
+ const o = s();
3109
+ if (o instanceof HTMLHeadElement) {
3110
+ const [l, d] = F(!1), u = () => d(!0);
3111
+ xe((f) => Sn(o, () => l() ? f() : a(), null)), dt(u);
3112
+ } else {
3113
+ const l = ur(e.isSVG ? "g" : "div", e.isSVG), d = t && l.attachShadow ? l.attachShadow({
3114
+ mode: "open"
3115
+ }) : l;
3116
+ Object.defineProperty(l, "_$host", {
3117
+ get() {
3118
+ return n.parentNode;
3119
+ },
3120
+ configurable: !0
3121
+ }), Sn(d, a), o.appendChild(l), e.ref && e.ref(l), dt(() => o.removeChild(l));
3122
+ }
3123
+ }, void 0, {
3124
+ render: !i
3125
+ }), n;
3126
+ }
3127
+ function Sl(e, t) {
3128
+ const n = W(e);
3129
+ return W(() => {
3130
+ const s = n();
3131
+ switch (typeof s) {
3132
+ case "function":
3133
+ return Z(() => s(t));
3134
+ case "string":
3135
+ const r = rl.has(s), a = _.context ? pl() : ur(s, r);
3136
+ return gl(a, t, r), a;
3137
+ }
3138
+ });
3139
+ }
3140
+ function Tu(e) {
3141
+ const [, t] = Wo(e, ["component"]);
3142
+ return Sl(() => e.component, t);
3143
+ }
3144
+ var _l = class {
3145
+ constructor() {
3146
+ this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
3147
+ }
3148
+ set(e, t) {
3149
+ this.keyToValue.set(e, t), this.valueToKey.set(t, e);
3150
+ }
3151
+ getByKey(e) {
3152
+ return this.keyToValue.get(e);
3153
+ }
3154
+ getByValue(e) {
3155
+ return this.valueToKey.get(e);
3156
+ }
3157
+ clear() {
3158
+ this.keyToValue.clear(), this.valueToKey.clear();
3159
+ }
3160
+ }, dr = class {
3161
+ constructor(e) {
3162
+ this.generateIdentifier = e, this.kv = new _l();
3163
+ }
3164
+ register(e, t) {
3165
+ this.kv.getByValue(e) || (t || (t = this.generateIdentifier(e)), this.kv.set(t, e));
3166
+ }
3167
+ clear() {
3168
+ this.kv.clear();
3169
+ }
3170
+ getIdentifier(e) {
3171
+ return this.kv.getByValue(e);
3172
+ }
3173
+ getValue(e) {
3174
+ return this.kv.getByKey(e);
3175
+ }
3176
+ }, Pl = class extends dr {
3177
+ constructor() {
3178
+ super((e) => e.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
3179
+ }
3180
+ register(e, t) {
3181
+ typeof t == "object" ? (t.allowProps && this.classToAllowedProps.set(e, t.allowProps), super.register(e, t.identifier)) : super.register(e, t);
3182
+ }
3183
+ getAllowedProps(e) {
3184
+ return this.classToAllowedProps.get(e);
3185
+ }
3186
+ };
3187
+ function wl(e) {
3188
+ if ("values" in Object)
3189
+ return Object.values(e);
3190
+ const t = [];
3191
+ for (const n in e)
3192
+ e.hasOwnProperty(n) && t.push(e[n]);
3193
+ return t;
3194
+ }
3195
+ function vl(e, t) {
3196
+ const n = wl(e);
3197
+ if ("find" in n)
3198
+ return n.find(t);
3199
+ const s = n;
3200
+ for (let r = 0; r < s.length; r++) {
3201
+ const a = s[r];
3202
+ if (t(a))
3203
+ return a;
3204
+ }
3205
+ }
3206
+ function rt(e, t) {
3207
+ Object.entries(e).forEach(([n, s]) => t(s, n));
3208
+ }
3209
+ function Ft(e, t) {
3210
+ return e.indexOf(t) !== -1;
3211
+ }
3212
+ function is(e, t) {
3213
+ for (let n = 0; n < e.length; n++) {
3214
+ const s = e[n];
3215
+ if (t(s))
3216
+ return s;
3217
+ }
3218
+ }
3219
+ var bl = class {
3220
+ constructor() {
3221
+ this.transfomers = {};
3222
+ }
3223
+ register(e) {
3224
+ this.transfomers[e.name] = e;
3225
+ }
3226
+ findApplicable(e) {
3227
+ return vl(this.transfomers, (t) => t.isApplicable(e));
3228
+ }
3229
+ findByName(e) {
3230
+ return this.transfomers[e];
3231
+ }
3232
+ }, Il = (e) => Object.prototype.toString.call(e).slice(8, -1), fr = (e) => typeof e > "u", Ll = (e) => e === null, gt = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, Pn = (e) => gt(e) && Object.keys(e).length === 0, Le = (e) => Array.isArray(e), Nl = (e) => typeof e == "string", Cl = (e) => typeof e == "number" && !isNaN(e), Gl = (e) => typeof e == "boolean", Ol = (e) => e instanceof RegExp, mt = (e) => e instanceof Map, Et = (e) => e instanceof Set, hr = (e) => Il(e) === "Symbol", Dl = (e) => e instanceof Date && !isNaN(e.valueOf()), xl = (e) => e instanceof Error, os = (e) => typeof e == "number" && isNaN(e), Rl = (e) => Gl(e) || Ll(e) || fr(e) || Cl(e) || Nl(e) || hr(e), kl = (e) => typeof e == "bigint", Ul = (e) => e === 1 / 0 || e === -1 / 0, Ml = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Bl = (e) => e instanceof URL, gr = (e) => e.replace(/\./g, "\\."), gn = (e) => e.map(String).map(gr).join("."), ut = (e) => {
3233
+ const t = [];
3234
+ let n = "";
3235
+ for (let r = 0; r < e.length; r++) {
3236
+ let a = e.charAt(r);
3237
+ if (a === "\\" && e.charAt(r + 1) === ".") {
3238
+ n += ".", r++;
3239
+ continue;
3240
+ }
3241
+ if (a === ".") {
3242
+ t.push(n), n = "";
3243
+ continue;
3244
+ }
3245
+ n += a;
3246
+ }
3247
+ const s = n;
3248
+ return t.push(s), t;
3249
+ };
3250
+ function ge(e, t, n, s) {
3251
+ return {
3252
+ isApplicable: e,
3253
+ annotation: t,
3254
+ transform: n,
3255
+ untransform: s
3256
+ };
3257
+ }
3258
+ var mr = [
3259
+ ge(fr, "undefined", () => null, () => {
3260
+ }),
3261
+ ge(kl, "bigint", (e) => e.toString(), (e) => typeof BigInt < "u" ? BigInt(e) : e),
3262
+ ge(Dl, "Date", (e) => e.toISOString(), (e) => new Date(e)),
3263
+ ge(xl, "Error", (e, t) => {
3264
+ const n = {
3265
+ name: e.name,
3266
+ message: e.message
3267
+ };
3268
+ return t.allowedErrorProps.forEach((s) => {
3269
+ n[s] = e[s];
3270
+ }), n;
3271
+ }, (e, t) => {
3272
+ const n = new Error(e.message);
3273
+ return n.name = e.name, n.stack = e.stack, t.allowedErrorProps.forEach((s) => {
3274
+ n[s] = e[s];
3275
+ }), n;
3276
+ }),
3277
+ ge(Ol, "regexp", (e) => "" + e, (e) => {
3278
+ const t = e.slice(1, e.lastIndexOf("/")), n = e.slice(e.lastIndexOf("/") + 1);
3279
+ return new RegExp(t, n);
3280
+ }),
3281
+ ge(
3282
+ Et,
3283
+ "set",
3284
+ // (sets only exist in es6+)
3285
+ // eslint-disable-next-line es5/no-es6-methods
3286
+ (e) => [...e.values()],
3287
+ (e) => new Set(e)
3288
+ ),
3289
+ ge(mt, "map", (e) => [...e.entries()], (e) => new Map(e)),
3290
+ ge((e) => os(e) || Ul(e), "number", (e) => os(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
3291
+ ge((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
3292
+ ge(Bl, "URL", (e) => e.toString(), (e) => new URL(e))
3293
+ ];
3294
+ function sn(e, t, n, s) {
3295
+ return {
3296
+ isApplicable: e,
3297
+ annotation: t,
3298
+ transform: n,
3299
+ untransform: s
3300
+ };
3301
+ }
3302
+ var Er = sn((e, t) => hr(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, n) => {
3303
+ const s = n.symbolRegistry.getValue(t[1]);
3304
+ if (!s)
3305
+ throw new Error("Trying to deserialize unknown symbol");
3306
+ return s;
3307
+ }), Fl = [
3308
+ Int8Array,
3309
+ Uint8Array,
3310
+ Int16Array,
3311
+ Uint16Array,
3312
+ Int32Array,
3313
+ Uint32Array,
3314
+ Float32Array,
3315
+ Float64Array,
3316
+ Uint8ClampedArray
3317
+ ].reduce((e, t) => (e[t.name] = t, e), {}), pr = sn(Ml, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
3318
+ const n = Fl[t[1]];
3319
+ if (!n)
3320
+ throw new Error("Trying to deserialize unknown typed array");
3321
+ return new n(e);
3322
+ });
3323
+ function yr(e, t) {
3324
+ return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
3325
+ }
3326
+ var Ar = sn(yr, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
3327
+ const n = t.classRegistry.getAllowedProps(e.constructor);
3328
+ if (!n)
3329
+ return { ...e };
3330
+ const s = {};
3331
+ return n.forEach((r) => {
3332
+ s[r] = e[r];
3333
+ }), s;
3334
+ }, (e, t, n) => {
3335
+ const s = n.classRegistry.getValue(t[1]);
3336
+ if (!s)
3337
+ throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
3338
+ return Object.assign(Object.create(s.prototype), e);
3339
+ }), Tr = sn((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, n) => {
3340
+ const s = n.customTransformerRegistry.findByName(t[1]);
3341
+ if (!s)
3342
+ throw new Error("Trying to deserialize unknown custom value");
3343
+ return s.deserialize(e);
3344
+ }), Kl = [Ar, Er, Tr, pr], ls = (e, t) => {
3345
+ const n = is(Kl, (r) => r.isApplicable(e, t));
3346
+ if (n)
3347
+ return {
3348
+ value: n.transform(e, t),
3349
+ type: n.annotation(e, t)
3350
+ };
3351
+ const s = is(mr, (r) => r.isApplicable(e, t));
3352
+ if (s)
3353
+ return {
3354
+ value: s.transform(e, t),
3355
+ type: s.annotation
3356
+ };
3357
+ }, Sr = {};
3358
+ mr.forEach((e) => {
3359
+ Sr[e.annotation] = e;
3360
+ });
3361
+ var Vl = (e, t, n) => {
3362
+ if (Le(t))
3363
+ switch (t[0]) {
3364
+ case "symbol":
3365
+ return Er.untransform(e, t, n);
3366
+ case "class":
3367
+ return Ar.untransform(e, t, n);
3368
+ case "custom":
3369
+ return Tr.untransform(e, t, n);
3370
+ case "typed-array":
3371
+ return pr.untransform(e, t, n);
3372
+ default:
3373
+ throw new Error("Unknown transformation: " + t);
3374
+ }
3375
+ else {
3376
+ const s = Sr[t];
3377
+ if (!s)
3378
+ throw new Error("Unknown transformation: " + t);
3379
+ return s.untransform(e, n);
3380
+ }
3381
+ }, Ve = (e, t) => {
3382
+ if (t > e.size)
3383
+ throw new Error("index out of bounds");
3384
+ const n = e.keys();
3385
+ for (; t > 0; )
3386
+ n.next(), t--;
3387
+ return n.next().value;
3388
+ };
3389
+ function _r(e) {
3390
+ if (Ft(e, "__proto__"))
3391
+ throw new Error("__proto__ is not allowed as a property");
3392
+ if (Ft(e, "prototype"))
3393
+ throw new Error("prototype is not allowed as a property");
3394
+ if (Ft(e, "constructor"))
3395
+ throw new Error("constructor is not allowed as a property");
3396
+ }
3397
+ var Hl = (e, t) => {
3398
+ _r(t);
3399
+ for (let n = 0; n < t.length; n++) {
3400
+ const s = t[n];
3401
+ if (Et(e))
3402
+ e = Ve(e, +s);
3403
+ else if (mt(e)) {
3404
+ const r = +s, a = +t[++n] == 0 ? "key" : "value", i = Ve(e, r);
3405
+ switch (a) {
3406
+ case "key":
3407
+ e = i;
3408
+ break;
3409
+ case "value":
3410
+ e = e.get(i);
3411
+ break;
3412
+ }
3413
+ } else
3414
+ e = e[s];
3415
+ }
3416
+ return e;
3417
+ }, wn = (e, t, n) => {
3418
+ if (_r(t), t.length === 0)
3419
+ return n(e);
3420
+ let s = e;
3421
+ for (let a = 0; a < t.length - 1; a++) {
3422
+ const i = t[a];
3423
+ if (Le(s)) {
3424
+ const o = +i;
3425
+ s = s[o];
3426
+ } else if (gt(s))
3427
+ s = s[i];
3428
+ else if (Et(s)) {
3429
+ const o = +i;
3430
+ s = Ve(s, o);
3431
+ } else if (mt(s)) {
3432
+ if (a === t.length - 2)
3433
+ break;
3434
+ const l = +i, d = +t[++a] == 0 ? "key" : "value", u = Ve(s, l);
3435
+ switch (d) {
3436
+ case "key":
3437
+ s = u;
3438
+ break;
3439
+ case "value":
3440
+ s = s.get(u);
3441
+ break;
3442
+ }
3443
+ }
3444
+ }
3445
+ const r = t[t.length - 1];
3446
+ if (Le(s) ? s[+r] = n(s[+r]) : gt(s) && (s[r] = n(s[r])), Et(s)) {
3447
+ const a = Ve(s, +r), i = n(a);
3448
+ a !== i && (s.delete(a), s.add(i));
3449
+ }
3450
+ if (mt(s)) {
3451
+ const a = +t[t.length - 2], i = Ve(s, a);
3452
+ switch (+r == 0 ? "key" : "value") {
3453
+ case "key": {
3454
+ const l = n(i);
3455
+ s.set(l, s.get(i)), l !== i && s.delete(i);
3456
+ break;
3457
+ }
3458
+ case "value": {
3459
+ s.set(i, n(s.get(i)));
3460
+ break;
3461
+ }
3462
+ }
3463
+ }
3464
+ return e;
3465
+ };
3466
+ function vn(e, t, n = []) {
3467
+ if (!e)
3468
+ return;
3469
+ if (!Le(e)) {
3470
+ rt(e, (a, i) => vn(a, t, [...n, ...ut(i)]));
3471
+ return;
3472
+ }
3473
+ const [s, r] = e;
3474
+ r && rt(r, (a, i) => {
3475
+ vn(a, t, [...n, ...ut(i)]);
3476
+ }), t(s, n);
3477
+ }
3478
+ function ql(e, t, n) {
3479
+ return vn(t, (s, r) => {
3480
+ e = wn(e, r, (a) => Vl(a, s, n));
3481
+ }), e;
3482
+ }
3483
+ function $l(e, t) {
3484
+ function n(s, r) {
3485
+ const a = Hl(e, ut(r));
3486
+ s.map(ut).forEach((i) => {
3487
+ e = wn(e, i, () => a);
3488
+ });
3489
+ }
3490
+ if (Le(t)) {
3491
+ const [s, r] = t;
3492
+ s.forEach((a) => {
3493
+ e = wn(e, ut(a), () => e);
3494
+ }), r && rt(r, n);
3495
+ } else
3496
+ rt(t, n);
3497
+ return e;
3498
+ }
3499
+ var Ql = (e, t) => gt(e) || Le(e) || mt(e) || Et(e) || yr(e, t);
3500
+ function zl(e, t, n) {
3501
+ const s = n.get(e);
3502
+ s ? s.push(t) : n.set(e, [t]);
3503
+ }
3504
+ function jl(e, t) {
3505
+ const n = {};
3506
+ let s;
3507
+ return e.forEach((r) => {
3508
+ if (r.length <= 1)
3509
+ return;
3510
+ t || (r = r.map((o) => o.map(String)).sort((o, l) => o.length - l.length));
3511
+ const [a, ...i] = r;
3512
+ a.length === 0 ? s = i.map(gn) : n[gn(a)] = i.map(gn);
3513
+ }), s ? Pn(n) ? [s] : [s, n] : Pn(n) ? void 0 : n;
3514
+ }
3515
+ var Pr = (e, t, n, s, r = [], a = [], i = /* @__PURE__ */ new Map()) => {
3516
+ const o = Rl(e);
3517
+ if (!o) {
3518
+ zl(e, r, t);
3519
+ const h = i.get(e);
3520
+ if (h)
3521
+ return s ? {
3522
+ transformedValue: null
3523
+ } : h;
3524
+ }
3525
+ if (!Ql(e, n)) {
3526
+ const h = ls(e, n), p = h ? {
3527
+ transformedValue: h.value,
3528
+ annotations: [h.type]
3529
+ } : {
3530
+ transformedValue: e
3531
+ };
3532
+ return o || i.set(e, p), p;
3533
+ }
3534
+ if (Ft(a, e))
3535
+ return {
3536
+ transformedValue: null
3537
+ };
3538
+ const l = ls(e, n), d = (l == null ? void 0 : l.value) ?? e, u = Le(d) ? [] : {}, f = {};
3539
+ rt(d, (h, p) => {
3540
+ if (p === "__proto__" || p === "constructor" || p === "prototype")
3541
+ throw new Error(`Detected property ${p}. This is a prototype pollution risk, please remove it from your object.`);
3542
+ const T = Pr(h, t, n, s, [...r, p], [...a, e], i);
3543
+ u[p] = T.transformedValue, Le(T.annotations) ? f[p] = T.annotations : gt(T.annotations) && rt(T.annotations, (S, D) => {
3544
+ f[gr(p) + "." + D] = S;
3545
+ });
3546
+ });
3547
+ const g = Pn(f) ? {
3548
+ transformedValue: u,
3549
+ annotations: l ? [l.type] : void 0
3550
+ } : {
3551
+ transformedValue: u,
3552
+ annotations: l ? [l.type, f] : f
3553
+ };
3554
+ return o || i.set(e, g), g;
3555
+ };
3556
+ function wr(e) {
3557
+ return Object.prototype.toString.call(e).slice(8, -1);
3558
+ }
3559
+ function cs(e) {
3560
+ return wr(e) === "Array";
3561
+ }
3562
+ function Wl(e) {
3563
+ if (wr(e) !== "Object")
3564
+ return !1;
3565
+ const t = Object.getPrototypeOf(e);
3566
+ return !!t && t.constructor === Object && t === Object.prototype;
3567
+ }
3568
+ function Yl(e, t, n, s, r) {
3569
+ const a = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
3570
+ a === "enumerable" && (e[t] = n), r && a === "nonenumerable" && Object.defineProperty(e, t, {
3571
+ value: n,
3572
+ enumerable: !1,
3573
+ writable: !0,
3574
+ configurable: !0
3575
+ });
3576
+ }
3577
+ function bn(e, t = {}) {
3578
+ if (cs(e))
3579
+ return e.map((r) => bn(r, t));
3580
+ if (!Wl(e))
3581
+ return e;
3582
+ const n = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
3583
+ return [...n, ...s].reduce((r, a) => {
3584
+ if (cs(t.props) && !t.props.includes(a))
3585
+ return r;
3586
+ const i = e[a], o = bn(i, t);
3587
+ return Yl(r, a, o, e, t.nonenumerable), r;
3588
+ }, {});
3589
+ }
3590
+ var R = class {
3591
+ /**
3592
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
3593
+ */
3594
+ constructor({ dedupe: e = !1 } = {}) {
3595
+ this.classRegistry = new Pl(), this.symbolRegistry = new dr((t) => t.description ?? ""), this.customTransformerRegistry = new bl(), this.allowedErrorProps = [], this.dedupe = e;
3596
+ }
3597
+ serialize(e) {
3598
+ const t = /* @__PURE__ */ new Map(), n = Pr(e, t, this, this.dedupe), s = {
3599
+ json: n.transformedValue
3600
+ };
3601
+ n.annotations && (s.meta = {
3602
+ ...s.meta,
3603
+ values: n.annotations
3604
+ });
3605
+ const r = jl(t, this.dedupe);
3606
+ return r && (s.meta = {
3607
+ ...s.meta,
3608
+ referentialEqualities: r
3609
+ }), s;
3610
+ }
3611
+ deserialize(e) {
3612
+ const { json: t, meta: n } = e;
3613
+ let s = bn(t);
3614
+ return n != null && n.values && (s = ql(s, n.values, this)), n != null && n.referentialEqualities && (s = $l(s, n.referentialEqualities)), s;
3615
+ }
3616
+ stringify(e) {
3617
+ return JSON.stringify(this.serialize(e));
3618
+ }
3619
+ parse(e) {
3620
+ return this.deserialize(JSON.parse(e));
3621
+ }
3622
+ registerClass(e, t) {
3623
+ this.classRegistry.register(e, t);
3624
+ }
3625
+ registerSymbol(e, t) {
3626
+ this.symbolRegistry.register(e, t);
3627
+ }
3628
+ registerCustom(e, t) {
3629
+ this.customTransformerRegistry.register({
3630
+ name: t,
3631
+ ...e
3632
+ });
3633
+ }
3634
+ allowErrorProps(...e) {
3635
+ this.allowedErrorProps.push(...e);
3636
+ }
3637
+ };
3638
+ R.defaultInstance = new R();
3639
+ R.serialize = R.defaultInstance.serialize.bind(R.defaultInstance);
3640
+ R.deserialize = R.defaultInstance.deserialize.bind(R.defaultInstance);
3641
+ R.stringify = R.defaultInstance.stringify.bind(R.defaultInstance);
3642
+ R.parse = R.defaultInstance.parse.bind(R.defaultInstance);
3643
+ R.registerClass = R.defaultInstance.registerClass.bind(R.defaultInstance);
3644
+ R.registerSymbol = R.defaultInstance.registerSymbol.bind(R.defaultInstance);
3645
+ R.registerCustom = R.defaultInstance.registerCustom.bind(R.defaultInstance);
3646
+ R.allowErrorProps = R.defaultInstance.allowErrorProps.bind(R.defaultInstance);
3647
+ var Jl = R.serialize, Su = R.stringify;
3648
+ function _u(e) {
3649
+ return e.state.fetchStatus === "fetching" ? "fetching" : e.getObserversCount() ? e.state.fetchStatus === "paused" ? "paused" : e.isStale() ? "stale" : "fresh" : "inactive";
3650
+ }
3651
+ function Pu(e, t) {
3652
+ return `${e}${t.charAt(0).toUpperCase() + t.slice(1)}`;
3653
+ }
3654
+ function wu({
3655
+ queryState: e,
3656
+ observerCount: t,
3657
+ isStale: n
3658
+ }) {
3659
+ return e.fetchStatus === "fetching" ? "blue" : t ? e.fetchStatus === "paused" ? "purple" : n ? "yellow" : "green" : "gray";
3660
+ }
3661
+ function vu({
3662
+ status: e,
3663
+ isPaused: t
3664
+ }) {
3665
+ return t ? "purple" : e === "error" ? "red" : e === "pending" ? "yellow" : e === "success" ? "green" : "gray";
3666
+ }
3667
+ function bu(e) {
3668
+ return e === "fresh" ? "green" : e === "stale" ? "yellow" : e === "paused" ? "purple" : e === "inactive" ? "gray" : "blue";
3669
+ }
3670
+ var Iu = (e, t = !1) => {
3671
+ const {
3672
+ json: n
3673
+ } = Jl(e);
3674
+ return JSON.stringify(n, null, t ? 2 : void 0);
3675
+ }, Rt = (e) => e.state.fetchStatus !== "idle" ? 0 : e.getObserversCount() ? e.isStale() ? 2 : 1 : 3, Zl = (e, t) => e.queryHash.localeCompare(t.queryHash), vr = (e, t) => e.state.dataUpdatedAt < t.state.dataUpdatedAt ? 1 : -1, Xl = (e, t) => Rt(e) === Rt(t) ? vr(e, t) : Rt(e) > Rt(t) ? 1 : -1, Lu = {
3676
+ status: Xl,
3677
+ "query hash": Zl,
3678
+ "last updated": vr
3679
+ }, kt = (e) => e.state.isPaused ? 0 : e.state.status === "error" ? 2 : e.state.status === "pending" ? 1 : 3, br = (e, t) => e.state.submittedAt < t.state.submittedAt ? 1 : -1, ec = (e, t) => kt(e) === kt(t) ? br(e, t) : kt(e) > kt(t) ? 1 : -1, Nu = {
3680
+ status: ec,
3681
+ "last updated": br
3682
+ }, Cu = (e) => e * parseFloat(getComputedStyle(document.documentElement).fontSize), Gu = () => {
3683
+ const [e, t] = F("dark");
3684
+ return Mo(() => {
3685
+ const n = window.matchMedia("(prefers-color-scheme: dark)");
3686
+ t(n.matches ? "dark" : "light");
3687
+ const s = (r) => {
3688
+ t(r.matches ? "dark" : "light");
3689
+ };
3690
+ n.addEventListener("change", s), dt(() => n.removeEventListener("change", s));
3691
+ }), e;
3692
+ }, Ut = (e, t, n) => {
3693
+ if (t.length === 0)
3694
+ return n;
3695
+ if (e instanceof Map) {
3696
+ const s = new Map(e);
3697
+ if (t.length === 1)
3698
+ return s.set(t[0], n), s;
3699
+ const [r, ...a] = t;
3700
+ return s.set(r, Ut(s.get(r), a, n)), s;
3701
+ }
3702
+ if (e instanceof Set) {
3703
+ const s = Ut(Array.from(e), t, n);
3704
+ return new Set(s);
3705
+ }
3706
+ if (Array.isArray(e)) {
3707
+ const s = [...e];
3708
+ if (t.length === 1)
3709
+ return s[t[0]] = n, s;
3710
+ const [r, ...a] = t;
3711
+ return s[r] = Ut(s[r], a, n), s;
3712
+ }
3713
+ if (e instanceof Object) {
3714
+ const s = {
3715
+ ...e
3716
+ };
3717
+ if (t.length === 1)
3718
+ return s[t[0]] = n, s;
3719
+ const [r, ...a] = t;
3720
+ return s[r] = Ut(s[r], a, n), s;
3721
+ }
3722
+ return e;
3723
+ }, Mt = (e, t) => {
3724
+ if (e instanceof Map) {
3725
+ const n = new Map(e);
3726
+ if (t.length === 1)
3727
+ return n.delete(t[0]), n;
3728
+ const [s, ...r] = t;
3729
+ return n.set(s, Mt(n.get(s), r)), n;
3730
+ }
3731
+ if (e instanceof Set) {
3732
+ const n = Mt(Array.from(e), t);
3733
+ return new Set(n);
3734
+ }
3735
+ if (Array.isArray(e)) {
3736
+ const n = [...e];
3737
+ if (t.length === 1)
3738
+ return n.filter((a, i) => i.toString() !== t[0]);
3739
+ const [s, ...r] = t;
3740
+ return n[s] = Mt(n[s], r), n;
3741
+ }
3742
+ if (e instanceof Object) {
3743
+ const n = {
3744
+ ...e
3745
+ };
3746
+ if (t.length === 1)
3747
+ return delete n[t[0]], n;
3748
+ const [s, ...r] = t;
3749
+ return n[s] = Mt(n[s], r), n;
3750
+ }
3751
+ return e;
3752
+ }, Ir = (e, t) => {
3753
+ if (!e || document.querySelector("#_goober") || (t == null ? void 0 : t.querySelector("#_goober"))) return;
3754
+ const s = document.createElement("style"), r = document.createTextNode("");
3755
+ s.appendChild(r), s.id = "_goober", s.setAttribute("nonce", e), t ? t.appendChild(s) : document.head.appendChild(s);
3756
+ }, He, pt, yt, At, Oe, Tt, qe, $e, Qe, ze, je, St, We, _t, hs, tc = (hs = class {
3757
+ constructor(e) {
3758
+ O(this, He);
3759
+ O(this, pt);
3760
+ O(this, yt);
3761
+ O(this, At);
3762
+ O(this, Oe, !1);
3763
+ O(this, Tt);
3764
+ O(this, qe);
3765
+ O(this, $e);
3766
+ O(this, Qe);
3767
+ O(this, ze);
3768
+ O(this, je);
3769
+ O(this, St);
3770
+ O(this, We);
3771
+ O(this, _t);
3772
+ const {
3773
+ client: t,
3774
+ queryFlavor: n,
3775
+ version: s,
3776
+ onlineManager: r,
3777
+ buttonPosition: a,
3778
+ position: i,
3779
+ initialIsOpen: o,
3780
+ errorTypes: l,
3781
+ styleNonce: d,
3782
+ shadowDOMTarget: u,
3783
+ hideDisabledQueries: f
3784
+ } = e;
3785
+ G(this, He, F(t)), G(this, yt, n), G(this, At, s), G(this, pt, r), G(this, Tt, d), G(this, qe, u), G(this, $e, F(a)), G(this, Qe, F(i)), G(this, ze, F(o)), G(this, je, F(l)), G(this, St, F(f));
3786
+ }
3787
+ setButtonPosition(e) {
3788
+ A(this, $e)[1](e);
3789
+ }
3790
+ setPosition(e) {
3791
+ A(this, Qe)[1](e);
3792
+ }
3793
+ setInitialIsOpen(e) {
3794
+ A(this, ze)[1](e);
3795
+ }
3796
+ setErrorTypes(e) {
3797
+ A(this, je)[1](e);
3798
+ }
3799
+ setClient(e) {
3800
+ A(this, He)[1](e);
3801
+ }
3802
+ mount(e) {
3803
+ if (A(this, Oe))
3804
+ throw new Error("Devtools is already mounted");
3805
+ const t = lr(() => {
3806
+ const n = this, [s] = A(this, $e), [r] = A(this, Qe), [a] = A(this, ze), [i] = A(this, je), [o] = A(this, St), [l] = A(this, He);
3807
+ let d;
3808
+ return A(this, We) ? d = A(this, We) : (d = ir(() => import("./NCMVHL6D-vUfYKc6i.js")), G(this, We, d)), Ir(A(this, Tt), A(this, qe)), rr(d, ar({
3809
+ get queryFlavor() {
3810
+ return A(n, yt);
3811
+ },
3812
+ get version() {
3813
+ return A(n, At);
3814
+ },
3815
+ get onlineManager() {
3816
+ return A(n, pt);
3817
+ },
3818
+ get shadowDOMTarget() {
3819
+ return A(n, qe);
3820
+ }
3821
+ }, {
3822
+ get client() {
3823
+ return l();
3824
+ },
3825
+ get buttonPosition() {
3826
+ return s();
3827
+ },
3828
+ get position() {
3829
+ return r();
3830
+ },
3831
+ get initialIsOpen() {
3832
+ return a();
3833
+ },
3834
+ get errorTypes() {
3835
+ return i();
3836
+ },
3837
+ get hideDisabledQueries() {
3838
+ return o();
3839
+ }
3840
+ }));
3841
+ }, e);
3842
+ G(this, Oe, !0), G(this, _t, t);
3843
+ }
3844
+ unmount() {
3845
+ var e;
3846
+ if (!A(this, Oe))
3847
+ throw new Error("Devtools is not mounted");
3848
+ (e = A(this, _t)) == null || e.call(this), G(this, Oe, !1);
3849
+ }
3850
+ }, He = new WeakMap(), pt = new WeakMap(), yt = new WeakMap(), At = new WeakMap(), Oe = new WeakMap(), Tt = new WeakMap(), qe = new WeakMap(), $e = new WeakMap(), Qe = new WeakMap(), ze = new WeakMap(), je = new WeakMap(), St = new WeakMap(), We = new WeakMap(), _t = new WeakMap(), hs), Ye, Pt, wt, vt, De, bt, Je, Ze, Xe, et, tt, It, nt, st, Lt, gs, nc = (gs = class {
3851
+ constructor(e) {
3852
+ O(this, Ye);
3853
+ O(this, Pt);
3854
+ O(this, wt);
3855
+ O(this, vt);
3856
+ O(this, De, !1);
3857
+ O(this, bt);
3858
+ O(this, Je);
3859
+ O(this, Ze);
3860
+ O(this, Xe);
3861
+ O(this, et);
3862
+ O(this, tt);
3863
+ O(this, It);
3864
+ O(this, nt);
3865
+ O(this, st);
3866
+ O(this, Lt);
3867
+ const {
3868
+ client: t,
3869
+ queryFlavor: n,
3870
+ version: s,
3871
+ onlineManager: r,
3872
+ buttonPosition: a,
3873
+ position: i,
3874
+ initialIsOpen: o,
3875
+ errorTypes: l,
3876
+ styleNonce: d,
3877
+ shadowDOMTarget: u,
3878
+ onClose: f,
3879
+ hideDisabledQueries: g
3880
+ } = e;
3881
+ G(this, Ye, F(t)), G(this, wt, n), G(this, vt, s), G(this, Pt, r), G(this, bt, d), G(this, Je, u), G(this, Ze, F(a)), G(this, Xe, F(i)), G(this, et, F(o)), G(this, tt, F(l)), G(this, It, F(g)), G(this, nt, F(f));
3882
+ }
3883
+ setButtonPosition(e) {
3884
+ A(this, Ze)[1](e);
3885
+ }
3886
+ setPosition(e) {
3887
+ A(this, Xe)[1](e);
3888
+ }
3889
+ setInitialIsOpen(e) {
3890
+ A(this, et)[1](e);
3891
+ }
3892
+ setErrorTypes(e) {
3893
+ A(this, tt)[1](e);
3894
+ }
3895
+ setClient(e) {
3896
+ A(this, Ye)[1](e);
3897
+ }
3898
+ setOnClose(e) {
3899
+ A(this, nt)[1](() => e);
3900
+ }
3901
+ mount(e) {
3902
+ if (A(this, De))
3903
+ throw new Error("Devtools is already mounted");
3904
+ const t = lr(() => {
3905
+ const n = this, [s] = A(this, Ze), [r] = A(this, Xe), [a] = A(this, et), [i] = A(this, tt), [o] = A(this, It), [l] = A(this, Ye), [d] = A(this, nt);
3906
+ let u;
3907
+ return A(this, st) ? u = A(this, st) : (u = ir(() => import("./2AITGKQY-2rt9M99C.js")), G(this, st, u)), Ir(A(this, bt), A(this, Je)), rr(u, ar({
3908
+ get queryFlavor() {
3909
+ return A(n, wt);
3910
+ },
3911
+ get version() {
3912
+ return A(n, vt);
3913
+ },
3914
+ get onlineManager() {
3915
+ return A(n, Pt);
3916
+ },
3917
+ get shadowDOMTarget() {
3918
+ return A(n, Je);
3919
+ }
3920
+ }, {
3921
+ get client() {
3922
+ return l();
3923
+ },
3924
+ get buttonPosition() {
3925
+ return s();
3926
+ },
3927
+ get position() {
3928
+ return r();
3929
+ },
3930
+ get initialIsOpen() {
3931
+ return a();
3932
+ },
3933
+ get errorTypes() {
3934
+ return i();
3935
+ },
3936
+ get hideDisabledQueries() {
3937
+ return o();
3938
+ },
3939
+ get onClose() {
3940
+ return d();
3941
+ }
3942
+ }));
3943
+ }, e);
3944
+ G(this, De, !0), G(this, Lt, t);
3945
+ }
3946
+ unmount() {
3947
+ var e;
3948
+ if (!A(this, De))
3949
+ throw new Error("Devtools is not mounted");
3950
+ (e = A(this, Lt)) == null || e.call(this), G(this, De, !1);
3951
+ }
3952
+ }, Ye = new WeakMap(), Pt = new WeakMap(), wt = new WeakMap(), vt = new WeakMap(), De = new WeakMap(), bt = new WeakMap(), Je = new WeakMap(), Ze = new WeakMap(), Xe = new WeakMap(), et = new WeakMap(), tt = new WeakMap(), It = new WeakMap(), nt = new WeakMap(), st = new WeakMap(), Lt = new WeakMap(), gs);
3953
+ function sc(e) {
3954
+ const t = J(e.client), n = Q.useRef(null), {
3955
+ buttonPosition: s,
3956
+ position: r,
3957
+ initialIsOpen: a,
3958
+ errorTypes: i,
3959
+ styleNonce: o,
3960
+ shadowDOMTarget: l,
3961
+ hideDisabledQueries: d
3962
+ } = e, [u] = Q.useState(
3963
+ new tc({
3964
+ client: t,
3965
+ queryFlavor: "React Query",
3966
+ version: "5",
3967
+ onlineManager: Ss,
3968
+ buttonPosition: s,
3969
+ position: r,
3970
+ initialIsOpen: a,
3971
+ errorTypes: i,
3972
+ styleNonce: o,
3973
+ shadowDOMTarget: l,
3974
+ hideDisabledQueries: d
3975
+ })
3976
+ );
3977
+ return Q.useEffect(() => {
3978
+ u.setClient(t);
3979
+ }, [t, u]), Q.useEffect(() => {
3980
+ s && u.setButtonPosition(s);
3981
+ }, [s, u]), Q.useEffect(() => {
3982
+ r && u.setPosition(r);
3983
+ }, [r, u]), Q.useEffect(() => {
3984
+ u.setInitialIsOpen(a || !1);
3985
+ }, [a, u]), Q.useEffect(() => {
3986
+ u.setErrorTypes(i || []);
3987
+ }, [i, u]), Q.useEffect(() => (n.current && u.mount(n.current), () => {
3988
+ u.unmount();
3989
+ }), [u]), /* @__PURE__ */ c("div", { dir: "ltr", className: "tsqd-parent-container", ref: n });
3990
+ }
3991
+ function rc(e) {
3992
+ const t = J(e.client), n = Q.useRef(null), { errorTypes: s, styleNonce: r, shadowDOMTarget: a, hideDisabledQueries: i } = e, [o] = Q.useState(
3993
+ new nc({
3994
+ client: t,
3995
+ queryFlavor: "React Query",
3996
+ version: "5",
3997
+ onlineManager: Ss,
3998
+ buttonPosition: "bottom-left",
3999
+ position: "bottom",
4000
+ initialIsOpen: !0,
4001
+ errorTypes: s,
4002
+ styleNonce: r,
4003
+ shadowDOMTarget: a,
4004
+ onClose: e.onClose,
4005
+ hideDisabledQueries: i
4006
+ })
4007
+ );
4008
+ return Q.useEffect(() => {
4009
+ o.setClient(t);
4010
+ }, [t, o]), Q.useEffect(() => {
4011
+ o.setOnClose(e.onClose ?? (() => {
4012
+ }));
4013
+ }, [e.onClose, o]), Q.useEffect(() => {
4014
+ o.setErrorTypes(s || []);
4015
+ }, [s, o]), Q.useEffect(() => (n.current && o.mount(n.current), () => {
4016
+ o.unmount();
4017
+ }), [o]), /* @__PURE__ */ c(
4018
+ "div",
4019
+ {
4020
+ style: { height: "500px", ...e.style },
4021
+ className: "tsqd-parent-container",
4022
+ ref: n
4023
+ }
4024
+ );
4025
+ }
4026
+ var us = process.env.NODE_ENV !== "development" ? function() {
4027
+ return null;
4028
+ } : sc;
4029
+ process.env.NODE_ENV;
4030
+ const ac = pe(""), ic = () => {
4031
+ rn("dynamic-page-selector", {
4032
+ description: "Dynamic page selector"
4033
+ }), rn("enable-add-page-dropdown", {
4034
+ description: "Enable add page dropdown"
4035
+ }), rn("enable-ai-chat-panel", {
4036
+ description: "Enable AI chat panel"
4037
+ });
4038
+ }, oc = () => {
4039
+ const e = C(), t = L();
4040
+ return oe({
4041
+ queryKey: [E.GET_COLLECTIONS],
4042
+ staleTime: 1 / 0,
4043
+ queryFn: async () => t(e, { action: E.GET_COLLECTIONS })
4044
+ });
4045
+ }, lc = () => {
4046
+ const { data: e } = ce(), { data: t } = Ne(), { data: n } = Be(), s = C(), r = L(), a = q(() => (n == null ? void 0 : n.fallbackLang) || "en", [n == null ? void 0 : n.fallbackLang]), i = Ie(/* @__PURE__ */ new Map());
4047
+ return Y({
4048
+ mutationFn: async ({ block: o }) => {
4049
+ const l = o._id, d = (t == null ? void 0 : t.lang) || a, u = `${l}:${d}`;
4050
+ if (i.current.has(u))
4051
+ return i.current.get(u);
4052
+ const f = r(s, {
4053
+ action: E.GET_BLOCK_ASYNC_PROPS,
4054
+ data: {
4055
+ block: o,
4056
+ lang: d,
4057
+ pageProps: {
4058
+ slug: t == null ? void 0 : t.slug,
4059
+ searchParams: {},
4060
+ pageType: t == null ? void 0 : t.pageType,
4061
+ fallbackLang: a,
4062
+ lastSaved: t.lastSaved,
4063
+ pageId: e.id,
4064
+ primaryPageId: t.primaryPage || e.id,
4065
+ pageBaseSlug: t == null ? void 0 : t.slug,
4066
+ dynamic: e == null ? void 0 : e.dynamic,
4067
+ languagePageId: t.id
4068
+ }
4069
+ }
4070
+ });
4071
+ return i.current.set(u, f), f.finally(() => {
4072
+ i.current.delete(u);
4073
+ }), f;
4074
+ }
4075
+ });
4076
+ }, cc = () => {
4077
+ const [, e] = we();
4078
+ return z(
4079
+ (t, n) => {
4080
+ const r = new URLSearchParams(window.location.search).get("lang"), a = new URLSearchParams({ page: t });
4081
+ r && a.set("lang", r), window.history.pushState({}, "", `?${a.toString()}`), e(a), window.dispatchEvent(new PopStateEvent("popstate")), n == null || n();
4082
+ },
4083
+ [e]
4084
+ );
4085
+ }, uc = () => {
4086
+ const e = cc();
4087
+ return z(
4088
+ ({ pageId: t }) => {
4089
+ e(t);
4090
+ },
4091
+ [e]
4092
+ );
4093
+ }, dc = V(() => import("./page-lock-DUlNr3os.js")), fc = V(() => import("./no-language-page-dialog-Dj_z2_hF.js")), hc = V(() => import("./digital-asset-manager-C8udwDBW.js")), gc = V(() => import("./save-to-lib-BwpkJcT2.js")), mc = V(() => import("./theme-panel-footer-5mxFeEua.js")), Ec = V(() => import("./web-preview-CGBKG162.js"));
4094
+ ic();
4095
+ ri();
4096
+ sa(lo);
4097
+ Oo();
4098
+ ra(hc);
4099
+ aa(gc);
4100
+ const pc = {
4101
+ role: "",
4102
+ permissions: null
4103
+ }, ds = (e) => {
4104
+ const { data: t } = Eo(), n = kn(), { data: s = pc, isFetching: r } = po(), { data: a, isFetching: i } = Ce(), { data: o, isFetching: l } = oc(), { data: d, isFetching: u } = Be(), f = r || i || l || u, [g] = we(), h = g.get("page"), { data: p } = ce(), { data: T, isFetching: S } = ho(), { blocks: D } = fo(T), { data: y, isFetching: w } = go(), { pageStatus: v } = he(), U = co(), { onSave: b } = yo(), { mutateAsync: ye } = lc(), { getPartialBlocks: Ae, getPartialBlockBlocks: B } = Ao(), { mutateAsync: P } = ki(), { mutateAsync: I } = mo(), j = uc(), [$, ue] = K(!1), it = Ie([]), be = q(() => H(d, "theme", {}) || {}, [d]), ot = v === ee.EDITING, Ge = v === ee.CHECKING, Bn = S || Ge || w;
4105
+ it.current = D;
4106
+ const [Lr] = ie(ac);
4107
+ se(() => {
4108
+ const re = () => {
4109
+ document.hidden ? ue(!0) : ue(!1);
4110
+ };
4111
+ return window.addEventListener("visibilitychange", re), () => window.removeEventListener("visibilitychange", re);
4112
+ }, []);
4113
+ const Nr = q(() => {
4114
+ const re = {};
4115
+ return s && (re.permissions = H(s, "permissions", null), re.role = H(s, "role", "user")), re;
4116
+ }, [s]), Fn = q(() => t == null ? void 0 : t.some((re) => re.isSiteLibrary), [t]), Cr = z(
4117
+ async (re, Ct) => await P({ pageType: re, query: Ct }),
4118
+ [P]
4119
+ );
4120
+ return /* @__PURE__ */ m(me, { children: [
4121
+ Bn && /* @__PURE__ */ c(Fs, { className: f ? "fixed inset-0 bg-white" : "bg-white/75", children: /* @__PURE__ */ c(Ht, { className: `animate-spin text-primary ${f ? "h-6 w-6" : "h-5 w-5"}` }) }),
4122
+ Lr && /* @__PURE__ */ c(
4123
+ X,
4124
+ {
4125
+ fallback: /* @__PURE__ */ c("div", { className: "absolute inset-0 z-[999999] flex min-h-screen w-screen items-center justify-center bg-gray-100", children: /* @__PURE__ */ c(Ht, { className: "h-6 w-6 animate-spin text-primary" }) }),
4126
+ children: /* @__PURE__ */ c(Ec, {})
4127
+ }
4128
+ ),
4129
+ /* @__PURE__ */ c(
4130
+ ia,
4131
+ {
4132
+ flags: e.flags ? { ...e.flags, librarySite: Fn } : { librarySite: Fn },
4133
+ gotoPage: j,
4134
+ collections: o ?? [],
4135
+ getBlockAsyncProps: ye,
4136
+ pageExternalData: y,
4137
+ themePresets: e.themePresets ?? [],
4138
+ pageId: p == null ? void 0 : p.id,
4139
+ loading: S,
4140
+ fallbackLang: n,
4141
+ languages: (d == null ? void 0 : d.languages) || [],
4142
+ brandingOptions: (d == null ? void 0 : d.theme) || {},
4143
+ translations: e.translations || {},
4144
+ locale: e.locale || "en",
4145
+ htmlDir: e.htmlDir || "ltr",
4146
+ autoSave: !$ && ot && (e.autoSave ?? !0),
4147
+ autoSaveInterval: e.autoSaveInterval ?? 15,
4148
+ onError: e.onError || console.error,
4149
+ getPartialBlockBlocks: B,
4150
+ getPartialBlocks: Ae,
4151
+ blocks: S ? [] : D,
4152
+ theme: qr(be),
4153
+ pageTypes: a,
4154
+ searchPageTypeItems: Cr,
4155
+ askAiCallBack: U,
4156
+ onSave: async ({ blocks: re, theme: Ct, needTranslations: Gr }) => {
4157
+ if (!h) return !0;
4158
+ it.current = re;
4159
+ const Kn = [...re];
4160
+ return await b({ page: h, blocks: Kn, needTranslations: Gr }), it.current = Kn, $r(Ct, be) || await I({ settings: { theme: Ct } }), !0;
4161
+ },
4162
+ themePanelComponent: mc,
4163
+ ...Nr,
4164
+ children: /* @__PURE__ */ c(dc, { isFetchingPageData: Bn })
4165
+ }
4166
+ ),
4167
+ /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(fc, {}) })
4168
+ ] });
4169
+ }, yc = new Wr({
4170
+ defaultOptions: {
4171
+ queries: {
4172
+ refetchOnWindowFocus: !1,
4173
+ refetchOnReconnect: !1,
4174
+ refetchOnMount: !1
4175
+ }
4176
+ }
4177
+ }), Ou = (e) => {
4178
+ const [, t] = Gn(), [n, s] = K(!1);
4179
+ return se(() => (t(
4180
+ In(e, [
4181
+ "apiUrl",
4182
+ "usersApiUrl",
4183
+ "assetsApiUrl",
4184
+ "getPreviewUrl",
4185
+ "getLiveUrl",
4186
+ "topLeftCorner",
4187
+ "onLogout",
4188
+ "getAccessToken",
4189
+ "websocket",
4190
+ "getLoggedInUser",
4191
+ "features",
4192
+ "currentUser"
4193
+ ])
4194
+ ), setTimeout(() => {
4195
+ s(!0);
4196
+ }, 200), () => {
4197
+ s(!1), t({});
4198
+ }), [e, t]), n ? H(e, "hasReactQueryProvider", !1) === !0 ? /* @__PURE__ */ m(me, { children: [
4199
+ /* @__PURE__ */ c(ds, { ...e }),
4200
+ /* @__PURE__ */ c(us, {})
4201
+ ] }) : /* @__PURE__ */ m(Yr, { client: yc, children: [
4202
+ /* @__PURE__ */ c(ds, { ...e }),
4203
+ /* @__PURE__ */ c(us, {})
4204
+ ] }) : /* @__PURE__ */ c("div", {});
4205
+ }, Ac = Q.lazy(() => import("./nested-path-selector-content-DvIL_EoN.js"));
4206
+ function Tc({ data: e, onSelect: t, dataType: n = "value", disabled: s = !1 }) {
4207
+ const [r, a] = Q.useState(!1);
4208
+ return /* @__PURE__ */ m(wa, { open: r, onOpenChange: a, children: [
4209
+ /* @__PURE__ */ m(Jt, { children: [
4210
+ /* @__PURE__ */ c(Zt, { asChild: !0, children: /* @__PURE__ */ c(va, { asChild: !0, children: /* @__PURE__ */ c(
4211
+ M,
4212
+ {
4213
+ size: "sm",
4214
+ variant: "outline",
4215
+ className: "h-6 w-6 px-1 py-0 text-[9px] text-muted-foreground",
4216
+ role: "combobox",
4217
+ "aria-expanded": r,
4218
+ disabled: s,
4219
+ children: /* @__PURE__ */ c("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24px", height: "24px", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ c(
4220
+ "path",
4221
+ {
4222
+ d: "M9.5 5H9C7.89543 5 7 5.89543 7 7V9C7 10 6.4 12 4 12C5 12 7 12.6 7 15V17.0002C7 18.1048 7.89543 19 9 19H9.5M14.5 5H15C16.1046 5 17 5.89543 17 7V9C17 10 17.6 12 20 12C19 12 17 12.6 17 15V17.0002C17 18.1048 16.1046 19 15 19H14.5",
4223
+ stroke: "#000000",
4224
+ strokeLinecap: "round",
4225
+ strokeLinejoin: "round",
4226
+ strokeWidth: "2"
4227
+ }
4228
+ ) })
4229
+ }
4230
+ ) }) }),
4231
+ /* @__PURE__ */ c(Xt, { children: "Add field" })
4232
+ ] }),
4233
+ r && /* @__PURE__ */ c(Q.Suspense, { children: /* @__PURE__ */ c(
4234
+ Ac,
4235
+ {
4236
+ data: e,
4237
+ onSelect: t,
4238
+ dataType: n,
4239
+ open: r,
4240
+ setOpen: a
4241
+ }
4242
+ ) })
4243
+ ] });
4244
+ }
4245
+ const Du = () => {
4246
+ const { savePageAsync: e } = ke(), t = J(), { isLocked: n } = he();
4247
+ return z(async () => {
4248
+ n || await e(), t.invalidateQueries({ queryKey: [E.GET_DRAFT_PAGE] }), t.invalidateQueries({ queryKey: [E.GET_BUILDER_PAGE_DATA] });
4249
+ }, [e, t, n]);
4250
+ }, xu = () => {
4251
+ const e = J();
4252
+ return z(() => {
4253
+ e.clear();
4254
+ }, [e]);
4255
+ }, Ru = () => {
4256
+ const e = C(), t = L(), { data: n } = Ne(), s = J();
4257
+ return Y({
4258
+ mutationFn: async (r) => {
4259
+ if (!(n != null && n.id))
4260
+ throw new Error("No active page found");
4261
+ return await t(`${e}`, {
4262
+ action: E.UPDATE_PAGE_METADATA,
4263
+ data: {
4264
+ id: n.id,
4265
+ metadata: r
4266
+ }
4267
+ });
4268
+ },
4269
+ onSuccess: () => {
4270
+ s.invalidateQueries({
4271
+ queryKey: [E.GET_BUILDER_PAGE_DATA]
4272
+ }), s.invalidateQueries({
4273
+ queryKey: [E.GET_LANGUAGE_PAGES]
4274
+ });
4275
+ },
4276
+ onError: () => {
4277
+ console.error("Failed to update metadata");
4278
+ }
4279
+ });
4280
+ }, Sc = V(() => import("./digital-asset-manager-C8udwDBW.js")), ku = ({
4281
+ assetId: e,
4282
+ assetUrl: t,
4283
+ onChange: n,
4284
+ className: s = "",
4285
+ placeholder: r = "Select an image",
4286
+ disabled: a = !1
4287
+ }) => {
4288
+ const { t: i } = Pe(), [o, l] = K(!1), d = () => {
4289
+ a || l(!0);
4290
+ }, u = () => {
4291
+ l(!1);
4292
+ }, f = (p) => {
4293
+ const T = Array.isArray(p) ? p[0] : p;
4294
+ T != null && T.url && n(In(T, ["url", "id"])), l(!1);
4295
+ }, g = () => {
4296
+ n({ url: "", id: "" });
4297
+ }, h = (t == null ? void 0 : t.startsWith("{{")) && (t == null ? void 0 : t.endsWith("}}"));
4298
+ return /* @__PURE__ */ m("div", { className: `w-full ${s}`, children: [
4299
+ t ? /* @__PURE__ */ m("div", { className: "relative overflow-hidden rounded-md border", children: [
4300
+ h ? /* @__PURE__ */ c("div", { className: "flex h-12 items-center bg-gray-100 px-4", children: /* @__PURE__ */ c("p", { className: "text-xs text-gray-500", children: t }) }) : /* @__PURE__ */ c(
4301
+ "img",
4302
+ {
4303
+ onClick: d,
4304
+ src: t,
4305
+ alt: i("Selected image"),
4306
+ className: "h-auto max-h-[100px] w-full bg-gray-100 object-contain"
4307
+ }
4308
+ ),
4309
+ /* @__PURE__ */ m("div", { className: "absolute right-2 top-2 flex gap-2", children: [
4310
+ /* @__PURE__ */ c(
4311
+ M,
4312
+ {
4313
+ type: "button",
4314
+ variant: "outline",
4315
+ size: "icon",
4316
+ className: "h-8 w-8 rounded-full bg-white text-red-500",
4317
+ onClick: g,
4318
+ disabled: a,
4319
+ children: h ? /* @__PURE__ */ c(Zn, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Ya, { className: "h-4 w-4" })
4320
+ }
4321
+ ),
4322
+ !h && /* @__PURE__ */ c(
4323
+ M,
4324
+ {
4325
+ type: "button",
4326
+ variant: "outline",
4327
+ size: "icon",
4328
+ className: "h-8 w-8 rounded-full bg-white/80 hover:bg-white/90",
4329
+ onClick: d,
4330
+ disabled: a,
4331
+ children: /* @__PURE__ */ c(Xn, { className: "h-4 w-4" })
4332
+ }
4333
+ )
4334
+ ] })
4335
+ ] }) : /* @__PURE__ */ c(
4336
+ "div",
4337
+ {
4338
+ className: `flex cursor-pointer items-center justify-center rounded-md border border-dashed p-6 ${a ? "cursor-not-allowed opacity-50" : "hover:border-gray-400"}`,
4339
+ onClick: d,
4340
+ children: /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
4341
+ /* @__PURE__ */ c(Xn, { className: "h-10 w-10 text-gray-400" }),
4342
+ /* @__PURE__ */ c("p", { className: "text-sm text-gray-500", children: r })
4343
+ ] })
4344
+ }
4345
+ ),
4346
+ /* @__PURE__ */ c(bs, { open: o, onOpenChange: l, children: /* @__PURE__ */ m(ba, { className: "h-fit w-full max-w-7xl overflow-hidden p-0", children: [
4347
+ /* @__PURE__ */ m(Ia, { className: "hidden border-b px-4 py-2", children: [
4348
+ /* @__PURE__ */ c(La, { children: i("Select Image") }),
4349
+ /* @__PURE__ */ c(
4350
+ M,
4351
+ {
4352
+ type: "button",
4353
+ variant: "ghost",
4354
+ size: "icon",
4355
+ className: "absolute right-4 top-2",
4356
+ onClick: u,
4357
+ children: /* @__PURE__ */ c(Zn, { className: "h-4 w-4" })
4358
+ }
4359
+ )
4360
+ ] }),
4361
+ /* @__PURE__ */ c("div", { className: "h-full flex-1 p-4", children: /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(
4362
+ Sc,
4363
+ {
4364
+ close: u,
4365
+ onSelect: f,
4366
+ mode: "image",
4367
+ assetId: e
4368
+ }
4369
+ ) }) })
4370
+ ] }) })
4371
+ ] });
4372
+ }, _c = zr(null), mn = {
4373
+ didCatch: !1,
4374
+ error: null
4375
+ };
4376
+ class Pc extends jr {
4377
+ constructor(t) {
4378
+ super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = mn;
4379
+ }
4380
+ static getDerivedStateFromError(t) {
4381
+ return {
4382
+ didCatch: !0,
4383
+ error: t
4384
+ };
4385
+ }
4386
+ resetErrorBoundary() {
4387
+ const {
4388
+ error: t
4389
+ } = this.state;
4390
+ if (t !== null) {
4391
+ for (var n, s, r = arguments.length, a = new Array(r), i = 0; i < r; i++)
4392
+ a[i] = arguments[i];
4393
+ (n = (s = this.props).onReset) === null || n === void 0 || n.call(s, {
4394
+ args: a,
4395
+ reason: "imperative-api"
4396
+ }), this.setState(mn);
4397
+ }
4398
+ }
4399
+ componentDidCatch(t, n) {
4400
+ var s, r;
4401
+ (s = (r = this.props).onError) === null || s === void 0 || s.call(r, t, n);
4402
+ }
4403
+ componentDidUpdate(t, n) {
4404
+ const {
4405
+ didCatch: s
4406
+ } = this.state, {
4407
+ resetKeys: r
4408
+ } = this.props;
4409
+ if (s && n.error !== null && wc(t.resetKeys, r)) {
4410
+ var a, i;
4411
+ (a = (i = this.props).onReset) === null || a === void 0 || a.call(i, {
4412
+ next: r,
4413
+ prev: t.resetKeys,
4414
+ reason: "keys"
4415
+ }), this.setState(mn);
4416
+ }
4417
+ }
4418
+ render() {
4419
+ const {
4420
+ children: t,
4421
+ fallbackRender: n,
4422
+ FallbackComponent: s,
4423
+ fallback: r
4424
+ } = this.props, {
4425
+ didCatch: a,
4426
+ error: i
4427
+ } = this.state;
4428
+ let o = t;
4429
+ if (a) {
4430
+ const l = {
4431
+ error: i,
4432
+ resetErrorBoundary: this.resetErrorBoundary
4433
+ };
4434
+ if (typeof n == "function")
4435
+ o = n(l);
4436
+ else if (s)
4437
+ o = $n(s, l);
4438
+ else if (r !== void 0)
4439
+ o = r;
4440
+ else
4441
+ throw i;
4442
+ }
4443
+ return $n(_c.Provider, {
4444
+ value: {
4445
+ didCatch: a,
4446
+ error: i,
4447
+ resetErrorBoundary: this.resetErrorBoundary
4448
+ }
4449
+ }, o);
4450
+ }
4451
+ }
4452
+ function wc() {
4453
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
4454
+ return e.length !== t.length || e.some((n, s) => !Object.is(n, t[s]));
4455
+ }
4456
+ const vc = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), fs = (e) => {
4457
+ if (!e.trim())
4458
+ return { isValid: !1, parsed: null, placeholders: [], error: { message: "JSON is empty" } };
4459
+ try {
4460
+ return { isValid: !0, parsed: JSON.parse(e), error: null, placeholders: [] };
4461
+ } catch {
4462
+ }
4463
+ const t = /{{([^{}]+)}}/g, n = [];
4464
+ let s = e, r;
4465
+ for (; (r = t.exec(e)) !== null; ) {
4466
+ const a = r[0], i = r.index, o = `"__placeholder_${n.length}__"`;
4467
+ n.push({ original: a, replaced: o, position: i }), s = s.replace(a, o);
4468
+ }
4469
+ try {
4470
+ return { isValid: !0, parsed: JSON.parse(s), error: null, placeholders: n };
4471
+ } catch (a) {
4472
+ const i = a, o = i.message.match(/position (\d+)/), l = o ? parseInt(o[1]) : void 0;
4473
+ let d, u;
4474
+ if (l !== void 0) {
4475
+ const f = s.substring(0, l).split(`
4476
+ `);
4477
+ d = f.length, u = f[f.length - 1].length + 1;
4478
+ }
4479
+ return {
4480
+ isValid: !1,
4481
+ parsed: null,
4482
+ placeholders: n,
4483
+ error: {
4484
+ message: i.message,
4485
+ line: d,
4486
+ column: u,
4487
+ position: l
4488
+ }
4489
+ };
4490
+ }
4491
+ }, bc = (e, t) => {
4492
+ let s = JSON.stringify(e, null, 2);
4493
+ return t.forEach(({ original: r }, a) => {
4494
+ const i = `"__placeholder_${a}__"`, o = new RegExp(vc(i), "g");
4495
+ s = s.replace(o, r);
4496
+ }), s;
4497
+ }, Ic = (e, t) => {
4498
+ if (!e) return "";
4499
+ let n = JSON.stringify(e, null, 2);
4500
+ const s = /{{([^{}]+)}}/g;
4501
+ let r;
4502
+ for (; (r = s.exec(n)) !== null; ) {
4503
+ const a = r[1], i = H(t, a, null);
4504
+ n = n.replace(r[0], i);
4505
+ }
4506
+ return n;
4507
+ }, Lc = V(() => import("./shared-json-ld-DHWdJvQd.js")), Uu = ({
4508
+ value: e,
4509
+ onChange: t,
4510
+ disabled: n = !1,
4511
+ readOnly: s = !1,
4512
+ placeholder: r = "Enter JSON",
4513
+ rows: a = 6,
4514
+ id: i = "json-input",
4515
+ pageData: o = {},
4516
+ handleFieldInsert: l,
4517
+ hasJsonLdForSelectedLang: d,
4518
+ copyJsonLDFromDefaultPage: u
4519
+ }) => {
4520
+ const [f, g] = K("edit"), [h, p] = K(null), [T, S] = K(""), D = Ie(null), [y] = Gn(), w = i === "jsonLD" && H(y, "features.sharedJsonLD", !1), v = i === "jsonLD" && !d && !!u;
4521
+ se(() => {
4522
+ e.trim() === "" && t("{}");
4523
+ }, [e, t]);
4524
+ const U = (B) => {
4525
+ if (s) return;
4526
+ const P = B.target.value;
4527
+ t(P);
4528
+ }, b = (B) => {
4529
+ if (B.key === "Tab") {
4530
+ B.preventDefault();
4531
+ const P = B.currentTarget, I = P.selectionStart, j = P.selectionEnd;
4532
+ if (I !== j) {
4533
+ const ue = e.substring(I, j).split(`
4534
+ `);
4535
+ if (B.shiftKey) {
4536
+ const be = ue.map((Ge) => Ge.startsWith(" ") ? Ge.substring(2) : Ge).join(`
4537
+ `), ot = e.substring(0, I) + be + e.substring(j);
4538
+ t(ot), setTimeout(() => {
4539
+ P.selectionStart = I, P.selectionEnd = I + be.length;
4540
+ }, 0);
4541
+ } else {
4542
+ const be = ue.map((Ge) => ` ${Ge}`).join(`
4543
+ `), ot = e.substring(0, I) + be + e.substring(j);
4544
+ t(ot), setTimeout(() => {
4545
+ P.selectionStart = I, P.selectionEnd = I + be.length;
4546
+ }, 0);
4547
+ }
4548
+ } else {
4549
+ const $ = e.substring(0, I) + " " + e.substring(j);
4550
+ t($), setTimeout(() => {
4551
+ P.selectionStart = P.selectionEnd = I + 2;
4552
+ }, 0);
4553
+ }
4554
+ }
4555
+ };
4556
+ se(() => {
4557
+ const B = fs(e);
4558
+ if (B.isValid)
4559
+ if (p(null), B.parsed) {
4560
+ const P = Ic(B.parsed, o);
4561
+ S(P);
4562
+ } else
4563
+ S("");
4564
+ else
4565
+ p(B.error), S("");
4566
+ }, [e, o]);
4567
+ const ye = () => {
4568
+ const B = fs(e);
4569
+ if (B.isValid && B.parsed) {
4570
+ const P = bc(B.parsed, B.placeholders);
4571
+ t(P);
4572
+ }
4573
+ }, Ae = () => {
4574
+ h != null && h.position && D.current && (D.current.focus(), D.current.setSelectionRange(h.position, h.position + 1));
4575
+ };
4576
+ return /* @__PURE__ */ c(Pc, { fallback: /* @__PURE__ */ c("div", { children: "Some error" }), children: /* @__PURE__ */ c("div", { className: "space-y-2", children: /* @__PURE__ */ m(Na, { value: f, onValueChange: g, className: "w-full", children: [
4577
+ /* @__PURE__ */ m("div", { className: "mb-2 flex items-center justify-between", children: [
4578
+ /* @__PURE__ */ m(Ca, { className: "w-max", children: [
4579
+ /* @__PURE__ */ m(an, { value: "edit", className: "flex items-center gap-1", children: [
4580
+ /* @__PURE__ */ c(Ja, { className: "h-4 w-4" }),
4581
+ /* @__PURE__ */ c("span", { children: "Edit" })
4582
+ ] }),
4583
+ /* @__PURE__ */ m(
4584
+ an,
4585
+ {
4586
+ value: "preview",
4587
+ className: "flex items-center gap-1",
4588
+ disabled: !e.trim() || h !== null || v,
4589
+ children: [
4590
+ /* @__PURE__ */ c(Za, { className: "h-4 w-4" }),
4591
+ /* @__PURE__ */ c("span", { children: "Preview" })
4592
+ ]
4593
+ }
4594
+ ),
4595
+ w && /* @__PURE__ */ m(
4596
+ an,
4597
+ {
4598
+ value: "shared",
4599
+ className: "flex items-center gap-1",
4600
+ disabled: !e.trim() || h !== null,
4601
+ children: [
4602
+ /* @__PURE__ */ c(Xa, { className: "h-4 w-4" }),
4603
+ /* @__PURE__ */ c("span", { children: "Shared" })
4604
+ ]
4605
+ }
4606
+ )
4607
+ ] }),
4608
+ v ? null : f === "edit" && !s && /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ c(
4609
+ Tc,
4610
+ {
4611
+ dataType: "value",
4612
+ data: o ?? {},
4613
+ onSelect: (B) => l && l(B, i)
4614
+ }
4615
+ ) })
4616
+ ] }),
4617
+ /* @__PURE__ */ m(on, { value: "edit", className: "relative mt-0", children: [
4618
+ !v && f === "edit" && /* @__PURE__ */ c(Un, { content: "Format JSON", side: "right", showTooltip: !n && !h, children: /* @__PURE__ */ c(
4619
+ M,
4620
+ {
4621
+ type: "button",
4622
+ variant: "outline",
4623
+ size: "icon",
4624
+ onClick: ye,
4625
+ className: "absolute right-1 top-1 h-6 w-6 p-1",
4626
+ disabled: !e.trim() || n || h !== null,
4627
+ children: /* @__PURE__ */ c(ei, {})
4628
+ }
4629
+ ) }),
4630
+ v ? /* @__PURE__ */ c("div", { className: "flex h-40 items-center justify-center rounded-md bg-black/20", children: /* @__PURE__ */ m("div", { className: "flex max-w-[400px] flex-col items-center gap-2 rounded-md bg-white p-4 shadow-lg", children: [
4631
+ /* @__PURE__ */ c("div", { className: "max-w-xl text-center text-xs text-gray-500", children: "JSON-LD for is not added for selected language. JSON LD will be used from default language." }),
4632
+ /* @__PURE__ */ m(M, { type: "button", variant: "default", size: "sm", onClick: u, children: [
4633
+ /* @__PURE__ */ c(Is, {}),
4634
+ "Copy & Edit from default language"
4635
+ ] })
4636
+ ] }) }) : /* @__PURE__ */ c(
4637
+ Qn,
4638
+ {
4639
+ ref: D,
4640
+ id: i,
4641
+ name: i,
4642
+ className: `rounded-md border border-input text-xs ${h ? "border-red-500" : ""}`,
4643
+ onChange: U,
4644
+ onKeyDown: b,
4645
+ value: e,
4646
+ placeholder: r,
4647
+ rows: a,
4648
+ disabled: n,
4649
+ readOnly: s
4650
+ }
4651
+ ),
4652
+ h && /* @__PURE__ */ m(Ga, { variant: "destructive", className: "mt-2", children: [
4653
+ /* @__PURE__ */ c(ti, { className: "h-4 w-4" }),
4654
+ /* @__PURE__ */ m(Oa, { className: "flex flex-col", children: [
4655
+ /* @__PURE__ */ c("span", { className: "font-medium", children: "Invalid JSON" }),
4656
+ /* @__PURE__ */ c("span", { className: "text-sm", children: h.message }),
4657
+ h.line && h.column && /* @__PURE__ */ m("span", { className: "text-sm", children: [
4658
+ "Error at line ",
4659
+ h.line,
4660
+ ", column ",
4661
+ h.column
4662
+ ] }),
4663
+ /* @__PURE__ */ c(
4664
+ M,
4665
+ {
4666
+ type: "button",
4667
+ variant: "link",
4668
+ size: "sm",
4669
+ className: "mt-1 h-auto self-start p-0 text-sm",
4670
+ onClick: Ae,
4671
+ children: "Show position"
4672
+ }
4673
+ )
4674
+ ] })
4675
+ ] })
4676
+ ] }),
4677
+ /* @__PURE__ */ m(on, { value: "preview", className: "mt-0", children: [
4678
+ /* @__PURE__ */ c(Qn, { rows: a, value: T, readOnly: !0, className: "cursor-default bg-muted font-mono text-sm" }),
4679
+ /* @__PURE__ */ c("p", { className: "mt-1 text-xs text-muted-foreground", children: "This is how the JSON will look after placeholder substitution." })
4680
+ ] }),
4681
+ w && /* @__PURE__ */ c(on, { value: "shared", className: "mt-0", children: /* @__PURE__ */ c(X, { children: /* @__PURE__ */ c(Lc, {}) }) })
4682
+ ] }) }) });
4683
+ }, Mu = (e) => {
4684
+ const t = Ls(), n = L();
4685
+ return oe({
4686
+ queryKey: [E.GET_CHAI_USER, e],
4687
+ queryFn: async () => {
4688
+ const r = await n(t, {
4689
+ action: E.GET_CHAI_USER,
4690
+ data: { userId: e }
4691
+ });
4692
+ return { ...r, name: r.name || r.email };
4693
+ },
4694
+ enabled: !Te(e),
4695
+ staleTime: "static"
4696
+ });
4697
+ };
4698
+ if (typeof window > "u")
4699
+ throw new Error("@chaibuilder/pages is not available on the server");
4700
+ export {
4701
+ wu as $,
4702
+ E as A,
4703
+ Fs as B,
4704
+ F as C,
4705
+ ol as D,
4706
+ ne as E,
4707
+ Js as F,
4708
+ ar as G,
4709
+ Wo as H,
4710
+ lu as I,
4711
+ cu as J,
4712
+ Re as K,
4713
+ Dt as L,
4714
+ Tn as M,
4715
+ uu as N,
4716
+ au as O,
4717
+ ee as P,
4718
+ Eu as Q,
4719
+ Au as R,
4720
+ hu as S,
4721
+ Un as T,
4722
+ dt as U,
4723
+ Tu as V,
4724
+ pu as W,
4725
+ Mo as X,
4726
+ ml as Y,
4727
+ Sn as Z,
4728
+ ul as _,
4729
+ he as a,
4730
+ xn as a$,
4731
+ vu as a0,
4732
+ gl as a1,
4733
+ bu as a2,
4734
+ Iu as a3,
4735
+ du as a4,
4736
+ ru as a5,
4737
+ yu as a6,
4738
+ Z as a7,
4739
+ Ro as a8,
4740
+ Jl as a9,
4741
+ en as aA,
4742
+ Rs as aB,
4743
+ Zc as aC,
4744
+ tu as aD,
4745
+ Uu as aE,
4746
+ fs as aF,
4747
+ Xc as aG,
4748
+ nu as aH,
4749
+ su as aI,
4750
+ eu as aJ,
4751
+ Yi as aK,
4752
+ qc as aL,
4753
+ Ds as aM,
4754
+ go as aN,
4755
+ Ri as aO,
4756
+ Gn as aP,
4757
+ Ni as aQ,
4758
+ Tc as aR,
4759
+ ku as aS,
4760
+ Kc as aT,
4761
+ Pc as aU,
4762
+ Ou as aV,
4763
+ Ne as aW,
4764
+ xu as aX,
4765
+ uc as aY,
4766
+ Du as aZ,
4767
+ Ru as a_,
4768
+ fu as aa,
4769
+ Ut as ab,
4770
+ Cu as ac,
4771
+ Pu as ad,
4772
+ _u as ae,
4773
+ js as af,
4774
+ xe as ag,
4775
+ dl as ah,
4776
+ Su as ai,
4777
+ mu as aj,
4778
+ gu as ak,
4779
+ Mt as al,
4780
+ ou as am,
4781
+ wi as an,
4782
+ Mu as ao,
4783
+ _i as ap,
4784
+ C as aq,
4785
+ L as ar,
4786
+ cc as as,
4787
+ Vc as at,
4788
+ Jc as au,
4789
+ Dn as av,
4790
+ ce as aw,
4791
+ cn as ax,
4792
+ de as ay,
4793
+ Os as az,
4794
+ ks as b,
4795
+ po as b0,
4796
+ we as c,
4797
+ Bi as d,
4798
+ Bs as e,
4799
+ mo as f,
4800
+ Us as g,
4801
+ $c as h,
4802
+ Qc as i,
4803
+ Be as j,
4804
+ kn as k,
4805
+ Me as l,
4806
+ Ce as m,
4807
+ ci as n,
4808
+ jc as o,
4809
+ ac as p,
4810
+ zc as q,
4811
+ Wc as r,
4812
+ Yc as s,
4813
+ un as t,
4814
+ Hc as u,
4815
+ Gu as v,
4816
+ W as w,
4817
+ rr as x,
4818
+ Lu as y,
4819
+ Nu as z
4820
+ };