@wix/editor-react-components 1.2449.0 → 1.2451.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/site/components/GoogleMap/component.js +1 -1
- package/dist/site/components/Image3/component.js +1 -1
- package/dist/site/components/TransparentVideo/component.js +28 -82
- package/dist/site/components/TransparentVideo/css.css +6 -4
- package/dist/site/components/chunks/Image.js +1 -1
- package/dist/site/components/chunks/customElementInit.js +1 -1
- package/dist/site/components/chunks/index4.js +2312 -1405
- package/dist/site/components/chunks/index5.js +1405 -2312
- package/dist/site/components/chunks/parseHtml.js +1 -1
- package/dist/site/components/chunks/parseSvg.js +1 -1
- package/package.json +4 -4
- package/dist/site/components/TransparentVideo/transparentVideoPoster.d.ts +0 -9
|
@@ -1,2372 +1,1465 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return this.next;
|
|
128
|
-
},
|
|
129
|
-
set: function(next) {
|
|
130
|
-
this.next = next;
|
|
131
|
-
},
|
|
132
|
-
enumerable: false,
|
|
133
|
-
configurable: true
|
|
134
|
-
});
|
|
135
|
-
Node2.prototype.cloneNode = function(recursive) {
|
|
136
|
-
if (recursive === void 0) {
|
|
137
|
-
recursive = false;
|
|
138
|
-
}
|
|
139
|
-
return cloneNode(this, recursive);
|
|
140
|
-
};
|
|
141
|
-
return Node2;
|
|
142
|
-
})()
|
|
143
|
-
);
|
|
144
|
-
node.Node = Node;
|
|
145
|
-
var DataNode = (
|
|
146
|
-
/** @class */
|
|
147
|
-
(function(_super) {
|
|
148
|
-
__extends(DataNode2, _super);
|
|
149
|
-
function DataNode2(data) {
|
|
150
|
-
var _this = _super.call(this) || this;
|
|
151
|
-
_this.data = data;
|
|
152
|
-
return _this;
|
|
153
|
-
}
|
|
154
|
-
Object.defineProperty(DataNode2.prototype, "nodeValue", {
|
|
155
|
-
/**
|
|
156
|
-
* Same as {@link data}.
|
|
157
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
158
|
-
*/
|
|
159
|
-
get: function() {
|
|
160
|
-
return this.data;
|
|
161
|
-
},
|
|
162
|
-
set: function(data) {
|
|
163
|
-
this.data = data;
|
|
164
|
-
},
|
|
165
|
-
enumerable: false,
|
|
166
|
-
configurable: true
|
|
167
|
-
});
|
|
168
|
-
return DataNode2;
|
|
169
|
-
})(Node)
|
|
170
|
-
);
|
|
171
|
-
node.DataNode = DataNode;
|
|
172
|
-
var Text = (
|
|
173
|
-
/** @class */
|
|
174
|
-
(function(_super) {
|
|
175
|
-
__extends(Text2, _super);
|
|
176
|
-
function Text2() {
|
|
177
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
178
|
-
_this.type = domelementtype_1.ElementType.Text;
|
|
179
|
-
return _this;
|
|
180
|
-
}
|
|
181
|
-
Object.defineProperty(Text2.prototype, "nodeType", {
|
|
182
|
-
get: function() {
|
|
183
|
-
return 3;
|
|
184
|
-
},
|
|
185
|
-
enumerable: false,
|
|
186
|
-
configurable: true
|
|
187
|
-
});
|
|
188
|
-
return Text2;
|
|
189
|
-
})(DataNode)
|
|
190
|
-
);
|
|
191
|
-
node.Text = Text;
|
|
192
|
-
var Comment = (
|
|
193
|
-
/** @class */
|
|
194
|
-
(function(_super) {
|
|
195
|
-
__extends(Comment2, _super);
|
|
196
|
-
function Comment2() {
|
|
197
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
198
|
-
_this.type = domelementtype_1.ElementType.Comment;
|
|
199
|
-
return _this;
|
|
200
|
-
}
|
|
201
|
-
Object.defineProperty(Comment2.prototype, "nodeType", {
|
|
202
|
-
get: function() {
|
|
203
|
-
return 8;
|
|
204
|
-
},
|
|
205
|
-
enumerable: false,
|
|
206
|
-
configurable: true
|
|
207
|
-
});
|
|
208
|
-
return Comment2;
|
|
209
|
-
})(DataNode)
|
|
210
|
-
);
|
|
211
|
-
node.Comment = Comment;
|
|
212
|
-
var ProcessingInstruction = (
|
|
213
|
-
/** @class */
|
|
214
|
-
(function(_super) {
|
|
215
|
-
__extends(ProcessingInstruction2, _super);
|
|
216
|
-
function ProcessingInstruction2(name, data) {
|
|
217
|
-
var _this = _super.call(this, data) || this;
|
|
218
|
-
_this.name = name;
|
|
219
|
-
_this.type = domelementtype_1.ElementType.Directive;
|
|
220
|
-
return _this;
|
|
221
|
-
}
|
|
222
|
-
Object.defineProperty(ProcessingInstruction2.prototype, "nodeType", {
|
|
223
|
-
get: function() {
|
|
224
|
-
return 1;
|
|
225
|
-
},
|
|
226
|
-
enumerable: false,
|
|
227
|
-
configurable: true
|
|
228
|
-
});
|
|
229
|
-
return ProcessingInstruction2;
|
|
230
|
-
})(DataNode)
|
|
231
|
-
);
|
|
232
|
-
node.ProcessingInstruction = ProcessingInstruction;
|
|
233
|
-
var NodeWithChildren = (
|
|
234
|
-
/** @class */
|
|
235
|
-
(function(_super) {
|
|
236
|
-
__extends(NodeWithChildren2, _super);
|
|
237
|
-
function NodeWithChildren2(children) {
|
|
238
|
-
var _this = _super.call(this) || this;
|
|
239
|
-
_this.children = children;
|
|
240
|
-
return _this;
|
|
241
|
-
}
|
|
242
|
-
Object.defineProperty(NodeWithChildren2.prototype, "firstChild", {
|
|
243
|
-
// Aliases
|
|
244
|
-
/** First child of the node. */
|
|
245
|
-
get: function() {
|
|
246
|
-
var _a;
|
|
247
|
-
return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
|
|
248
|
-
},
|
|
249
|
-
enumerable: false,
|
|
250
|
-
configurable: true
|
|
251
|
-
});
|
|
252
|
-
Object.defineProperty(NodeWithChildren2.prototype, "lastChild", {
|
|
253
|
-
/** Last child of the node. */
|
|
254
|
-
get: function() {
|
|
255
|
-
return this.children.length > 0 ? this.children[this.children.length - 1] : null;
|
|
256
|
-
},
|
|
257
|
-
enumerable: false,
|
|
258
|
-
configurable: true
|
|
259
|
-
});
|
|
260
|
-
Object.defineProperty(NodeWithChildren2.prototype, "childNodes", {
|
|
261
|
-
/**
|
|
262
|
-
* Same as {@link children}.
|
|
263
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
264
|
-
*/
|
|
265
|
-
get: function() {
|
|
266
|
-
return this.children;
|
|
267
|
-
},
|
|
268
|
-
set: function(children) {
|
|
269
|
-
this.children = children;
|
|
270
|
-
},
|
|
271
|
-
enumerable: false,
|
|
272
|
-
configurable: true
|
|
273
|
-
});
|
|
274
|
-
return NodeWithChildren2;
|
|
275
|
-
})(Node)
|
|
276
|
-
);
|
|
277
|
-
node.NodeWithChildren = NodeWithChildren;
|
|
278
|
-
var CDATA = (
|
|
279
|
-
/** @class */
|
|
280
|
-
(function(_super) {
|
|
281
|
-
__extends(CDATA2, _super);
|
|
282
|
-
function CDATA2() {
|
|
283
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
284
|
-
_this.type = domelementtype_1.ElementType.CDATA;
|
|
285
|
-
return _this;
|
|
286
|
-
}
|
|
287
|
-
Object.defineProperty(CDATA2.prototype, "nodeType", {
|
|
288
|
-
get: function() {
|
|
289
|
-
return 4;
|
|
290
|
-
},
|
|
291
|
-
enumerable: false,
|
|
292
|
-
configurable: true
|
|
293
|
-
});
|
|
294
|
-
return CDATA2;
|
|
295
|
-
})(NodeWithChildren)
|
|
296
|
-
);
|
|
297
|
-
node.CDATA = CDATA;
|
|
298
|
-
var Document = (
|
|
299
|
-
/** @class */
|
|
300
|
-
(function(_super) {
|
|
301
|
-
__extends(Document2, _super);
|
|
302
|
-
function Document2() {
|
|
303
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
304
|
-
_this.type = domelementtype_1.ElementType.Root;
|
|
305
|
-
return _this;
|
|
306
|
-
}
|
|
307
|
-
Object.defineProperty(Document2.prototype, "nodeType", {
|
|
308
|
-
get: function() {
|
|
309
|
-
return 9;
|
|
310
|
-
},
|
|
311
|
-
enumerable: false,
|
|
312
|
-
configurable: true
|
|
313
|
-
});
|
|
314
|
-
return Document2;
|
|
315
|
-
})(NodeWithChildren)
|
|
316
|
-
);
|
|
317
|
-
node.Document = Document;
|
|
318
|
-
var Element = (
|
|
319
|
-
/** @class */
|
|
320
|
-
(function(_super) {
|
|
321
|
-
__extends(Element2, _super);
|
|
322
|
-
function Element2(name, attribs, children, type) {
|
|
323
|
-
if (children === void 0) {
|
|
324
|
-
children = [];
|
|
325
|
-
}
|
|
326
|
-
if (type === void 0) {
|
|
327
|
-
type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag;
|
|
328
|
-
}
|
|
329
|
-
var _this = _super.call(this, children) || this;
|
|
330
|
-
_this.name = name;
|
|
331
|
-
_this.attribs = attribs;
|
|
332
|
-
_this.type = type;
|
|
333
|
-
return _this;
|
|
334
|
-
}
|
|
335
|
-
Object.defineProperty(Element2.prototype, "nodeType", {
|
|
336
|
-
get: function() {
|
|
337
|
-
return 1;
|
|
338
|
-
},
|
|
339
|
-
enumerable: false,
|
|
340
|
-
configurable: true
|
|
341
|
-
});
|
|
342
|
-
Object.defineProperty(Element2.prototype, "tagName", {
|
|
343
|
-
// DOM Level 1 aliases
|
|
344
|
-
/**
|
|
345
|
-
* Same as {@link name}.
|
|
346
|
-
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
|
|
347
|
-
*/
|
|
348
|
-
get: function() {
|
|
349
|
-
return this.name;
|
|
350
|
-
},
|
|
351
|
-
set: function(name) {
|
|
352
|
-
this.name = name;
|
|
353
|
-
},
|
|
354
|
-
enumerable: false,
|
|
355
|
-
configurable: true
|
|
356
|
-
});
|
|
357
|
-
Object.defineProperty(Element2.prototype, "attributes", {
|
|
358
|
-
get: function() {
|
|
359
|
-
var _this = this;
|
|
360
|
-
return Object.keys(this.attribs).map(function(name) {
|
|
361
|
-
var _a, _b;
|
|
362
|
-
return {
|
|
363
|
-
name,
|
|
364
|
-
value: _this.attribs[name],
|
|
365
|
-
namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
|
|
366
|
-
prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name]
|
|
367
|
-
};
|
|
368
|
-
});
|
|
369
|
-
},
|
|
370
|
-
enumerable: false,
|
|
371
|
-
configurable: true
|
|
372
|
-
});
|
|
373
|
-
return Element2;
|
|
374
|
-
})(NodeWithChildren)
|
|
375
|
-
);
|
|
376
|
-
node.Element = Element;
|
|
377
|
-
function isTag(node2) {
|
|
378
|
-
return (0, domelementtype_1.isTag)(node2);
|
|
379
|
-
}
|
|
380
|
-
node.isTag = isTag;
|
|
381
|
-
function isCDATA(node2) {
|
|
382
|
-
return node2.type === domelementtype_1.ElementType.CDATA;
|
|
383
|
-
}
|
|
384
|
-
node.isCDATA = isCDATA;
|
|
385
|
-
function isText(node2) {
|
|
386
|
-
return node2.type === domelementtype_1.ElementType.Text;
|
|
387
|
-
}
|
|
388
|
-
node.isText = isText;
|
|
389
|
-
function isComment(node2) {
|
|
390
|
-
return node2.type === domelementtype_1.ElementType.Comment;
|
|
391
|
-
}
|
|
392
|
-
node.isComment = isComment;
|
|
393
|
-
function isDirective(node2) {
|
|
394
|
-
return node2.type === domelementtype_1.ElementType.Directive;
|
|
395
|
-
}
|
|
396
|
-
node.isDirective = isDirective;
|
|
397
|
-
function isDocument(node2) {
|
|
398
|
-
return node2.type === domelementtype_1.ElementType.Root;
|
|
1
|
+
const API_VERSION = "v1";
|
|
2
|
+
const MAX_DEVICE_PIXEL_RATIO = 2;
|
|
3
|
+
const DSKTP_MAX_BG_SITE_LEGACY_WIDTH = 1920;
|
|
4
|
+
const DSKTP_MAX_BG_SITE_LEGACY_HEIGHT = 1920;
|
|
5
|
+
const MOBILE_MAX_BG_SITE_LEGACY_WIDTH = 1e3;
|
|
6
|
+
const MOBILE_MAX_BG_SITE_LEGACY_HEIGHT = 1e3;
|
|
7
|
+
const fittingTypes = {
|
|
8
|
+
SCALE_TO_FILL: "fill",
|
|
9
|
+
SCALE_TO_FIT: "fit",
|
|
10
|
+
STRETCH: "stretch",
|
|
11
|
+
ORIGINAL_SIZE: "original_size",
|
|
12
|
+
TILE: "tile",
|
|
13
|
+
TILE_HORIZONTAL: "tile_horizontal",
|
|
14
|
+
TILE_VERTICAL: "tile_vertical",
|
|
15
|
+
FIT_AND_TILE: "fit_and_tile",
|
|
16
|
+
LEGACY_STRIP_TILE: "legacy_strip_tile",
|
|
17
|
+
LEGACY_STRIP_TILE_HORIZONTAL: "legacy_strip_tile_horizontal",
|
|
18
|
+
LEGACY_STRIP_TILE_VERTICAL: "legacy_strip_tile_vertical",
|
|
19
|
+
LEGACY_STRIP_SCALE_TO_FILL: "legacy_strip_fill",
|
|
20
|
+
LEGACY_STRIP_SCALE_TO_FIT: "legacy_strip_fit",
|
|
21
|
+
LEGACY_STRIP_FIT_AND_TILE: "legacy_strip_fit_and_tile",
|
|
22
|
+
LEGACY_STRIP_ORIGINAL_SIZE: "legacy_strip_original_size",
|
|
23
|
+
LEGACY_ORIGINAL_SIZE: "actual_size",
|
|
24
|
+
LEGACY_FIT_WIDTH: "fitWidth",
|
|
25
|
+
LEGACY_FIT_HEIGHT: "fitHeight",
|
|
26
|
+
LEGACY_FULL: "full",
|
|
27
|
+
LEGACY_BG_FIT_AND_TILE: "legacy_tile",
|
|
28
|
+
LEGACY_BG_FIT_AND_TILE_HORIZONTAL: "legacy_tile_horizontal",
|
|
29
|
+
LEGACY_BG_FIT_AND_TILE_VERTICAL: "legacy_tile_vertical",
|
|
30
|
+
LEGACY_BG_NORMAL: "legacy_normal"
|
|
31
|
+
};
|
|
32
|
+
const transformTypes = {
|
|
33
|
+
FIT: "fit",
|
|
34
|
+
FILL: "fill",
|
|
35
|
+
FILL_FOCAL: "fill_focal",
|
|
36
|
+
CROP: "crop",
|
|
37
|
+
LEGACY_CROP: "legacy_crop",
|
|
38
|
+
LEGACY_FILL: "legacy_fill"
|
|
39
|
+
};
|
|
40
|
+
const alignTypes = {
|
|
41
|
+
CENTER: "center",
|
|
42
|
+
TOP: "top",
|
|
43
|
+
TOP_LEFT: "top_left",
|
|
44
|
+
TOP_RIGHT: "top_right",
|
|
45
|
+
BOTTOM: "bottom",
|
|
46
|
+
BOTTOM_LEFT: "bottom_left",
|
|
47
|
+
BOTTOM_RIGHT: "bottom_right",
|
|
48
|
+
LEFT: "left",
|
|
49
|
+
RIGHT: "right"
|
|
50
|
+
};
|
|
51
|
+
const ALIGN_TYPE_TO_FOCAL_POINT = {
|
|
52
|
+
[alignTypes.CENTER]: { x: 0.5, y: 0.5 },
|
|
53
|
+
[alignTypes.TOP_LEFT]: { x: 0, y: 0 },
|
|
54
|
+
[alignTypes.TOP_RIGHT]: { x: 1, y: 0 },
|
|
55
|
+
[alignTypes.TOP]: { x: 0.5, y: 0 },
|
|
56
|
+
[alignTypes.BOTTOM_LEFT]: { x: 0, y: 1 },
|
|
57
|
+
[alignTypes.BOTTOM_RIGHT]: { x: 1, y: 1 },
|
|
58
|
+
[alignTypes.BOTTOM]: { x: 0.5, y: 1 },
|
|
59
|
+
[alignTypes.RIGHT]: { x: 1, y: 0.5 },
|
|
60
|
+
[alignTypes.LEFT]: { x: 0, y: 0.5 }
|
|
61
|
+
};
|
|
62
|
+
const alignTypesMap = {
|
|
63
|
+
center: "c",
|
|
64
|
+
top: "t",
|
|
65
|
+
top_left: "tl",
|
|
66
|
+
top_right: "tr",
|
|
67
|
+
bottom: "b",
|
|
68
|
+
bottom_left: "bl",
|
|
69
|
+
bottom_right: "br",
|
|
70
|
+
left: "l",
|
|
71
|
+
right: "r"
|
|
72
|
+
};
|
|
73
|
+
const htmlTag = {
|
|
74
|
+
BG: "bg",
|
|
75
|
+
SVG: "svg"
|
|
76
|
+
};
|
|
77
|
+
const upscaleMethods = {
|
|
78
|
+
AUTO: "auto",
|
|
79
|
+
CLASSIC: "classic",
|
|
80
|
+
SUPER: "super"
|
|
81
|
+
};
|
|
82
|
+
const upscaleMethodsValues = {
|
|
83
|
+
classic: 1,
|
|
84
|
+
super: 2
|
|
85
|
+
};
|
|
86
|
+
const defaultUSM = {
|
|
87
|
+
radius: "0.66",
|
|
88
|
+
amount: "1.00",
|
|
89
|
+
threshold: "0.01"
|
|
90
|
+
};
|
|
91
|
+
const emptyData = {
|
|
92
|
+
uri: "",
|
|
93
|
+
css: {
|
|
94
|
+
img: {},
|
|
95
|
+
container: {}
|
|
96
|
+
},
|
|
97
|
+
attr: {
|
|
98
|
+
img: {},
|
|
99
|
+
container: {}
|
|
100
|
+
},
|
|
101
|
+
transformed: false
|
|
102
|
+
};
|
|
103
|
+
const MAX_TRANSFORMED_IMAGE_WIDTH = 5e3;
|
|
104
|
+
const MAX_TRANSFORMED_IMAGE_HEIGHT = 5e3;
|
|
105
|
+
const SAFE_TRANSFORMED_AREA = MAX_TRANSFORMED_IMAGE_WIDTH * MAX_TRANSFORMED_IMAGE_HEIGHT;
|
|
106
|
+
const SUPER_UPSCALE_MODELS = [1.5, 2, 4];
|
|
107
|
+
const imageScaleDefaults = {
|
|
108
|
+
HIGH: {
|
|
109
|
+
size: 1400 * 1400,
|
|
110
|
+
quality: 90,
|
|
111
|
+
maxUpscale: 1
|
|
112
|
+
},
|
|
113
|
+
MEDIUM: {
|
|
114
|
+
size: 600 * 600,
|
|
115
|
+
quality: 85,
|
|
116
|
+
maxUpscale: 1
|
|
117
|
+
},
|
|
118
|
+
LOW: {
|
|
119
|
+
size: 400 * 400,
|
|
120
|
+
quality: 80,
|
|
121
|
+
maxUpscale: 1.2
|
|
122
|
+
},
|
|
123
|
+
TINY: {
|
|
124
|
+
size: 0,
|
|
125
|
+
quality: 80,
|
|
126
|
+
maxUpscale: 1.4
|
|
399
127
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
128
|
+
};
|
|
129
|
+
const imageQuality = {
|
|
130
|
+
HIGH: "HIGH",
|
|
131
|
+
MEDIUM: "MEDIUM",
|
|
132
|
+
LOW: "LOW",
|
|
133
|
+
TINY: "TINY"
|
|
134
|
+
};
|
|
135
|
+
const imageFilters = {
|
|
136
|
+
CONTRAST: "contrast",
|
|
137
|
+
BRIGHTNESS: "brightness",
|
|
138
|
+
SATURATION: "saturation",
|
|
139
|
+
HUE: "hue",
|
|
140
|
+
BLUR: "blur"
|
|
141
|
+
};
|
|
142
|
+
const fileType = {
|
|
143
|
+
JPG: "jpg",
|
|
144
|
+
JPEG: "jpeg",
|
|
145
|
+
JPE: "jpe",
|
|
146
|
+
PNG: "png",
|
|
147
|
+
WEBP: "webp",
|
|
148
|
+
WIX_ICO_MP: "wix_ico_mp",
|
|
149
|
+
WIX_MP: "wix_mp",
|
|
150
|
+
GIF: "gif",
|
|
151
|
+
AVIF: "avif",
|
|
152
|
+
UNRECOGNIZED: "unrecognized"
|
|
153
|
+
};
|
|
154
|
+
const encodingTypes = {
|
|
155
|
+
AVIF: "AVIF",
|
|
156
|
+
PAVIF: "PAVIF"
|
|
157
|
+
};
|
|
158
|
+
function template(strings, ...keys) {
|
|
159
|
+
return function(...values) {
|
|
160
|
+
const dict = values[values.length - 1] || {};
|
|
161
|
+
const result = [strings[0]];
|
|
162
|
+
keys.forEach(function(key, i) {
|
|
163
|
+
const value = Number.isInteger(key) ? values[key] : dict[key];
|
|
164
|
+
result.push(value, strings[i + 1]);
|
|
165
|
+
});
|
|
166
|
+
return result.join("");
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function last(array) {
|
|
170
|
+
return array[array.length - 1];
|
|
171
|
+
}
|
|
172
|
+
const SUPPORTED_IMAGE_EXTENSIONS = [
|
|
173
|
+
fileType.PNG,
|
|
174
|
+
fileType.JPEG,
|
|
175
|
+
fileType.JPG,
|
|
176
|
+
fileType.JPE,
|
|
177
|
+
fileType.WIX_ICO_MP,
|
|
178
|
+
fileType.WIX_MP,
|
|
179
|
+
fileType.WEBP,
|
|
180
|
+
fileType.AVIF
|
|
181
|
+
];
|
|
182
|
+
const JPG_EXTENSIONS = [
|
|
183
|
+
fileType.JPEG,
|
|
184
|
+
fileType.JPG,
|
|
185
|
+
fileType.JPE
|
|
186
|
+
];
|
|
187
|
+
function isImageTypeSupported(uri) {
|
|
188
|
+
return SUPPORTED_IMAGE_EXTENSIONS.includes(getFileExtension(uri));
|
|
189
|
+
}
|
|
190
|
+
function isValidRequest(fittingType, src, target) {
|
|
191
|
+
return target && src && !isUrlEmptyOrNone(src.id) && Object.values(fittingTypes).includes(fittingType);
|
|
192
|
+
}
|
|
193
|
+
function canTransformAnimatedWebpOrAvif(uri, hasAnimation, allowAnimatedTransform) {
|
|
194
|
+
const isAvifWebpFormat = isWEBP(uri) || isAVIF(uri);
|
|
195
|
+
if (!isAvifWebpFormat || !hasAnimation) {
|
|
196
|
+
return true;
|
|
403
197
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
var result;
|
|
410
|
-
if (isText(node2)) {
|
|
411
|
-
result = new Text(node2.data);
|
|
412
|
-
} else if (isComment(node2)) {
|
|
413
|
-
result = new Comment(node2.data);
|
|
414
|
-
} else if (isTag(node2)) {
|
|
415
|
-
var children = recursive ? cloneChildren(node2.children) : [];
|
|
416
|
-
var clone_1 = new Element(node2.name, __assign({}, node2.attribs), children);
|
|
417
|
-
children.forEach(function(child) {
|
|
418
|
-
return child.parent = clone_1;
|
|
419
|
-
});
|
|
420
|
-
if (node2.namespace != null) {
|
|
421
|
-
clone_1.namespace = node2.namespace;
|
|
422
|
-
}
|
|
423
|
-
if (node2["x-attribsNamespace"]) {
|
|
424
|
-
clone_1["x-attribsNamespace"] = __assign({}, node2["x-attribsNamespace"]);
|
|
425
|
-
}
|
|
426
|
-
if (node2["x-attribsPrefix"]) {
|
|
427
|
-
clone_1["x-attribsPrefix"] = __assign({}, node2["x-attribsPrefix"]);
|
|
428
|
-
}
|
|
429
|
-
result = clone_1;
|
|
430
|
-
} else if (isCDATA(node2)) {
|
|
431
|
-
var children = recursive ? cloneChildren(node2.children) : [];
|
|
432
|
-
var clone_2 = new CDATA(children);
|
|
433
|
-
children.forEach(function(child) {
|
|
434
|
-
return child.parent = clone_2;
|
|
435
|
-
});
|
|
436
|
-
result = clone_2;
|
|
437
|
-
} else if (isDocument(node2)) {
|
|
438
|
-
var children = recursive ? cloneChildren(node2.children) : [];
|
|
439
|
-
var clone_3 = new Document(children);
|
|
440
|
-
children.forEach(function(child) {
|
|
441
|
-
return child.parent = clone_3;
|
|
442
|
-
});
|
|
443
|
-
if (node2["x-mode"]) {
|
|
444
|
-
clone_3["x-mode"] = node2["x-mode"];
|
|
445
|
-
}
|
|
446
|
-
result = clone_3;
|
|
447
|
-
} else if (isDirective(node2)) {
|
|
448
|
-
var instruction = new ProcessingInstruction(node2.name, node2.data);
|
|
449
|
-
if (node2["x-name"] != null) {
|
|
450
|
-
instruction["x-name"] = node2["x-name"];
|
|
451
|
-
instruction["x-publicId"] = node2["x-publicId"];
|
|
452
|
-
instruction["x-systemId"] = node2["x-systemId"];
|
|
453
|
-
}
|
|
454
|
-
result = instruction;
|
|
455
|
-
} else {
|
|
456
|
-
throw new Error("Not implemented yet: ".concat(node2.type));
|
|
457
|
-
}
|
|
458
|
-
result.startIndex = node2.startIndex;
|
|
459
|
-
result.endIndex = node2.endIndex;
|
|
460
|
-
if (node2.sourceCodeLocation != null) {
|
|
461
|
-
result.sourceCodeLocation = node2.sourceCodeLocation;
|
|
462
|
-
}
|
|
463
|
-
return result;
|
|
198
|
+
return allowAnimatedTransform;
|
|
199
|
+
}
|
|
200
|
+
function canTransformGIF(uri, allowAnimatedTransform, allowFullGIFTransformation) {
|
|
201
|
+
if (!isGIF(uri)) {
|
|
202
|
+
return false;
|
|
464
203
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
for (var i = 1; i < children.length; i++) {
|
|
471
|
-
children[i].prev = children[i - 1];
|
|
472
|
-
children[i - 1].next = children[i];
|
|
473
|
-
}
|
|
474
|
-
return children;
|
|
204
|
+
return !!(allowAnimatedTransform || allowFullGIFTransformation);
|
|
205
|
+
}
|
|
206
|
+
function isImageTransformApplicable(uri, hasAnimation, allowAnimatedTransform, allowFullGIFTransformation) {
|
|
207
|
+
if (isExternalUrl(uri)) {
|
|
208
|
+
return false;
|
|
475
209
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
var hasRequiredLib$2;
|
|
479
|
-
function requireLib$2() {
|
|
480
|
-
if (hasRequiredLib$2) return lib$2;
|
|
481
|
-
hasRequiredLib$2 = 1;
|
|
482
|
-
(function(exports$1) {
|
|
483
|
-
var __createBinding = lib$2 && lib$2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
484
|
-
if (k2 === void 0) k2 = k;
|
|
485
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
486
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
487
|
-
desc = { enumerable: true, get: function() {
|
|
488
|
-
return m[k];
|
|
489
|
-
} };
|
|
490
|
-
}
|
|
491
|
-
Object.defineProperty(o, k2, desc);
|
|
492
|
-
}) : (function(o, m, k, k2) {
|
|
493
|
-
if (k2 === void 0) k2 = k;
|
|
494
|
-
o[k2] = m[k];
|
|
495
|
-
}));
|
|
496
|
-
var __exportStar = lib$2 && lib$2.__exportStar || function(m, exports$12) {
|
|
497
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$12, p)) __createBinding(exports$12, m, p);
|
|
498
|
-
};
|
|
499
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
500
|
-
exports$1.DomHandler = void 0;
|
|
501
|
-
var domelementtype_1 = /* @__PURE__ */ requireLib$3();
|
|
502
|
-
var node_js_1 = /* @__PURE__ */ requireNode();
|
|
503
|
-
__exportStar(/* @__PURE__ */ requireNode(), exports$1);
|
|
504
|
-
var defaultOpts = {
|
|
505
|
-
withStartIndices: false,
|
|
506
|
-
withEndIndices: false,
|
|
507
|
-
xmlMode: false
|
|
508
|
-
};
|
|
509
|
-
var DomHandler = (
|
|
510
|
-
/** @class */
|
|
511
|
-
(function() {
|
|
512
|
-
function DomHandler2(callback, options, elementCB) {
|
|
513
|
-
this.dom = [];
|
|
514
|
-
this.root = new node_js_1.Document(this.dom);
|
|
515
|
-
this.done = false;
|
|
516
|
-
this.tagStack = [this.root];
|
|
517
|
-
this.lastNode = null;
|
|
518
|
-
this.parser = null;
|
|
519
|
-
if (typeof options === "function") {
|
|
520
|
-
elementCB = options;
|
|
521
|
-
options = defaultOpts;
|
|
522
|
-
}
|
|
523
|
-
if (typeof callback === "object") {
|
|
524
|
-
options = callback;
|
|
525
|
-
callback = void 0;
|
|
526
|
-
}
|
|
527
|
-
this.callback = callback !== null && callback !== void 0 ? callback : null;
|
|
528
|
-
this.options = options !== null && options !== void 0 ? options : defaultOpts;
|
|
529
|
-
this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
|
|
530
|
-
}
|
|
531
|
-
DomHandler2.prototype.onparserinit = function(parser) {
|
|
532
|
-
this.parser = parser;
|
|
533
|
-
};
|
|
534
|
-
DomHandler2.prototype.onreset = function() {
|
|
535
|
-
this.dom = [];
|
|
536
|
-
this.root = new node_js_1.Document(this.dom);
|
|
537
|
-
this.done = false;
|
|
538
|
-
this.tagStack = [this.root];
|
|
539
|
-
this.lastNode = null;
|
|
540
|
-
this.parser = null;
|
|
541
|
-
};
|
|
542
|
-
DomHandler2.prototype.onend = function() {
|
|
543
|
-
if (this.done)
|
|
544
|
-
return;
|
|
545
|
-
this.done = true;
|
|
546
|
-
this.parser = null;
|
|
547
|
-
this.handleCallback(null);
|
|
548
|
-
};
|
|
549
|
-
DomHandler2.prototype.onerror = function(error) {
|
|
550
|
-
this.handleCallback(error);
|
|
551
|
-
};
|
|
552
|
-
DomHandler2.prototype.onclosetag = function() {
|
|
553
|
-
this.lastNode = null;
|
|
554
|
-
var elem = this.tagStack.pop();
|
|
555
|
-
if (this.options.withEndIndices) {
|
|
556
|
-
elem.endIndex = this.parser.endIndex;
|
|
557
|
-
}
|
|
558
|
-
if (this.elementCB)
|
|
559
|
-
this.elementCB(elem);
|
|
560
|
-
};
|
|
561
|
-
DomHandler2.prototype.onopentag = function(name, attribs) {
|
|
562
|
-
var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : void 0;
|
|
563
|
-
var element = new node_js_1.Element(name, attribs, void 0, type);
|
|
564
|
-
this.addNode(element);
|
|
565
|
-
this.tagStack.push(element);
|
|
566
|
-
};
|
|
567
|
-
DomHandler2.prototype.ontext = function(data) {
|
|
568
|
-
var lastNode = this.lastNode;
|
|
569
|
-
if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) {
|
|
570
|
-
lastNode.data += data;
|
|
571
|
-
if (this.options.withEndIndices) {
|
|
572
|
-
lastNode.endIndex = this.parser.endIndex;
|
|
573
|
-
}
|
|
574
|
-
} else {
|
|
575
|
-
var node2 = new node_js_1.Text(data);
|
|
576
|
-
this.addNode(node2);
|
|
577
|
-
this.lastNode = node2;
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
DomHandler2.prototype.oncomment = function(data) {
|
|
581
|
-
if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) {
|
|
582
|
-
this.lastNode.data += data;
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
var node2 = new node_js_1.Comment(data);
|
|
586
|
-
this.addNode(node2);
|
|
587
|
-
this.lastNode = node2;
|
|
588
|
-
};
|
|
589
|
-
DomHandler2.prototype.oncommentend = function() {
|
|
590
|
-
this.lastNode = null;
|
|
591
|
-
};
|
|
592
|
-
DomHandler2.prototype.oncdatastart = function() {
|
|
593
|
-
var text = new node_js_1.Text("");
|
|
594
|
-
var node2 = new node_js_1.CDATA([text]);
|
|
595
|
-
this.addNode(node2);
|
|
596
|
-
text.parent = node2;
|
|
597
|
-
this.lastNode = text;
|
|
598
|
-
};
|
|
599
|
-
DomHandler2.prototype.oncdataend = function() {
|
|
600
|
-
this.lastNode = null;
|
|
601
|
-
};
|
|
602
|
-
DomHandler2.prototype.onprocessinginstruction = function(name, data) {
|
|
603
|
-
var node2 = new node_js_1.ProcessingInstruction(name, data);
|
|
604
|
-
this.addNode(node2);
|
|
605
|
-
};
|
|
606
|
-
DomHandler2.prototype.handleCallback = function(error) {
|
|
607
|
-
if (typeof this.callback === "function") {
|
|
608
|
-
this.callback(error, this.dom);
|
|
609
|
-
} else if (error) {
|
|
610
|
-
throw error;
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
DomHandler2.prototype.addNode = function(node2) {
|
|
614
|
-
var parent = this.tagStack[this.tagStack.length - 1];
|
|
615
|
-
var previousSibling = parent.children[parent.children.length - 1];
|
|
616
|
-
if (this.options.withStartIndices) {
|
|
617
|
-
node2.startIndex = this.parser.startIndex;
|
|
618
|
-
}
|
|
619
|
-
if (this.options.withEndIndices) {
|
|
620
|
-
node2.endIndex = this.parser.endIndex;
|
|
621
|
-
}
|
|
622
|
-
parent.children.push(node2);
|
|
623
|
-
if (previousSibling) {
|
|
624
|
-
node2.prev = previousSibling;
|
|
625
|
-
previousSibling.next = node2;
|
|
626
|
-
}
|
|
627
|
-
node2.parent = parent;
|
|
628
|
-
this.lastNode = null;
|
|
629
|
-
};
|
|
630
|
-
return DomHandler2;
|
|
631
|
-
})()
|
|
632
|
-
);
|
|
633
|
-
exports$1.DomHandler = DomHandler;
|
|
634
|
-
exports$1.default = DomHandler;
|
|
635
|
-
})(lib$2);
|
|
636
|
-
return lib$2;
|
|
637
|
-
}
|
|
638
|
-
var constants = {};
|
|
639
|
-
var hasRequiredConstants;
|
|
640
|
-
function requireConstants() {
|
|
641
|
-
if (hasRequiredConstants) return constants;
|
|
642
|
-
hasRequiredConstants = 1;
|
|
643
|
-
(function(exports$1) {
|
|
644
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
645
|
-
exports$1.CARRIAGE_RETURN_PLACEHOLDER_REGEX = exports$1.CARRIAGE_RETURN_PLACEHOLDER = exports$1.CARRIAGE_RETURN_REGEX = exports$1.CARRIAGE_RETURN = exports$1.CASE_SENSITIVE_TAG_NAMES_MAP = exports$1.CASE_SENSITIVE_TAG_NAMES = void 0;
|
|
646
|
-
exports$1.CASE_SENSITIVE_TAG_NAMES = [
|
|
647
|
-
"animateMotion",
|
|
648
|
-
"animateTransform",
|
|
649
|
-
"clipPath",
|
|
650
|
-
"feBlend",
|
|
651
|
-
"feColorMatrix",
|
|
652
|
-
"feComponentTransfer",
|
|
653
|
-
"feComposite",
|
|
654
|
-
"feConvolveMatrix",
|
|
655
|
-
"feDiffuseLighting",
|
|
656
|
-
"feDisplacementMap",
|
|
657
|
-
"feDropShadow",
|
|
658
|
-
"feFlood",
|
|
659
|
-
"feFuncA",
|
|
660
|
-
"feFuncB",
|
|
661
|
-
"feFuncG",
|
|
662
|
-
"feFuncR",
|
|
663
|
-
"feGaussianBlur",
|
|
664
|
-
"feImage",
|
|
665
|
-
"feMerge",
|
|
666
|
-
"feMergeNode",
|
|
667
|
-
"feMorphology",
|
|
668
|
-
"feOffset",
|
|
669
|
-
"fePointLight",
|
|
670
|
-
"feSpecularLighting",
|
|
671
|
-
"feSpotLight",
|
|
672
|
-
"feTile",
|
|
673
|
-
"feTurbulence",
|
|
674
|
-
"foreignObject",
|
|
675
|
-
"linearGradient",
|
|
676
|
-
"radialGradient",
|
|
677
|
-
"textPath"
|
|
678
|
-
];
|
|
679
|
-
exports$1.CASE_SENSITIVE_TAG_NAMES_MAP = exports$1.CASE_SENSITIVE_TAG_NAMES.reduce(function(accumulator, tagName) {
|
|
680
|
-
accumulator[tagName.toLowerCase()] = tagName;
|
|
681
|
-
return accumulator;
|
|
682
|
-
}, {});
|
|
683
|
-
exports$1.CARRIAGE_RETURN = "\r";
|
|
684
|
-
exports$1.CARRIAGE_RETURN_REGEX = new RegExp(exports$1.CARRIAGE_RETURN, "g");
|
|
685
|
-
exports$1.CARRIAGE_RETURN_PLACEHOLDER = "__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(), "__");
|
|
686
|
-
exports$1.CARRIAGE_RETURN_PLACEHOLDER_REGEX = new RegExp(exports$1.CARRIAGE_RETURN_PLACEHOLDER, "g");
|
|
687
|
-
})(constants);
|
|
688
|
-
return constants;
|
|
689
|
-
}
|
|
690
|
-
var hasRequiredUtilities$2;
|
|
691
|
-
function requireUtilities$2() {
|
|
692
|
-
if (hasRequiredUtilities$2) return utilities$2;
|
|
693
|
-
hasRequiredUtilities$2 = 1;
|
|
694
|
-
Object.defineProperty(utilities$2, "__esModule", { value: true });
|
|
695
|
-
utilities$2.formatAttributes = formatAttributes;
|
|
696
|
-
utilities$2.escapeSpecialCharacters = escapeSpecialCharacters;
|
|
697
|
-
utilities$2.revertEscapedCharacters = revertEscapedCharacters;
|
|
698
|
-
utilities$2.formatDOM = formatDOM;
|
|
699
|
-
var domhandler_1 = /* @__PURE__ */ requireLib$2();
|
|
700
|
-
var constants_1 = requireConstants();
|
|
701
|
-
function getCaseSensitiveTagName(tagName) {
|
|
702
|
-
return constants_1.CASE_SENSITIVE_TAG_NAMES_MAP[tagName];
|
|
210
|
+
if (!canTransformAnimatedWebpOrAvif(uri, hasAnimation, allowAnimatedTransform)) {
|
|
211
|
+
return false;
|
|
703
212
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
213
|
+
const isSupportedImageType = isImageTypeSupported(uri);
|
|
214
|
+
const isTransformableGif = canTransformGIF(uri, allowAnimatedTransform, allowFullGIFTransformation);
|
|
215
|
+
return isSupportedImageType || isTransformableGif;
|
|
216
|
+
}
|
|
217
|
+
function isJPG(uri) {
|
|
218
|
+
return JPG_EXTENSIONS.includes(getFileExtension(uri));
|
|
219
|
+
}
|
|
220
|
+
function isPNG(uri) {
|
|
221
|
+
return getFileExtension(uri) === fileType.PNG;
|
|
222
|
+
}
|
|
223
|
+
function isWEBP(uri) {
|
|
224
|
+
return getFileExtension(uri) === fileType.WEBP;
|
|
225
|
+
}
|
|
226
|
+
function isGIF(uri) {
|
|
227
|
+
return getFileExtension(uri) === fileType.GIF;
|
|
228
|
+
}
|
|
229
|
+
function isAVIF(uri) {
|
|
230
|
+
return getFileExtension(uri) === fileType.AVIF;
|
|
231
|
+
}
|
|
232
|
+
function isExternalUrl(url) {
|
|
233
|
+
return /(^https?)|(^data)|(^\/\/)/.test(url);
|
|
234
|
+
}
|
|
235
|
+
function isUrlEmptyOrNone(url) {
|
|
236
|
+
return !url || !url.trim() || url.toLowerCase() === "none";
|
|
237
|
+
}
|
|
238
|
+
function isSEOBot(options) {
|
|
239
|
+
return (options == null ? void 0 : options.isSEOBot) ?? false;
|
|
240
|
+
}
|
|
241
|
+
const ILLEGAL_CHARS = ["/", "\\", "?", "<", ">", "|", "“", ":", '"'].map(encodeURIComponent);
|
|
242
|
+
const URL_SAFE_ILLEGAL_CHARS = ["\\.", "\\*"];
|
|
243
|
+
const ILLEGAL_CHARS_REPLACEMENT = "_";
|
|
244
|
+
function getFileName(uri, name) {
|
|
245
|
+
const beforeLeadingSlashRegexp = /\/(.*?)$/;
|
|
246
|
+
const fileExtensionRegexp = /\.([^.]*)$/;
|
|
247
|
+
const illegalCharsRegex = new RegExp(`(${ILLEGAL_CHARS.concat(URL_SAFE_ILLEGAL_CHARS).join("|")})`, "g");
|
|
248
|
+
if (name && name.length) {
|
|
249
|
+
let fileName2 = name;
|
|
250
|
+
const extension = name.match(fileExtensionRegexp);
|
|
251
|
+
if (extension && SUPPORTED_IMAGE_EXTENSIONS.includes(extension[1])) {
|
|
252
|
+
fileName2 = name.replace(fileExtensionRegexp, "");
|
|
711
253
|
}
|
|
712
|
-
return
|
|
254
|
+
return encodeURIComponent(fileName2).replace(illegalCharsRegex, ILLEGAL_CHARS_REPLACEMENT);
|
|
713
255
|
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
return
|
|
256
|
+
const trimmed = uri.match(beforeLeadingSlashRegexp);
|
|
257
|
+
const fileName = trimmed ? trimmed[1] : uri;
|
|
258
|
+
return fileName.replace(fileExtensionRegexp, "");
|
|
259
|
+
}
|
|
260
|
+
function getFileType(uri) {
|
|
261
|
+
if (isJPG(uri)) {
|
|
262
|
+
return fileType.JPG;
|
|
263
|
+
} else if (isPNG(uri)) {
|
|
264
|
+
return fileType.PNG;
|
|
265
|
+
} else if (isWEBP(uri)) {
|
|
266
|
+
return fileType.WEBP;
|
|
267
|
+
} else if (isGIF(uri)) {
|
|
268
|
+
return fileType.GIF;
|
|
269
|
+
} else if (isAVIF(uri)) {
|
|
270
|
+
return fileType.AVIF;
|
|
721
271
|
}
|
|
722
|
-
|
|
723
|
-
|
|
272
|
+
return fileType.UNRECOGNIZED;
|
|
273
|
+
}
|
|
274
|
+
function getFileExtension(uri) {
|
|
275
|
+
const splitURI = /[.]([^.]+)$/.exec(uri);
|
|
276
|
+
return (splitURI && /[.]([^.]+)$/.exec(uri)[1] || "").toLowerCase();
|
|
277
|
+
}
|
|
278
|
+
function getFitScaleFactor(sWidth, sHeight, dWidth, dHeight) {
|
|
279
|
+
return Math.min(dWidth / sWidth, dHeight / sHeight);
|
|
280
|
+
}
|
|
281
|
+
function getFillScaleFactor(sWidth, sHeight, dWidth, dHeight) {
|
|
282
|
+
return Math.max(dWidth / sWidth, dHeight / sHeight);
|
|
283
|
+
}
|
|
284
|
+
function getScaleFactor(sWidth, sHeight, dWidth, dHeight, transformType) {
|
|
285
|
+
let scaleFactor;
|
|
286
|
+
if (transformType === transformTypes.FILL) {
|
|
287
|
+
scaleFactor = getFillScaleFactor(sWidth, sHeight, dWidth, dHeight);
|
|
288
|
+
} else if (transformType === transformTypes.FIT) {
|
|
289
|
+
scaleFactor = getFitScaleFactor(sWidth, sHeight, dWidth, dHeight);
|
|
290
|
+
} else {
|
|
291
|
+
scaleFactor = 1;
|
|
724
292
|
}
|
|
725
|
-
|
|
726
|
-
|
|
293
|
+
return scaleFactor;
|
|
294
|
+
}
|
|
295
|
+
function getSafeTransformData(sWidth, sHeight, dWidth, dHeight, transformType) {
|
|
296
|
+
let scaleFactor;
|
|
297
|
+
let width = dWidth;
|
|
298
|
+
let height = dHeight;
|
|
299
|
+
scaleFactor = getScaleFactor(sWidth, sHeight, dWidth, dHeight, transformType);
|
|
300
|
+
if (transformType === transformTypes.FIT) {
|
|
301
|
+
width = sWidth * scaleFactor;
|
|
302
|
+
height = sHeight * scaleFactor;
|
|
727
303
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
var current;
|
|
734
|
-
var index = 0;
|
|
735
|
-
var nodesLength = nodes.length;
|
|
736
|
-
for (; index < nodesLength; index++) {
|
|
737
|
-
var node2 = nodes[index];
|
|
738
|
-
switch (node2.nodeType) {
|
|
739
|
-
case 1: {
|
|
740
|
-
var tagName = formatTagName(node2.nodeName);
|
|
741
|
-
current = new domhandler_1.Element(tagName, formatAttributes(node2.attributes));
|
|
742
|
-
current.children = formatDOM(
|
|
743
|
-
// template children are on content
|
|
744
|
-
tagName === "template" ? node2.content.childNodes : node2.childNodes,
|
|
745
|
-
current
|
|
746
|
-
);
|
|
747
|
-
break;
|
|
748
|
-
}
|
|
749
|
-
case 3:
|
|
750
|
-
current = new domhandler_1.Text(revertEscapedCharacters(node2.nodeValue));
|
|
751
|
-
break;
|
|
752
|
-
case 8:
|
|
753
|
-
current = new domhandler_1.Comment(node2.nodeValue);
|
|
754
|
-
break;
|
|
755
|
-
default:
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
var prev = domNodes[index - 1] || null;
|
|
759
|
-
if (prev) {
|
|
760
|
-
prev.next = current;
|
|
761
|
-
}
|
|
762
|
-
current.parent = parent;
|
|
763
|
-
current.prev = prev;
|
|
764
|
-
current.next = null;
|
|
765
|
-
domNodes.push(current);
|
|
766
|
-
}
|
|
767
|
-
if (directive) {
|
|
768
|
-
current = new domhandler_1.ProcessingInstruction(directive.substring(0, directive.indexOf(" ")).toLowerCase(), directive);
|
|
769
|
-
current.next = domNodes[0] || null;
|
|
770
|
-
current.parent = parent;
|
|
771
|
-
domNodes.unshift(current);
|
|
772
|
-
if (domNodes[1]) {
|
|
773
|
-
domNodes[1].prev = domNodes[0];
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
return domNodes;
|
|
304
|
+
if (width && height && width * height > SAFE_TRANSFORMED_AREA) {
|
|
305
|
+
const dimensionScaleFactor = Math.sqrt(SAFE_TRANSFORMED_AREA / (width * height));
|
|
306
|
+
width *= dimensionScaleFactor;
|
|
307
|
+
height *= dimensionScaleFactor;
|
|
308
|
+
scaleFactor = getScaleFactor(sWidth, sHeight, width, height, transformType);
|
|
777
309
|
}
|
|
778
|
-
return
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
if (hasRequiredDomparser) return domparser;
|
|
783
|
-
hasRequiredDomparser = 1;
|
|
784
|
-
Object.defineProperty(domparser, "__esModule", { value: true });
|
|
785
|
-
domparser.default = domparser$1;
|
|
786
|
-
var utilities_1 = requireUtilities$2();
|
|
787
|
-
var HTML = "html";
|
|
788
|
-
var HEAD = "head";
|
|
789
|
-
var BODY = "body";
|
|
790
|
-
var FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/;
|
|
791
|
-
var HEAD_TAG_REGEX = /<head[^]*>/i;
|
|
792
|
-
var BODY_TAG_REGEX = /<body[^]*>/i;
|
|
793
|
-
var parseFromDocument = function(html, tagName) {
|
|
794
|
-
throw new Error("This browser does not support `document.implementation.createHTMLDocument`");
|
|
310
|
+
return {
|
|
311
|
+
scaleFactor,
|
|
312
|
+
width,
|
|
313
|
+
height
|
|
795
314
|
};
|
|
796
|
-
|
|
797
|
-
|
|
315
|
+
}
|
|
316
|
+
function getTransformData(sWidth, sHeight, transformType, target, dpr, upscaleMethod) {
|
|
317
|
+
sWidth = sWidth || target.width;
|
|
318
|
+
sHeight = sHeight || target.height;
|
|
319
|
+
const { scaleFactor, width, height } = getSafeTransformData(sWidth, sHeight, target.width * dpr, target.height * dpr, transformType);
|
|
320
|
+
return getOptimizedTransformData(sWidth, sHeight, width, height, upscaleMethod, scaleFactor, transformType);
|
|
321
|
+
}
|
|
322
|
+
function getFocalPointFrom9GridAlignment(alignment = alignTypes.CENTER) {
|
|
323
|
+
return ALIGN_TYPE_TO_FOCAL_POINT[alignment];
|
|
324
|
+
}
|
|
325
|
+
function getAlignedRect(sRect, dRect, sFP, alignment) {
|
|
326
|
+
const fp = getFocalPoint(sFP) || getFocalPointFrom9GridAlignment(alignment);
|
|
327
|
+
const x = Math.max(0, Math.min(sRect.width - dRect.width, fp.x * sRect.width - dRect.width / 2));
|
|
328
|
+
const y = Math.max(0, Math.min(sRect.height - dRect.height, fp.y * sRect.height - dRect.height / 2));
|
|
329
|
+
return {
|
|
330
|
+
x,
|
|
331
|
+
y,
|
|
332
|
+
width: Math.min(sRect.width, dRect.width),
|
|
333
|
+
height: Math.min(sRect.height, dRect.height)
|
|
798
334
|
};
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
335
|
+
}
|
|
336
|
+
function getOverlappingRect(sRect, dRect) {
|
|
337
|
+
const width = Math.max(0, Math.min(sRect.width, dRect.x + dRect.width) - Math.max(0, dRect.x));
|
|
338
|
+
const height = Math.max(0, Math.min(sRect.height, dRect.y + dRect.height) - Math.max(0, dRect.y));
|
|
339
|
+
const isValidRect = width && height && (sRect.width !== width || sRect.height !== height);
|
|
340
|
+
return isValidRect ? {
|
|
341
|
+
x: Math.max(0, dRect.x),
|
|
342
|
+
y: Math.max(0, dRect.y),
|
|
343
|
+
width,
|
|
344
|
+
height
|
|
345
|
+
} : null;
|
|
346
|
+
}
|
|
347
|
+
function getDevicePixelRatio(target) {
|
|
348
|
+
return Math.min(target.pixelAspectRatio || 1, MAX_DEVICE_PIXEL_RATIO);
|
|
349
|
+
}
|
|
350
|
+
function getAlignment(target) {
|
|
351
|
+
return target.alignment && alignTypesMap[target.alignment] || alignTypesMap[alignTypes.CENTER];
|
|
352
|
+
}
|
|
353
|
+
function getFocalPoint(focalPoint) {
|
|
354
|
+
let fp;
|
|
355
|
+
if (focalPoint && typeof focalPoint.x === "number" && !isNaN(focalPoint.x) && typeof focalPoint.y === "number" && !isNaN(focalPoint.y)) {
|
|
356
|
+
fp = {
|
|
357
|
+
x: roundToFixed(Math.max(0, Math.min(100, focalPoint.x)) / 100, 2),
|
|
358
|
+
y: roundToFixed(Math.max(0, Math.min(100, focalPoint.y)) / 100, 2)
|
|
808
359
|
};
|
|
809
|
-
parseFromDocument = parseFromString;
|
|
810
360
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
361
|
+
return fp;
|
|
362
|
+
}
|
|
363
|
+
function getPreferredImageQuality(imageWidth, imageHeight) {
|
|
364
|
+
return imageScaleDefaults[getImageQualityKey(imageWidth, imageHeight)].quality;
|
|
365
|
+
}
|
|
366
|
+
function getClassicScaleData(sWidth, sHeight) {
|
|
367
|
+
const imageKey = getImageQualityKey(sWidth, sHeight);
|
|
368
|
+
return {
|
|
369
|
+
optimizedScaleFactor: imageScaleDefaults[imageKey].maxUpscale,
|
|
370
|
+
upscaleMethodValue: upscaleMethodsValues.classic,
|
|
371
|
+
forceUSM: false
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function getAutoScaleData(sWidth, sHeight) {
|
|
375
|
+
const imageKey = getImageQualityKey(sWidth, sHeight);
|
|
376
|
+
return {
|
|
377
|
+
optimizedScaleFactor: imageScaleDefaults[imageKey].maxUpscale,
|
|
378
|
+
upscaleMethodValue: upscaleMethodsValues.classic,
|
|
379
|
+
forceUSM: false
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function getSuperScaleData(scaleFactor) {
|
|
383
|
+
return {
|
|
384
|
+
optimizedScaleFactor: last(SUPER_UPSCALE_MODELS),
|
|
385
|
+
upscaleMethodValue: upscaleMethodsValues.super,
|
|
386
|
+
forceUSM: !(SUPER_UPSCALE_MODELS.includes(scaleFactor) || scaleFactor > last(SUPER_UPSCALE_MODELS))
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function getOptimizedScaleData(sWidth, sHeight, scaleFactor, upscaleMethod) {
|
|
390
|
+
if (upscaleMethod === "auto") {
|
|
391
|
+
return getAutoScaleData(sWidth, sHeight);
|
|
392
|
+
} else if (upscaleMethod === "super") {
|
|
393
|
+
return getSuperScaleData(scaleFactor);
|
|
824
394
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
395
|
+
return getClassicScaleData(sWidth, sHeight);
|
|
396
|
+
}
|
|
397
|
+
function getOptimizedTransformData(sWidth, sHeight, tWidth, tHeight, upscaleMethod, scaleFactor, transformType) {
|
|
398
|
+
const { optimizedScaleFactor, upscaleMethodValue, forceUSM } = getOptimizedScaleData(sWidth, sHeight, scaleFactor, upscaleMethod);
|
|
399
|
+
let width = tWidth;
|
|
400
|
+
let height = tHeight;
|
|
401
|
+
if (scaleFactor <= optimizedScaleFactor) {
|
|
402
|
+
return {
|
|
403
|
+
width,
|
|
404
|
+
height,
|
|
405
|
+
scaleFactor,
|
|
406
|
+
upscaleMethodValue,
|
|
407
|
+
forceUSM,
|
|
408
|
+
cssUpscaleNeeded: false
|
|
831
409
|
};
|
|
832
410
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
var element = doc.querySelector(HEAD);
|
|
843
|
-
(_a = element === null || element === void 0 ? void 0 : element.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(element);
|
|
844
|
-
}
|
|
845
|
-
if (!BODY_TAG_REGEX.test(html)) {
|
|
846
|
-
var element = doc.querySelector(BODY);
|
|
847
|
-
(_b = element === null || element === void 0 ? void 0 : element.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element);
|
|
848
|
-
}
|
|
849
|
-
return doc.querySelectorAll(HTML);
|
|
850
|
-
}
|
|
851
|
-
case HEAD:
|
|
852
|
-
case BODY: {
|
|
853
|
-
var elements = parseFromDocument(html).querySelectorAll(firstTagName);
|
|
854
|
-
if (BODY_TAG_REGEX.test(html) && HEAD_TAG_REGEX.test(html)) {
|
|
855
|
-
return elements[0].parentNode.childNodes;
|
|
856
|
-
}
|
|
857
|
-
return elements;
|
|
858
|
-
}
|
|
859
|
-
// low-level tag or text
|
|
860
|
-
default: {
|
|
861
|
-
if (parseFromTemplate) {
|
|
862
|
-
return parseFromTemplate(html);
|
|
863
|
-
}
|
|
864
|
-
var element = parseFromDocument(html, BODY).querySelector(BODY);
|
|
865
|
-
return element.childNodes;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
411
|
+
switch (transformType) {
|
|
412
|
+
case transformTypes.FILL:
|
|
413
|
+
width = tWidth * (optimizedScaleFactor / scaleFactor);
|
|
414
|
+
height = tHeight * (optimizedScaleFactor / scaleFactor);
|
|
415
|
+
break;
|
|
416
|
+
case transformTypes.FIT:
|
|
417
|
+
width = sWidth * optimizedScaleFactor;
|
|
418
|
+
height = sHeight * optimizedScaleFactor;
|
|
419
|
+
break;
|
|
868
420
|
}
|
|
869
|
-
return
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
421
|
+
return {
|
|
422
|
+
width,
|
|
423
|
+
height,
|
|
424
|
+
scaleFactor: optimizedScaleFactor,
|
|
425
|
+
upscaleMethodValue,
|
|
426
|
+
forceUSM,
|
|
427
|
+
cssUpscaleNeeded: true
|
|
877
428
|
};
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
if (!html) {
|
|
888
|
-
return [];
|
|
889
|
-
}
|
|
890
|
-
var match = html.match(DIRECTIVE_REGEX);
|
|
891
|
-
var directive = match ? match[1] : void 0;
|
|
892
|
-
return (0, utilities_1.formatDOM)((0, domparser_1.default)(html), null, directive);
|
|
429
|
+
}
|
|
430
|
+
function getImageQualityKey(imageWidth, imageHeight) {
|
|
431
|
+
const size = imageWidth * imageHeight;
|
|
432
|
+
if (size > imageScaleDefaults[imageQuality.HIGH].size) {
|
|
433
|
+
return imageQuality.HIGH;
|
|
434
|
+
} else if (size > imageScaleDefaults[imageQuality.MEDIUM].size) {
|
|
435
|
+
return imageQuality.MEDIUM;
|
|
436
|
+
} else if (size > imageScaleDefaults[imageQuality.LOW].size) {
|
|
437
|
+
return imageQuality.LOW;
|
|
893
438
|
}
|
|
894
|
-
return
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (hasRequiredPossibleStandardNamesOptimized) return possibleStandardNamesOptimized;
|
|
902
|
-
hasRequiredPossibleStandardNamesOptimized = 1;
|
|
903
|
-
var SAME = 0;
|
|
904
|
-
possibleStandardNamesOptimized.SAME = SAME;
|
|
905
|
-
var CAMELCASE = 1;
|
|
906
|
-
possibleStandardNamesOptimized.CAMELCASE = CAMELCASE;
|
|
907
|
-
possibleStandardNamesOptimized.possibleStandardNames = {
|
|
908
|
-
accept: 0,
|
|
909
|
-
acceptCharset: 1,
|
|
910
|
-
"accept-charset": "acceptCharset",
|
|
911
|
-
accessKey: 1,
|
|
912
|
-
action: 0,
|
|
913
|
-
allowFullScreen: 1,
|
|
914
|
-
alt: 0,
|
|
915
|
-
as: 0,
|
|
916
|
-
async: 0,
|
|
917
|
-
autoCapitalize: 1,
|
|
918
|
-
autoComplete: 1,
|
|
919
|
-
autoCorrect: 1,
|
|
920
|
-
autoFocus: 1,
|
|
921
|
-
autoPlay: 1,
|
|
922
|
-
autoSave: 1,
|
|
923
|
-
capture: 0,
|
|
924
|
-
cellPadding: 1,
|
|
925
|
-
cellSpacing: 1,
|
|
926
|
-
challenge: 0,
|
|
927
|
-
charSet: 1,
|
|
928
|
-
checked: 0,
|
|
929
|
-
children: 0,
|
|
930
|
-
cite: 0,
|
|
931
|
-
class: "className",
|
|
932
|
-
classID: 1,
|
|
933
|
-
className: 1,
|
|
934
|
-
cols: 0,
|
|
935
|
-
colSpan: 1,
|
|
936
|
-
content: 0,
|
|
937
|
-
contentEditable: 1,
|
|
938
|
-
contextMenu: 1,
|
|
939
|
-
controls: 0,
|
|
940
|
-
controlsList: 1,
|
|
941
|
-
coords: 0,
|
|
942
|
-
crossOrigin: 1,
|
|
943
|
-
dangerouslySetInnerHTML: 1,
|
|
944
|
-
data: 0,
|
|
945
|
-
dateTime: 1,
|
|
946
|
-
default: 0,
|
|
947
|
-
defaultChecked: 1,
|
|
948
|
-
defaultValue: 1,
|
|
949
|
-
defer: 0,
|
|
950
|
-
dir: 0,
|
|
951
|
-
disabled: 0,
|
|
952
|
-
disablePictureInPicture: 1,
|
|
953
|
-
disableRemotePlayback: 1,
|
|
954
|
-
download: 0,
|
|
955
|
-
draggable: 0,
|
|
956
|
-
encType: 1,
|
|
957
|
-
enterKeyHint: 1,
|
|
958
|
-
for: "htmlFor",
|
|
959
|
-
form: 0,
|
|
960
|
-
formMethod: 1,
|
|
961
|
-
formAction: 1,
|
|
962
|
-
formEncType: 1,
|
|
963
|
-
formNoValidate: 1,
|
|
964
|
-
formTarget: 1,
|
|
965
|
-
frameBorder: 1,
|
|
966
|
-
headers: 0,
|
|
967
|
-
height: 0,
|
|
968
|
-
hidden: 0,
|
|
969
|
-
high: 0,
|
|
970
|
-
href: 0,
|
|
971
|
-
hrefLang: 1,
|
|
972
|
-
htmlFor: 1,
|
|
973
|
-
httpEquiv: 1,
|
|
974
|
-
"http-equiv": "httpEquiv",
|
|
975
|
-
icon: 0,
|
|
976
|
-
id: 0,
|
|
977
|
-
innerHTML: 1,
|
|
978
|
-
inputMode: 1,
|
|
979
|
-
integrity: 0,
|
|
980
|
-
is: 0,
|
|
981
|
-
itemID: 1,
|
|
982
|
-
itemProp: 1,
|
|
983
|
-
itemRef: 1,
|
|
984
|
-
itemScope: 1,
|
|
985
|
-
itemType: 1,
|
|
986
|
-
keyParams: 1,
|
|
987
|
-
keyType: 1,
|
|
988
|
-
kind: 0,
|
|
989
|
-
label: 0,
|
|
990
|
-
lang: 0,
|
|
991
|
-
list: 0,
|
|
992
|
-
loop: 0,
|
|
993
|
-
low: 0,
|
|
994
|
-
manifest: 0,
|
|
995
|
-
marginWidth: 1,
|
|
996
|
-
marginHeight: 1,
|
|
997
|
-
max: 0,
|
|
998
|
-
maxLength: 1,
|
|
999
|
-
media: 0,
|
|
1000
|
-
mediaGroup: 1,
|
|
1001
|
-
method: 0,
|
|
1002
|
-
min: 0,
|
|
1003
|
-
minLength: 1,
|
|
1004
|
-
multiple: 0,
|
|
1005
|
-
muted: 0,
|
|
1006
|
-
name: 0,
|
|
1007
|
-
noModule: 1,
|
|
1008
|
-
nonce: 0,
|
|
1009
|
-
noValidate: 1,
|
|
1010
|
-
open: 0,
|
|
1011
|
-
optimum: 0,
|
|
1012
|
-
pattern: 0,
|
|
1013
|
-
placeholder: 0,
|
|
1014
|
-
playsInline: 1,
|
|
1015
|
-
poster: 0,
|
|
1016
|
-
preload: 0,
|
|
1017
|
-
profile: 0,
|
|
1018
|
-
radioGroup: 1,
|
|
1019
|
-
readOnly: 1,
|
|
1020
|
-
referrerPolicy: 1,
|
|
1021
|
-
rel: 0,
|
|
1022
|
-
required: 0,
|
|
1023
|
-
reversed: 0,
|
|
1024
|
-
role: 0,
|
|
1025
|
-
rows: 0,
|
|
1026
|
-
rowSpan: 1,
|
|
1027
|
-
sandbox: 0,
|
|
1028
|
-
scope: 0,
|
|
1029
|
-
scoped: 0,
|
|
1030
|
-
scrolling: 0,
|
|
1031
|
-
seamless: 0,
|
|
1032
|
-
selected: 0,
|
|
1033
|
-
shape: 0,
|
|
1034
|
-
size: 0,
|
|
1035
|
-
sizes: 0,
|
|
1036
|
-
span: 0,
|
|
1037
|
-
spellCheck: 1,
|
|
1038
|
-
src: 0,
|
|
1039
|
-
srcDoc: 1,
|
|
1040
|
-
srcLang: 1,
|
|
1041
|
-
srcSet: 1,
|
|
1042
|
-
start: 0,
|
|
1043
|
-
step: 0,
|
|
1044
|
-
style: 0,
|
|
1045
|
-
summary: 0,
|
|
1046
|
-
tabIndex: 1,
|
|
1047
|
-
target: 0,
|
|
1048
|
-
title: 0,
|
|
1049
|
-
type: 0,
|
|
1050
|
-
useMap: 1,
|
|
1051
|
-
value: 0,
|
|
1052
|
-
width: 0,
|
|
1053
|
-
wmode: 0,
|
|
1054
|
-
wrap: 0,
|
|
1055
|
-
about: 0,
|
|
1056
|
-
accentHeight: 1,
|
|
1057
|
-
"accent-height": "accentHeight",
|
|
1058
|
-
accumulate: 0,
|
|
1059
|
-
additive: 0,
|
|
1060
|
-
alignmentBaseline: 1,
|
|
1061
|
-
"alignment-baseline": "alignmentBaseline",
|
|
1062
|
-
allowReorder: 1,
|
|
1063
|
-
alphabetic: 0,
|
|
1064
|
-
amplitude: 0,
|
|
1065
|
-
arabicForm: 1,
|
|
1066
|
-
"arabic-form": "arabicForm",
|
|
1067
|
-
ascent: 0,
|
|
1068
|
-
attributeName: 1,
|
|
1069
|
-
attributeType: 1,
|
|
1070
|
-
autoReverse: 1,
|
|
1071
|
-
azimuth: 0,
|
|
1072
|
-
baseFrequency: 1,
|
|
1073
|
-
baselineShift: 1,
|
|
1074
|
-
"baseline-shift": "baselineShift",
|
|
1075
|
-
baseProfile: 1,
|
|
1076
|
-
bbox: 0,
|
|
1077
|
-
begin: 0,
|
|
1078
|
-
bias: 0,
|
|
1079
|
-
by: 0,
|
|
1080
|
-
calcMode: 1,
|
|
1081
|
-
capHeight: 1,
|
|
1082
|
-
"cap-height": "capHeight",
|
|
1083
|
-
clip: 0,
|
|
1084
|
-
clipPath: 1,
|
|
1085
|
-
"clip-path": "clipPath",
|
|
1086
|
-
clipPathUnits: 1,
|
|
1087
|
-
clipRule: 1,
|
|
1088
|
-
"clip-rule": "clipRule",
|
|
1089
|
-
color: 0,
|
|
1090
|
-
colorInterpolation: 1,
|
|
1091
|
-
"color-interpolation": "colorInterpolation",
|
|
1092
|
-
colorInterpolationFilters: 1,
|
|
1093
|
-
"color-interpolation-filters": "colorInterpolationFilters",
|
|
1094
|
-
colorProfile: 1,
|
|
1095
|
-
"color-profile": "colorProfile",
|
|
1096
|
-
colorRendering: 1,
|
|
1097
|
-
"color-rendering": "colorRendering",
|
|
1098
|
-
contentScriptType: 1,
|
|
1099
|
-
contentStyleType: 1,
|
|
1100
|
-
cursor: 0,
|
|
1101
|
-
cx: 0,
|
|
1102
|
-
cy: 0,
|
|
1103
|
-
d: 0,
|
|
1104
|
-
datatype: 0,
|
|
1105
|
-
decelerate: 0,
|
|
1106
|
-
descent: 0,
|
|
1107
|
-
diffuseConstant: 1,
|
|
1108
|
-
direction: 0,
|
|
1109
|
-
display: 0,
|
|
1110
|
-
divisor: 0,
|
|
1111
|
-
dominantBaseline: 1,
|
|
1112
|
-
"dominant-baseline": "dominantBaseline",
|
|
1113
|
-
dur: 0,
|
|
1114
|
-
dx: 0,
|
|
1115
|
-
dy: 0,
|
|
1116
|
-
edgeMode: 1,
|
|
1117
|
-
elevation: 0,
|
|
1118
|
-
enableBackground: 1,
|
|
1119
|
-
"enable-background": "enableBackground",
|
|
1120
|
-
end: 0,
|
|
1121
|
-
exponent: 0,
|
|
1122
|
-
externalResourcesRequired: 1,
|
|
1123
|
-
fill: 0,
|
|
1124
|
-
fillOpacity: 1,
|
|
1125
|
-
"fill-opacity": "fillOpacity",
|
|
1126
|
-
fillRule: 1,
|
|
1127
|
-
"fill-rule": "fillRule",
|
|
1128
|
-
filter: 0,
|
|
1129
|
-
filterRes: 1,
|
|
1130
|
-
filterUnits: 1,
|
|
1131
|
-
floodOpacity: 1,
|
|
1132
|
-
"flood-opacity": "floodOpacity",
|
|
1133
|
-
floodColor: 1,
|
|
1134
|
-
"flood-color": "floodColor",
|
|
1135
|
-
focusable: 0,
|
|
1136
|
-
fontFamily: 1,
|
|
1137
|
-
"font-family": "fontFamily",
|
|
1138
|
-
fontSize: 1,
|
|
1139
|
-
"font-size": "fontSize",
|
|
1140
|
-
fontSizeAdjust: 1,
|
|
1141
|
-
"font-size-adjust": "fontSizeAdjust",
|
|
1142
|
-
fontStretch: 1,
|
|
1143
|
-
"font-stretch": "fontStretch",
|
|
1144
|
-
fontStyle: 1,
|
|
1145
|
-
"font-style": "fontStyle",
|
|
1146
|
-
fontVariant: 1,
|
|
1147
|
-
"font-variant": "fontVariant",
|
|
1148
|
-
fontWeight: 1,
|
|
1149
|
-
"font-weight": "fontWeight",
|
|
1150
|
-
format: 0,
|
|
1151
|
-
from: 0,
|
|
1152
|
-
fx: 0,
|
|
1153
|
-
fy: 0,
|
|
1154
|
-
g1: 0,
|
|
1155
|
-
g2: 0,
|
|
1156
|
-
glyphName: 1,
|
|
1157
|
-
"glyph-name": "glyphName",
|
|
1158
|
-
glyphOrientationHorizontal: 1,
|
|
1159
|
-
"glyph-orientation-horizontal": "glyphOrientationHorizontal",
|
|
1160
|
-
glyphOrientationVertical: 1,
|
|
1161
|
-
"glyph-orientation-vertical": "glyphOrientationVertical",
|
|
1162
|
-
glyphRef: 1,
|
|
1163
|
-
gradientTransform: 1,
|
|
1164
|
-
gradientUnits: 1,
|
|
1165
|
-
hanging: 0,
|
|
1166
|
-
horizAdvX: 1,
|
|
1167
|
-
"horiz-adv-x": "horizAdvX",
|
|
1168
|
-
horizOriginX: 1,
|
|
1169
|
-
"horiz-origin-x": "horizOriginX",
|
|
1170
|
-
ideographic: 0,
|
|
1171
|
-
imageRendering: 1,
|
|
1172
|
-
"image-rendering": "imageRendering",
|
|
1173
|
-
in2: 0,
|
|
1174
|
-
in: 0,
|
|
1175
|
-
inlist: 0,
|
|
1176
|
-
intercept: 0,
|
|
1177
|
-
k1: 0,
|
|
1178
|
-
k2: 0,
|
|
1179
|
-
k3: 0,
|
|
1180
|
-
k4: 0,
|
|
1181
|
-
k: 0,
|
|
1182
|
-
kernelMatrix: 1,
|
|
1183
|
-
kernelUnitLength: 1,
|
|
1184
|
-
kerning: 0,
|
|
1185
|
-
keyPoints: 1,
|
|
1186
|
-
keySplines: 1,
|
|
1187
|
-
keyTimes: 1,
|
|
1188
|
-
lengthAdjust: 1,
|
|
1189
|
-
letterSpacing: 1,
|
|
1190
|
-
"letter-spacing": "letterSpacing",
|
|
1191
|
-
lightingColor: 1,
|
|
1192
|
-
"lighting-color": "lightingColor",
|
|
1193
|
-
limitingConeAngle: 1,
|
|
1194
|
-
local: 0,
|
|
1195
|
-
markerEnd: 1,
|
|
1196
|
-
"marker-end": "markerEnd",
|
|
1197
|
-
markerHeight: 1,
|
|
1198
|
-
markerMid: 1,
|
|
1199
|
-
"marker-mid": "markerMid",
|
|
1200
|
-
markerStart: 1,
|
|
1201
|
-
"marker-start": "markerStart",
|
|
1202
|
-
markerUnits: 1,
|
|
1203
|
-
markerWidth: 1,
|
|
1204
|
-
mask: 0,
|
|
1205
|
-
maskContentUnits: 1,
|
|
1206
|
-
maskUnits: 1,
|
|
1207
|
-
mathematical: 0,
|
|
1208
|
-
mode: 0,
|
|
1209
|
-
numOctaves: 1,
|
|
1210
|
-
offset: 0,
|
|
1211
|
-
opacity: 0,
|
|
1212
|
-
operator: 0,
|
|
1213
|
-
order: 0,
|
|
1214
|
-
orient: 0,
|
|
1215
|
-
orientation: 0,
|
|
1216
|
-
origin: 0,
|
|
1217
|
-
overflow: 0,
|
|
1218
|
-
overlinePosition: 1,
|
|
1219
|
-
"overline-position": "overlinePosition",
|
|
1220
|
-
overlineThickness: 1,
|
|
1221
|
-
"overline-thickness": "overlineThickness",
|
|
1222
|
-
paintOrder: 1,
|
|
1223
|
-
"paint-order": "paintOrder",
|
|
1224
|
-
panose1: 0,
|
|
1225
|
-
"panose-1": "panose1",
|
|
1226
|
-
pathLength: 1,
|
|
1227
|
-
patternContentUnits: 1,
|
|
1228
|
-
patternTransform: 1,
|
|
1229
|
-
patternUnits: 1,
|
|
1230
|
-
pointerEvents: 1,
|
|
1231
|
-
"pointer-events": "pointerEvents",
|
|
1232
|
-
points: 0,
|
|
1233
|
-
pointsAtX: 1,
|
|
1234
|
-
pointsAtY: 1,
|
|
1235
|
-
pointsAtZ: 1,
|
|
1236
|
-
prefix: 0,
|
|
1237
|
-
preserveAlpha: 1,
|
|
1238
|
-
preserveAspectRatio: 1,
|
|
1239
|
-
primitiveUnits: 1,
|
|
1240
|
-
property: 0,
|
|
1241
|
-
r: 0,
|
|
1242
|
-
radius: 0,
|
|
1243
|
-
refX: 1,
|
|
1244
|
-
refY: 1,
|
|
1245
|
-
renderingIntent: 1,
|
|
1246
|
-
"rendering-intent": "renderingIntent",
|
|
1247
|
-
repeatCount: 1,
|
|
1248
|
-
repeatDur: 1,
|
|
1249
|
-
requiredExtensions: 1,
|
|
1250
|
-
requiredFeatures: 1,
|
|
1251
|
-
resource: 0,
|
|
1252
|
-
restart: 0,
|
|
1253
|
-
result: 0,
|
|
1254
|
-
results: 0,
|
|
1255
|
-
rotate: 0,
|
|
1256
|
-
rx: 0,
|
|
1257
|
-
ry: 0,
|
|
1258
|
-
scale: 0,
|
|
1259
|
-
security: 0,
|
|
1260
|
-
seed: 0,
|
|
1261
|
-
shapeRendering: 1,
|
|
1262
|
-
"shape-rendering": "shapeRendering",
|
|
1263
|
-
slope: 0,
|
|
1264
|
-
spacing: 0,
|
|
1265
|
-
specularConstant: 1,
|
|
1266
|
-
specularExponent: 1,
|
|
1267
|
-
speed: 0,
|
|
1268
|
-
spreadMethod: 1,
|
|
1269
|
-
startOffset: 1,
|
|
1270
|
-
stdDeviation: 1,
|
|
1271
|
-
stemh: 0,
|
|
1272
|
-
stemv: 0,
|
|
1273
|
-
stitchTiles: 1,
|
|
1274
|
-
stopColor: 1,
|
|
1275
|
-
"stop-color": "stopColor",
|
|
1276
|
-
stopOpacity: 1,
|
|
1277
|
-
"stop-opacity": "stopOpacity",
|
|
1278
|
-
strikethroughPosition: 1,
|
|
1279
|
-
"strikethrough-position": "strikethroughPosition",
|
|
1280
|
-
strikethroughThickness: 1,
|
|
1281
|
-
"strikethrough-thickness": "strikethroughThickness",
|
|
1282
|
-
string: 0,
|
|
1283
|
-
stroke: 0,
|
|
1284
|
-
strokeDasharray: 1,
|
|
1285
|
-
"stroke-dasharray": "strokeDasharray",
|
|
1286
|
-
strokeDashoffset: 1,
|
|
1287
|
-
"stroke-dashoffset": "strokeDashoffset",
|
|
1288
|
-
strokeLinecap: 1,
|
|
1289
|
-
"stroke-linecap": "strokeLinecap",
|
|
1290
|
-
strokeLinejoin: 1,
|
|
1291
|
-
"stroke-linejoin": "strokeLinejoin",
|
|
1292
|
-
strokeMiterlimit: 1,
|
|
1293
|
-
"stroke-miterlimit": "strokeMiterlimit",
|
|
1294
|
-
strokeWidth: 1,
|
|
1295
|
-
"stroke-width": "strokeWidth",
|
|
1296
|
-
strokeOpacity: 1,
|
|
1297
|
-
"stroke-opacity": "strokeOpacity",
|
|
1298
|
-
suppressContentEditableWarning: 1,
|
|
1299
|
-
suppressHydrationWarning: 1,
|
|
1300
|
-
surfaceScale: 1,
|
|
1301
|
-
systemLanguage: 1,
|
|
1302
|
-
tableValues: 1,
|
|
1303
|
-
targetX: 1,
|
|
1304
|
-
targetY: 1,
|
|
1305
|
-
textAnchor: 1,
|
|
1306
|
-
"text-anchor": "textAnchor",
|
|
1307
|
-
textDecoration: 1,
|
|
1308
|
-
"text-decoration": "textDecoration",
|
|
1309
|
-
textLength: 1,
|
|
1310
|
-
textRendering: 1,
|
|
1311
|
-
"text-rendering": "textRendering",
|
|
1312
|
-
to: 0,
|
|
1313
|
-
transform: 0,
|
|
1314
|
-
typeof: 0,
|
|
1315
|
-
u1: 0,
|
|
1316
|
-
u2: 0,
|
|
1317
|
-
underlinePosition: 1,
|
|
1318
|
-
"underline-position": "underlinePosition",
|
|
1319
|
-
underlineThickness: 1,
|
|
1320
|
-
"underline-thickness": "underlineThickness",
|
|
1321
|
-
unicode: 0,
|
|
1322
|
-
unicodeBidi: 1,
|
|
1323
|
-
"unicode-bidi": "unicodeBidi",
|
|
1324
|
-
unicodeRange: 1,
|
|
1325
|
-
"unicode-range": "unicodeRange",
|
|
1326
|
-
unitsPerEm: 1,
|
|
1327
|
-
"units-per-em": "unitsPerEm",
|
|
1328
|
-
unselectable: 0,
|
|
1329
|
-
vAlphabetic: 1,
|
|
1330
|
-
"v-alphabetic": "vAlphabetic",
|
|
1331
|
-
values: 0,
|
|
1332
|
-
vectorEffect: 1,
|
|
1333
|
-
"vector-effect": "vectorEffect",
|
|
1334
|
-
version: 0,
|
|
1335
|
-
vertAdvY: 1,
|
|
1336
|
-
"vert-adv-y": "vertAdvY",
|
|
1337
|
-
vertOriginX: 1,
|
|
1338
|
-
"vert-origin-x": "vertOriginX",
|
|
1339
|
-
vertOriginY: 1,
|
|
1340
|
-
"vert-origin-y": "vertOriginY",
|
|
1341
|
-
vHanging: 1,
|
|
1342
|
-
"v-hanging": "vHanging",
|
|
1343
|
-
vIdeographic: 1,
|
|
1344
|
-
"v-ideographic": "vIdeographic",
|
|
1345
|
-
viewBox: 1,
|
|
1346
|
-
viewTarget: 1,
|
|
1347
|
-
visibility: 0,
|
|
1348
|
-
vMathematical: 1,
|
|
1349
|
-
"v-mathematical": "vMathematical",
|
|
1350
|
-
vocab: 0,
|
|
1351
|
-
widths: 0,
|
|
1352
|
-
wordSpacing: 1,
|
|
1353
|
-
"word-spacing": "wordSpacing",
|
|
1354
|
-
writingMode: 1,
|
|
1355
|
-
"writing-mode": "writingMode",
|
|
1356
|
-
x1: 0,
|
|
1357
|
-
x2: 0,
|
|
1358
|
-
x: 0,
|
|
1359
|
-
xChannelSelector: 1,
|
|
1360
|
-
xHeight: 1,
|
|
1361
|
-
"x-height": "xHeight",
|
|
1362
|
-
xlinkActuate: 1,
|
|
1363
|
-
"xlink:actuate": "xlinkActuate",
|
|
1364
|
-
xlinkArcrole: 1,
|
|
1365
|
-
"xlink:arcrole": "xlinkArcrole",
|
|
1366
|
-
xlinkHref: 1,
|
|
1367
|
-
"xlink:href": "xlinkHref",
|
|
1368
|
-
xlinkRole: 1,
|
|
1369
|
-
"xlink:role": "xlinkRole",
|
|
1370
|
-
xlinkShow: 1,
|
|
1371
|
-
"xlink:show": "xlinkShow",
|
|
1372
|
-
xlinkTitle: 1,
|
|
1373
|
-
"xlink:title": "xlinkTitle",
|
|
1374
|
-
xlinkType: 1,
|
|
1375
|
-
"xlink:type": "xlinkType",
|
|
1376
|
-
xmlBase: 1,
|
|
1377
|
-
"xml:base": "xmlBase",
|
|
1378
|
-
xmlLang: 1,
|
|
1379
|
-
"xml:lang": "xmlLang",
|
|
1380
|
-
xmlns: 0,
|
|
1381
|
-
"xml:space": "xmlSpace",
|
|
1382
|
-
xmlnsXlink: 1,
|
|
1383
|
-
"xmlns:xlink": "xmlnsXlink",
|
|
1384
|
-
xmlSpace: 1,
|
|
1385
|
-
y1: 0,
|
|
1386
|
-
y2: 0,
|
|
1387
|
-
y: 0,
|
|
1388
|
-
yChannelSelector: 1,
|
|
1389
|
-
z: 0,
|
|
1390
|
-
zoomAndPan: 1
|
|
439
|
+
return imageQuality.TINY;
|
|
440
|
+
}
|
|
441
|
+
function getDimension(sWidth, sHeight, tWidth, tHeight, transformType) {
|
|
442
|
+
const scaleFactor = getScaleFactor(sWidth, sHeight, tWidth, tHeight, transformType);
|
|
443
|
+
return {
|
|
444
|
+
width: Math.round(sWidth * scaleFactor),
|
|
445
|
+
height: Math.round(sHeight * scaleFactor)
|
|
1391
446
|
};
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
const BOOLEANISH_STRING = 2;
|
|
1401
|
-
const BOOLEAN = 3;
|
|
1402
|
-
const OVERLOADED_BOOLEAN = 4;
|
|
1403
|
-
const NUMERIC = 5;
|
|
1404
|
-
const POSITIVE_NUMERIC = 6;
|
|
1405
|
-
function getPropertyInfo(name) {
|
|
1406
|
-
return properties.hasOwnProperty(name) ? properties[name] : null;
|
|
447
|
+
}
|
|
448
|
+
function roundToFixed(value, precision) {
|
|
449
|
+
const truncatePrecision = Math.pow(10, precision);
|
|
450
|
+
return (value * truncatePrecision / truncatePrecision).toFixed(precision);
|
|
451
|
+
}
|
|
452
|
+
function getUpscaleString(options) {
|
|
453
|
+
if (!options || !options.upscaleMethod) {
|
|
454
|
+
return upscaleMethods.AUTO;
|
|
1407
455
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
456
|
+
return upscaleMethods[options.upscaleMethod.toUpperCase()] || upscaleMethods.AUTO;
|
|
457
|
+
}
|
|
458
|
+
function imageIsAnimated(uri, hasAnimation) {
|
|
459
|
+
const isAvifWebpFormat = isWEBP(uri) || isAVIF(uri);
|
|
460
|
+
return getFileExtension(uri) === fileType.GIF || isAvifWebpFormat && hasAnimation;
|
|
461
|
+
}
|
|
462
|
+
const globalFeaturesSupportObj = {
|
|
463
|
+
/**
|
|
464
|
+
* @type {object<boolean>}
|
|
465
|
+
*/
|
|
466
|
+
isMobile: false
|
|
467
|
+
};
|
|
468
|
+
const getFeature = function(feature) {
|
|
469
|
+
return globalFeaturesSupportObj[feature];
|
|
470
|
+
};
|
|
471
|
+
const setFeature = function(feature, value) {
|
|
472
|
+
globalFeaturesSupportObj[feature] = value;
|
|
473
|
+
};
|
|
474
|
+
function populateGlobalFeatureSupport() {
|
|
475
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
476
|
+
const isSmallScreen = window.matchMedia && window.matchMedia("(max-width: 767px)").matches;
|
|
477
|
+
const isMobileAgent = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
478
|
+
setFeature("isMobile", isSmallScreen && isMobileAgent);
|
|
1417
479
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
// elements (not just inputs). Now that ReactDOMInput assigns to the
|
|
1424
|
-
// defaultValue property -- do we need this?
|
|
1425
|
-
"defaultValue",
|
|
1426
|
-
"defaultChecked",
|
|
1427
|
-
"innerHTML",
|
|
1428
|
-
"suppressContentEditableWarning",
|
|
1429
|
-
"suppressHydrationWarning",
|
|
1430
|
-
"style"
|
|
1431
|
-
];
|
|
1432
|
-
reservedProps.forEach((name) => {
|
|
1433
|
-
properties[name] = new PropertyInfoRecord(
|
|
1434
|
-
name,
|
|
1435
|
-
RESERVED,
|
|
1436
|
-
false,
|
|
1437
|
-
// mustUseProperty
|
|
1438
|
-
name,
|
|
1439
|
-
// attributeName
|
|
1440
|
-
null,
|
|
1441
|
-
// attributeNamespace
|
|
1442
|
-
false,
|
|
1443
|
-
// sanitizeURL
|
|
1444
|
-
false
|
|
1445
|
-
// removeEmptyString
|
|
1446
|
-
);
|
|
1447
|
-
});
|
|
1448
|
-
[
|
|
1449
|
-
["acceptCharset", "accept-charset"],
|
|
1450
|
-
["className", "class"],
|
|
1451
|
-
["htmlFor", "for"],
|
|
1452
|
-
["httpEquiv", "http-equiv"]
|
|
1453
|
-
].forEach(([name, attributeName]) => {
|
|
1454
|
-
properties[name] = new PropertyInfoRecord(
|
|
1455
|
-
name,
|
|
1456
|
-
STRING,
|
|
1457
|
-
false,
|
|
1458
|
-
// mustUseProperty
|
|
1459
|
-
attributeName,
|
|
1460
|
-
// attributeName
|
|
1461
|
-
null,
|
|
1462
|
-
// attributeNamespace
|
|
1463
|
-
false,
|
|
1464
|
-
// sanitizeURL
|
|
1465
|
-
false
|
|
1466
|
-
// removeEmptyString
|
|
1467
|
-
);
|
|
1468
|
-
});
|
|
1469
|
-
["contentEditable", "draggable", "spellCheck", "value"].forEach((name) => {
|
|
1470
|
-
properties[name] = new PropertyInfoRecord(
|
|
1471
|
-
name,
|
|
1472
|
-
BOOLEANISH_STRING,
|
|
1473
|
-
false,
|
|
1474
|
-
// mustUseProperty
|
|
1475
|
-
name.toLowerCase(),
|
|
1476
|
-
// attributeName
|
|
1477
|
-
null,
|
|
1478
|
-
// attributeNamespace
|
|
1479
|
-
false,
|
|
1480
|
-
// sanitizeURL
|
|
1481
|
-
false
|
|
1482
|
-
// removeEmptyString
|
|
1483
|
-
);
|
|
1484
|
-
});
|
|
1485
|
-
[
|
|
1486
|
-
"autoReverse",
|
|
1487
|
-
"externalResourcesRequired",
|
|
1488
|
-
"focusable",
|
|
1489
|
-
"preserveAlpha"
|
|
1490
|
-
].forEach((name) => {
|
|
1491
|
-
properties[name] = new PropertyInfoRecord(
|
|
1492
|
-
name,
|
|
1493
|
-
BOOLEANISH_STRING,
|
|
1494
|
-
false,
|
|
1495
|
-
// mustUseProperty
|
|
1496
|
-
name,
|
|
1497
|
-
// attributeName
|
|
1498
|
-
null,
|
|
1499
|
-
// attributeNamespace
|
|
1500
|
-
false,
|
|
1501
|
-
// sanitizeURL
|
|
1502
|
-
false
|
|
1503
|
-
// removeEmptyString
|
|
1504
|
-
);
|
|
1505
|
-
});
|
|
1506
|
-
[
|
|
1507
|
-
"allowFullScreen",
|
|
1508
|
-
"async",
|
|
1509
|
-
// Note: there is a special case that prevents it from being written to the DOM
|
|
1510
|
-
// on the client side because the browsers are inconsistent. Instead we call focus().
|
|
1511
|
-
"autoFocus",
|
|
1512
|
-
"autoPlay",
|
|
1513
|
-
"controls",
|
|
1514
|
-
"default",
|
|
1515
|
-
"defer",
|
|
1516
|
-
"disabled",
|
|
1517
|
-
"disablePictureInPicture",
|
|
1518
|
-
"disableRemotePlayback",
|
|
1519
|
-
"formNoValidate",
|
|
1520
|
-
"hidden",
|
|
1521
|
-
"loop",
|
|
1522
|
-
"noModule",
|
|
1523
|
-
"noValidate",
|
|
1524
|
-
"open",
|
|
1525
|
-
"playsInline",
|
|
1526
|
-
"readOnly",
|
|
1527
|
-
"required",
|
|
1528
|
-
"reversed",
|
|
1529
|
-
"scoped",
|
|
1530
|
-
"seamless",
|
|
1531
|
-
// Microdata
|
|
1532
|
-
"itemScope"
|
|
1533
|
-
].forEach((name) => {
|
|
1534
|
-
properties[name] = new PropertyInfoRecord(
|
|
1535
|
-
name,
|
|
1536
|
-
BOOLEAN,
|
|
1537
|
-
false,
|
|
1538
|
-
// mustUseProperty
|
|
1539
|
-
name.toLowerCase(),
|
|
1540
|
-
// attributeName
|
|
1541
|
-
null,
|
|
1542
|
-
// attributeNamespace
|
|
1543
|
-
false,
|
|
1544
|
-
// sanitizeURL
|
|
1545
|
-
false
|
|
1546
|
-
// removeEmptyString
|
|
1547
|
-
);
|
|
1548
|
-
});
|
|
1549
|
-
[
|
|
1550
|
-
"checked",
|
|
1551
|
-
// Note: `option.selected` is not updated if `select.multiple` is
|
|
1552
|
-
// disabled with `removeAttribute`. We have special logic for handling this.
|
|
1553
|
-
"multiple",
|
|
1554
|
-
"muted",
|
|
1555
|
-
"selected"
|
|
1556
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
1557
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
1558
|
-
// instead in the assignment below.
|
|
1559
|
-
].forEach((name) => {
|
|
1560
|
-
properties[name] = new PropertyInfoRecord(
|
|
1561
|
-
name,
|
|
1562
|
-
BOOLEAN,
|
|
1563
|
-
true,
|
|
1564
|
-
// mustUseProperty
|
|
1565
|
-
name,
|
|
1566
|
-
// attributeName
|
|
1567
|
-
null,
|
|
1568
|
-
// attributeNamespace
|
|
1569
|
-
false,
|
|
1570
|
-
// sanitizeURL
|
|
1571
|
-
false
|
|
1572
|
-
// removeEmptyString
|
|
1573
|
-
);
|
|
1574
|
-
});
|
|
1575
|
-
[
|
|
1576
|
-
"capture",
|
|
1577
|
-
"download"
|
|
1578
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
1579
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
1580
|
-
// instead in the assignment below.
|
|
1581
|
-
].forEach((name) => {
|
|
1582
|
-
properties[name] = new PropertyInfoRecord(
|
|
1583
|
-
name,
|
|
1584
|
-
OVERLOADED_BOOLEAN,
|
|
1585
|
-
false,
|
|
1586
|
-
// mustUseProperty
|
|
1587
|
-
name,
|
|
1588
|
-
// attributeName
|
|
1589
|
-
null,
|
|
1590
|
-
// attributeNamespace
|
|
1591
|
-
false,
|
|
1592
|
-
// sanitizeURL
|
|
1593
|
-
false
|
|
1594
|
-
// removeEmptyString
|
|
1595
|
-
);
|
|
1596
|
-
});
|
|
1597
|
-
[
|
|
1598
|
-
"cols",
|
|
1599
|
-
"rows",
|
|
1600
|
-
"size",
|
|
1601
|
-
"span"
|
|
1602
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
1603
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
1604
|
-
// instead in the assignment below.
|
|
1605
|
-
].forEach((name) => {
|
|
1606
|
-
properties[name] = new PropertyInfoRecord(
|
|
1607
|
-
name,
|
|
1608
|
-
POSITIVE_NUMERIC,
|
|
1609
|
-
false,
|
|
1610
|
-
// mustUseProperty
|
|
1611
|
-
name,
|
|
1612
|
-
// attributeName
|
|
1613
|
-
null,
|
|
1614
|
-
// attributeNamespace
|
|
1615
|
-
false,
|
|
1616
|
-
// sanitizeURL
|
|
1617
|
-
false
|
|
1618
|
-
// removeEmptyString
|
|
1619
|
-
);
|
|
1620
|
-
});
|
|
1621
|
-
["rowSpan", "start"].forEach((name) => {
|
|
1622
|
-
properties[name] = new PropertyInfoRecord(
|
|
1623
|
-
name,
|
|
1624
|
-
NUMERIC,
|
|
1625
|
-
false,
|
|
1626
|
-
// mustUseProperty
|
|
1627
|
-
name.toLowerCase(),
|
|
1628
|
-
// attributeName
|
|
1629
|
-
null,
|
|
1630
|
-
// attributeNamespace
|
|
1631
|
-
false,
|
|
1632
|
-
// sanitizeURL
|
|
1633
|
-
false
|
|
1634
|
-
// removeEmptyString
|
|
1635
|
-
);
|
|
1636
|
-
});
|
|
1637
|
-
const CAMELIZE = /[\-\:]([a-z])/g;
|
|
1638
|
-
const capitalize = (token) => token[1].toUpperCase();
|
|
1639
|
-
[
|
|
1640
|
-
"accent-height",
|
|
1641
|
-
"alignment-baseline",
|
|
1642
|
-
"arabic-form",
|
|
1643
|
-
"baseline-shift",
|
|
1644
|
-
"cap-height",
|
|
1645
|
-
"clip-path",
|
|
1646
|
-
"clip-rule",
|
|
1647
|
-
"color-interpolation",
|
|
1648
|
-
"color-interpolation-filters",
|
|
1649
|
-
"color-profile",
|
|
1650
|
-
"color-rendering",
|
|
1651
|
-
"dominant-baseline",
|
|
1652
|
-
"enable-background",
|
|
1653
|
-
"fill-opacity",
|
|
1654
|
-
"fill-rule",
|
|
1655
|
-
"flood-color",
|
|
1656
|
-
"flood-opacity",
|
|
1657
|
-
"font-family",
|
|
1658
|
-
"font-size",
|
|
1659
|
-
"font-size-adjust",
|
|
1660
|
-
"font-stretch",
|
|
1661
|
-
"font-style",
|
|
1662
|
-
"font-variant",
|
|
1663
|
-
"font-weight",
|
|
1664
|
-
"glyph-name",
|
|
1665
|
-
"glyph-orientation-horizontal",
|
|
1666
|
-
"glyph-orientation-vertical",
|
|
1667
|
-
"horiz-adv-x",
|
|
1668
|
-
"horiz-origin-x",
|
|
1669
|
-
"image-rendering",
|
|
1670
|
-
"letter-spacing",
|
|
1671
|
-
"lighting-color",
|
|
1672
|
-
"marker-end",
|
|
1673
|
-
"marker-mid",
|
|
1674
|
-
"marker-start",
|
|
1675
|
-
"overline-position",
|
|
1676
|
-
"overline-thickness",
|
|
1677
|
-
"paint-order",
|
|
1678
|
-
"panose-1",
|
|
1679
|
-
"pointer-events",
|
|
1680
|
-
"rendering-intent",
|
|
1681
|
-
"shape-rendering",
|
|
1682
|
-
"stop-color",
|
|
1683
|
-
"stop-opacity",
|
|
1684
|
-
"strikethrough-position",
|
|
1685
|
-
"strikethrough-thickness",
|
|
1686
|
-
"stroke-dasharray",
|
|
1687
|
-
"stroke-dashoffset",
|
|
1688
|
-
"stroke-linecap",
|
|
1689
|
-
"stroke-linejoin",
|
|
1690
|
-
"stroke-miterlimit",
|
|
1691
|
-
"stroke-opacity",
|
|
1692
|
-
"stroke-width",
|
|
1693
|
-
"text-anchor",
|
|
1694
|
-
"text-decoration",
|
|
1695
|
-
"text-rendering",
|
|
1696
|
-
"underline-position",
|
|
1697
|
-
"underline-thickness",
|
|
1698
|
-
"unicode-bidi",
|
|
1699
|
-
"unicode-range",
|
|
1700
|
-
"units-per-em",
|
|
1701
|
-
"v-alphabetic",
|
|
1702
|
-
"v-hanging",
|
|
1703
|
-
"v-ideographic",
|
|
1704
|
-
"v-mathematical",
|
|
1705
|
-
"vector-effect",
|
|
1706
|
-
"vert-adv-y",
|
|
1707
|
-
"vert-origin-x",
|
|
1708
|
-
"vert-origin-y",
|
|
1709
|
-
"word-spacing",
|
|
1710
|
-
"writing-mode",
|
|
1711
|
-
"xmlns:xlink",
|
|
1712
|
-
"x-height"
|
|
1713
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
1714
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
1715
|
-
// instead in the assignment below.
|
|
1716
|
-
].forEach((attributeName) => {
|
|
1717
|
-
const name = attributeName.replace(CAMELIZE, capitalize);
|
|
1718
|
-
properties[name] = new PropertyInfoRecord(
|
|
1719
|
-
name,
|
|
1720
|
-
STRING,
|
|
1721
|
-
false,
|
|
1722
|
-
// mustUseProperty
|
|
1723
|
-
attributeName,
|
|
1724
|
-
null,
|
|
1725
|
-
// attributeNamespace
|
|
1726
|
-
false,
|
|
1727
|
-
// sanitizeURL
|
|
1728
|
-
false
|
|
1729
|
-
// removeEmptyString
|
|
1730
|
-
);
|
|
1731
|
-
});
|
|
1732
|
-
[
|
|
1733
|
-
"xlink:actuate",
|
|
1734
|
-
"xlink:arcrole",
|
|
1735
|
-
"xlink:role",
|
|
1736
|
-
"xlink:show",
|
|
1737
|
-
"xlink:title",
|
|
1738
|
-
"xlink:type"
|
|
1739
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
1740
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
1741
|
-
// instead in the assignment below.
|
|
1742
|
-
].forEach((attributeName) => {
|
|
1743
|
-
const name = attributeName.replace(CAMELIZE, capitalize);
|
|
1744
|
-
properties[name] = new PropertyInfoRecord(
|
|
1745
|
-
name,
|
|
1746
|
-
STRING,
|
|
1747
|
-
false,
|
|
1748
|
-
// mustUseProperty
|
|
1749
|
-
attributeName,
|
|
1750
|
-
"http://www.w3.org/1999/xlink",
|
|
1751
|
-
false,
|
|
1752
|
-
// sanitizeURL
|
|
1753
|
-
false
|
|
1754
|
-
// removeEmptyString
|
|
1755
|
-
);
|
|
1756
|
-
});
|
|
1757
|
-
[
|
|
1758
|
-
"xml:base",
|
|
1759
|
-
"xml:lang",
|
|
1760
|
-
"xml:space"
|
|
1761
|
-
// NOTE: if you add a camelCased prop to this list,
|
|
1762
|
-
// you'll need to set attributeName to name.toLowerCase()
|
|
1763
|
-
// instead in the assignment below.
|
|
1764
|
-
].forEach((attributeName) => {
|
|
1765
|
-
const name = attributeName.replace(CAMELIZE, capitalize);
|
|
1766
|
-
properties[name] = new PropertyInfoRecord(
|
|
1767
|
-
name,
|
|
1768
|
-
STRING,
|
|
1769
|
-
false,
|
|
1770
|
-
// mustUseProperty
|
|
1771
|
-
attributeName,
|
|
1772
|
-
"http://www.w3.org/XML/1998/namespace",
|
|
1773
|
-
false,
|
|
1774
|
-
// sanitizeURL
|
|
1775
|
-
false
|
|
1776
|
-
// removeEmptyString
|
|
1777
|
-
);
|
|
1778
|
-
});
|
|
1779
|
-
["tabIndex", "crossOrigin"].forEach((attributeName) => {
|
|
1780
|
-
properties[attributeName] = new PropertyInfoRecord(
|
|
1781
|
-
attributeName,
|
|
1782
|
-
STRING,
|
|
1783
|
-
false,
|
|
1784
|
-
// mustUseProperty
|
|
1785
|
-
attributeName.toLowerCase(),
|
|
1786
|
-
// attributeName
|
|
1787
|
-
null,
|
|
1788
|
-
// attributeNamespace
|
|
1789
|
-
false,
|
|
1790
|
-
// sanitizeURL
|
|
1791
|
-
false
|
|
1792
|
-
// removeEmptyString
|
|
1793
|
-
);
|
|
1794
|
-
});
|
|
1795
|
-
const xlinkHref = "xlinkHref";
|
|
1796
|
-
properties[xlinkHref] = new PropertyInfoRecord(
|
|
1797
|
-
"xlinkHref",
|
|
1798
|
-
STRING,
|
|
1799
|
-
false,
|
|
1800
|
-
// mustUseProperty
|
|
1801
|
-
"xlink:href",
|
|
1802
|
-
"http://www.w3.org/1999/xlink",
|
|
1803
|
-
true,
|
|
1804
|
-
// sanitizeURL
|
|
1805
|
-
false
|
|
1806
|
-
// removeEmptyString
|
|
1807
|
-
);
|
|
1808
|
-
["src", "href", "action", "formAction"].forEach((attributeName) => {
|
|
1809
|
-
properties[attributeName] = new PropertyInfoRecord(
|
|
1810
|
-
attributeName,
|
|
1811
|
-
STRING,
|
|
1812
|
-
false,
|
|
1813
|
-
// mustUseProperty
|
|
1814
|
-
attributeName.toLowerCase(),
|
|
1815
|
-
// attributeName
|
|
1816
|
-
null,
|
|
1817
|
-
// attributeNamespace
|
|
1818
|
-
true,
|
|
1819
|
-
// sanitizeURL
|
|
1820
|
-
true
|
|
1821
|
-
// removeEmptyString
|
|
1822
|
-
);
|
|
1823
|
-
});
|
|
1824
|
-
const {
|
|
1825
|
-
CAMELCASE,
|
|
1826
|
-
SAME,
|
|
1827
|
-
possibleStandardNames: possibleStandardNamesOptimized2
|
|
1828
|
-
} = requirePossibleStandardNamesOptimized();
|
|
1829
|
-
const ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
1830
|
-
const ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
1831
|
-
const isCustomAttribute = RegExp.prototype.test.bind(
|
|
1832
|
-
// eslint-disable-next-line no-misleading-character-class
|
|
1833
|
-
new RegExp("^(data|aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$")
|
|
1834
|
-
);
|
|
1835
|
-
const possibleStandardNames = Object.keys(
|
|
1836
|
-
possibleStandardNamesOptimized2
|
|
1837
|
-
).reduce((accumulator, standardName) => {
|
|
1838
|
-
const propName = possibleStandardNamesOptimized2[standardName];
|
|
1839
|
-
if (propName === SAME) {
|
|
1840
|
-
accumulator[standardName] = standardName;
|
|
1841
|
-
} else if (propName === CAMELCASE) {
|
|
1842
|
-
accumulator[standardName.toLowerCase()] = standardName;
|
|
1843
|
-
} else {
|
|
1844
|
-
accumulator[standardName] = propName;
|
|
1845
|
-
}
|
|
1846
|
-
return accumulator;
|
|
1847
|
-
}, {});
|
|
1848
|
-
lib.BOOLEAN = BOOLEAN;
|
|
1849
|
-
lib.BOOLEANISH_STRING = BOOLEANISH_STRING;
|
|
1850
|
-
lib.NUMERIC = NUMERIC;
|
|
1851
|
-
lib.OVERLOADED_BOOLEAN = OVERLOADED_BOOLEAN;
|
|
1852
|
-
lib.POSITIVE_NUMERIC = POSITIVE_NUMERIC;
|
|
1853
|
-
lib.RESERVED = RESERVED;
|
|
1854
|
-
lib.STRING = STRING;
|
|
1855
|
-
lib.getPropertyInfo = getPropertyInfo;
|
|
1856
|
-
lib.isCustomAttribute = isCustomAttribute;
|
|
1857
|
-
lib.possibleStandardNames = possibleStandardNames;
|
|
1858
|
-
return lib;
|
|
1859
|
-
}
|
|
1860
|
-
var utilities$1 = {};
|
|
1861
|
-
var cjs$2 = {};
|
|
1862
|
-
var cjs$1;
|
|
1863
|
-
var hasRequiredCjs$2;
|
|
1864
|
-
function requireCjs$2() {
|
|
1865
|
-
if (hasRequiredCjs$2) return cjs$1;
|
|
1866
|
-
hasRequiredCjs$2 = 1;
|
|
1867
|
-
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
1868
|
-
var NEWLINE_REGEX = /\n/g;
|
|
1869
|
-
var WHITESPACE_REGEX = /^\s*/;
|
|
1870
|
-
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
1871
|
-
var COLON_REGEX = /^:\s*/;
|
|
1872
|
-
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
|
|
1873
|
-
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
1874
|
-
var TRIM_REGEX = /^\s+|\s+$/g;
|
|
1875
|
-
var NEWLINE = "\n";
|
|
1876
|
-
var FORWARD_SLASH = "/";
|
|
1877
|
-
var ASTERISK = "*";
|
|
1878
|
-
var EMPTY_STRING = "";
|
|
1879
|
-
var TYPE_COMMENT = "comment";
|
|
1880
|
-
var TYPE_DECLARATION = "declaration";
|
|
1881
|
-
function index(style, options) {
|
|
1882
|
-
if (typeof style !== "string") {
|
|
1883
|
-
throw new TypeError("First argument must be a string");
|
|
1884
|
-
}
|
|
1885
|
-
if (!style) return [];
|
|
1886
|
-
options = options || {};
|
|
1887
|
-
var lineno = 1;
|
|
1888
|
-
var column = 1;
|
|
1889
|
-
function updatePosition(str) {
|
|
1890
|
-
var lines = str.match(NEWLINE_REGEX);
|
|
1891
|
-
if (lines) lineno += lines.length;
|
|
1892
|
-
var i = str.lastIndexOf(NEWLINE);
|
|
1893
|
-
column = ~i ? str.length - i : column + str.length;
|
|
1894
|
-
}
|
|
1895
|
-
function position() {
|
|
1896
|
-
var start = { line: lineno, column };
|
|
1897
|
-
return function(node2) {
|
|
1898
|
-
node2.position = new Position(start);
|
|
1899
|
-
whitespace();
|
|
1900
|
-
return node2;
|
|
1901
|
-
};
|
|
1902
|
-
}
|
|
1903
|
-
function Position(start) {
|
|
1904
|
-
this.start = start;
|
|
1905
|
-
this.end = { line: lineno, column };
|
|
1906
|
-
this.source = options.source;
|
|
1907
|
-
}
|
|
1908
|
-
Position.prototype.content = style;
|
|
1909
|
-
function error(msg) {
|
|
1910
|
-
var err = new Error(
|
|
1911
|
-
options.source + ":" + lineno + ":" + column + ": " + msg
|
|
1912
|
-
);
|
|
1913
|
-
err.reason = msg;
|
|
1914
|
-
err.filename = options.source;
|
|
1915
|
-
err.line = lineno;
|
|
1916
|
-
err.column = column;
|
|
1917
|
-
err.source = style;
|
|
1918
|
-
if (options.silent) ;
|
|
1919
|
-
else {
|
|
1920
|
-
throw err;
|
|
1921
|
-
}
|
|
480
|
+
}
|
|
481
|
+
function getCSS$1(transformsObj, target) {
|
|
482
|
+
const attributes = {
|
|
483
|
+
css: {
|
|
484
|
+
container: {}
|
|
1922
485
|
}
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
486
|
+
};
|
|
487
|
+
const { css } = attributes;
|
|
488
|
+
const { fittingType } = transformsObj;
|
|
489
|
+
switch (fittingType) {
|
|
490
|
+
case fittingTypes.ORIGINAL_SIZE:
|
|
491
|
+
case fittingTypes.LEGACY_ORIGINAL_SIZE:
|
|
492
|
+
case fittingTypes.LEGACY_STRIP_ORIGINAL_SIZE:
|
|
493
|
+
css.container.backgroundSize = "auto";
|
|
494
|
+
css.container.backgroundRepeat = "no-repeat";
|
|
495
|
+
break;
|
|
496
|
+
case fittingTypes.SCALE_TO_FIT:
|
|
497
|
+
case fittingTypes.LEGACY_STRIP_SCALE_TO_FIT:
|
|
498
|
+
css.container.backgroundSize = "contain";
|
|
499
|
+
css.container.backgroundRepeat = "no-repeat";
|
|
500
|
+
break;
|
|
501
|
+
case fittingTypes.STRETCH:
|
|
502
|
+
css.container.backgroundSize = "100% 100%";
|
|
503
|
+
css.container.backgroundRepeat = "no-repeat";
|
|
504
|
+
break;
|
|
505
|
+
case fittingTypes.SCALE_TO_FILL:
|
|
506
|
+
case fittingTypes.LEGACY_STRIP_SCALE_TO_FILL:
|
|
507
|
+
css.container.backgroundSize = "cover";
|
|
508
|
+
css.container.backgroundRepeat = "no-repeat";
|
|
509
|
+
break;
|
|
510
|
+
case fittingTypes.TILE_HORIZONTAL:
|
|
511
|
+
case fittingTypes.LEGACY_STRIP_TILE_HORIZONTAL:
|
|
512
|
+
css.container.backgroundSize = "auto";
|
|
513
|
+
css.container.backgroundRepeat = "repeat-x";
|
|
514
|
+
break;
|
|
515
|
+
case fittingTypes.TILE_VERTICAL:
|
|
516
|
+
case fittingTypes.LEGACY_STRIP_TILE_VERTICAL:
|
|
517
|
+
css.container.backgroundSize = "auto";
|
|
518
|
+
css.container.backgroundRepeat = "repeat-y";
|
|
519
|
+
break;
|
|
520
|
+
case fittingTypes.TILE:
|
|
521
|
+
case fittingTypes.LEGACY_STRIP_TILE:
|
|
522
|
+
css.container.backgroundSize = "auto";
|
|
523
|
+
css.container.backgroundRepeat = "repeat";
|
|
524
|
+
break;
|
|
525
|
+
case fittingTypes.LEGACY_STRIP_FIT_AND_TILE:
|
|
526
|
+
css.container.backgroundSize = "contain";
|
|
527
|
+
css.container.backgroundRepeat = "repeat";
|
|
528
|
+
break;
|
|
529
|
+
case fittingTypes.FIT_AND_TILE:
|
|
530
|
+
css.container.backgroundSize = "auto";
|
|
531
|
+
css.container.backgroundRepeat = "repeat";
|
|
532
|
+
break;
|
|
533
|
+
// Legacy old editor bg types.
|
|
534
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE:
|
|
535
|
+
css.container.backgroundSize = "auto";
|
|
536
|
+
css.container.backgroundRepeat = "repeat";
|
|
537
|
+
break;
|
|
538
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL:
|
|
539
|
+
css.container.backgroundSize = "auto";
|
|
540
|
+
css.container.backgroundRepeat = "repeat-x";
|
|
541
|
+
break;
|
|
542
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL:
|
|
543
|
+
css.container.backgroundSize = "auto";
|
|
544
|
+
css.container.backgroundRepeat = "repeat-y";
|
|
545
|
+
break;
|
|
546
|
+
case fittingTypes.LEGACY_BG_NORMAL:
|
|
547
|
+
css.container.backgroundSize = "auto";
|
|
548
|
+
css.container.backgroundRepeat = "no-repeat";
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
switch (target.alignment) {
|
|
552
|
+
case alignTypes.CENTER:
|
|
553
|
+
css.container.backgroundPosition = "center center";
|
|
554
|
+
break;
|
|
555
|
+
case alignTypes.LEFT:
|
|
556
|
+
css.container.backgroundPosition = "left center";
|
|
557
|
+
break;
|
|
558
|
+
case alignTypes.RIGHT:
|
|
559
|
+
css.container.backgroundPosition = "right center";
|
|
560
|
+
break;
|
|
561
|
+
case alignTypes.TOP:
|
|
562
|
+
css.container.backgroundPosition = "center top";
|
|
563
|
+
break;
|
|
564
|
+
case alignTypes.BOTTOM:
|
|
565
|
+
css.container.backgroundPosition = "center bottom";
|
|
566
|
+
break;
|
|
567
|
+
case alignTypes.TOP_RIGHT:
|
|
568
|
+
css.container.backgroundPosition = "right top";
|
|
569
|
+
break;
|
|
570
|
+
case alignTypes.TOP_LEFT:
|
|
571
|
+
css.container.backgroundPosition = "left top";
|
|
572
|
+
break;
|
|
573
|
+
case alignTypes.BOTTOM_RIGHT:
|
|
574
|
+
css.container.backgroundPosition = "right bottom";
|
|
575
|
+
break;
|
|
576
|
+
case alignTypes.BOTTOM_LEFT:
|
|
577
|
+
css.container.backgroundPosition = "left bottom";
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
return attributes;
|
|
581
|
+
}
|
|
582
|
+
function alignTypeToPosition(verticalMiddle, horizontalMiddle, target) {
|
|
583
|
+
return {
|
|
584
|
+
[alignTypes.TOP_LEFT]: { top: 0, left: 0 },
|
|
585
|
+
[alignTypes.TOP_RIGHT]: { top: 0, right: 0 },
|
|
586
|
+
[alignTypes.TOP]: { top: 0, left: horizontalMiddle },
|
|
587
|
+
[alignTypes.BOTTOM_LEFT]: { bottom: 0, left: 0 },
|
|
588
|
+
[alignTypes.BOTTOM_RIGHT]: { bottom: 0, right: 0 },
|
|
589
|
+
[alignTypes.BOTTOM]: { bottom: 0, left: horizontalMiddle },
|
|
590
|
+
[alignTypes.RIGHT]: { top: verticalMiddle, right: 0 },
|
|
591
|
+
[alignTypes.LEFT]: { top: verticalMiddle, left: 0 },
|
|
592
|
+
[alignTypes.CENTER]: {
|
|
593
|
+
width: target.width,
|
|
594
|
+
height: target.height,
|
|
595
|
+
objectFit: "none"
|
|
1930
596
|
}
|
|
1931
|
-
|
|
1932
|
-
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const alignTypeToPositionStr = {
|
|
600
|
+
[alignTypes.CENTER]: "center",
|
|
601
|
+
[alignTypes.TOP]: "top",
|
|
602
|
+
[alignTypes.TOP_LEFT]: "top left",
|
|
603
|
+
[alignTypes.TOP_RIGHT]: "top right",
|
|
604
|
+
[alignTypes.BOTTOM]: "bottom",
|
|
605
|
+
[alignTypes.BOTTOM_LEFT]: "bottom left",
|
|
606
|
+
[alignTypes.BOTTOM_RIGHT]: "bottom right",
|
|
607
|
+
[alignTypes.LEFT]: "left",
|
|
608
|
+
[alignTypes.RIGHT]: "right"
|
|
609
|
+
};
|
|
610
|
+
const aligmentDefaults = {
|
|
611
|
+
position: "absolute",
|
|
612
|
+
top: "auto",
|
|
613
|
+
right: "auto",
|
|
614
|
+
bottom: "auto",
|
|
615
|
+
left: "auto"
|
|
616
|
+
};
|
|
617
|
+
function getCSS(transformsObj, target) {
|
|
618
|
+
const attributes = {
|
|
619
|
+
css: {
|
|
620
|
+
container: {},
|
|
621
|
+
img: {}
|
|
1933
622
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
623
|
+
};
|
|
624
|
+
const { css } = attributes;
|
|
625
|
+
const { fittingType } = transformsObj;
|
|
626
|
+
const alignType = target.alignment;
|
|
627
|
+
css.container.position = "relative";
|
|
628
|
+
switch (fittingType) {
|
|
629
|
+
case fittingTypes.ORIGINAL_SIZE:
|
|
630
|
+
case fittingTypes.LEGACY_ORIGINAL_SIZE:
|
|
631
|
+
if (transformsObj.parts && transformsObj.parts.length) {
|
|
632
|
+
css.img.width = transformsObj.parts[0].width;
|
|
633
|
+
css.img.height = transformsObj.parts[0].height;
|
|
634
|
+
} else {
|
|
635
|
+
css.img.width = transformsObj.src.width;
|
|
636
|
+
css.img.height = transformsObj.src.height;
|
|
1941
637
|
}
|
|
1942
|
-
|
|
638
|
+
break;
|
|
639
|
+
case fittingTypes.SCALE_TO_FIT:
|
|
640
|
+
case fittingTypes.LEGACY_FIT_WIDTH:
|
|
641
|
+
case fittingTypes.LEGACY_FIT_HEIGHT:
|
|
642
|
+
case fittingTypes.LEGACY_FULL:
|
|
643
|
+
css.img.width = target.width;
|
|
644
|
+
css.img.height = target.height;
|
|
645
|
+
css.img.objectFit = "contain";
|
|
646
|
+
css.img.objectPosition = alignTypeToPositionStr[alignType] || "unset";
|
|
647
|
+
break;
|
|
648
|
+
// BG_NORMAL is a sitebackground legacy for original size fitting type.
|
|
649
|
+
// target width and height were modified in transform.js
|
|
650
|
+
case fittingTypes.LEGACY_BG_NORMAL:
|
|
651
|
+
css.img.width = "100%";
|
|
652
|
+
css.img.height = "100%";
|
|
653
|
+
css.img.objectFit = "none";
|
|
654
|
+
css.img.objectPosition = alignTypeToPositionStr[alignType] || "unset";
|
|
655
|
+
break;
|
|
656
|
+
case fittingTypes.STRETCH:
|
|
657
|
+
css.img.width = target.width;
|
|
658
|
+
css.img.height = target.height;
|
|
659
|
+
css.img.objectFit = "fill";
|
|
660
|
+
break;
|
|
661
|
+
case fittingTypes.SCALE_TO_FILL:
|
|
662
|
+
css.img.width = target.width;
|
|
663
|
+
css.img.height = target.height;
|
|
664
|
+
css.img.objectFit = "cover";
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
if (typeof css.img.width === "number" && typeof css.img.height === "number" && (css.img.width !== target.width || css.img.height !== target.height)) {
|
|
668
|
+
const verticalMiddle = Math.round((target.height - css.img.height) / 2);
|
|
669
|
+
const horizontalMiddle = Math.round((target.width - css.img.width) / 2);
|
|
670
|
+
Object.assign(css.img, aligmentDefaults, alignTypeToPosition(verticalMiddle, horizontalMiddle, target)[alignType]);
|
|
671
|
+
}
|
|
672
|
+
return attributes;
|
|
673
|
+
}
|
|
674
|
+
function getSvgAttr(transformsObj, target) {
|
|
675
|
+
const attributes = {
|
|
676
|
+
css: {
|
|
677
|
+
container: {}
|
|
678
|
+
},
|
|
679
|
+
attr: {
|
|
680
|
+
container: {},
|
|
681
|
+
img: {}
|
|
1943
682
|
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
683
|
+
};
|
|
684
|
+
const { css, attr } = attributes;
|
|
685
|
+
const { fittingType } = transformsObj;
|
|
686
|
+
const alignType = target.alignment;
|
|
687
|
+
const { width: sourceWidth, height: sourceHeight } = transformsObj.src;
|
|
688
|
+
let imageScale;
|
|
689
|
+
css.container.position = "relative";
|
|
690
|
+
switch (fittingType) {
|
|
691
|
+
case fittingTypes.ORIGINAL_SIZE:
|
|
692
|
+
case fittingTypes.LEGACY_ORIGINAL_SIZE:
|
|
693
|
+
case fittingTypes.TILE:
|
|
694
|
+
if (transformsObj.parts && transformsObj.parts.length) {
|
|
695
|
+
attr.img.width = transformsObj.parts[0].width;
|
|
696
|
+
attr.img.height = transformsObj.parts[0].height;
|
|
697
|
+
} else {
|
|
698
|
+
attr.img.width = sourceWidth;
|
|
699
|
+
attr.img.height = sourceHeight;
|
|
1950
700
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
701
|
+
attr.img.preserveAspectRatio = "xMidYMid slice";
|
|
702
|
+
break;
|
|
703
|
+
case fittingTypes.SCALE_TO_FIT:
|
|
704
|
+
case fittingTypes.LEGACY_FIT_WIDTH:
|
|
705
|
+
case fittingTypes.LEGACY_FIT_HEIGHT:
|
|
706
|
+
case fittingTypes.LEGACY_FULL:
|
|
707
|
+
attr.img.width = "100%";
|
|
708
|
+
attr.img.height = "100%";
|
|
709
|
+
attr.img.transform = "";
|
|
710
|
+
attr.img.preserveAspectRatio = "";
|
|
711
|
+
break;
|
|
712
|
+
case fittingTypes.STRETCH:
|
|
713
|
+
attr.img.width = target.width;
|
|
714
|
+
attr.img.height = target.height;
|
|
715
|
+
attr.img.x = 0;
|
|
716
|
+
attr.img.y = 0;
|
|
717
|
+
attr.img.transform = "";
|
|
718
|
+
attr.img.preserveAspectRatio = "none";
|
|
719
|
+
break;
|
|
720
|
+
case fittingTypes.SCALE_TO_FILL:
|
|
721
|
+
if (!isImageTransformApplicable(transformsObj.src.id)) {
|
|
722
|
+
imageScale = getDimension(sourceWidth, sourceHeight, target.width, target.height, transformTypes.FILL);
|
|
723
|
+
attr.img.width = imageScale.width;
|
|
724
|
+
attr.img.height = imageScale.height;
|
|
725
|
+
} else {
|
|
726
|
+
attr.img.width = target.width;
|
|
727
|
+
attr.img.height = target.height;
|
|
1954
728
|
}
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
var ret = pos({
|
|
1973
|
-
type: TYPE_DECLARATION,
|
|
1974
|
-
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
|
|
1975
|
-
value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
|
|
1976
|
-
});
|
|
1977
|
-
match(SEMICOLON_REGEX);
|
|
1978
|
-
return ret;
|
|
729
|
+
attr.img.x = 0;
|
|
730
|
+
attr.img.y = 0;
|
|
731
|
+
attr.img.transform = "";
|
|
732
|
+
attr.img.preserveAspectRatio = "xMidYMid slice";
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
if (typeof attr.img.width === "number" && typeof attr.img.height === "number" && (attr.img.width !== target.width || attr.img.height !== target.height)) {
|
|
736
|
+
let x = 0;
|
|
737
|
+
let y = 0;
|
|
738
|
+
let right;
|
|
739
|
+
let bottom;
|
|
740
|
+
if (fittingType === fittingTypes.TILE) {
|
|
741
|
+
right = target.width % attr.img.width;
|
|
742
|
+
bottom = target.height % attr.img.height;
|
|
743
|
+
} else {
|
|
744
|
+
right = target.width - attr.img.width;
|
|
745
|
+
bottom = target.height - attr.img.height;
|
|
1979
746
|
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
747
|
+
const center = Math.round(right / 2);
|
|
748
|
+
const middle = Math.round(bottom / 2);
|
|
749
|
+
switch (alignType) {
|
|
750
|
+
case alignTypes.TOP_LEFT:
|
|
751
|
+
x = 0;
|
|
752
|
+
y = 0;
|
|
753
|
+
break;
|
|
754
|
+
case alignTypes.TOP:
|
|
755
|
+
x = center;
|
|
756
|
+
y = 0;
|
|
757
|
+
break;
|
|
758
|
+
case alignTypes.TOP_RIGHT:
|
|
759
|
+
x = right;
|
|
760
|
+
y = 0;
|
|
761
|
+
break;
|
|
762
|
+
case alignTypes.LEFT:
|
|
763
|
+
x = 0;
|
|
764
|
+
y = middle;
|
|
765
|
+
break;
|
|
766
|
+
case alignTypes.CENTER:
|
|
767
|
+
x = center;
|
|
768
|
+
y = middle;
|
|
769
|
+
break;
|
|
770
|
+
case alignTypes.RIGHT:
|
|
771
|
+
x = right;
|
|
772
|
+
y = middle;
|
|
773
|
+
break;
|
|
774
|
+
case alignTypes.BOTTOM_LEFT:
|
|
775
|
+
x = 0;
|
|
776
|
+
y = bottom;
|
|
777
|
+
break;
|
|
778
|
+
case alignTypes.BOTTOM:
|
|
779
|
+
x = center;
|
|
780
|
+
y = bottom;
|
|
781
|
+
break;
|
|
782
|
+
case alignTypes.BOTTOM_RIGHT:
|
|
783
|
+
x = right;
|
|
784
|
+
y = bottom;
|
|
785
|
+
break;
|
|
1991
786
|
}
|
|
1992
|
-
|
|
1993
|
-
|
|
787
|
+
attr.img.x = x;
|
|
788
|
+
attr.img.y = y;
|
|
1994
789
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
790
|
+
attr.container.width = target.width;
|
|
791
|
+
attr.container.height = target.height;
|
|
792
|
+
attr.container.viewBox = [0, 0, target.width, target.height].join(" ");
|
|
793
|
+
return attributes;
|
|
794
|
+
}
|
|
795
|
+
function getAttributes(transformsObj, target) {
|
|
796
|
+
let attributesGetter;
|
|
797
|
+
if (target.htmlTag === htmlTag.BG) {
|
|
798
|
+
attributesGetter = getCSS$1;
|
|
799
|
+
} else if (target.htmlTag === htmlTag.SVG) {
|
|
800
|
+
attributesGetter = getSvgAttr;
|
|
801
|
+
} else {
|
|
802
|
+
attributesGetter = getCSS;
|
|
1997
803
|
}
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
let styleObject = null;
|
|
2013
|
-
if (!style || typeof style !== "string") {
|
|
2014
|
-
return styleObject;
|
|
804
|
+
return attributesGetter(transformsObj, target);
|
|
805
|
+
}
|
|
806
|
+
function isMobile() {
|
|
807
|
+
return getFeature("isMobile");
|
|
808
|
+
}
|
|
809
|
+
function setTransformParts(transformsObj, src, target) {
|
|
810
|
+
let rect;
|
|
811
|
+
if (src.crop) {
|
|
812
|
+
rect = getOverlappingRect(src, src.crop);
|
|
813
|
+
if (rect) {
|
|
814
|
+
transformsObj.src.width = rect.width;
|
|
815
|
+
transformsObj.src.height = rect.height;
|
|
816
|
+
transformsObj.src.isCropped = true;
|
|
817
|
+
transformsObj.parts.push(getCropPart(rect));
|
|
2015
818
|
}
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
819
|
+
}
|
|
820
|
+
switch (transformsObj.fittingType) {
|
|
821
|
+
case fittingTypes.SCALE_TO_FIT:
|
|
822
|
+
case fittingTypes.LEGACY_FIT_WIDTH:
|
|
823
|
+
case fittingTypes.LEGACY_FIT_HEIGHT:
|
|
824
|
+
case fittingTypes.LEGACY_FULL:
|
|
825
|
+
case fittingTypes.FIT_AND_TILE:
|
|
826
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE:
|
|
827
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL:
|
|
828
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL:
|
|
829
|
+
case fittingTypes.LEGACY_BG_NORMAL:
|
|
830
|
+
transformsObj.parts.push(getFitPart(transformsObj, target));
|
|
831
|
+
break;
|
|
832
|
+
case fittingTypes.SCALE_TO_FILL:
|
|
833
|
+
transformsObj.parts.push(getFillPart(transformsObj, target));
|
|
834
|
+
break;
|
|
835
|
+
case fittingTypes.STRETCH:
|
|
836
|
+
transformsObj.parts.push(getStretchPart(transformsObj, target));
|
|
837
|
+
break;
|
|
838
|
+
case fittingTypes.TILE_HORIZONTAL:
|
|
839
|
+
case fittingTypes.TILE_VERTICAL:
|
|
840
|
+
case fittingTypes.TILE:
|
|
841
|
+
case fittingTypes.LEGACY_ORIGINAL_SIZE:
|
|
842
|
+
case fittingTypes.ORIGINAL_SIZE:
|
|
843
|
+
rect = getAlignedRect(transformsObj.src, target, transformsObj.focalPoint, target.alignment);
|
|
844
|
+
if (transformsObj.src.isCropped) {
|
|
845
|
+
Object.assign(transformsObj.parts[0], rect);
|
|
846
|
+
transformsObj.src.width = rect.width;
|
|
847
|
+
transformsObj.src.height = rect.height;
|
|
848
|
+
} else {
|
|
849
|
+
transformsObj.parts.push(getCropPart(rect));
|
|
2028
850
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
851
|
+
break;
|
|
852
|
+
// ---------------------------------------------------------------------------------------
|
|
853
|
+
// handles a legacy bug on bgImageStrip, background html tag
|
|
854
|
+
// component Full Width Strip stored incorrect image source width and height
|
|
855
|
+
// ---------------------------------------------------------------------------------------
|
|
856
|
+
case fittingTypes.LEGACY_STRIP_TILE_HORIZONTAL:
|
|
857
|
+
case fittingTypes.LEGACY_STRIP_TILE_VERTICAL:
|
|
858
|
+
case fittingTypes.LEGACY_STRIP_TILE:
|
|
859
|
+
case fittingTypes.LEGACY_STRIP_ORIGINAL_SIZE:
|
|
860
|
+
transformsObj.parts.push(getLegacyCropPart(target));
|
|
861
|
+
break;
|
|
862
|
+
case fittingTypes.LEGACY_STRIP_SCALE_TO_FIT:
|
|
863
|
+
case fittingTypes.LEGACY_STRIP_FIT_AND_TILE:
|
|
864
|
+
transformsObj.parts.push(getLegacyFitPart(target));
|
|
865
|
+
break;
|
|
866
|
+
case fittingTypes.LEGACY_STRIP_SCALE_TO_FILL:
|
|
867
|
+
transformsObj.parts.push(getLegacyFillPart(target));
|
|
868
|
+
break;
|
|
2031
869
|
}
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
870
|
+
}
|
|
871
|
+
function getFitPart(transformsObj, target) {
|
|
872
|
+
const transformedData = getTransformData(transformsObj.src.width, transformsObj.src.height, transformTypes.FIT, target, transformsObj.devicePixelRatio, transformsObj.upscaleMethod);
|
|
873
|
+
const isMissingSrcDimensions = !transformsObj.src.width || !transformsObj.src.height;
|
|
874
|
+
const transformType = isMissingSrcDimensions ? transformTypes.FIT : transformTypes.FILL;
|
|
875
|
+
return {
|
|
876
|
+
transformType,
|
|
877
|
+
width: Math.round(transformedData.width),
|
|
878
|
+
height: Math.round(transformedData.height),
|
|
879
|
+
alignment: alignTypesMap.center,
|
|
880
|
+
upscale: transformedData.scaleFactor > 1,
|
|
881
|
+
forceUSM: transformedData.forceUSM,
|
|
882
|
+
scaleFactor: transformedData.scaleFactor,
|
|
883
|
+
cssUpscaleNeeded: transformedData.cssUpscaleNeeded,
|
|
884
|
+
upscaleMethodValue: transformedData.upscaleMethodValue
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
function getFillPart(transformsObj, target) {
|
|
888
|
+
const transformedData = getTransformData(transformsObj.src.width, transformsObj.src.height, transformTypes.FILL, target, transformsObj.devicePixelRatio, transformsObj.upscaleMethod);
|
|
889
|
+
const focalPoint = getFocalPoint(transformsObj.focalPoint);
|
|
890
|
+
const transformType = focalPoint ? transformTypes.FILL_FOCAL : transformTypes.FILL;
|
|
891
|
+
return {
|
|
892
|
+
transformType,
|
|
893
|
+
width: Math.round(transformedData.width),
|
|
894
|
+
height: Math.round(transformedData.height),
|
|
895
|
+
alignment: getAlignment(target),
|
|
896
|
+
focalPointX: focalPoint && focalPoint.x,
|
|
897
|
+
focalPointY: focalPoint && focalPoint.y,
|
|
898
|
+
upscale: transformedData.scaleFactor > 1,
|
|
899
|
+
forceUSM: transformedData.forceUSM,
|
|
900
|
+
scaleFactor: transformedData.scaleFactor,
|
|
901
|
+
cssUpscaleNeeded: transformedData.cssUpscaleNeeded,
|
|
902
|
+
upscaleMethodValue: transformedData.upscaleMethodValue
|
|
2048
903
|
};
|
|
2049
|
-
|
|
2050
|
-
|
|
904
|
+
}
|
|
905
|
+
function getStretchPart(transformsObj, target) {
|
|
906
|
+
const scaleFactor = getScaleFactor(transformsObj.src.width, transformsObj.src.height, target.width, target.height, transformTypes.FILL);
|
|
907
|
+
const clonedTarget = { ...target };
|
|
908
|
+
clonedTarget.width = transformsObj.src.width * scaleFactor;
|
|
909
|
+
clonedTarget.height = transformsObj.src.height * scaleFactor;
|
|
910
|
+
return getFitPart(transformsObj, clonedTarget);
|
|
911
|
+
}
|
|
912
|
+
function getCropPart(rect) {
|
|
913
|
+
return {
|
|
914
|
+
transformType: transformTypes.CROP,
|
|
915
|
+
x: Math.round(rect.x),
|
|
916
|
+
y: Math.round(rect.y),
|
|
917
|
+
width: Math.round(rect.width),
|
|
918
|
+
height: Math.round(rect.height),
|
|
919
|
+
upscale: false,
|
|
920
|
+
forceUSM: false,
|
|
921
|
+
scaleFactor: 1,
|
|
922
|
+
cssUpscaleNeeded: false
|
|
2051
923
|
};
|
|
2052
|
-
|
|
2053
|
-
|
|
924
|
+
}
|
|
925
|
+
function getLegacyFitPart(target) {
|
|
926
|
+
return {
|
|
927
|
+
transformType: transformTypes.FIT,
|
|
928
|
+
width: Math.round(target.width),
|
|
929
|
+
height: Math.round(target.height),
|
|
930
|
+
upscale: false,
|
|
931
|
+
forceUSM: true,
|
|
932
|
+
scaleFactor: 1,
|
|
933
|
+
cssUpscaleNeeded: false
|
|
2054
934
|
};
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
|
|
2067
|
-
}
|
|
2068
|
-
return property.replace(HYPHEN_REGEX, capitalize);
|
|
935
|
+
}
|
|
936
|
+
function getLegacyFillPart(target) {
|
|
937
|
+
return {
|
|
938
|
+
transformType: transformTypes.LEGACY_FILL,
|
|
939
|
+
width: Math.round(target.width),
|
|
940
|
+
height: Math.round(target.height),
|
|
941
|
+
alignment: getAlignment(target),
|
|
942
|
+
upscale: false,
|
|
943
|
+
forceUSM: true,
|
|
944
|
+
scaleFactor: 1,
|
|
945
|
+
cssUpscaleNeeded: false
|
|
2069
946
|
};
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
947
|
+
}
|
|
948
|
+
function getLegacyCropPart(target) {
|
|
949
|
+
return {
|
|
950
|
+
transformType: transformTypes.LEGACY_CROP,
|
|
951
|
+
width: Math.round(target.width),
|
|
952
|
+
height: Math.round(target.height),
|
|
953
|
+
alignment: getAlignment(target),
|
|
954
|
+
upscale: false,
|
|
955
|
+
forceUSM: false,
|
|
956
|
+
scaleFactor: 1,
|
|
957
|
+
cssUpscaleNeeded: false
|
|
2080
958
|
};
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
959
|
+
}
|
|
960
|
+
function setTransformOptions(transformsObj, options) {
|
|
961
|
+
options = options || {};
|
|
962
|
+
transformsObj.quality = getQuality(transformsObj, options);
|
|
963
|
+
transformsObj.progressive = getProgressive(options);
|
|
964
|
+
transformsObj.watermark = getWatermark(options);
|
|
965
|
+
transformsObj.autoEncode = options.autoEncode ?? true;
|
|
966
|
+
transformsObj.encoding = options == null ? void 0 : options.encoding;
|
|
967
|
+
transformsObj.unsharpMask = getUnsharpMask(transformsObj, options);
|
|
968
|
+
transformsObj.filters = getFilters(options);
|
|
969
|
+
}
|
|
970
|
+
function getWatermark(options) {
|
|
971
|
+
return options.watermark;
|
|
972
|
+
}
|
|
973
|
+
function getProgressive(options) {
|
|
974
|
+
return options.progressive !== false;
|
|
975
|
+
}
|
|
976
|
+
function getQuality(transformsObj, options) {
|
|
977
|
+
const isPNG2 = transformsObj.fileType === fileType.PNG;
|
|
978
|
+
const isJPG2 = transformsObj.fileType === fileType.JPG;
|
|
979
|
+
const isWEBP2 = transformsObj.fileType === fileType.WEBP;
|
|
980
|
+
const isAVIF2 = transformsObj.fileType === fileType.AVIF;
|
|
981
|
+
const isQualitySupported = isJPG2 || isPNG2 || isWEBP2 || isAVIF2;
|
|
982
|
+
if (isQualitySupported) {
|
|
983
|
+
const transformData = last(transformsObj.parts);
|
|
984
|
+
const defaultQuality = getPreferredImageQuality(transformData.width, transformData.height);
|
|
985
|
+
let quality = options.quality && options.quality >= 5 && options.quality <= 90 ? options.quality : defaultQuality;
|
|
986
|
+
quality = isPNG2 ? quality + 5 : quality;
|
|
987
|
+
return quality;
|
|
2094
988
|
}
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
(
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
if (RESERVED_SVG_MATHML_ELEMENTS.has(tagName)) {
|
|
2128
|
-
return false;
|
|
2129
|
-
}
|
|
2130
|
-
return true;
|
|
2131
|
-
}
|
|
2132
|
-
var styleOptions = {
|
|
2133
|
-
reactCompat: true
|
|
2134
|
-
};
|
|
2135
|
-
function setStyleProp(style, props) {
|
|
2136
|
-
if (typeof style !== "string") {
|
|
2137
|
-
return;
|
|
2138
|
-
}
|
|
2139
|
-
if (!style.trim()) {
|
|
2140
|
-
props.style = {};
|
|
2141
|
-
return;
|
|
2142
|
-
}
|
|
2143
|
-
try {
|
|
2144
|
-
props.style = (0, style_to_js_1.default)(style, styleOptions);
|
|
2145
|
-
} catch (error) {
|
|
2146
|
-
props.style = {};
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
exports$1.PRESERVE_CUSTOM_ATTRIBUTES = Number(react_1.version.split(".")[0]) >= 16;
|
|
2150
|
-
exports$1.ELEMENTS_WITH_NO_TEXT_CHILDREN = /* @__PURE__ */ new Set([
|
|
2151
|
-
"tr",
|
|
2152
|
-
"tbody",
|
|
2153
|
-
"thead",
|
|
2154
|
-
"tfoot",
|
|
2155
|
-
"colgroup",
|
|
2156
|
-
"table",
|
|
2157
|
-
"head",
|
|
2158
|
-
"html",
|
|
2159
|
-
"frameset"
|
|
2160
|
-
]);
|
|
2161
|
-
var canTextBeChildOfNode = function(node2) {
|
|
2162
|
-
return !exports$1.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(node2.name);
|
|
2163
|
-
};
|
|
2164
|
-
exports$1.canTextBeChildOfNode = canTextBeChildOfNode;
|
|
2165
|
-
var returnFirstArg = function(arg) {
|
|
2166
|
-
return arg;
|
|
989
|
+
return 0;
|
|
990
|
+
}
|
|
991
|
+
function getFilters(options) {
|
|
992
|
+
const filterOptions = options.filters || {};
|
|
993
|
+
const filters = {};
|
|
994
|
+
if (isValidImageFilter(filterOptions[imageFilters.CONTRAST], -100, 100)) {
|
|
995
|
+
filters[imageFilters.CONTRAST] = filterOptions[imageFilters.CONTRAST];
|
|
996
|
+
}
|
|
997
|
+
if (isValidImageFilter(filterOptions[imageFilters.BRIGHTNESS], -100, 100)) {
|
|
998
|
+
filters[imageFilters.BRIGHTNESS] = filterOptions[imageFilters.BRIGHTNESS];
|
|
999
|
+
}
|
|
1000
|
+
if (isValidImageFilter(filterOptions[imageFilters.SATURATION], -100, 100)) {
|
|
1001
|
+
filters[imageFilters.SATURATION] = filterOptions[imageFilters.SATURATION];
|
|
1002
|
+
}
|
|
1003
|
+
if (isValidImageFilter(filterOptions[imageFilters.HUE], -180, 180)) {
|
|
1004
|
+
filters[imageFilters.HUE] = filterOptions[imageFilters.HUE];
|
|
1005
|
+
}
|
|
1006
|
+
if (isValidImageFilter(filterOptions[imageFilters.BLUR], 0, 100)) {
|
|
1007
|
+
filters[imageFilters.BLUR] = filterOptions[imageFilters.BLUR];
|
|
1008
|
+
}
|
|
1009
|
+
return filters;
|
|
1010
|
+
}
|
|
1011
|
+
function isValidImageFilter(filterValue, minValue, maxValue) {
|
|
1012
|
+
return typeof filterValue === "number" && !isNaN(filterValue) && filterValue !== 0 && filterValue >= minValue && filterValue <= maxValue;
|
|
1013
|
+
}
|
|
1014
|
+
function getUnsharpMask(transformsObj, options) {
|
|
1015
|
+
var _a, _b, _c;
|
|
1016
|
+
if (isUSMValid(options.unsharpMask)) {
|
|
1017
|
+
return {
|
|
1018
|
+
radius: roundToFixed((_a = options.unsharpMask) == null ? void 0 : _a.radius, 2),
|
|
1019
|
+
amount: roundToFixed((_b = options.unsharpMask) == null ? void 0 : _b.amount, 2),
|
|
1020
|
+
threshold: roundToFixed((_c = options.unsharpMask) == null ? void 0 : _c.threshold, 2)
|
|
2167
1021
|
};
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
function
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
1022
|
+
} else if (!isZeroUSM(options.unsharpMask) && isUSMNeeded(transformsObj)) {
|
|
1023
|
+
return defaultUSM;
|
|
1024
|
+
}
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
function isUSMNeeded(transformsObj) {
|
|
1028
|
+
const transformPart = last(transformsObj.parts);
|
|
1029
|
+
const upscale = transformPart.scaleFactor >= 1;
|
|
1030
|
+
return !upscale || transformPart.forceUSM || transformPart.transformType === transformTypes.FIT;
|
|
1031
|
+
}
|
|
1032
|
+
function isUSMValid(usm) {
|
|
1033
|
+
usm = usm || {};
|
|
1034
|
+
const radius = typeof usm.radius === "number" && !isNaN(usm.radius) && usm.radius >= 0.1 && usm.radius <= 500;
|
|
1035
|
+
const amount = typeof usm.amount === "number" && !isNaN(usm.amount) && usm.amount >= 0 && usm.amount <= 10;
|
|
1036
|
+
const threshold = typeof usm.threshold === "number" && !isNaN(usm.threshold) && usm.threshold >= 0 && usm.threshold <= 255;
|
|
1037
|
+
return radius && amount && threshold;
|
|
1038
|
+
}
|
|
1039
|
+
function isZeroUSM(usm) {
|
|
1040
|
+
usm = usm || {};
|
|
1041
|
+
return typeof usm.radius === "number" && !isNaN(usm.radius) && usm.radius === 0 && typeof usm.amount === "number" && !isNaN(usm.amount) && usm.amount === 0 && typeof usm.threshold === "number" && !isNaN(usm.threshold) && usm.threshold === 0;
|
|
1042
|
+
}
|
|
1043
|
+
function getTransform(fittingType, src, target, options) {
|
|
1044
|
+
const _isSEOBot = isSEOBot(options);
|
|
1045
|
+
const fileType2 = getFileType(src.id);
|
|
1046
|
+
const fileName = getFileName(src.id, src.name);
|
|
1047
|
+
const devicePixelRatio = _isSEOBot ? 1 : getDevicePixelRatio(target);
|
|
1048
|
+
const fileExtension = getFileExtension(src.id);
|
|
1049
|
+
const preferredExtension = fileExtension;
|
|
1050
|
+
const canTransformImage = isImageTransformApplicable(src.id, options == null ? void 0 : options.hasAnimation, options == null ? void 0 : options.allowAnimatedTransform, options == null ? void 0 : options.allowFullGIFTransformation);
|
|
1051
|
+
const transformsObj = {
|
|
1052
|
+
fileName,
|
|
1053
|
+
fileExtension,
|
|
1054
|
+
fileType: fileType2,
|
|
1055
|
+
fittingType,
|
|
1056
|
+
preferredExtension,
|
|
1057
|
+
src: {
|
|
1058
|
+
id: src.id,
|
|
1059
|
+
width: src.width,
|
|
1060
|
+
height: src.height,
|
|
1061
|
+
isCropped: false,
|
|
1062
|
+
isAnimated: imageIsAnimated(src.id, options == null ? void 0 : options.hasAnimation)
|
|
1063
|
+
},
|
|
1064
|
+
focalPoint: {
|
|
1065
|
+
x: src.focalPoint && src.focalPoint.x,
|
|
1066
|
+
y: src.focalPoint && src.focalPoint.y
|
|
1067
|
+
},
|
|
1068
|
+
parts: [],
|
|
1069
|
+
// options - general
|
|
1070
|
+
devicePixelRatio,
|
|
1071
|
+
quality: 0,
|
|
1072
|
+
upscaleMethod: getUpscaleString(options),
|
|
1073
|
+
progressive: true,
|
|
1074
|
+
watermark: "",
|
|
1075
|
+
unsharpMask: {},
|
|
1076
|
+
filters: {},
|
|
1077
|
+
transformed: canTransformImage,
|
|
1078
|
+
allowFullGIFTransformation: options == null ? void 0 : options.allowFullGIFTransformation,
|
|
1079
|
+
isPlaceholderFlow: options == null ? void 0 : options.isPlaceholderFlow
|
|
2185
1080
|
};
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
1081
|
+
if (canTransformImage) {
|
|
1082
|
+
setTransformParts(transformsObj, src, target);
|
|
1083
|
+
setTransformOptions(transformsObj, options);
|
|
1084
|
+
}
|
|
1085
|
+
return transformsObj;
|
|
1086
|
+
}
|
|
1087
|
+
function getTarget(fittingType, src, target) {
|
|
1088
|
+
const targetObj = { ...target };
|
|
1089
|
+
const _isMobile = isMobile();
|
|
1090
|
+
switch (fittingType) {
|
|
1091
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE:
|
|
1092
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL:
|
|
1093
|
+
case fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL:
|
|
1094
|
+
case fittingTypes.LEGACY_BG_NORMAL:
|
|
1095
|
+
const maxBGSiteLegacyWidth = _isMobile ? MOBILE_MAX_BG_SITE_LEGACY_WIDTH : DSKTP_MAX_BG_SITE_LEGACY_WIDTH;
|
|
1096
|
+
const maxBGSiteLegacyHeight = _isMobile ? MOBILE_MAX_BG_SITE_LEGACY_HEIGHT : DSKTP_MAX_BG_SITE_LEGACY_HEIGHT;
|
|
1097
|
+
targetObj.width = Math.min(maxBGSiteLegacyWidth, src.width);
|
|
1098
|
+
targetObj.height = Math.min(maxBGSiteLegacyHeight, Math.round(targetObj.width / (src.width / src.height)));
|
|
1099
|
+
targetObj.pixelAspectRatio = 1;
|
|
1100
|
+
}
|
|
1101
|
+
return targetObj;
|
|
1102
|
+
}
|
|
1103
|
+
const fitTemplate = template`fit/w_${"width"},h_${"height"}`;
|
|
1104
|
+
const fillTemplate = template`fill/w_${"width"},h_${"height"},al_${"alignment"}`;
|
|
1105
|
+
const fillFocalTemplate = template`fill/w_${"width"},h_${"height"},fp_${"focalPointX"}_${"focalPointY"}`;
|
|
1106
|
+
const cropTemplate = template`crop/x_${"x"},y_${"y"},w_${"width"},h_${"height"}`;
|
|
1107
|
+
const legacyCropTemplate = template`crop/w_${"width"},h_${"height"},al_${"alignment"}`;
|
|
1108
|
+
const legacyFillTemplate = template`fill/w_${"width"},h_${"height"},al_${"alignment"}`;
|
|
1109
|
+
const upscaleTemplate = template`,lg_${"upscaleMethodValue"}`;
|
|
1110
|
+
const qualityTemplate = template`,q_${"quality"}`;
|
|
1111
|
+
const qualityAutoTemplate = template`,quality_auto`;
|
|
1112
|
+
const unSharpMaskTemplate = template`,usm_${"radius"}_${"amount"}_${"threshold"}`;
|
|
1113
|
+
const nonProgressiveTemplate = template`,bl`;
|
|
1114
|
+
const watermarkTemplate = template`,wm_${"watermark"}`;
|
|
1115
|
+
const filterTemplatesMap = {
|
|
1116
|
+
[imageFilters.CONTRAST]: template`,con_${"contrast"}`,
|
|
1117
|
+
[imageFilters.BRIGHTNESS]: template`,br_${"brightness"}`,
|
|
1118
|
+
[imageFilters.SATURATION]: template`,sat_${"saturation"}`,
|
|
1119
|
+
[imageFilters.HUE]: template`,hue_${"hue"}`,
|
|
1120
|
+
[imageFilters.BLUR]: template`,blur_${"blur"}`
|
|
1121
|
+
};
|
|
1122
|
+
const autoEncodeTemplate = template`,enc_auto`;
|
|
1123
|
+
const AVIFEncodeTemplate = template`,enc_avif`;
|
|
1124
|
+
const pAVIFEncodeTemplate = template`,enc_pavif`;
|
|
1125
|
+
const animatedTransformTemplate = template`,pstr`;
|
|
1126
|
+
const animatedGIFTransformTemplate = template`,anm_all`;
|
|
1127
|
+
function getImageURI(transformsObj) {
|
|
1128
|
+
var _a;
|
|
1129
|
+
const transformsObjStrArr = [];
|
|
1130
|
+
transformsObj.parts.forEach((transformPart) => {
|
|
1131
|
+
switch (transformPart.transformType) {
|
|
1132
|
+
case transformTypes.CROP:
|
|
1133
|
+
transformsObjStrArr.push(cropTemplate(transformPart));
|
|
1134
|
+
break;
|
|
1135
|
+
case transformTypes.LEGACY_CROP:
|
|
1136
|
+
transformsObjStrArr.push(legacyCropTemplate(transformPart));
|
|
1137
|
+
break;
|
|
1138
|
+
case transformTypes.LEGACY_FILL:
|
|
1139
|
+
let legacyFillStr = legacyFillTemplate(transformPart);
|
|
1140
|
+
if (transformPart.upscale) {
|
|
1141
|
+
legacyFillStr += upscaleTemplate(transformPart);
|
|
2204
1142
|
}
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
if (attributeValue === "") {
|
|
2212
|
-
props[propName] = true;
|
|
2213
|
-
}
|
|
2214
|
-
break;
|
|
1143
|
+
transformsObjStrArr.push(legacyFillStr);
|
|
1144
|
+
break;
|
|
1145
|
+
case transformTypes.FIT:
|
|
1146
|
+
let fitStr = fitTemplate(transformPart);
|
|
1147
|
+
if (transformPart.upscale) {
|
|
1148
|
+
fitStr += upscaleTemplate(transformPart);
|
|
2215
1149
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
1150
|
+
transformsObjStrArr.push(fitStr);
|
|
1151
|
+
break;
|
|
1152
|
+
case transformTypes.FILL:
|
|
1153
|
+
let fillStr = fillTemplate(transformPart);
|
|
1154
|
+
if (transformPart.upscale) {
|
|
1155
|
+
fillStr += upscaleTemplate(transformPart);
|
|
1156
|
+
}
|
|
1157
|
+
transformsObjStrArr.push(fillStr);
|
|
1158
|
+
break;
|
|
1159
|
+
case transformTypes.FILL_FOCAL:
|
|
1160
|
+
let fillFocalStr = fillFocalTemplate(transformPart);
|
|
1161
|
+
if (transformPart.upscale) {
|
|
1162
|
+
fillFocalStr += upscaleTemplate(transformPart);
|
|
1163
|
+
}
|
|
1164
|
+
transformsObjStrArr.push(fillFocalStr);
|
|
1165
|
+
break;
|
|
2221
1166
|
}
|
|
2222
|
-
|
|
2223
|
-
|
|
1167
|
+
});
|
|
1168
|
+
let transformsStr = transformsObjStrArr.join("/");
|
|
1169
|
+
if (transformsObj.quality) {
|
|
1170
|
+
transformsStr += qualityTemplate(transformsObj);
|
|
2224
1171
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
1172
|
+
if (transformsObj.unsharpMask) {
|
|
1173
|
+
transformsStr += unSharpMaskTemplate(transformsObj.unsharpMask);
|
|
2227
1174
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
isValidElement: react_1.isValidElement
|
|
2247
|
-
};
|
|
2248
|
-
function domToReact$1(nodes, options) {
|
|
2249
|
-
if (options === void 0) {
|
|
2250
|
-
options = {};
|
|
1175
|
+
if (!transformsObj.progressive) {
|
|
1176
|
+
transformsStr += nonProgressiveTemplate(transformsObj);
|
|
1177
|
+
}
|
|
1178
|
+
if (transformsObj.watermark) {
|
|
1179
|
+
transformsStr += watermarkTemplate(transformsObj);
|
|
1180
|
+
}
|
|
1181
|
+
if (transformsObj.filters) {
|
|
1182
|
+
transformsStr += Object.keys(transformsObj.filters).map((filterName) => filterTemplatesMap[filterName](transformsObj.filters)).join("");
|
|
1183
|
+
}
|
|
1184
|
+
if (transformsObj.fileType !== fileType.GIF) {
|
|
1185
|
+
if (transformsObj.encoding === encodingTypes.AVIF) {
|
|
1186
|
+
transformsStr += AVIFEncodeTemplate(transformsObj);
|
|
1187
|
+
transformsStr += qualityAutoTemplate(transformsObj);
|
|
1188
|
+
} else if (transformsObj.encoding === encodingTypes.PAVIF) {
|
|
1189
|
+
transformsStr += pAVIFEncodeTemplate(transformsObj);
|
|
1190
|
+
transformsStr += qualityAutoTemplate(transformsObj);
|
|
1191
|
+
} else if (transformsObj.autoEncode) {
|
|
1192
|
+
transformsStr += autoEncodeTemplate(transformsObj);
|
|
2251
1193
|
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
if (isValidElement(replaceElement)) {
|
|
2262
|
-
if (nodesLength > 1) {
|
|
2263
|
-
replaceElement = cloneElement(replaceElement, {
|
|
2264
|
-
key: replaceElement.key || index
|
|
2265
|
-
});
|
|
2266
|
-
}
|
|
2267
|
-
reactElements.push(transform(replaceElement, node2, index));
|
|
2268
|
-
continue;
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
if (node2.type === "text") {
|
|
2272
|
-
var isWhitespace = !node2.data.trim().length;
|
|
2273
|
-
if (isWhitespace && node2.parent && !(0, utilities_1.canTextBeChildOfNode)(node2.parent)) {
|
|
2274
|
-
continue;
|
|
2275
|
-
}
|
|
2276
|
-
if (options.trim && isWhitespace) {
|
|
2277
|
-
continue;
|
|
2278
|
-
}
|
|
2279
|
-
reactElements.push(transform(node2.data, node2, index));
|
|
2280
|
-
continue;
|
|
2281
|
-
}
|
|
2282
|
-
var element = node2;
|
|
2283
|
-
var props = {};
|
|
2284
|
-
if (skipAttributesToProps(element)) {
|
|
2285
|
-
(0, utilities_1.setStyleProp)(element.attribs.style, element.attribs);
|
|
2286
|
-
props = element.attribs;
|
|
2287
|
-
} else if (element.attribs) {
|
|
2288
|
-
props = (0, attributes_to_props_1.default)(element.attribs, element.name);
|
|
2289
|
-
}
|
|
2290
|
-
var children = void 0;
|
|
2291
|
-
switch (node2.type) {
|
|
2292
|
-
case "script":
|
|
2293
|
-
case "style":
|
|
2294
|
-
if (node2.children[0]) {
|
|
2295
|
-
props.dangerouslySetInnerHTML = {
|
|
2296
|
-
__html: node2.children[0].data
|
|
2297
|
-
};
|
|
2298
|
-
}
|
|
2299
|
-
break;
|
|
2300
|
-
case "tag":
|
|
2301
|
-
if (node2.name === "textarea" && node2.children[0]) {
|
|
2302
|
-
props.defaultValue = node2.children[0].data;
|
|
2303
|
-
} else if (node2.children && node2.children.length) {
|
|
2304
|
-
children = domToReact$1(node2.children, options);
|
|
2305
|
-
}
|
|
2306
|
-
break;
|
|
2307
|
-
// skip all other cases (e.g., comment)
|
|
2308
|
-
default:
|
|
2309
|
-
continue;
|
|
2310
|
-
}
|
|
2311
|
-
if (nodesLength > 1) {
|
|
2312
|
-
props.key = index;
|
|
2313
|
-
}
|
|
2314
|
-
reactElements.push(transform(createElement(node2.name, props, children), node2, index));
|
|
1194
|
+
}
|
|
1195
|
+
if (((_a = transformsObj.src) == null ? void 0 : _a.isAnimated) && transformsObj.transformed) {
|
|
1196
|
+
const isGif = isGIF(transformsObj.src.id);
|
|
1197
|
+
const isPlaceholderFlow = transformsObj.isPlaceholderFlow === true;
|
|
1198
|
+
const allowFullGIFTransformation = transformsObj.allowFullGIFTransformation === true;
|
|
1199
|
+
if (isPlaceholderFlow) {
|
|
1200
|
+
transformsStr += animatedTransformTemplate(transformsObj);
|
|
1201
|
+
} else if (isGif && allowFullGIFTransformation) {
|
|
1202
|
+
transformsStr += animatedGIFTransformTemplate(transformsObj);
|
|
2315
1203
|
}
|
|
2316
|
-
return reactElements.length === 1 ? reactElements[0] : reactElements;
|
|
2317
1204
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
1205
|
+
return `${transformsObj.src.id}/${API_VERSION}/${transformsStr}/${transformsObj.fileName}.${transformsObj.preferredExtension}`;
|
|
1206
|
+
}
|
|
1207
|
+
function getURI(fittingType, src, target, options = {}, transformObj) {
|
|
1208
|
+
if (isImageTransformApplicable(src.id, options == null ? void 0 : options.hasAnimation, options == null ? void 0 : options.allowAnimatedTransform, options == null ? void 0 : options.allowFullGIFTransformation)) {
|
|
1209
|
+
if ((isWEBP(src.id) || isAVIF(src.id)) && !options.allowWebpAvifTransforms) {
|
|
1210
|
+
const { alignment, ...transformTarget } = target;
|
|
1211
|
+
src.focalPoint = { x: void 0, y: void 0 };
|
|
1212
|
+
src == null ? true : delete src.crop;
|
|
1213
|
+
transformObj = getTransform(fittingType, src, transformTarget, options);
|
|
1214
|
+
} else {
|
|
1215
|
+
transformObj = transformObj || getTransform(fittingType, src, target, options);
|
|
1216
|
+
}
|
|
1217
|
+
return getImageURI(transformObj);
|
|
1218
|
+
}
|
|
1219
|
+
return src.id;
|
|
1220
|
+
}
|
|
1221
|
+
function getSrcset(fittingType, src, target, options, data) {
|
|
1222
|
+
const dpr = target.pixelAspectRatio || 1;
|
|
1223
|
+
return {
|
|
1224
|
+
dpr: [
|
|
1225
|
+
`${dpr === 1 ? data.uri : getURI(fittingType, src, {
|
|
1226
|
+
...target,
|
|
1227
|
+
pixelAspectRatio: 1
|
|
1228
|
+
}, options)} 1x`,
|
|
1229
|
+
`${dpr === 2 ? data.uri : getURI(fittingType, src, {
|
|
1230
|
+
...target,
|
|
1231
|
+
pixelAspectRatio: 2
|
|
1232
|
+
}, options)} 2x`
|
|
1233
|
+
]
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
const ALIGN_TYPE_TO_POSITION = {
|
|
1237
|
+
[alignTypes.CENTER]: "50% 50%",
|
|
1238
|
+
[alignTypes.TOP_LEFT]: "0% 0%",
|
|
1239
|
+
[alignTypes.TOP_RIGHT]: "100% 0%",
|
|
1240
|
+
[alignTypes.TOP]: "50% 0%",
|
|
1241
|
+
[alignTypes.BOTTOM_LEFT]: "0% 100%",
|
|
1242
|
+
[alignTypes.BOTTOM_RIGHT]: "100% 100%",
|
|
1243
|
+
[alignTypes.BOTTOM]: "50% 100%",
|
|
1244
|
+
[alignTypes.RIGHT]: "100% 50%",
|
|
1245
|
+
[alignTypes.LEFT]: "0% 50%"
|
|
1246
|
+
};
|
|
1247
|
+
const POSITION_TO_ALIGN_TYPE = Object.entries(ALIGN_TYPE_TO_POSITION).reduce((acc, [align, position]) => {
|
|
1248
|
+
acc[position] = align;
|
|
1249
|
+
return acc;
|
|
1250
|
+
}, {});
|
|
1251
|
+
const TILE_FITTING_TYPES = [
|
|
1252
|
+
fittingTypes.TILE,
|
|
1253
|
+
fittingTypes.TILE_HORIZONTAL,
|
|
1254
|
+
fittingTypes.TILE_VERTICAL,
|
|
1255
|
+
fittingTypes.LEGACY_BG_FIT_AND_TILE,
|
|
1256
|
+
fittingTypes.LEGACY_BG_FIT_AND_TILE_HORIZONTAL,
|
|
1257
|
+
fittingTypes.LEGACY_BG_FIT_AND_TILE_VERTICAL
|
|
1258
|
+
];
|
|
1259
|
+
const NON_SCALING_FITTING_TYPES = [
|
|
1260
|
+
fittingTypes.LEGACY_ORIGINAL_SIZE,
|
|
1261
|
+
fittingTypes.ORIGINAL_SIZE,
|
|
1262
|
+
fittingTypes.LEGACY_BG_NORMAL
|
|
1263
|
+
];
|
|
1264
|
+
function getIsFakeTile(fittingType, src, { width: targetWidth, height: targetHeight }) {
|
|
1265
|
+
return fittingType === fittingTypes.TILE && src.width > targetWidth && src.height > targetHeight;
|
|
1266
|
+
}
|
|
1267
|
+
function getScaledDimensions(fittingType, src, { width, height }, isSEOBot2 = false) {
|
|
1268
|
+
if (isSEOBot2) {
|
|
1269
|
+
return { width, height };
|
|
1270
|
+
}
|
|
1271
|
+
const isScalable = !NON_SCALING_FITTING_TYPES.includes(fittingType);
|
|
1272
|
+
const isFakeTile = getIsFakeTile(fittingType, src, { width, height });
|
|
1273
|
+
const isTile = !isFakeTile && TILE_FITTING_TYPES.includes(fittingType);
|
|
1274
|
+
const _width = isTile ? src.width : width;
|
|
1275
|
+
const _height = isTile ? src.height : height;
|
|
1276
|
+
const scaleFactor = isScalable ? getScaleFactorByWidth(_width, isPNG(src.id)) : 1;
|
|
1277
|
+
return {
|
|
1278
|
+
width: isFakeTile ? 1920 : _width * scaleFactor,
|
|
1279
|
+
height: _height * scaleFactor
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
function getConvertedFitting(fittingType, isFakeTile) {
|
|
1283
|
+
const isTile = TILE_FITTING_TYPES.includes(fittingType) && !isFakeTile;
|
|
1284
|
+
const isFill = fittingType === fittingTypes.SCALE_TO_FILL;
|
|
1285
|
+
return isFill || isTile ? fittingTypes.SCALE_TO_FIT : fittingType;
|
|
1286
|
+
}
|
|
1287
|
+
function validateTargetDimensions(src, { width, height }) {
|
|
1288
|
+
if (!width || !height) {
|
|
1289
|
+
const _width = width || Math.min(980, src.width);
|
|
1290
|
+
const heightRatio = _width / src.width;
|
|
1291
|
+
return {
|
|
1292
|
+
width: _width,
|
|
1293
|
+
height: height || src.height * heightRatio
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
return { width, height };
|
|
1297
|
+
}
|
|
1298
|
+
function getScaleFactorByWidth(width, isHighQuality) {
|
|
1299
|
+
if (width > 900) {
|
|
1300
|
+
return isHighQuality ? 0.05 : 0.15;
|
|
1301
|
+
} else if (width > 500) {
|
|
1302
|
+
return isHighQuality ? 0.1 : 0.18;
|
|
1303
|
+
} else if (width > 200) {
|
|
1304
|
+
return 0.25;
|
|
1305
|
+
}
|
|
1306
|
+
return 1;
|
|
1307
|
+
}
|
|
1308
|
+
function getBlurValue(width, fittingType, isSEOBot2) {
|
|
1309
|
+
if (isSEOBot2) {
|
|
1310
|
+
return 0;
|
|
1311
|
+
}
|
|
1312
|
+
if (TILE_FITTING_TYPES.includes(fittingType)) {
|
|
1313
|
+
return 1;
|
|
2320
1314
|
}
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
1315
|
+
if (width > 200) {
|
|
1316
|
+
return 2;
|
|
1317
|
+
}
|
|
1318
|
+
return 3;
|
|
1319
|
+
}
|
|
1320
|
+
function getCSSOverrides(fittingType, src, target, alignment = "center") {
|
|
1321
|
+
const returnValue = {
|
|
1322
|
+
img: {},
|
|
1323
|
+
container: {}
|
|
1324
|
+
};
|
|
1325
|
+
if (fittingType === fittingTypes.SCALE_TO_FILL) {
|
|
1326
|
+
const alignTypeFromFocalPoint = src.focalPoint && convertFocalPointToAlignType(src.focalPoint);
|
|
1327
|
+
const alignType = alignTypeFromFocalPoint || alignment;
|
|
1328
|
+
if (src.focalPoint && !alignTypeFromFocalPoint) {
|
|
1329
|
+
returnValue.img = {
|
|
1330
|
+
objectPosition: convertFillFocalToPosition(src, target, src.focalPoint)
|
|
1331
|
+
};
|
|
1332
|
+
} else {
|
|
1333
|
+
returnValue.img = {
|
|
1334
|
+
objectPosition: ALIGN_TYPE_TO_POSITION[alignType]
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
} else if ([fittingTypes.LEGACY_ORIGINAL_SIZE, fittingTypes.ORIGINAL_SIZE].includes(fittingType)) {
|
|
1338
|
+
returnValue.img = {
|
|
1339
|
+
objectFit: "none",
|
|
1340
|
+
top: "auto",
|
|
1341
|
+
left: "auto",
|
|
1342
|
+
right: "auto",
|
|
1343
|
+
bottom: "auto"
|
|
2330
1344
|
};
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
1345
|
+
} else if (TILE_FITTING_TYPES.includes(fittingType)) {
|
|
1346
|
+
returnValue.container = {
|
|
1347
|
+
backgroundSize: `${src.width}px ${src.height}px`
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
return returnValue;
|
|
1351
|
+
}
|
|
1352
|
+
function convertFocalPointToAlignType(focalPoint) {
|
|
1353
|
+
const position = `${focalPoint.x}% ${focalPoint.y}%`;
|
|
1354
|
+
return POSITION_TO_ALIGN_TYPE[position] || "";
|
|
1355
|
+
}
|
|
1356
|
+
function convertFillFocalToPosition(src, target, focalPoint) {
|
|
1357
|
+
const { width: sW, height: sH } = src;
|
|
1358
|
+
const { width: tW, height: tH } = target;
|
|
1359
|
+
const { x: fpX, y: fpY } = focalPoint;
|
|
1360
|
+
if (!tW || !tH) {
|
|
1361
|
+
return `${fpX}% ${fpY}%`;
|
|
1362
|
+
}
|
|
1363
|
+
const fillScaleFactor = Math.max(tW / sW, tH / sH);
|
|
1364
|
+
const imgScaledW = sW * fillScaleFactor;
|
|
1365
|
+
const imgScaledH = sH * fillScaleFactor;
|
|
1366
|
+
const x = Math.max(0, Math.min(imgScaledW - tW, imgScaledW * (fpX / 100) - tW / 2));
|
|
1367
|
+
const y = Math.max(0, Math.min(imgScaledH - tH, imgScaledH * (fpY / 100) - tH / 2));
|
|
1368
|
+
const posX = x && Math.floor(x / (imgScaledW - tW) * 100);
|
|
1369
|
+
const posY = y && Math.floor(y / (imgScaledH - tH) * 100);
|
|
1370
|
+
return `${posX}% ${posY}%`;
|
|
1371
|
+
}
|
|
1372
|
+
const PLACEHOLDER_IMG_CSS_OVERRIDES = { width: "100%", height: "100%" };
|
|
1373
|
+
function getPlaceholder(fittingType, src, target, options = {}) {
|
|
1374
|
+
const { autoEncode = true, isSEOBot: isSEOBot2, shouldLoadHQImage, hasAnimation, allowAnimatedTransform, encoding } = options;
|
|
1375
|
+
if (!isValidRequest(fittingType, src, target)) {
|
|
1376
|
+
return emptyData;
|
|
1377
|
+
}
|
|
1378
|
+
const IS_IN_PLACEHOLDER_FLOW = true;
|
|
1379
|
+
const shouldAllowAnimatedTransformInPlaceholder = allowAnimatedTransform ?? IS_IN_PLACEHOLDER_FLOW;
|
|
1380
|
+
const canTransformImage = isImageTransformApplicable(src.id, hasAnimation, shouldAllowAnimatedTransformInPlaceholder);
|
|
1381
|
+
if (!canTransformImage || shouldLoadHQImage) {
|
|
1382
|
+
return getData(fittingType, src, target, {
|
|
1383
|
+
...options,
|
|
1384
|
+
autoEncode,
|
|
1385
|
+
useSrcset: canTransformImage
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
const newTarget = {
|
|
1389
|
+
...target,
|
|
1390
|
+
...validateTargetDimensions(src, target)
|
|
1391
|
+
};
|
|
1392
|
+
const { alignment, htmlTag: htmlTag2 } = newTarget;
|
|
1393
|
+
const isFakeTile = getIsFakeTile(fittingType, src, newTarget);
|
|
1394
|
+
const scaledDimensions = getScaledDimensions(fittingType, src, newTarget, isSEOBot2);
|
|
1395
|
+
const blur = getBlurValue(newTarget.width, fittingType, isSEOBot2);
|
|
1396
|
+
const convertedFittingType = getConvertedFitting(fittingType, isFakeTile);
|
|
1397
|
+
const overrideCSS = getCSSOverrides(fittingType, src, target, alignment);
|
|
1398
|
+
const { uri } = getData(convertedFittingType, src, {
|
|
1399
|
+
...scaledDimensions,
|
|
1400
|
+
alignment,
|
|
1401
|
+
htmlTag: htmlTag2
|
|
1402
|
+
}, {
|
|
1403
|
+
autoEncode,
|
|
1404
|
+
filters: blur ? { blur } : {},
|
|
1405
|
+
hasAnimation,
|
|
1406
|
+
allowAnimatedTransform: shouldAllowAnimatedTransformInPlaceholder,
|
|
1407
|
+
encoding,
|
|
1408
|
+
isPlaceholderFlow: IS_IN_PLACEHOLDER_FLOW
|
|
1409
|
+
});
|
|
1410
|
+
const { attr = {}, css } = getData(fittingType, src, {
|
|
1411
|
+
...newTarget,
|
|
1412
|
+
alignment,
|
|
1413
|
+
htmlTag: htmlTag2
|
|
1414
|
+
}, {});
|
|
1415
|
+
css.img = css.img || {};
|
|
1416
|
+
css.container = css.container || {};
|
|
1417
|
+
Object.assign(css.img, overrideCSS.img, PLACEHOLDER_IMG_CSS_OVERRIDES);
|
|
1418
|
+
Object.assign(css.container, overrideCSS.container);
|
|
1419
|
+
return { uri, css, attr, transformed: true };
|
|
1420
|
+
}
|
|
1421
|
+
function getData(fittingType, src, target, options) {
|
|
1422
|
+
let data = {};
|
|
1423
|
+
if (isValidRequest(fittingType, src, target)) {
|
|
1424
|
+
const targetObj = getTarget(fittingType, src, target);
|
|
1425
|
+
const transformObj = getTransform(fittingType, src, targetObj, options);
|
|
1426
|
+
data.uri = getURI(fittingType, src, targetObj, options, transformObj);
|
|
1427
|
+
if (options == null ? void 0 : options.useSrcset) {
|
|
1428
|
+
data.srcset = getSrcset(fittingType, src, targetObj, options, data);
|
|
2362
1429
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
1430
|
+
Object.assign(data, getAttributes(transformObj, targetObj), {
|
|
1431
|
+
transformed: transformObj.transformed
|
|
1432
|
+
});
|
|
1433
|
+
} else {
|
|
1434
|
+
data = emptyData;
|
|
1435
|
+
}
|
|
1436
|
+
return data;
|
|
2365
1437
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
1438
|
+
const wixStaticWithMedia = "https://static.wixstatic.com/media/";
|
|
1439
|
+
populateGlobalFeatureSupport();
|
|
1440
|
+
populateGlobalFeatureSupport();
|
|
1441
|
+
const STATIC_MEDIA_URL = wixStaticWithMedia;
|
|
1442
|
+
const imageKit = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1443
|
+
__proto__: null,
|
|
1444
|
+
STATIC_MEDIA_URL,
|
|
1445
|
+
alignTypes,
|
|
1446
|
+
fileType,
|
|
1447
|
+
fittingTypes,
|
|
1448
|
+
getData,
|
|
1449
|
+
getFileExtension,
|
|
1450
|
+
getPlaceholder,
|
|
1451
|
+
htmlTag,
|
|
1452
|
+
isWEBP,
|
|
1453
|
+
populateGlobalFeatureSupport,
|
|
1454
|
+
upscaleMethods
|
|
1455
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2369
1456
|
export {
|
|
2370
|
-
|
|
2371
|
-
|
|
1457
|
+
STATIC_MEDIA_URL as S,
|
|
1458
|
+
getData as a,
|
|
1459
|
+
getFileExtension as b,
|
|
1460
|
+
alignTypes as c,
|
|
1461
|
+
fittingTypes as d,
|
|
1462
|
+
fileType as f,
|
|
1463
|
+
getPlaceholder as g,
|
|
1464
|
+
imageKit as i
|
|
2372
1465
|
};
|