@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33

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 (130) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +161 -156
  3. package/dist/accordionComponent/index.umd.js +9 -9
  4. package/dist/aiChat/chatManager.d.ts +15 -0
  5. package/dist/aiChat/clientTools.d.ts +3 -3
  6. package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
  7. package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
  8. package/dist/aiChat/components/AiChatError.d.ts +2 -1
  9. package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
  10. package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
  11. package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
  12. package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
  13. package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
  14. package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
  15. package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
  16. package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
  17. package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
  18. package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
  19. package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
  20. package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
  21. package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
  22. package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
  23. package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
  24. package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
  25. package/dist/aiChat/components/index.d.ts +24 -25
  26. package/dist/aiChat/components/utils.d.ts +12 -4
  27. package/dist/aiChat/index.cjs.d.ts +5 -0
  28. package/dist/aiChat/index.cjs.js +453 -0
  29. package/dist/aiChat/index.d.ts +4 -3
  30. package/dist/aiChat/index.es.d.ts +5 -0
  31. package/dist/aiChat/index.es.js +30930 -0
  32. package/dist/aiChat/index.js +453 -0
  33. package/dist/aiChat/index.umd.js +453 -0
  34. package/dist/aiChat/locales/en.d.ts +64 -0
  35. package/dist/aiChat/server/index.cjs.d.ts +4 -0
  36. package/dist/aiChat/server/index.cjs.js +309 -0
  37. package/dist/aiChat/server/index.d.ts +0 -50
  38. package/dist/aiChat/server/index.es.d.ts +4 -0
  39. package/dist/aiChat/server/index.es.js +876 -0
  40. package/dist/aiChat/server/index.js +309 -0
  41. package/dist/aiChat/server/index.umd.js +309 -0
  42. package/dist/aiChat/server/stream.d.ts +0 -6
  43. package/dist/aiChat/server/tools.d.ts +157 -51
  44. package/dist/aiChat/server/types.d.ts +108 -64
  45. package/dist/aiChat/types.d.ts +148 -108
  46. package/dist/aiChat/typesSchema.d.ts +238 -25
  47. package/dist/animationComponent/index.cjs.js +3 -3
  48. package/dist/animationComponent/index.es.js +174 -169
  49. package/dist/animationComponent/index.umd.js +3 -3
  50. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  51. package/dist/canvasAbsoluteMode/index.es.js +161 -156
  52. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  53. package/dist/canvasEmptyState/index.cjs.js +1 -1
  54. package/dist/canvasEmptyState/index.es.js +113 -108
  55. package/dist/canvasEmptyState/index.umd.js +1 -1
  56. package/dist/canvasFullSize/index.cjs.js +9 -9
  57. package/dist/canvasFullSize/index.es.js +137 -132
  58. package/dist/canvasFullSize/index.umd.js +9 -9
  59. package/dist/canvasGridMode/index.cjs.js +4 -4
  60. package/dist/canvasGridMode/index.es.js +168 -163
  61. package/dist/canvasGridMode/index.umd.js +8 -8
  62. package/dist/canvasScreenshot/index.cjs.js +1 -1
  63. package/dist/canvasScreenshot/index.es.js +132 -127
  64. package/dist/canvasScreenshot/index.umd.js +1 -1
  65. package/dist/dataSourceEjs/index.cjs.js +5 -5
  66. package/dist/dataSourceEjs/index.es.js +151 -146
  67. package/dist/dataSourceEjs/index.umd.js +5 -5
  68. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  69. package/dist/dataSourceHandlebars/index.es.js +91 -86
  70. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  71. package/dist/dialogComponent/index.cjs.js +16 -16
  72. package/dist/dialogComponent/index.es.js +117 -112
  73. package/dist/dialogComponent/index.umd.js +16 -16
  74. package/dist/flexComponent/index.cjs.js +11 -11
  75. package/dist/flexComponent/index.es.js +416 -411
  76. package/dist/flexComponent/index.umd.js +11 -11
  77. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  78. package/dist/fsLightboxComponent/index.es.js +152 -147
  79. package/dist/fsLightboxComponent/index.umd.js +3 -3
  80. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  81. package/dist/googleFontsAssetProvider/index.es.js +127 -122
  82. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  83. package/dist/iconifyComponent/index.cjs.js +2 -2
  84. package/dist/iconifyComponent/index.es.js +170 -165
  85. package/dist/iconifyComponent/index.umd.js +2 -2
  86. package/dist/index.cjs.js +1 -1
  87. package/dist/index.es.js +27 -22
  88. package/dist/index.umd.js +1 -1
  89. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  90. package/dist/layoutSidebarButtons/index.es.js +156 -151
  91. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  92. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  93. package/dist/lightGalleryComponent/index.es.js +197 -192
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/linkImageComponent/index.cjs.js +2 -2
  96. package/dist/linkImageComponent/index.es.js +86 -81
  97. package/dist/linkImageComponent/index.umd.js +2 -2
  98. package/dist/listPagesComponent/index.cjs.js +5 -5
  99. package/dist/listPagesComponent/index.es.js +121 -116
  100. package/dist/listPagesComponent/index.umd.js +5 -5
  101. package/dist/presetPrintable/index.cjs.js +4 -4
  102. package/dist/presetPrintable/index.es.js +180 -175
  103. package/dist/presetPrintable/index.umd.js +4 -4
  104. package/dist/prosemirror/index.cjs.js +6 -6
  105. package/dist/prosemirror/index.es.js +128 -123
  106. package/dist/prosemirror/index.umd.js +8 -8
  107. package/dist/rendererReact/index.cjs.js +1 -1
  108. package/dist/rendererReact/index.es.js +127 -122
  109. package/dist/rendererReact/index.js +1 -1
  110. package/dist/rendererReact/index.umd.js +1 -1
  111. package/dist/rteTinyMce/index.cjs.js +2 -2
  112. package/dist/rteTinyMce/index.es.js +160 -155
  113. package/dist/rteTinyMce/index.umd.js +2 -2
  114. package/dist/shapeDividerComponent/index.cjs.js +25 -25
  115. package/dist/shapeDividerComponent/index.es.js +127 -122
  116. package/dist/shapeDividerComponent/index.umd.js +25 -25
  117. package/dist/swiperComponent/index.cjs.js +9 -9
  118. package/dist/swiperComponent/index.es.js +197 -192
  119. package/dist/swiperComponent/index.umd.js +9 -9
  120. package/dist/tableComponent/index.cjs.js +1 -1
  121. package/dist/tableComponent/index.es.js +227 -222
  122. package/dist/tableComponent/index.umd.js +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/utils.d.ts +12 -1
  125. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  126. package/dist/youtubeAssetProvider/index.es.js +124 -119
  127. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  128. package/package.json +5 -2
  129. package/dist/aiChat/components/AiChatInput.d.ts +0 -17
  130. package/dist/aiChat/server/stream-utils.d.ts +0 -16
@@ -1,8 +1,8 @@
1
- const _ = "app.grapesjs.com", N = "app-stage.grapesjs.com", D = "app2.grapesjs.com", R = "app-stage2.grapesjs.com", C = [
2
- _,
1
+ const D = "app.grapesjs.com", C = "app-stage.grapesjs.com", S = "app2.grapesjs.com", x = "app-stage2.grapesjs.com", v = [
3
2
  D,
4
- N,
5
- R,
3
+ S,
4
+ C,
5
+ x,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,83 +11,88 @@ const _ = "app.grapesjs.com", N = "app-stage.grapesjs.com", D = "app2.grapesjs.c
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], S = "license:check:start", x = "license:check:end", O = () => typeof window < "u", U = ({ isDev: e, isStage: s }) => `${e ? "" : `https://${s ? N : _}`}/api`, W = () => {
15
- const e = O() && window.location.hostname;
16
- return !!e && (C.includes(e) || C.some((s) => e.endsWith(s)));
14
+ ], O = "license:check:start", U = "license:check:end", k = () => typeof window < "u", W = ({
15
+ isDev: t,
16
+ isStage: s,
17
+ isPlatform: i
18
+ }) => `${t ? "" : `https://${s ? C : D}`}/${i ? "platform-api" : "api"}`, j = () => {
19
+ const t = k() && window.location.hostname;
20
+ return !!t && (v.includes(t) || v.some((s) => t.endsWith(s)));
17
21
  };
18
- async function j({
19
- path: e,
22
+ async function B({
23
+ path: t,
20
24
  baseApiUrl: s,
21
25
  method: i = "GET",
22
- headers: t = {},
26
+ headers: e = {},
23
27
  params: o,
24
28
  body: a
25
29
  }) {
26
- const c = `${s || U({ isDev: !1, isStage: !1 })}${e}`, r = {
30
+ const c = `${s || W({ isDev: !1, isStage: !1 })}${t}`, u = {
27
31
  method: i,
28
32
  headers: {
29
33
  "Content-Type": "application/json",
30
- ...t
34
+ ...e
31
35
  }
32
36
  };
33
- a && (r.body = JSON.stringify(a));
34
- const u = o ? new URLSearchParams(o).toString() : "", n = u ? `?${u}` : "", l = await fetch(`${c}${n}`, r);
35
- if (!l.ok)
36
- throw new Error(`HTTP error! status: ${l.status}`);
37
- return l.json();
37
+ a && (u.body = JSON.stringify(a));
38
+ const r = o ? new URLSearchParams(o).toString() : "", p = r ? `?${r}` : "", n = await fetch(`${c}${p}`, u);
39
+ if (!n.ok)
40
+ throw new Error(`HTTP error! status: ${n.status}`);
41
+ return n.json();
38
42
  }
39
- var f = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(f || {});
40
- const M = {
41
- [f.free]: 0,
42
- [f.startup]: 10,
43
- [f.business]: 20,
44
- [f.enterprise]: 30
43
+ var y = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(y || {});
44
+ const _ = {
45
+ [y.free]: 0,
46
+ [y.startup]: 10,
47
+ [y.business]: 20,
48
+ [y.enterprise]: 30
45
49
  };
46
- function B(e) {
47
- const s = e;
48
- return s.init = (i) => (t) => e(t, i), s;
50
+ function K(t) {
51
+ const s = t;
52
+ return s.init = (i) => (e) => t(e, i), s;
49
53
  }
50
- const K = (e) => /* @__PURE__ */ B(e);
51
- async function G({
52
- editor: e,
54
+ const G = (t) => /* @__PURE__ */ K(t);
55
+ async function F({
56
+ editor: t,
53
57
  plan: s,
54
58
  pluginName: i,
55
- licenseKey: t,
56
- cleanup: o
59
+ licenseKey: e,
60
+ onLicenseCheckResponse: o,
61
+ cleanup: a
57
62
  }) {
58
- let a = "", p = !1;
59
- const c = W(), r = (n) => {
60
- console.warn("Cleanup plugin:", i, "Reason:", n), o();
61
- }, u = (n = {}) => {
63
+ let l = "", c = !1;
64
+ const u = j(), r = (n) => {
65
+ console.warn("Cleanup plugin:", i, "Reason:", n), a();
66
+ }, p = (n = {}) => {
62
67
  var P;
63
- const { error: l, sdkLicense: I } = n, h = (P = n.plan) == null ? void 0 : P.category;
64
- if (!(I || n.license) || l)
65
- r(l || "Invalid license");
66
- else if (h) {
67
- const A = M[s], b = M[h];
68
- A > b && r({ pluginRequiredPlan: s, licensePlan: h });
68
+ const { error: h, sdkLicense: A } = n, m = (P = n.plan) == null ? void 0 : P.category;
69
+ if (!(A || n.license) || h)
70
+ r(h || "Invalid license");
71
+ else if (m) {
72
+ const b = _[s], H = _[m];
73
+ b > H && r({ pluginRequiredPlan: s, licensePlan: m });
69
74
  }
70
75
  };
71
- e.on(S, (n) => {
72
- a = n == null ? void 0 : n.baseApiUrl, p = !0;
73
- }), e.on(x, (n) => {
74
- u(n);
76
+ t.on(O, (n) => {
77
+ l = n == null ? void 0 : n.baseApiUrl, c = !0;
78
+ }), t.on(U, (n) => {
79
+ o == null || o(n), p(n);
75
80
  }), setTimeout(async () => {
76
- if (!p) {
77
- if (c) return;
78
- if (t) {
79
- const n = await F({ licenseKey: t, pluginName: i, baseApiUrl: a });
80
- n && u(n);
81
+ if (!c) {
82
+ if (u) return;
83
+ if (e) {
84
+ const n = await R({ licenseKey: e, pluginName: i, baseApiUrl: l });
85
+ o == null || o(n), n && p(n);
81
86
  } else
82
87
  r("The `licenseKey` option not provided");
83
88
  }
84
89
  }, 2e3);
85
90
  }
86
- async function F(e) {
87
- const { licenseKey: s, pluginName: i, baseApiUrl: t } = e;
91
+ async function R(t) {
92
+ const { licenseKey: s, pluginName: i, baseApiUrl: e } = t;
88
93
  try {
89
- return (await j({
90
- baseApiUrl: t,
94
+ return (await B({
95
+ baseApiUrl: e,
91
96
  path: `/sdk/${s || "na"}`,
92
97
  method: "POST",
93
98
  params: {
@@ -99,58 +104,58 @@ async function F(e) {
99
104
  return console.error("Error during SDK license check:", o), !1;
100
105
  }
101
106
  }
102
- const v = "gjs-plg-", q = "listPagesComponent", X = f.startup;
103
- function Y(e, s, i) {
104
- let t, o, a, p, c;
105
- const r = s;
106
- function u() {
107
- const l = Date.now() - p;
108
- l < r && l >= 0 ? t = setTimeout(u, r - l) : (t = null, c = e.apply(a, o), a = o = null);
107
+ const N = "gjs-plg-", q = "listPagesComponent", X = y.startup;
108
+ function Y(t, s, i) {
109
+ let e, o, a, l, c;
110
+ const u = s;
111
+ function r() {
112
+ const n = Date.now() - l;
113
+ n < u && n >= 0 ? e = setTimeout(r, u - n) : (e = null, c = t.apply(a, o), a = o = null);
109
114
  }
110
- const n = function() {
111
- return a = this, o = arguments, p = Date.now(), t || (t = setTimeout(u, r)), c;
115
+ const p = function() {
116
+ return a = this, o = arguments, l = Date.now(), e || (e = setTimeout(r, u)), c;
112
117
  };
113
- return n.clear = function() {
114
- t && (clearTimeout(t), t = null);
115
- }, n.flush = function() {
116
- t && (c = e.apply(a, o), a = o = null, clearTimeout(t), t = null);
117
- }, n;
118
+ return p.clear = function() {
119
+ e && (clearTimeout(e), e = null);
120
+ }, p.flush = function() {
121
+ e && (c = t.apply(a, o), a = o = null, clearTimeout(e), e = null);
122
+ }, p;
118
123
  }
119
- const k = "page://", m = "list-pages", d = "list-pages-item", g = "list-pages-link", Z = (e) => e.components().reduce(
124
+ const $ = "page://", g = "list-pages", f = "list-pages-item", d = "list-pages-link", Z = (t) => t.components().reduce(
120
125
  (s, i) => {
121
- var p;
122
- const t = i.findFirstType(g), o = (p = t == null ? void 0 : t.attributes.attributes) == null ? void 0 : p.href, a = o != null && o.startsWith(k) ? o.replace(k, "") : "";
123
- if (a && t) {
126
+ var l;
127
+ const e = i.findFirstType(d), o = (l = e == null ? void 0 : e.attributes.attributes) == null ? void 0 : l.href, a = o != null && o.startsWith($) ? o.replace($, "") : "";
128
+ if (a && e) {
124
129
  const c = s[a];
125
- c ? c.push(t) : s[a] = [t];
130
+ c ? c.push(e) : s[a] = [e];
126
131
  }
127
132
  return s;
128
133
  },
129
134
  {}
130
- ), T = "data-type-role", J = "page_root", z = (e) => (s) => s.is(e), Q = (e) => (s, i) => i.is(e), w = (e) => (s) => {
135
+ ), I = "data-type-role", J = "page_root", z = (t) => (s) => s.is(t), Q = (t) => (s, i) => i.is(t), w = (t) => (s) => {
131
136
  var i;
132
- return ((i = s.getAttribute) == null ? void 0 : i.call(s, T)) === e;
133
- }, ee = function(e, s = {}) {
134
- const { Blocks: i, Components: t, Pages: o } = e, { licenseKey: a, block: p = {} } = s, c = "List Pages", r = "List Pages Item", u = "Link", n = `${v}${m}`, l = `${v}${g}`, I = '<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>', h = '<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';
135
- t.addType(m, {
136
- block: p && {
137
+ return ((i = s.getAttribute) == null ? void 0 : i.call(s, I)) === t;
138
+ }, tt = function(t, s = {}) {
139
+ const { Blocks: i, Components: e, Pages: o } = t, { licenseKey: a, block: l = {} } = s, c = "List Pages", u = "List Pages Item", r = "Link", p = `${N}${g}`, n = `${N}${d}`, h = '<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>', A = '<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';
140
+ e.addType(g, {
141
+ block: l && {
137
142
  label: c,
138
- media: I,
143
+ media: h,
139
144
  category: "Extra",
140
145
  select: !0,
141
146
  ...s.block
142
147
  },
143
- isComponent: w(m),
148
+ isComponent: w(g),
144
149
  model: {
145
150
  defaults: {
146
151
  tagName: "ul",
147
152
  name: c,
148
153
  [J]: "",
149
- classes: n,
150
- attributes: { [T]: m, role: "navigation" },
151
- droppable: z(d),
154
+ classes: p,
155
+ attributes: { [I]: g, role: "navigation" },
156
+ droppable: z(f),
152
157
  styles: `
153
- .${n} {
158
+ .${p} {
154
159
  list-style: none;
155
160
  margin: 0;
156
161
  padding: 0;
@@ -161,71 +166,71 @@ const k = "page://", m = "list-pages", d = "list-pages-item", g = "list-pages-li
161
166
  this.syncPageItems = Y(this.syncPageItems.bind(this), 0), this.listenTo(this.em, o.events.all, this.syncPageItems), this.syncPageItems();
162
167
  },
163
168
  syncPageItems() {
164
- if (e.Components.getSymbolInfo(this).isInstance) return;
165
- const y = this.em.Pages.getAll(), P = this.components(), A = Z(this);
166
- y.forEach((b, $) => {
167
- const E = b.id, H = b.getName(), L = A[E];
168
- L ? L == null || L.forEach((V) => {
169
- V.getInnerHTML() !== H && V.components(H);
170
- }) : P.add(
169
+ if (t.Components.getSymbolInfo(this).isInstance) return;
170
+ const m = this.em.Pages.getAll(), E = this.components(), P = Z(this);
171
+ m.forEach((b, H) => {
172
+ const V = b.id, L = b.getName(), T = P[V];
173
+ T ? T == null || T.forEach((M) => {
174
+ M.getInnerHTML() !== L && M.components(L);
175
+ }) : E.add(
171
176
  {
172
- type: d,
177
+ type: f,
173
178
  components: [
174
179
  {
175
- type: g,
176
- attributes: { href: `page://${E}` },
177
- components: { type: "textnode", content: H }
180
+ type: d,
181
+ attributes: { href: `page://${V}` },
182
+ components: { type: "textnode", content: L }
178
183
  }
179
184
  ]
180
185
  },
181
- { at: $ }
186
+ { at: H }
182
187
  );
183
188
  });
184
189
  }
185
190
  }
186
- }), t.addType(d, {
187
- isComponent: w(d),
191
+ }), e.addType(f, {
192
+ isComponent: w(f),
188
193
  model: {
189
194
  defaults: {
190
- name: r,
195
+ name: u,
191
196
  tagName: "li",
192
- icon: h,
193
- attributes: { [T]: d },
194
- components: { type: g },
195
- draggable: Q(m)
197
+ icon: A,
198
+ attributes: { [I]: f },
199
+ components: { type: d },
200
+ draggable: Q(g)
196
201
  }
197
202
  }
198
- }), t.addType(g, {
203
+ }), e.addType(d, {
199
204
  extend: "link",
200
- isComponent: w(g),
205
+ isComponent: w(d),
201
206
  model: {
202
207
  defaults: {
203
208
  removable: !1,
204
209
  copyable: !1,
205
210
  delegate: {
206
- move: (y) => y.closestType(d)
211
+ move: (m) => m.closestType(f)
207
212
  },
208
- name: u,
209
- classes: l,
210
- attributes: { [T]: g },
213
+ name: r,
214
+ classes: n,
215
+ attributes: { [I]: d },
211
216
  components: { type: "textnode", content: "Item" },
212
217
  styles: `
213
- .${l} {
218
+ .${n} {
214
219
  text-decoration: none;
215
220
  }
216
221
  `
217
222
  }
218
223
  }
219
- }), G({
220
- editor: e,
224
+ }), F({
225
+ editor: t,
221
226
  licenseKey: a,
222
227
  plan: X,
223
228
  pluginName: q,
224
229
  cleanup: () => {
225
- i.remove(m), t.removeType(m);
230
+ i.remove(g), e.removeType(g);
226
231
  }
227
232
  });
228
- }, te = K(ee);
233
+ }, et = G(tt);
229
234
  export {
230
- te as default
235
+ et as default
231
236
  };
@@ -1,11 +1,11 @@
1
- (function(g,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(g=typeof globalThis<"u"?globalThis:g||self,g.StudioSdkPlugins_listPagesComponent=f())})(this,function(){"use strict";const g="app.grapesjs.com",f="app-stage.grapesjs.com",M=[g,"app2.grapesjs.com",f,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],D="license:check:start",$="license:check:end",S=()=>typeof window<"u",O=({isDev:e,isStage:s})=>`${e?"":`https://${s?f:g}`}/api`,x=()=>{const e=S()&&window.location.hostname;return!!e&&(M.includes(e)||M.some(s=>e.endsWith(s)))};async function R({path:e,baseApiUrl:s,method:i="GET",headers:t={},params:o,body:a}){const c=`${s||O({isDev:!1,isStage:!1})}${e}`,r={method:i,headers:{"Content-Type":"application/json",...t}};a&&(r.body=JSON.stringify(a));const u=o?new URLSearchParams(o).toString():"",n=u?`?${u}`:"",l=await fetch(`${c}${n}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{});const V={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function U(e){const s=e;return s.init=i=>t=>e(t,i),s}const W=e=>U(e);async function j({editor:e,plan:s,pluginName:i,licenseKey:t,cleanup:o}){let a="",p=!1;const c=x(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),o()},u=(n={})=>{var L;const{error:l,sdkLicense:E}=n,P=(L=n.plan)==null?void 0:L.category;if(!(E||n.license)||l)r(l||"Invalid license");else if(P){const w=V[s],A=V[P];w>A&&r({pluginRequiredPlan:s,licensePlan:P})}};e.on(D,n=>{a=n==null?void 0:n.baseApiUrl,p=!0}),e.on($,n=>{u(n)}),setTimeout(async()=>{if(!p){if(c)return;if(t){const n=await B({licenseKey:t,pluginName:i,baseApiUrl:a});n&&u(n)}else r("The `licenseKey` option not provided")}},2e3)}async function B(e){const{licenseKey:s,pluginName:i,baseApiUrl:t}=e;try{return(await R({baseApiUrl:t,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const _="gjs-plg-",G="listPagesComponent",K=h.startup;function F(e,s,i){let t,o,a,p,c;const r=s;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,c=e.apply(a,o),a=o=null)}const n=function(){return a=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),c};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(c=e.apply(a,o),a=o=null,clearTimeout(t),t=null)},n}const k="page://",m="list-pages",y="list-pages-item",d="list-pages-link",q=e=>e.components().reduce((s,i)=>{var p;const t=i.findFirstType(d),o=(p=t==null?void 0:t.attributes.attributes)==null?void 0:p.href,a=o!=null&&o.startsWith(k)?o.replace(k,""):"";if(a&&t){const c=s[a];c?c.push(t):s[a]=[t]}return s},{}),b="data-type-role",X="page_root",Y=e=>s=>s.is(e),Z=e=>(s,i)=>i.is(e),H=e=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,b))===e};return W(function(e,s={}){const{Blocks:i,Components:t,Pages:o}=e,{licenseKey:a,block:p={}}=s,c="List Pages",r="List Pages Item",u="Link",n=`${_}${m}`,l=`${_}${d}`,E='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',P='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';t.addType(m,{block:p&&{label:c,media:E,category:"Extra",select:!0,...s.block},isComponent:H(m),model:{defaults:{tagName:"ul",name:c,[X]:"",classes:n,attributes:{[b]:m,role:"navigation"},droppable:Y(y),styles:`
2
- .${n} {
1
+ (function(f,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(f=typeof globalThis<"u"?globalThis:f||self,f.StudioSdkPlugins_listPagesComponent=y())})(this,function(){"use strict";const f="app.grapesjs.com",y="app-stage.grapesjs.com",V=[f,"app2.grapesjs.com",y,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",x="license:check:end",C=()=>typeof window<"u",U=({isDev:t,isStage:s,isPlatform:i})=>`${t?"":`https://${s?y:f}`}/${i?"platform-api":"api"}`,k=()=>{const t=C()&&window.location.hostname;return!!t&&(V.includes(t)||V.some(s=>t.endsWith(s)))};async function W({path:t,baseApiUrl:s,method:i="GET",headers:e={},params:o,body:a}){const c=`${s||U({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...e}};a&&(u.body=JSON.stringify(a));const r=o?new URLSearchParams(o).toString():"",p=r?`?${r}`:"",n=await fetch(`${c}${p}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var h=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(h||{});const _={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function j(t){const s=t;return s.init=i=>e=>t(e,i),s}const B=t=>j(t);async function G({editor:t,plan:s,pluginName:i,licenseKey:e,onLicenseCheckResponse:o,cleanup:a}){let l="",c=!1;const u=k(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),a()},p=(n={})=>{var A;const{error:T,sdkLicense:E}=n,g=(A=n.plan)==null?void 0:A.category;if(!(E||n.license)||T)r(T||"Invalid license");else if(g){const I=_[s],w=_[g];I>w&&r({pluginRequiredPlan:s,licensePlan:g})}};t.on(O,n=>{l=n==null?void 0:n.baseApiUrl,c=!0}),t.on(x,n=>{o==null||o(n),p(n)}),setTimeout(async()=>{if(!c){if(u)return;if(e){const n=await K({licenseKey:e,pluginName:i,baseApiUrl:l});o==null||o(n),n&&p(n)}else r("The `licenseKey` option not provided")}},2e3)}async function K(t){const{licenseKey:s,pluginName:i,baseApiUrl:e}=t;try{return(await W({baseApiUrl:e,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const v="gjs-plg-",F="listPagesComponent",R=h.startup;function q(t,s,i){let e,o,a,l,c;const u=s;function r(){const n=Date.now()-l;n<u&&n>=0?e=setTimeout(r,u-n):(e=null,c=t.apply(a,o),a=o=null)}const p=function(){return a=this,o=arguments,l=Date.now(),e||(e=setTimeout(r,u)),c};return p.clear=function(){e&&(clearTimeout(e),e=null)},p.flush=function(){e&&(c=t.apply(a,o),a=o=null,clearTimeout(e),e=null)},p}const N="page://",m="list-pages",P="list-pages-item",d="list-pages-link",X=t=>t.components().reduce((s,i)=>{var l;const e=i.findFirstType(d),o=(l=e==null?void 0:e.attributes.attributes)==null?void 0:l.href,a=o!=null&&o.startsWith(N)?o.replace(N,""):"";if(a&&e){const c=s[a];c?c.push(e):s[a]=[e]}return s},{}),b="data-type-role",Y="page_root",Z=t=>s=>s.is(t),J=t=>(s,i)=>i.is(t),L=t=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,b))===t};return B(function(t,s={}){const{Blocks:i,Components:e,Pages:o}=t,{licenseKey:a,block:l={}}=s,c="List Pages",u="List Pages Item",r="Link",p=`${v}${m}`,n=`${v}${d}`,T='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',E='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(m,{block:l&&{label:c,media:T,category:"Extra",select:!0,...s.block},isComponent:L(m),model:{defaults:{tagName:"ul",name:c,[Y]:"",classes:p,attributes:{[b]:m,role:"navigation"},droppable:Z(P),styles:`
2
+ .${p} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
6
6
  }
7
- `},init(){this.syncPageItems=F(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const T=this.em.Pages.getAll(),L=this.components(),w=q(this);T.forEach((A,J)=>{const v=A.id,C=A.getName(),I=w[v];I?I==null||I.forEach(N=>{N.getInnerHTML()!==C&&N.components(C)}):L.add({type:y,components:[{type:d,attributes:{href:`page://${v}`},components:{type:"textnode",content:C}}]},{at:J})})}}}),t.addType(y,{isComponent:H(y),model:{defaults:{name:r,tagName:"li",icon:P,attributes:{[b]:y},components:{type:d},draggable:Z(m)}}}),t.addType(d,{extend:"link",isComponent:H(d),model:{defaults:{removable:!1,copyable:!1,delegate:{move:T=>T.closestType(y)},name:u,classes:l,attributes:{[b]:d},components:{type:"textnode",content:"Item"},styles:`
8
- .${l} {
7
+ `},init(){this.syncPageItems=q(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const g=this.em.Pages.getAll(),$=this.components(),A=X(this);g.forEach((I,w)=>{const D=I.id,M=I.getName(),H=A[D];H?H==null||H.forEach(S=>{S.getInnerHTML()!==M&&S.components(M)}):$.add({type:P,components:[{type:d,attributes:{href:`page://${D}`},components:{type:"textnode",content:M}}]},{at:w})})}}}),e.addType(P,{isComponent:L(P),model:{defaults:{name:u,tagName:"li",icon:E,attributes:{[b]:P},components:{type:d},draggable:J(m)}}}),e.addType(d,{extend:"link",isComponent:L(d),model:{defaults:{removable:!1,copyable:!1,delegate:{move:g=>g.closestType(P)},name:r,classes:n,attributes:{[b]:d},components:{type:"textnode",content:"Item"},styles:`
8
+ .${n} {
9
9
  text-decoration: none;
10
10
  }
11
- `}}}),j({editor:e,licenseKey:a,plan:K,pluginName:G,cleanup:()=>{i.remove(m),t.removeType(m)}})})});
11
+ `}}}),G({editor:t,licenseKey:a,plan:R,pluginName:F,cleanup:()=>{i.remove(m),e.removeType(m)}})})});
@@ -1,11 +1,11 @@
1
- "use strict";const F="app.grapesjs.com",W="app-stage.grapesjs.com",X="app2.grapesjs.com",Z="app-stage2.grapesjs.com",U=[F,X,W,Z,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Q="license:check:start",ee="license:check:end",te=()=>typeof window<"u",O=(e,s={})=>{const t=ne(e)?{id:e,src:e}:e;return new Promise((o,a)=>{var g,h;const{loadedScripts:n}=s,{id:i,src:d}=t,c=document.querySelector(`script[src="${d}"]`);if(c){if((g=s.onScript)==null||g.call(s,c),n&&!n.get(d)){c.addEventListener("load",()=>o(i)),c.addEventListener("error",()=>a(i));return}return o(i)}const u=window.define;window.define=void 0;const l=()=>{n==null||n.set(d,!0),window.define=u},r=document.createElement("script");r.src=d,r.onload=()=>{o(i),l()},r.onerror=()=>{a(i),l()},document.head.appendChild(r),(h=s.onScript)==null||h.call(s,r)})},oe=({isDev:e,isStage:s})=>`${e?"":`https://${s?W:F}`}/api`,se=()=>{const e=te()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(s=>e.endsWith(s)))},ne=e=>typeof e=="string";async function ae({path:e,baseApiUrl:s,method:t="GET",headers:o={},params:a,body:n}){const d=`${s||oe({isDev:!1,isStage:!1})}${e}`,c={method:t,headers:{"Content-Type":"application/json",...o}};n&&(c.body=JSON.stringify(n));const u=a?new URLSearchParams(a).toString():"",l=u?`?${u}`:"",r=await fetch(`${d}${l}`,c);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var k=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(k||{}),z=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(z||{});const I={[k.free]:0,[k.startup]:10,[k.business]:20,[k.enterprise]:30};function ie(e){const s=e;return s.init=t=>o=>e(o,t),s}const re=e=>ie(e);async function ce({editor:e,plan:s,pluginName:t,licenseKey:o,cleanup:a}){let n="",i=!1;const d=se(),c=l=>{console.warn("Cleanup plugin:",t,"Reason:",l),a()},u=(l={})=>{var w;const{error:r,sdkLicense:g}=l,h=(w=l.plan)==null?void 0:w.category;if(!(g||l.license)||r)c(r||"Invalid license");else if(h){const p=I[s],f=I[h];p>f&&c({pluginRequiredPlan:s,licensePlan:h})}};e.on(Q,l=>{n=l==null?void 0:l.baseApiUrl,i=!0}),e.on(ee,l=>{u(l)}),setTimeout(async()=>{if(!i){if(d)return;if(o){const l=await le({licenseKey:o,pluginName:t,baseApiUrl:n});l&&u(l)}else c("The `licenseKey` option not provided")}},2e3)}async function le(e){const{licenseKey:s,pluginName:t,baseApiUrl:o}=e;try{return(await ae({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const pe=e=>s=>{var t;return((t=s.getAttribute)==null?void 0:t.call(s,V))===e},de=(...e)=>(s,t)=>e.some(o=>t.is(o)),K=(e,s,t)=>{const{doc:o=document}=t,a=t.target||o.head,n=a.querySelector(`style[${e}]`)||o.createElement("style");n.setAttribute(e,"true"),n.innerHTML=s,!a.contains(n)&&a.appendChild(n)},ge="gjs-plg-",q="data-gs-plg-",V="data-type-role";function C(e,s,t){let o,a,n,i,d;const c=s===void 0?100:s;function u(){const r=Date.now()-i;r<c&&r>=0?o=setTimeout(u,c-r):(o=null,d=e.apply(n,a),n=a=null)}const l=function(){return n=this,a=arguments,i=Date.now(),o||(o=setTimeout(u,c)),d};return l.clear=function(){o&&(clearTimeout(o),o=null)},l.flush=function(){o&&(d=e.apply(n,a),n=a=null,clearTimeout(o),o=null)},l}const A="page-break";var m=(e=>(e.A5="a5",e.A5Portrait="a5-portrait",e.A4="a4",e.A3="a3",e.B5="b5",e.B4="b4",e.letter="letter",e.legal="legal",e.ledger="ledger",e))(m||{});function _(e,s){const o={mm:3.7795275590551185,cm:37.79527559055118,in:96,pt:1.3333333333333333,pc:16};return o[s]?e*o[s]:null}const ue=(e,s)=>{const{name:t,id:o,width:a,height:n,unit:i}=e,{fixedHeight:d}=s,c=`${a}${i}`,u=`${n}${i}`;return{id:o||t.toLowerCase().replace(/\s/g,"-"),name:`${t} (${c} x ${u})`,sizeH:n,sizeW:a,sizeUnit:i,widthMedia:"",width:c,minHeight:d?"0":`${_(n,i)}px`,height:d?u:void 0}},G="page-breaks",x="gjs-page-breaks-spot",j=e=>e.type===G;function he(e){const{Devices:s}=e,{height:t,minHeight:o}=s.getSelected().attributes,n=parseFloat(`${t&&t!=="auto"?t:o}`),i=e.getWrapper(),d=i==null?void 0:i.getEl(),c=[];if(!i||!d)return c;const u=d.getBoundingClientRect().height,r=i.findType(A).map(h=>h.getEl()).filter(Boolean).map(h=>({top:h.offsetTop,height:h.offsetHeight}));let g=0;for(;g<u;){const h=r.find(y=>y.top>g&&y.top<g+n);h?(g=h.top+h.height,c.push(h.top)):(g+=n,g<u&&c.push(g))}return c}function fe(e,s){const{Canvas:t}=e,o=t.events,a=e.events;let n;const i=()=>{K(`${q}preset-printable-spots`,`.${x} {
1
+ "use strict";const W="app.grapesjs.com",z="app-stage.grapesjs.com",X="app2.grapesjs.com",Z="app-stage2.grapesjs.com",U=[W,X,z,Z,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Q="license:check:start",ee="license:check:end",te=()=>typeof window<"u",O=(e,s={})=>{const t=ne(e)?{id:e,src:e}:e;return new Promise((o,n)=>{var p,u;const{loadedScripts:r}=s,{id:i,src:l}=t,d=document.querySelector(`script[src="${l}"]`);if(d){if((p=s.onScript)==null||p.call(s,d),r&&!r.get(l)){d.addEventListener("load",()=>o(i)),d.addEventListener("error",()=>n(i));return}return o(i)}const g=window.define;window.define=void 0;const f=()=>{r==null||r.set(l,!0),window.define=g},a=document.createElement("script");a.src=l,a.onload=()=>{o(i),f()},a.onerror=()=>{n(i),f()},document.head.appendChild(a),(u=s.onScript)==null||u.call(s,a)})},oe=({isDev:e,isStage:s,isPlatform:t})=>`${e?"":`https://${s?z:W}`}/${t?"platform-api":"api"}`,se=()=>{const e=te()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(s=>e.endsWith(s)))},ne=e=>typeof e=="string";async function ae({path:e,baseApiUrl:s,method:t="GET",headers:o={},params:n,body:r}){const l=`${s||oe({isDev:!1,isStage:!1})}${e}`,d={method:t,headers:{"Content-Type":"application/json",...o}};r&&(d.body=JSON.stringify(r));const g=n?new URLSearchParams(n).toString():"",f=g?`?${g}`:"",a=await fetch(`${l}${f}`,d);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}var $=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))($||{}),K=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(K||{});const I={[$.free]:0,[$.startup]:10,[$.business]:20,[$.enterprise]:30};function re(e){const s=e;return s.init=t=>o=>e(o,t),s}const ie=e=>re(e);async function ce({editor:e,plan:s,pluginName:t,licenseKey:o,onLicenseCheckResponse:n,cleanup:r}){let i="",l=!1;const d=se(),g=a=>{console.warn("Cleanup plugin:",t,"Reason:",a),r()},f=(a={})=>{var c;const{error:p,sdkLicense:u}=a,m=(c=a.plan)==null?void 0:c.category;if(!(u||a.license)||p)g(p||"Invalid license");else if(m){const h=I[s],k=I[m];h>k&&g({pluginRequiredPlan:s,licensePlan:m})}};e.on(Q,a=>{i=a==null?void 0:a.baseApiUrl,l=!0}),e.on(ee,a=>{n==null||n(a),f(a)}),setTimeout(async()=>{if(!l){if(d)return;if(o){const a=await le({licenseKey:o,pluginName:t,baseApiUrl:i});n==null||n(a),a&&f(a)}else g("The `licenseKey` option not provided")}},2e3)}async function le(e){const{licenseKey:s,pluginName:t,baseApiUrl:o}=e;try{return(await ae({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const de=e=>s=>{var t;return((t=s.getAttribute)==null?void 0:t.call(s,V))===e},pe=(...e)=>(s,t)=>e.some(o=>t.is(o)),C=(e,s,t)=>{const{doc:o=document}=t,n=t.target||o.head,r=n.querySelector(`style[${e}]`)||o.createElement("style");r.setAttribute(e,"true"),r.innerHTML=s,!n.contains(r)&&n.appendChild(r)},ge="gjs-plg-",q="data-gs-plg-",V="data-type-role";function N(e,s,t){let o,n,r,i,l;const d=s===void 0?100:s;function g(){const a=Date.now()-i;a<d&&a>=0?o=setTimeout(g,d-a):(o=null,l=e.apply(r,n),r=n=null)}const f=function(){return r=this,n=arguments,i=Date.now(),o||(o=setTimeout(g,d)),l};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.flush=function(){o&&(l=e.apply(r,n),r=n=null,clearTimeout(o),o=null)},f}const A="page-break";var y=(e=>(e.A5="a5",e.A5Portrait="a5-portrait",e.A4="a4",e.A3="a3",e.B5="b5",e.B4="b4",e.letter="letter",e.legal="legal",e.ledger="ledger",e))(y||{});function _(e,s){const o={mm:3.7795275590551185,cm:37.79527559055118,in:96,pt:1.3333333333333333,pc:16};return o[s]?e*o[s]:null}const ue=(e,s)=>{const{name:t,id:o,width:n,height:r,unit:i}=e,{fixedHeight:l}=s,d=`${n}${i}`,g=`${r}${i}`;return{id:o||t.toLowerCase().replace(/\s/g,"-"),name:`${t} (${d} x ${g})`,sizeH:r,sizeW:n,sizeUnit:i,widthMedia:"",width:d,minHeight:l?"0":`${_(r,i)}px`,height:l?g:void 0}},G="page-breaks",D="gjs-page-breaks-spot",j=e=>e.type===G;function he(e){const{Devices:s}=e,{height:t,minHeight:o}=s.getSelected().attributes,r=parseFloat(`${t&&t!=="auto"?t:o}`),i=e.getWrapper(),l=i==null?void 0:i.getEl(),d=[];if(!i||!l)return d;const g=l.getBoundingClientRect().height,a=i.findType(A).map(u=>u.getEl()).filter(Boolean).map(u=>({top:u.offsetTop,height:u.offsetHeight}));let p=0;for(;p<g;){const u=a.find(m=>m.top>p&&m.top<p+r);u?(p=u.top+u.height,d.push(u.top)):(p+=r,p<g&&d.push(p))}return d}function fe(e,s){const{Canvas:t}=e,o=t.events,n=e.events;let r;const i=()=>{C(`${q}preset-printable-spots`,`.${D} {
2
2
  position: absolute;
3
3
  left: 0;
4
4
  width: 100%;
5
5
  border-top: 1px dashed var(--gs-theme-cl-cmp-bg2, var(--gjs-color-blue));
6
6
  color: var(--gs-theme-cl-prm-txt, var(--gjs-font-color));
7
7
  }
8
- .${x}::after {
8
+ .${D}::after {
9
9
  background-color: var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight));
10
10
  content: attr(data-page-number);
11
11
  display: block;
@@ -16,7 +16,7 @@
16
16
  right: 0;
17
17
  transform: translate(100%, -50%);
18
18
  }
19
- `,{target:window.document.head})},d=()=>{if(s.enablePageBreaksSpot===!1)return;const p={id:G,type:G,component:e.getWrapper()};return t.getSpots(p).pop()||t.addSpot(p)},c=({spot:p})=>{const{spotEl:f}=p.attributes;!j(p)||!f||!n||n.removeChild(f)},u=({spot:p})=>{if(!j(p)||!n)return;let{spotEl:f}=p.attributes;f||(f=document.createElement("div"),f.className=`${x}__items`,p.set({spotEl:f})),n.appendChild(f)},l=({spot:p})=>{const{spotEl:f,pageBreaks:D=[]}=p.attributes;!j(p)||!f||!n||(Object.entries(p.getStyle()).forEach(([L,$])=>f.style.setProperty(L,$)),f.innerHTML="",D.forEach((L,$)=>{const E=document.createElement("div");E.setAttribute("data-page-number",`${$+2}`),E.className=x,E.style.top=`${L}px`,f.appendChild(E)}))},r=C(()=>{if(e.em.destroyed)return;const p=d();p&&p.set({pageBreaks:he(e),up:(p.attributes.up||0)+1})},150),g=C(r,200),h=()=>{n=t.getSpotsEl(),d()},y=()=>{const p=d();p&&p.set({up:(p.attributes.up||0)+1})},w=[["component:input",r],["frame:scroll",y],[a.update,r],[o.spotAdd,u],[o.spotUpdate,l],[o.spotRemove,c],[o.frameLoadBody,h]];return w.forEach(([p,f])=>e.on(p,f)),e.onReady(()=>{i(),new ResizeObserver(y).observe(t.getElement().parentElement)}),()=>{w.forEach(([p,f])=>e.off(p,f)),r.clear(),g.clear()}}var H=(e=>(e.print="presetPrintable:print",e))(H||{});const N=e=>new Promise(s=>{const t=document.createElement("iframe");t.style.cssText="position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;",t.srcdoc=e.content,t.onload=()=>s(t),document.body.appendChild(t)});function ve(e,s){const{Commands:t,Pages:o}=e;return t.add(H.print,async(a,n,i={})=>{const d={page:i.allPages?void 0:o.getSelected(),styles:"inline",optionsHtml:{exporter:null}},u=(await t.run(z.projectFiles,d)).filter(g=>g.filename.endsWith(".html")),l=u.map(g=>g.content).join('<div style="break-before: page;"></div>'),r=[];if(i.separatePrints)for(const g of u)r.push(await N(g));else r.push(await N({content:l,filename:"",mimeType:""}));for(const g of r){const h=g.contentWindow;h.focus(),h.print()}setTimeout(()=>r.forEach(g=>g.remove()),1e3)}),t.add("presetPrintable:exp",async a=>{await O("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"),await O("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");const{Devices:n,Canvas:i}=a,{sizeW:d,sizeH:c,sizeUnit:u}=n.getSelected().attributes,l=i.getFrameEl().contentDocument,r="px",g=[_(d,u),_(c,u)],h=new window.jspdf.jsPDF({unit:r,format:g}),y=l.body;h.html(y,{callback:w=>w.save()})}),()=>{delete e.Commands.commands[H.print]}}function be(e,s){const{blockPageBreak:t={}}=s,{Components:o,Blocks:a}=e,n="Page Break",i=`${ge}${A}`;return o.addType(A,{block:t&&{label:n,media:'<svg viewBox="0 0 24 24"><path d="M18 20H6v-2H4v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2h-2v2M14 2H6a2 2 0 0 0-2 2v8h2V4h8v4h4v4h2V8l-6-6m-3 14H8v-2h3v2m5 0h-3v-2h3v2M3 14h3v2H3v-2m18 2h-3v-2h3v2Z"/></svg>',category:"Extra",select:!0,...t},isComponent:pe(A),model:{defaults:{name:n,classes:i,attributes:{[V]:A},emptyState:!0,stylable:!1,droppable:!1,draggable:de("wrapper"),styles:`.${i} { break-before: page; }`,traits:[]}}}),()=>{o.removeType(A),a.remove(A)}}const me="presetPrintable",ye=k.free,we=function(e,s={}){var M;const t={selectedDevice:m.A4,...s},{Canvas:o,Devices:a,Blocks:n}=e,i=o.events,d=e.events,c=t.selectedDevice||a.getConfig().default,u=[{id:m.A5,name:"A5",width:148,height:210,unit:"mm"},{id:m.A5Portrait,name:"A5 Portrait",width:210,height:148,unit:"mm"},{id:m.A4,name:"A4",width:210,height:297,unit:"mm"},{id:m.A3,name:"A3",width:297,height:420,unit:"mm"},{id:m.B5,name:"B5",width:176,height:250,unit:"mm"},{id:m.B4,name:"B4",width:250,height:353,unit:"mm"},{id:m.letter,name:"Letter",width:8.5,height:11,unit:"in"},{id:m.legal,name:"Legal",width:8.5,height:14,unit:"in"},{id:m.ledger,name:"Ledger",width:11,height:17,unit:"in"}],r=(((M=t.devices)==null?void 0:M.call(t,{items:u}))||u).map(v=>ue(v,t));a.devices.reset(r);const g=c&&a.get(c)||a.getAll().at(0);a.select(g),["map","video"].forEach(v=>n.remove(v));const y=(v={})=>{const b="page-rule",{rules:P}=e.Css,{width:T,height:B,minHeight:R}=a.getSelected().attributes,Y=B&&B!=="auto"?B:R,S=P.where({id:b}).pop(),J=S||P.add({id:b,selectors:[],selectorsAdd:"@page"},{at:0});(v.fromDeviceChange||!S)&&J.addStyle({size:`${T} ${Y}`,...!S&&{margin:"0"}})},w=(v,b={})=>{const P=v.document,{minHeight:T}=a.getSelected().attributes,R=`
19
+ `,{target:window.document.head})},l=()=>{if(s.enablePageBreaksSpot===!1)return;const c={id:G,type:G,component:e.getWrapper()};return t.getSpots(c).pop()||t.addSpot(c)},d=({spot:c})=>{const{spotEl:h}=c.attributes;!j(c)||!h||!r||r.removeChild(h)},g=({spot:c})=>{if(!j(c)||!r)return;let{spotEl:h}=c.attributes;h||(h=document.createElement("div"),h.className=`${D}__items`,c.set({spotEl:h})),r.appendChild(h)},f=({spot:c})=>{const{spotEl:h,pageBreaks:k=[]}=c.attributes;!j(c)||!h||!r||(Object.entries(c.getStyle()).forEach(([x,L])=>h.style.setProperty(x,L)),h.innerHTML="",k.forEach((x,L)=>{const E=document.createElement("div");E.setAttribute("data-page-number",`${L+2}`),E.className=D,E.style.top=`${x}px`,h.appendChild(E)}))},a=N(()=>{if(e.em.destroyed)return;const c=l();c&&c.set({pageBreaks:he(e),up:(c.attributes.up||0)+1})},150),p=N(a,200),u=()=>{r=t.getSpotsEl(),l()},m=()=>{const c=l();c&&c.set({up:(c.attributes.up||0)+1})},w=[["component:input",a],["frame:scroll",m],[n.update,a],[o.spotAdd,g],[o.spotUpdate,f],[o.spotRemove,d],[o.frameLoadBody,u]];return w.forEach(([c,h])=>e.on(c,h)),e.onReady(()=>{i(),new ResizeObserver(m).observe(t.getElement().parentElement)}),()=>{w.forEach(([c,h])=>e.off(c,h)),a.clear(),p.clear()}}var H=(e=>(e.print="presetPrintable:print",e))(H||{});const F=e=>new Promise(s=>{const t=document.createElement("iframe");t.style.cssText="position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;",t.srcdoc=e.content,t.onload=()=>s(t),document.body.appendChild(t)});function ve(e,s){const{Commands:t,Pages:o}=e;return t.add(H.print,async(n,r,i={})=>{const l={page:i.allPages?void 0:o.getSelected(),styles:"inline",optionsHtml:{exporter:null}},g=(await t.run(K.projectFiles,l)).filter(p=>p.filename.endsWith(".html")),f=g.map(p=>p.content).join('<div style="break-before: page;"></div>'),a=[];if(i.separatePrints)for(const p of g)a.push(await F(p));else a.push(await F({content:f,filename:"",mimeType:""}));for(const p of a){const u=p.contentWindow;u.focus(),u.print()}setTimeout(()=>a.forEach(p=>p.remove()),1e3)}),t.add("presetPrintable:exp",async n=>{await O("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"),await O("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");const{Devices:r,Canvas:i}=n,{sizeW:l,sizeH:d,sizeUnit:g}=r.getSelected().attributes,f=i.getFrameEl().contentDocument,a="px",p=[_(l,g),_(d,g)],u=new window.jspdf.jsPDF({unit:a,format:p}),m=f.body;u.html(m,{callback:w=>w.save()})}),()=>{delete e.Commands.commands[H.print]}}function be(e,s){const{blockPageBreak:t={}}=s,{Components:o,Blocks:n}=e,r="Page Break",i=`${ge}${A}`;return o.addType(A,{block:t&&{label:r,media:'<svg viewBox="0 0 24 24"><path d="M18 20H6v-2H4v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2h-2v2M14 2H6a2 2 0 0 0-2 2v8h2V4h8v4h4v4h2V8l-6-6m-3 14H8v-2h3v2m5 0h-3v-2h3v2M3 14h3v2H3v-2m18 2h-3v-2h3v2Z"/></svg>',category:"Extra",select:!0,...t},isComponent:de(A),model:{defaults:{name:r,classes:i,attributes:{[V]:A},emptyState:!0,stylable:!1,droppable:!1,draggable:pe("wrapper"),styles:`.${i} { break-before: page; }`,traits:[]}}}),()=>{o.removeType(A),n.remove(A)}}const me="presetPrintable",ye=$.free,we=function(e,s={}){var M;const t={selectedDevice:y.A4,...s},{Canvas:o,Devices:n,Blocks:r}=e,i=o.events,l=e.events,d=t.selectedDevice||n.getConfig().default,g=[{id:y.A5,name:"A5",width:148,height:210,unit:"mm"},{id:y.A5Portrait,name:"A5 Portrait",width:210,height:148,unit:"mm"},{id:y.A4,name:"A4",width:210,height:297,unit:"mm"},{id:y.A3,name:"A3",width:297,height:420,unit:"mm"},{id:y.B5,name:"B5",width:176,height:250,unit:"mm"},{id:y.B4,name:"B4",width:250,height:353,unit:"mm"},{id:y.letter,name:"Letter",width:8.5,height:11,unit:"in"},{id:y.legal,name:"Legal",width:8.5,height:14,unit:"in"},{id:y.ledger,name:"Ledger",width:11,height:17,unit:"in"}],a=(((M=t.devices)==null?void 0:M.call(t,{items:g}))||g).map(v=>ue(v,t));n.devices.reset(a);const p=d&&n.get(d)||n.getAll().at(0);n.select(p),["map","video"].forEach(v=>r.remove(v));const m=(v={})=>{const b="page-rule",{rules:P}=e.Css,{width:T,height:B,minHeight:R}=n.getSelected().attributes,Y=B&&B!=="auto"?B:R,S=P.where({id:b}).pop(),J=S||P.add({id:b,selectors:[],selectorsAdd:"@page"},{at:0});(v.fromDeviceChange||!S)&&J.addStyle({size:`${T} ${Y}`,...!S&&{margin:"0"}})},w=(v,b={})=>{const P=v.document,{minHeight:T}=n.getSelected().attributes,R=`
20
20
  ${!!parseFloat(`${T}`)?`
21
21
  [data-gjs-type="wrapper"] { min-height: ${T}; }
22
22
  `:`
@@ -29,4 +29,4 @@
29
29
  height: 100dvh;
30
30
  }
31
31
  `}
32
- `;K(`${q}preset-printable`,R,{doc:P,target:P.head}),y(b)};e.on(i.frameLoadBody,v=>{const b=v.window;if(w(b),t.fixedHeight){const T=v.model.getComponent().getEl();T==null||T.addEventListener("scroll",B=>{const R=B.target;R.scrollTop>0&&R.scrollTo(0,0)})}}),e.on(a.events.select,()=>{var b;const v=(b=o.getFrameEl().contentDocument)==null?void 0:b.defaultView;v&&w(v,{fromDeviceChange:!0})});const p=()=>{const b=e.Css.getRules().filter(P=>P.selectorsToString()==="body").pop();b==null||b.addStyle({"margin-top":"","margin-right":"","margin-bottom":"","margin-left":"",margin:"0"})},f=[[d.projectLoad,p]];f.forEach(([v,b])=>e.on(v,b));const D=fe(e,t),L=ve(e),$=be(e,t);e.onReady(()=>{e.UndoManager.clear()});const E=()=>{f.forEach(([v,b])=>e.off(v,b)),D(),L(),$()};e.on(d.destroy,E),ce({editor:e,licenseKey:t.licenseKey,plan:ye,pluginName:me,cleanup:E})},Pe=re(we);module.exports=Pe;
32
+ `;C(`${q}preset-printable`,R,{doc:P,target:P.head}),m(b)};e.on(i.frameLoadBody,v=>{const b=v.window;if(w(b),t.fixedHeight){const T=v.model.getComponent().getEl();T==null||T.addEventListener("scroll",B=>{const R=B.target;R.scrollTop>0&&R.scrollTo(0,0)})}}),e.on(n.events.select,()=>{var b;const v=(b=o.getFrameEl().contentDocument)==null?void 0:b.defaultView;v&&w(v,{fromDeviceChange:!0})});const c=()=>{const b=e.Css.getRules().filter(P=>P.selectorsToString()==="body").pop();b==null||b.addStyle({"margin-top":"","margin-right":"","margin-bottom":"","margin-left":"",margin:"0"})},h=[[l.projectLoad,c]];h.forEach(([v,b])=>e.on(v,b));const k=fe(e,t),x=ve(e),L=be(e,t);e.onReady(()=>{e.UndoManager.clear()});const E=()=>{h.forEach(([v,b])=>e.off(v,b)),k(),x(),L()};e.on(l.destroy,E),ce({editor:e,licenseKey:t.licenseKey,plan:ye,pluginName:me,cleanup:E})},Pe=ie(we);module.exports=Pe;