@templatical/media-library 0.25.0 → 0.25.2
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,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as ee, c as te, d as ne, et as re, f as ie, g as ae, h as oe, i as se, it as A, j, k as M, l as ce, m as le, n as ue, nt as de, o as fe, ot as N, p as pe, q as P, r as me, rt as F, s as he, st as I, t as ge, tt as L, u as _e, v as ve, w as R, x as ye, y as be, z } from "./chunks/icons-
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as ee, c as te, d as ne, et as re, f as ie, g as ae, h as oe, i as se, it as A, j, k as M, l as ce, m as le, n as ue, nt as de, o as fe, ot as N, p as pe, q as P, r as me, rt as F, s as he, st as I, t as ge, tt as L, u as _e, v as ve, w as R, x as ye, y as be, z } from "./chunks/icons-BuORgodq.js";
|
|
2
2
|
//#region ../types/src/config.ts
|
|
3
3
|
var xe = class extends Error {
|
|
4
4
|
statusCode;
|
|
@@ -520,7 +520,7 @@ function Be(e, t, n, r) {
|
|
|
520
520
|
//#region src/keys.ts
|
|
521
521
|
var Ve = Symbol("templaticalMediaPopoverTarget");
|
|
522
522
|
//#endregion
|
|
523
|
-
//#region ../../node_modules/.pnpm/vue-advanced-cropper@2.8.9_vue@3.5.
|
|
523
|
+
//#region ../../node_modules/.pnpm/vue-advanced-cropper@2.8.9_vue@3.5.41_typescript@6.0.3_/node_modules/vue-advanced-cropper/dist/index.esm-bundler.js
|
|
524
524
|
function He(e, t) {
|
|
525
525
|
var n = Object.keys(e);
|
|
526
526
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -599,8 +599,10 @@ var Ke, qe, Je, G = (Ke = function(e) {
|
|
|
599
599
|
var o = n.apply(null, i);
|
|
600
600
|
o && e.push(o);
|
|
601
601
|
}
|
|
602
|
-
} else if (a === "object")
|
|
603
|
-
|
|
602
|
+
} else if (a === "object") {
|
|
603
|
+
if (i.toString === Object.prototype.toString) for (var s in i) t.call(i, s) && i[s] && e.push(s);
|
|
604
|
+
else e.push(i.toString());
|
|
605
|
+
}
|
|
604
606
|
}
|
|
605
607
|
}
|
|
606
608
|
return e.join(" ");
|
|
@@ -1033,7 +1035,7 @@ function Z(e) {
|
|
|
1033
1035
|
return e.width / e.height;
|
|
1034
1036
|
}
|
|
1035
1037
|
function kt(e, t) {
|
|
1036
|
-
return Math.min(t.right !== void 0 && t.left !== void 0 ? (t.right - t.left) / e.width :
|
|
1038
|
+
return Math.min(t.right !== void 0 && t.left !== void 0 ? (t.right - t.left) / e.width : 1 / 0, t.bottom !== void 0 && t.top !== void 0 ? (t.bottom - t.top) / e.height : 1 / 0);
|
|
1037
1039
|
}
|
|
1038
1040
|
function At(e, t) {
|
|
1039
1041
|
var n = {
|
|
@@ -1048,16 +1050,16 @@ function jt(e, t) {
|
|
|
1048
1050
|
}
|
|
1049
1051
|
function Mt(e, t) {
|
|
1050
1052
|
var n = Z(e), r = Z(t);
|
|
1051
|
-
return t.width <
|
|
1053
|
+
return t.width < 1 / 0 && t.height < 1 / 0 ? n > r ? {
|
|
1052
1054
|
width: t.width,
|
|
1053
1055
|
height: t.width / n
|
|
1054
1056
|
} : {
|
|
1055
1057
|
width: t.height * n,
|
|
1056
1058
|
height: t.height
|
|
1057
|
-
} : t.width <
|
|
1059
|
+
} : t.width < 1 / 0 ? {
|
|
1058
1060
|
width: t.width,
|
|
1059
1061
|
height: t.width / n
|
|
1060
|
-
} : t.height <
|
|
1062
|
+
} : t.height < 1 / 0 ? {
|
|
1061
1063
|
width: t.height * n,
|
|
1062
1064
|
height: t.height
|
|
1063
1065
|
} : e;
|
|
@@ -1087,8 +1089,8 @@ function Q(e, t, n) {
|
|
|
1087
1089
|
}
|
|
1088
1090
|
function It(e) {
|
|
1089
1091
|
return {
|
|
1090
|
-
width: e.right !== void 0 && e.left !== void 0 ? e.right - e.left :
|
|
1091
|
-
height: e.bottom !== void 0 && e.top !== void 0 ? e.bottom - e.top :
|
|
1092
|
+
width: e.right !== void 0 && e.left !== void 0 ? e.right - e.left : 1 / 0,
|
|
1093
|
+
height: e.bottom !== void 0 && e.top !== void 0 ? e.bottom - e.top : 1 / 0
|
|
1092
1094
|
};
|
|
1093
1095
|
}
|
|
1094
1096
|
function Lt(e, t) {
|
|
@@ -1120,7 +1122,7 @@ function Vt(e, t) {
|
|
|
1120
1122
|
function Ht(e) {
|
|
1121
1123
|
var t = e.width, n = e.height, r = e.sizeRestrictions, i = {
|
|
1122
1124
|
minimum: e.aspectRatio && e.aspectRatio.minimum || 0,
|
|
1123
|
-
maximum: e.aspectRatio && e.aspectRatio.maximum ||
|
|
1125
|
+
maximum: e.aspectRatio && e.aspectRatio.maximum || 1 / 0
|
|
1124
1126
|
}, a = {
|
|
1125
1127
|
width: Math.max(r.minWidth, Math.min(r.maxWidth, t)),
|
|
1126
1128
|
height: Math.max(r.minHeight, Math.min(r.maxHeight, n))
|
|
@@ -1273,7 +1275,7 @@ function Jt(e) {
|
|
|
1273
1275
|
};
|
|
1274
1276
|
}
|
|
1275
1277
|
function Yt(e) {
|
|
1276
|
-
var t = e.imageSize, n = e.visibleArea, r = e.aspectRatio, i = e.sizeRestrictions, a = n || t, o = Math.min(r.maximum ||
|
|
1278
|
+
var t = e.imageSize, n = e.visibleArea, r = e.aspectRatio, i = e.sizeRestrictions, a = n || t, o = Math.min(r.maximum || 1 / 0, Math.max(r.minimum || 0, Z(a))), s = a.width < a.height ? {
|
|
1277
1279
|
width: .8 * a.width,
|
|
1278
1280
|
height: .8 * a.width / o
|
|
1279
1281
|
} : {
|
|
@@ -1337,7 +1339,7 @@ function $t(e) {
|
|
|
1337
1339
|
var h = {
|
|
1338
1340
|
stencil: {
|
|
1339
1341
|
minimum: Math.max(i.minWidth ? i.minWidth / d.width : 0, i.minHeight ? i.minHeight / d.height : 0),
|
|
1340
|
-
maximum: Math.min(i.maxWidth ? i.maxWidth / d.width :
|
|
1342
|
+
maximum: Math.min(i.maxWidth ? i.maxWidth / d.width : 1 / 0, i.maxHeight ? i.maxHeight / d.height : 1 / 0, kt(d, o))
|
|
1341
1343
|
},
|
|
1342
1344
|
area: { maximum: kt(u, a({
|
|
1343
1345
|
visibleArea: u,
|
|
@@ -1412,12 +1414,12 @@ function nn(e) {
|
|
|
1412
1414
|
var d = Et(Dt(n, c), i);
|
|
1413
1415
|
s && (d.left && d.left > 0 && d.right === 0 ? (c.right += d.left, c.left -= d.left) : d.right && d.right > 0 && d.left === 0 && (c.left += d.right, c.right -= d.right), d.top && d.top > 0 && d.bottom === 0 ? (c.bottom += d.top, c.top -= d.top) : d.bottom && d.bottom > 0 && d.top === 0 && (c.top += d.bottom, c.bottom -= d.bottom), d = Et(Dt(n, c), i));
|
|
1414
1416
|
var f = {
|
|
1415
|
-
width:
|
|
1416
|
-
height:
|
|
1417
|
-
left:
|
|
1418
|
-
right:
|
|
1419
|
-
top:
|
|
1420
|
-
bottom:
|
|
1417
|
+
width: 1 / 0,
|
|
1418
|
+
height: 1 / 0,
|
|
1419
|
+
left: 1 / 0,
|
|
1420
|
+
right: 1 / 0,
|
|
1421
|
+
top: 1 / 0,
|
|
1422
|
+
bottom: 1 / 0
|
|
1421
1423
|
};
|
|
1422
1424
|
if (_t.forEach((function(e) {
|
|
1423
1425
|
var t = d[e];
|
|
@@ -1426,20 +1428,20 @@ function nn(e) {
|
|
|
1426
1428
|
var p = Math.min.apply(null, _t.map((function(e) {
|
|
1427
1429
|
return f[e];
|
|
1428
1430
|
})));
|
|
1429
|
-
p !==
|
|
1431
|
+
p !== 1 / 0 && _t.forEach((function(e) {
|
|
1430
1432
|
c[e] *= p;
|
|
1431
1433
|
}));
|
|
1432
1434
|
} else _t.forEach((function(e) {
|
|
1433
|
-
f[e] !==
|
|
1435
|
+
f[e] !== 1 / 0 && (c[e] *= f[e]);
|
|
1434
1436
|
}));
|
|
1435
1437
|
if (l = Dt(n, c).width, u = Dt(n, c).height, c.right + c.left && (l > a.maxWidth ? f.width = (a.maxWidth - n.width) / (c.right + c.left) : l < a.minWidth && (f.width = (a.minWidth - n.width) / (c.right + c.left))), c.bottom + c.top && (u > a.maxHeight ? f.height = (a.maxHeight - n.height) / (c.bottom + c.top) : u < a.minHeight && (f.height = (a.minHeight - n.height) / (c.bottom + c.top))), o) {
|
|
1436
1438
|
var m = Math.min(f.width, f.height);
|
|
1437
|
-
m !==
|
|
1439
|
+
m !== 1 / 0 && _t.forEach((function(e) {
|
|
1438
1440
|
c[e] *= m;
|
|
1439
1441
|
}));
|
|
1440
|
-
} else f.width !==
|
|
1442
|
+
} else f.width !== 1 / 0 && vt.forEach((function(e) {
|
|
1441
1443
|
c[e] *= f.width;
|
|
1442
|
-
})), f.height !==
|
|
1444
|
+
})), f.height !== 1 / 0 && yt.forEach((function(e) {
|
|
1443
1445
|
c[e] *= f.height;
|
|
1444
1446
|
}));
|
|
1445
1447
|
return c;
|
|
@@ -1933,29 +1935,30 @@ function _n(e) {
|
|
|
1933
1935
|
function vn(e) {
|
|
1934
1936
|
return new Promise((function(t, n) {
|
|
1935
1937
|
try {
|
|
1936
|
-
if (e)
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
i.
|
|
1954
|
-
|
|
1955
|
-
i.
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1938
|
+
if (e) {
|
|
1939
|
+
if (/^data:/i.test(e)) t(function(e) {
|
|
1940
|
+
e = e.replace(/^data:([^;]+);base64,/gim, "");
|
|
1941
|
+
for (var t = atob(e), n = t.length, r = new ArrayBuffer(n), i = new Uint8Array(r), a = 0; a < n; a++) i[a] = t.charCodeAt(a);
|
|
1942
|
+
return r;
|
|
1943
|
+
}(e));
|
|
1944
|
+
else if (/^blob:/i.test(e)) {
|
|
1945
|
+
var r = new FileReader();
|
|
1946
|
+
r.onload = function(e) {
|
|
1947
|
+
t(e.target.result);
|
|
1948
|
+
}, a = e, o = function(e) {
|
|
1949
|
+
r.readAsArrayBuffer(e);
|
|
1950
|
+
}, (s = new XMLHttpRequest()).open("GET", a, !0), s.responseType = "blob", s.onload = function() {
|
|
1951
|
+
this.status != 200 && this.status !== 0 || o(this.response);
|
|
1952
|
+
}, s.send();
|
|
1953
|
+
} else {
|
|
1954
|
+
var i = new XMLHttpRequest();
|
|
1955
|
+
i.onreadystatechange = function() {
|
|
1956
|
+
i.readyState === 4 && (i.status === 200 || i.status === 0 ? t(i.response) : n("Warning: could not load an image to parse its orientation"), i = null);
|
|
1957
|
+
}, i.onprogress = function() {
|
|
1958
|
+
i.getResponseHeader("content-type") !== "image/jpeg" && i.abort();
|
|
1959
|
+
}, i.withCredentials = !1, i.open("GET", e, !0), i.responseType = "arraybuffer", i.send(null);
|
|
1960
|
+
}
|
|
1961
|
+
} else n("Error: the image is empty");
|
|
1959
1962
|
} catch (e) {
|
|
1960
1963
|
n(e);
|
|
1961
1964
|
}
|
|
@@ -2895,19 +2898,19 @@ var kn = ["transitions"], An = Ye("vue-advanced-cropper"), jn = {
|
|
|
2895
2898
|
imageSize: this.imageSize,
|
|
2896
2899
|
minWidth: q(this.minWidth) ? 0 : it(this.minWidth),
|
|
2897
2900
|
minHeight: q(this.minHeight) ? 0 : it(this.minHeight),
|
|
2898
|
-
maxWidth: q(this.maxWidth) ?
|
|
2899
|
-
maxHeight: q(this.maxHeight) ?
|
|
2901
|
+
maxWidth: q(this.maxWidth) ? 1 / 0 : it(this.maxWidth),
|
|
2902
|
+
maxHeight: q(this.maxHeight) ? 1 / 0 : it(this.maxHeight)
|
|
2900
2903
|
});
|
|
2901
2904
|
if (e = function(e) {
|
|
2902
2905
|
var t = e.areaRestrictions, n = e.sizeRestrictions, r = e.boundaries, i = e.positionRestrictions, a = K(K({}, n), {
|
|
2903
2906
|
minWidth: n.minWidth === void 0 ? 0 : n.minWidth,
|
|
2904
2907
|
minHeight: n.minHeight === void 0 ? 0 : n.minHeight,
|
|
2905
|
-
maxWidth: n.maxWidth === void 0 ?
|
|
2906
|
-
maxHeight: n.maxHeight === void 0 ?
|
|
2908
|
+
maxWidth: n.maxWidth === void 0 ? 1 / 0 : n.maxWidth,
|
|
2909
|
+
maxHeight: n.maxHeight === void 0 ? 1 / 0 : n.maxHeight
|
|
2907
2910
|
});
|
|
2908
2911
|
i.left !== void 0 && i.right !== void 0 && (a.maxWidth = Math.min(a.maxWidth, i.right - i.left)), i.bottom !== void 0 && i.top !== void 0 && (a.maxHeight = Math.min(a.maxHeight, i.bottom - i.top));
|
|
2909
2912
|
var o = It(t), s = Mt(r, o);
|
|
2910
|
-
return o.width <
|
|
2913
|
+
return o.width < 1 / 0 && (!a.maxWidth || a.maxWidth > s.width) && (a.maxWidth = Math.min(a.maxWidth, s.width)), o.height < 1 / 0 && (!a.maxHeight || a.maxHeight > s.height) && (a.maxHeight = Math.min(a.maxHeight, s.height)), a.minWidth > a.maxWidth && (a.minWidth = a.maxWidth, a.widthFrozen = !0), a.minHeight > a.maxHeight && (a.minHeight = a.maxHeight, a.heightFrozen = !0), a;
|
|
2911
2914
|
}({
|
|
2912
2915
|
sizeRestrictions: e,
|
|
2913
2916
|
areaRestrictions: this.getAreaRestrictions({
|
|
@@ -3202,8 +3205,8 @@ var kn = ["transitions"], An = Ye("vue-advanced-cropper"), jn = {
|
|
|
3202
3205
|
}(this.$refs.sourceCanvas, t, this.imageTransforms) : t, r = U({
|
|
3203
3206
|
minWidth: 0,
|
|
3204
3207
|
minHeight: 0,
|
|
3205
|
-
maxWidth:
|
|
3206
|
-
maxHeight:
|
|
3208
|
+
maxWidth: 1 / 0,
|
|
3209
|
+
maxHeight: 1 / 0,
|
|
3207
3210
|
maxArea: this.maxCanvasSize,
|
|
3208
3211
|
imageSmoothingEnabled: !0,
|
|
3209
3212
|
imageSmoothingQuality: "high",
|
|
@@ -3217,8 +3220,8 @@ var kn = ["transitions"], An = Ye("vue-advanced-cropper"), jn = {
|
|
|
3217
3220
|
sizeRestrictions: {
|
|
3218
3221
|
minWidth: i([r.width, r.minWidth]) || 0,
|
|
3219
3222
|
minHeight: i([r.height, r.minHeight]) || 0,
|
|
3220
|
-
maxWidth: i([r.width, r.maxWidth]) ||
|
|
3221
|
-
maxHeight: i([r.height, r.maxHeight]) ||
|
|
3223
|
+
maxWidth: i([r.width, r.maxWidth]) || 1 / 0,
|
|
3224
|
+
maxHeight: i([r.height, r.maxHeight]) || 1 / 0
|
|
3222
3225
|
},
|
|
3223
3226
|
width: this.coordinates.width,
|
|
3224
3227
|
height: this.coordinates.height,
|
|
@@ -4375,7 +4378,7 @@ var Pn = ["data-tpl-theme"], Fn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, In
|
|
|
4375
4378
|
}
|
|
4376
4379
|
});
|
|
4377
4380
|
//#endregion
|
|
4378
|
-
//#region ../../node_modules/.pnpm/@vueuse+shared@14.4.0_vue@3.5.
|
|
4381
|
+
//#region ../../node_modules/.pnpm/@vueuse+shared@14.4.0_vue@3.5.41_typescript@6.0.3_/node_modules/@vueuse/shared/dist/index.js
|
|
4379
4382
|
function Ar(e, t) {
|
|
4380
4383
|
return T() ? (E(e, t), !0) : !1;
|
|
4381
4384
|
}
|
|
@@ -4488,7 +4491,7 @@ function Gr(e, t, n) {
|
|
|
4488
4491
|
});
|
|
4489
4492
|
}
|
|
4490
4493
|
//#endregion
|
|
4491
|
-
//#region ../../node_modules/.pnpm/@vueuse+core@14.4.0_vue@3.5.
|
|
4494
|
+
//#region ../../node_modules/.pnpm/@vueuse+core@14.4.0_vue@3.5.41_typescript@6.0.3_/node_modules/@vueuse/core/dist/index.js
|
|
4492
4495
|
var Kr = Mr ? window : void 0, qr = Mr ? window.document : void 0, Jr = Mr ? window.navigator : void 0;
|
|
4493
4496
|
function Yr(e) {
|
|
4494
4497
|
let t = F(e);
|
|
@@ -4636,10 +4639,12 @@ function ni(e = {}) {
|
|
|
4636
4639
|
} catch {
|
|
4637
4640
|
e = !0;
|
|
4638
4641
|
}
|
|
4639
|
-
if (e)
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4642
|
+
if (e) {
|
|
4643
|
+
if (typeof n == "string") d.value = n, y(n);
|
|
4644
|
+
else {
|
|
4645
|
+
let e = ++h, t = await n();
|
|
4646
|
+
t != null && e === h && (d.value = t, y(t));
|
|
4647
|
+
}
|
|
4643
4648
|
}
|
|
4644
4649
|
f.value = !0, m.start(), p.value = !1;
|
|
4645
4650
|
}
|