@chaibuilder/pages 0.1.0-beta.7 → 0.1.0-beta.9

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 (3) hide show
  1. package/dist/index.cjs +10 -10
  2. package/dist/index.js +787 -782
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import pt, { useState as I, useEffect as Be, useCallback as la, useMemo as ye, useRef as ca } from "react";
2
- import { loadWebBlocks as ua } from "@chaibuilder/sdk/web-blocks";
3
- import { getBlocksFromHTML as da, useLanguages as Ue, ChaiBuilderEditor as ha } from "@chaibuilder/sdk";
4
- import { useQueryClient as z, useQuery as ne, useMutation as re, QueryClient as fa, QueryClientProvider as pa } from "@tanstack/react-query";
5
- import { useToast as J, Accordion as ga, AccordionItem as pe, AccordionTrigger as ge, AccordionContent as me, Label as _, Input as U, Textarea as ve, Button as B, Popover as gt, PopoverTrigger as mt, PopoverContent as vt, Dialog as xt, DialogContent as bt, DialogHeader as yt, DialogTitle as jt, DialogDescription as wt, DialogFooter as St, Tabs as ma, TabsList as va, TabsTrigger as ut, SheetHeader as xa, SheetDescription as ba, Sheet as ya, SheetContent as ja } from "@chaibuilder/sdk/ui";
6
- import { StarIcon as wa, PencilIcon as Et, TrashIcon as Ct, Plus as Sa, GlobeIcon as kt, File as Nt, ArrowLeftRightIcon as Ea, RocketIcon as Ca } from "lucide-react";
7
- import { get as G, find as se, isString as Fe, filter as ae, isEmpty as W, includes as xe, startCase as ka, reverse as Na, sortBy as Ta, isEqual as Le, map as Ge, toLower as Pa, trim as _a, orderBy as Oa } from "lodash-es";
8
- var Ie = { exports: {} }, ee = {};
1
+ import pt, { useCallback as xt, useState as I, useEffect as Le, useMemo as ve, useRef as vt } from "react";
2
+ import { loadWebBlocks as da } from "@chaibuilder/sdk/web-blocks";
3
+ import { getBlocksFromHTML as ha, useLanguages as Ie, ChaiBuilderEditor as fa } from "@chaibuilder/sdk";
4
+ import { useQueryClient as te, useQuery as Y, useMutation as be, QueryClient as ga, QueryClientProvider as ma } from "@tanstack/react-query";
5
+ import { useToast as ae, Accordion as pa, AccordionItem as he, AccordionTrigger as fe, AccordionContent as ge, Label as R, Input as G, Textarea as me, Button as B, Popover as bt, PopoverTrigger as yt, PopoverContent as jt, Dialog as wt, DialogContent as St, DialogHeader as kt, DialogTitle as Ct, DialogDescription as Et, DialogFooter as Nt, Tabs as xa, TabsList as va, TabsTrigger as ut, SheetHeader as ba, SheetDescription as ya, Sheet as ja, SheetContent as wa } from "@chaibuilder/sdk/ui";
6
+ import { StarIcon as Sa, PencilIcon as Tt, TrashIcon as Pt, Plus as ka, GlobeIcon as _t, File as Ot, ArrowLeftRightIcon as Ca, RocketIcon as Ea } from "lucide-react";
7
+ import { get as q, find as ne, isEmpty as M, filter as Be, includes as pe, startCase as Na, reverse as Ta, sortBy as Pa, isEqual as Fe, map as Ue, startsWith as dt, toLower as _a, trim as Oa, orderBy as Ra, isString as ht } from "lodash-es";
8
+ var Ae = { exports: {} }, Z = {};
9
9
  /**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
@@ -15,21 +15,21 @@ var Ie = { exports: {} }, ee = {};
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  */
18
- var dt;
19
- function Ra() {
20
- if (dt) return ee;
21
- dt = 1;
22
- var r = pt, i = Symbol.for("react.element"), o = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, w = { key: !0, ref: !0, __self: !0, __source: !0 };
23
- function c(p, u, m) {
24
- var h, g = {}, f = null, S = null;
25
- m !== void 0 && (f = "" + m), u.key !== void 0 && (f = "" + u.key), u.ref !== void 0 && (S = u.ref);
26
- for (h in u) a.call(u, h) && !w.hasOwnProperty(h) && (g[h] = u[h]);
27
- if (p && p.defaultProps) for (h in u = p.defaultProps, u) g[h] === void 0 && (g[h] = u[h]);
28
- return { $$typeof: i, type: p, key: f, ref: S, props: g, _owner: s.current };
18
+ var ft;
19
+ function Da() {
20
+ if (ft) return Z;
21
+ ft = 1;
22
+ var n = pt, i = Symbol.for("react.element"), l = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, s = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, x = { key: !0, ref: !0, __self: !0, __source: !0 };
23
+ function c(g, h, v) {
24
+ var y, m = {}, u = null, w = null;
25
+ v !== void 0 && (u = "" + v), h.key !== void 0 && (u = "" + h.key), h.ref !== void 0 && (w = h.ref);
26
+ for (y in h) a.call(h, y) && !x.hasOwnProperty(y) && (m[y] = h[y]);
27
+ if (g && g.defaultProps) for (y in h = g.defaultProps, h) m[y] === void 0 && (m[y] = h[y]);
28
+ return { $$typeof: i, type: g, key: u, ref: w, props: m, _owner: s.current };
29
29
  }
30
- return ee.Fragment = o, ee.jsx = c, ee.jsxs = c, ee;
30
+ return Z.Fragment = l, Z.jsx = c, Z.jsxs = c, Z;
31
31
  }
32
- var te = {};
32
+ var ee = {};
33
33
  /**
34
34
  * @license React
35
35
  * react-jsx-runtime.development.js
@@ -39,91 +39,91 @@ var te = {};
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
41
  */
42
- var ht;
43
- function Da() {
44
- return ht || (ht = 1, process.env.NODE_ENV !== "production" && function() {
45
- var r = pt, i = Symbol.for("react.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), p = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), T = Symbol.iterator, E = "@@iterator";
46
- function A(e) {
42
+ var gt;
43
+ function Fa() {
44
+ return gt || (gt = 1, process.env.NODE_ENV !== "production" && function() {
45
+ var n = pt, i = Symbol.for("react.element"), l = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), g = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), u = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), _ = Symbol.iterator, S = "@@iterator";
46
+ function C(e) {
47
47
  if (e === null || typeof e != "object")
48
48
  return null;
49
- var n = T && e[T] || e[E];
50
- return typeof n == "function" ? n : null;
49
+ var r = _ && e[_] || e[S];
50
+ return typeof r == "function" ? r : null;
51
51
  }
52
- var R = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
53
- function b(e) {
52
+ var N = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
53
+ function P(e) {
54
54
  {
55
- for (var n = arguments.length, l = new Array(n > 1 ? n - 1 : 0), d = 1; d < n; d++)
56
- l[d - 1] = arguments[d];
57
- je("error", e, l);
55
+ for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), d = 1; d < r; d++)
56
+ o[d - 1] = arguments[d];
57
+ ye("error", e, o);
58
58
  }
59
59
  }
60
- function je(e, n, l) {
60
+ function ye(e, r, o) {
61
61
  {
62
- var d = R.ReactDebugCurrentFrame, y = d.getStackAddendum();
63
- y !== "" && (n += "%s", l = l.concat([y]));
64
- var j = l.map(function(x) {
65
- return String(x);
62
+ var d = N.ReactDebugCurrentFrame, b = d.getStackAddendum();
63
+ b !== "" && (r += "%s", o = o.concat([b]));
64
+ var j = o.map(function(p) {
65
+ return String(p);
66
66
  });
67
- j.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, j);
67
+ j.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, j);
68
68
  }
69
69
  }
70
- var ie = !1, H = !1, we = !1, Se = !1, oe = !1, q;
71
- q = Symbol.for("react.module.reference");
72
- function Ee(e) {
73
- return !!(typeof e == "string" || typeof e == "function" || e === a || e === w || oe || e === s || e === m || e === h || Se || e === S || ie || H || we || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === g || e.$$typeof === c || e.$$typeof === p || e.$$typeof === u || // This needs to include all possible module reference object
70
+ var je = !1, se = !1, J = !1, we = !1, Se = !1, H;
71
+ H = Symbol.for("react.module.reference");
72
+ function K(e) {
73
+ return !!(typeof e == "string" || typeof e == "function" || e === a || e === x || Se || e === s || e === v || e === y || we || e === w || je || se || J || typeof e == "object" && e !== null && (e.$$typeof === u || e.$$typeof === m || e.$$typeof === c || e.$$typeof === g || e.$$typeof === h || // This needs to include all possible module reference object
74
74
  // types supported by any Flight configuration anywhere since
75
75
  // we don't know which Flight build this will end up being used
76
76
  // with.
77
- e.$$typeof === q || e.getModuleId !== void 0));
77
+ e.$$typeof === H || e.getModuleId !== void 0));
78
78
  }
79
- function Ce(e, n, l) {
79
+ function ke(e, r, o) {
80
80
  var d = e.displayName;
81
81
  if (d)
82
82
  return d;
83
- var y = n.displayName || n.name || "";
84
- return y !== "" ? l + "(" + y + ")" : l;
83
+ var b = r.displayName || r.name || "";
84
+ return b !== "" ? o + "(" + b + ")" : o;
85
85
  }
86
- function Q(e) {
86
+ function ie(e) {
87
87
  return e.displayName || "Context";
88
88
  }
89
- function C(e) {
89
+ function F(e) {
90
90
  if (e == null)
91
91
  return null;
92
- if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
92
+ if (typeof e.tag == "number" && P("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
93
93
  return e.displayName || e.name || null;
94
94
  if (typeof e == "string")
95
95
  return e;
96
96
  switch (e) {
97
97
  case a:
98
98
  return "Fragment";
99
- case o:
99
+ case l:
100
100
  return "Portal";
101
- case w:
101
+ case x:
102
102
  return "Profiler";
103
103
  case s:
104
104
  return "StrictMode";
105
- case m:
105
+ case v:
106
106
  return "Suspense";
107
- case h:
107
+ case y:
108
108
  return "SuspenseList";
109
109
  }
110
110
  if (typeof e == "object")
111
111
  switch (e.$$typeof) {
112
- case p:
113
- var n = e;
114
- return Q(n) + ".Consumer";
115
- case c:
116
- var l = e;
117
- return Q(l._context) + ".Provider";
118
- case u:
119
- return Ce(e, e.render, "ForwardRef");
120
112
  case g:
113
+ var r = e;
114
+ return ie(r) + ".Consumer";
115
+ case c:
116
+ var o = e;
117
+ return ie(o._context) + ".Provider";
118
+ case h:
119
+ return ke(e, e.render, "ForwardRef");
120
+ case m:
121
121
  var d = e.displayName || null;
122
- return d !== null ? d : C(e.type) || "Memo";
123
- case f: {
124
- var y = e, j = y._payload, x = y._init;
122
+ return d !== null ? d : F(e.type) || "Memo";
123
+ case u: {
124
+ var b = e, j = b._payload, p = b._init;
125
125
  try {
126
- return C(x(j));
126
+ return F(p(j));
127
127
  } catch {
128
128
  return null;
129
129
  }
@@ -131,18 +131,18 @@ function Da() {
131
131
  }
132
132
  return null;
133
133
  }
134
- var F = Object.assign, M = 0, le, ce, Ke, Ve, We, ze, Je;
135
- function Ye() {
134
+ var k = Object.assign, A = 0, W, oe, Ke, We, Ve, ze, Ye;
135
+ function Je() {
136
136
  }
137
- Ye.__reactDisabledLog = !0;
138
- function Ft() {
137
+ Je.__reactDisabledLog = !0;
138
+ function Bt() {
139
139
  {
140
- if (M === 0) {
141
- le = console.log, ce = console.info, Ke = console.warn, Ve = console.error, We = console.group, ze = console.groupCollapsed, Je = console.groupEnd;
140
+ if (A === 0) {
141
+ W = console.log, oe = console.info, Ke = console.warn, We = console.error, Ve = console.group, ze = console.groupCollapsed, Ye = console.groupEnd;
142
142
  var e = {
143
143
  configurable: !0,
144
144
  enumerable: !0,
145
- value: Ye,
145
+ value: Je,
146
146
  writable: !0
147
147
  };
148
148
  Object.defineProperties(console, {
@@ -155,208 +155,208 @@ function Da() {
155
155
  groupEnd: e
156
156
  });
157
157
  }
158
- M++;
158
+ A++;
159
159
  }
160
160
  }
161
- function Lt() {
161
+ function Ut() {
162
162
  {
163
- if (M--, M === 0) {
163
+ if (A--, A === 0) {
164
164
  var e = {
165
165
  configurable: !0,
166
166
  enumerable: !0,
167
167
  writable: !0
168
168
  };
169
169
  Object.defineProperties(console, {
170
- log: F({}, e, {
171
- value: le
170
+ log: k({}, e, {
171
+ value: W
172
172
  }),
173
- info: F({}, e, {
174
- value: ce
173
+ info: k({}, e, {
174
+ value: oe
175
175
  }),
176
- warn: F({}, e, {
176
+ warn: k({}, e, {
177
177
  value: Ke
178
178
  }),
179
- error: F({}, e, {
180
- value: Ve
181
- }),
182
- group: F({}, e, {
179
+ error: k({}, e, {
183
180
  value: We
184
181
  }),
185
- groupCollapsed: F({}, e, {
182
+ group: k({}, e, {
183
+ value: Ve
184
+ }),
185
+ groupCollapsed: k({}, e, {
186
186
  value: ze
187
187
  }),
188
- groupEnd: F({}, e, {
189
- value: Je
188
+ groupEnd: k({}, e, {
189
+ value: Ye
190
190
  })
191
191
  });
192
192
  }
193
- M < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
193
+ A < 0 && P("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
194
194
  }
195
195
  }
196
- var ke = R.ReactCurrentDispatcher, Ne;
197
- function ue(e, n, l) {
196
+ var Ce = N.ReactCurrentDispatcher, Ee;
197
+ function le(e, r, o) {
198
198
  {
199
- if (Ne === void 0)
199
+ if (Ee === void 0)
200
200
  try {
201
201
  throw Error();
202
- } catch (y) {
203
- var d = y.stack.trim().match(/\n( *(at )?)/);
204
- Ne = d && d[1] || "";
202
+ } catch (b) {
203
+ var d = b.stack.trim().match(/\n( *(at )?)/);
204
+ Ee = d && d[1] || "";
205
205
  }
206
206
  return `
207
- ` + Ne + e;
207
+ ` + Ee + e;
208
208
  }
209
209
  }
210
- var Te = !1, de;
210
+ var Ne = !1, ce;
211
211
  {
212
- var It = typeof WeakMap == "function" ? WeakMap : Map;
213
- de = new It();
212
+ var Gt = typeof WeakMap == "function" ? WeakMap : Map;
213
+ ce = new Gt();
214
214
  }
215
- function He(e, n) {
216
- if (!e || Te)
215
+ function He(e, r) {
216
+ if (!e || Ne)
217
217
  return "";
218
218
  {
219
- var l = de.get(e);
220
- if (l !== void 0)
221
- return l;
219
+ var o = ce.get(e);
220
+ if (o !== void 0)
221
+ return o;
222
222
  }
223
223
  var d;
224
- Te = !0;
225
- var y = Error.prepareStackTrace;
224
+ Ne = !0;
225
+ var b = Error.prepareStackTrace;
226
226
  Error.prepareStackTrace = void 0;
227
227
  var j;
228
- j = ke.current, ke.current = null, Ft();
228
+ j = Ce.current, Ce.current = null, Bt();
229
229
  try {
230
- if (n) {
231
- var x = function() {
230
+ if (r) {
231
+ var p = function() {
232
232
  throw Error();
233
233
  };
234
- if (Object.defineProperty(x.prototype, "props", {
234
+ if (Object.defineProperty(p.prototype, "props", {
235
235
  set: function() {
236
236
  throw Error();
237
237
  }
238
238
  }), typeof Reflect == "object" && Reflect.construct) {
239
239
  try {
240
- Reflect.construct(x, []);
241
- } catch (O) {
242
- d = O;
240
+ Reflect.construct(p, []);
241
+ } catch (D) {
242
+ d = D;
243
243
  }
244
- Reflect.construct(e, [], x);
244
+ Reflect.construct(e, [], p);
245
245
  } else {
246
246
  try {
247
- x.call();
248
- } catch (O) {
249
- d = O;
247
+ p.call();
248
+ } catch (D) {
249
+ d = D;
250
250
  }
251
- e.call(x.prototype);
251
+ e.call(p.prototype);
252
252
  }
253
253
  } else {
254
254
  try {
255
255
  throw Error();
256
- } catch (O) {
257
- d = O;
256
+ } catch (D) {
257
+ d = D;
258
258
  }
259
259
  e();
260
260
  }
261
- } catch (O) {
262
- if (O && d && typeof O.stack == "string") {
263
- for (var v = O.stack.split(`
264
- `), P = d.stack.split(`
265
- `), k = v.length - 1, N = P.length - 1; k >= 1 && N >= 0 && v[k] !== P[N]; )
266
- N--;
267
- for (; k >= 1 && N >= 0; k--, N--)
268
- if (v[k] !== P[N]) {
269
- if (k !== 1 || N !== 1)
261
+ } catch (D) {
262
+ if (D && d && typeof D.stack == "string") {
263
+ for (var f = D.stack.split(`
264
+ `), O = d.stack.split(`
265
+ `), E = f.length - 1, T = O.length - 1; E >= 1 && T >= 0 && f[E] !== O[T]; )
266
+ T--;
267
+ for (; E >= 1 && T >= 0; E--, T--)
268
+ if (f[E] !== O[T]) {
269
+ if (E !== 1 || T !== 1)
270
270
  do
271
- if (k--, N--, N < 0 || v[k] !== P[N]) {
271
+ if (E--, T--, T < 0 || f[E] !== O[T]) {
272
272
  var L = `
273
- ` + v[k].replace(" at new ", " at ");
274
- return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && de.set(e, L), L;
273
+ ` + f[E].replace(" at new ", " at ");
274
+ return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && ce.set(e, L), L;
275
275
  }
276
- while (k >= 1 && N >= 0);
276
+ while (E >= 1 && T >= 0);
277
277
  break;
278
278
  }
279
279
  }
280
280
  } finally {
281
- Te = !1, ke.current = j, Lt(), Error.prepareStackTrace = y;
281
+ Ne = !1, Ce.current = j, Ut(), Error.prepareStackTrace = b;
282
282
  }
283
- var V = e ? e.displayName || e.name : "", $ = V ? ue(V) : "";
284
- return typeof e == "function" && de.set(e, $), $;
283
+ var z = e ? e.displayName || e.name : "", $ = z ? le(z) : "";
284
+ return typeof e == "function" && ce.set(e, $), $;
285
285
  }
286
- function Bt(e, n, l) {
286
+ function qt(e, r, o) {
287
287
  return He(e, !1);
288
288
  }
289
- function Ut(e) {
290
- var n = e.prototype;
291
- return !!(n && n.isReactComponent);
289
+ function Mt(e) {
290
+ var r = e.prototype;
291
+ return !!(r && r.isReactComponent);
292
292
  }
293
- function he(e, n, l) {
293
+ function ue(e, r, o) {
294
294
  if (e == null)
295
295
  return "";
296
296
  if (typeof e == "function")
297
- return He(e, Ut(e));
297
+ return He(e, Mt(e));
298
298
  if (typeof e == "string")
299
- return ue(e);
299
+ return le(e);
300
300
  switch (e) {
301
- case m:
302
- return ue("Suspense");
303
- case h:
304
- return ue("SuspenseList");
301
+ case v:
302
+ return le("Suspense");
303
+ case y:
304
+ return le("SuspenseList");
305
305
  }
306
306
  if (typeof e == "object")
307
307
  switch (e.$$typeof) {
308
- case u:
309
- return Bt(e.render);
310
- case g:
311
- return he(e.type, n, l);
312
- case f: {
313
- var d = e, y = d._payload, j = d._init;
308
+ case h:
309
+ return qt(e.render);
310
+ case m:
311
+ return ue(e.type, r, o);
312
+ case u: {
313
+ var d = e, b = d._payload, j = d._init;
314
314
  try {
315
- return he(j(y), n, l);
315
+ return ue(j(b), r, o);
316
316
  } catch {
317
317
  }
318
318
  }
319
319
  }
320
320
  return "";
321
321
  }
322
- var X = Object.prototype.hasOwnProperty, Qe = {}, Xe = R.ReactDebugCurrentFrame;
323
- function fe(e) {
322
+ var Q = Object.prototype.hasOwnProperty, Qe = {}, Xe = N.ReactDebugCurrentFrame;
323
+ function de(e) {
324
324
  if (e) {
325
- var n = e._owner, l = he(e.type, e._source, n ? n.type : null);
326
- Xe.setExtraStackFrame(l);
325
+ var r = e._owner, o = ue(e.type, e._source, r ? r.type : null);
326
+ Xe.setExtraStackFrame(o);
327
327
  } else
328
328
  Xe.setExtraStackFrame(null);
329
329
  }
330
- function Gt(e, n, l, d, y) {
330
+ function $t(e, r, o, d, b) {
331
331
  {
332
- var j = Function.call.bind(X);
333
- for (var x in e)
334
- if (j(e, x)) {
335
- var v = void 0;
332
+ var j = Function.call.bind(Q);
333
+ for (var p in e)
334
+ if (j(e, p)) {
335
+ var f = void 0;
336
336
  try {
337
- if (typeof e[x] != "function") {
338
- var P = Error((d || "React class") + ": " + l + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
339
- throw P.name = "Invariant Violation", P;
337
+ if (typeof e[p] != "function") {
338
+ var O = Error((d || "React class") + ": " + o + " type `" + p + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[p] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
339
+ throw O.name = "Invariant Violation", O;
340
340
  }
341
- v = e[x](n, x, d, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
342
- } catch (k) {
343
- v = k;
341
+ f = e[p](r, p, d, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
342
+ } catch (E) {
343
+ f = E;
344
344
  }
345
- v && !(v instanceof Error) && (fe(y), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", l, x, typeof v), fe(null)), v instanceof Error && !(v.message in Qe) && (Qe[v.message] = !0, fe(y), b("Failed %s type: %s", l, v.message), fe(null));
345
+ f && !(f instanceof Error) && (de(b), P("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", o, p, typeof f), de(null)), f instanceof Error && !(f.message in Qe) && (Qe[f.message] = !0, de(b), P("Failed %s type: %s", o, f.message), de(null));
346
346
  }
347
347
  }
348
348
  }
349
- var qt = Array.isArray;
350
- function Pe(e) {
351
- return qt(e);
349
+ var Kt = Array.isArray;
350
+ function Te(e) {
351
+ return Kt(e);
352
352
  }
353
- function Mt(e) {
353
+ function Wt(e) {
354
354
  {
355
- var n = typeof Symbol == "function" && Symbol.toStringTag, l = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
356
- return l;
355
+ var r = typeof Symbol == "function" && Symbol.toStringTag, o = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
356
+ return o;
357
357
  }
358
358
  }
359
- function $t(e) {
359
+ function Vt(e) {
360
360
  try {
361
361
  return Ze(e), !1;
362
362
  } catch {
@@ -367,124 +367,124 @@ function Da() {
367
367
  return "" + e;
368
368
  }
369
369
  function et(e) {
370
- if ($t(e))
371
- return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Mt(e)), Ze(e);
370
+ if (Vt(e))
371
+ return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Wt(e)), Ze(e);
372
372
  }
373
- var Z = R.ReactCurrentOwner, Kt = {
373
+ var X = N.ReactCurrentOwner, zt = {
374
374
  key: !0,
375
375
  ref: !0,
376
376
  __self: !0,
377
377
  __source: !0
378
- }, tt, at, _e;
379
- _e = {};
380
- function Vt(e) {
381
- if (X.call(e, "ref")) {
382
- var n = Object.getOwnPropertyDescriptor(e, "ref").get;
383
- if (n && n.isReactWarning)
378
+ }, tt, at, Pe;
379
+ Pe = {};
380
+ function Yt(e) {
381
+ if (Q.call(e, "ref")) {
382
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
383
+ if (r && r.isReactWarning)
384
384
  return !1;
385
385
  }
386
386
  return e.ref !== void 0;
387
387
  }
388
- function Wt(e) {
389
- if (X.call(e, "key")) {
390
- var n = Object.getOwnPropertyDescriptor(e, "key").get;
391
- if (n && n.isReactWarning)
388
+ function Jt(e) {
389
+ if (Q.call(e, "key")) {
390
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
391
+ if (r && r.isReactWarning)
392
392
  return !1;
393
393
  }
394
394
  return e.key !== void 0;
395
395
  }
396
- function zt(e, n) {
397
- if (typeof e.ref == "string" && Z.current && n && Z.current.stateNode !== n) {
398
- var l = C(Z.current.type);
399
- _e[l] || (b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', C(Z.current.type), e.ref), _e[l] = !0);
396
+ function Ht(e, r) {
397
+ if (typeof e.ref == "string" && X.current && r && X.current.stateNode !== r) {
398
+ var o = F(X.current.type);
399
+ Pe[o] || (P('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', F(X.current.type), e.ref), Pe[o] = !0);
400
400
  }
401
401
  }
402
- function Jt(e, n) {
402
+ function Qt(e, r) {
403
403
  {
404
- var l = function() {
405
- tt || (tt = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
404
+ var o = function() {
405
+ tt || (tt = !0, P("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
406
406
  };
407
- l.isReactWarning = !0, Object.defineProperty(e, "key", {
408
- get: l,
407
+ o.isReactWarning = !0, Object.defineProperty(e, "key", {
408
+ get: o,
409
409
  configurable: !0
410
410
  });
411
411
  }
412
412
  }
413
- function Yt(e, n) {
413
+ function Xt(e, r) {
414
414
  {
415
- var l = function() {
416
- at || (at = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
415
+ var o = function() {
416
+ at || (at = !0, P("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
417
417
  };
418
- l.isReactWarning = !0, Object.defineProperty(e, "ref", {
419
- get: l,
418
+ o.isReactWarning = !0, Object.defineProperty(e, "ref", {
419
+ get: o,
420
420
  configurable: !0
421
421
  });
422
422
  }
423
423
  }
424
- var Ht = function(e, n, l, d, y, j, x) {
425
- var v = {
424
+ var Zt = function(e, r, o, d, b, j, p) {
425
+ var f = {
426
426
  // This tag allows us to uniquely identify this as a React Element
427
427
  $$typeof: i,
428
428
  // Built-in properties that belong on the element
429
429
  type: e,
430
- key: n,
431
- ref: l,
432
- props: x,
430
+ key: r,
431
+ ref: o,
432
+ props: p,
433
433
  // Record the component responsible for creating this element.
434
434
  _owner: j
435
435
  };
436
- return v._store = {}, Object.defineProperty(v._store, "validated", {
436
+ return f._store = {}, Object.defineProperty(f._store, "validated", {
437
437
  configurable: !1,
438
438
  enumerable: !1,
439
439
  writable: !0,
440
440
  value: !1
441
- }), Object.defineProperty(v, "_self", {
441
+ }), Object.defineProperty(f, "_self", {
442
442
  configurable: !1,
443
443
  enumerable: !1,
444
444
  writable: !1,
445
445
  value: d
446
- }), Object.defineProperty(v, "_source", {
446
+ }), Object.defineProperty(f, "_source", {
447
447
  configurable: !1,
448
448
  enumerable: !1,
449
449
  writable: !1,
450
- value: y
451
- }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
450
+ value: b
451
+ }), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
452
452
  };
453
- function Qt(e, n, l, d, y) {
453
+ function ea(e, r, o, d, b) {
454
454
  {
455
- var j, x = {}, v = null, P = null;
456
- l !== void 0 && (et(l), v = "" + l), Wt(n) && (et(n.key), v = "" + n.key), Vt(n) && (P = n.ref, zt(n, y));
457
- for (j in n)
458
- X.call(n, j) && !Kt.hasOwnProperty(j) && (x[j] = n[j]);
455
+ var j, p = {}, f = null, O = null;
456
+ o !== void 0 && (et(o), f = "" + o), Jt(r) && (et(r.key), f = "" + r.key), Yt(r) && (O = r.ref, Ht(r, b));
457
+ for (j in r)
458
+ Q.call(r, j) && !zt.hasOwnProperty(j) && (p[j] = r[j]);
459
459
  if (e && e.defaultProps) {
460
- var k = e.defaultProps;
461
- for (j in k)
462
- x[j] === void 0 && (x[j] = k[j]);
460
+ var E = e.defaultProps;
461
+ for (j in E)
462
+ p[j] === void 0 && (p[j] = E[j]);
463
463
  }
464
- if (v || P) {
465
- var N = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
466
- v && Jt(x, N), P && Yt(x, N);
464
+ if (f || O) {
465
+ var T = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
466
+ f && Qt(p, T), O && Xt(p, T);
467
467
  }
468
- return Ht(e, v, P, y, d, Z.current, x);
468
+ return Zt(e, f, O, b, d, X.current, p);
469
469
  }
470
470
  }
471
- var Oe = R.ReactCurrentOwner, nt = R.ReactDebugCurrentFrame;
472
- function K(e) {
471
+ var _e = N.ReactCurrentOwner, nt = N.ReactDebugCurrentFrame;
472
+ function V(e) {
473
473
  if (e) {
474
- var n = e._owner, l = he(e.type, e._source, n ? n.type : null);
475
- nt.setExtraStackFrame(l);
474
+ var r = e._owner, o = ue(e.type, e._source, r ? r.type : null);
475
+ nt.setExtraStackFrame(o);
476
476
  } else
477
477
  nt.setExtraStackFrame(null);
478
478
  }
479
- var Re;
480
- Re = !1;
481
- function De(e) {
479
+ var Oe;
480
+ Oe = !1;
481
+ function Re(e) {
482
482
  return typeof e == "object" && e !== null && e.$$typeof === i;
483
483
  }
484
484
  function rt() {
485
485
  {
486
- if (Oe.current) {
487
- var e = C(Oe.current.type);
486
+ if (_e.current) {
487
+ var e = F(_e.current.type);
488
488
  if (e)
489
489
  return `
490
490
 
@@ -493,285 +493,235 @@ Check the render method of \`` + e + "`.";
493
493
  return "";
494
494
  }
495
495
  }
496
- function Xt(e) {
496
+ function ta(e) {
497
497
  return "";
498
498
  }
499
499
  var st = {};
500
- function Zt(e) {
500
+ function aa(e) {
501
501
  {
502
- var n = rt();
503
- if (!n) {
504
- var l = typeof e == "string" ? e : e.displayName || e.name;
505
- l && (n = `
502
+ var r = rt();
503
+ if (!r) {
504
+ var o = typeof e == "string" ? e : e.displayName || e.name;
505
+ o && (r = `
506
506
 
507
- Check the top-level render call using <` + l + ">.");
507
+ Check the top-level render call using <` + o + ">.");
508
508
  }
509
- return n;
509
+ return r;
510
510
  }
511
511
  }
512
- function it(e, n) {
512
+ function it(e, r) {
513
513
  {
514
514
  if (!e._store || e._store.validated || e.key != null)
515
515
  return;
516
516
  e._store.validated = !0;
517
- var l = Zt(n);
518
- if (st[l])
517
+ var o = aa(r);
518
+ if (st[o])
519
519
  return;
520
- st[l] = !0;
520
+ st[o] = !0;
521
521
  var d = "";
522
- e && e._owner && e._owner !== Oe.current && (d = " It was passed a child from " + C(e._owner.type) + "."), K(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, d), K(null);
522
+ e && e._owner && e._owner !== _e.current && (d = " It was passed a child from " + F(e._owner.type) + "."), V(e), P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, d), V(null);
523
523
  }
524
524
  }
525
- function ot(e, n) {
525
+ function ot(e, r) {
526
526
  {
527
527
  if (typeof e != "object")
528
528
  return;
529
- if (Pe(e))
530
- for (var l = 0; l < e.length; l++) {
531
- var d = e[l];
532
- De(d) && it(d, n);
529
+ if (Te(e))
530
+ for (var o = 0; o < e.length; o++) {
531
+ var d = e[o];
532
+ Re(d) && it(d, r);
533
533
  }
534
- else if (De(e))
534
+ else if (Re(e))
535
535
  e._store && (e._store.validated = !0);
536
536
  else if (e) {
537
- var y = A(e);
538
- if (typeof y == "function" && y !== e.entries)
539
- for (var j = y.call(e), x; !(x = j.next()).done; )
540
- De(x.value) && it(x.value, n);
537
+ var b = C(e);
538
+ if (typeof b == "function" && b !== e.entries)
539
+ for (var j = b.call(e), p; !(p = j.next()).done; )
540
+ Re(p.value) && it(p.value, r);
541
541
  }
542
542
  }
543
543
  }
544
- function ea(e) {
544
+ function na(e) {
545
545
  {
546
- var n = e.type;
547
- if (n == null || typeof n == "string")
546
+ var r = e.type;
547
+ if (r == null || typeof r == "string")
548
548
  return;
549
- var l;
550
- if (typeof n == "function")
551
- l = n.propTypes;
552
- else if (typeof n == "object" && (n.$$typeof === u || // Note: Memo only checks outer props here.
549
+ var o;
550
+ if (typeof r == "function")
551
+ o = r.propTypes;
552
+ else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
553
553
  // Inner props are checked in the reconciler.
554
- n.$$typeof === g))
555
- l = n.propTypes;
554
+ r.$$typeof === m))
555
+ o = r.propTypes;
556
556
  else
557
557
  return;
558
- if (l) {
559
- var d = C(n);
560
- Gt(l, e.props, "prop", d, e);
561
- } else if (n.PropTypes !== void 0 && !Re) {
562
- Re = !0;
563
- var y = C(n);
564
- b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
558
+ if (o) {
559
+ var d = F(r);
560
+ $t(o, e.props, "prop", d, e);
561
+ } else if (r.PropTypes !== void 0 && !Oe) {
562
+ Oe = !0;
563
+ var b = F(r);
564
+ P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown");
565
565
  }
566
- typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
566
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
567
567
  }
568
568
  }
569
- function ta(e) {
569
+ function ra(e) {
570
570
  {
571
- for (var n = Object.keys(e.props), l = 0; l < n.length; l++) {
572
- var d = n[l];
571
+ for (var r = Object.keys(e.props), o = 0; o < r.length; o++) {
572
+ var d = r[o];
573
573
  if (d !== "children" && d !== "key") {
574
- K(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), K(null);
574
+ V(e), P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), V(null);
575
575
  break;
576
576
  }
577
577
  }
578
- e.ref !== null && (K(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), K(null));
578
+ e.ref !== null && (V(e), P("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
579
579
  }
580
580
  }
581
581
  var lt = {};
582
- function ct(e, n, l, d, y, j) {
582
+ function ct(e, r, o, d, b, j) {
583
583
  {
584
- var x = Ee(e);
585
- if (!x) {
586
- var v = "";
587
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
588
- var P = Xt();
589
- P ? v += P : v += rt();
590
- var k;
591
- e === null ? k = "null" : Pe(e) ? k = "array" : e !== void 0 && e.$$typeof === i ? (k = "<" + (C(e.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : k = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", k, v);
584
+ var p = K(e);
585
+ if (!p) {
586
+ var f = "";
587
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (f += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
588
+ var O = ta();
589
+ O ? f += O : f += rt();
590
+ var E;
591
+ e === null ? E = "null" : Te(e) ? E = "array" : e !== void 0 && e.$$typeof === i ? (E = "<" + (F(e.type) || "Unknown") + " />", f = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, f);
592
592
  }
593
- var N = Qt(e, n, l, y, j);
594
- if (N == null)
595
- return N;
596
- if (x) {
597
- var L = n.children;
593
+ var T = ea(e, r, o, b, j);
594
+ if (T == null)
595
+ return T;
596
+ if (p) {
597
+ var L = r.children;
598
598
  if (L !== void 0)
599
599
  if (d)
600
- if (Pe(L)) {
601
- for (var V = 0; V < L.length; V++)
602
- ot(L[V], e);
600
+ if (Te(L)) {
601
+ for (var z = 0; z < L.length; z++)
602
+ ot(L[z], e);
603
603
  Object.freeze && Object.freeze(L);
604
604
  } else
605
- b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
605
+ P("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
606
606
  else
607
607
  ot(L, e);
608
608
  }
609
- if (X.call(n, "key")) {
610
- var $ = C(e), O = Object.keys(n).filter(function(oa) {
611
- return oa !== "key";
612
- }), Ae = O.length > 0 ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}";
613
- if (!lt[$ + Ae]) {
614
- var ia = O.length > 0 ? "{" + O.join(": ..., ") + ": ...}" : "{}";
615
- b(`A props object containing a "key" prop is being spread into JSX:
609
+ if (Q.call(r, "key")) {
610
+ var $ = F(e), D = Object.keys(r).filter(function(ua) {
611
+ return ua !== "key";
612
+ }), De = D.length > 0 ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}";
613
+ if (!lt[$ + De]) {
614
+ var ca = D.length > 0 ? "{" + D.join(": ..., ") + ": ...}" : "{}";
615
+ P(`A props object containing a "key" prop is being spread into JSX:
616
616
  let props = %s;
617
617
  <%s {...props} />
618
618
  React keys must be passed directly to JSX without using spread:
619
619
  let props = %s;
620
- <%s key={someKey} {...props} />`, Ae, $, ia, $), lt[$ + Ae] = !0;
620
+ <%s key={someKey} {...props} />`, De, $, ca, $), lt[$ + De] = !0;
621
621
  }
622
622
  }
623
- return e === a ? ta(N) : ea(N), N;
623
+ return e === a ? ra(T) : na(T), T;
624
624
  }
625
625
  }
626
- function aa(e, n, l) {
627
- return ct(e, n, l, !0);
626
+ function sa(e, r, o) {
627
+ return ct(e, r, o, !0);
628
628
  }
629
- function na(e, n, l) {
630
- return ct(e, n, l, !1);
629
+ function ia(e, r, o) {
630
+ return ct(e, r, o, !1);
631
631
  }
632
- var ra = na, sa = aa;
633
- te.Fragment = a, te.jsx = ra, te.jsxs = sa;
634
- }()), te;
635
- }
636
- process.env.NODE_ENV === "production" ? Ie.exports = Ra() : Ie.exports = Da();
637
- var t = Ie.exports;
638
- const Aa = (r, i) => {
639
- const a = z().getQueryData(["builder_props"]);
640
- return G(a, r, i);
641
- }, D = () => Aa("apiUrl", "/chai/api");
642
- function Y() {
643
- const [r, i] = I(
644
- new URLSearchParams(window.location.search)
645
- );
646
- return Be(() => {
647
- const o = () => {
648
- i(new URLSearchParams(window.location.search));
649
- };
650
- return window.addEventListener("popstate", o), () => {
651
- window.removeEventListener("popstate", o);
652
- };
653
- }, []), [r, i];
632
+ var oa = ia, la = sa;
633
+ ee.Fragment = a, ee.jsx = oa, ee.jsxs = la;
634
+ }()), ee;
654
635
  }
655
- const Tt = () => {
656
- const [r] = Y(), i = r.get("page"), o = D();
657
- return ne({
658
- queryKey: ["page", i],
659
- initialData: [],
660
- queryFn: async () => (await (await fetch(`${o}`, {
661
- method: "POST",
662
- headers: { "Content-Type": "application/json" },
663
- body: JSON.stringify({
664
- action: "GET_PAGE",
665
- data: { id: i, draft: !0 }
666
- })
667
- })).json()).blocks ?? [],
668
- enabled: !!i
636
+ process.env.NODE_ENV === "production" ? Ae.exports = Da() : Ae.exports = Fa();
637
+ var t = Ae.exports;
638
+ const Aa = (n, i) => {
639
+ const a = te().getQueryData(["builder_props"]);
640
+ return q(a, n, i);
641
+ }, U = () => Aa("apiUrl", "/chai/api"), Ge = () => {
642
+ const n = te(), { data: i } = Y({
643
+ queryKey: ["ai-context"],
644
+ initialData: "",
645
+ queryFn: () => ""
669
646
  });
670
- }, Pt = () => {
671
- const r = D(), i = z(), { toast: o } = J(), { data: a } = Tt(), [s] = Y(), w = s.get("page"), c = G(
672
- se(a, { _type: "@chai/ai-context" }),
673
- "_value",
674
- ""
675
- ), { mutateAsync: p } = re({
676
- mutationFn: async ({ page: u, aiContext: m }) => {
677
- const h = {
678
- _type: "@chai/ai-context",
679
- _value: Fe(m) ? m : ""
680
- }, g = ae(
681
- a,
682
- (S) => (S == null ? void 0 : S._type) !== h._type
683
- );
684
- return g.push(h), await fetch(r, {
685
- method: "POST",
686
- headers: { "Content-Type": "application/json" },
687
- body: JSON.stringify({
688
- action: "UPDATE_PAGE",
689
- data: { id: u, blocks: g }
690
- })
691
- });
692
- },
693
- onSuccess: (u, { aiContext: m }) => {
694
- i.setQueryData(["page", w], () => {
695
- const h = {
696
- _type: "@chai/ai-context",
697
- _value: Fe(m) ? m : ""
698
- }, g = ae(
699
- a,
700
- (f) => (f == null ? void 0 : f._type) !== h._type
701
- );
702
- return g.push(h), g;
703
- }), o({ title: "AI context updated successfully." });
704
- },
705
- onError: (u) => {
706
- o({
707
- variant: "destructive",
708
- title: "Failed to update AI context",
709
- description: u.message
710
- });
711
- }
712
- });
713
- return { aiContext: c, updateAiContext: p };
714
- }, Fa = () => {
715
- const r = D(), { aiContext: i } = Pt();
716
- return la(
717
- async (o, a, s, w) => {
718
- const p = await (await fetch(r, {
647
+ return { setAiContext: xt((a) => {
648
+ n.setQueryData(["ai-context"], a);
649
+ }, []), aiContext: i };
650
+ }, La = () => {
651
+ const n = U(), { aiContext: i } = Ge();
652
+ return xt(
653
+ async (l, a, s, x) => {
654
+ const g = await (await fetch(n, {
719
655
  method: "POST",
720
656
  headers: {
721
657
  "Content-Type": "application/json"
722
658
  },
723
659
  body: JSON.stringify({
724
660
  action: "ASK_AI",
725
- data: { type: o, prompt: a, blocks: s, aiContext: i, lang: w }
661
+ data: { type: l, prompt: a, blocks: s, aiContext: i, lang: x }
726
662
  })
727
663
  })).json();
728
- return console.log("data", p), p.error ? { error: new Error(p.error) } : p;
664
+ return console.log("data", g), g.error ? { error: new Error(g.error) } : g;
729
665
  },
730
- [r, i]
666
+ [n, i]
731
667
  );
732
- }, La = () => {
733
- const r = D(), { toast: i } = J(), o = z();
734
- return { getUILibraryBlock: async (c, p) => {
735
- const h = (await (await fetch(
736
- c.url + (p.path ? "/blocks/" + p.path : "/" + p.uuid + ".html")
668
+ }, Ia = () => {
669
+ const n = U(), { toast: i } = ae();
670
+ return { getUILibraryBlock: async (x, c) => {
671
+ const v = (await (await fetch(
672
+ x.url + (c.path ? "/blocks/" + c.path : "/" + c.uuid + ".html")
737
673
  )).text()).replace(/---([\s\S]*?)---/g, "");
738
- return da(`${h}`);
739
- }, getUILibraryBlocks: async (c) => {
674
+ return ha(`${v}`);
675
+ }, getUILibraryBlocks: async (x) => {
740
676
  try {
741
- return (await (await fetch(c.url + "/blocks.json")).json()).map((m) => ({
742
- ...m,
743
- preview: c.url.replace("chaiblocks", "") + m.preview
677
+ return (await (await fetch(x.url + "/blocks.json")).json()).map((h) => ({
678
+ ...h,
679
+ preview: x.url.replace("chaiblocks", "") + h.preview
744
680
  }));
745
- } catch (p) {
746
- return console.error(p), [];
681
+ } catch (c) {
682
+ return console.error(c), [];
747
683
  }
748
684
  }, onSave: async ({
749
- page: c,
750
- blocks: p
685
+ page: x,
686
+ blocks: c
751
687
  }) => {
752
688
  try {
753
- return (await fetch(r, {
689
+ return (await fetch(n, {
754
690
  method: "POST",
755
691
  headers: { "Content-Type": "application/json" },
756
692
  body: JSON.stringify({
757
693
  action: "UPDATE_PAGE",
758
- data: { id: c, blocks: p }
694
+ data: { id: x, blocks: c }
759
695
  })
760
- })).ok ? (o.setQueryData(["page", c], p), i({
696
+ })).ok ? (i({
761
697
  title: "Success",
762
698
  description: "Page saved successfully",
763
699
  variant: "default"
764
700
  }), !0) : new Error("Failed to save blocks");
765
- } catch (u) {
766
- return u;
701
+ } catch (g) {
702
+ return g;
767
703
  }
768
704
  } };
769
- }, qe = () => {
770
- const r = D();
771
- return ne({
705
+ };
706
+ function re() {
707
+ const [n, i] = I(
708
+ new URLSearchParams(window.location.search)
709
+ );
710
+ return Le(() => {
711
+ const l = () => {
712
+ i(new URLSearchParams(window.location.search));
713
+ };
714
+ return window.addEventListener("popstate", l), () => {
715
+ window.removeEventListener("popstate", l);
716
+ };
717
+ }, []), [n, i];
718
+ }
719
+ const qe = () => {
720
+ const n = U();
721
+ return Y({
772
722
  queryKey: ["project-pages"],
773
723
  staleTime: 1e3 * 60 * 5,
774
- queryFn: async () => await (await fetch(r, {
724
+ queryFn: async () => await (await fetch(n, {
775
725
  method: "POST",
776
726
  headers: {
777
727
  "Content-Type": "application/json"
@@ -781,13 +731,13 @@ const Tt = () => {
781
731
  })
782
732
  })).json()
783
733
  });
784
- }, _t = () => {
785
- const [r] = Y(), i = r.get("page"), { data: o, isFetching: a } = qe();
786
- return { data: ye(
787
- () => se(o, { id: i }) || {},
788
- [o, i]
734
+ }, Rt = () => {
735
+ const [n] = re(), i = n.get("page"), { data: l, isFetching: a } = qe();
736
+ return { data: ve(
737
+ () => ne(l, { id: i }) || {},
738
+ [l, i]
789
739
  ), isFetching: a };
790
- }, Ia = () => ne({
740
+ }, Ba = () => Y({
791
741
  queryKey: ["uiLibraries"],
792
742
  initialData: [],
793
743
  queryFn: async () => [
@@ -802,23 +752,41 @@ const Tt = () => {
802
752
  url: "https://chaibuilder.com/chaiblocks"
803
753
  }
804
754
  ]
805
- }), Ba = (r) => ye(() => {
806
- if (!r || W(r))
755
+ }), Ua = () => {
756
+ const [n] = re(), i = n.get("page"), l = U(), { setAiContext: a } = Ge();
757
+ return Y({
758
+ queryKey: ["page", i],
759
+ initialData: [],
760
+ queryFn: async () => {
761
+ const c = (await (await fetch(`${l}`, {
762
+ method: "POST",
763
+ headers: { "Content-Type": "application/json" },
764
+ body: JSON.stringify({
765
+ action: "GET_PAGE",
766
+ data: { id: i, draft: !0 }
767
+ })
768
+ })).json()).blocks ?? [], g = ne(c, { _type: "@chai/ai-context" });
769
+ return a(q(g, "_value", "") || ""), c;
770
+ },
771
+ enabled: !!i
772
+ });
773
+ }, Ga = (n) => ve(() => {
774
+ if (!n || M(n))
807
775
  return {
808
776
  blocks: [],
809
777
  theme: {}
810
778
  };
811
- const i = se(r, { _type: "@chai/theme" }), o = G(i, "_value", {}) || {}, a = ae(
812
- r,
813
- (s) => !xe(s == null ? void 0 : s._type, "@chai/")
779
+ const i = ne(n, { _type: "@chai/theme" }), l = q(i, "_value", {}) || {}, a = Be(
780
+ n,
781
+ (s) => !pe(s == null ? void 0 : s._type, "@chai/")
814
782
  );
815
- return { theme: o, blocks: a };
816
- }, [r]), Ot = () => {
817
- const r = D();
818
- return ne({
783
+ return { theme: l, blocks: a };
784
+ }, [n]), Dt = () => {
785
+ const n = U();
786
+ return Y({
819
787
  queryKey: ["project-config"],
820
788
  initialData: { theme: {} },
821
- queryFn: async () => await (await fetch(r, {
789
+ queryFn: async () => await (await fetch(n, {
822
790
  method: "POST",
823
791
  headers: {
824
792
  "Content-Type": "application/json"
@@ -826,45 +794,45 @@ const Tt = () => {
826
794
  body: JSON.stringify({ action: "GET_PROJECT_CONFIG" })
827
795
  })).json()
828
796
  });
829
- }, Ua = () => {
830
- const { data: r } = qe(), i = D();
797
+ }, qa = () => {
798
+ const { data: n } = qe(), i = U();
831
799
  return {
832
800
  getGlobalBlocks: async () => {
833
- const o = {};
834
- for (const a of r ?? [])
835
- W(a == null ? void 0 : a.slug) && (o[a.id] = {
836
- name: ka(a.name ?? a.slug),
801
+ const l = {};
802
+ for (const a of n ?? [])
803
+ M(a == null ? void 0 : a.slug) && (l[a.id] = {
804
+ name: Na(a.name ?? a.slug),
837
805
  description: ""
838
806
  });
839
- return o;
807
+ return l;
840
808
  },
841
- getGlobalBlockBlocks: async (o) => o ? (await (await fetch(`${i}`, {
809
+ getGlobalBlockBlocks: async (l) => l ? (await (await fetch(`${i}`, {
842
810
  method: "POST",
843
811
  headers: { "Content-Type": "application/json" },
844
812
  body: JSON.stringify({
845
813
  action: "GET_PAGE",
846
- data: { id: o, draft: !0 }
814
+ data: { id: l, draft: !0 }
847
815
  })
848
816
  })).json()).blocks : []
849
817
  };
850
- }, Ga = () => {
851
- const r = D();
852
- return { uploadFile: async (o) => {
818
+ }, Ma = () => {
819
+ const n = U();
820
+ return { uploadFile: async (l) => {
853
821
  const a = new FormData();
854
- return a.append("action", "UPLOAD_FILE"), a.append("file", o), (await fetch(r, {
822
+ return a.append("action", "UPLOAD_FILE"), a.append("file", l), (await fetch(n, {
855
823
  method: "POST",
856
824
  body: a
857
825
  })).json();
858
826
  } };
859
- }, qa = () => {
860
- const r = D(), { toast: i } = J();
861
- return re({
862
- mutationFn: async (o) => (await fetch(`${r}`, {
827
+ }, $a = () => {
828
+ const n = U(), { toast: i } = ae();
829
+ return be({
830
+ mutationFn: async (l) => (await fetch(`${n}`, {
863
831
  method: "POST",
864
832
  headers: { "Content-Type": "application/json" },
865
833
  body: JSON.stringify({
866
834
  action: "PUBLISH_PAGE",
867
- data: { id: o }
835
+ data: { id: l }
868
836
  })
869
837
  })).json(),
870
838
  onSuccess: () => {
@@ -875,24 +843,24 @@ const Tt = () => {
875
843
  }
876
844
  });
877
845
  }, Me = () => {
878
- const r = D(), [i] = Y(), o = i.get("page");
879
- return ne({
880
- queryKey: ["language-pages", o],
846
+ const n = U(), [i] = re(), l = i.get("page");
847
+ return Y({
848
+ queryKey: ["language-pages", l],
881
849
  initialData: [],
882
850
  queryFn: async () => {
883
- if (!o) return null;
884
- const s = await (await fetch(r, {
851
+ if (!l) return null;
852
+ const s = await (await fetch(n, {
885
853
  method: "POST",
886
854
  headers: { "Content-Type": "application/json" },
887
855
  body: JSON.stringify({
888
856
  action: "GET_LANGUAGE_PAGES",
889
- data: { id: o }
857
+ data: { id: l }
890
858
  })
891
859
  })).json();
892
- return Na(Ta(s, "primaryPage"));
860
+ return Ta(Pa(s, "primaryPage"));
893
861
  }
894
862
  });
895
- }, be = {
863
+ }, xe = {
896
864
  ab: "Abkhazian",
897
865
  aa: "Afar",
898
866
  af: "Afrikaans",
@@ -1080,10 +1048,10 @@ const Tt = () => {
1080
1048
  yo: "Yoruba",
1081
1049
  za: "Zhuang, Chuang",
1082
1050
  zu: "Zulu"
1083
- }, Rt = () => {
1084
- const r = D(), i = z(), { toast: o } = J();
1085
- return re({
1086
- mutationFn: async (a) => await (await fetch(r, {
1051
+ }, Ft = () => {
1052
+ const n = U(), i = te(), { toast: l } = ae();
1053
+ return be({
1054
+ mutationFn: async (a) => await (await fetch(n, {
1087
1055
  method: "POST",
1088
1056
  headers: {
1089
1057
  "Content-Type": "application/json"
@@ -1096,12 +1064,12 @@ const Tt = () => {
1096
1064
  onSuccess: (a, s) => {
1097
1065
  s && (s != null && s.primaryPage) ? i.invalidateQueries({
1098
1066
  queryKey: ["language-pages", s == null ? void 0 : s.primaryPage]
1099
- }) : i.invalidateQueries({ queryKey: ["project-pages"] }), o({
1067
+ }) : i.invalidateQueries({ queryKey: ["project-pages"] }), l({
1100
1068
  title: `New ${s.global ? "global block" : "page"} added successfully.`
1101
1069
  });
1102
1070
  },
1103
1071
  onError: (a, s) => {
1104
- o({
1072
+ l({
1105
1073
  variant: "destructive",
1106
1074
  title: `Failed to add new ${s.global ? "global block" : "page"}.`,
1107
1075
  description: a.message
@@ -1109,9 +1077,9 @@ const Tt = () => {
1109
1077
  }
1110
1078
  });
1111
1079
  }, $e = () => {
1112
- const r = D(), i = z(), { toast: o } = J();
1113
- return re({
1114
- mutationFn: async (a) => (await fetch(r, {
1080
+ const n = U(), i = te(), { toast: l } = ae();
1081
+ return be({
1082
+ mutationFn: async (a) => (await fetch(n, {
1115
1083
  method: "POST",
1116
1084
  headers: {
1117
1085
  "Content-Type": "application/json"
@@ -1124,24 +1092,24 @@ const Tt = () => {
1124
1092
  onSuccess: (a, s) => {
1125
1093
  s && (s != null && s.primaryPage || s != null && s.seo) ? i.invalidateQueries({
1126
1094
  queryKey: ["language-pages", s == null ? void 0 : s.primaryPage]
1127
- }) : i.invalidateQueries({ queryKey: ["project-pages"] }), s != null && s.seo ? o({
1095
+ }) : i.invalidateQueries({ queryKey: ["project-pages"] }), s != null && s.seo ? l({
1128
1096
  title: "SEO Settings updated successfully."
1129
- }) : o({
1097
+ }) : l({
1130
1098
  title: `${s.global ? "Global block" : "Page"} updated successfully.`
1131
1099
  });
1132
1100
  },
1133
1101
  onError: (a, s) => {
1134
- o({
1102
+ l({
1135
1103
  variant: "destructive",
1136
1104
  title: `Failed to update ${s.global ? "global block" : "page"}.`,
1137
1105
  description: a.message
1138
1106
  });
1139
1107
  }
1140
1108
  });
1141
- }, Dt = () => {
1142
- const r = D(), i = z(), { toast: o } = J();
1143
- return re({
1144
- mutationFn: async (a) => (await fetch(r, {
1109
+ }, At = () => {
1110
+ const n = U(), i = te(), { toast: l } = ae();
1111
+ return be({
1112
+ mutationFn: async (a) => (await fetch(n, {
1145
1113
  method: "POST",
1146
1114
  headers: {
1147
1115
  "Content-Type": "application/json"
@@ -1154,25 +1122,25 @@ const Tt = () => {
1154
1122
  onSuccess: (a, s) => {
1155
1123
  s && (s != null && s.primaryPage) ? i.invalidateQueries({
1156
1124
  queryKey: ["language-pages", s == null ? void 0 : s.primaryPage]
1157
- }) : i.invalidateQueries({ queryKey: ["project-pages"] }), o({
1125
+ }) : i.invalidateQueries({ queryKey: ["project-pages"] }), l({
1158
1126
  title: `${s.global ? "Global block" : "Page"} deleted successfully.`
1159
1127
  });
1160
1128
  },
1161
1129
  onError: (a, s) => {
1162
- o({
1130
+ l({
1163
1131
  variant: "destructive",
1164
1132
  title: `Failed to delete ${s.global ? "global block" : "page"}.`,
1165
1133
  description: a.message
1166
1134
  });
1167
1135
  }
1168
1136
  });
1169
- }, Ma = () => {
1170
- const { selectedLang: r } = Ue(), { data: i, isFetching: o } = Me();
1171
- return { data: ye(() => se(i, { lang: r || "" }) || {}, [i, r]), isFetching: o };
1172
- }, At = () => {
1173
- const { data: r, isFetching: i } = Ma(), o = r == null ? void 0 : r.seo, [a, s] = I({
1174
- seoTitle: "",
1175
- seoDescription: "",
1137
+ }, Lt = () => {
1138
+ const { selectedLang: n } = Ie(), { data: i, isFetching: l } = Me();
1139
+ return { data: ve(() => ne(i, { lang: n || "" }) || {}, [i, n]), isFetching: l };
1140
+ }, It = () => {
1141
+ const { data: n, isFetching: i } = Lt(), l = n == null ? void 0 : n.seo, [a, s] = I({
1142
+ title: "",
1143
+ description: "",
1176
1144
  cononicalUrl: "",
1177
1145
  noIndex: !1,
1178
1146
  noFollow: "",
@@ -1182,12 +1150,12 @@ const Tt = () => {
1182
1150
  searchTitle: "",
1183
1151
  searchDescription: "",
1184
1152
  jsonLD: "",
1185
- ...o
1186
- }), w = ca({ initial: a, updated: a }), { selectedLang: c, fallbackLang: p } = Ue(), u = c.length ? c : p, { mutate: m, isPending: h } = $e(), g = h;
1187
- Be(() => {
1188
- !i && o && s({
1189
- seoTitle: "",
1190
- seoDescription: "",
1153
+ ...l
1154
+ }), x = vt({ initial: a, updated: a }), { selectedLang: c, fallbackLang: g } = Ie(), h = c.length ? c : g, { mutate: v, isPending: y } = $e(), m = y;
1155
+ Le(() => {
1156
+ !i && l && s({
1157
+ title: "",
1158
+ description: "",
1191
1159
  cononicalUrl: "",
1192
1160
  noIndex: !1,
1193
1161
  noFollow: "",
@@ -1197,82 +1165,88 @@ const Tt = () => {
1197
1165
  searchTitle: "",
1198
1166
  searchDescription: "",
1199
1167
  jsonLD: "",
1200
- ...o
1168
+ ...l
1201
1169
  });
1202
- }, [i, o]);
1203
- const f = async () => {
1204
- m({ id: r == null ? void 0 : r.id, seo: a }), w.current.initial = a, w.current.updated = a;
1205
- }, S = () => {
1170
+ }, [i, l]);
1171
+ const u = async () => {
1172
+ v({ id: n == null ? void 0 : n.id, seo: a }), x.current.initial = a, x.current.updated = a;
1173
+ }, w = () => {
1206
1174
  s({
1207
1175
  ...a,
1208
- ogTitle: a.seoTitle,
1209
- ogDescription: a.seoDescription
1176
+ ogTitle: a.title,
1177
+ ogDescription: a.description
1210
1178
  });
1211
- }, T = () => {
1179
+ }, _ = () => {
1212
1180
  s({
1213
1181
  ...a,
1214
1182
  searchTitle: a.ogTitle,
1215
1183
  searchDescription: a.ogDescription
1216
1184
  });
1217
- }, E = (A) => {
1218
- const R = {
1185
+ }, S = (C) => {
1186
+ const N = {
1219
1187
  ...a,
1220
- [A.target.name]: A.target.name === "noIndex" ? A.target.checked : A.target.value
1188
+ [C.target.name]: C.target.name === "noIndex" || C.target.name === "noFollow" ? C.target.checked : C.target.value
1221
1189
  };
1222
- s(R), w.current.updated = R;
1190
+ s(N), x.current.updated = N;
1223
1191
  };
1224
1192
  return /* @__PURE__ */ t.jsxs("div", { className: "relative pb-40", children: [
1225
1193
  /* @__PURE__ */ t.jsxs("div", { className: "text-xs bg-gray-100 p-2 rounded-md text-center", children: [
1226
1194
  "Current language:",
1227
1195
  " ",
1228
- /* @__PURE__ */ t.jsx("span", { className: "text-blue-500 font-semibold", children: G(be, u, u) })
1196
+ /* @__PURE__ */ t.jsx("span", { className: "text-blue-500 font-semibold", children: q(xe, h, h) }),
1197
+ /* @__PURE__ */ t.jsxs("span", { className: "text-[11px] text-gray-500", children: [
1198
+ " ",
1199
+ "( ",
1200
+ n == null ? void 0 : n.slug,
1201
+ " )"
1202
+ ] })
1229
1203
  ] }),
1230
- /* @__PURE__ */ t.jsx("form", { className: "space-y-8", children: /* @__PURE__ */ t.jsxs(ga, { type: "multiple", defaultValue: ["page"], children: [
1231
- /* @__PURE__ */ t.jsxs(pe, { value: "page", children: [
1232
- /* @__PURE__ */ t.jsx(ge, { className: "text-blue-500", children: "Seo Page" }),
1233
- /* @__PURE__ */ t.jsx(me, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
1204
+ /* @__PURE__ */ t.jsx("form", { className: "space-y-8", children: /* @__PURE__ */ t.jsxs(pa, { type: "multiple", defaultValue: ["page"], children: [
1205
+ /* @__PURE__ */ t.jsxs(he, { value: "page", children: [
1206
+ /* @__PURE__ */ t.jsx(fe, { className: "text-blue-500", children: "Seo Page" }),
1207
+ /* @__PURE__ */ t.jsx(ge, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
1234
1208
  /* @__PURE__ */ t.jsxs("div", { children: [
1235
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoTitle", children: "SEO Title" }),
1209
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "title", children: "SEO Title" }),
1236
1210
  /* @__PURE__ */ t.jsx(
1237
- U,
1211
+ G,
1238
1212
  {
1239
1213
  type: "text",
1240
- id: "seoTitle",
1241
- name: "seoTitle",
1242
- value: a.seoTitle,
1243
- onChange: E,
1244
- disabled: g,
1214
+ id: "title",
1215
+ name: "title",
1216
+ value: a.title,
1217
+ onChange: S,
1218
+ disabled: m,
1245
1219
  placeholder: "Enter SEO title"
1246
1220
  }
1247
1221
  ),
1248
1222
  /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The title should be between 10 and 60 characters." })
1249
1223
  ] }),
1250
1224
  /* @__PURE__ */ t.jsxs("div", { children: [
1251
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoDescription", children: "SEO Description" }),
1225
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "description", children: "SEO Description" }),
1252
1226
  /* @__PURE__ */ t.jsx(
1253
- ve,
1227
+ me,
1254
1228
  {
1255
- id: "seoDescription",
1256
- name: "seoDescription",
1257
- value: a.seoDescription,
1258
- onChange: E,
1259
- disabled: g,
1229
+ id: "description",
1230
+ name: "description",
1231
+ value: a.description,
1232
+ onChange: S,
1233
+ disabled: m,
1260
1234
  placeholder: "Enter SEO description"
1261
1235
  }
1262
1236
  ),
1263
1237
  /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The description should be between 50 and 160 characters." })
1264
1238
  ] }),
1265
1239
  /* @__PURE__ */ t.jsxs("div", { children: [
1266
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoTitle", children: "Canonical URL" }),
1240
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "title", children: "Canonical URL" }),
1267
1241
  /* @__PURE__ */ t.jsx(
1268
- U,
1242
+ G,
1269
1243
  {
1270
1244
  type: "text",
1271
1245
  id: "canonicalUrl",
1272
1246
  name: "canonicalUrl",
1273
1247
  value: a.canonicalUrl,
1274
- onChange: E,
1275
- disabled: g,
1248
+ onChange: S,
1249
+ disabled: m,
1276
1250
  placeholder: "Enter Canonical URL"
1277
1251
  }
1278
1252
  )
@@ -1280,93 +1254,96 @@ const Tt = () => {
1280
1254
  /* @__PURE__ */ t.jsxs("div", { className: "", children: [
1281
1255
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-2", children: [
1282
1256
  /* @__PURE__ */ t.jsx(
1283
- U,
1257
+ G,
1284
1258
  {
1285
1259
  type: "checkbox",
1286
1260
  id: "noIndex",
1287
1261
  name: "noIndex",
1288
1262
  checked: a.noIndex,
1289
- onChange: E,
1290
- disabled: g,
1263
+ onChange: S,
1264
+ disabled: m,
1291
1265
  className: "h-4 w-4"
1292
1266
  }
1293
1267
  ),
1294
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "noIndex", children: "No Index" })
1268
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "noIndex", children: "No Index" })
1295
1269
  ] }),
1296
1270
  /* @__PURE__ */ t.jsx("p", { className: "mt-2 text-[10px] font-light text-gray-400", children: "Check this if you don't want search engines to index this page." })
1297
1271
  ] }),
1298
- /* @__PURE__ */ t.jsxs("div", { children: [
1299
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoTitle", children: "No Follow" }),
1300
- /* @__PURE__ */ t.jsx(
1301
- U,
1302
- {
1303
- type: "text",
1304
- id: "noFollow",
1305
- name: "noFollow",
1306
- value: a.noFollow,
1307
- onChange: E,
1308
- disabled: g,
1309
- placeholder: "Enter No follow"
1310
- }
1311
- )
1272
+ /* @__PURE__ */ t.jsxs("div", { className: "", children: [
1273
+ /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-2", children: [
1274
+ /* @__PURE__ */ t.jsx(
1275
+ G,
1276
+ {
1277
+ type: "checkbox",
1278
+ id: "noFollow",
1279
+ name: "noFollow",
1280
+ checked: a.noFollow,
1281
+ onChange: S,
1282
+ disabled: m,
1283
+ className: "h-4 w-4"
1284
+ }
1285
+ ),
1286
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "noIndex", children: "No Follow" })
1287
+ ] }),
1288
+ /* @__PURE__ */ t.jsx("p", { className: "mt-2 text-[10px] font-light text-gray-400", children: "Check this if you don't want search engines to follow links on this page." })
1312
1289
  ] })
1313
1290
  ] }) })
1314
1291
  ] }),
1315
- /* @__PURE__ */ t.jsxs(pe, { value: "og", children: [
1316
- /* @__PURE__ */ t.jsx(ge, { className: "text-blue-500", children: "OG" }),
1317
- /* @__PURE__ */ t.jsx(me, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
1292
+ /* @__PURE__ */ t.jsxs(he, { value: "og", children: [
1293
+ /* @__PURE__ */ t.jsx(fe, { className: "text-blue-500", children: "OG" }),
1294
+ /* @__PURE__ */ t.jsx(ge, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
1318
1295
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ t.jsx(
1319
1296
  B,
1320
1297
  {
1321
1298
  type: "button",
1322
1299
  variant: "outline",
1323
1300
  size: "sm",
1324
- onClick: S,
1301
+ onClick: w,
1325
1302
  children: "Copy from SEO Settings"
1326
1303
  }
1327
1304
  ) }),
1328
1305
  /* @__PURE__ */ t.jsxs("div", { children: [
1329
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "ogTitle", children: "OG Title" }),
1306
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "ogTitle", children: "OG Title" }),
1330
1307
  /* @__PURE__ */ t.jsx(
1331
- U,
1308
+ G,
1332
1309
  {
1333
1310
  type: "text",
1334
1311
  id: "ogTitle",
1335
1312
  name: "ogTitle",
1336
1313
  value: a.ogTitle,
1337
- onChange: E,
1338
- disabled: g,
1314
+ onChange: S,
1315
+ disabled: m,
1339
1316
  placeholder: "Enter OG title"
1340
1317
  }
1341
1318
  ),
1342
1319
  /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The OG title should be between 10 and 60 characters." })
1343
1320
  ] }),
1344
1321
  /* @__PURE__ */ t.jsxs("div", { className: "mt-4", children: [
1345
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "ogDescription", children: "OG Description" }),
1322
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "ogDescription", children: "OG Description" }),
1346
1323
  /* @__PURE__ */ t.jsx(
1347
- ve,
1324
+ me,
1348
1325
  {
1349
1326
  id: "ogDescription",
1350
1327
  name: "ogDescription",
1351
1328
  value: a.ogDescription,
1352
- onChange: E,
1353
- disabled: g,
1329
+ onChange: S,
1330
+ disabled: m,
1354
1331
  placeholder: "Enter OG description"
1355
1332
  }
1356
1333
  ),
1357
1334
  /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The OG description should be between 50 and 160 characters." })
1358
1335
  ] }),
1359
1336
  /* @__PURE__ */ t.jsxs("div", { className: "mt-4", children: [
1360
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "ogImage", children: "OG Image URL" }),
1337
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "ogImage", children: "OG Image URL" }),
1361
1338
  /* @__PURE__ */ t.jsx(
1362
- U,
1339
+ G,
1363
1340
  {
1364
1341
  type: "text",
1365
1342
  id: "ogImage",
1366
1343
  name: "ogImage",
1367
1344
  value: a.ogImage,
1368
- onChange: E,
1369
- disabled: g,
1345
+ onChange: S,
1346
+ disabled: m,
1370
1347
  placeholder: "Enter OG image URL"
1371
1348
  }
1372
1349
  ),
@@ -1374,44 +1351,44 @@ const Tt = () => {
1374
1351
  ] })
1375
1352
  ] }) })
1376
1353
  ] }),
1377
- /* @__PURE__ */ t.jsxs(pe, { value: "search", children: [
1378
- /* @__PURE__ */ t.jsx(ge, { className: "text-blue-500", children: "Search" }),
1379
- /* @__PURE__ */ t.jsx(me, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
1354
+ /* @__PURE__ */ t.jsxs(he, { value: "search", children: [
1355
+ /* @__PURE__ */ t.jsx(fe, { className: "text-blue-500", children: "Search" }),
1356
+ /* @__PURE__ */ t.jsx(ge, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
1380
1357
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ t.jsx(
1381
1358
  B,
1382
1359
  {
1383
1360
  type: "button",
1384
1361
  variant: "outline",
1385
1362
  size: "sm",
1386
- onClick: T,
1363
+ onClick: _,
1387
1364
  children: "Copy from OG Settings"
1388
1365
  }
1389
1366
  ) }),
1390
1367
  /* @__PURE__ */ t.jsxs("div", { children: [
1391
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "searchTitle", children: "Search Title" }),
1368
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "searchTitle", children: "Search Title" }),
1392
1369
  /* @__PURE__ */ t.jsx(
1393
- U,
1370
+ G,
1394
1371
  {
1395
1372
  type: "text",
1396
1373
  id: "searchTitle",
1397
1374
  name: "searchTitle",
1398
1375
  value: a.searchTitle,
1399
- onChange: E,
1400
- disabled: g,
1376
+ onChange: S,
1377
+ disabled: m,
1401
1378
  placeholder: "Enter search title"
1402
1379
  }
1403
1380
  ),
1404
1381
  /* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The search title should be between 10 and 60 characters." })
1405
1382
  ] }),
1406
1383
  /* @__PURE__ */ t.jsxs("div", { children: [
1407
- /* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "searchDescription", children: "Search Description" }),
1384
+ /* @__PURE__ */ t.jsx(R, { className: "text-xs pb-1", htmlFor: "searchDescription", children: "Search Description" }),
1408
1385
  /* @__PURE__ */ t.jsx(
1409
- ve,
1386
+ me,
1410
1387
  {
1411
1388
  id: "searchDescription",
1412
1389
  name: "searchDescription",
1413
1390
  value: a.searchDescription,
1414
- onChange: E,
1391
+ onChange: S,
1415
1392
  placeholder: "Enter search description"
1416
1393
  }
1417
1394
  ),
@@ -1419,16 +1396,16 @@ const Tt = () => {
1419
1396
  ] })
1420
1397
  ] }) })
1421
1398
  ] }),
1422
- /* @__PURE__ */ t.jsxs(pe, { value: "jsonLD", children: [
1423
- /* @__PURE__ */ t.jsx(ge, { className: "text-blue-500", children: "JSON-LD" }),
1424
- /* @__PURE__ */ t.jsx(me, { children: /* @__PURE__ */ t.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
1425
- ve,
1399
+ /* @__PURE__ */ t.jsxs(he, { value: "jsonLD", children: [
1400
+ /* @__PURE__ */ t.jsx(fe, { className: "text-blue-500", children: "JSON-LD" }),
1401
+ /* @__PURE__ */ t.jsx(ge, { children: /* @__PURE__ */ t.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
1402
+ me,
1426
1403
  {
1427
1404
  id: "jsonLD",
1428
1405
  name: "jsonLD",
1429
1406
  rows: 3,
1430
1407
  value: a.jsonLD,
1431
- onChange: E,
1408
+ onChange: S,
1432
1409
  placeholder: "Enter JSON-LD"
1433
1410
  }
1434
1411
  ) }) }) })
@@ -1439,73 +1416,73 @@ const Tt = () => {
1439
1416
  {
1440
1417
  size: "lg",
1441
1418
  variant: "default",
1442
- onClick: f,
1443
- disabled: Le(w.current.initial, a) || g,
1444
- children: h ? "Saving..." : "Save"
1419
+ onClick: u,
1420
+ disabled: Fe(x.current.initial, a) || m,
1421
+ children: y ? "Saving..." : "Save"
1445
1422
  }
1446
1423
  ) })
1447
1424
  ] });
1448
1425
  };
1449
- At.displayName = "SeoPanel";
1450
- const $a = ({
1451
- langProps: r,
1426
+ It.displayName = "SeoPanel";
1427
+ const Ka = ({
1428
+ langProps: n,
1452
1429
  onClose: i,
1453
- languagePages: o
1430
+ languages: l
1454
1431
  }) => {
1455
- const { data: a } = _t(), [s, w] = I(r.edit ? r.name : ""), [c, p] = I(r.edit ? r.lang : ""), [u, m] = I(r.edit ? r.slug : ""), { mutate: h, isPending: g } = Rt(), { mutate: f, isPending: S } = $e(), T = g || S, { data: E } = Ot(), A = ae(
1456
- G(E, "languages") || ["en"],
1457
- (b) => !se(o, { lang: b }) && b !== G(E, "fallbackLang")
1458
- ), R = () => {
1459
- r.edit ? f(
1432
+ const { data: a } = Rt(), [s, x] = I(n.name || ""), [c, g] = I(n.edit ? n.lang : ""), [h, v] = I(n.edit ? n.slug : ""), { mutate: y, isPending: m } = Ft(), { mutate: u, isPending: w } = $e(), _ = m || w, S = () => {
1433
+ n.edit ? u(
1460
1434
  {
1461
1435
  name: s,
1462
- slug: u,
1436
+ slug: h,
1463
1437
  lang: c,
1464
- id: r == null ? void 0 : r.id,
1465
- primaryPage: r == null ? void 0 : r.primaryPage
1438
+ id: n == null ? void 0 : n.id,
1439
+ primaryPage: n == null ? void 0 : n.primaryPage
1466
1440
  },
1467
1441
  { onSuccess: i }
1468
- ) : h(
1442
+ ) : y(
1469
1443
  {
1470
1444
  name: s,
1471
- slug: u,
1445
+ slug: h,
1472
1446
  lang: c,
1473
1447
  primaryPage: a == null ? void 0 : a.id
1474
1448
  },
1475
1449
  { onSuccess: i }
1476
1450
  );
1477
1451
  };
1478
- return /* @__PURE__ */ t.jsx(xt, { open: !!r, onOpenChange: i, children: /* @__PURE__ */ t.jsxs(bt, { className: "sm:max-w-[425px]", children: [
1479
- /* @__PURE__ */ t.jsxs(yt, { children: [
1480
- /* @__PURE__ */ t.jsx(jt, { children: r.edit ? "Edit language" : "Add New language" }),
1481
- /* @__PURE__ */ t.jsx(wt, { children: "Enter the details for the language" })
1452
+ return /* @__PURE__ */ t.jsx(wt, { open: !!n, onOpenChange: i, children: /* @__PURE__ */ t.jsxs(St, { className: "sm:max-w-[425px]", children: [
1453
+ /* @__PURE__ */ t.jsxs(kt, { children: [
1454
+ /* @__PURE__ */ t.jsx(Ct, { children: n.edit ? "Edit language" : "Add New language" }),
1455
+ /* @__PURE__ */ t.jsx(Et, { children: "Enter the details for the language" })
1482
1456
  ] }),
1483
1457
  /* @__PURE__ */ t.jsxs("form", { children: [
1484
1458
  /* @__PURE__ */ t.jsxs("div", { className: "grid gap-4 py-4", children: [
1485
1459
  /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
1486
- /* @__PURE__ */ t.jsx(_, { htmlFor: "lang", className: "text-right", children: "Language" }),
1460
+ /* @__PURE__ */ t.jsx(R, { htmlFor: "lang", className: "text-right", children: "Language" }),
1487
1461
  /* @__PURE__ */ t.jsxs(
1488
1462
  "select",
1489
1463
  {
1490
1464
  value: c,
1491
- disabled: r.edit || W(A),
1492
- onChange: (b) => p(b.target.value),
1465
+ disabled: n.edit || M(l),
1466
+ onChange: (C) => {
1467
+ const N = C.target.value;
1468
+ g(N), v(`/${N}`);
1469
+ },
1493
1470
  className: "flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",
1494
1471
  children: [
1495
- /* @__PURE__ */ t.jsx("option", { value: "", disabled: !0, selected: !0, children: W(A) ? "All available language page is created." : "Choose language" }),
1496
- Ge(A, (b) => /* @__PURE__ */ t.jsx("option", { value: b, children: G(be, b, b) }, b))
1472
+ /* @__PURE__ */ t.jsx("option", { value: "", disabled: !0, selected: !0, children: M(l) ? "All available language page is created." : "Choose language" }),
1473
+ Ue(l, (C) => /* @__PURE__ */ t.jsx("option", { value: C, children: q(xe, C, C) }, C))
1497
1474
  ]
1498
1475
  }
1499
1476
  )
1500
1477
  ] }),
1501
1478
  /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
1502
- /* @__PURE__ */ t.jsx(_, { htmlFor: "slug", className: "text-right", children: "Page Name" }),
1479
+ /* @__PURE__ */ t.jsx(R, { htmlFor: "slug", className: "text-right", children: "Page Name" }),
1503
1480
  /* @__PURE__ */ t.jsx(
1504
- U,
1481
+ G,
1505
1482
  {
1506
1483
  id: "name",
1507
1484
  value: s,
1508
- onChange: (b) => w(b.target.value),
1485
+ onChange: (C) => x(C.target.value),
1509
1486
  className: "col-span-3",
1510
1487
  required: !0,
1511
1488
  placeholder: "Enter page name"
@@ -1513,93 +1490,104 @@ const $a = ({
1513
1490
  )
1514
1491
  ] }),
1515
1492
  /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
1516
- /* @__PURE__ */ t.jsxs(_, { htmlFor: "slug", className: "text-right", children: [
1493
+ /* @__PURE__ */ t.jsxs(R, { htmlFor: "slug", className: "text-right", children: [
1517
1494
  "Slug",
1518
1495
  " ",
1519
- /* @__PURE__ */ t.jsx("small", { className: "font-light", children: "(Slug should start with /)" })
1496
+ /* @__PURE__ */ t.jsxs("small", { className: "font-light", children: [
1497
+ "(Slug should start with /",
1498
+ c,
1499
+ ")"
1500
+ ] })
1520
1501
  ] }),
1521
1502
  /* @__PURE__ */ t.jsx(
1522
- U,
1503
+ G,
1523
1504
  {
1524
1505
  id: "slug",
1525
- value: u,
1526
- onChange: (b) => m(Pa(_a(b.target.value))),
1506
+ value: h,
1507
+ onChange: (C) => {
1508
+ const N = C.target.value;
1509
+ dt(N, `/${c}`) && v(_a(Oa(N)));
1510
+ },
1527
1511
  className: "col-span-3",
1528
1512
  required: !0,
1529
1513
  pattern: "^/.*",
1514
+ disabled: M(c),
1530
1515
  title: "Slug must start with /",
1531
- placeholder: "Enter page slug"
1516
+ placeholder: M(c) ? "Choose language to add slug" : "Enter page slug"
1532
1517
  }
1533
1518
  )
1534
1519
  ] })
1535
1520
  ] }),
1536
- /* @__PURE__ */ t.jsx(St, { children: /* @__PURE__ */ t.jsx(
1521
+ /* @__PURE__ */ t.jsx(Nt, { children: /* @__PURE__ */ t.jsx(
1537
1522
  B,
1538
1523
  {
1539
- onClick: R,
1524
+ onClick: S,
1540
1525
  type: "button",
1541
- disabled: T || !c || !u || !u.startsWith("/"),
1542
- children: T ? r.edit ? "Updating..." : "Adding..." : r.edit ? "Update" : "Add new language"
1526
+ disabled: _ || !c || !h || !h.startsWith("/") || !dt(h, `/${c}`),
1527
+ children: _ ? n.edit ? "Updating..." : "Adding..." : n.edit ? "Update" : "Add new language"
1543
1528
  }
1544
1529
  ) })
1545
1530
  ] })
1546
1531
  ] }) });
1547
- }, Ka = () => {
1548
- const [r, i] = I(null), { selectedLang: o, fallbackLang: a, setSelectedLang: s, languages: w } = Ue(), { data: c, isFetching: p } = Me(), { mutate: u, isPending: m } = Dt();
1532
+ }, Wa = () => {
1533
+ const [n, i] = I(null), { selectedLang: l, fallbackLang: a, setSelectedLang: s } = Ie(), { data: x, isFetching: c } = Me(), { mutate: g, isPending: h } = At(), { data: v } = Lt(), { data: y } = Dt(), m = Be(
1534
+ q(y, "languages") || ["en"],
1535
+ (u) => !ne(x, { lang: u }) && u !== q(y, "fallbackLang")
1536
+ );
1549
1537
  return /* @__PURE__ */ t.jsxs("div", { className: "space-y-4 pt-2", children: [
1550
- /* @__PURE__ */ t.jsx("ul", { className: "space-y-2 mt-4", children: p ? /* @__PURE__ */ t.jsxs("div", { className: "w-full space-y-3 py-4", children: [
1538
+ /* @__PURE__ */ t.jsx("ul", { className: "space-y-2 mt-4", children: c ? /* @__PURE__ */ t.jsxs("div", { className: "w-full space-y-3 py-4", children: [
1551
1539
  /* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
1552
1540
  /* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
1553
1541
  /* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" })
1554
- ] }) : Ge(c, (h) => {
1555
- const g = h.lang, f = h.slug, S = !h.primaryPage, T = g === o;
1542
+ ] }) : Ue(x, (u) => {
1543
+ const w = u.lang, _ = u.slug, S = !u.primaryPage, C = w === l;
1556
1544
  return S ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1557
1545
  /* @__PURE__ */ t.jsxs(
1558
1546
  "li",
1559
1547
  {
1560
- className: `w-full p-2 rounded cursor-pointer flex items-center justify-between ${T ? "bg-gray-200" : "hover:bg-gray-100"}`,
1561
- onClick: () => s(g),
1548
+ className: `w-full p-2 rounded cursor-pointer flex items-center justify-between ${C ? "bg-gray-200" : "hover:bg-gray-100"}`,
1549
+ onClick: () => s(w),
1562
1550
  children: [
1563
1551
  /* @__PURE__ */ t.jsxs("div", { className: " flex-1 gap-x-3", children: [
1564
- /* @__PURE__ */ t.jsx("div", { className: "text-[13px]", children: G(be, S ? a : g, g) }),
1552
+ /* @__PURE__ */ t.jsx("div", { className: "text-[13px]", children: q(xe, S ? a : w, w) }),
1565
1553
  /* @__PURE__ */ t.jsxs("div", { children: [
1566
1554
  /* @__PURE__ */ t.jsxs("div", { className: "text-[11px] text-gray-500", children: [
1567
1555
  "Slug:",
1568
1556
  /* @__PURE__ */ t.jsxs("b", { children: [
1569
1557
  " ",
1570
- f
1558
+ _
1571
1559
  ] })
1572
1560
  ] }),
1573
1561
  /* @__PURE__ */ t.jsxs("div", { className: "text-[11px] text-gray-500", children: [
1574
1562
  "Name:",
1575
1563
  /* @__PURE__ */ t.jsxs("b", { children: [
1576
1564
  " ",
1577
- h.name,
1565
+ u.name,
1578
1566
  " "
1579
1567
  ] })
1580
1568
  ] })
1581
1569
  ] })
1582
1570
  ] }),
1583
1571
  S ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center text-[11px] text-orange-500 gap-x-1", children: [
1584
- /* @__PURE__ */ t.jsx(wa, { fill: "orange", className: "w-3 h-3" }),
1572
+ /* @__PURE__ */ t.jsx(Sa, { fill: "orange", className: "w-3 h-3" }),
1585
1573
  /* @__PURE__ */ t.jsx("b", { children: " Default" })
1586
1574
  ] }) : /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-3", children: [
1587
1575
  /* @__PURE__ */ t.jsx(
1588
- Et,
1576
+ Tt,
1589
1577
  {
1590
- onClick: (E) => {
1591
- E.stopPropagation(), i({ ...h, edit: !0 });
1578
+ onClick: (N) => {
1579
+ N.stopPropagation(), i({ ...u, edit: !0 });
1592
1580
  },
1593
1581
  className: "w-3 h-3 hover:text-blue-500"
1594
1582
  }
1595
1583
  ),
1596
- /* @__PURE__ */ t.jsxs(gt, { children: [
1597
- /* @__PURE__ */ t.jsx(mt, { children: /* @__PURE__ */ t.jsx(Ct, { className: "w-3 h-3 hover:text-red-500" }) }),
1598
- /* @__PURE__ */ t.jsx(vt, { children: /* @__PURE__ */ t.jsxs("div", { children: [
1584
+ /* @__PURE__ */ t.jsxs(bt, { children: [
1585
+ /* @__PURE__ */ t.jsx(yt, { children: /* @__PURE__ */ t.jsx(Pt, { className: "w-3 h-3 hover:text-red-500" }) }),
1586
+ /* @__PURE__ */ t.jsx(jt, { children: /* @__PURE__ */ t.jsxs("div", { children: [
1599
1587
  /* @__PURE__ */ t.jsxs("p", { className: "pb-2 text-sm", children: [
1600
1588
  "Are you sure you want to remove",
1601
1589
  " ",
1602
- /* @__PURE__ */ t.jsx("b", { children: G(be, g, g) }),
1590
+ /* @__PURE__ */ t.jsx("b", { children: q(xe, w, w) }),
1603
1591
  " language?"
1604
1592
  ] }),
1605
1593
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-end w-full", children: /* @__PURE__ */ t.jsx(
@@ -1607,9 +1595,9 @@ const $a = ({
1607
1595
  {
1608
1596
  size: "sm",
1609
1597
  variant: "destructive",
1610
- disabled: m,
1611
- onClick: () => u(h),
1612
- children: m ? "Deleting..." : "Delete"
1598
+ disabled: h,
1599
+ onClick: () => g(u),
1600
+ children: h ? "Deleting..." : "Delete"
1613
1601
  }
1614
1602
  ) })
1615
1603
  ] }) })
@@ -1617,84 +1605,90 @@ const $a = ({
1617
1605
  ] })
1618
1606
  ]
1619
1607
  },
1620
- h.id
1608
+ u.id
1621
1609
  ),
1622
1610
  /* @__PURE__ */ t.jsx("div", { className: "h-1 w-full border-b" })
1623
1611
  ] });
1624
1612
  }) }),
1625
- /* @__PURE__ */ t.jsx("div", { className: "flex justify-center w-full", children: ((c == null ? void 0 : c.length) || 0) >= w.length && /* @__PURE__ */ t.jsx(
1613
+ /* @__PURE__ */ t.jsx("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ t.jsx(
1626
1614
  B,
1627
1615
  {
1628
1616
  variant: "default",
1629
1617
  size: "sm",
1630
- onClick: () => i({ name: "", lang: "", slug: "", edit: !1 }),
1618
+ disabled: M(m),
1619
+ onClick: () => i({
1620
+ name: v == null ? void 0 : v.name,
1621
+ lang: "",
1622
+ slug: "",
1623
+ edit: !1
1624
+ }),
1631
1625
  children: "+ Add new language"
1632
1626
  }
1633
1627
  ) }),
1634
- r && /* @__PURE__ */ t.jsx(
1635
- $a,
1628
+ n && /* @__PURE__ */ t.jsx(
1629
+ Ka,
1636
1630
  {
1637
- langProps: r,
1638
- languagePages: c,
1631
+ languages: m,
1632
+ langProps: n,
1639
1633
  onClose: () => i(null)
1640
1634
  }
1641
1635
  )
1642
1636
  ] });
1643
1637
  }, Va = ({
1644
- activePage: r,
1638
+ activePage: n,
1645
1639
  editPage: i,
1646
- onShowUpsertPage: o
1640
+ onShowUpsertPage: l
1647
1641
  }) => {
1648
- const [a, s] = I("pages"), { data: w, isFetching: c } = qe(), { mutate: p, isPending: u } = Dt(), m = (h) => Oa(
1649
- ae(h, (f) => a === "pages" ? f.slug : !f.slug),
1642
+ const [a, s] = I("pages"), { data: x, isFetching: c } = qe(), { mutate: g, isPending: h } = At(), v = (y) => Ra(
1643
+ Be(y, (u) => a === "pages" ? u.slug : !u.slug),
1650
1644
  "name",
1651
1645
  "asc"
1652
- ).map((f) => /* @__PURE__ */ t.jsxs(
1646
+ ).map((u) => /* @__PURE__ */ t.jsxs(
1653
1647
  B,
1654
1648
  {
1655
- onClick: () => i(f.id),
1656
- variant: f.id === r ? "default" : "ghost",
1649
+ onClick: () => i(u.id),
1650
+ variant: u.id === n ? "default" : "ghost",
1657
1651
  className: "flex justify-between items-center w-full space-x-2 py-1",
1658
1652
  children: [
1659
1653
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
1660
- f.global ? /* @__PURE__ */ t.jsx(kt, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(Nt, { className: "h-4 w-4" }),
1661
- /* @__PURE__ */ t.jsx("span", { children: f.name ?? f.slug }),
1662
- (f == null ? void 0 : f.slug) && /* @__PURE__ */ t.jsxs("span", { className: "text-xs font-light", children: [
1654
+ u.global ? /* @__PURE__ */ t.jsx(_t, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(Ot, { className: "h-4 w-4" }),
1655
+ /* @__PURE__ */ t.jsx("span", { children: u.name ?? u.slug }),
1656
+ (u == null ? void 0 : u.slug) && /* @__PURE__ */ t.jsxs("span", { className: "text-xs font-light", children: [
1663
1657
  "( ",
1664
- f.slug,
1658
+ u.slug,
1665
1659
  " )"
1666
1660
  ] })
1667
1661
  ] }),
1668
1662
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-4", children: [
1669
1663
  /* @__PURE__ */ t.jsx(
1670
- Et,
1664
+ Tt,
1671
1665
  {
1672
1666
  className: "h-3 w-3 hover:text-blue-500",
1673
- onClick: (S) => {
1674
- S.stopPropagation(), o({ ...f, global: a === "globalBlocks" });
1667
+ onClick: (w) => {
1668
+ w.stopPropagation(), l({ ...u, global: a === "globalBlocks" });
1675
1669
  }
1676
1670
  }
1677
1671
  ),
1678
- /* @__PURE__ */ t.jsxs(gt, { children: [
1679
- /* @__PURE__ */ t.jsx(mt, { onClick: (S) => S.stopPropagation(), children: /* @__PURE__ */ t.jsx(Ct, { className: "w-3 h-3 hover:text-red-500" }) }),
1680
- /* @__PURE__ */ t.jsx(vt, { children: /* @__PURE__ */ t.jsxs("div", { children: [
1672
+ /* @__PURE__ */ t.jsxs(bt, { children: [
1673
+ /* @__PURE__ */ t.jsx(yt, { onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ t.jsx(Pt, { className: "w-3 h-3 hover:text-red-500" }) }),
1674
+ /* @__PURE__ */ t.jsx(jt, { children: /* @__PURE__ */ t.jsxs("div", { children: [
1681
1675
  /* @__PURE__ */ t.jsxs("p", { className: "pb-2 text-sm", children: [
1682
1676
  "Are you sure you want to remove",
1683
1677
  " ",
1684
- /* @__PURE__ */ t.jsx("b", { children: f.name ?? (f == null ? void 0 : f.slug) }),
1678
+ /* @__PURE__ */ t.jsx("b", { children: u.name ?? (u == null ? void 0 : u.slug) }),
1685
1679
  " ",
1686
- f.global ? "global block?" : "page? This will also delete all associated language pages."
1680
+ u.global ? "global block?" : "page? This will also delete all associated language pages."
1687
1681
  ] }),
1688
1682
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-end w-full", children: /* @__PURE__ */ t.jsx(
1689
1683
  B,
1690
1684
  {
1691
1685
  size: "sm",
1692
1686
  variant: "destructive",
1693
- disabled: u,
1694
- onClick: (S) => {
1695
- S.stopPropagation(), p(f);
1687
+ disabled: h,
1688
+ onClick: (w) => {
1689
+ w.stopPropagation(), g(u);
1696
1690
  },
1697
- children: u ? "Deleting..." : "Delete"
1691
+ children: h ? "Deleting..." : "Delete"
1698
1692
  }
1699
1693
  ) })
1700
1694
  ] }) })
@@ -1702,11 +1696,11 @@ const $a = ({
1702
1696
  ] })
1703
1697
  ]
1704
1698
  },
1705
- f.id
1699
+ u.id
1706
1700
  ));
1707
1701
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1708
1702
  /* @__PURE__ */ t.jsx("br", {}),
1709
- /* @__PURE__ */ t.jsxs(ma, { value: a, className: "w-full", onValueChange: s, children: [
1703
+ /* @__PURE__ */ t.jsxs(xa, { value: a, className: "w-full", onValueChange: s, children: [
1710
1704
  /* @__PURE__ */ t.jsxs(va, { className: "w-full", children: [
1711
1705
  /* @__PURE__ */ t.jsx(ut, { value: "pages", className: "w-full", children: /* @__PURE__ */ t.jsx("div", { className: "px-4", children: "Pages" }) }),
1712
1706
  /* @__PURE__ */ t.jsx(ut, { value: "globalBlocks", className: "w-full", children: /* @__PURE__ */ t.jsx("div", { className: "px-4", children: "Global Blocks" }) })
@@ -1716,7 +1710,7 @@ const $a = ({
1716
1710
  /* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
1717
1711
  /* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" })
1718
1712
  ] }) : /* @__PURE__ */ t.jsxs("div", { className: "py-4 space-y-3", children: [
1719
- /* @__PURE__ */ t.jsx(xa, { children: /* @__PURE__ */ t.jsxs(ba, { className: "text-xs text-muted-foreground text-center text-light", children: [
1713
+ /* @__PURE__ */ t.jsx(ba, { children: /* @__PURE__ */ t.jsxs(ya, { className: "text-xs text-muted-foreground text-center text-light", children: [
1720
1714
  "Manage your ",
1721
1715
  a === "pages" ? "pages" : "global blocks"
1722
1716
  ] }) }),
@@ -1726,29 +1720,29 @@ const $a = ({
1726
1720
  variant: "default",
1727
1721
  size: "sm",
1728
1722
  disabled: c,
1729
- onClick: () => o({
1723
+ onClick: () => l({
1730
1724
  slug: "",
1731
1725
  name: "",
1732
1726
  global: a === "globalBlocks"
1733
1727
  }),
1734
1728
  className: "mb-4 w-1/2 bg-blue-500 hover:bg-blue-400",
1735
1729
  children: [
1736
- /* @__PURE__ */ t.jsx(Sa, { className: "h-4 w-4 mr-2" }),
1730
+ /* @__PURE__ */ t.jsx(ka, { className: "h-4 w-4 mr-2" }),
1737
1731
  c ? "Loading..." : `Add new ${a === "pages" ? "page" : "global block"}`
1738
1732
  ]
1739
1733
  }
1740
1734
  ) }),
1741
- /* @__PURE__ */ t.jsx("div", { className: "pt-4", children: /* @__PURE__ */ t.jsx("div", { className: "space-y-2", children: c ? /* @__PURE__ */ t.jsx("div", { className: "h-32 w-full flex justify-center items-center text-sm animate-pulse", children: "Loading..." }) : m(w) }) })
1735
+ /* @__PURE__ */ t.jsx("div", { className: "pt-4", children: /* @__PURE__ */ t.jsx("div", { className: "space-y-2", children: c ? /* @__PURE__ */ t.jsx("div", { className: "h-32 w-full flex justify-center items-center text-sm animate-pulse", children: "Loading..." }) : v(x) }) })
1742
1736
  ] })
1743
1737
  ] })
1744
1738
  ] });
1745
- }, Wa = ({
1746
- editPage: r,
1739
+ }, za = ({
1740
+ editPage: n,
1747
1741
  showUpsertPage: i,
1748
- setShowUpsertPage: o
1742
+ setShowUpsertPage: l
1749
1743
  }) => {
1750
- const a = i.id, [s, w] = I(a && i.name || ""), [c, p] = I(a && i.slug || ""), { mutate: u, isPending: m } = Rt(), { mutate: h, isPending: g } = $e(), f = m || g, S = () => {
1751
- a ? h(
1744
+ const a = i.id, [s, x] = I(a && i.name || ""), [c, g] = I(a && i.slug || ""), { mutate: h, isPending: v } = Ft(), { mutate: y, isPending: m } = $e(), u = v || m, w = () => {
1745
+ a ? y(
1752
1746
  {
1753
1747
  name: s,
1754
1748
  slug: c,
@@ -1757,35 +1751,35 @@ const $a = ({
1757
1751
  },
1758
1752
  {
1759
1753
  onSuccess: () => {
1760
- o(void 0);
1754
+ l(void 0);
1761
1755
  }
1762
1756
  }
1763
- ) : u(
1757
+ ) : h(
1764
1758
  {
1765
1759
  name: s,
1766
1760
  slug: c,
1767
1761
  global: !!i.global
1768
1762
  },
1769
1763
  {
1770
- onSuccess: (T) => {
1771
- r(T.id);
1764
+ onSuccess: (_) => {
1765
+ n(_.id);
1772
1766
  }
1773
1767
  }
1774
1768
  );
1775
1769
  };
1776
1770
  return /* @__PURE__ */ t.jsx(
1777
- xt,
1771
+ wt,
1778
1772
  {
1779
1773
  open: !!i,
1780
- onOpenChange: () => o(void 0),
1781
- children: /* @__PURE__ */ t.jsxs(bt, { className: "sm:max-w-[425px]", children: [
1782
- /* @__PURE__ */ t.jsxs(yt, { children: [
1783
- /* @__PURE__ */ t.jsxs(jt, { children: [
1774
+ onOpenChange: () => l(void 0),
1775
+ children: /* @__PURE__ */ t.jsxs(St, { className: "sm:max-w-[425px]", children: [
1776
+ /* @__PURE__ */ t.jsxs(kt, { children: [
1777
+ /* @__PURE__ */ t.jsxs(Ct, { children: [
1784
1778
  a ? "Edit" : "Add New",
1785
1779
  " ",
1786
1780
  i.global ? "Global Block" : "Page"
1787
1781
  ] }),
1788
- /* @__PURE__ */ t.jsxs(wt, { children: [
1782
+ /* @__PURE__ */ t.jsxs(Et, { children: [
1789
1783
  "Enter the details for the new",
1790
1784
  " ",
1791
1785
  i.global ? "global block. Identifier should be unique." : "page. Slug must start with /"
@@ -1794,29 +1788,29 @@ const $a = ({
1794
1788
  /* @__PURE__ */ t.jsxs("form", { children: [
1795
1789
  /* @__PURE__ */ t.jsxs("div", { className: "grid gap-4 py-4", children: [
1796
1790
  /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
1797
- /* @__PURE__ */ t.jsx(_, { htmlFor: "name", className: "text-right", children: "Name" }),
1791
+ /* @__PURE__ */ t.jsx(R, { htmlFor: "name", className: "text-right", children: "Name" }),
1798
1792
  /* @__PURE__ */ t.jsx(
1799
- U,
1793
+ G,
1800
1794
  {
1801
1795
  id: "name",
1802
1796
  value: s,
1803
1797
  placeholder: `Enter ${i.global ? "global block" : "page"} name`,
1804
- onChange: (T) => w(T.target.value),
1798
+ onChange: (_) => x(_.target.value),
1805
1799
  className: "col-span-3",
1806
1800
  required: !0
1807
1801
  }
1808
1802
  )
1809
1803
  ] }),
1810
1804
  !i.global && /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
1811
- /* @__PURE__ */ t.jsx(_, { htmlFor: "slug", className: "text-right", children: i.global ? "Identifier" : "Slug" }),
1805
+ /* @__PURE__ */ t.jsx(R, { htmlFor: "slug", className: "text-right", children: i.global ? "Identifier" : "Slug" }),
1812
1806
  /* @__PURE__ */ t.jsx(
1813
- U,
1807
+ G,
1814
1808
  {
1815
1809
  id: "slug",
1816
1810
  value: c,
1817
- onChange: (T) => {
1818
- var E;
1819
- return p((E = T.target.value) == null ? void 0 : E.trim().toLowerCase());
1811
+ onChange: (_) => {
1812
+ var S;
1813
+ return g((S = _.target.value) == null ? void 0 : S.trim().toLowerCase());
1820
1814
  },
1821
1815
  className: "col-span-3",
1822
1816
  required: !0,
@@ -1827,13 +1821,13 @@ const $a = ({
1827
1821
  )
1828
1822
  ] })
1829
1823
  ] }),
1830
- /* @__PURE__ */ t.jsx(St, { children: /* @__PURE__ */ t.jsx(
1824
+ /* @__PURE__ */ t.jsx(Nt, { children: /* @__PURE__ */ t.jsx(
1831
1825
  B,
1832
1826
  {
1833
- onClick: S,
1827
+ onClick: w,
1834
1828
  type: "button",
1835
- disabled: f || !s || !i.global && !c.startsWith("/") || Le(i.name, s) && Le(i.slug, c),
1836
- children: f ? a ? "Updating..." : "Adding..." : i.global ? `${a ? "Update" : "Add"} global block` : `${a ? "Update" : "Add"} Page`
1829
+ disabled: u || !s || !i.global && !c.startsWith("/") || Fe(i.name, s) && Fe(i.slug, c),
1830
+ children: u ? a ? "Updating..." : "Adding..." : i.global ? `${a ? "Update" : "Add"} global block` : `${a ? "Update" : "Add"} Page`
1837
1831
  }
1838
1832
  ) })
1839
1833
  ] })
@@ -1841,37 +1835,37 @@ const $a = ({
1841
1835
  }
1842
1836
  );
1843
1837
  };
1844
- function za(r) {
1845
- const { activePage: i, canClose: o, open: a, close: s } = r, [, w] = Y(), [c, p] = I(), u = (m) => {
1846
- window.history.pushState({}, "", `?page=${m}`), w(new URLSearchParams({ page: m })), window.dispatchEvent(new PopStateEvent("popstate")), p(void 0), s();
1838
+ function Ya(n) {
1839
+ const { activePage: i, canClose: l, open: a, close: s } = n, [, x] = re(), [c, g] = I(), h = (v) => {
1840
+ window.history.pushState({}, "", `?page=${v}`), x(new URLSearchParams({ page: v })), window.dispatchEvent(new PopStateEvent("popstate")), g(void 0), s();
1847
1841
  };
1848
1842
  return /* @__PURE__ */ t.jsx(
1849
- ya,
1843
+ ja,
1850
1844
  {
1851
1845
  open: a,
1852
- onOpenChange: (m) => {
1853
- !m && o && s();
1846
+ onOpenChange: (v) => {
1847
+ !v && l && s();
1854
1848
  },
1855
1849
  children: /* @__PURE__ */ t.jsxs(
1856
- ja,
1850
+ wa,
1857
1851
  {
1858
1852
  side: "left",
1859
- className: `border-border w-full ${o ? "" : "sheet-hide-close-btn"}`,
1853
+ className: `border-border w-full ${l ? "" : "sheet-hide-close-btn"}`,
1860
1854
  children: [
1861
1855
  /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
1862
1856
  Va,
1863
1857
  {
1864
- onShowUpsertPage: (m) => p(m),
1858
+ onShowUpsertPage: (v) => g(v),
1865
1859
  activePage: i,
1866
- editPage: u
1860
+ editPage: h
1867
1861
  }
1868
1862
  ) }),
1869
1863
  c && /* @__PURE__ */ t.jsx(
1870
- Wa,
1864
+ za,
1871
1865
  {
1872
- editPage: u,
1866
+ editPage: h,
1873
1867
  showUpsertPage: c,
1874
- setShowUpsertPage: p
1868
+ setShowUpsertPage: g
1875
1869
  }
1876
1870
  )
1877
1871
  ]
@@ -1880,57 +1874,68 @@ function za(r) {
1880
1874
  }
1881
1875
  );
1882
1876
  }
1883
- ua();
1884
- const Ja = (r) => {
1885
- var Q;
1886
- const [i] = Y(), o = i.get("page"), { data: a, isFetching: s } = _t(), { data: w } = Ia(), { data: c, isFetching: p } = Tt(), { blocks: u, theme: m } = Ba(c), { data: h } = Ot(), { data: g } = Me(), f = Fa(), { uploadFile: S } = Ga(), { getUILibraryBlock: T, getUILibraryBlocks: E, onSave: A } = La(), { getGlobalBlocks: R, getGlobalBlockBlocks: b } = Ua(), { mutate: je, isPending: ie } = qa(), { aiContext: H, updateAiContext: we } = Pt(), [Se, oe] = I(!1), [q, Ee] = I("SAVED");
1887
- Be(() => {
1888
- const C = (F) => {
1889
- q === "UNSAVED" && (F.preventDefault(), F.returnValue = !1);
1877
+ da();
1878
+ const Ja = (n) => {
1879
+ var F;
1880
+ const i = vt([]), [l] = re(), a = l.get("page"), { data: s, isFetching: x } = Rt(), { data: c } = Ba(), { data: g, isFetching: h } = Ua(), { blocks: v, theme: y } = Ga(g), { data: m } = Dt(), { data: u } = Me(), w = La(), { uploadFile: _ } = Ma(), { getUILibraryBlock: S, getUILibraryBlocks: C, onSave: N } = Ia(), { getGlobalBlocks: P, getGlobalBlockBlocks: ye } = qa(), { mutate: je, isPending: se } = $a(), { aiContext: J, setAiContext: we } = Ge();
1881
+ i.current = v;
1882
+ const [Se, H] = I(!1), [K, ke] = I("SAVED");
1883
+ Le(() => {
1884
+ const k = (A) => {
1885
+ K === "UNSAVED" && (A.preventDefault(), A.returnValue = !1);
1890
1886
  };
1891
- return q === "UNSAVED" && window.addEventListener("beforeunload", C), () => {
1892
- window.removeEventListener("beforeunload", C);
1887
+ return K === "UNSAVED" && window.addEventListener("beforeunload", k), () => {
1888
+ window.removeEventListener("beforeunload", k);
1893
1889
  };
1894
- }, [q]);
1895
- const Ce = ye(() => {
1896
- const C = {};
1897
- return h != null && h.theme && (C.brandingOptions = h.theme), C;
1898
- }, [h]);
1890
+ }, [K]);
1891
+ const ie = ve(() => {
1892
+ const k = {};
1893
+ return m != null && m.theme && (k.brandingOptions = m.theme), k;
1894
+ }, [m]);
1899
1895
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
1900
1896
  /* @__PURE__ */ t.jsx(
1901
- ha,
1897
+ fa,
1902
1898
  {
1903
- loading: p,
1904
- fallbackLang: r.fallbackLang || "en",
1905
- languages: Ge(g, "lang") || [],
1906
- translations: r.translations || {},
1907
- locale: r.locale || "en",
1908
- htmlDir: r.htmlDir || "ltr",
1909
- autoSaveSupport: r.autoSaveSupport || !1,
1910
- autoSaveInterval: r.autoSaveInterval || 15,
1911
- uploadMediaCallback: S,
1912
- onError: r.onError || console.error,
1913
- getGlobalBlockBlocks: b,
1914
- getGlobalBlocks: R,
1915
- blocks: u,
1916
- getUILibraryBlock: T,
1917
- getUILibraryBlocks: E,
1918
- brandingOptions: m,
1919
- uiLibraries: w,
1920
- saveAiContextCallback: async (C) => (await we({ page: o, aiContext: C }), !0),
1921
- onSaveStateChange: (C) => Ee(C),
1922
- aiContext: H,
1923
- askAiCallBack: f,
1924
- onSave: async ({ blocks: C, themeConfiguration: F }) => {
1925
- if (!o) return !0;
1926
- const M = {
1927
- _type: "@chai/theme",
1928
- _value: F
1929
- }, le = {
1899
+ loading: h,
1900
+ ...n.fallbackLang && {
1901
+ fallbackLang: n.fallbackLang || "en"
1902
+ },
1903
+ ...n.languages && {
1904
+ languages: Ue(u, "lang") || []
1905
+ },
1906
+ translations: n.translations || {},
1907
+ locale: n.locale || "en",
1908
+ htmlDir: n.htmlDir || "ltr",
1909
+ autoSaveSupport: n.autoSaveSupport || !1,
1910
+ autoSaveInterval: n.autoSaveInterval || 15,
1911
+ uploadMediaCallback: _,
1912
+ onError: n.onError || console.error,
1913
+ getGlobalBlockBlocks: ye,
1914
+ getGlobalBlocks: P,
1915
+ blocks: v,
1916
+ getUILibraryBlock: S,
1917
+ getUILibraryBlocks: C,
1918
+ brandingOptions: y,
1919
+ uiLibraries: c,
1920
+ saveAiContextCallback: async (k) => {
1921
+ if (!a) return !0;
1922
+ const A = i.current, W = {
1923
+ _type: "@chai/ai-context",
1924
+ _value: ht(k) ? k : ""
1925
+ }, oe = [...A, W];
1926
+ return await N({ page: a, blocks: oe }), we(k), !0;
1927
+ },
1928
+ onSaveStateChange: (k) => ke(k),
1929
+ aiContext: J,
1930
+ askAiCallBack: w,
1931
+ onSave: async ({ blocks: k }) => {
1932
+ if (!a) return !0;
1933
+ i.current = k;
1934
+ const A = {
1930
1935
  _type: "@chai/ai-context",
1931
- _value: Fe(H) ? H : ""
1932
- }, ce = [...C, M, le];
1933
- return await A({ page: o, blocks: ce }), !0;
1936
+ _value: ht(J) ? J : ""
1937
+ }, W = [...k, A];
1938
+ return await N({ page: a, blocks: W }), i.current = k, !0;
1934
1939
  },
1935
1940
  topBarComponents: {
1936
1941
  left: [
@@ -1939,11 +1944,11 @@ const Ja = (r) => {
1939
1944
  {
1940
1945
  variant: "default",
1941
1946
  className: "flex justify-start max-w-[250px] items-center w-full space-x-2 py-1",
1942
- onClick: () => oe(!0),
1947
+ onClick: () => H(!0),
1943
1948
  children: [
1944
- xe(a.slug, "/") ? /* @__PURE__ */ t.jsx(Nt, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(kt, { className: "h-4 w-4" }),
1945
- /* @__PURE__ */ t.jsx("span", { className: "truncate", children: (a == null ? void 0 : a.name) ?? "" }),
1946
- /* @__PURE__ */ t.jsx(Ea, { className: "h-4 w-4" })
1949
+ pe(s.slug, "/") ? /* @__PURE__ */ t.jsx(Ot, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(_t, { className: "h-4 w-4" }),
1950
+ /* @__PURE__ */ t.jsx("span", { className: "truncate", children: (s == null ? void 0 : s.name) ?? "" }),
1951
+ /* @__PURE__ */ t.jsx(Ca, { className: "h-4 w-4" })
1947
1952
  ]
1948
1953
  },
1949
1954
  "template-viewer"
@@ -1953,15 +1958,15 @@ const Ja = (r) => {
1953
1958
  () => /* @__PURE__ */ t.jsxs(
1954
1959
  B,
1955
1960
  {
1956
- disabled: ie || q !== "SAVED",
1961
+ disabled: se || K !== "SAVED",
1957
1962
  size: "sm",
1958
1963
  variant: "default",
1959
- onClick: () => je(o),
1964
+ onClick: () => je(a),
1960
1965
  children: [
1961
- /* @__PURE__ */ t.jsx(Ca, { className: "h-4 w-4" }),
1966
+ /* @__PURE__ */ t.jsx(Ea, { className: "h-4 w-4" }),
1962
1967
  "  ",
1963
1968
  " ",
1964
- ie ? "Publishing..." : "Publish"
1969
+ se ? "Publishing..." : "Publish"
1965
1970
  ]
1966
1971
  }
1967
1972
  )
@@ -1969,10 +1974,10 @@ const Ja = (r) => {
1969
1974
  },
1970
1975
  sideBarComponents: {
1971
1976
  top: [
1972
- ...xe(a.slug, "/") ? [
1977
+ ...pe(s.slug, "/") ? [
1973
1978
  {
1974
1979
  label: "SEO Setting",
1975
- component: At,
1980
+ component: It,
1976
1981
  icon: /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
1977
1982
  "svg",
1978
1983
  {
@@ -1989,10 +1994,10 @@ const Ja = (r) => {
1989
1994
  ) })
1990
1995
  }
1991
1996
  ] : [],
1992
- ...(Q = r.languages) != null && Q.length && xe(a.slug, "/") ? [
1997
+ ...(F = n.languages) != null && F.length && pe(s.slug, "/") ? [
1993
1998
  {
1994
1999
  label: "Language Pages",
1995
- component: Ka,
2000
+ component: Wa,
1996
2001
  icon: /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
1997
2002
  "svg",
1998
2003
  {
@@ -2022,22 +2027,22 @@ const Ja = (r) => {
2022
2027
  ] : []
2023
2028
  ]
2024
2029
  },
2025
- ...Ce
2030
+ ...ie
2026
2031
  }
2027
2032
  ),
2028
2033
  /* @__PURE__ */ t.jsx(
2029
- za,
2034
+ Ya,
2030
2035
  {
2031
- activePage: o || "",
2032
- canClose: !!o && !W(a),
2033
- open: !o || !s && W(a) || Se,
2034
- close: () => oe(!1)
2036
+ activePage: a || "",
2037
+ canClose: !!a && !M(s),
2038
+ open: !a || !x && M(s) || Se,
2039
+ close: () => H(!1)
2035
2040
  }
2036
2041
  )
2037
2042
  ] });
2038
- }, ft = new fa({
2043
+ }, mt = new ga({
2039
2044
  defaultOptions: { queries: { refetchOnWindowFocus: !1 } }
2040
- }), an = (r) => (ft.setQueryData(["builder_props"], r), /* @__PURE__ */ t.jsx(pa, { client: ft, children: /* @__PURE__ */ t.jsx(Ja, { ...r }) }));
2045
+ }), nn = (n) => (mt.setQueryData(["builder_props"], n), /* @__PURE__ */ t.jsx(ma, { client: mt, children: /* @__PURE__ */ t.jsx(Ja, { ...n }) }));
2041
2046
  export {
2042
- an as default
2047
+ nn as default
2043
2048
  };