@grapesjs/studio-sdk-plugins 1.0.9 → 1.0.10

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,6 +1,6 @@
1
- const F = "app.grapesjs.com", ie = "app-stage.grapesjs.com", Y = [
2
- F,
1
+ const ie = "app.grapesjs.com", re = "app-stage.grapesjs.com", Y = [
3
2
  ie,
3
+ re,
4
4
  "localhost",
5
5
  "127.0.0.1",
6
6
  ".local-credentialless.webcontainer.io",
@@ -9,122 +9,146 @@ const F = "app.grapesjs.com", ie = "app-stage.grapesjs.com", Y = [
9
9
  // For stackblitz.com demos
10
10
  "-sandpack.codesandbox.io"
11
11
  // For Sandpack demos
12
- ], pe = "license:check:start", ue = "license:check:end", se = () => typeof window < "u", he = ({ isDev: e, isStage: n }) => `${e ? "" : `https://${n ? ie : F}`}/api`, ge = () => {
13
- const e = se() && window.location.hostname;
14
- return !!e && (Y.includes(e) || Y.some((n) => e.endsWith(n)));
15
- }, be = () => (se() && window.location.hostname) === F;
16
- var de = {};
17
- const me = de.NODE_ENV !== "production";
18
- async function ye({
12
+ ], ue = "license:check:start", he = "license:check:end", ge = () => typeof window < "u", be = ({ isDev: e, isStage: l }) => `${e ? "" : `https://${l ? re : ie}`}/api`, de = () => {
13
+ const e = ge() && window.location.hostname;
14
+ return !!e && (Y.includes(e) || Y.some((l) => e.endsWith(l)));
15
+ };
16
+ var E = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(E || {});
17
+ async function me({
19
18
  path: e,
20
- method: n = "GET",
21
- headers: a = {},
22
- body: o
19
+ baseApiUrl: l,
20
+ method: a = "GET",
21
+ headers: n = {},
22
+ params: s,
23
+ body: u
23
24
  }) {
24
- const c = `${he({ isDev: me, isStage: !be() })}${e}`, i = {
25
- method: n,
25
+ const p = `${l || be({ isDev: !1, isStage: !1 })}${e}`, h = {
26
+ method: a,
26
27
  headers: {
27
28
  "Content-Type": "application/json",
28
- ...a
29
+ ...n
29
30
  }
30
31
  };
31
- o && (i.body = JSON.stringify(o));
32
- const r = await fetch(c, i);
33
- if (!r.ok)
34
- throw new Error(`HTTP error! status: ${r.status}`);
35
- return r.json();
32
+ u && (h.body = JSON.stringify(u));
33
+ const c = s ? new URLSearchParams(s).toString() : "", i = c ? `?${c}` : "", b = await fetch(`${p}${i}`, h);
34
+ if (!b.ok)
35
+ throw new Error(`HTTP error! status: ${b.status}`);
36
+ return b.json();
36
37
  }
37
- function ve(e) {
38
- const n = e;
39
- return n.init = (a) => (o) => e(o, a), n;
38
+ const ee = {
39
+ [E.free]: 0,
40
+ [E.startup]: 10,
41
+ [E.business]: 20,
42
+ [E.enterprise]: 30
43
+ };
44
+ function ye(e) {
45
+ const l = e;
46
+ return l.init = (a) => (n) => e(n, a), l;
40
47
  }
41
- const fe = (e) => /* @__PURE__ */ ve(e);
42
- async function Te({
48
+ const ve = (e) => /* @__PURE__ */ ye(e);
49
+ async function fe({
43
50
  editor: e,
44
- pluginName: n,
45
- licenseKey: a,
46
- cleanup: o
51
+ plan: l,
52
+ pluginName: a,
53
+ licenseKey: n,
54
+ cleanup: s
47
55
  }) {
48
- let s = !1;
49
- const c = ge();
50
- e.on(pe, () => {
51
- s = !0;
52
- }), e.on(ue, ({ sdkLicense: i }) => {
53
- i || o();
56
+ let u = "", r = !1;
57
+ const p = de(), h = (i) => {
58
+ console.warn("Cleanup plugin:", a, "Reason:", i), s();
59
+ }, c = (i = {}) => {
60
+ var L;
61
+ const { error: b, sdkLicense: C } = i, T = (L = i.plan) == null ? void 0 : L.category;
62
+ if (!(C || i.license) || b)
63
+ h(b || "Invalid license");
64
+ else if (T) {
65
+ const G = ee[l], V = ee[T];
66
+ G > V && h({ pluginRequiredPlan: l, licensePlan: T });
67
+ }
68
+ };
69
+ e.on(ue, (i) => {
70
+ u = i == null ? void 0 : i.baseApiUrl, r = !0;
71
+ }), e.on(he, (i) => {
72
+ c(i);
54
73
  }), setTimeout(async () => {
55
- if (!s) {
56
- if (c) return;
57
- a && await we({ licenseKey: a, pluginName: n }) || o();
74
+ if (!r) {
75
+ if (p) return;
76
+ if (n) {
77
+ const i = await Te({ licenseKey: n, pluginName: a, baseApiUrl: u });
78
+ i && c(i);
79
+ } else
80
+ h("The `licenseKey` option not provided");
58
81
  }
59
82
  }, 2e3);
60
83
  }
61
- async function we({ licenseKey: e, pluginName: n }) {
84
+ async function Te(e) {
85
+ const { licenseKey: l, pluginName: a, baseApiUrl: n } = e;
62
86
  try {
63
- const a = await ye({
64
- path: `/sdk/${e}`,
87
+ return (await me({
88
+ baseApiUrl: n,
89
+ path: `/sdk/${l || "na"}`,
65
90
  method: "POST",
66
- body: JSON.stringify({
91
+ params: {
67
92
  d: window.location.hostname,
68
- pn: n
69
- })
70
- }), { license: o } = a.result || {};
71
- return !!o;
72
- } catch (a) {
73
- return console.error("Error during SDK license check:", a), !1;
93
+ pn: a
94
+ }
95
+ })).result || {};
96
+ } catch (s) {
97
+ return console.error("Error during SDK license check:", s), !1;
74
98
  }
75
99
  }
76
- const z = (e, n) => {
100
+ const z = (e, l) => {
77
101
  var a;
78
- return !!((a = e == null ? void 0 : e.hasAttribute) != null && a.call(e, n));
102
+ return !!((a = e == null ? void 0 : e.hasAttribute) != null && a.call(e, l));
79
103
  };
80
- var k = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(k || {});
81
- const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-item`, O = "toggle", S = {
104
+ var P = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(P || {});
105
+ const k = "lightGallery", te = `${k}-item`, D = "data-lightgallery", ae = `${D}-item`, H = "toggle", I = {
82
106
  image: '<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',
83
107
  video: '<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',
84
108
  gallery: '<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',
85
109
  galleryItem: '<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',
86
110
  external: '<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',
87
111
  eye: '<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'
88
- }, U = { propKeys: [], props: {}, traits: [] }, A = (e, n = {}) => {
112
+ }, B = { propKeys: [], props: {}, traits: [] }, M = (e, l = {}) => {
89
113
  var s;
90
- const a = {}, o = [];
91
- for (const c in e) {
92
- const { value: i, ...r } = e[c];
93
- o.push({ id: c, name: c, changeProp: !0, category: n.category, ...r }), a[c] = i;
94
- const { subTraits: h = {} } = r;
95
- for (const u in r.subTraits)
96
- (s = h[u]) == null || s.forEach((I) => {
97
- const E = I.id || I.name;
98
- a[E] = I.value;
114
+ const a = {}, n = [];
115
+ for (const u in e) {
116
+ const { value: r, ...p } = e[u];
117
+ n.push({ id: u, name: u, changeProp: !0, category: l.category, ...p }), a[u] = r;
118
+ const { subTraits: h = {} } = p;
119
+ for (const c in p.subTraits)
120
+ (s = h[c]) == null || s.forEach((i) => {
121
+ const b = i.id || i.name;
122
+ a[b] = i.value;
99
123
  });
100
124
  }
101
125
  return {
102
126
  propKeys: Object.keys(a),
103
127
  props: a,
104
- traits: o
128
+ traits: n
105
129
  };
106
- }, Z = (e, n) => {
107
- const a = e.getTrait(n), o = a.get("category"), s = a.get("subTraits") || {}, i = (Object.values(s).flat() || []).map((u) => u.id || u.name);
108
- e.removeTrait(i);
109
- const r = s[a.getValue()], h = e.getTraitIndex(n) + 1;
110
- r && e.addTrait(
111
- r.map((u) => ({ category: o, ...u })),
130
+ }, Z = (e, l) => {
131
+ const a = e.getTrait(l), n = a.get("category"), s = a.get("subTraits") || {}, r = (Object.values(s).flat() || []).map((c) => c.id || c.name);
132
+ e.removeTrait(r);
133
+ const p = s[a.getValue()], h = e.getTraitIndex(l) + 1;
134
+ p && e.addTrait(
135
+ p.map((c) => ({ category: n, ...c })),
112
136
  { at: h }
113
137
  );
114
- }, W = (e, n) => {
115
- n.forEach((a) => {
116
- const o = e.getTrait(a);
117
- if (!o || !o.get("subTraits")) return;
118
- const s = o.changeProp ? `change:${a}` : `change:attributes:${a}`;
138
+ }, W = (e, l) => {
139
+ l.forEach((a) => {
140
+ const n = e.getTrait(a);
141
+ if (!n || !n.get("subTraits")) return;
142
+ const s = n.changeProp ? `change:${a}` : `change:attributes:${a}`;
119
143
  e.on(s, () => Z(e, a)), Z(e, a);
120
144
  });
121
- }, Se = (e, n, a) => {
122
- const s = e.getTrait(n).get("subTraits") || {}, i = (Object.values(s).flat() || []).map((h) => {
123
- const u = h.name || h.id;
124
- return h.changeProp ? `change:${u}` : `change:attributes:${u}`;
125
- }), r = Array.from(new Set(i));
126
- r.length && e.on(r.join(" "), a);
127
- }, xe = {
145
+ }, we = (e, l, a) => {
146
+ const s = e.getTrait(l).get("subTraits") || {}, r = (Object.values(s).flat() || []).map((h) => {
147
+ const c = h.name || h.id;
148
+ return h.changeProp ? `change:${c}` : `change:attributes:${c}`;
149
+ }), p = Array.from(new Set(r));
150
+ p.length && e.on(p.join(" "), a);
151
+ }, Se = {
128
152
  // startAnimationDuration: {
129
153
  // type: 'number',
130
154
  // label: 'Start duration',
@@ -133,12 +157,12 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
133
157
  // step: 50,
134
158
  // min: 0
135
159
  // },
136
- [O]: {
160
+ [H]: {
137
161
  type: "button",
138
162
  label: "Toggle Gallery",
139
- command: (e, n) => {
140
- var a, o;
141
- return (o = (a = n.target) == null ? void 0 : a.getView()) == null ? void 0 : o.toggleGallery();
163
+ command: (e, l) => {
164
+ var a, n;
165
+ return (n = (a = l.target) == null ? void 0 : a.getView()) == null ? void 0 : n.toggleGallery();
142
166
  }
143
167
  },
144
168
  speed: {
@@ -238,7 +262,7 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
238
262
  visible: ({ component: e }) => !!e.getTrait("closable").getValue(),
239
263
  value: !0
240
264
  }
241
- }, ke = {
265
+ }, xe = {
242
266
  thumbnail: {
243
267
  category: { id: "thumbnail-options", label: "Thumbnail Options" },
244
268
  type: "checkbox",
@@ -340,7 +364,7 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
340
364
  ]
341
365
  }
342
366
  }
343
- }, Ie = {
367
+ }, ke = {
344
368
  autoplay: {
345
369
  category: { id: "autoplay-options", label: "Autoplay options" },
346
370
  type: "checkbox",
@@ -394,7 +418,7 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
394
418
  ]
395
419
  }
396
420
  }
397
- }, Le = {
421
+ }, Ie = {
398
422
  zoom: {
399
423
  category: { id: "zoom-options", label: "Zoom options" },
400
424
  type: "checkbox",
@@ -446,147 +470,147 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
446
470
  ]
447
471
  }
448
472
  }
449
- }, y = "sourceType", G = "data-iframe", B = {
473
+ }, f = "sourceType", U = "data-iframe", R = {
450
474
  name: "href",
451
475
  type: "file",
452
476
  label: "Image Source"
453
- }, _ = {
477
+ }, N = {
454
478
  name: "data-src",
455
479
  label: "Video Source",
456
480
  placeholder: "https://www.youtube.com/watch?v=..."
457
- }, R = {
481
+ }, F = {
458
482
  name: "data-poster",
459
483
  label: "Video Poster",
460
484
  type: "file"
461
- }, ae = {
485
+ }, ne = {
462
486
  name: "data-src",
463
487
  label: "External Source",
464
488
  placeholder: "https://some-external-source.com/...."
465
- }, re = {
489
+ }, ce = {
466
490
  label: "Caption",
467
491
  name: "data-sub-html",
468
492
  placeholder: "My caption",
469
493
  changeProp: !1
470
- }, Ae = {
471
- [O]: {
494
+ }, Le = {
495
+ [H]: {
472
496
  type: "button",
473
497
  label: "Toggle Gallery",
474
- command: (e, n) => {
475
- var s, c;
476
- const a = n.target, o = (s = a == null ? void 0 : a.closestType(w)) == null ? void 0 : s.getView();
477
- if (o && a) {
478
- const i = ((c = o.getLightGallery()) == null ? void 0 : c.items) || [], r = Array.from(i).indexOf(a.getEl());
479
- r >= 0 && o.toggleGallery(r);
498
+ command: (e, l) => {
499
+ var s, u;
500
+ const a = l.target, n = (s = a == null ? void 0 : a.closestType(k)) == null ? void 0 : s.getView();
501
+ if (n && a) {
502
+ const r = ((u = n.getLightGallery()) == null ? void 0 : u.items) || [], p = Array.from(r).indexOf(a.getEl());
503
+ p >= 0 && n.toggleGallery(p);
480
504
  }
481
505
  }
482
506
  },
483
- [y]: {
507
+ [f]: {
484
508
  type: "radio",
485
509
  label: "Source type",
486
510
  labelToTitle: !0,
487
511
  value: "image",
488
512
  subTraits: {
489
- image: [B],
490
- video: [_, R],
491
- external: [ae]
513
+ image: [R],
514
+ video: [N, F],
515
+ external: [ne]
492
516
  },
493
517
  options: [
494
- { id: "image", label: B.label || "", icon: S.image },
495
- { id: "video", label: _.label || "", icon: S.video },
496
- { id: "external", label: ae.label || "", icon: S.external }
518
+ { id: "image", label: R.label || "", icon: I.image },
519
+ { id: "video", label: N.label || "", icon: I.video },
520
+ { id: "external", label: ne.label || "", icon: I.external }
497
521
  ]
498
522
  },
499
- subHtml: re
523
+ subHtml: ce
500
524
  // This unfortuntaly breaks other thumbnails
501
525
  // customThumb: traitCustomThumb
502
- }, Ee = "lightGalleryComponent", oe = "lgThumbnail", Pe = "lgVideo", ne = "lgAutoplay", le = "lgZoom", x = "https://cdn.jsdelivr.net/npm/lightgallery@2.8.2", Ce = function(e, n = {}) {
503
- const { Blocks: a, Components: o } = e, s = "LightGallery", c = "LightGallery Item", i = {
504
- toolbarIconOpen: S.eye,
526
+ }, Ae = "lightGalleryComponent", le = "lgThumbnail", Pe = "lgVideo", oe = "lgAutoplay", se = "lgZoom", A = "https://cdn.jsdelivr.net/npm/lightgallery@2.8.2", Ee = function(e, l = {}) {
527
+ const { Blocks: a, Components: n } = e, s = "LightGallery", u = "LightGallery Item", r = {
528
+ toolbarIconOpen: I.eye,
505
529
  block: {},
506
- lgLicenseKey: "0000-0000-000-0000",
530
+ lgLicenseKey: "92DE1DB8-7986-4F02-B908-514F97678D28",
507
531
  defaultSrc: "https://placehold.co/200/777/white.png?text=Image",
508
- plugins: [oe, Pe, ne, le],
532
+ plugins: [le, Pe, oe, se],
509
533
  cdnScript: [
510
- `${x}/lightgallery.min.js`,
511
- `${x}/plugins/thumbnail/lg-thumbnail.min.js`,
512
- `${x}/plugins/video/lg-video.min.js`,
513
- `${x}/plugins/autoplay/lg-autoplay.min.js`,
514
- `${x}/plugins/zoom/lg-zoom.min.js`
534
+ `${A}/lightgallery.min.js`,
535
+ `${A}/plugins/thumbnail/lg-thumbnail.min.js`,
536
+ `${A}/plugins/video/lg-video.min.js`,
537
+ `${A}/plugins/autoplay/lg-autoplay.min.js`,
538
+ `${A}/plugins/zoom/lg-zoom.min.js`
515
539
  ],
516
- cdnStyle: `${x}/css/lightgallery-bundle.min.css`,
517
- ...n
518
- }, { block: r, toolbarIconOpen: h, defaultSrc: u } = i, I = function(t) {
519
- const l = this, p = window, { plugins: b, cdnScript: v, cdnStyle: L, inline: q, lgLicenseKey: ce, ...d } = t || {}, f = (g) => isNaN(g) ? void 0 : parseInt(g, 10), Q = () => {
520
- var P;
521
- const g = {
522
- ...d,
523
- licenseKey: ce,
524
- speed: f(d.speed),
525
- startAnimationDuration: f(d.startAnimationDuration),
526
- thumbMargin: f(d.thumbMargin),
527
- thumbWidth: f(d.thumbWidth),
528
- slideShowInterval: f(d.slideShowInterval),
529
- scale: f(d.scale),
530
- enableZoomAfter: f(d.enableZoomAfter),
531
- plugins: (b || []).map((C) => p[C])
540
+ cdnStyle: `${A}/css/lightgallery-bundle.min.css`,
541
+ ...l
542
+ }, { block: p, toolbarIconOpen: h, defaultSrc: c } = r, i = function(t) {
543
+ const o = this, g = window, { plugins: m, cdnScript: w, cdnStyle: O, inline: J, lgLicenseKey: pe, ...y } = t || {}, S = (d) => isNaN(d) ? void 0 : parseInt(d, 10), Q = () => {
544
+ var $;
545
+ const d = {
546
+ ...y,
547
+ licenseKey: pe,
548
+ speed: S(y.speed),
549
+ startAnimationDuration: S(y.startAnimationDuration),
550
+ thumbMargin: S(y.thumbMargin),
551
+ thumbWidth: S(y.thumbWidth),
552
+ slideShowInterval: S(y.slideShowInterval),
553
+ scale: S(y.scale),
554
+ enableZoomAfter: S(y.enableZoomAfter),
555
+ plugins: (m || []).map((K) => g[K])
532
556
  };
533
- q && (g.container = l, g.closable = !1);
534
- const j = (P = p.lightGallery) == null ? void 0 : P.call(p, l, g);
535
- q && j.openGallery();
557
+ J && (d.container = o, d.closable = !1);
558
+ const j = ($ = g.lightGallery) == null ? void 0 : $.call(g, o, d);
559
+ J && j.openGallery();
536
560
  };
537
- if (p.lightGallery)
561
+ if (g.lightGallery)
538
562
  Q();
539
563
  else {
540
- const { head: g } = document, j = Array.isArray(v) ? [...v] : [v], P = Array.isArray(L) ? [...L] : [L], C = (T) => {
541
- if (T.length) {
542
- const m = document.createElement("link");
543
- m.href = T.shift(), m.rel = "stylesheet", g.appendChild(m), C(T);
564
+ const { head: d } = document, j = Array.isArray(w) ? [...w] : [w], $ = Array.isArray(O) ? [...O] : [O], K = (x) => {
565
+ if (x.length) {
566
+ const v = document.createElement("link");
567
+ v.href = x.shift(), v.rel = "stylesheet", d.appendChild(v), K(x);
544
568
  }
545
- }, X = (T) => {
546
- if (T.length) {
547
- const m = document.createElement("script");
548
- m.src = T.shift(), m.onerror = m.onload = X.bind(null, T), g.appendChild(m);
569
+ }, X = (x) => {
570
+ if (x.length) {
571
+ const v = document.createElement("script");
572
+ v.src = x.shift(), v.onerror = v.onload = X.bind(null, x), d.appendChild(v);
549
573
  } else
550
574
  Q();
551
575
  };
552
- C(P), X(j);
576
+ K($), X(j);
553
577
  }
554
- }, E = (t) => {
555
- const l = t.getTrait(O);
556
- if (!h || !l) return;
557
- const { toolbar: p } = t, b = {
558
- id: O,
578
+ }, b = (t) => {
579
+ const o = t.getTrait(H);
580
+ if (!h || !o) return;
581
+ const { toolbar: g } = t, m = {
582
+ id: H,
559
583
  label: h,
560
- command: () => setTimeout(() => l.runCommand(), 100)
584
+ command: () => setTimeout(() => o.runCommand(), 100)
561
585
  };
562
- !p.find((L) => L.id === b.id) && (p == null || p.unshift(b));
586
+ !g.find((O) => O.id === m.id) && (g == null || g.unshift(m));
563
587
  };
564
- let M = [];
565
- const N = i.plugins || [], $ = A(xe), H = N.includes(oe) ? A(ke) : U, D = N.includes(ne) ? A(Ie) : U, K = N.includes(le) ? A(Le) : U;
566
- o.addType(w, {
567
- block: r && {
588
+ let C = [];
589
+ const T = r.plugins || [], _ = M(Se), L = T.includes(le) ? M(xe) : B, G = T.includes(oe) ? M(ke) : B, V = T.includes(se) ? M(Ie) : B;
590
+ n.addType(k, {
591
+ block: p && {
568
592
  label: s,
569
- media: S.gallery,
593
+ media: I.gallery,
570
594
  category: "Extra",
571
595
  select: !0,
572
- ...i.block
596
+ ...r.block
573
597
  },
574
- isComponent: (t) => z(t, V),
598
+ isComponent: (t) => z(t, D),
575
599
  extendFn: ["init", "initToolbar"],
576
600
  model: {
577
601
  defaults: {
578
602
  name: s,
579
- icon: S.gallery,
580
- draggable: (t, l) => !l.is(w),
581
- attributes: { [V]: !0 },
582
- components: { type: ee },
583
- script: I,
603
+ icon: I.gallery,
604
+ draggable: (t, o) => !o.is(k),
605
+ attributes: { [D]: !0 },
606
+ components: { type: te },
607
+ script: i,
584
608
  selector: "",
585
609
  exThumbImage: "",
586
- cdnScript: i.cdnScript,
587
- cdnStyle: i.cdnStyle,
588
- plugins: i.plugins,
589
- lgLicenseKey: i.lgLicenseKey,
610
+ cdnScript: r.cdnScript,
611
+ cdnStyle: r.cdnStyle,
612
+ plugins: r.plugins,
613
+ lgLicenseKey: r.lgLicenseKey,
590
614
  "script-props": [
591
615
  "lgLicenseKey",
592
616
  "cdnScript",
@@ -594,22 +618,22 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
594
618
  "plugins",
595
619
  "selector",
596
620
  "exThumbImage",
597
- ...$.propKeys,
598
- ...H.propKeys,
599
- ...D.propKeys,
600
- ...K.propKeys
621
+ ..._.propKeys,
622
+ ...L.propKeys,
623
+ ...G.propKeys,
624
+ ...V.propKeys
601
625
  ],
602
- ...$.props,
603
- ...H.props,
604
- ...D.props,
605
- ...K.props,
606
- traits: [...$.traits, ...H.traits, ...D.traits, ...K.traits]
626
+ ..._.props,
627
+ ...L.props,
628
+ ...G.props,
629
+ ...V.props,
630
+ traits: [..._.traits, ...L.traits, ...G.traits, ...V.traits]
607
631
  },
608
632
  init() {
609
633
  W(this, ["thumbnail"]), W(this, ["autoplay"]), W(this, ["zoom"]);
610
634
  },
611
635
  initToolbar() {
612
- E(this);
636
+ b(this);
613
637
  }
614
638
  },
615
639
  extendFnView: ["init"],
@@ -621,7 +645,7 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
621
645
  lgAfterClose: "onLgClose"
622
646
  }),
623
647
  init() {
624
- const t = o.events.scriptUnmount;
648
+ const t = n.events.scriptUnmount;
625
649
  t && this.listenTo(this.model, t, this.destroyLightGallery);
626
650
  },
627
651
  getLightGallery() {
@@ -636,83 +660,84 @@ const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-
636
660
  t.lgOpened = !0;
637
661
  },
638
662
  isInlineGallery() {
639
- var l;
663
+ var o;
640
664
  const t = this.getLightGallery();
641
- return ((l = t == null ? void 0 : t.settings) == null ? void 0 : l.container) === this.el;
665
+ return ((o = t == null ? void 0 : t.settings) == null ? void 0 : o.container) === this.el;
642
666
  },
643
667
  onLgInit(t) {
644
668
  this.el.__lg = t.detail.instance, !this.isInlineGallery() && this.disableLgInCanvas();
645
669
  },
646
670
  onLgOpen() {
647
- const { em: t } = this, { Canvas: l } = t, p = this.getLightGallery();
648
- M = l.getSpots(), setTimeout(() => l.removeSpots()), p.__lgOpened = !0;
671
+ const { em: t } = this, { Canvas: o } = t, g = this.getLightGallery();
672
+ C = o.getSpots(), setTimeout(() => o.removeSpots()), g.__lgOpened = !0;
649
673
  },
650
674
  onLgClose() {
651
675
  const t = this.getLightGallery();
652
- M.forEach((l) => this.em.Canvas.addSpot(l.attributes)), M = [], t.__lgOpened = !1, setTimeout(() => this.disableLgInCanvas());
676
+ C.forEach((o) => this.em.Canvas.addSpot(o.attributes)), C = [], t.__lgOpened = !1, setTimeout(() => this.disableLgInCanvas());
653
677
  },
654
678
  toggleGallery(t) {
655
- const l = this.getLightGallery();
656
- if (l.__lgOpened) return l.closeGallery(!0);
657
- l.lgOpened = !1, l.openGallery(t);
679
+ const o = this.getLightGallery();
680
+ if (o.__lgOpened) return o.closeGallery(!0);
681
+ o.lgOpened = !1, o.openGallery(t);
658
682
  }
659
683
  }
660
684
  });
661
- const J = A(Ae);
662
- o.addType(ee, {
663
- isComponent: (t) => z(t, te) || t.tagName === "A" && z(t.parentElement, V),
685
+ const q = M(Le);
686
+ n.addType(te, {
687
+ isComponent: (t) => z(t, ae) || t.tagName === "A" && z(t.parentElement, D),
664
688
  extendFn: ["init", "initToolbar"],
665
689
  model: {
666
690
  defaults: {
667
691
  tagName: "a",
668
- name: c,
669
- icon: S.galleryItem,
670
- attributes: { [te]: !0, href: u },
671
- components: { type: "image", attributes: { alt: "Image", src: u } },
672
- ...J.props,
673
- traits: [...J.traits]
692
+ name: u,
693
+ icon: I.galleryItem,
694
+ attributes: { [ae]: !0, href: c },
695
+ components: { type: "image", attributes: { alt: "Image", src: c } },
696
+ ...q.props,
697
+ traits: [...q.traits]
674
698
  },
675
699
  init() {
676
- const t = [y].map((l) => `change:${l}`).join(" ");
677
- this.initSourceType(), this.on(t, this.updateTraits), this.updateTraits({ init: !0 }), this.initScriptUpdate(), Se(this, y, this.triggerGalleryUpdate);
700
+ const t = [f].map((o) => `change:${o}`).join(" ");
701
+ this.initSourceType(), this.on(t, this.updateTraits), this.updateTraits({ init: !0 }), this.initScriptUpdate(), we(this, f, this.triggerGalleryUpdate);
678
702
  },
679
703
  initToolbar() {
680
- E(this);
704
+ b(this);
681
705
  },
682
706
  initScriptUpdate() {
683
- const t = [re.name].map((l) => `change:attributes:${l}`).join(" ");
707
+ const t = [ce.name].map((o) => `change:attributes:${o}`).join(" ");
684
708
  this.on(t, this.triggerGalleryUpdate);
685
709
  },
686
710
  triggerGalleryUpdate(...t) {
687
- var l;
688
- (l = this.closestType(w)) == null || l.__scriptPropsChange(...t);
711
+ var o;
712
+ (o = this.closestType(k)) == null || o.__scriptPropsChange(...t);
689
713
  },
690
714
  updateTraits(t = {}) {
691
- const { changed: l } = this, { init: p } = t;
692
- if (l[y] || p) {
693
- Z(this, y);
694
- const b = this.getTrait(y).getValue();
695
- if (b === k.image) {
696
- this.removeAttributes([_.name, R.name, G]);
697
- const v = this.getTrait(B.name);
698
- v.setValue(v.getValue() || u);
699
- } else b === k.video ? this.removeAttributes([G]) : b === k.external && this.addAttributes({ [G]: !0 });
715
+ const { changed: o } = this, { init: g } = t;
716
+ if (o[f] || g) {
717
+ Z(this, f);
718
+ const m = this.getTrait(f).getValue();
719
+ if (m === P.image) {
720
+ this.removeAttributes([N.name, F.name, U]);
721
+ const w = this.getTrait(R.name);
722
+ w.setValue(w.getValue() || c);
723
+ } else m === P.video ? this.removeAttributes([U]) : m === P.external && this.addAttributes({ [U]: !0 });
700
724
  }
701
725
  },
702
726
  initSourceType() {
703
727
  const t = this.getAttributes({ noClass: !0, noStyle: !0 });
704
- t[G] ? this.set(y, k.external) : (t[_.name] || t[R.name]) && this.set(y, k.video);
728
+ t[U] ? this.set(f, P.external) : (t[N.name] || t[F.name]) && this.set(f, P.video);
705
729
  }
706
730
  }
707
- }), Te({
731
+ }), fe({
708
732
  editor: e,
709
- licenseKey: i.licenseKey,
710
- pluginName: Ee,
733
+ plan: E.free,
734
+ licenseKey: r.licenseKey,
735
+ pluginName: Ae,
711
736
  cleanup: () => {
712
- a.remove(w), o.removeType(w);
737
+ a.remove(k), n.removeType(k);
713
738
  }
714
739
  });
715
- }, Ge = fe(Ce);
740
+ }, Ce = ve(Ee);
716
741
  export {
717
- Ge as default
742
+ Ce as default
718
743
  };