@topol.io/editor-react 0.3.0 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,215 @@
1
- import xe, { useEffect as Oe } from "react";
2
- var _ = { exports: {} }, k = {};
1
+ import Be, { useRef as _, useEffect as D, forwardRef as Me, useImperativeHandle as Le } from "react";
2
+ function ze(t) {
3
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
4
+ }
5
+ var Ye = function(t, d, g) {
6
+ var s = document.head || document.getElementsByTagName("head")[0], u = document.createElement("script");
7
+ typeof d == "function" && (g = d, d = {}), d = d || {}, g = g || function() {
8
+ }, u.type = d.type || "text/javascript", u.charset = d.charset || "utf8", u.async = "async" in d ? !!d.async : !0, u.src = t, d.attrs && Ie(u, d.attrs), d.text && (u.text = "" + d.text);
9
+ var E = "onload" in u ? he : Ue;
10
+ E(u, g), u.onload || he(u, g), s.appendChild(u);
11
+ };
12
+ function Ie(t, d) {
13
+ for (var g in d)
14
+ t.setAttribute(g, d[g]);
15
+ }
16
+ function he(t, d) {
17
+ t.onload = function() {
18
+ this.onerror = this.onload = null, d(null, t);
19
+ }, t.onerror = function() {
20
+ this.onerror = this.onload = null, d(new Error("Failed to load " + this.src), t);
21
+ };
22
+ }
23
+ function Ue(t, d) {
24
+ t.onreadystatechange = function() {
25
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, d(null, t));
26
+ };
27
+ }
28
+ const Z = /* @__PURE__ */ ze(Ye);
29
+ var J = {};
30
+ const N = {
31
+ production: J.VITE_TOPOL_URL,
32
+ dev: J.VITE_TOPOL_DEV_URL,
33
+ staging: J.VITE_TOPOL_STAGING_URL
34
+ }, We = "https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";
35
+ function $e(t = "production") {
36
+ switch (t) {
37
+ case "dev":
38
+ return N.dev;
39
+ case "staging":
40
+ return N.staging;
41
+ case "production":
42
+ return N.production;
43
+ default:
44
+ return We.replace("{stage}", String(t));
45
+ }
46
+ }
47
+ async function Ve(t) {
48
+ return new Promise((d, g) => {
49
+ Z(N.production, (s) => {
50
+ if (s !== null) {
51
+ g(s);
52
+ return;
53
+ }
54
+ window.TopolPlugin.init(t), d(!0);
55
+ });
56
+ });
57
+ }
58
+ const X = {
59
+ /**
60
+ * Initialize the Email Editor.
61
+ * @param topolOptions - Configuration options for the editor
62
+ * @param options - Plugin options including stage selection
63
+ * @returns Promise that resolves to true when the editor is ready
64
+ */
65
+ init: (t, d) => new Promise((g, s) => {
66
+ const u = $e(d == null ? void 0 : d.stage);
67
+ Z(u, async (E) => {
68
+ if (E !== null) {
69
+ if (u !== N.production)
70
+ try {
71
+ return await Ve(t), g(!0);
72
+ } catch (v) {
73
+ s(v);
74
+ }
75
+ s(E);
76
+ return;
77
+ }
78
+ window.TopolPlugin.init(t), g(!0);
79
+ });
80
+ }),
81
+ /** Trigger the save callback with current editor content */
82
+ save: () => {
83
+ window.TopolPlugin.save();
84
+ },
85
+ /** Load a template JSON into the editor */
86
+ load: (t) => {
87
+ window.TopolPlugin.load(t);
88
+ },
89
+ /** Toggle the preview mode */
90
+ togglePreview: () => {
91
+ window.TopolPlugin.togglePreview();
92
+ },
93
+ /** Toggle between desktop and mobile preview sizes */
94
+ togglePreviewSize: () => {
95
+ window.TopolPlugin.togglePreviewSize();
96
+ },
97
+ /** Select a file from the custom file manager */
98
+ chooseFile: (t) => {
99
+ window.TopolPlugin.chooseFile(t);
100
+ },
101
+ /** Undo the last action */
102
+ undo: () => {
103
+ window.TopolPlugin.undo();
104
+ },
105
+ /** Redo the last undone action */
106
+ redo: () => {
107
+ window.TopolPlugin.redo();
108
+ },
109
+ /** Destroy the editor instance and clean up resources */
110
+ destroy: () => {
111
+ window.TopolPlugin.destroy();
112
+ },
113
+ /** Update the list of saved/reusable blocks */
114
+ setSavedBlocks: (t) => {
115
+ window.TopolPlugin.setSavedBlocks(t);
116
+ },
117
+ /** Set custom HTML for the preview */
118
+ setPreviewHTML: (t) => {
119
+ window.TopolPlugin.setPreviewHTML(t);
120
+ },
121
+ /** Display a notification in the editor */
122
+ createNotification: (t) => {
123
+ window.TopolPlugin.createNotification(t);
124
+ },
125
+ /** Set the list of active collaboration members */
126
+ setActiveMembers: (t) => {
127
+ window.TopolPlugin.setActiveMembers(t);
128
+ },
129
+ /** Switch to mobile view */
130
+ changeEmailToMobile: () => {
131
+ window.TopolPlugin.changeEmailToMobile();
132
+ },
133
+ /** Switch to desktop view */
134
+ changeEmailToDesktop: () => {
135
+ window.TopolPlugin.changeEmailToDesktop();
136
+ },
137
+ /** Toggle visibility of hidden blocks and structures */
138
+ toggleBlocksAndStructuresVisibility: () => {
139
+ window.TopolPlugin.toggleBlocksAndStructuresVisibility();
140
+ },
141
+ /** Update the content of a custom block */
142
+ updateCustomBlockContent: (t) => {
143
+ window.TopolPlugin.updateCustomBlockContent(t);
144
+ },
145
+ /** Refresh comments/conversations */
146
+ refreshComments: (t) => {
147
+ window.TopolPlugin.refreshComments(t);
148
+ },
149
+ /** Refresh synced rows */
150
+ refreshSyncedRows: () => {
151
+ window.TopolPlugin.refreshSyncedRows();
152
+ },
153
+ /** Open the premade templates selection modal */
154
+ openPremadeTemplatesSelection: () => {
155
+ window.TopolPlugin.openPremadeTemplatesSelection();
156
+ },
157
+ /** Update the API authorization header */
158
+ updateApiAuthorizationHeader: (t) => {
159
+ window.TopolPlugin.updateApiAuthorizationHeader(t);
160
+ },
161
+ /** Set the template name/title */
162
+ setTemplateName: (t) => {
163
+ window.TopolPlugin.setTemplateName(t);
164
+ },
165
+ /** Toggle the AI chat feature */
166
+ toggleChatAI: () => {
167
+ window.TopolPlugin.toggleChatAI();
168
+ },
169
+ /** Toggle the autosaves feature */
170
+ toggleAutosaves: () => {
171
+ window.TopolPlugin.toggleAutosaves();
172
+ },
173
+ /** Toggle the comments panel */
174
+ toggleComments: () => {
175
+ window.TopolPlugin.toggleComments();
176
+ },
177
+ /** Create a new language variant */
178
+ createLanguage: (t) => {
179
+ window.TopolPlugin.createLanguage(t);
180
+ },
181
+ /** Set the primary language */
182
+ setPrimaryLanguage: (t) => {
183
+ window.TopolPlugin.setPrimaryLanguage(t);
184
+ },
185
+ /** Delete a language variant */
186
+ deleteLanguage: (t) => {
187
+ window.TopolPlugin.deleteLanguage(t);
188
+ },
189
+ /** Select/switch to a language */
190
+ selectLanguage: (t) => {
191
+ window.TopolPlugin.selectLanguage(t);
192
+ }
193
+ }, He = "https://v1.page-assets.topol.io/topol-lpe.js", Fe = {
194
+ /**
195
+ * Inits Landing Page Editor.
196
+ *
197
+ * @param options - Configuration options for the editor
198
+ * @param pluginOptions - Plugin options (reserved for future staging/dev URL support)
199
+ * @returns Promise that resolves with the editor instance
200
+ */
201
+ init: (t, d) => new Promise((g, s) => {
202
+ Z(He, (u) => {
203
+ if (u !== null) {
204
+ s(u);
205
+ return;
206
+ }
207
+ const E = window.LandingPageEditor(t);
208
+ g(E);
209
+ });
210
+ })
211
+ }, Qe = X;
212
+ var M = { exports: {} }, x = {};
3
213
  /**
4
214
  * @license React
5
215
  * react-jsx-runtime.production.js
@@ -9,29 +219,29 @@ var _ = { exports: {} }, k = {};
9
219
  * This source code is licensed under the MIT license found in the
10
220
  * LICENSE file in the root directory of this source tree.
11
221
  */
12
- var ge;
13
- function je() {
14
- if (ge) return k;
15
- ge = 1;
16
- var o = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
17
- function c(r, i, f) {
222
+ var be;
223
+ function qe() {
224
+ if (be) return x;
225
+ be = 1;
226
+ var t = Symbol.for("react.transitional.element"), d = Symbol.for("react.fragment");
227
+ function g(s, u, E) {
18
228
  var v = null;
19
- if (f !== void 0 && (v = "" + f), i.key !== void 0 && (v = "" + i.key), "key" in i) {
20
- f = {};
21
- for (var y in i)
22
- y !== "key" && (f[y] = i[y]);
23
- } else f = i;
24
- return i = f.ref, {
25
- $$typeof: o,
26
- type: r,
229
+ if (E !== void 0 && (v = "" + E), u.key !== void 0 && (v = "" + u.key), "key" in u) {
230
+ E = {};
231
+ for (var m in u)
232
+ m !== "key" && (E[m] = u[m]);
233
+ } else E = u;
234
+ return u = E.ref, {
235
+ $$typeof: t,
236
+ type: s,
27
237
  key: v,
28
- ref: i !== void 0 ? i : null,
29
- props: f
238
+ ref: u !== void 0 ? u : null,
239
+ props: E
30
240
  };
31
241
  }
32
- return k.Fragment = l, k.jsx = c, k.jsxs = c, k;
242
+ return x.Fragment = d, x.jsx = g, x.jsxs = g, x;
33
243
  }
34
- var A = {};
244
+ var j = {};
35
245
  /**
36
246
  * @license React
37
247
  * react-jsx-runtime.development.js
@@ -41,79 +251,79 @@ var A = {};
41
251
  * This source code is licensed under the MIT license found in the
42
252
  * LICENSE file in the root directory of this source tree.
43
253
  */
44
- var ve;
45
- function Ne() {
46
- return ve || (ve = 1, process.env.NODE_ENV !== "production" && function() {
47
- function o(e) {
254
+ var Pe;
255
+ function Ge() {
256
+ return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
257
+ function t(e) {
48
258
  if (e == null) return null;
49
259
  if (typeof e == "function")
50
- return e.$$typeof === Re ? null : e.displayName || e.name || null;
260
+ return e.$$typeof === xe ? null : e.displayName || e.name || null;
51
261
  if (typeof e == "string") return e;
52
262
  switch (e) {
53
- case N:
263
+ case Y:
54
264
  return "Fragment";
55
- case ke:
265
+ case Ae:
56
266
  return "Portal";
57
- case Z:
267
+ case te:
58
268
  return "Profiler";
59
- case X:
269
+ case ne:
60
270
  return "StrictMode";
61
- case B:
271
+ case U:
62
272
  return "Suspense";
63
- case Y:
273
+ case W:
64
274
  return "SuspenseList";
65
275
  }
66
276
  if (typeof e == "object")
67
277
  switch (typeof e.tag == "number" && console.error(
68
278
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
279
  ), e.$$typeof) {
70
- case K:
280
+ case ae:
71
281
  return (e.displayName || "Context") + ".Provider";
72
- case Q:
282
+ case re:
73
283
  return (e._context.displayName || "Context") + ".Consumer";
74
- case M:
75
- var t = e.render;
76
- return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
77
- case W:
78
- return t = e.displayName || null, t !== null ? t : o(e.type) || "Memo";
284
+ case I:
285
+ var r = e.render;
286
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
287
  case $:
80
- t = e._payload, e = e._init;
288
+ return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
289
+ case V:
290
+ r = e._payload, e = e._init;
81
291
  try {
82
- return o(e(t));
292
+ return t(e(r));
83
293
  } catch {
84
294
  }
85
295
  }
86
296
  return null;
87
297
  }
88
- function l(e) {
298
+ function d(e) {
89
299
  return "" + e;
90
300
  }
91
- function c(e) {
301
+ function g(e) {
92
302
  try {
93
- l(e);
94
- var t = !1;
303
+ d(e);
304
+ var r = !1;
95
305
  } catch {
96
- t = !0;
306
+ r = !0;
97
307
  }
98
- if (t) {
99
- t = console;
100
- var n = t.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
101
- return n.call(
102
- t,
308
+ if (r) {
309
+ r = console;
310
+ var a = r.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
311
+ return a.call(
312
+ r,
103
313
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
104
- u
105
- ), l(e);
314
+ f
315
+ ), d(e);
106
316
  }
107
317
  }
108
- function r() {
318
+ function s() {
109
319
  }
110
- function i() {
111
- if (P === 0) {
112
- oe = console.log, te = console.info, ne = console.warn, re = console.error, ae = console.group, ie = console.groupCollapsed, le = console.groupEnd;
320
+ function u() {
321
+ if (A === 0) {
322
+ ue = console.log, se = console.info, ce = console.warn, de = console.error, fe = console.group, ge = console.groupCollapsed, ve = console.groupEnd;
113
323
  var e = {
114
324
  configurable: !0,
115
325
  enumerable: !0,
116
- value: r,
326
+ value: s,
117
327
  writable: !0
118
328
  };
119
329
  Object.defineProperties(console, {
@@ -126,204 +336,204 @@ function Ne() {
126
336
  groupEnd: e
127
337
  });
128
338
  }
129
- P++;
339
+ A++;
130
340
  }
131
- function f() {
132
- if (P--, P === 0) {
341
+ function E() {
342
+ if (A--, A === 0) {
133
343
  var e = { configurable: !0, enumerable: !0, writable: !0 };
134
344
  Object.defineProperties(console, {
135
- log: b({}, e, { value: oe }),
136
- info: b({}, e, { value: te }),
137
- warn: b({}, e, { value: ne }),
138
- error: b({}, e, { value: re }),
139
- group: b({}, e, { value: ae }),
140
- groupCollapsed: b({}, e, { value: ie }),
141
- groupEnd: b({}, e, { value: le })
345
+ log: R({}, e, { value: ue }),
346
+ info: R({}, e, { value: se }),
347
+ warn: R({}, e, { value: ce }),
348
+ error: R({}, e, { value: de }),
349
+ group: R({}, e, { value: fe }),
350
+ groupCollapsed: R({}, e, { value: ge }),
351
+ groupEnd: R({}, e, { value: ve })
142
352
  });
143
353
  }
144
- 0 > P && console.error(
354
+ 0 > A && console.error(
145
355
  "disabledDepth fell below zero. This is a bug in React. Please file an issue."
146
356
  );
147
357
  }
148
358
  function v(e) {
149
- if (U === void 0)
359
+ if (F === void 0)
150
360
  try {
151
361
  throw Error();
152
- } catch (n) {
153
- var t = n.stack.trim().match(/\n( *(at )?)/);
154
- U = t && t[1] || "", ue = -1 < n.stack.indexOf(`
155
- at`) ? " (<anonymous>)" : -1 < n.stack.indexOf("@") ? "@unknown:0:0" : "";
362
+ } catch (a) {
363
+ var r = a.stack.trim().match(/\n( *(at )?)/);
364
+ F = r && r[1] || "", Ee = -1 < a.stack.indexOf(`
365
+ at`) ? " (<anonymous>)" : -1 < a.stack.indexOf("@") ? "@unknown:0:0" : "";
156
366
  }
157
367
  return `
158
- ` + U + e + ue;
368
+ ` + F + e + Ee;
159
369
  }
160
- function y(e, t) {
161
- if (!e || z) return "";
162
- var n = H.get(e);
163
- if (n !== void 0) return n;
164
- z = !0, n = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
165
- var u = null;
166
- u = T.H, T.H = null, i();
370
+ function m(e, r) {
371
+ if (!e || q) return "";
372
+ var a = G.get(e);
373
+ if (a !== void 0) return a;
374
+ q = !0, a = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
375
+ var f = null;
376
+ f = y.H, y.H = null, u();
167
377
  try {
168
- var d = {
378
+ var T = {
169
379
  DetermineComponentFrameRoot: function() {
170
380
  try {
171
- if (t) {
172
- var E = function() {
381
+ if (r) {
382
+ var C = function() {
173
383
  throw Error();
174
384
  };
175
- if (Object.defineProperty(E.prototype, "props", {
385
+ if (Object.defineProperty(C.prototype, "props", {
176
386
  set: function() {
177
387
  throw Error();
178
388
  }
179
389
  }), typeof Reflect == "object" && Reflect.construct) {
180
390
  try {
181
- Reflect.construct(E, []);
182
- } catch (w) {
183
- var R = w;
391
+ Reflect.construct(C, []);
392
+ } catch (P) {
393
+ var B = P;
184
394
  }
185
- Reflect.construct(e, [], E);
395
+ Reflect.construct(e, [], C);
186
396
  } else {
187
397
  try {
188
- E.call();
189
- } catch (w) {
190
- R = w;
398
+ C.call();
399
+ } catch (P) {
400
+ B = P;
191
401
  }
192
- e.call(E.prototype);
402
+ e.call(C.prototype);
193
403
  }
194
404
  } else {
195
405
  try {
196
406
  throw Error();
197
- } catch (w) {
198
- R = w;
407
+ } catch (P) {
408
+ B = P;
199
409
  }
200
- (E = e()) && typeof E.catch == "function" && E.catch(function() {
410
+ (C = e()) && typeof C.catch == "function" && C.catch(function() {
201
411
  });
202
412
  }
203
- } catch (w) {
204
- if (w && R && typeof w.stack == "string")
205
- return [w.stack, R.stack];
413
+ } catch (P) {
414
+ if (P && B && typeof P.stack == "string")
415
+ return [P.stack, B.stack];
206
416
  }
207
417
  return [null, null];
208
418
  }
209
419
  };
210
- d.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
211
- var s = Object.getOwnPropertyDescriptor(
212
- d.DetermineComponentFrameRoot,
420
+ T.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
421
+ var p = Object.getOwnPropertyDescriptor(
422
+ T.DetermineComponentFrameRoot,
213
423
  "name"
214
424
  );
215
- s && s.configurable && Object.defineProperty(
216
- d.DetermineComponentFrameRoot,
425
+ p && p.configurable && Object.defineProperty(
426
+ T.DetermineComponentFrameRoot,
217
427
  "name",
218
428
  { value: "DetermineComponentFrameRoot" }
219
429
  );
220
- var a = d.DetermineComponentFrameRoot(), m = a[0], C = a[1];
221
- if (m && C) {
222
- var g = m.split(`
223
- `), h = C.split(`
430
+ var c = T.DetermineComponentFrameRoot(), b = c[0], k = c[1];
431
+ if (b && k) {
432
+ var h = b.split(`
433
+ `), S = k.split(`
224
434
  `);
225
- for (a = s = 0; s < g.length && !g[s].includes(
435
+ for (c = p = 0; p < h.length && !h[p].includes(
226
436
  "DetermineComponentFrameRoot"
227
437
  ); )
228
- s++;
229
- for (; a < h.length && !h[a].includes(
438
+ p++;
439
+ for (; c < S.length && !S[c].includes(
230
440
  "DetermineComponentFrameRoot"
231
441
  ); )
232
- a++;
233
- if (s === g.length || a === h.length)
234
- for (s = g.length - 1, a = h.length - 1; 1 <= s && 0 <= a && g[s] !== h[a]; )
235
- a--;
236
- for (; 1 <= s && 0 <= a; s--, a--)
237
- if (g[s] !== h[a]) {
238
- if (s !== 1 || a !== 1)
442
+ c++;
443
+ if (p === h.length || c === S.length)
444
+ for (p = h.length - 1, c = S.length - 1; 1 <= p && 0 <= c && h[p] !== S[c]; )
445
+ c--;
446
+ for (; 1 <= p && 0 <= c; p--, c--)
447
+ if (h[p] !== S[c]) {
448
+ if (p !== 1 || c !== 1)
239
449
  do
240
- if (s--, a--, 0 > a || g[s] !== h[a]) {
241
- var S = `
242
- ` + g[s].replace(
450
+ if (p--, c--, 0 > c || h[p] !== S[c]) {
451
+ var O = `
452
+ ` + h[p].replace(
243
453
  " at new ",
244
454
  " at "
245
455
  );
246
- return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && H.set(e, S), S;
456
+ return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && G.set(e, O), O;
247
457
  }
248
- while (1 <= s && 0 <= a);
458
+ while (1 <= p && 0 <= c);
249
459
  break;
250
460
  }
251
461
  }
252
462
  } finally {
253
- z = !1, T.H = u, f(), Error.prepareStackTrace = n;
463
+ q = !1, y.H = f, E(), Error.prepareStackTrace = a;
254
464
  }
255
- return g = (g = e ? e.displayName || e.name : "") ? v(g) : "", typeof e == "function" && H.set(e, g), g;
465
+ return h = (h = e ? e.displayName || e.name : "") ? v(h) : "", typeof e == "function" && G.set(e, h), h;
256
466
  }
257
- function p(e) {
467
+ function l(e) {
258
468
  if (e == null) return "";
259
469
  if (typeof e == "function") {
260
- var t = e.prototype;
261
- return y(
470
+ var r = e.prototype;
471
+ return m(
262
472
  e,
263
- !(!t || !t.isReactComponent)
473
+ !(!r || !r.isReactComponent)
264
474
  );
265
475
  }
266
476
  if (typeof e == "string") return v(e);
267
477
  switch (e) {
268
- case B:
478
+ case U:
269
479
  return v("Suspense");
270
- case Y:
480
+ case W:
271
481
  return v("SuspenseList");
272
482
  }
273
483
  if (typeof e == "object")
274
484
  switch (e.$$typeof) {
275
- case M:
276
- return e = y(e.render, !1), e;
277
- case W:
278
- return p(e.type);
485
+ case I:
486
+ return e = m(e.render, !1), e;
279
487
  case $:
280
- t = e._payload, e = e._init;
488
+ return l(e.type);
489
+ case V:
490
+ r = e._payload, e = e._init;
281
491
  try {
282
- return p(e(t));
492
+ return l(e(r));
283
493
  } catch {
284
494
  }
285
495
  }
286
496
  return "";
287
497
  }
288
- function x() {
289
- var e = T.A;
498
+ function o() {
499
+ var e = y.A;
290
500
  return e === null ? null : e.getOwner();
291
501
  }
292
- function be(e) {
293
- if (ee.call(e, "key")) {
294
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
295
- if (t && t.isReactWarning) return !1;
502
+ function n(e) {
503
+ if (le.call(e, "key")) {
504
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
505
+ if (r && r.isReactWarning) return !1;
296
506
  }
297
507
  return e.key !== void 0;
298
508
  }
299
- function he(e, t) {
300
- function n() {
301
- se || (se = !0, console.error(
509
+ function i(e, r) {
510
+ function a() {
511
+ pe || (pe = !0, console.error(
302
512
  "%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://react.dev/link/special-props)",
303
- t
513
+ r
304
514
  ));
305
515
  }
306
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
307
- get: n,
516
+ a.isReactWarning = !0, Object.defineProperty(e, "key", {
517
+ get: a,
308
518
  configurable: !0
309
519
  });
310
520
  }
311
- function ye() {
312
- var e = o(this.type);
313
- return ce[e] || (ce[e] = !0, console.error(
521
+ function w() {
522
+ var e = t(this.type);
523
+ return me[e] || (me[e] = !0, console.error(
314
524
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
315
525
  )), e = this.props.ref, e !== void 0 ? e : null;
316
526
  }
317
- function Ce(e, t, n, u, d, s) {
318
- return n = s.ref, e = {
319
- $$typeof: j,
527
+ function Se(e, r, a, f, T, p) {
528
+ return a = p.ref, e = {
529
+ $$typeof: z,
320
530
  type: e,
321
- key: t,
322
- props: s,
323
- _owner: d
324
- }, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
531
+ key: r,
532
+ props: p,
533
+ _owner: T
534
+ }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
325
535
  enumerable: !1,
326
- get: ye
536
+ get: w
327
537
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
328
538
  configurable: !1,
329
539
  enumerable: !1,
@@ -336,336 +546,322 @@ function Ne() {
336
546
  value: null
337
547
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
338
548
  }
339
- function I(e, t, n, u, d, s) {
340
- if (typeof e == "string" || typeof e == "function" || e === N || e === Z || e === X || e === B || e === Y || e === Ae || typeof e == "object" && e !== null && (e.$$typeof === $ || e.$$typeof === W || e.$$typeof === K || e.$$typeof === Q || e.$$typeof === M || e.$$typeof === _e || e.getModuleId !== void 0)) {
341
- var a = t.children;
342
- if (a !== void 0)
343
- if (u)
344
- if (L(a)) {
345
- for (u = 0; u < a.length; u++)
346
- J(a[u], e);
347
- Object.freeze && Object.freeze(a);
549
+ function K(e, r, a, f, T, p) {
550
+ if (typeof e == "string" || typeof e == "function" || e === Y || e === te || e === ne || e === U || e === W || e === Oe || typeof e == "object" && e !== null && (e.$$typeof === V || e.$$typeof === $ || e.$$typeof === ae || e.$$typeof === re || e.$$typeof === I || e.$$typeof === je || e.getModuleId !== void 0)) {
551
+ var c = r.children;
552
+ if (c !== void 0)
553
+ if (f)
554
+ if (H(c)) {
555
+ for (f = 0; f < c.length; f++)
556
+ ee(c[f], e);
557
+ Object.freeze && Object.freeze(c);
348
558
  } else
349
559
  console.error(
350
560
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
351
561
  );
352
- else J(a, e);
562
+ else ee(c, e);
353
563
  } else
354
- a = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? u = "null" : L(e) ? u = "array" : e !== void 0 && e.$$typeof === j ? (u = "<" + (o(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : u = typeof e, console.error(
564
+ c = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? f = "null" : H(e) ? f = "array" : e !== void 0 && e.$$typeof === z ? (f = "<" + (t(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : f = typeof e, console.error(
355
565
  "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
356
- u,
357
- a
566
+ f,
567
+ c
358
568
  );
359
- if (ee.call(t, "key")) {
360
- a = o(e);
361
- var m = Object.keys(t).filter(function(g) {
362
- return g !== "key";
569
+ if (le.call(r, "key")) {
570
+ c = t(e);
571
+ var b = Object.keys(r).filter(function(h) {
572
+ return h !== "key";
363
573
  });
364
- u = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", fe[a + u] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
574
+ f = 0 < b.length ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}", we[c + f] || (b = 0 < b.length ? "{" + b.join(": ..., ") + ": ...}" : "{}", console.error(
365
575
  `A props object containing a "key" prop is being spread into JSX:
366
576
  let props = %s;
367
577
  <%s {...props} />
368
578
  React keys must be passed directly to JSX without using spread:
369
579
  let props = %s;
370
580
  <%s key={someKey} {...props} />`,
371
- u,
372
- a,
373
- m,
374
- a
375
- ), fe[a + u] = !0);
581
+ f,
582
+ c,
583
+ b,
584
+ c
585
+ ), we[c + f] = !0);
376
586
  }
377
- if (a = null, n !== void 0 && (c(n), a = "" + n), be(t) && (c(t.key), a = "" + t.key), "key" in t) {
378
- n = {};
379
- for (var C in t)
380
- C !== "key" && (n[C] = t[C]);
381
- } else n = t;
382
- return a && he(
383
- n,
587
+ if (c = null, a !== void 0 && (g(a), c = "" + a), n(r) && (g(r.key), c = "" + r.key), "key" in r) {
588
+ a = {};
589
+ for (var k in r)
590
+ k !== "key" && (a[k] = r[k]);
591
+ } else a = r;
592
+ return c && i(
593
+ a,
384
594
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
385
- ), Ce(e, a, s, d, x(), n);
595
+ ), Se(e, c, p, T, o(), a);
386
596
  }
387
- function J(e, t) {
388
- if (typeof e == "object" && e && e.$$typeof !== pe) {
389
- if (L(e))
390
- for (var n = 0; n < e.length; n++) {
391
- var u = e[n];
392
- O(u) && G(u, t);
597
+ function ee(e, r) {
598
+ if (typeof e == "object" && e && e.$$typeof !== Ne) {
599
+ if (H(e))
600
+ for (var a = 0; a < e.length; a++) {
601
+ var f = e[a];
602
+ L(f) && oe(f, r);
393
603
  }
394
- else if (O(e))
604
+ else if (L(e))
395
605
  e._store && (e._store.validated = 1);
396
- else if (e === null || typeof e != "object" ? n = null : (n = D && e[D] || e["@@iterator"], n = typeof n == "function" ? n : null), typeof n == "function" && n !== e.entries && (n = n.call(e), n !== e))
397
- for (; !(e = n.next()).done; )
398
- O(e.value) && G(e.value, t);
606
+ else if (e === null || typeof e != "object" ? a = null : (a = ie && e[ie] || e["@@iterator"], a = typeof a == "function" ? a : null), typeof a == "function" && a !== e.entries && (a = a.call(e), a !== e))
607
+ for (; !(e = a.next()).done; )
608
+ L(e.value) && oe(e.value, r);
399
609
  }
400
610
  }
401
- function O(e) {
402
- return typeof e == "object" && e !== null && e.$$typeof === j;
611
+ function L(e) {
612
+ return typeof e == "object" && e !== null && e.$$typeof === z;
403
613
  }
404
- function G(e, t) {
405
- if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, t = Pe(t), !de[t])) {
406
- de[t] = !0;
407
- var n = "";
408
- e && e._owner != null && e._owner !== x() && (n = null, typeof e._owner.tag == "number" ? n = o(e._owner.type) : typeof e._owner.name == "string" && (n = e._owner.name), n = " It was passed a child from " + n + ".");
409
- var u = T.getCurrentStack;
410
- T.getCurrentStack = function() {
411
- var d = p(e.type);
412
- return u && (d += u() || ""), d;
614
+ function oe(e, r) {
615
+ if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, r = ke(r), !Te[r])) {
616
+ Te[r] = !0;
617
+ var a = "";
618
+ e && e._owner != null && e._owner !== o() && (a = null, typeof e._owner.tag == "number" ? a = t(e._owner.type) : typeof e._owner.name == "string" && (a = e._owner.name), a = " It was passed a child from " + a + ".");
619
+ var f = y.getCurrentStack;
620
+ y.getCurrentStack = function() {
621
+ var T = l(e.type);
622
+ return f && (T += f() || ""), T;
413
623
  }, console.error(
414
624
  'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
415
- t,
416
- n
417
- ), T.getCurrentStack = u;
625
+ r,
626
+ a
627
+ ), y.getCurrentStack = f;
418
628
  }
419
629
  }
420
- function Pe(e) {
421
- var t = "", n = x();
422
- return n && (n = o(n.type)) && (t = `
630
+ function ke(e) {
631
+ var r = "", a = o();
632
+ return a && (a = t(a.type)) && (r = `
423
633
 
424
- Check the render method of \`` + n + "`."), t || (e = o(e)) && (t = `
634
+ Check the render method of \`` + a + "`."), r || (e = t(e)) && (r = `
425
635
 
426
- Check the top-level render call using <` + e + ">."), t;
636
+ Check the top-level render call using <` + e + ">."), r;
427
637
  }
428
- var Se = xe, j = Symbol.for("react.transitional.element"), ke = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), Z = Symbol.for("react.profiler"), Q = Symbol.for("react.consumer"), K = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), Y = Symbol.for("react.suspense_list"), W = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), Ae = Symbol.for("react.offscreen"), D = Symbol.iterator, Re = Symbol.for("react.client.reference"), T = Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, b = Object.assign, _e = Symbol.for("react.client.reference"), L = Array.isArray, P = 0, oe, te, ne, re, ae, ie, le;
429
- r.__reactDisabledLog = !0;
430
- var U, ue, z = !1, H = new (typeof WeakMap == "function" ? WeakMap : Map)(), pe = Symbol.for("react.client.reference"), se, ce = {}, fe = {}, de = {};
431
- A.Fragment = N, A.jsx = function(e, t, n, u, d) {
432
- return I(e, t, n, !1, u, d);
433
- }, A.jsxs = function(e, t, n, u, d) {
434
- return I(e, t, n, !0, u, d);
638
+ var _e = Be, z = Symbol.for("react.transitional.element"), Ae = Symbol.for("react.portal"), Y = Symbol.for("react.fragment"), ne = Symbol.for("react.strict_mode"), te = Symbol.for("react.profiler"), re = Symbol.for("react.consumer"), ae = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), U = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), Oe = Symbol.for("react.offscreen"), ie = Symbol.iterator, xe = Symbol.for("react.client.reference"), y = _e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, le = Object.prototype.hasOwnProperty, R = Object.assign, je = Symbol.for("react.client.reference"), H = Array.isArray, A = 0, ue, se, ce, de, fe, ge, ve;
639
+ s.__reactDisabledLog = !0;
640
+ var F, Ee, q = !1, G = new (typeof WeakMap == "function" ? WeakMap : Map)(), Ne = Symbol.for("react.client.reference"), pe, me = {}, we = {}, Te = {};
641
+ j.Fragment = Y, j.jsx = function(e, r, a, f, T) {
642
+ return K(e, r, a, !1, f, T);
643
+ }, j.jsxs = function(e, r, a, f, T) {
644
+ return K(e, r, a, !0, f, T);
435
645
  };
436
- }()), A;
437
- }
438
- var me;
439
- function Me() {
440
- return me || (me = 1, process.env.NODE_ENV === "production" ? _.exports = je() : _.exports = Ne()), _.exports;
441
- }
442
- var Be = Me();
443
- function Ye(o) {
444
- return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
445
- }
446
- var We = function(o, l, c) {
447
- var r = document.head || document.getElementsByTagName("head")[0], i = document.createElement("script");
448
- typeof l == "function" && (c = l, l = {}), l = l || {}, c = c || function() {
449
- }, i.type = l.type || "text/javascript", i.charset = l.charset || "utf8", i.async = "async" in l ? !!l.async : !0, i.src = o, l.attrs && $e(i, l.attrs), l.text && (i.text = "" + l.text);
450
- var f = "onload" in i ? we : Le;
451
- f(i, c), i.onload || we(i, c), r.appendChild(i);
452
- };
453
- function $e(o, l) {
454
- for (var c in l)
455
- o.setAttribute(c, l[c]);
456
- }
457
- function we(o, l) {
458
- o.onload = function() {
459
- this.onerror = this.onload = null, l(null, o);
460
- }, o.onerror = function() {
461
- this.onerror = this.onload = null, l(new Error("Failed to load " + this.src), o);
462
- };
463
- }
464
- function Le(o, l) {
465
- o.onreadystatechange = function() {
466
- this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, l(null, o));
467
- };
468
- }
469
- const Te = /* @__PURE__ */ Ye(We), F = "https://v3.email-assets.topol.io/loader/build.js", Ue = "https://v3.develop.email-assets.topol.io/loader/build.js", ze = "https://v3.develop.email-assets.topol.io/loader/build.js";
470
- function He(o = "production") {
471
- switch (o) {
472
- case "dev":
473
- return Ue;
474
- case "staging":
475
- return ze;
476
- case "production":
477
- return F;
478
- default:
479
- return `https://d10h8ga60f7b91.cloudfront.net/preview-app-${o}/loader/build.js`;
480
- }
646
+ }()), j;
481
647
  }
482
- async function Ve(o) {
483
- return new Promise((l, c) => {
484
- Te(F, (r) => {
485
- r !== null && c(r), window.TopolPlugin.init(o), l(!0);
486
- });
487
- });
648
+ var Ce;
649
+ function Je() {
650
+ return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? M.exports = qe() : M.exports = Ge()), M.exports;
488
651
  }
489
- const Ee = {
490
- init: (o, l) => new Promise((c, r) => {
491
- const i = He(l == null ? void 0 : l.stage);
492
- Te(i, async (f) => {
493
- if (f !== null) {
494
- if (i !== F)
495
- try {
496
- return await Ve(o), c(!0);
497
- } catch (v) {
498
- r(v);
499
- }
500
- r(f);
501
- }
502
- window.TopolPlugin.init(o), c(!0);
503
- });
504
- }),
505
- save: () => {
506
- window.TopolPlugin.save();
507
- },
508
- load: (o) => {
509
- window.TopolPlugin.load(o);
510
- },
511
- togglePreview: () => {
512
- window.TopolPlugin.togglePreview();
513
- },
514
- togglePreviewSize: () => {
515
- window.TopolPlugin.togglePreviewSize();
516
- },
517
- chooseFile: (o) => {
518
- window.TopolPlugin.chooseFile(o);
519
- },
520
- undo: () => {
521
- window.TopolPlugin.undo();
522
- },
523
- redo: () => {
524
- window.TopolPlugin.redo();
525
- },
526
- destroy: () => {
527
- window.TopolPlugin.destroy();
528
- },
529
- setSavedBlocks: (o) => {
530
- window.TopolPlugin.setSavedBlocks(o);
531
- },
532
- setPreviewHTML: (o) => {
533
- window.TopolPlugin.setPreviewHTML(o);
534
- },
535
- createNotification: (o) => {
536
- window.TopolPlugin.createNotification(o);
537
- },
538
- setActiveMembers: (o) => {
539
- window.TopolPlugin.setActiveMembers(o);
540
- },
541
- changeEmailToMobile: () => {
542
- window.TopolPlugin.changeEmailToMobile();
543
- },
544
- changeEmailToDesktop: () => {
545
- window.TopolPlugin.changeEmailToDesktop();
546
- },
547
- toggleBlocksAndStructuresVisibility: () => {
548
- window.TopolPlugin.toggleBlocksAndStructuresVisibility();
549
- },
550
- updateCustomBlockContent: (o) => {
551
- window.TopolPlugin.updateCustomBlockContent(o);
552
- },
553
- refreshComments: (o) => {
554
- window.TopolPlugin.refreshComments(o);
555
- },
556
- refreshSyncedRows: () => {
557
- window.TopolPlugin.refreshSyncedRows();
558
- },
559
- openPremadeTemplatesSelection: () => {
560
- window.TopolPlugin.openPremadeTemplatesSelection();
561
- },
562
- updateApiAuthorizationHeader: (o) => {
563
- window.TopolPlugin.updateApiAuthorizationHeader(o);
564
- },
565
- setTemplateName: (o) => {
566
- window.TopolPlugin.setTemplateName(o);
567
- },
568
- toggleChatAI: () => {
569
- window.TopolPlugin.toggleChatAI();
570
- },
571
- toggleAutosaves: () => {
572
- window.TopolPlugin.toggleAutosaves();
573
- },
574
- toggleComments: () => {
575
- window.TopolPlugin.toggleComments();
576
- },
577
- createLanguage: (o) => {
578
- window.TopolPlugin.createLanguage(o);
579
- },
580
- setPrimaryLanguage: (o) => {
581
- window.TopolPlugin.setPrimaryLanguage(o);
582
- },
583
- deleteLanguage: (o) => {
584
- window.TopolPlugin.deleteLanguage(o);
585
- },
586
- selectLanguage: (o) => {
587
- window.TopolPlugin.selectLanguage(o);
588
- }
589
- }, qe = "editor";
590
- let V = !1, q = !1;
591
- function Ie(o) {
592
- const l = () => {
593
- const c = {
594
- onSave(r, i) {
595
- o.onSave !== void 0 && o.onSave(r, i);
652
+ var Q = Je();
653
+ const ye = "topol-email-editor-id";
654
+ function Xe(t) {
655
+ const d = _(!1), g = _(!1), s = _(t);
656
+ return s.current = t, D(() => d.current ? void 0 : (d.current = !0, (async () => {
657
+ const E = s.current, v = {
658
+ onSave(l, o) {
659
+ var n, i;
660
+ (i = (n = s.current).onSave) == null || i.call(n, l, o);
596
661
  },
597
- onSaveAndClose(r, i) {
598
- o.onSaveAndClose !== void 0 && o.onSaveAndClose(r, i);
662
+ onSaveAndClose(l, o) {
663
+ var n, i;
664
+ (i = (n = s.current).onSaveAndClose) == null || i.call(n, l, o);
599
665
  },
600
- onTestSend(r, i, f) {
601
- o.onTestSend !== void 0 && o.onTestSend(r, i, f);
666
+ onTestSend(l, o, n) {
667
+ var i, w;
668
+ (w = (i = s.current).onTestSend) == null || w.call(i, l, o, n);
602
669
  },
603
670
  onOpenFileManager() {
604
- o.onOpenFileManager !== void 0 && o.onOpenFileManager();
671
+ var l, o;
672
+ (o = (l = s.current).onOpenFileManager) == null || o.call(l);
605
673
  },
606
674
  onLoaded() {
607
- o.onLoaded !== void 0 && o.onLoaded();
675
+ var l, o;
676
+ (o = (l = s.current).onLoaded) == null || o.call(l);
608
677
  },
609
- onBlockSave(r) {
610
- o.onBlockSave !== void 0 && o.onBlockSave(r);
678
+ onBlockSave(l) {
679
+ var o, n;
680
+ (n = (o = s.current).onBlockSave) == null || n.call(o, l);
611
681
  },
612
- onBlockRemove(r) {
613
- o.onBlockRemove !== void 0 && o.onBlockRemove(r);
682
+ onBlockRemove(l) {
683
+ var o, n;
684
+ (n = (o = s.current).onBlockRemove) == null || n.call(o, l);
614
685
  },
615
- onBlockEdit(r) {
616
- o.onBlockEdit !== void 0 && o.onBlockEdit(r);
686
+ onBlockEdit(l) {
687
+ var o, n;
688
+ (n = (o = s.current).onBlockEdit) == null || n.call(o, l);
617
689
  },
618
690
  onInit() {
619
- o.onInit !== void 0 && o.onInit(), V = !1, q = !0;
691
+ var l, o;
692
+ (o = (l = s.current).onInit) == null || o.call(l), g.current = !0;
620
693
  },
621
- onUndoChange(r) {
622
- o.onUndoChange !== void 0 && o.onUndoChange(r);
694
+ onUndoChange(l) {
695
+ var o, n;
696
+ (n = (o = s.current).onUndoChange) == null || n.call(o, l);
623
697
  },
624
- onRedoChange(r) {
625
- o.onRedoChange !== void 0 && o.onRedoChange(r);
698
+ onRedoChange(l) {
699
+ var o, n;
700
+ (n = (o = s.current).onRedoChange) == null || n.call(o, l);
626
701
  },
627
- onPreview(r) {
628
- o.onPreview !== void 0 && o.onPreview(r);
702
+ onPreview(l) {
703
+ var o, n;
704
+ (n = (o = s.current).onPreview) == null || n.call(o, l);
629
705
  },
630
- onAlert(r) {
631
- o.onAlert !== void 0 && o.onAlert(r);
706
+ onAlert(l) {
707
+ var o, n;
708
+ (n = (o = s.current).onAlert) == null || n.call(o, l);
632
709
  },
633
710
  onClose() {
634
- o.onClose !== void 0 && o.onClose();
711
+ var l, o;
712
+ (o = (l = s.current).onClose) == null || o.call(l);
713
+ },
714
+ onBannerClick(l, o) {
715
+ var n, i;
716
+ (i = (n = s.current).onBannerClick) == null || i.call(n, l, o);
635
717
  },
636
- onEdittedWithoutSaveChanged(r) {
637
- o.onEdittedWithoutSaveChanged !== void 0 && o.onEdittedWithoutSaveChanged(r);
718
+ onEdittedWithoutSaveChanged(l) {
719
+ var o, n;
720
+ (n = (o = s.current).onEdittedWithoutSaveChanged) == null || n.call(o, l);
638
721
  },
639
- onOpenCustomBlockDialog(r) {
640
- o.onOpenCustomBlockDialog !== void 0 && o.onOpenCustomBlockDialog(r);
722
+ onOpenCustomBlockDialog(l) {
723
+ var o, n;
724
+ (n = (o = s.current).onOpenCustomBlockDialog) == null || n.call(o, l);
641
725
  },
642
- onTemplateRename(r) {
643
- o.onTemplateRename !== void 0 && o.onTemplateRename(r);
726
+ onTemplateRename(l) {
727
+ var o, n;
728
+ (n = (o = s.current).onTemplateRename) == null || n.call(o, l);
644
729
  },
645
- updateTestingEmailAddresses(r) {
646
- o.updateTestingEmailAddresses !== void 0 && o.updateTestingEmailAddresses(r);
730
+ updateTestingEmailAddresses(l) {
731
+ var o, n;
732
+ (n = (o = s.current).updateTestingEmailAddresses) == null || n.call(o, l);
647
733
  },
648
- onError(r, i) {
649
- o.onError !== void 0 && o.onError(r, i);
734
+ onError(l, o) {
735
+ var n, i;
736
+ (i = (n = s.current).onError) == null || i.call(n, l, o);
650
737
  }
738
+ }, m = {
739
+ id: "#" + ye,
740
+ ...E.options,
741
+ callbacks: v
651
742
  };
652
- return { id: "#" + qe, ...o.options, callbacks: { ...c } };
653
- };
654
- return Oe(() => (V || (async () => {
655
- V = !0;
656
- const r = l();
657
- await Ee.init(r, { stage: o.stage || "production" });
658
- })(), () => {
659
- q && (Ee.destroy(), q = !1);
660
- }), []), /* @__PURE__ */ Be.jsx(
743
+ await X.init(m, { stage: E.stage || "production" });
744
+ })().catch((E) => {
745
+ var v, m;
746
+ (m = (v = s.current).onError) == null || m.call(v, "init", (E == null ? void 0 : E.message) || "Failed to initialize editor"), console.error("[@topol.io/editor-react] EmailEditor initialization failed:", E);
747
+ }), () => {
748
+ g.current && (X.destroy(), g.current = !1), d.current = !1;
749
+ }), []), /* @__PURE__ */ Q.jsx(
750
+ "div",
751
+ {
752
+ id: ye,
753
+ style: { position: "absolute", height: "100vh", width: "100%" }
754
+ }
755
+ );
756
+ }
757
+ const Re = "topol-landing-page-editor-id", De = Me((t, d) => {
758
+ const g = _(!1), s = _(null), u = _(t);
759
+ return u.current = t, Le(d, () => ({
760
+ load(E) {
761
+ var v;
762
+ (v = s.current) == null || v.load(E);
763
+ }
764
+ })), D(() => g.current ? void 0 : (g.current = !0, (async () => {
765
+ const v = u.current, m = {
766
+ onSave(o, n) {
767
+ var i, w;
768
+ (w = (i = u.current).onSave) == null || w.call(i, o, n);
769
+ },
770
+ onSaveAndClose(o, n) {
771
+ var i, w;
772
+ (w = (i = u.current).onSaveAndClose) == null || w.call(i, o, n);
773
+ },
774
+ onOpenFileManager() {
775
+ var o, n;
776
+ (n = (o = u.current).onOpenFileManager) == null || n.call(o);
777
+ },
778
+ onLoaded() {
779
+ var o, n;
780
+ (n = (o = u.current).onLoaded) == null || n.call(o);
781
+ },
782
+ onBlockSave(o) {
783
+ var n, i;
784
+ (i = (n = u.current).onBlockSave) == null || i.call(n, o);
785
+ },
786
+ onBlockRemove(o) {
787
+ var n, i;
788
+ (i = (n = u.current).onBlockRemove) == null || i.call(n, o);
789
+ },
790
+ onBlockEdit(o) {
791
+ var n, i;
792
+ (i = (n = u.current).onBlockEdit) == null || i.call(n, o);
793
+ },
794
+ onInit() {
795
+ var o, n;
796
+ (n = (o = u.current).onInit) == null || n.call(o);
797
+ },
798
+ onClose() {
799
+ var o, n;
800
+ (n = (o = u.current).onClose) == null || n.call(o);
801
+ },
802
+ onUndoChange(o) {
803
+ var n, i;
804
+ (i = (n = u.current).onUndoChange) == null || i.call(n, o);
805
+ },
806
+ onRedoChange(o) {
807
+ var n, i;
808
+ (i = (n = u.current).onRedoChange) == null || i.call(n, o);
809
+ },
810
+ onPreview(o) {
811
+ var n, i;
812
+ (i = (n = u.current).onPreview) == null || i.call(n, o);
813
+ },
814
+ onAlert(o) {
815
+ var n, i;
816
+ (i = (n = u.current).onAlert) == null || i.call(n, o);
817
+ },
818
+ onBannerClick(o, n) {
819
+ var i, w;
820
+ (w = (i = u.current).onBannerClick) == null || w.call(i, o, n);
821
+ },
822
+ onEdittedWithoutSaveChanged(o) {
823
+ var n, i;
824
+ (i = (n = u.current).onEdittedWithoutSaveChanged) == null || i.call(n, o);
825
+ },
826
+ onOpenCustomBlockDialog(o) {
827
+ var n, i;
828
+ (i = (n = u.current).onOpenCustomBlockDialog) == null || i.call(n, o);
829
+ },
830
+ onTemplateRename(o) {
831
+ var n, i;
832
+ (i = (n = u.current).onTemplateRename) == null || i.call(n, o);
833
+ },
834
+ onError(o, n) {
835
+ var i, w;
836
+ (w = (i = u.current).onError) == null || w.call(i, o, n);
837
+ }
838
+ }, l = await Fe.init({ config: v.options, ...m }, { stage: v.stage || "production" });
839
+ s.current = l, l.render("#" + Re);
840
+ })().catch((v) => {
841
+ var m, l;
842
+ (l = (m = u.current).onError) == null || l.call(m, "init", (v == null ? void 0 : v.message) || "Failed to initialize editor"), console.error("[@topol.io/editor-react] LandingPageEditor initialization failed:", v);
843
+ }), () => {
844
+ var v;
845
+ (v = s.current) == null || v.destroy(), s.current = null, g.current = !1;
846
+ }), []), /* @__PURE__ */ Q.jsx(
661
847
  "div",
662
848
  {
663
- id: "editor",
849
+ id: Re,
664
850
  style: { position: "absolute", height: "100vh", width: "100%" }
665
851
  }
666
852
  );
853
+ });
854
+ De.displayName = "LandingPageEditor";
855
+ function Ke(t) {
856
+ return D(() => {
857
+ console.warn("[@topol.io/editor-react] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.");
858
+ }, []), /* @__PURE__ */ Q.jsx(Xe, { ...t });
667
859
  }
668
860
  export {
669
- Ee as TopolPlugin,
670
- Ie as default
861
+ X as CoreEmailEditor,
862
+ Fe as CoreLandingPageEditor,
863
+ Xe as EmailEditor,
864
+ De as LandingPageEditor,
865
+ Ke as TopolEditor,
866
+ Qe as TopolPlugin
671
867
  };