| 1 |
(function() { |
| 2 |
|
| 3 |
//#region \0rolldown/runtime.js |
| 4 |
var __create = Object.create; |
| 5 |
var __defProp = Object.defineProperty; |
| 6 |
var __name = (target, value) => __defProp(target, "name", { |
| 7 |
value, |
| 8 |
configurable: true |
| 9 |
}); |
| 10 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 11 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 12 |
var __getProtoOf = Object.getPrototypeOf; |
| 13 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 14 |
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports); |
| 15 |
var __copyProps = (to, from, except, desc) => { |
| 16 |
if (from && typeof from === "object" || typeof from === "function") { |
| 17 |
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { |
| 18 |
key = keys[i]; |
| 19 |
if (!__hasOwnProp.call(to, key) && key !== except) { |
| 20 |
__defProp(to, key, { |
| 21 |
get: ((k) => from[k]).bind(null, key), |
| 22 |
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable |
| 23 |
}); |
| 24 |
} |
| 25 |
} |
| 26 |
} |
| 27 |
return to; |
| 28 |
}; |
| 29 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { |
| 30 |
value: mod, |
| 31 |
enumerable: true |
| 32 |
}) : target, mod)); |
| 33 |
|
| 34 |
//#endregion |
| 35 |
|
| 36 |
//#region node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js |
| 37 |
function asyncGeneratorStep$1(n, t, e, r, o, a, c) { |
| 38 |
try { |
| 39 |
var i = n[a](c); |
| 40 |
var u = i.value; |
| 41 |
} catch (n) { |
| 42 |
e(n); |
| 43 |
return; |
| 44 |
} |
| 45 |
i.done ? t(u) : Promise.resolve(u).then(r, o); |
| 46 |
} |
| 47 |
__name(asyncGeneratorStep$1, "asyncGeneratorStep"); |
| 48 |
function _asyncToGenerator$1(n) { |
| 49 |
return function() { |
| 50 |
var t = this; |
| 51 |
var e = arguments; |
| 52 |
return new Promise(function(r, o) { |
| 53 |
var a = n.apply(t, e); |
| 54 |
function _next(n) { |
| 55 |
asyncGeneratorStep$1(a, r, o, _next, _throw, "next", n); |
| 56 |
} |
| 57 |
function _throw(n) { |
| 58 |
asyncGeneratorStep$1(a, r, o, _next, _throw, "throw", n); |
| 59 |
} |
| 60 |
_next(void 0); |
| 61 |
}); |
| 62 |
}; |
| 63 |
} |
| 64 |
__name(_asyncToGenerator$1, "_asyncToGenerator"); |
| 65 |
|
| 66 |
//#endregion |
| 67 |
//#region node_modules/@babel/runtime/helpers/esm/typeof.js |
| 68 |
function _typeof(o) { |
| 69 |
"@babel/helpers - typeof"; |
| 70 |
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 71 |
return typeof o; |
| 72 |
} : function(o) { |
| 73 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 74 |
}, _typeof(o); |
| 75 |
} |
| 76 |
|
| 77 |
//#endregion |
| 78 |
//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js |
| 79 |
function toPrimitive(t, r) { |
| 80 |
if ("object" != _typeof(t) || !t) return t; |
| 81 |
var e = t[Symbol.toPrimitive]; |
| 82 |
if (void 0 !== e) { |
| 83 |
var i = e.call(t, r || "default"); |
| 84 |
if ("object" != _typeof(i)) return i; |
| 85 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 86 |
} |
| 87 |
return ("string" === r ? String : Number)(t); |
| 88 |
} |
| 89 |
|
| 90 |
//#endregion |
| 91 |
//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js |
| 92 |
function toPropertyKey(t) { |
| 93 |
var i = toPrimitive(t, "string"); |
| 94 |
return "symbol" == _typeof(i) ? i : i + ""; |
| 95 |
} |
| 96 |
|
| 97 |
//#endregion |
| 98 |
//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js |
| 99 |
function _defineProperty(e, r, t) { |
| 100 |
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { |
| 101 |
value: t, |
| 102 |
enumerable: !0, |
| 103 |
configurable: !0, |
| 104 |
writable: !0 |
| 105 |
}) : e[r] = t, e; |
| 106 |
} |
| 107 |
|
| 108 |
//#endregion |
| 109 |
//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
| 110 |
function _classCallCheck(a, n) { |
| 111 |
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); |
| 112 |
} |
| 113 |
|
| 114 |
//#endregion |
| 115 |
//#region node_modules/@babel/runtime/helpers/esm/createClass.js |
| 116 |
function _defineProperties(e, r) { |
| 117 |
for (var t = 0; t < r.length; t++) { |
| 118 |
var o = r[t]; |
| 119 |
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); |
| 120 |
} |
| 121 |
} |
| 122 |
function _createClass(e, r, t) { |
| 123 |
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; |
| 124 |
} |
| 125 |
|
| 126 |
//#endregion |
| 127 |
//#region node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
| 128 |
function _assertThisInitialized(e) { |
| 129 |
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
| 130 |
return e; |
| 131 |
} |
| 132 |
|
| 133 |
//#endregion |
| 134 |
//#region node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
| 135 |
function _possibleConstructorReturn(t, e) { |
| 136 |
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; |
| 137 |
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); |
| 138 |
return _assertThisInitialized(t); |
| 139 |
} |
| 140 |
|
| 141 |
//#endregion |
| 142 |
//#region node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
| 143 |
function _getPrototypeOf(t) { |
| 144 |
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) { |
| 145 |
return t.__proto__ || Object.getPrototypeOf(t); |
| 146 |
}, _getPrototypeOf(t); |
| 147 |
} |
| 148 |
|
| 149 |
//#endregion |
| 150 |
//#region node_modules/@babel/runtime/helpers/esm/superPropBase.js |
| 151 |
function _superPropBase(t, o) { |
| 152 |
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); |
| 153 |
return t; |
| 154 |
} |
| 155 |
|
| 156 |
//#endregion |
| 157 |
//#region node_modules/@babel/runtime/helpers/esm/get.js |
| 158 |
function _get() { |
| 159 |
return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, r) { |
| 160 |
var p = _superPropBase(e, t); |
| 161 |
if (p) { |
| 162 |
var n = Object.getOwnPropertyDescriptor(p, t); |
| 163 |
return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; |
| 164 |
} |
| 165 |
}, _get.apply(null, arguments); |
| 166 |
} |
| 167 |
|
| 168 |
//#endregion |
| 169 |
//#region node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
| 170 |
function _setPrototypeOf(t, e) { |
| 171 |
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { |
| 172 |
return t.__proto__ = e, t; |
| 173 |
}, _setPrototypeOf(t, e); |
| 174 |
} |
| 175 |
|
| 176 |
//#endregion |
| 177 |
//#region node_modules/@babel/runtime/helpers/esm/inherits.js |
| 178 |
function _inherits(t, e) { |
| 179 |
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); |
| 180 |
t.prototype = Object.create(e && e.prototype, { constructor: { |
| 181 |
value: t, |
| 182 |
writable: !0, |
| 183 |
configurable: !0 |
| 184 |
} }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); |
| 185 |
} |
| 186 |
|
| 187 |
//#endregion |
| 188 |
//#region node_modules/@babel/runtime/helpers/OverloadYield.js |
| 189 |
var require_OverloadYield = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 190 |
function _OverloadYield(e, d) { |
| 191 |
this.v = e, this.k = d; |
| 192 |
} |
| 193 |
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 194 |
})); |
| 195 |
|
| 196 |
//#endregion |
| 197 |
//#region node_modules/@babel/runtime/helpers/regeneratorDefine.js |
| 198 |
var require_regeneratorDefine = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 199 |
function _regeneratorDefine(e, r, n, t) { |
| 200 |
var i = Object.defineProperty; |
| 201 |
try { |
| 202 |
i({}, "", {}); |
| 203 |
} catch (e) { |
| 204 |
i = 0; |
| 205 |
} |
| 206 |
module.exports = _regeneratorDefine = function regeneratorDefine(e, r, n, t) { |
| 207 |
function o(r, n) { |
| 208 |
_regeneratorDefine(e, r, function(e) { |
| 209 |
return this._invoke(r, n, e); |
| 210 |
}); |
| 211 |
} |
| 212 |
r ? i ? i(e, r, { |
| 213 |
value: n, |
| 214 |
enumerable: !t, |
| 215 |
configurable: !t, |
| 216 |
writable: !t |
| 217 |
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); |
| 218 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _regeneratorDefine(e, r, n, t); |
| 219 |
} |
| 220 |
module.exports = _regeneratorDefine, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 221 |
})); |
| 222 |
|
| 223 |
//#endregion |
| 224 |
//#region node_modules/@babel/runtime/helpers/regenerator.js |
| 225 |
var require_regenerator$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 226 |
var regeneratorDefine = require_regeneratorDefine(); |
| 227 |
function _regenerator() { |
| 228 |
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ |
| 229 |
var e; |
| 230 |
var t; |
| 231 |
var r = "function" == typeof Symbol ? Symbol : {}; |
| 232 |
var n = r.iterator || "@@iterator"; |
| 233 |
var o = r.toStringTag || "@@toStringTag"; |
| 234 |
function i(r, n, o, i) { |
| 235 |
var c = n && n.prototype instanceof Generator ? n : Generator; |
| 236 |
var u = Object.create(c.prototype); |
| 237 |
return regeneratorDefine(u, "_invoke", function(r, n, o) { |
| 238 |
var i; |
| 239 |
var c; |
| 240 |
var u; |
| 241 |
var f = 0; |
| 242 |
var p = o || []; |
| 243 |
var y = !1; |
| 244 |
var G = { |
| 245 |
p: 0, |
| 246 |
n: 0, |
| 247 |
v: e, |
| 248 |
a: d, |
| 249 |
f: d.bind(e, 4), |
| 250 |
d: function d(t, r) { |
| 251 |
return i = t, c = 0, u = e, G.n = r, a; |
| 252 |
} |
| 253 |
}; |
| 254 |
function d(r, n) { |
| 255 |
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { |
| 256 |
var o; |
| 257 |
var i = p[t]; |
| 258 |
var d = G.p; |
| 259 |
var l = i[2]; |
| 260 |
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); |
| 261 |
} |
| 262 |
if (o || r > 1) return a; |
| 263 |
throw y = !0, n; |
| 264 |
} |
| 265 |
return function(o, p, l) { |
| 266 |
if (f > 1) throw TypeError("Generator is already running"); |
| 267 |
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { |
| 268 |
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); |
| 269 |
try { |
| 270 |
if (f = 2, i) { |
| 271 |
if (c || (o = "next"), t = i[o]) { |
| 272 |
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); |
| 273 |
if (!t.done) return t; |
| 274 |
u = t.value, c < 2 && (c = 0); |
| 275 |
} else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); |
| 276 |
i = e; |
| 277 |
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; |
| 278 |
} catch (t) { |
| 279 |
i = e, c = 1, u = t; |
| 280 |
} finally { |
| 281 |
f = 1; |
| 282 |
} |
| 283 |
} |
| 284 |
return { |
| 285 |
value: t, |
| 286 |
done: y |
| 287 |
}; |
| 288 |
}; |
| 289 |
}(r, o, i), !0), u; |
| 290 |
} |
| 291 |
var a = {}; |
| 292 |
function Generator() {} |
| 293 |
function GeneratorFunction() {} |
| 294 |
function GeneratorFunctionPrototype() {} |
| 295 |
t = Object.getPrototypeOf; |
| 296 |
var c = [][n] ? t(t([][n]())) : (regeneratorDefine(t = {}, n, function() { |
| 297 |
return this; |
| 298 |
}), t); |
| 299 |
var u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); |
| 300 |
function f(e) { |
| 301 |
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; |
| 302 |
} |
| 303 |
return GeneratorFunction.prototype = GeneratorFunctionPrototype, regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), regeneratorDefine(u), regeneratorDefine(u, o, "Generator"), regeneratorDefine(u, n, function() { |
| 304 |
return this; |
| 305 |
}), regeneratorDefine(u, "toString", function() { |
| 306 |
return "[object Generator]"; |
| 307 |
}), (module.exports = _regenerator = function _regenerator() { |
| 308 |
return { |
| 309 |
w: i, |
| 310 |
m: f |
| 311 |
}; |
| 312 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(); |
| 313 |
} |
| 314 |
module.exports = _regenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 315 |
})); |
| 316 |
|
| 317 |
//#endregion |
| 318 |
//#region node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js |
| 319 |
var require_regeneratorAsyncIterator = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 320 |
var OverloadYield = require_OverloadYield(); |
| 321 |
var regeneratorDefine = require_regeneratorDefine(); |
| 322 |
function AsyncIterator(t, e) { |
| 323 |
function n(r, o, i, f) { |
| 324 |
try { |
| 325 |
var c = t[r](o); |
| 326 |
var u = c.value; |
| 327 |
return u instanceof OverloadYield ? e.resolve(u.v).then(function(t) { |
| 328 |
n("next", t, i, f); |
| 329 |
}, function(t) { |
| 330 |
n("throw", t, i, f); |
| 331 |
}) : e.resolve(u).then(function(t) { |
| 332 |
c.value = t, i(c); |
| 333 |
}, function(t) { |
| 334 |
return n("throw", t, i, f); |
| 335 |
}); |
| 336 |
} catch (t) { |
| 337 |
f(t); |
| 338 |
} |
| 339 |
} |
| 340 |
var r; |
| 341 |
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() { |
| 342 |
return this; |
| 343 |
})), regeneratorDefine(this, "_invoke", function(t, o, i) { |
| 344 |
function f() { |
| 345 |
return new e(function(e, r) { |
| 346 |
n(t, i, e, r); |
| 347 |
}); |
| 348 |
} |
| 349 |
return r = r ? r.then(f, f) : f(); |
| 350 |
}, !0); |
| 351 |
} |
| 352 |
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 353 |
})); |
| 354 |
|
| 355 |
//#endregion |
| 356 |
//#region node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js |
| 357 |
var require_regeneratorAsyncGen = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 358 |
var regenerator = require_regenerator$1(); |
| 359 |
var regeneratorAsyncIterator = require_regeneratorAsyncIterator(); |
| 360 |
function _regeneratorAsyncGen(r, e, t, o, n) { |
| 361 |
return new regeneratorAsyncIterator(regenerator().w(r, e, t, o), n || Promise); |
| 362 |
} |
| 363 |
module.exports = _regeneratorAsyncGen, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 364 |
})); |
| 365 |
|
| 366 |
//#endregion |
| 367 |
//#region node_modules/@babel/runtime/helpers/regeneratorAsync.js |
| 368 |
var require_regeneratorAsync = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 369 |
var regeneratorAsyncGen = require_regeneratorAsyncGen(); |
| 370 |
function _regeneratorAsync(n, e, r, t, o) { |
| 371 |
var a = regeneratorAsyncGen(n, e, r, t, o); |
| 372 |
return a.next().then(function(n) { |
| 373 |
return n.done ? n.value : a.next(); |
| 374 |
}); |
| 375 |
} |
| 376 |
module.exports = _regeneratorAsync, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 377 |
})); |
| 378 |
|
| 379 |
//#endregion |
| 380 |
//#region node_modules/@babel/runtime/helpers/regeneratorKeys.js |
| 381 |
var require_regeneratorKeys = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 382 |
function _regeneratorKeys(e) { |
| 383 |
var n = Object(e); |
| 384 |
var r = []; |
| 385 |
for (var t in n) r.unshift(t); |
| 386 |
return function e() { |
| 387 |
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e; |
| 388 |
return e.done = !0, e; |
| 389 |
}; |
| 390 |
} |
| 391 |
module.exports = _regeneratorKeys, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 392 |
})); |
| 393 |
|
| 394 |
//#endregion |
| 395 |
//#region node_modules/@babel/runtime/helpers/typeof.js |
| 396 |
var require_typeof = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 397 |
function _typeof(o) { |
| 398 |
"@babel/helpers - typeof"; |
| 399 |
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { |
| 400 |
return typeof o; |
| 401 |
} : function(o) { |
| 402 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 403 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); |
| 404 |
} |
| 405 |
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 406 |
})); |
| 407 |
|
| 408 |
//#endregion |
| 409 |
//#region node_modules/@babel/runtime/helpers/regeneratorValues.js |
| 410 |
var require_regeneratorValues = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 411 |
var _typeof = require_typeof()["default"]; |
| 412 |
function _regeneratorValues(e) { |
| 413 |
if (null != e) { |
| 414 |
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"]; |
| 415 |
var r = 0; |
| 416 |
if (t) return t.call(e); |
| 417 |
if ("function" == typeof e.next) return e; |
| 418 |
if (!isNaN(e.length)) return { next: function next() { |
| 419 |
return e && r >= e.length && (e = void 0), { |
| 420 |
value: e && e[r++], |
| 421 |
done: !e |
| 422 |
}; |
| 423 |
} }; |
| 424 |
} |
| 425 |
throw new TypeError(_typeof(e) + " is not iterable"); |
| 426 |
} |
| 427 |
module.exports = _regeneratorValues, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 428 |
})); |
| 429 |
|
| 430 |
//#endregion |
| 431 |
//#region node_modules/@babel/runtime/helpers/regeneratorRuntime.js |
| 432 |
var require_regeneratorRuntime = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 433 |
var OverloadYield = require_OverloadYield(); |
| 434 |
var regenerator = require_regenerator$1(); |
| 435 |
var regeneratorAsync = require_regeneratorAsync(); |
| 436 |
var regeneratorAsyncGen = require_regeneratorAsyncGen(); |
| 437 |
var regeneratorAsyncIterator = require_regeneratorAsyncIterator(); |
| 438 |
var regeneratorKeys = require_regeneratorKeys(); |
| 439 |
var regeneratorValues = require_regeneratorValues(); |
| 440 |
function _regeneratorRuntime() { |
| 441 |
"use strict"; |
| 442 |
var r = regenerator(); |
| 443 |
var e = r.m(_regeneratorRuntime); |
| 444 |
var t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor; |
| 445 |
function n(r) { |
| 446 |
var e = "function" == typeof r && r.constructor; |
| 447 |
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name)); |
| 448 |
} |
| 449 |
var o = { |
| 450 |
"throw": 1, |
| 451 |
"return": 2, |
| 452 |
"break": 3, |
| 453 |
"continue": 3 |
| 454 |
}; |
| 455 |
function a(r) { |
| 456 |
var e; |
| 457 |
var t; |
| 458 |
return function(n) { |
| 459 |
e || (e = { |
| 460 |
stop: function stop() { |
| 461 |
return t(n.a, 2); |
| 462 |
}, |
| 463 |
"catch": function _catch() { |
| 464 |
return n.v; |
| 465 |
}, |
| 466 |
abrupt: function abrupt(r, e) { |
| 467 |
return t(n.a, o[r], e); |
| 468 |
}, |
| 469 |
delegateYield: function delegateYield(r, o, a) { |
| 470 |
return e.resultName = o, t(n.d, regeneratorValues(r), a); |
| 471 |
}, |
| 472 |
finish: function finish(r) { |
| 473 |
return t(n.f, r); |
| 474 |
} |
| 475 |
}, t = function t(r, _t, o) { |
| 476 |
n.p = e.prev, n.n = e.next; |
| 477 |
try { |
| 478 |
return r(_t, o); |
| 479 |
} finally { |
| 480 |
e.next = n.n; |
| 481 |
} |
| 482 |
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; |
| 483 |
try { |
| 484 |
return r.call(this, e); |
| 485 |
} finally { |
| 486 |
n.p = e.prev, n.n = e.next; |
| 487 |
} |
| 488 |
}; |
| 489 |
} |
| 490 |
return (module.exports = _regeneratorRuntime = function _regeneratorRuntime() { |
| 491 |
return { |
| 492 |
wrap: function wrap(e, t, n, o) { |
| 493 |
return r.w(a(e), t, n, o && o.reverse()); |
| 494 |
}, |
| 495 |
isGeneratorFunction: n, |
| 496 |
mark: r.m, |
| 497 |
awrap: function awrap(r, e) { |
| 498 |
return new OverloadYield(r, e); |
| 499 |
}, |
| 500 |
AsyncIterator: regeneratorAsyncIterator, |
| 501 |
async: function async(r, e, t, o, u) { |
| 502 |
return (n(e) ? regeneratorAsyncGen : regeneratorAsync)(a(r), e, t, o, u); |
| 503 |
}, |
| 504 |
keys: regeneratorKeys, |
| 505 |
values: regeneratorValues |
| 506 |
}; |
| 507 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports)(); |
| 508 |
} |
| 509 |
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 510 |
})); |
| 511 |
|
| 512 |
//#endregion |
| 513 |
//#region node_modules/@babel/runtime/regenerator/index.js |
| 514 |
var require_regenerator = /* @__PURE__ */ __commonJSMin(((exports, module) => { |
| 515 |
var runtime = require_regeneratorRuntime()(); |
| 516 |
module.exports = runtime; |
| 517 |
try { |
| 518 |
regeneratorRuntime = runtime; |
| 519 |
} catch (accidentalStrictMode) { |
| 520 |
if (typeof globalThis === "object") globalThis.regeneratorRuntime = runtime; |
| 521 |
else Function("r", "regeneratorRuntime = r")(runtime); |
| 522 |
} |
| 523 |
})); |
| 524 |
|
| 525 |
//#endregion |
| 526 |
//#region \0@[email protected]/helpers/esm/asyncToGenerator.js |
| 527 |
var import_regenerator = /* @__PURE__ */ __toESM(require_regenerator()); |
| 528 |
function asyncGeneratorStep(n, t, e, r, o, a, c) { |
| 529 |
try { |
| 530 |
var i = n[a](c); |
| 531 |
var u = i.value; |
| 532 |
} catch (n) { |
| 533 |
e(n); |
| 534 |
return; |
| 535 |
} |
| 536 |
i.done ? t(u) : Promise.resolve(u).then(r, o); |
| 537 |
} |
| 538 |
function _asyncToGenerator(n) { |
| 539 |
return function() { |
| 540 |
var t = this; |
| 541 |
var e = arguments; |
| 542 |
return new Promise(function(r, o) { |
| 543 |
var a = n.apply(t, e); |
| 544 |
function _next(n) { |
| 545 |
asyncGeneratorStep(a, r, o, _next, _throw, "next", n); |
| 546 |
} |
| 547 |
function _throw(n) { |
| 548 |
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); |
| 549 |
} |
| 550 |
_next(void 0); |
| 551 |
}); |
| 552 |
}; |
| 553 |
} |
| 554 |
|
| 555 |
//#endregion |
| 556 |
//#region node_modules/html-to-image/es/util.js |
| 557 |
function resolveUrl(url, baseUrl) { |
| 558 |
if (url.match(/^[a-z]+:\/\//i)) return url; |
| 559 |
if (url.match(/^\/\//)) return window.location.protocol + url; |
| 560 |
if (url.match(/^[a-z]+:/i)) return url; |
| 561 |
const doc = document.implementation.createHTMLDocument(); |
| 562 |
const base = doc.createElement("base"); |
| 563 |
const a = doc.createElement("a"); |
| 564 |
doc.head.appendChild(base); |
| 565 |
doc.body.appendChild(a); |
| 566 |
if (baseUrl) base.href = baseUrl; |
| 567 |
a.href = url; |
| 568 |
return a.href; |
| 569 |
} |
| 570 |
var uuid = (() => { |
| 571 |
let counter = 0; |
| 572 |
const random = () => `0000${(Math.random() * Math.pow(36, 4) << 0).toString(36)}`.slice(-4); |
| 573 |
return () => { |
| 574 |
counter += 1; |
| 575 |
return `u${random()}${counter}`; |
| 576 |
}; |
| 577 |
})(); |
| 578 |
function toArray(arrayLike) { |
| 579 |
const arr = []; |
| 580 |
for (let i = 0, l = arrayLike.length; i < l; i++) arr.push(arrayLike[i]); |
| 581 |
return arr; |
| 582 |
} |
| 583 |
var styleProps = null; |
| 584 |
function getStyleProperties(options = {}) { |
| 585 |
if (styleProps) return styleProps; |
| 586 |
if (options.includeStyleProperties) { |
| 587 |
styleProps = options.includeStyleProperties; |
| 588 |
return styleProps; |
| 589 |
} |
| 590 |
styleProps = toArray(window.getComputedStyle(document.documentElement)); |
| 591 |
return styleProps; |
| 592 |
} |
| 593 |
function px(node, styleProperty) { |
| 594 |
const val = (node.ownerDocument.defaultView || window).getComputedStyle(node).getPropertyValue(styleProperty); |
| 595 |
return val ? parseFloat(val.replace("px", "")) : 0; |
| 596 |
} |
| 597 |
function getNodeWidth(node) { |
| 598 |
const leftBorder = px(node, "border-left-width"); |
| 599 |
const rightBorder = px(node, "border-right-width"); |
| 600 |
return node.clientWidth + leftBorder + rightBorder; |
| 601 |
} |
| 602 |
function getNodeHeight(node) { |
| 603 |
const topBorder = px(node, "border-top-width"); |
| 604 |
const bottomBorder = px(node, "border-bottom-width"); |
| 605 |
return node.clientHeight + topBorder + bottomBorder; |
| 606 |
} |
| 607 |
function getImageSize(targetNode, options = {}) { |
| 608 |
return { |
| 609 |
width: options.width || getNodeWidth(targetNode), |
| 610 |
height: options.height || getNodeHeight(targetNode) |
| 611 |
}; |
| 612 |
} |
| 613 |
function getPixelRatio() { |
| 614 |
let ratio; |
| 615 |
let FINAL_PROCESS; |
| 616 |
try { |
| 617 |
FINAL_PROCESS = process; |
| 618 |
} catch (e) {} |
| 619 |
const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null; |
| 620 |
if (val) { |
| 621 |
ratio = parseInt(val, 10); |
| 622 |
if (Number.isNaN(ratio)) ratio = 1; |
| 623 |
} |
| 624 |
return ratio || window.devicePixelRatio || 1; |
| 625 |
} |
| 626 |
var canvasDimensionLimit = 16384; |
| 627 |
function checkCanvasDimensions(canvas) { |
| 628 |
if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) if (canvas.width > canvas.height) { |
| 629 |
canvas.height *= canvasDimensionLimit / canvas.width; |
| 630 |
canvas.width = canvasDimensionLimit; |
| 631 |
} else { |
| 632 |
canvas.width *= canvasDimensionLimit / canvas.height; |
| 633 |
canvas.height = canvasDimensionLimit; |
| 634 |
} |
| 635 |
else if (canvas.width > canvasDimensionLimit) { |
| 636 |
canvas.height *= canvasDimensionLimit / canvas.width; |
| 637 |
canvas.width = canvasDimensionLimit; |
| 638 |
} else { |
| 639 |
canvas.width *= canvasDimensionLimit / canvas.height; |
| 640 |
canvas.height = canvasDimensionLimit; |
| 641 |
} |
| 642 |
} |
| 643 |
function createImage(url) { |
| 644 |
return new Promise((resolve, reject) => { |
| 645 |
const img = new Image(); |
| 646 |
img.onload = () => { |
| 647 |
img.decode().then(() => { |
| 648 |
requestAnimationFrame(() => resolve(img)); |
| 649 |
}); |
| 650 |
}; |
| 651 |
img.onerror = reject; |
| 652 |
img.crossOrigin = "anonymous"; |
| 653 |
img.decoding = "async"; |
| 654 |
img.src = url; |
| 655 |
}); |
| 656 |
} |
| 657 |
function svgToDataURL(_x) { |
| 658 |
return _svgToDataURL.apply(this, arguments); |
| 659 |
} |
| 660 |
function _svgToDataURL() { |
| 661 |
_svgToDataURL = _asyncToGenerator(function* (svg) { |
| 662 |
return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`); |
| 663 |
}); |
| 664 |
return _svgToDataURL.apply(this, arguments); |
| 665 |
} |
| 666 |
function nodeToDataURL(_x2, _x3, _x4) { |
| 667 |
return _nodeToDataURL.apply(this, arguments); |
| 668 |
} |
| 669 |
function _nodeToDataURL() { |
| 670 |
_nodeToDataURL = _asyncToGenerator(function* (node, width, height) { |
| 671 |
const xmlns = "http://www.w3.org/2000/svg"; |
| 672 |
const svg = document.createElementNS(xmlns, "svg"); |
| 673 |
const foreignObject = document.createElementNS(xmlns, "foreignObject"); |
| 674 |
svg.setAttribute("width", `${width}`); |
| 675 |
svg.setAttribute("height", `${height}`); |
| 676 |
svg.setAttribute("viewBox", `0 0 ${width} ${height}`); |
| 677 |
foreignObject.setAttribute("width", "100%"); |
| 678 |
foreignObject.setAttribute("height", "100%"); |
| 679 |
foreignObject.setAttribute("x", "0"); |
| 680 |
foreignObject.setAttribute("y", "0"); |
| 681 |
foreignObject.setAttribute("externalResourcesRequired", "true"); |
| 682 |
svg.appendChild(foreignObject); |
| 683 |
foreignObject.appendChild(node); |
| 684 |
return svgToDataURL(svg); |
| 685 |
}); |
| 686 |
return _nodeToDataURL.apply(this, arguments); |
| 687 |
} |
| 688 |
var isInstanceOfElement = (node, instance) => { |
| 689 |
if (node instanceof instance) return true; |
| 690 |
const nodePrototype = Object.getPrototypeOf(node); |
| 691 |
if (nodePrototype === null) return false; |
| 692 |
return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance); |
| 693 |
}; |
| 694 |
|
| 695 |
//#endregion |
| 696 |
//#region node_modules/html-to-image/es/clone-pseudos.js |
| 697 |
function formatCSSText(style) { |
| 698 |
const content = style.getPropertyValue("content"); |
| 699 |
return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`; |
| 700 |
} |
| 701 |
function formatCSSProperties(style, options) { |
| 702 |
return getStyleProperties(options).map((name) => { |
| 703 |
return `${name}: ${style.getPropertyValue(name)}${style.getPropertyPriority(name) ? " !important" : ""};`; |
| 704 |
}).join(" "); |
| 705 |
} |
| 706 |
function getPseudoElementStyle(className, pseudo, style, options) { |
| 707 |
const selector = `.${className}:${pseudo}`; |
| 708 |
const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style, options); |
| 709 |
return document.createTextNode(`${selector}{${cssText}}`); |
| 710 |
} |
| 711 |
function clonePseudoElement(nativeNode, clonedNode, pseudo, options) { |
| 712 |
const style = window.getComputedStyle(nativeNode, pseudo); |
| 713 |
const content = style.getPropertyValue("content"); |
| 714 |
if (content === "" || content === "none") return; |
| 715 |
const className = uuid(); |
| 716 |
try { |
| 717 |
clonedNode.className = `${clonedNode.className} ${className}`; |
| 718 |
} catch (err) { |
| 719 |
return; |
| 720 |
} |
| 721 |
const styleElement = document.createElement("style"); |
| 722 |
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style, options)); |
| 723 |
clonedNode.appendChild(styleElement); |
| 724 |
} |
| 725 |
function clonePseudoElements(nativeNode, clonedNode, options) { |
| 726 |
clonePseudoElement(nativeNode, clonedNode, ":before", options); |
| 727 |
clonePseudoElement(nativeNode, clonedNode, ":after", options); |
| 728 |
} |
| 729 |
|
| 730 |
//#endregion |
| 731 |
//#region node_modules/html-to-image/es/mimes.js |
| 732 |
var WOFF = "application/font-woff"; |
| 733 |
var JPEG = "image/jpeg"; |
| 734 |
var mimes = { |
| 735 |
woff: WOFF, |
| 736 |
woff2: WOFF, |
| 737 |
ttf: "application/font-truetype", |
| 738 |
eot: "application/vnd.ms-fontobject", |
| 739 |
png: "image/png", |
| 740 |
jpg: JPEG, |
| 741 |
jpeg: JPEG, |
| 742 |
gif: "image/gif", |
| 743 |
tiff: "image/tiff", |
| 744 |
svg: "image/svg+xml", |
| 745 |
webp: "image/webp" |
| 746 |
}; |
| 747 |
function getExtension(url) { |
| 748 |
const match = /\.([^./]*?)$/g.exec(url); |
| 749 |
return match ? match[1] : ""; |
| 750 |
} |
| 751 |
function getMimeType(url) { |
| 752 |
const extension = getExtension(url).toLowerCase(); |
| 753 |
return mimes[extension] || ""; |
| 754 |
} |
| 755 |
|
| 756 |
//#endregion |
| 757 |
//#region node_modules/html-to-image/es/dataurl.js |
| 758 |
function getContentFromDataUrl(dataURL) { |
| 759 |
return dataURL.split(/,/)[1]; |
| 760 |
} |
| 761 |
function isDataUrl(url) { |
| 762 |
return url.search(/^(data:)/) !== -1; |
| 763 |
} |
| 764 |
function makeDataUrl(content, mimeType) { |
| 765 |
return `data:${mimeType};base64,${content}`; |
| 766 |
} |
| 767 |
function fetchAsDataURL(_x, _x2, _x3) { |
| 768 |
return _fetchAsDataURL.apply(this, arguments); |
| 769 |
} |
| 770 |
function _fetchAsDataURL() { |
| 771 |
_fetchAsDataURL = _asyncToGenerator(function* (url, init, process) { |
| 772 |
const res = yield fetch(url, init); |
| 773 |
if (res.status === 404) throw new Error(`Resource "${res.url}" not found`); |
| 774 |
const blob = yield res.blob(); |
| 775 |
return new Promise((resolve, reject) => { |
| 776 |
const reader = new FileReader(); |
| 777 |
reader.onerror = reject; |
| 778 |
reader.onloadend = () => { |
| 779 |
try { |
| 780 |
resolve(process({ |
| 781 |
res, |
| 782 |
result: reader.result |
| 783 |
})); |
| 784 |
} catch (error) { |
| 785 |
reject(error); |
| 786 |
} |
| 787 |
}; |
| 788 |
reader.readAsDataURL(blob); |
| 789 |
}); |
| 790 |
}); |
| 791 |
return _fetchAsDataURL.apply(this, arguments); |
| 792 |
} |
| 793 |
var cache = {}; |
| 794 |
function getCacheKey(url, contentType, includeQueryParams) { |
| 795 |
let key = url.replace(/\?.*/, ""); |
| 796 |
if (includeQueryParams) key = url; |
| 797 |
if (/ttf|otf|eot|woff2?/i.test(key)) key = key.replace(/.*\//, ""); |
| 798 |
return contentType ? `[${contentType}]${key}` : key; |
| 799 |
} |
| 800 |
function resourceToDataURL(_x4, _x5, _x6) { |
| 801 |
return _resourceToDataURL.apply(this, arguments); |
| 802 |
} |
| 803 |
function _resourceToDataURL() { |
| 804 |
_resourceToDataURL = _asyncToGenerator(function* (resourceUrl, contentType, options) { |
| 805 |
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams); |
| 806 |
if (cache[cacheKey] != null) return cache[cacheKey]; |
| 807 |
if (options.cacheBust) resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime(); |
| 808 |
let dataURL; |
| 809 |
try { |
| 810 |
dataURL = makeDataUrl(yield fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => { |
| 811 |
if (!contentType) contentType = res.headers.get("Content-Type") || ""; |
| 812 |
return getContentFromDataUrl(result); |
| 813 |
}), contentType); |
| 814 |
} catch (error) { |
| 815 |
dataURL = options.imagePlaceholder || ""; |
| 816 |
let msg = `Failed to fetch resource: ${resourceUrl}`; |
| 817 |
if (error) msg = typeof error === "string" ? error : error.message; |
| 818 |
if (msg) console.warn(msg); |
| 819 |
} |
| 820 |
cache[cacheKey] = dataURL; |
| 821 |
return dataURL; |
| 822 |
}); |
| 823 |
return _resourceToDataURL.apply(this, arguments); |
| 824 |
} |
| 825 |
|
| 826 |
//#endregion |
| 827 |
//#region node_modules/html-to-image/es/clone-node.js |
| 828 |
function cloneCanvasElement(_x) { |
| 829 |
return _cloneCanvasElement.apply(this, arguments); |
| 830 |
} |
| 831 |
function _cloneCanvasElement() { |
| 832 |
_cloneCanvasElement = _asyncToGenerator(function* (canvas) { |
| 833 |
const dataURL = canvas.toDataURL(); |
| 834 |
if (dataURL === "data:,") return canvas.cloneNode(false); |
| 835 |
return createImage(dataURL); |
| 836 |
}); |
| 837 |
return _cloneCanvasElement.apply(this, arguments); |
| 838 |
} |
| 839 |
function cloneVideoElement(_x2, _x3) { |
| 840 |
return _cloneVideoElement.apply(this, arguments); |
| 841 |
} |
| 842 |
function _cloneVideoElement() { |
| 843 |
_cloneVideoElement = _asyncToGenerator(function* (video, options) { |
| 844 |
if (video.currentSrc) { |
| 845 |
const canvas = document.createElement("canvas"); |
| 846 |
const ctx = canvas.getContext("2d"); |
| 847 |
canvas.width = video.clientWidth; |
| 848 |
canvas.height = video.clientHeight; |
| 849 |
ctx === null || ctx === void 0 || ctx.drawImage(video, 0, 0, canvas.width, canvas.height); |
| 850 |
return createImage(canvas.toDataURL()); |
| 851 |
} |
| 852 |
const poster = video.poster; |
| 853 |
return createImage(yield resourceToDataURL(poster, getMimeType(poster), options)); |
| 854 |
}); |
| 855 |
return _cloneVideoElement.apply(this, arguments); |
| 856 |
} |
| 857 |
function cloneIFrameElement(_x4, _x5) { |
| 858 |
return _cloneIFrameElement.apply(this, arguments); |
| 859 |
} |
| 860 |
function _cloneIFrameElement() { |
| 861 |
_cloneIFrameElement = _asyncToGenerator(function* (iframe, options) { |
| 862 |
var _a; |
| 863 |
try { |
| 864 |
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) return yield cloneNode(iframe.contentDocument.body, options, true); |
| 865 |
} catch (_b) {} |
| 866 |
return iframe.cloneNode(false); |
| 867 |
}); |
| 868 |
return _cloneIFrameElement.apply(this, arguments); |
| 869 |
} |
| 870 |
function cloneSingleNode(_x6, _x7) { |
| 871 |
return _cloneSingleNode.apply(this, arguments); |
| 872 |
} |
| 873 |
function _cloneSingleNode() { |
| 874 |
_cloneSingleNode = _asyncToGenerator(function* (node, options) { |
| 875 |
if (isInstanceOfElement(node, HTMLCanvasElement)) return cloneCanvasElement(node); |
| 876 |
if (isInstanceOfElement(node, HTMLVideoElement)) return cloneVideoElement(node, options); |
| 877 |
if (isInstanceOfElement(node, HTMLIFrameElement)) return cloneIFrameElement(node, options); |
| 878 |
return node.cloneNode(isSVGElement(node)); |
| 879 |
}); |
| 880 |
return _cloneSingleNode.apply(this, arguments); |
| 881 |
} |
| 882 |
var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT"; |
| 883 |
var isSVGElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SVG"; |
| 884 |
function cloneChildren(_x8, _x9, _x10) { |
| 885 |
return _cloneChildren.apply(this, arguments); |
| 886 |
} |
| 887 |
function _cloneChildren() { |
| 888 |
_cloneChildren = _asyncToGenerator(function* (nativeNode, clonedNode, options) { |
| 889 |
var _a; |
| 890 |
var _b; |
| 891 |
if (isSVGElement(clonedNode)) return clonedNode; |
| 892 |
let children = []; |
| 893 |
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) children = toArray(nativeNode.assignedNodes()); |
| 894 |
else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) children = toArray(nativeNode.contentDocument.body.childNodes); |
| 895 |
else children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes); |
| 896 |
if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) return clonedNode; |
| 897 |
yield children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => { |
| 898 |
if (clonedChild) clonedNode.appendChild(clonedChild); |
| 899 |
}), Promise.resolve()); |
| 900 |
return clonedNode; |
| 901 |
}); |
| 902 |
return _cloneChildren.apply(this, arguments); |
| 903 |
} |
| 904 |
function cloneCSSStyle(nativeNode, clonedNode, options) { |
| 905 |
const targetStyle = clonedNode.style; |
| 906 |
if (!targetStyle) return; |
| 907 |
const sourceStyle = window.getComputedStyle(nativeNode); |
| 908 |
if (sourceStyle.cssText) { |
| 909 |
targetStyle.cssText = sourceStyle.cssText; |
| 910 |
targetStyle.transformOrigin = sourceStyle.transformOrigin; |
| 911 |
} else getStyleProperties(options).forEach((name) => { |
| 912 |
let value = sourceStyle.getPropertyValue(name); |
| 913 |
if (name === "font-size" && value.endsWith("px")) value = `${Math.floor(parseFloat(value.substring(0, value.length - 2))) - .1}px`; |
| 914 |
if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") value = "block"; |
| 915 |
if (name === "d" && clonedNode.getAttribute("d")) value = `path(${clonedNode.getAttribute("d")})`; |
| 916 |
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name)); |
| 917 |
}); |
| 918 |
} |
| 919 |
function cloneInputValue(nativeNode, clonedNode) { |
| 920 |
if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) clonedNode.innerHTML = nativeNode.value; |
| 921 |
if (isInstanceOfElement(nativeNode, HTMLInputElement)) clonedNode.setAttribute("value", nativeNode.value); |
| 922 |
} |
| 923 |
function cloneSelectValue(nativeNode, clonedNode) { |
| 924 |
if (isInstanceOfElement(nativeNode, HTMLSelectElement)) { |
| 925 |
const clonedSelect = clonedNode; |
| 926 |
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value")); |
| 927 |
if (selectedOption) selectedOption.setAttribute("selected", ""); |
| 928 |
} |
| 929 |
} |
| 930 |
function decorate(nativeNode, clonedNode, options) { |
| 931 |
if (isInstanceOfElement(clonedNode, Element)) { |
| 932 |
cloneCSSStyle(nativeNode, clonedNode, options); |
| 933 |
clonePseudoElements(nativeNode, clonedNode, options); |
| 934 |
cloneInputValue(nativeNode, clonedNode); |
| 935 |
cloneSelectValue(nativeNode, clonedNode); |
| 936 |
} |
| 937 |
return clonedNode; |
| 938 |
} |
| 939 |
function ensureSVGSymbols(_x11, _x12) { |
| 940 |
return _ensureSVGSymbols.apply(this, arguments); |
| 941 |
} |
| 942 |
function _ensureSVGSymbols() { |
| 943 |
_ensureSVGSymbols = _asyncToGenerator(function* (clone, options) { |
| 944 |
const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : []; |
| 945 |
if (uses.length === 0) return clone; |
| 946 |
const processedDefs = {}; |
| 947 |
for (let i = 0; i < uses.length; i++) { |
| 948 |
const id = uses[i].getAttribute("xlink:href"); |
| 949 |
if (id) { |
| 950 |
const exist = clone.querySelector(id); |
| 951 |
const definition = document.querySelector(id); |
| 952 |
if (!exist && definition && !processedDefs[id]) processedDefs[id] = yield cloneNode(definition, options, true); |
| 953 |
} |
| 954 |
} |
| 955 |
const nodes = Object.values(processedDefs); |
| 956 |
if (nodes.length) { |
| 957 |
const ns = "http://www.w3.org/1999/xhtml"; |
| 958 |
const svg = document.createElementNS(ns, "svg"); |
| 959 |
svg.setAttribute("xmlns", ns); |
| 960 |
svg.style.position = "absolute"; |
| 961 |
svg.style.width = "0"; |
| 962 |
svg.style.height = "0"; |
| 963 |
svg.style.overflow = "hidden"; |
| 964 |
svg.style.display = "none"; |
| 965 |
const defs = document.createElementNS(ns, "defs"); |
| 966 |
svg.appendChild(defs); |
| 967 |
for (let i = 0; i < nodes.length; i++) defs.appendChild(nodes[i]); |
| 968 |
clone.appendChild(svg); |
| 969 |
} |
| 970 |
return clone; |
| 971 |
}); |
| 972 |
return _ensureSVGSymbols.apply(this, arguments); |
| 973 |
} |
| 974 |
function cloneNode(_x13, _x14, _x15) { |
| 975 |
return _cloneNode.apply(this, arguments); |
| 976 |
} |
| 977 |
function _cloneNode() { |
| 978 |
_cloneNode = _asyncToGenerator(function* (node, options, isRoot) { |
| 979 |
if (!isRoot && options.filter && !options.filter(node)) return null; |
| 980 |
return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode, options)).then((clonedNode) => ensureSVGSymbols(clonedNode, options)); |
| 981 |
}); |
| 982 |
return _cloneNode.apply(this, arguments); |
| 983 |
} |
| 984 |
|
| 985 |
//#endregion |
| 986 |
//#region node_modules/html-to-image/es/embed-resources.js |
| 987 |
var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g; |
| 988 |
var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g; |
| 989 |
var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g; |
| 990 |
function toRegex(url) { |
| 991 |
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1"); |
| 992 |
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g"); |
| 993 |
} |
| 994 |
function parseURLs(cssText) { |
| 995 |
const urls = []; |
| 996 |
cssText.replace(URL_REGEX, (raw, quotation, url) => { |
| 997 |
urls.push(url); |
| 998 |
return raw; |
| 999 |
}); |
| 1000 |
return urls.filter((url) => !isDataUrl(url)); |
| 1001 |
} |
| 1002 |
function embed(_x, _x2, _x3, _x4, _x5) { |
| 1003 |
return _embed.apply(this, arguments); |
| 1004 |
} |
| 1005 |
function _embed() { |
| 1006 |
_embed = _asyncToGenerator(function* (cssText, resourceURL, baseURL, options, getContentFromUrl) { |
| 1007 |
try { |
| 1008 |
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL; |
| 1009 |
const contentType = getMimeType(resourceURL); |
| 1010 |
let dataURL; |
| 1011 |
if (getContentFromUrl) dataURL = makeDataUrl(yield getContentFromUrl(resolvedURL), contentType); |
| 1012 |
else dataURL = yield resourceToDataURL(resolvedURL, contentType, options); |
| 1013 |
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`); |
| 1014 |
} catch (error) {} |
| 1015 |
return cssText; |
| 1016 |
}); |
| 1017 |
return _embed.apply(this, arguments); |
| 1018 |
} |
| 1019 |
function filterPreferredFontFormat(str, { preferredFontFormat }) { |
| 1020 |
return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => { |
| 1021 |
while (true) { |
| 1022 |
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || []; |
| 1023 |
if (!format) return ""; |
| 1024 |
if (format === preferredFontFormat) return `src: ${src};`; |
| 1025 |
} |
| 1026 |
}); |
| 1027 |
} |
| 1028 |
function shouldEmbed(url) { |
| 1029 |
return url.search(URL_REGEX) !== -1; |
| 1030 |
} |
| 1031 |
function embedResources(_x6, _x7, _x8) { |
| 1032 |
return _embedResources.apply(this, arguments); |
| 1033 |
} |
| 1034 |
function _embedResources() { |
| 1035 |
_embedResources = _asyncToGenerator(function* (cssText, baseUrl, options) { |
| 1036 |
if (!shouldEmbed(cssText)) return cssText; |
| 1037 |
const filteredCSSText = filterPreferredFontFormat(cssText, options); |
| 1038 |
return parseURLs(filteredCSSText).reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText)); |
| 1039 |
}); |
| 1040 |
return _embedResources.apply(this, arguments); |
| 1041 |
} |
| 1042 |
|
| 1043 |
//#endregion |
| 1044 |
//#region node_modules/html-to-image/es/embed-images.js |
| 1045 |
function embedProp(_x, _x2, _x3) { |
| 1046 |
return _embedProp.apply(this, arguments); |
| 1047 |
} |
| 1048 |
function _embedProp() { |
| 1049 |
_embedProp = _asyncToGenerator(function* (propName, node, options) { |
| 1050 |
var _a; |
| 1051 |
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName); |
| 1052 |
if (propValue) { |
| 1053 |
const cssString = yield embedResources(propValue, null, options); |
| 1054 |
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName)); |
| 1055 |
return true; |
| 1056 |
} |
| 1057 |
return false; |
| 1058 |
}); |
| 1059 |
return _embedProp.apply(this, arguments); |
| 1060 |
} |
| 1061 |
function embedBackground(_x4, _x5) { |
| 1062 |
return _embedBackground.apply(this, arguments); |
| 1063 |
} |
| 1064 |
function _embedBackground() { |
| 1065 |
_embedBackground = _asyncToGenerator(function* (clonedNode, options) { |
| 1066 |
(yield embedProp("background", clonedNode, options)) || (yield embedProp("background-image", clonedNode, options)); |
| 1067 |
(yield embedProp("mask", clonedNode, options)) || (yield embedProp("-webkit-mask", clonedNode, options)) || (yield embedProp("mask-image", clonedNode, options)) || (yield embedProp("-webkit-mask-image", clonedNode, options)); |
| 1068 |
}); |
| 1069 |
return _embedBackground.apply(this, arguments); |
| 1070 |
} |
| 1071 |
function embedImageNode(_x6, _x7) { |
| 1072 |
return _embedImageNode.apply(this, arguments); |
| 1073 |
} |
| 1074 |
function _embedImageNode() { |
| 1075 |
_embedImageNode = _asyncToGenerator(function* (clonedNode, options) { |
| 1076 |
const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement); |
| 1077 |
if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) return; |
| 1078 |
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal; |
| 1079 |
const dataURL = yield resourceToDataURL(url, getMimeType(url), options); |
| 1080 |
yield new Promise((resolve, reject) => { |
| 1081 |
clonedNode.onload = resolve; |
| 1082 |
clonedNode.onerror = options.onImageErrorHandler ? (...attributes) => { |
| 1083 |
try { |
| 1084 |
resolve(options.onImageErrorHandler(...attributes)); |
| 1085 |
} catch (error) { |
| 1086 |
reject(error); |
| 1087 |
} |
| 1088 |
} : reject; |
| 1089 |
const image = clonedNode; |
| 1090 |
if (image.decode) image.decode = resolve; |
| 1091 |
if (image.loading === "lazy") image.loading = "eager"; |
| 1092 |
if (isImageElement) { |
| 1093 |
clonedNode.srcset = ""; |
| 1094 |
clonedNode.src = dataURL; |
| 1095 |
} else clonedNode.href.baseVal = dataURL; |
| 1096 |
}); |
| 1097 |
}); |
| 1098 |
return _embedImageNode.apply(this, arguments); |
| 1099 |
} |
| 1100 |
function embedChildren(_x8, _x9) { |
| 1101 |
return _embedChildren.apply(this, arguments); |
| 1102 |
} |
| 1103 |
function _embedChildren() { |
| 1104 |
_embedChildren = _asyncToGenerator(function* (clonedNode, options) { |
| 1105 |
const deferreds = toArray(clonedNode.childNodes).map((child) => embedImages(child, options)); |
| 1106 |
yield Promise.all(deferreds).then(() => clonedNode); |
| 1107 |
}); |
| 1108 |
return _embedChildren.apply(this, arguments); |
| 1109 |
} |
| 1110 |
function embedImages(_x10, _x11) { |
| 1111 |
return _embedImages.apply(this, arguments); |
| 1112 |
} |
| 1113 |
function _embedImages() { |
| 1114 |
_embedImages = _asyncToGenerator(function* (clonedNode, options) { |
| 1115 |
if (isInstanceOfElement(clonedNode, Element)) { |
| 1116 |
yield embedBackground(clonedNode, options); |
| 1117 |
yield embedImageNode(clonedNode, options); |
| 1118 |
yield embedChildren(clonedNode, options); |
| 1119 |
} |
| 1120 |
}); |
| 1121 |
return _embedImages.apply(this, arguments); |
| 1122 |
} |
| 1123 |
|
| 1124 |
//#endregion |
| 1125 |
//#region node_modules/html-to-image/es/apply-style.js |
| 1126 |
function applyStyle(node, options) { |
| 1127 |
const { style } = node; |
| 1128 |
if (options.backgroundColor) style.backgroundColor = options.backgroundColor; |
| 1129 |
if (options.width) style.width = `${options.width}px`; |
| 1130 |
if (options.height) style.height = `${options.height}px`; |
| 1131 |
const manual = options.style; |
| 1132 |
if (manual != null) Object.keys(manual).forEach((key) => { |
| 1133 |
style[key] = manual[key]; |
| 1134 |
}); |
| 1135 |
return node; |
| 1136 |
} |
| 1137 |
|
| 1138 |
//#endregion |
| 1139 |
//#region node_modules/html-to-image/es/embed-webfonts.js |
| 1140 |
var cssFetchCache = {}; |
| 1141 |
function fetchCSS(_x) { |
| 1142 |
return _fetchCSS.apply(this, arguments); |
| 1143 |
} |
| 1144 |
function _fetchCSS() { |
| 1145 |
_fetchCSS = _asyncToGenerator(function* (url) { |
| 1146 |
let cache = cssFetchCache[url]; |
| 1147 |
if (cache != null) return cache; |
| 1148 |
cache = { |
| 1149 |
url, |
| 1150 |
cssText: yield (yield fetch(url)).text() |
| 1151 |
}; |
| 1152 |
cssFetchCache[url] = cache; |
| 1153 |
return cache; |
| 1154 |
}); |
| 1155 |
return _fetchCSS.apply(this, arguments); |
| 1156 |
} |
| 1157 |
function embedFonts(_x3, _x4) { |
| 1158 |
return _embedFonts.apply(this, arguments); |
| 1159 |
} |
| 1160 |
function _embedFonts() { |
| 1161 |
_embedFonts = _asyncToGenerator(function* (data, options) { |
| 1162 |
let cssText = data.cssText; |
| 1163 |
const regexUrl = /url\(["']?([^"')]+)["']?\)/g; |
| 1164 |
const loadFonts = (cssText.match(/url\([^)]+\)/g) || []).map(function() { |
| 1165 |
var _ref = _asyncToGenerator(function* (loc) { |
| 1166 |
let url = loc.replace(regexUrl, "$1"); |
| 1167 |
if (!url.startsWith("https://")) url = new URL(url, data.url).href; |
| 1168 |
return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => { |
| 1169 |
cssText = cssText.replace(loc, `url(${result})`); |
| 1170 |
return [loc, result]; |
| 1171 |
}); |
| 1172 |
}); |
| 1173 |
return function(_x2) { |
| 1174 |
return _ref.apply(this, arguments); |
| 1175 |
}; |
| 1176 |
}()); |
| 1177 |
return Promise.all(loadFonts).then(() => cssText); |
| 1178 |
}); |
| 1179 |
return _embedFonts.apply(this, arguments); |
| 1180 |
} |
| 1181 |
function parseCSS(source) { |
| 1182 |
if (source == null) return []; |
| 1183 |
const result = []; |
| 1184 |
let cssText = source.replace(/(\/\*[\s\S]*?\*\/)/gi, ""); |
| 1185 |
const keyframesRegex = /* @__PURE__ */ new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi"); |
| 1186 |
while (true) { |
| 1187 |
const matches = keyframesRegex.exec(cssText); |
| 1188 |
if (matches === null) break; |
| 1189 |
result.push(matches[0]); |
| 1190 |
} |
| 1191 |
cssText = cssText.replace(keyframesRegex, ""); |
| 1192 |
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi; |
| 1193 |
const unifiedRegex = /* @__PURE__ */ new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", "gi"); |
| 1194 |
while (true) { |
| 1195 |
let matches = importRegex.exec(cssText); |
| 1196 |
if (matches === null) { |
| 1197 |
matches = unifiedRegex.exec(cssText); |
| 1198 |
if (matches === null) break; |
| 1199 |
else importRegex.lastIndex = unifiedRegex.lastIndex; |
| 1200 |
} else unifiedRegex.lastIndex = importRegex.lastIndex; |
| 1201 |
result.push(matches[0]); |
| 1202 |
} |
| 1203 |
return result; |
| 1204 |
} |
| 1205 |
function getCSSRules(_x5, _x6) { |
| 1206 |
return _getCSSRules.apply(this, arguments); |
| 1207 |
} |
| 1208 |
function _getCSSRules() { |
| 1209 |
_getCSSRules = _asyncToGenerator(function* (styleSheets, options) { |
| 1210 |
const ret = []; |
| 1211 |
const deferreds = []; |
| 1212 |
styleSheets.forEach((sheet) => { |
| 1213 |
if ("cssRules" in sheet) try { |
| 1214 |
toArray(sheet.cssRules || []).forEach((item, index) => { |
| 1215 |
if (item.type === CSSRule.IMPORT_RULE) { |
| 1216 |
let importIndex = index + 1; |
| 1217 |
const url = item.href; |
| 1218 |
const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => { |
| 1219 |
try { |
| 1220 |
sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length); |
| 1221 |
} catch (error) { |
| 1222 |
console.error("Error inserting rule from remote css", { |
| 1223 |
rule, |
| 1224 |
error |
| 1225 |
}); |
| 1226 |
} |
| 1227 |
})).catch((e) => { |
| 1228 |
console.error("Error loading remote css", e.toString()); |
| 1229 |
}); |
| 1230 |
deferreds.push(deferred); |
| 1231 |
} |
| 1232 |
}); |
| 1233 |
} catch (e) { |
| 1234 |
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0]; |
| 1235 |
if (sheet.href != null) deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => { |
| 1236 |
inline.insertRule(rule, inline.cssRules.length); |
| 1237 |
})).catch((err) => { |
| 1238 |
console.error("Error loading remote stylesheet", err); |
| 1239 |
})); |
| 1240 |
console.error("Error inlining remote css file", e); |
| 1241 |
} |
| 1242 |
}); |
| 1243 |
return Promise.all(deferreds).then(() => { |
| 1244 |
styleSheets.forEach((sheet) => { |
| 1245 |
if ("cssRules" in sheet) try { |
| 1246 |
toArray(sheet.cssRules || []).forEach((item) => { |
| 1247 |
ret.push(item); |
| 1248 |
}); |
| 1249 |
} catch (e) { |
| 1250 |
console.error(`Error while reading CSS rules from ${sheet.href}`, e); |
| 1251 |
} |
| 1252 |
}); |
| 1253 |
return ret; |
| 1254 |
}); |
| 1255 |
}); |
| 1256 |
return _getCSSRules.apply(this, arguments); |
| 1257 |
} |
| 1258 |
function getWebFontRules(cssRules) { |
| 1259 |
return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src"))); |
| 1260 |
} |
| 1261 |
function parseWebFontRules(_x7, _x8) { |
| 1262 |
return _parseWebFontRules.apply(this, arguments); |
| 1263 |
} |
| 1264 |
function _parseWebFontRules() { |
| 1265 |
_parseWebFontRules = _asyncToGenerator(function* (node, options) { |
| 1266 |
if (node.ownerDocument == null) throw new Error("Provided element is not within a Document"); |
| 1267 |
return getWebFontRules(yield getCSSRules(toArray(node.ownerDocument.styleSheets), options)); |
| 1268 |
}); |
| 1269 |
return _parseWebFontRules.apply(this, arguments); |
| 1270 |
} |
| 1271 |
function normalizeFontFamily(font) { |
| 1272 |
return font.trim().replace(/["']/g, ""); |
| 1273 |
} |
| 1274 |
function getUsedFonts(node) { |
| 1275 |
const fonts = /* @__PURE__ */ new Set(); |
| 1276 |
function traverse(node) { |
| 1277 |
(node.style.fontFamily || getComputedStyle(node).fontFamily).split(",").forEach((font) => { |
| 1278 |
fonts.add(normalizeFontFamily(font)); |
| 1279 |
}); |
| 1280 |
Array.from(node.children).forEach((child) => { |
| 1281 |
if (child instanceof HTMLElement) traverse(child); |
| 1282 |
}); |
| 1283 |
} |
| 1284 |
traverse(node); |
| 1285 |
return fonts; |
| 1286 |
} |
| 1287 |
function getWebFontCSS(_x9, _x10) { |
| 1288 |
return _getWebFontCSS.apply(this, arguments); |
| 1289 |
} |
| 1290 |
function _getWebFontCSS() { |
| 1291 |
_getWebFontCSS = _asyncToGenerator(function* (node, options) { |
| 1292 |
const rules = yield parseWebFontRules(node, options); |
| 1293 |
const usedFonts = getUsedFonts(node); |
| 1294 |
return (yield Promise.all(rules.filter((rule) => usedFonts.has(normalizeFontFamily(rule.style.fontFamily))).map((rule) => { |
| 1295 |
const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null; |
| 1296 |
return embedResources(rule.cssText, baseUrl, options); |
| 1297 |
}))).join("\n"); |
| 1298 |
}); |
| 1299 |
return _getWebFontCSS.apply(this, arguments); |
| 1300 |
} |
| 1301 |
function embedWebFonts(_x11, _x12) { |
| 1302 |
return _embedWebFonts.apply(this, arguments); |
| 1303 |
} |
| 1304 |
function _embedWebFonts() { |
| 1305 |
_embedWebFonts = _asyncToGenerator(function* (clonedNode, options) { |
| 1306 |
const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : yield getWebFontCSS(clonedNode, options); |
| 1307 |
if (cssText) { |
| 1308 |
const styleNode = document.createElement("style"); |
| 1309 |
const sytleContent = document.createTextNode(cssText); |
| 1310 |
styleNode.appendChild(sytleContent); |
| 1311 |
if (clonedNode.firstChild) clonedNode.insertBefore(styleNode, clonedNode.firstChild); |
| 1312 |
else clonedNode.appendChild(styleNode); |
| 1313 |
} |
| 1314 |
}); |
| 1315 |
return _embedWebFonts.apply(this, arguments); |
| 1316 |
} |
| 1317 |
|
| 1318 |
//#endregion |
| 1319 |
//#region node_modules/html-to-image/es/index.js |
| 1320 |
function toSvg(_x) { |
| 1321 |
return _toSvg.apply(this, arguments); |
| 1322 |
} |
| 1323 |
function _toSvg() { |
| 1324 |
_toSvg = _asyncToGenerator(function* (node, options = {}) { |
| 1325 |
const { width, height } = getImageSize(node, options); |
| 1326 |
const clonedNode = yield cloneNode(node, options, true); |
| 1327 |
yield embedWebFonts(clonedNode, options); |
| 1328 |
yield embedImages(clonedNode, options); |
| 1329 |
applyStyle(clonedNode, options); |
| 1330 |
return yield nodeToDataURL(clonedNode, width, height); |
| 1331 |
}); |
| 1332 |
return _toSvg.apply(this, arguments); |
| 1333 |
} |
| 1334 |
function toCanvas(_x2) { |
| 1335 |
return _toCanvas.apply(this, arguments); |
| 1336 |
} |
| 1337 |
function _toCanvas() { |
| 1338 |
_toCanvas = _asyncToGenerator(function* (node, options = {}) { |
| 1339 |
const { width, height } = getImageSize(node, options); |
| 1340 |
const img = yield createImage(yield toSvg(node, options)); |
| 1341 |
const canvas = document.createElement("canvas"); |
| 1342 |
const context = canvas.getContext("2d"); |
| 1343 |
const ratio = options.pixelRatio || getPixelRatio(); |
| 1344 |
const canvasWidth = options.canvasWidth || width; |
| 1345 |
const canvasHeight = options.canvasHeight || height; |
| 1346 |
canvas.width = canvasWidth * ratio; |
| 1347 |
canvas.height = canvasHeight * ratio; |
| 1348 |
if (!options.skipAutoScale) checkCanvasDimensions(canvas); |
| 1349 |
canvas.style.width = `${canvasWidth}`; |
| 1350 |
canvas.style.height = `${canvasHeight}`; |
| 1351 |
if (options.backgroundColor) { |
| 1352 |
context.fillStyle = options.backgroundColor; |
| 1353 |
context.fillRect(0, 0, canvas.width, canvas.height); |
| 1354 |
} |
| 1355 |
context.drawImage(img, 0, 0, canvas.width, canvas.height); |
| 1356 |
return canvas; |
| 1357 |
}); |
| 1358 |
return _toCanvas.apply(this, arguments); |
| 1359 |
} |
| 1360 |
|
| 1361 |
//#endregion |
| 1362 |
//#region modules/cloud-library/assets/js/preview/screenshot.js |
| 1363 |
function ownKeys(e, r) { |
| 1364 |
var t = Object.keys(e); |
| 1365 |
if (Object.getOwnPropertySymbols) { |
| 1366 |
var o = Object.getOwnPropertySymbols(e); |
| 1367 |
r && (o = o.filter(function(r) { |
| 1368 |
return Object.getOwnPropertyDescriptor(e, r).enumerable; |
| 1369 |
})), t.push.apply(t, o); |
| 1370 |
} |
| 1371 |
return t; |
| 1372 |
} |
| 1373 |
function _objectSpread(e) { |
| 1374 |
for (var r = 1; r < arguments.length; r++) { |
| 1375 |
var t = null != arguments[r] ? arguments[r] : {}; |
| 1376 |
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) { |
| 1377 |
_defineProperty(e, r, t[r]); |
| 1378 |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) { |
| 1379 |
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); |
| 1380 |
}); |
| 1381 |
} |
| 1382 |
return e; |
| 1383 |
} |
| 1384 |
function _callSuper(t, o, e) { |
| 1385 |
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); |
| 1386 |
} |
| 1387 |
function _isNativeReflectConstruct() { |
| 1388 |
try { |
| 1389 |
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); |
| 1390 |
} catch (t) {} |
| 1391 |
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { |
| 1392 |
return !!t; |
| 1393 |
})(); |
| 1394 |
} |
| 1395 |
function _superPropGet(t, o, e, r) { |
| 1396 |
var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); |
| 1397 |
return 2 & r && "function" == typeof p ? function(t) { |
| 1398 |
return p.apply(e, t); |
| 1399 |
} : p; |
| 1400 |
} |
| 1401 |
var Screenshot = /*#__PURE__*/ function(_elementorModules$Vie) { |
| 1402 |
function Screenshot() { |
| 1403 |
_classCallCheck(this, Screenshot); |
| 1404 |
return _callSuper(this, Screenshot, arguments); |
| 1405 |
} |
| 1406 |
_inherits(Screenshot, _elementorModules$Vie); |
| 1407 |
return _createClass(Screenshot, [ |
| 1408 |
{ |
| 1409 |
key: "getDefaultSettings", |
| 1410 |
value: function getDefaultSettings() { |
| 1411 |
return _objectSpread({ |
| 1412 |
timeout: 15e3, |
| 1413 |
render_timeout: 5e3, |
| 1414 |
image_quality: .15, |
| 1415 |
image_placeholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" |
| 1416 |
}, ElementorScreenshotConfig); |
| 1417 |
} |
| 1418 |
}, |
| 1419 |
{ |
| 1420 |
key: "getDefaultElements", |
| 1421 |
value: function getDefaultElements() { |
| 1422 |
return { $elementor: jQuery(ElementorScreenshotConfig.selector) }; |
| 1423 |
} |
| 1424 |
}, |
| 1425 |
{ |
| 1426 |
key: "onInit", |
| 1427 |
value: function onInit() { |
| 1428 |
var _this = this; |
| 1429 |
_superPropGet(Screenshot, "onInit", this, 3)([]); |
| 1430 |
/** |
| 1431 |
* Hold the timeout timer |
| 1432 |
* |
| 1433 |
* @type {number|null} |
| 1434 |
*/ |
| 1435 |
this.timeoutTimer = setTimeout(function() { |
| 1436 |
_this.screenshotFailed(/* @__PURE__ */ new Error("Screenshot timeout reached")); |
| 1437 |
}, this.getSettings("timeout")); |
| 1438 |
return this.captureScreenshot(); |
| 1439 |
} |
| 1440 |
}, |
| 1441 |
{ |
| 1442 |
key: "captureScreenshot", |
| 1443 |
value: function captureScreenshot() { |
| 1444 |
var _this2 = this; |
| 1445 |
return Promise.resolve().then(function() { |
| 1446 |
return _this2.createImage(); |
| 1447 |
}).then(function(imageData) { |
| 1448 |
return _this2.save(imageData); |
| 1449 |
}).then(function(url) { |
| 1450 |
return _this2.screenshotSucceed(url); |
| 1451 |
}).catch(function(error) { |
| 1452 |
return _this2.screenshotFailed(error); |
| 1453 |
}); |
| 1454 |
} |
| 1455 |
}, |
| 1456 |
{ |
| 1457 |
key: "createImage", |
| 1458 |
value: function() { |
| 1459 |
var _createImage = _asyncToGenerator$1(/*#__PURE__*/ import_regenerator.default.mark(function _callee() { |
| 1460 |
var _this3 = this; |
| 1461 |
var pageLoadedPromise; |
| 1462 |
var timeOutPromise; |
| 1463 |
var $elementorElement; |
| 1464 |
var bodyStyle; |
| 1465 |
var bodyBackgroundColor; |
| 1466 |
var canvas; |
| 1467 |
return import_regenerator.default.wrap(function(_context) { |
| 1468 |
while (1) switch (_context.prev = _context.next) { |
| 1469 |
case 0: |
| 1470 |
pageLoadedPromise = new Promise(function(resolve) { |
| 1471 |
window.addEventListener("load", function() { |
| 1472 |
return resolve(); |
| 1473 |
}); |
| 1474 |
}); |
| 1475 |
timeOutPromise = new Promise(function(resolve) { |
| 1476 |
setTimeout(function() { |
| 1477 |
return resolve(); |
| 1478 |
}, _this3.getSettings("render_timeout")); |
| 1479 |
}); |
| 1480 |
_context.next = 1; |
| 1481 |
return Promise.race([pageLoadedPromise, timeOutPromise]); |
| 1482 |
case 1: |
| 1483 |
$elementorElement = this.elements.$elementor; |
| 1484 |
if (!$elementorElement.length) $elementorElement = jQuery(ElementorScreenshotConfig.selector); |
| 1485 |
if (!$elementorElement.length) $elementorElement = jQuery("body > div.elementor:not(.elementor-location-header):not(.elementor-location-footer)"); |
| 1486 |
if ($elementorElement.length) { |
| 1487 |
_context.next = 2; |
| 1488 |
break; |
| 1489 |
} |
| 1490 |
throw new Error("Elementor container not found. Selector: " + ElementorScreenshotConfig.selector); |
| 1491 |
case 2: |
| 1492 |
this.preprocessLazyImages($elementorElement); |
| 1493 |
bodyStyle = window.getComputedStyle(document.body); |
| 1494 |
bodyBackgroundColor = bodyStyle.backgroundColor; |
| 1495 |
_context.next = 3; |
| 1496 |
return toCanvas($elementorElement[0], { |
| 1497 |
quality: this.getSettings("image_quality"), |
| 1498 |
imagePlaceholder: this.getSettings("image_placeholder"), |
| 1499 |
backgroundColor: bodyBackgroundColor || null, |
| 1500 |
style: { |
| 1501 |
transform: "scale(1)", |
| 1502 |
transformOrigin: "top left" |
| 1503 |
} |
| 1504 |
}); |
| 1505 |
case 3: |
| 1506 |
canvas = _context.sent; |
| 1507 |
return _context.abrupt("return", canvas.toDataURL("image/webp", this.getSettings("image_quality"))); |
| 1508 |
case 4: |
| 1509 |
case "end": return _context.stop(); |
| 1510 |
} |
| 1511 |
}, _callee, this); |
| 1512 |
})); |
| 1513 |
function createImage() { |
| 1514 |
return _createImage.apply(this, arguments); |
| 1515 |
} |
| 1516 |
return createImage; |
| 1517 |
}() |
| 1518 |
}, |
| 1519 |
{ |
| 1520 |
key: "preprocessLazyImages", |
| 1521 |
value: function preprocessLazyImages($element) { |
| 1522 |
$element.find("img[data-src], img.swiper-lazy, img.lazy").each(function(index, img) { |
| 1523 |
var $img = jQuery(img); |
| 1524 |
if ($img.attr("data-src")) { |
| 1525 |
$img.attr("src", $img.attr("data-src")); |
| 1526 |
$img.removeAttr("data-src"); |
| 1527 |
} |
| 1528 |
$img.removeClass("swiper-lazy lazy swiper-slide-image"); |
| 1529 |
$img.removeAttr("loading"); |
| 1530 |
$img.removeAttr("data-srcset"); |
| 1531 |
}); |
| 1532 |
} |
| 1533 |
}, |
| 1534 |
{ |
| 1535 |
key: "save", |
| 1536 |
value: function save(dataUrl) { |
| 1537 |
var _this$getSaveAction = this.getSaveAction(); |
| 1538 |
var key = _this$getSaveAction.key; |
| 1539 |
var action = _this$getSaveAction.action; |
| 1540 |
var data = _defineProperty(_defineProperty({}, key, this.getSettings(key)), "screenshot", dataUrl); |
| 1541 |
return new Promise(function(resolve, reject) { |
| 1542 |
if ("kit_id" === key) return resolve(data.screenshot); |
| 1543 |
elementorCommon.ajax.addRequest(action, { |
| 1544 |
data, |
| 1545 |
success: function success(url) { |
| 1546 |
return resolve(url); |
| 1547 |
}, |
| 1548 |
error: function error() { |
| 1549 |
return reject(); |
| 1550 |
} |
| 1551 |
}); |
| 1552 |
}); |
| 1553 |
} |
| 1554 |
}, |
| 1555 |
{ |
| 1556 |
key: "markAsFailed", |
| 1557 |
value: function markAsFailed(e) { |
| 1558 |
var _this4 = this; |
| 1559 |
return new Promise(function(resolve, reject) { |
| 1560 |
var templateId = _this4.getSettings("template_id"); |
| 1561 |
var postId = _this4.getSettings("post_id"); |
| 1562 |
if (_this4.getSettings("kit_id")) resolve(); |
| 1563 |
else { |
| 1564 |
var route = templateId ? "template_screenshot_failed" : "screenshot_failed"; |
| 1565 |
var data = templateId ? { |
| 1566 |
template_id: templateId, |
| 1567 |
error: e.message || e.toString() |
| 1568 |
} : { post_id: postId }; |
| 1569 |
elementorCommon.ajax.addRequest(route, { |
| 1570 |
data, |
| 1571 |
success: function success() { |
| 1572 |
return resolve(); |
| 1573 |
}, |
| 1574 |
error: function error() { |
| 1575 |
return reject(); |
| 1576 |
} |
| 1577 |
}); |
| 1578 |
} |
| 1579 |
}); |
| 1580 |
} |
| 1581 |
}, |
| 1582 |
{ |
| 1583 |
key: "screenshotSucceed", |
| 1584 |
value: function screenshotSucceed(imageUrl) { |
| 1585 |
this.screenshotDone(true, imageUrl); |
| 1586 |
} |
| 1587 |
}, |
| 1588 |
{ |
| 1589 |
key: "screenshotFailed", |
| 1590 |
value: function screenshotFailed(e) { |
| 1591 |
var _this5 = this; |
| 1592 |
this.markAsFailed(e).then(function() { |
| 1593 |
return _this5.screenshotDone(false); |
| 1594 |
}); |
| 1595 |
} |
| 1596 |
}, |
| 1597 |
{ |
| 1598 |
key: "screenshotDone", |
| 1599 |
value: function screenshotDone(success) { |
| 1600 |
var imageUrl = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null; |
| 1601 |
clearTimeout(this.timeoutTimer); |
| 1602 |
this.timeoutTimer = null; |
| 1603 |
var _this$getSaveAction2 = this.getSaveAction(); |
| 1604 |
var message = _this$getSaveAction2.message; |
| 1605 |
var key = _this$getSaveAction2.key; |
| 1606 |
window.parent.postMessage({ |
| 1607 |
name: message, |
| 1608 |
success, |
| 1609 |
id: this.getSettings(key), |
| 1610 |
imageUrl |
| 1611 |
}, "*"); |
| 1612 |
} |
| 1613 |
}, |
| 1614 |
{ |
| 1615 |
key: "getSaveAction", |
| 1616 |
value: function getSaveAction() { |
| 1617 |
var config = this.getSettings(); |
| 1618 |
if (config.kit_id) return { |
| 1619 |
message: "kit-screenshot-done", |
| 1620 |
action: "update_kit_preview", |
| 1621 |
key: "kit_id" |
| 1622 |
}; |
| 1623 |
if (config.template_id) return { |
| 1624 |
message: "library/capture-screenshot-done", |
| 1625 |
action: "save_template_screenshot", |
| 1626 |
key: "template_id" |
| 1627 |
}; |
| 1628 |
return { |
| 1629 |
message: "capture-screenshot-done", |
| 1630 |
action: "screenshot_save", |
| 1631 |
key: "post_id" |
| 1632 |
}; |
| 1633 |
} |
| 1634 |
} |
| 1635 |
]); |
| 1636 |
}(elementorModules.ViewModule); |
| 1637 |
jQuery(function() { |
| 1638 |
new Screenshot(); |
| 1639 |
}); |
| 1640 |
|
| 1641 |
//#endregion |
| 1642 |
})(); |
| 1643 |
//# sourceMappingURL=cloud-library-screenshot.js.map |