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

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