1"use strict"; 2 3if (!Array.from) { 4 Array.from = function (object) { 5 'use strict'; 6 return [].slice.call(object); 7 }; 8} 9 10Math.imul = Math.imul || function(a, b) { 11 var ah = (a >>> 16) & 0xffff; 12 var al = a & 0xffff; 13 var bh = (b >>> 16) & 0xffff; 14 var bl = b & 0xffff; 15 // the shift by 0 fixes the sign on the high part 16 // the final |0 converts the unsigned value into a signed value 17 return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0); 18}; 19 20function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } 21 22function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 23 24function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 25 26function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 27 28function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 29 30function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 31 32function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 33 34function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 35 36function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e29) { throw _e29; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e30) { didErr = true; err = _e30; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 37 38function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 39 40function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 41 42function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 43 44function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 45 46function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 47 48function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 49 50function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } 51 52function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 53 54function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 55 56function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 57 58function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 59 60function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 61 62function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 63 64function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 65 66var rough = function () { 67 "use strict"; 68 69 function t(t, e, s) { 70 if (t && t.length) { 71 var _e2 = _slicedToArray(e, 2), 72 _n = _e2[0], 73 _o = _e2[1], 74 _a = Math.PI / 180 * s, 75 _r = Math.cos(_a), 76 _h = Math.sin(_a); 77 78 t.forEach(function (t) { 79 var _t = _slicedToArray(t, 2), 80 e = _t[0], 81 s = _t[1]; 82 83 t[0] = (e - _n) * _r - (s - _o) * _h + _n, t[1] = (e - _n) * _h + (s - _o) * _r + _o; 84 }); 85 } 86 } 87 88 function e(t) { 89 var e = t[0], 90 s = t[1]; 91 return Math.sqrt(Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2)); 92 } 93 94 function s(t, e, s, n) { 95 var o = e[1] - t[1], 96 a = t[0] - e[0], 97 r = o * t[0] + a * t[1], 98 h = n[1] - s[1], 99 i = s[0] - n[0], 100 c = h * s[0] + i * s[1], 101 l = o * i - h * a; 102 return l ? [(i * r - a * c) / l, (o * c - h * r) / l] : null; 103 } 104 105 function n(t, e, s) { 106 var n = t.length; 107 if (n < 3) return !1; 108 var h = [Number.MAX_SAFE_INTEGER, s], 109 i = [e, s]; 110 var c = 0; 111 112 for (var _e3 = 0; _e3 < n; _e3++) { 113 var _s2 = t[_e3], 114 _l = t[(_e3 + 1) % n]; 115 116 if (r(_s2, _l, i, h)) { 117 if (0 === a(_s2, i, _l)) return o(_s2, i, _l); 118 c++; 119 } 120 } 121 122 return c % 2 == 1; 123 } 124 125 function o(t, e, s) { 126 return e[0] <= Math.max(t[0], s[0]) && e[0] >= Math.min(t[0], s[0]) && e[1] <= Math.max(t[1], s[1]) && e[1] >= Math.min(t[1], s[1]); 127 } 128 129 function a(t, e, s) { 130 var n = (e[1] - t[1]) * (s[0] - e[0]) - (e[0] - t[0]) * (s[1] - e[1]); 131 return 0 === n ? 0 : n > 0 ? 1 : 2; 132 } 133 134 function r(t, e, s, n) { 135 var r = a(t, e, s), 136 h = a(t, e, n), 137 i = a(s, n, t), 138 c = a(s, n, e); 139 return r !== h && i !== c || !(0 !== r || !o(t, s, e)) || !(0 !== h || !o(t, n, e)) || !(0 !== i || !o(s, t, n)) || !(0 !== c || !o(s, e, n)); 140 } 141 142 function h(e, s) { 143 var n = [0, 0], 144 o = Math.round(s.hachureAngle + 90); 145 o && t(e, n, o); 146 147 var a = function (t, e) { 148 var s = _toConsumableArray(t); 149 150 s[0].join(",") !== s[s.length - 1].join(",") && s.push([s[0][0], s[0][1]]); 151 var n = []; 152 153 if (s && s.length > 2) { 154 var _ret = function () { 155 var t = e.hachureGap; 156 t < 0 && (t = 4 * e.strokeWidth), t = Math.max(t, .1); 157 var o = []; 158 159 for (var _t2 = 0; _t2 < s.length - 1; _t2++) { 160 var _e4 = s[_t2], 161 _n2 = s[_t2 + 1]; 162 163 if (_e4[1] !== _n2[1]) { 164 var _t3 = Math.min(_e4[1], _n2[1]); 165 166 o.push({ 167 ymin: _t3, 168 ymax: Math.max(_e4[1], _n2[1]), 169 x: _t3 === _e4[1] ? _e4[0] : _n2[0], 170 islope: (_n2[0] - _e4[0]) / (_n2[1] - _e4[1]) 171 }); 172 } 173 } 174 175 if (o.sort(function (t, e) { 176 return t.ymin < e.ymin ? -1 : t.ymin > e.ymin ? 1 : t.x < e.x ? -1 : t.x > e.x ? 1 : t.ymax === e.ymax ? 0 : (t.ymax - e.ymax) / Math.abs(t.ymax - e.ymax); 177 }), !o.length) return { 178 v: n 179 }; 180 var a = [], 181 r = o[0].ymin; 182 183 for (; a.length || o.length;) { 184 if (o.length) { 185 var _t4 = -1; 186 187 for (var _e5 = 0; _e5 < o.length && !(o[_e5].ymin > r); _e5++) { 188 _t4 = _e5; 189 } 190 191 o.splice(0, _t4 + 1).forEach(function (t) { 192 a.push({ 193 s: r, 194 edge: t 195 }); 196 }); 197 } 198 199 if (a = a.filter(function (t) { 200 return !(t.edge.ymax <= r); 201 }), a.sort(function (t, e) { 202 return t.edge.x === e.edge.x ? 0 : (t.edge.x - e.edge.x) / Math.abs(t.edge.x - e.edge.x); 203 }), a.length > 1) for (var _t5 = 0; _t5 < a.length; _t5 += 2) { 204 var _e6 = _t5 + 1; 205 206 if (_e6 >= a.length) break; 207 var _s3 = a[_t5].edge, 208 _o2 = a[_e6].edge; 209 n.push([[Math.round(_s3.x), r], [Math.round(_o2.x), r]]); 210 } 211 r += t, a.forEach(function (e) { 212 e.edge.x = e.edge.x + t * e.edge.islope; 213 }); 214 } 215 }(); 216 217 if (_typeof(_ret) === "object") return _ret.v; 218 } 219 220 return n; 221 }(e, s); 222 223 return o && (t(e, n, -o), function (e, s, n) { 224 var o = []; 225 e.forEach(function (t) { 226 return o.push.apply(o, _toConsumableArray(t)); 227 }), t(o, s, n); 228 }(a, n, -o)), a; 229 } 230 231 var i = /*#__PURE__*/function () { 232 function i(t) { 233 _classCallCheck(this, i); 234 235 this.helper = t; 236 } 237 238 _createClass(i, [{ 239 key: "fillPolygon", 240 value: function fillPolygon(t, e) { 241 return this._fillPolygon(t, e); 242 } 243 }, { 244 key: "_fillPolygon", 245 value: function _fillPolygon(t, e) { 246 var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1; 247 var n = h(t, e); 248 249 if (s) { 250 var _e7 = this.connectingLines(t, n); 251 252 n = n.concat(_e7); 253 } 254 255 return { 256 type: "fillSketch", 257 ops: this.renderLines(n, e) 258 }; 259 } 260 }, { 261 key: "renderLines", 262 value: function renderLines(t, e) { 263 var s = []; 264 265 var _iterator = _createForOfIteratorHelper(t), 266 _step; 267 268 try { 269 for (_iterator.s(); !(_step = _iterator.n()).done;) { 270 var _n3 = _step.value; 271 s.push.apply(s, _toConsumableArray(this.helper.doubleLineOps(_n3[0][0], _n3[0][1], _n3[1][0], _n3[1][1], e))); 272 } 273 } catch (err) { 274 _iterator.e(err); 275 } finally { 276 _iterator.f(); 277 } 278 279 return s; 280 } 281 }, { 282 key: "connectingLines", 283 value: function connectingLines(t, s) { 284 var n = []; 285 if (s.length > 1) for (var _o3 = 1; _o3 < s.length; _o3++) { 286 var _a2 = s[_o3 - 1]; 287 if (e(_a2) < 3) continue; 288 var _r2 = [s[_o3][0], _a2[1]]; 289 290 if (e(_r2) > 3) { 291 var _e8 = this.splitOnIntersections(t, _r2); 292 293 n.push.apply(n, _toConsumableArray(_e8)); 294 } 295 } 296 return n; 297 } 298 }, { 299 key: "midPointInPolygon", 300 value: function midPointInPolygon(t, e) { 301 return n(t, (e[0][0] + e[1][0]) / 2, (e[0][1] + e[1][1]) / 2); 302 } 303 }, { 304 key: "splitOnIntersections", 305 value: function splitOnIntersections(t, o) { 306 var a = Math.max(5, .1 * e(o)), 307 h = []; 308 309 for (var _n4 = 0; _n4 < t.length; _n4++) { 310 var _i2 = t[_n4], 311 _c = t[(_n4 + 1) % t.length]; 312 313 if (r.apply(void 0, [_i2, _c].concat(_toConsumableArray(o)))) { 314 var _t6 = s(_i2, _c, o[0], o[1]); 315 316 if (_t6) { 317 var _s4 = e([_t6, o[0]]), 318 _n5 = e([_t6, o[1]]); 319 320 _s4 > a && _n5 > a && h.push({ 321 point: _t6, 322 distance: _s4 323 }); 324 } 325 } 326 } 327 328 if (h.length > 1) { 329 var _e9 = h.sort(function (t, e) { 330 return t.distance - e.distance; 331 }).map(function (t) { 332 return t.point; 333 }); 334 335 if (n.apply(void 0, [t].concat(_toConsumableArray(o[0]))) || _e9.shift(), n.apply(void 0, [t].concat(_toConsumableArray(o[1]))) || _e9.pop(), _e9.length <= 1) return this.midPointInPolygon(t, o) ? [o] : []; 336 337 var _s5 = [o[0]].concat(_toConsumableArray(_e9), [o[1]]), 338 _a3 = []; 339 340 for (var _e10 = 0; _e10 < _s5.length - 1; _e10 += 2) { 341 var _n6 = [_s5[_e10], _s5[_e10 + 1]]; 342 this.midPointInPolygon(t, _n6) && _a3.push(_n6); 343 } 344 345 return _a3; 346 } 347 348 return this.midPointInPolygon(t, o) ? [o] : []; 349 } 350 }]); 351 352 return i; 353 }(); 354 355 var c = /*#__PURE__*/function (_i3) { 356 _inherits(c, _i3); 357 358 var _super = _createSuper(c); 359 360 function c() { 361 _classCallCheck(this, c); 362 363 return _super.apply(this, arguments); 364 } 365 366 _createClass(c, [{ 367 key: "fillPolygon", 368 value: function fillPolygon(t, e) { 369 return this._fillPolygon(t, e, !0); 370 } 371 }]); 372 373 return c; 374 }(i); 375 376 var l = /*#__PURE__*/function (_i4) { 377 _inherits(l, _i4); 378 379 var _super2 = _createSuper(l); 380 381 function l() { 382 _classCallCheck(this, l); 383 384 return _super2.apply(this, arguments); 385 } 386 387 _createClass(l, [{ 388 key: "fillPolygon", 389 value: function fillPolygon(t, e) { 390 var s = this._fillPolygon(t, e), 391 n = Object.assign({}, e, { 392 hachureAngle: e.hachureAngle + 90 393 }), 394 o = this._fillPolygon(t, n); 395 396 return s.ops = s.ops.concat(o.ops), s; 397 } 398 }]); 399 400 return l; 401 }(i); 402 403 var u = /*#__PURE__*/function () { 404 function u(t) { 405 _classCallCheck(this, u); 406 407 this.helper = t; 408 } 409 410 _createClass(u, [{ 411 key: "fillPolygon", 412 value: function fillPolygon(t, e) { 413 var s = h(t, e = Object.assign({}, e, { 414 curveStepCount: 4, 415 hachureAngle: 0, 416 roughness: 1 417 })); 418 return this.dotsOnLines(s, e); 419 } 420 }, { 421 key: "dotsOnLines", 422 value: function dotsOnLines(t, s) { 423 var n = []; 424 var o = s.hachureGap; 425 o < 0 && (o = 4 * s.strokeWidth), o = Math.max(o, .1); 426 var a = s.fillWeight; 427 a < 0 && (a = s.strokeWidth / 2); 428 var r = o / 4; 429 430 var _iterator2 = _createForOfIteratorHelper(t), 431 _step2; 432 433 try { 434 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 435 var _h2 = _step2.value; 436 437 var _t7 = e(_h2), 438 _i5 = _t7 / o, 439 _c2 = Math.ceil(_i5) - 1, 440 _l2 = _t7 - _c2 * o, 441 _u = (_h2[0][0] + _h2[1][0]) / 2 - o / 4, 442 _p = Math.min(_h2[0][1], _h2[1][1]); 443 444 for (var _t8 = 0; _t8 < _c2; _t8++) { 445 var _e11 = _p + _l2 + _t8 * o, 446 _h3 = this.helper.randOffsetWithRange(_u - r, _u + r, s), 447 _i6 = this.helper.randOffsetWithRange(_e11 - r, _e11 + r, s), 448 _c3 = this.helper.ellipse(_h3, _i6, a, a, s); 449 450 n.push.apply(n, _toConsumableArray(_c3.ops)); 451 } 452 } 453 } catch (err) { 454 _iterator2.e(err); 455 } finally { 456 _iterator2.f(); 457 } 458 459 return { 460 type: "fillSketch", 461 ops: n 462 }; 463 } 464 }]); 465 466 return u; 467 }(); 468 469 var p = /*#__PURE__*/function () { 470 function p(t) { 471 _classCallCheck(this, p); 472 473 this.helper = t; 474 } 475 476 _createClass(p, [{ 477 key: "fillPolygon", 478 value: function fillPolygon(t, e) { 479 var s = h(t, e); 480 return { 481 type: "fillSketch", 482 ops: this.dashedLine(s, e) 483 }; 484 } 485 }, { 486 key: "dashedLine", 487 value: function dashedLine(t, s) { 488 var _this = this; 489 490 var n = s.dashOffset < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashOffset, 491 o = s.dashGap < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashGap, 492 a = []; 493 return t.forEach(function (t) { 494 var r = e(t), 495 h = Math.floor(r / (n + o)), 496 i = (r + o - h * (n + o)) / 2; 497 var c = t[0], 498 l = t[1]; 499 c[0] > l[0] && (c = t[1], l = t[0]); 500 var u = Math.atan((l[1] - c[1]) / (l[0] - c[0])); 501 502 for (var _t9 = 0; _t9 < h; _t9++) { 503 var _e12 = _t9 * (n + o), 504 _r3 = _e12 + n, 505 _h4 = [c[0] + _e12 * Math.cos(u) + i * Math.cos(u), c[1] + _e12 * Math.sin(u) + i * Math.sin(u)], 506 _l3 = [c[0] + _r3 * Math.cos(u) + i * Math.cos(u), c[1] + _r3 * Math.sin(u) + i * Math.sin(u)]; 507 508 a.push.apply(a, _toConsumableArray(_this.helper.doubleLineOps(_h4[0], _h4[1], _l3[0], _l3[1], s))); 509 } 510 }), a; 511 } 512 }]); 513 514 return p; 515 }(); 516 517 var f = /*#__PURE__*/function () { 518 function f(t) { 519 _classCallCheck(this, f); 520 521 this.helper = t; 522 } 523 524 _createClass(f, [{ 525 key: "fillPolygon", 526 value: function fillPolygon(t, e) { 527 var s = e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap, 528 n = e.zigzagOffset < 0 ? s : e.zigzagOffset, 529 o = h(t, e = Object.assign({}, e, { 530 hachureGap: s + n 531 })); 532 return { 533 type: "fillSketch", 534 ops: this.zigzagLines(o, n, e) 535 }; 536 } 537 }, { 538 key: "zigzagLines", 539 value: function zigzagLines(t, s, n) { 540 var _this2 = this; 541 542 var o = []; 543 return t.forEach(function (t) { 544 var a = e(t), 545 r = Math.round(a / (2 * s)); 546 var h = t[0], 547 i = t[1]; 548 h[0] > i[0] && (h = t[1], i = t[0]); 549 var c = Math.atan((i[1] - h[1]) / (i[0] - h[0])); 550 551 for (var _t10 = 0; _t10 < r; _t10++) { 552 var _e13 = 2 * _t10 * s, 553 _a4 = 2 * (_t10 + 1) * s, 554 _r4 = Math.sqrt(2 * Math.pow(s, 2)), 555 _i7 = [h[0] + _e13 * Math.cos(c), h[1] + _e13 * Math.sin(c)], 556 _l4 = [h[0] + _a4 * Math.cos(c), h[1] + _a4 * Math.sin(c)], 557 _u2 = [_i7[0] + _r4 * Math.cos(c + Math.PI / 4), _i7[1] + _r4 * Math.sin(c + Math.PI / 4)]; 558 559 o.push.apply(o, _toConsumableArray(_this2.helper.doubleLineOps(_i7[0], _i7[1], _u2[0], _u2[1], n)).concat(_toConsumableArray(_this2.helper.doubleLineOps(_u2[0], _u2[1], _l4[0], _l4[1], n)))); 560 } 561 }), o; 562 } 563 }]); 564 565 return f; 566 }(); 567 568 var d = {}; 569 570 var g = /*#__PURE__*/function () { 571 function g(t) { 572 _classCallCheck(this, g); 573 574 this.seed = t; 575 } 576 577 _createClass(g, [{ 578 key: "next", 579 value: function next() { 580 return this.seed ? (Math.pow(2, 31) - 1 & (this.seed = Math.imul(48271, this.seed))) / Math.pow(2, 31) : Math.random(); 581 } 582 }]); 583 584 return g; 585 }(); 586 587 var M = { 588 A: 7, 589 a: 7, 590 C: 6, 591 c: 6, 592 H: 1, 593 h: 1, 594 L: 2, 595 l: 2, 596 M: 2, 597 m: 2, 598 Q: 4, 599 q: 4, 600 S: 4, 601 s: 4, 602 T: 2, 603 t: 2, 604 V: 1, 605 v: 1, 606 Z: 0, 607 z: 0 608 }; 609 610 function k(t, e) { 611 return t.type === e; 612 } 613 614 function b(t) { 615 var e = [], 616 s = function (t) { 617 var e = new Array(); 618 619 for (; "" !== t;) { 620 if (t.match(/^([ \t\r\n,]+)/)) t = t.substr(RegExp.$1.length);else if (t.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e[e.length] = { 621 type: 0, 622 text: RegExp.$1 623 }, t = t.substr(RegExp.$1.length);else { 624 if (!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return []; 625 e[e.length] = { 626 type: 1, 627 text: "".concat(parseFloat(RegExp.$1)) 628 }, t = t.substr(RegExp.$1.length); 629 } 630 } 631 632 return e[e.length] = { 633 type: 2, 634 text: "" 635 }, e; 636 }(t); 637 638 var n = "BOD", 639 o = 0, 640 a = s[o]; 641 642 for (; !k(a, 2);) { 643 var _r5 = 0; 644 var _h5 = []; 645 646 if ("BOD" === n) { 647 if ("M" !== a.text && "m" !== a.text) return b("M0,0" + t); 648 o++, _r5 = M[a.text], n = a.text; 649 } else k(a, 1) ? _r5 = M[n] : (o++, _r5 = M[a.text], n = a.text); 650 651 if (!(o + _r5 < s.length)) throw new Error("Path data ended short"); 652 653 for (var _t11 = o; _t11 < o + _r5; _t11++) { 654 var _e14 = s[_t11]; 655 if (!k(_e14, 1)) throw new Error("Param not a number: " + n + "," + _e14.text); 656 _h5[_h5.length] = +_e14.text; 657 } 658 659 if ("number" != typeof M[n]) throw new Error("Bad segment: " + n); 660 { 661 var _t12 = { 662 key: n, 663 data: _h5 664 }; 665 e.push(_t12), o += _r5, a = s[o], "M" === n && (n = "L"), "m" === n && (n = "l"); 666 } 667 } 668 669 return e; 670 } 671 672 function y(t) { 673 var _h7, _h8, _h9, _h10, _h11, _h12; 674 675 var e = 0, 676 s = 0, 677 n = 0, 678 o = 0; 679 var a = []; 680 681 var _iterator3 = _createForOfIteratorHelper(t), 682 _step3; 683 684 try { 685 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 686 var _step3$value = _step3.value, 687 _r6 = _step3$value.key, 688 _h6 = _step3$value.data; 689 690 switch (_r6) { 691 case "M": 692 a.push({ 693 key: "M", 694 data: _toConsumableArray(_h6) 695 }), (_h7 = _h6, _h8 = _slicedToArray(_h7, 2), e = _h8[0], s = _h8[1], _h7), (_h9 = _h6, _h10 = _slicedToArray(_h9, 2), n = _h10[0], o = _h10[1], _h9); 696 break; 697 698 case "m": 699 e += _h6[0], s += _h6[1], a.push({ 700 key: "M", 701 data: [e, s] 702 }), n = e, o = s; 703 break; 704 705 case "L": 706 a.push({ 707 key: "L", 708 data: _toConsumableArray(_h6) 709 }), (_h11 = _h6, _h12 = _slicedToArray(_h11, 2), e = _h12[0], s = _h12[1], _h11); 710 break; 711 712 case "l": 713 e += _h6[0], s += _h6[1], a.push({ 714 key: "L", 715 data: [e, s] 716 }); 717 break; 718 719 case "C": 720 a.push({ 721 key: "C", 722 data: _toConsumableArray(_h6) 723 }), e = _h6[4], s = _h6[5]; 724 break; 725 726 case "c": 727 { 728 var _t13 = _h6.map(function (t, n) { 729 return n % 2 ? t + s : t + e; 730 }); 731 732 a.push({ 733 key: "C", 734 data: _t13 735 }), e = _t13[4], s = _t13[5]; 736 break; 737 } 738 739 case "Q": 740 a.push({ 741 key: "Q", 742 data: _toConsumableArray(_h6) 743 }), e = _h6[2], s = _h6[3]; 744 break; 745 746 case "q": 747 { 748 var _t14 = _h6.map(function (t, n) { 749 return n % 2 ? t + s : t + e; 750 }); 751 752 a.push({ 753 key: "Q", 754 data: _t14 755 }), e = _t14[2], s = _t14[3]; 756 break; 757 } 758 759 case "A": 760 a.push({ 761 key: "A", 762 data: _toConsumableArray(_h6) 763 }), e = _h6[5], s = _h6[6]; 764 break; 765 766 case "a": 767 e += _h6[5], s += _h6[6], a.push({ 768 key: "A", 769 data: [_h6[0], _h6[1], _h6[2], _h6[3], _h6[4], e, s] 770 }); 771 break; 772 773 case "H": 774 a.push({ 775 key: "H", 776 data: _toConsumableArray(_h6) 777 }), e = _h6[0]; 778 break; 779 780 case "h": 781 e += _h6[0], a.push({ 782 key: "H", 783 data: [e] 784 }); 785 break; 786 787 case "V": 788 a.push({ 789 key: "V", 790 data: _toConsumableArray(_h6) 791 }), s = _h6[0]; 792 break; 793 794 case "v": 795 s += _h6[0], a.push({ 796 key: "V", 797 data: [s] 798 }); 799 break; 800 801 case "S": 802 a.push({ 803 key: "S", 804 data: _toConsumableArray(_h6) 805 }), e = _h6[2], s = _h6[3]; 806 break; 807 808 case "s": 809 { 810 var _t15 = _h6.map(function (t, n) { 811 return n % 2 ? t + s : t + e; 812 }); 813 814 a.push({ 815 key: "S", 816 data: _t15 817 }), e = _t15[2], s = _t15[3]; 818 break; 819 } 820 821 case "T": 822 a.push({ 823 key: "T", 824 data: _toConsumableArray(_h6) 825 }), e = _h6[0], s = _h6[1]; 826 break; 827 828 case "t": 829 e += _h6[0], s += _h6[1], a.push({ 830 key: "T", 831 data: [e, s] 832 }); 833 break; 834 835 case "Z": 836 case "z": 837 a.push({ 838 key: "Z", 839 data: [] 840 }), e = n, s = o; 841 } 842 } 843 } catch (err) { 844 _iterator3.e(err); 845 } finally { 846 _iterator3.f(); 847 } 848 849 return a; 850 } 851 852 function m(t) { 853 var _l6, _l7, _l8, _l9, _l10, _l11; 854 855 var e = []; 856 var s = "", 857 n = 0, 858 o = 0, 859 a = 0, 860 r = 0, 861 h = 0, 862 i = 0; 863 864 var _iterator4 = _createForOfIteratorHelper(t), 865 _step4; 866 867 try { 868 for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { 869 var _step4$value = _step4.value, 870 _c4 = _step4$value.key, 871 _l5 = _step4$value.data; 872 873 switch (_c4) { 874 case "M": 875 e.push({ 876 key: "M", 877 data: _toConsumableArray(_l5) 878 }), (_l6 = _l5, _l7 = _slicedToArray(_l6, 2), n = _l7[0], o = _l7[1], _l6), (_l8 = _l5, _l9 = _slicedToArray(_l8, 2), a = _l9[0], r = _l9[1], _l8); 879 break; 880 881 case "C": 882 e.push({ 883 key: "C", 884 data: _toConsumableArray(_l5) 885 }), n = _l5[4], o = _l5[5], h = _l5[2], i = _l5[3]; 886 break; 887 888 case "L": 889 e.push({ 890 key: "L", 891 data: _toConsumableArray(_l5) 892 }), (_l10 = _l5, _l11 = _slicedToArray(_l10, 2), n = _l11[0], o = _l11[1], _l10); 893 break; 894 895 case "H": 896 n = _l5[0], e.push({ 897 key: "L", 898 data: [n, o] 899 }); 900 break; 901 902 case "V": 903 o = _l5[0], e.push({ 904 key: "L", 905 data: [n, o] 906 }); 907 break; 908 909 case "S": 910 { 911 var _t16 = 0, 912 _a5 = 0; 913 "C" === s || "S" === s ? (_t16 = n + (n - h), _a5 = o + (o - i)) : (_t16 = n, _a5 = o), e.push({ 914 key: "C", 915 data: [_t16, _a5].concat(_toConsumableArray(_l5)) 916 }), h = _l5[0], i = _l5[1], n = _l5[2], o = _l5[3]; 917 break; 918 } 919 920 case "T": 921 { 922 var _l12 = _slicedToArray(_l5, 2), 923 _t17 = _l12[0], 924 _a6 = _l12[1]; 925 926 var _r7 = 0, 927 _c5 = 0; 928 "Q" === s || "T" === s ? (_r7 = n + (n - h), _c5 = o + (o - i)) : (_r7 = n, _c5 = o); 929 930 var _u3 = n + 2 * (_r7 - n) / 3, 931 _p2 = o + 2 * (_c5 - o) / 3, 932 _f = _t17 + 2 * (_r7 - _t17) / 3, 933 _d2 = _a6 + 2 * (_c5 - _a6) / 3; 934 935 e.push({ 936 key: "C", 937 data: [_u3, _p2, _f, _d2, _t17, _a6] 938 }), h = _r7, i = _c5, n = _t17, o = _a6; 939 break; 940 } 941 942 case "Q": 943 { 944 var _l13 = _slicedToArray(_l5, 4), 945 _t18 = _l13[0], 946 _s6 = _l13[1], 947 _a7 = _l13[2], 948 _r8 = _l13[3], 949 _c6 = n + 2 * (_t18 - n) / 3, 950 _u4 = o + 2 * (_s6 - o) / 3, 951 _p3 = _a7 + 2 * (_t18 - _a7) / 3, 952 _f2 = _r8 + 2 * (_s6 - _r8) / 3; 953 954 e.push({ 955 key: "C", 956 data: [_c6, _u4, _p3, _f2, _a7, _r8] 957 }), h = _t18, i = _s6, n = _a7, o = _r8; 958 break; 959 } 960 961 case "A": 962 { 963 var _t19 = Math.abs(_l5[0]), 964 _s7 = Math.abs(_l5[1]), 965 _a8 = _l5[2], 966 _r9 = _l5[3], 967 _h13 = _l5[4], 968 _i8 = _l5[5], 969 _c7 = _l5[6]; 970 971 if (0 === _t19 || 0 === _s7) e.push({ 972 key: "C", 973 data: [n, o, _i8, _c7, _i8, _c7] 974 }), n = _i8, o = _c7;else if (n !== _i8 || o !== _c7) { 975 P(n, o, _i8, _c7, _t19, _s7, _a8, _r9, _h13).forEach(function (t) { 976 e.push({ 977 key: "C", 978 data: t 979 }); 980 }), n = _i8, o = _c7; 981 } 982 break; 983 } 984 985 case "Z": 986 e.push({ 987 key: "Z", 988 data: [] 989 }), n = a, o = r; 990 } 991 992 s = _c4; 993 } 994 } catch (err) { 995 _iterator4.e(err); 996 } finally { 997 _iterator4.f(); 998 } 999 1000 return e; 1001 } 1002 1003 function w(t, e, s) { 1004 return [t * Math.cos(s) - e * Math.sin(s), t * Math.sin(s) + e * Math.cos(s)]; 1005 } 1006 1007 function P(t, e, s, n, o, a, r, h, i, c) { 1008 var l = (u = r, Math.PI * u / 180); 1009 var u; 1010 var p = [], 1011 f = 0, 1012 d = 0, 1013 g = 0, 1014 M = 0; 1015 1016 if (c) { 1017 var _c8 = _slicedToArray(c, 4); 1018 1019 f = _c8[0]; 1020 d = _c8[1]; 1021 g = _c8[2]; 1022 M = _c8[3]; 1023 } else { 1024 var _w, _w2, _w3, _w4; 1025 1026 (_w = w(t, e, -l), _w2 = _slicedToArray(_w, 2), t = _w2[0], e = _w2[1], _w), (_w3 = w(s, n, -l), _w4 = _slicedToArray(_w3, 2), s = _w4[0], n = _w4[1], _w3); 1027 1028 var _r10 = (t - s) / 2, 1029 _c9 = (e - n) / 2; 1030 1031 var _u5 = _r10 * _r10 / (o * o) + _c9 * _c9 / (a * a); 1032 1033 _u5 > 1 && (_u5 = Math.sqrt(_u5), o *= _u5, a *= _u5); 1034 1035 var _p4 = o * o, 1036 _k = a * a, 1037 _b = _p4 * _k - _p4 * _c9 * _c9 - _k * _r10 * _r10, 1038 _y = _p4 * _c9 * _c9 + _k * _r10 * _r10, 1039 _m = (h === i ? -1 : 1) * Math.sqrt(Math.abs(_b / _y)); 1040 1041 g = _m * o * _c9 / a + (t + s) / 2, M = _m * -a * _r10 / o + (e + n) / 2, f = Math.asin(parseFloat(((e - M) / a).toFixed(9))), d = Math.asin(parseFloat(((n - M) / a).toFixed(9))), t < g && (f = Math.PI - f), s < g && (d = Math.PI - d), f < 0 && (f = 2 * Math.PI + f), d < 0 && (d = 2 * Math.PI + d), i && f > d && (f -= 2 * Math.PI), !i && d > f && (d -= 2 * Math.PI); 1042 } 1043 1044 var k = d - f; 1045 1046 if (Math.abs(k) > 120 * Math.PI / 180) { 1047 var _t20 = d, 1048 _e15 = s, 1049 _h14 = n; 1050 d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p = P(s = g + o * Math.cos(d), n = M + a * Math.sin(d), _e15, _h14, o, a, r, 0, i, [d, _t20, g, M]); 1051 } 1052 1053 k = d - f; 1054 var b = Math.cos(f), 1055 y = Math.sin(f), 1056 m = Math.cos(d), 1057 x = Math.sin(d), 1058 v = Math.tan(k / 4), 1059 O = 4 / 3 * o * v, 1060 S = 4 / 3 * a * v, 1061 L = [t, e], 1062 T = [t + O * y, e - S * b], 1063 I = [s + O * x, n - S * m], 1064 A = [s, n]; 1065 if (T[0] = 2 * L[0] - T[0], T[1] = 2 * L[1] - T[1], c) return [T, I, A].concat(p); 1066 { 1067 p = [T, I, A].concat(p); 1068 var _t21 = []; 1069 1070 for (var _e16 = 0; _e16 < p.length; _e16 += 3) { 1071 var _s8 = w(p[_e16][0], p[_e16][1], l), 1072 _n7 = w(p[_e16 + 1][0], p[_e16 + 1][1], l), 1073 _o4 = w(p[_e16 + 2][0], p[_e16 + 2][1], l); 1074 1075 _t21.push([_s8[0], _s8[1], _n7[0], _n7[1], _o4[0], _o4[1]]); 1076 } 1077 1078 return _t21; 1079 } 1080 } 1081 1082 var x = { 1083 randOffset: function randOffset(t, e) { 1084 return W(t, e); 1085 }, 1086 randOffsetWithRange: function randOffsetWithRange(t, e, s) { 1087 return E(t, e, s); 1088 }, 1089 ellipse: function ellipse(t, e, s, n, o) { 1090 var a = T(s, n, o); 1091 return I(t, e, o, a).opset; 1092 }, 1093 doubleLineOps: function doubleLineOps(t, e, s, n, o) { 1094 return z(t, e, s, n, o, !0); 1095 } 1096 }; 1097 1098 function v(t, e, s, n, o) { 1099 return { 1100 type: "path", 1101 ops: z(t, e, s, n, o) 1102 }; 1103 } 1104 1105 function O(t, e, s) { 1106 var n = (t || []).length; 1107 1108 if (n > 2) { 1109 var _o5 = []; 1110 1111 for (var _e17 = 0; _e17 < n - 1; _e17++) { 1112 _o5.push.apply(_o5, _toConsumableArray(z(t[_e17][0], t[_e17][1], t[_e17 + 1][0], t[_e17 + 1][1], s))); 1113 } 1114 1115 return e && _o5.push.apply(_o5, _toConsumableArray(z(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], s))), { 1116 type: "path", 1117 ops: _o5 1118 }; 1119 } 1120 1121 return 2 === n ? v(t[0][0], t[0][1], t[1][0], t[1][1], s) : { 1122 type: "path", 1123 ops: [] 1124 }; 1125 } 1126 1127 function S(t, e, s, n, o) { 1128 return function (t, e) { 1129 return O(t, !0, e); 1130 }([[t, e], [t + s, e], [t + s, e + n], [t, e + n]], o); 1131 } 1132 1133 function L(t, e) { 1134 var s = $(t, 1 * (1 + .2 * e.roughness), e); 1135 1136 if (!e.disableMultiStroke) { 1137 var _n8 = $(t, 1.5 * (1 + .22 * e.roughness), function (t) { 1138 var e = Object.assign({}, t); 1139 e.randomizer = void 0, t.seed && (e.seed = t.seed + 1); 1140 return e; 1141 }(e)); 1142 1143 s = s.concat(_n8); 1144 } 1145 1146 return { 1147 type: "path", 1148 ops: s 1149 }; 1150 } 1151 1152 function T(t, e, s) { 1153 var n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(e / 2, 2)) / 2)), 1154 o = Math.max(s.curveStepCount, s.curveStepCount / Math.sqrt(200) * n), 1155 a = 2 * Math.PI / o; 1156 var r = Math.abs(t / 2), 1157 h = Math.abs(e / 2); 1158 var i = 1 - s.curveFitting; 1159 return r += W(r * i, s), h += W(h * i, s), { 1160 increment: a, 1161 rx: r, 1162 ry: h 1163 }; 1164 } 1165 1166 function I(t, e, s, n) { 1167 var _q = q(n.increment, t, e, n.rx, n.ry, 1, n.increment * E(.1, E(.4, 1, s), s), s), 1168 _q2 = _slicedToArray(_q, 2), 1169 o = _q2[0], 1170 a = _q2[1]; 1171 1172 var r = G(o, null, s); 1173 1174 if (!s.disableMultiStroke) { 1175 var _q3 = q(n.increment, t, e, n.rx, n.ry, 1.5, 0, s), 1176 _q4 = _slicedToArray(_q3, 1), 1177 _o6 = _q4[0], 1178 _a9 = G(_o6, null, s); 1179 1180 r = r.concat(_a9); 1181 } 1182 1183 return { 1184 estimatedPoints: a, 1185 opset: { 1186 type: "path", 1187 ops: r 1188 } 1189 }; 1190 } 1191 1192 function A(t, e, s, n, o, a, r, h, i) { 1193 var c = t, 1194 l = e; 1195 var u = Math.abs(s / 2), 1196 p = Math.abs(n / 2); 1197 u += W(.01 * u, i), p += W(.01 * p, i); 1198 var f = o, 1199 d = a; 1200 1201 for (; f < 0;) { 1202 f += 2 * Math.PI, d += 2 * Math.PI; 1203 } 1204 1205 d - f > 2 * Math.PI && (f = 0, d = 2 * Math.PI); 1206 var g = 2 * Math.PI / i.curveStepCount, 1207 M = Math.min(g / 2, (d - f) / 2), 1208 k = F(M, c, l, u, p, f, d, 1, i); 1209 1210 if (!i.disableMultiStroke) { 1211 var _t22 = F(M, c, l, u, p, f, d, 1.5, i); 1212 1213 k.push.apply(k, _toConsumableArray(_t22)); 1214 } 1215 1216 return r && (h ? k.push.apply(k, _toConsumableArray(z(c, l, c + u * Math.cos(f), l + p * Math.sin(f), i)).concat(_toConsumableArray(z(c, l, c + u * Math.cos(d), l + p * Math.sin(d), i)))) : k.push({ 1217 op: "lineTo", 1218 data: [c, l] 1219 }, { 1220 op: "lineTo", 1221 data: [c + u * Math.cos(f), l + p * Math.sin(f)] 1222 })), { 1223 type: "path", 1224 ops: k 1225 }; 1226 } 1227 1228 function D(t, e) { 1229 var s = []; 1230 1231 if (t.length) { 1232 var _n9 = e.maxRandomnessOffset || 0, 1233 _o7 = t.length; 1234 1235 if (_o7 > 2) { 1236 s.push({ 1237 op: "move", 1238 data: [t[0][0] + W(_n9, e), t[0][1] + W(_n9, e)] 1239 }); 1240 1241 for (var _a10 = 1; _a10 < _o7; _a10++) { 1242 s.push({ 1243 op: "lineTo", 1244 data: [t[_a10][0] + W(_n9, e), t[_a10][1] + W(_n9, e)] 1245 }); 1246 } 1247 } 1248 } 1249 1250 return { 1251 type: "fillPath", 1252 ops: s 1253 }; 1254 } 1255 1256 function _(t, e) { 1257 return function (t, e) { 1258 var s = t.fillStyle || "hachure"; 1259 if (!d[s]) switch (s) { 1260 case "zigzag": 1261 d[s] || (d[s] = new c(e)); 1262 break; 1263 1264 case "cross-hatch": 1265 d[s] || (d[s] = new l(e)); 1266 break; 1267 1268 case "dots": 1269 d[s] || (d[s] = new u(e)); 1270 break; 1271 1272 case "dashed": 1273 d[s] || (d[s] = new p(e)); 1274 break; 1275 1276 case "zigzag-line": 1277 d[s] || (d[s] = new f(e)); 1278 break; 1279 1280 case "hachure": 1281 default: 1282 s = "hachure", d[s] || (d[s] = new i(e)); 1283 } 1284 return d[s]; 1285 }(e, x).fillPolygon(t, e); 1286 } 1287 1288 function C(t) { 1289 return t.randomizer || (t.randomizer = new g(t.seed || 0)), t.randomizer.next(); 1290 } 1291 1292 function E(t, e, s) { 1293 var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; 1294 return s.roughness * n * (C(s) * (e - t) + t); 1295 } 1296 1297 function W(t, e) { 1298 var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; 1299 return E(-t, t, e, s); 1300 } 1301 1302 function z(t, e, s, n, o) { 1303 var a = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1; 1304 var r = a ? o.disableMultiStrokeFill : o.disableMultiStroke, 1305 h = R(t, e, s, n, o, !0, !1); 1306 if (r) return h; 1307 var i = R(t, e, s, n, o, !0, !0); 1308 return h.concat(i); 1309 } 1310 1311 function R(t, e, s, n, o, a, r) { 1312 var h = Math.pow(t - s, 2) + Math.pow(e - n, 2), 1313 i = Math.sqrt(h); 1314 var c = 1; 1315 c = i < 200 ? 1 : i > 500 ? .4 : -.0016668 * i + 1.233334; 1316 var l = o.maxRandomnessOffset || 0; 1317 l * l * 100 > h && (l = i / 10); 1318 var u = l / 2, 1319 p = .2 + .2 * C(o); 1320 var f = o.bowing * o.maxRandomnessOffset * (n - e) / 200, 1321 d = o.bowing * o.maxRandomnessOffset * (t - s) / 200; 1322 f = W(f, o, c), d = W(d, o, c); 1323 1324 var g = [], 1325 M = function M() { 1326 return W(u, o, c); 1327 }, 1328 k = function k() { 1329 return W(l, o, c); 1330 }, 1331 b = o.preserveVertices; 1332 1333 return a && (r ? g.push({ 1334 op: "move", 1335 data: [t + (b ? 0 : M()), e + (b ? 0 : M())] 1336 }) : g.push({ 1337 op: "move", 1338 data: [t + (b ? 0 : W(l, o, c)), e + (b ? 0 : W(l, o, c))] 1339 })), r ? g.push({ 1340 op: "bcurveTo", 1341 data: [f + t + (s - t) * p + M(), d + e + (n - e) * p + M(), f + t + 2 * (s - t) * p + M(), d + e + 2 * (n - e) * p + M(), s + (b ? 0 : M()), n + (b ? 0 : M())] 1342 }) : g.push({ 1343 op: "bcurveTo", 1344 data: [f + t + (s - t) * p + k(), d + e + (n - e) * p + k(), f + t + 2 * (s - t) * p + k(), d + e + 2 * (n - e) * p + k(), s + (b ? 0 : k()), n + (b ? 0 : k())] 1345 }), g; 1346 } 1347 1348 function $(t, e, s) { 1349 var n = []; 1350 n.push([t[0][0] + W(e, s), t[0][1] + W(e, s)]), n.push([t[0][0] + W(e, s), t[0][1] + W(e, s)]); 1351 1352 for (var _o8 = 1; _o8 < t.length; _o8++) { 1353 n.push([t[_o8][0] + W(e, s), t[_o8][1] + W(e, s)]), _o8 === t.length - 1 && n.push([t[_o8][0] + W(e, s), t[_o8][1] + W(e, s)]); 1354 } 1355 1356 return G(n, null, s); 1357 } 1358 1359 function G(t, e, s) { 1360 var n = t.length, 1361 o = []; 1362 1363 if (n > 3) { 1364 var _a11 = [], 1365 _r11 = 1 - s.curveTightness; 1366 1367 o.push({ 1368 op: "move", 1369 data: [t[1][0], t[1][1]] 1370 }); 1371 1372 for (var _e18 = 1; _e18 + 2 < n; _e18++) { 1373 var _s9 = t[_e18]; 1374 _a11[0] = [_s9[0], _s9[1]], _a11[1] = [_s9[0] + (_r11 * t[_e18 + 1][0] - _r11 * t[_e18 - 1][0]) / 6, _s9[1] + (_r11 * t[_e18 + 1][1] - _r11 * t[_e18 - 1][1]) / 6], _a11[2] = [t[_e18 + 1][0] + (_r11 * t[_e18][0] - _r11 * t[_e18 + 2][0]) / 6, t[_e18 + 1][1] + (_r11 * t[_e18][1] - _r11 * t[_e18 + 2][1]) / 6], _a11[3] = [t[_e18 + 1][0], t[_e18 + 1][1]], o.push({ 1375 op: "bcurveTo", 1376 data: [_a11[1][0], _a11[1][1], _a11[2][0], _a11[2][1], _a11[3][0], _a11[3][1]] 1377 }); 1378 } 1379 1380 if (e && 2 === e.length) { 1381 var _t23 = s.maxRandomnessOffset; 1382 o.push({ 1383 op: "lineTo", 1384 data: [e[0] + W(_t23, s), e[1] + W(_t23, s)] 1385 }); 1386 } 1387 } else 3 === n ? (o.push({ 1388 op: "move", 1389 data: [t[1][0], t[1][1]] 1390 }), o.push({ 1391 op: "bcurveTo", 1392 data: [t[1][0], t[1][1], t[2][0], t[2][1], t[2][0], t[2][1]] 1393 })) : 2 === n && o.push.apply(o, _toConsumableArray(z(t[0][0], t[0][1], t[1][0], t[1][1], s))); 1394 1395 return o; 1396 } 1397 1398 function q(t, e, s, n, o, a, r, h) { 1399 var i = [], 1400 c = [], 1401 l = W(.5, h) - Math.PI / 2; 1402 c.push([W(a, h) + e + .9 * n * Math.cos(l - t), W(a, h) + s + .9 * o * Math.sin(l - t)]); 1403 1404 for (var _r12 = l; _r12 < 2 * Math.PI + l - .01; _r12 += t) { 1405 var _t24 = [W(a, h) + e + n * Math.cos(_r12), W(a, h) + s + o * Math.sin(_r12)]; 1406 i.push(_t24), c.push(_t24); 1407 } 1408 1409 return c.push([W(a, h) + e + n * Math.cos(l + 2 * Math.PI + .5 * r), W(a, h) + s + o * Math.sin(l + 2 * Math.PI + .5 * r)]), c.push([W(a, h) + e + .98 * n * Math.cos(l + r), W(a, h) + s + .98 * o * Math.sin(l + r)]), c.push([W(a, h) + e + .9 * n * Math.cos(l + .5 * r), W(a, h) + s + .9 * o * Math.sin(l + .5 * r)]), [c, i]; 1410 } 1411 1412 function F(t, e, s, n, o, a, r, h, i) { 1413 var c = a + W(.1, i), 1414 l = []; 1415 l.push([W(h, i) + e + .9 * n * Math.cos(c - t), W(h, i) + s + .9 * o * Math.sin(c - t)]); 1416 1417 for (var _a12 = c; _a12 <= r; _a12 += t) { 1418 l.push([W(h, i) + e + n * Math.cos(_a12), W(h, i) + s + o * Math.sin(_a12)]); 1419 } 1420 1421 return l.push([e + n * Math.cos(r), s + o * Math.sin(r)]), l.push([e + n * Math.cos(r), s + o * Math.sin(r)]), G(l, null, i); 1422 } 1423 1424 function V(t, e, s, n, o, a, r, h) { 1425 var i = [], 1426 c = [h.maxRandomnessOffset || 1, (h.maxRandomnessOffset || 1) + .3]; 1427 var l = [0, 0]; 1428 var u = h.disableMultiStroke ? 1 : 2, 1429 p = h.preserveVertices; 1430 1431 for (var _f3 = 0; _f3 < u; _f3++) { 1432 0 === _f3 ? i.push({ 1433 op: "move", 1434 data: [r[0], r[1]] 1435 }) : i.push({ 1436 op: "move", 1437 data: [r[0] + (p ? 0 : W(c[0], h)), r[1] + (p ? 0 : W(c[0], h))] 1438 }), l = p ? [o, a] : [o + W(c[_f3], h), a + W(c[_f3], h)], i.push({ 1439 op: "bcurveTo", 1440 data: [t + W(c[_f3], h), e + W(c[_f3], h), s + W(c[_f3], h), n + W(c[_f3], h), l[0], l[1]] 1441 }); 1442 } 1443 1444 return i; 1445 } 1446 1447 function j(t) { 1448 return _toConsumableArray(t); 1449 } 1450 1451 function N(t, e) { 1452 return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2); 1453 } 1454 1455 function Z(t, e, s) { 1456 var n = N(e, s); 1457 if (0 === n) return N(t, e); 1458 var o = ((t[0] - e[0]) * (s[0] - e[0]) + (t[1] - e[1]) * (s[1] - e[1])) / n; 1459 return o = Math.max(0, Math.min(1, o)), N(t, Q(e, s, o)); 1460 } 1461 1462 function Q(t, e, s) { 1463 return [t[0] + (e[0] - t[0]) * s, t[1] + (e[1] - t[1]) * s]; 1464 } 1465 1466 function H(t, e, s, n) { 1467 var o = n || []; 1468 1469 if (function (t, e) { 1470 var s = t[e + 0], 1471 n = t[e + 1], 1472 o = t[e + 2], 1473 a = t[e + 3]; 1474 var r = 3 * n[0] - 2 * s[0] - a[0]; 1475 r *= r; 1476 var h = 3 * n[1] - 2 * s[1] - a[1]; 1477 h *= h; 1478 var i = 3 * o[0] - 2 * a[0] - s[0]; 1479 i *= i; 1480 var c = 3 * o[1] - 2 * a[1] - s[1]; 1481 return c *= c, r < i && (r = i), h < c && (h = c), r + h; 1482 }(t, e) < s) { 1483 var _s10 = t[e + 0]; 1484 1485 if (o.length) { 1486 (a = o[o.length - 1], r = _s10, Math.sqrt(N(a, r))) > 1 && o.push(_s10); 1487 } else o.push(_s10); 1488 1489 o.push(t[e + 3]); 1490 } else { 1491 var _n10 = .5, 1492 _a13 = t[e + 0], 1493 _r13 = t[e + 1], 1494 _h15 = t[e + 2], 1495 _i9 = t[e + 3], 1496 _c10 = Q(_a13, _r13, _n10), 1497 _l14 = Q(_r13, _h15, _n10), 1498 _u6 = Q(_h15, _i9, _n10), 1499 _p5 = Q(_c10, _l14, _n10), 1500 _f4 = Q(_l14, _u6, _n10), 1501 _d3 = Q(_p5, _f4, _n10); 1502 1503 H([_a13, _c10, _p5, _d3], 0, s, o), H([_d3, _f4, _u6, _i9], 0, s, o); 1504 } 1505 1506 var a, r; 1507 return o; 1508 } 1509 1510 function B(t, e) { 1511 return X(t, 0, t.length, e); 1512 } 1513 1514 function X(t, e, s, n, o) { 1515 var a = o || [], 1516 r = t[e], 1517 h = t[s - 1]; 1518 var i = 0, 1519 c = 1; 1520 1521 for (var _n11 = e + 1; _n11 < s - 1; ++_n11) { 1522 var _e19 = Z(t[_n11], r, h); 1523 1524 _e19 > i && (i = _e19, c = _n11); 1525 } 1526 1527 return Math.sqrt(i) > n ? (X(t, e, c + 1, n, a), X(t, c, s, n, a)) : (a.length || a.push(r), a.push(h)), a; 1528 } 1529 1530 function J(t) { 1531 var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .15; 1532 var s = arguments.length > 2 ? arguments[2] : undefined; 1533 var n = [], 1534 o = (t.length - 1) / 3; 1535 1536 for (var _s11 = 0; _s11 < o; _s11++) { 1537 H(t, 3 * _s11, e, n); 1538 } 1539 1540 return s && s > 0 ? X(n, 0, n.length, s) : n; 1541 } 1542 1543 var K = "none"; 1544 1545 var U = /*#__PURE__*/function () { 1546 function U(t) { 1547 _classCallCheck(this, U); 1548 1549 this.defaultOptions = { 1550 maxRandomnessOffset: 2, 1551 roughness: 1, 1552 bowing: 1, 1553 stroke: "#000", 1554 strokeWidth: 1, 1555 curveTightness: 0, 1556 curveFitting: .95, 1557 curveStepCount: 9, 1558 fillStyle: "hachure", 1559 fillWeight: -1, 1560 hachureAngle: -41, 1561 hachureGap: -1, 1562 dashOffset: -1, 1563 dashGap: -1, 1564 zigzagOffset: -1, 1565 seed: 0, 1566 combineNestedSvgPaths: !1, 1567 disableMultiStroke: !1, 1568 disableMultiStrokeFill: !1, 1569 preserveVertices: !1 1570 }, this.config = t || {}, this.config.options && (this.defaultOptions = this._o(this.config.options)); 1571 } 1572 1573 _createClass(U, [{ 1574 key: "_o", 1575 value: function _o(t) { 1576 return t ? Object.assign({}, this.defaultOptions, t) : this.defaultOptions; 1577 } 1578 }, { 1579 key: "_d", 1580 value: function _d(t, e, s) { 1581 return { 1582 shape: t, 1583 sets: e || [], 1584 options: s || this.defaultOptions 1585 }; 1586 } 1587 }, { 1588 key: "line", 1589 value: function line(t, e, s, n, o) { 1590 var a = this._o(o); 1591 1592 return this._d("line", [v(t, e, s, n, a)], a); 1593 } 1594 }, { 1595 key: "rectangle", 1596 value: function rectangle(t, e, s, n, o) { 1597 var a = this._o(o), 1598 r = [], 1599 h = S(t, e, s, n, a); 1600 1601 if (a.fill) { 1602 var _o9 = [[t, e], [t + s, e], [t + s, e + n], [t, e + n]]; 1603 "solid" === a.fillStyle ? r.push(D(_o9, a)) : r.push(_(_o9, a)); 1604 } 1605 1606 return a.stroke !== K && r.push(h), this._d("rectangle", r, a); 1607 } 1608 }, { 1609 key: "ellipse", 1610 value: function ellipse(t, e, s, n, o) { 1611 var a = this._o(o), 1612 r = [], 1613 h = T(s, n, a), 1614 i = I(t, e, a, h); 1615 1616 if (a.fill) if ("solid" === a.fillStyle) { 1617 var _s12 = I(t, e, a, h).opset; 1618 _s12.type = "fillPath", r.push(_s12); 1619 } else r.push(_(i.estimatedPoints, a)); 1620 return a.stroke !== K && r.push(i.opset), this._d("ellipse", r, a); 1621 } 1622 }, { 1623 key: "circle", 1624 value: function circle(t, e, s, n) { 1625 var o = this.ellipse(t, e, s, s, n); 1626 return o.shape = "circle", o; 1627 } 1628 }, { 1629 key: "linearPath", 1630 value: function linearPath(t, e) { 1631 var s = this._o(e); 1632 1633 return this._d("linearPath", [O(t, !1, s)], s); 1634 } 1635 }, { 1636 key: "arc", 1637 value: function arc(t, e, s, n, o, a) { 1638 var r = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1; 1639 var h = arguments.length > 7 ? arguments[7] : undefined; 1640 1641 var i = this._o(h), 1642 c = [], 1643 l = A(t, e, s, n, o, a, r, !0, i); 1644 1645 if (r && i.fill) if ("solid" === i.fillStyle) { 1646 var _r14 = A(t, e, s, n, o, a, !0, !1, i); 1647 1648 _r14.type = "fillPath", c.push(_r14); 1649 } else c.push(function (t, e, s, n, o, a, r) { 1650 var h = t, 1651 i = e; 1652 var c = Math.abs(s / 2), 1653 l = Math.abs(n / 2); 1654 c += W(.01 * c, r), l += W(.01 * l, r); 1655 var u = o, 1656 p = a; 1657 1658 for (; u < 0;) { 1659 u += 2 * Math.PI, p += 2 * Math.PI; 1660 } 1661 1662 p - u > 2 * Math.PI && (u = 0, p = 2 * Math.PI); 1663 var f = (p - u) / r.curveStepCount, 1664 d = []; 1665 1666 for (var _t25 = u; _t25 <= p; _t25 += f) { 1667 d.push([h + c * Math.cos(_t25), i + l * Math.sin(_t25)]); 1668 } 1669 1670 return d.push([h + c * Math.cos(p), i + l * Math.sin(p)]), d.push([h, i]), _(d, r); 1671 }(t, e, s, n, o, a, i)); 1672 return i.stroke !== K && c.push(l), this._d("arc", c, i); 1673 } 1674 }, { 1675 key: "curve", 1676 value: function curve(t, e) { 1677 var s = this._o(e), 1678 n = [], 1679 o = L(t, s); 1680 1681 if (s.fill && s.fill !== K && t.length >= 3) { 1682 var _e20 = J(function (t) { 1683 var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 1684 var s = t.length; 1685 if (s < 3) throw new Error("A curve must have at least three points."); 1686 var n = []; 1687 if (3 === s) n.push(j(t[0]), j(t[1]), j(t[2]), j(t[2]));else { 1688 var _s13 = []; 1689 1690 _s13.push(t[0], t[0]); 1691 1692 for (var _e21 = 1; _e21 < t.length; _e21++) { 1693 _s13.push(t[_e21]), _e21 === t.length - 1 && _s13.push(t[_e21]); 1694 } 1695 1696 var _o10 = [], 1697 _a14 = 1 - e; 1698 1699 n.push(j(_s13[0])); 1700 1701 for (var _t26 = 1; _t26 + 2 < _s13.length; _t26++) { 1702 var _e22 = _s13[_t26]; 1703 _o10[0] = [_e22[0], _e22[1]], _o10[1] = [_e22[0] + (_a14 * _s13[_t26 + 1][0] - _a14 * _s13[_t26 - 1][0]) / 6, _e22[1] + (_a14 * _s13[_t26 + 1][1] - _a14 * _s13[_t26 - 1][1]) / 6], _o10[2] = [_s13[_t26 + 1][0] + (_a14 * _s13[_t26][0] - _a14 * _s13[_t26 + 2][0]) / 6, _s13[_t26 + 1][1] + (_a14 * _s13[_t26][1] - _a14 * _s13[_t26 + 2][1]) / 6], _o10[3] = [_s13[_t26 + 1][0], _s13[_t26 + 1][1]], n.push(_o10[1], _o10[2], _o10[3]); 1704 } 1705 } 1706 return n; 1707 }(t), 10, (1 + s.roughness) / 2); 1708 1709 "solid" === s.fillStyle ? n.push(D(_e20, s)) : n.push(_(_e20, s)); 1710 } 1711 1712 return s.stroke !== K && n.push(o), this._d("curve", n, s); 1713 } 1714 }, { 1715 key: "polygon", 1716 value: function polygon(t, e) { 1717 var s = this._o(e), 1718 n = [], 1719 o = O(t, !0, s); 1720 1721 return s.fill && ("solid" === s.fillStyle ? n.push(D(t, s)) : n.push(_(t, s))), s.stroke !== K && n.push(o), this._d("polygon", n, s); 1722 } 1723 }, { 1724 key: "path", 1725 value: function path(t, e) { 1726 var s = this._o(e), 1727 n = []; 1728 1729 if (!t) return this._d("path", n, s); 1730 t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " "); 1731 1732 var o = s.fill && "transparent" !== s.fill && s.fill !== K, 1733 a = s.stroke !== K, 1734 r = !!(s.simplification && s.simplification < 1), 1735 h = function (t, e, s) { 1736 var n = m(y(b(t))), 1737 o = []; 1738 var a = [], 1739 r = [0, 0], 1740 h = []; 1741 1742 var i = function i() { 1743 var _a15; 1744 1745 h.length >= 4 && (_a15 = a).push.apply(_a15, _toConsumableArray(J(h, e))), h = []; 1746 }, 1747 c = function c() { 1748 i(), a.length && (o.push(a), a = []); 1749 }; 1750 1751 var _iterator5 = _createForOfIteratorHelper(n), 1752 _step5; 1753 1754 try { 1755 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 1756 var _step5$value = _step5.value, 1757 _t28 = _step5$value.key, 1758 _e24 = _step5$value.data; 1759 1760 switch (_t28) { 1761 case "M": 1762 c(), r = [_e24[0], _e24[1]], a.push(r); 1763 break; 1764 1765 case "L": 1766 i(), a.push([_e24[0], _e24[1]]); 1767 break; 1768 1769 case "C": 1770 if (!h.length) { 1771 var _t29 = a.length ? a[a.length - 1] : r; 1772 1773 h.push([_t29[0], _t29[1]]); 1774 } 1775 1776 h.push([_e24[0], _e24[1]]), h.push([_e24[2], _e24[3]]), h.push([_e24[4], _e24[5]]); 1777 break; 1778 1779 case "Z": 1780 i(), a.push([r[0], r[1]]); 1781 } 1782 } 1783 } catch (err) { 1784 _iterator5.e(err); 1785 } finally { 1786 _iterator5.f(); 1787 } 1788 1789 if (c(), !s) return o; 1790 var l = []; 1791 1792 for (var _i10 = 0, _o11 = o; _i10 < _o11.length; _i10++) { 1793 var _t27 = _o11[_i10]; 1794 1795 var _e23 = B(_t27, s); 1796 1797 _e23.length && l.push(_e23); 1798 } 1799 1800 return l; 1801 }(t, 1, r ? 4 - 4 * s.simplification : (1 + s.roughness) / 2); 1802 1803 if (o) if (s.combineNestedSvgPaths) { 1804 var _t30 = []; 1805 h.forEach(function (e) { 1806 return _t30.push.apply(_t30, _toConsumableArray(e)); 1807 }), "solid" === s.fillStyle ? n.push(D(_t30, s)) : n.push(_(_t30, s)); 1808 } else h.forEach(function (t) { 1809 "solid" === s.fillStyle ? n.push(D(t, s)) : n.push(_(t, s)); 1810 }); 1811 return a && (r ? h.forEach(function (t) { 1812 n.push(O(t, !1, s)); 1813 }) : n.push(function (t, e) { 1814 var s = m(y(b(t))), 1815 n = []; 1816 var o = [0, 0], 1817 a = [0, 0]; 1818 1819 var _iterator6 = _createForOfIteratorHelper(s), 1820 _step6; 1821 1822 try { 1823 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { 1824 var _step6$value = _step6.value, 1825 _t31 = _step6$value.key, 1826 _r15 = _step6$value.data; 1827 1828 switch (_t31) { 1829 case "M": 1830 { 1831 var _ret2 = function () { 1832 var t = 1 * (e.maxRandomnessOffset || 0), 1833 s = e.preserveVertices; 1834 n.push({ 1835 op: "move", 1836 data: _r15.map(function (n) { 1837 return n + (s ? 0 : W(t, e)); 1838 }) 1839 }), a = [_r15[0], _r15[1]], o = [_r15[0], _r15[1]]; 1840 return "break"; 1841 }(); 1842 1843 if (_ret2 === "break") break; 1844 } 1845 1846 case "L": 1847 n.push.apply(n, _toConsumableArray(z(a[0], a[1], _r15[0], _r15[1], e))), a = [_r15[0], _r15[1]]; 1848 break; 1849 1850 case "C": 1851 { 1852 var _r16 = _slicedToArray(_r15, 6), 1853 _t32 = _r16[0], 1854 _s14 = _r16[1], 1855 _o12 = _r16[2], 1856 _h16 = _r16[3], 1857 _i11 = _r16[4], 1858 _c11 = _r16[5]; 1859 1860 n.push.apply(n, _toConsumableArray(V(_t32, _s14, _o12, _h16, _i11, _c11, a, e))), a = [_i11, _c11]; 1861 break; 1862 } 1863 1864 case "Z": 1865 n.push.apply(n, _toConsumableArray(z(a[0], a[1], o[0], o[1], e))), a = [o[0], o[1]]; 1866 } 1867 } 1868 } catch (err) { 1869 _iterator6.e(err); 1870 } finally { 1871 _iterator6.f(); 1872 } 1873 1874 return { 1875 type: "path", 1876 ops: n 1877 }; 1878 }(t, s))), this._d("path", n, s); 1879 } 1880 }, { 1881 key: "opsToPath", 1882 value: function opsToPath(t, e) { 1883 var s = ""; 1884 1885 var _iterator7 = _createForOfIteratorHelper(t.ops), 1886 _step7; 1887 1888 try { 1889 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { 1890 var _n12 = _step7.value; 1891 1892 var _t33 = "number" == typeof e && e >= 0 ? _n12.data.map(function (t) { 1893 return +t.toFixed(e); 1894 }) : _n12.data; 1895 1896 switch (_n12.op) { 1897 case "move": 1898 s += "M".concat(_t33[0], " ").concat(_t33[1], " "); 1899 break; 1900 1901 case "bcurveTo": 1902 s += "C".concat(_t33[0], " ").concat(_t33[1], ", ").concat(_t33[2], " ").concat(_t33[3], ", ").concat(_t33[4], " ").concat(_t33[5], " "); 1903 break; 1904 1905 case "lineTo": 1906 s += "L".concat(_t33[0], " ").concat(_t33[1], " "); 1907 } 1908 } 1909 } catch (err) { 1910 _iterator7.e(err); 1911 } finally { 1912 _iterator7.f(); 1913 } 1914 1915 return s.trim(); 1916 } 1917 }, { 1918 key: "toPaths", 1919 value: function toPaths(t) { 1920 var e = t.sets || [], 1921 s = t.options || this.defaultOptions, 1922 n = []; 1923 1924 var _iterator8 = _createForOfIteratorHelper(e), 1925 _step8; 1926 1927 try { 1928 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { 1929 var _t34 = _step8.value; 1930 var _e25 = null; 1931 1932 switch (_t34.type) { 1933 case "path": 1934 _e25 = { 1935 d: this.opsToPath(_t34), 1936 stroke: s.stroke, 1937 strokeWidth: s.strokeWidth, 1938 fill: K 1939 }; 1940 break; 1941 1942 case "fillPath": 1943 _e25 = { 1944 d: this.opsToPath(_t34), 1945 stroke: K, 1946 strokeWidth: 0, 1947 fill: s.fill || K 1948 }; 1949 break; 1950 1951 case "fillSketch": 1952 _e25 = this.fillSketch(_t34, s); 1953 } 1954 1955 _e25 && n.push(_e25); 1956 } 1957 } catch (err) { 1958 _iterator8.e(err); 1959 } finally { 1960 _iterator8.f(); 1961 } 1962 1963 return n; 1964 } 1965 }, { 1966 key: "fillSketch", 1967 value: function fillSketch(t, e) { 1968 var s = e.fillWeight; 1969 return s < 0 && (s = e.strokeWidth / 2), { 1970 d: this.opsToPath(t), 1971 stroke: e.fill || K, 1972 strokeWidth: s, 1973 fill: K 1974 }; 1975 } 1976 }], [{ 1977 key: "newSeed", 1978 value: function newSeed() { 1979 return Math.floor(Math.random() * Math.pow(2, 31)); 1980 } 1981 }]); 1982 1983 return U; 1984 }(); 1985 1986 var Y = /*#__PURE__*/function () { 1987 function Y(t, e) { 1988 _classCallCheck(this, Y); 1989 1990 this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new U(e); 1991 } 1992 1993 _createClass(Y, [{ 1994 key: "draw", 1995 value: function draw(t) { 1996 var e = t.sets || [], 1997 s = t.options || this.getDefaultOptions(), 1998 n = this.ctx; 1999 2000 var _iterator9 = _createForOfIteratorHelper(e), 2001 _step9; 2002 2003 try { 2004 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { 2005 var _o13 = _step9.value; 2006 2007 switch (_o13.type) { 2008 case "path": 2009 n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n, _o13), n.restore(); 2010 break; 2011 2012 case "fillPath": 2013 n.save(), n.fillStyle = s.fill || ""; 2014 2015 var _e26 = "curve" === t.shape || "polygon" === t.shape ? "evenodd" : "nonzero"; 2016 2017 this._drawToContext(n, _o13, _e26), n.restore(); 2018 break; 2019 2020 case "fillSketch": 2021 this.fillSketch(n, _o13, s); 2022 } 2023 } 2024 } catch (err) { 2025 _iterator9.e(err); 2026 } finally { 2027 _iterator9.f(); 2028 } 2029 } 2030 }, { 2031 key: "fillSketch", 2032 value: function fillSketch(t, e, s) { 2033 var n = s.fillWeight; 2034 n < 0 && (n = s.strokeWidth / 2), t.save(), s.fillLineDash && t.setLineDash(s.fillLineDash), s.fillLineDashOffset && (t.lineDashOffset = s.fillLineDashOffset), t.strokeStyle = s.fill || "", t.lineWidth = n, this._drawToContext(t, e), t.restore(); 2035 } 2036 }, { 2037 key: "_drawToContext", 2038 value: function _drawToContext(t, e) { 2039 var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "nonzero"; 2040 t.beginPath(); 2041 2042 var _iterator10 = _createForOfIteratorHelper(e.ops), 2043 _step10; 2044 2045 try { 2046 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { 2047 var _s15 = _step10.value; 2048 var _e27 = _s15.data; 2049 2050 switch (_s15.op) { 2051 case "move": 2052 t.moveTo(_e27[0], _e27[1]); 2053 break; 2054 2055 case "bcurveTo": 2056 t.bezierCurveTo(_e27[0], _e27[1], _e27[2], _e27[3], _e27[4], _e27[5]); 2057 break; 2058 2059 case "lineTo": 2060 t.lineTo(_e27[0], _e27[1]); 2061 } 2062 } 2063 } catch (err) { 2064 _iterator10.e(err); 2065 } finally { 2066 _iterator10.f(); 2067 } 2068 2069 "fillPath" === e.type ? t.fill(s) : t.stroke(); 2070 } 2071 }, { 2072 key: "getDefaultOptions", 2073 value: function getDefaultOptions() { 2074 return this.gen.defaultOptions; 2075 } 2076 }, { 2077 key: "line", 2078 value: function line(t, e, s, n, o) { 2079 var a = this.gen.line(t, e, s, n, o); 2080 return this.draw(a), a; 2081 } 2082 }, { 2083 key: "rectangle", 2084 value: function rectangle(t, e, s, n, o) { 2085 var a = this.gen.rectangle(t, e, s, n, o); 2086 return this.draw(a), a; 2087 } 2088 }, { 2089 key: "ellipse", 2090 value: function ellipse(t, e, s, n, o) { 2091 var a = this.gen.ellipse(t, e, s, n, o); 2092 return this.draw(a), a; 2093 } 2094 }, { 2095 key: "circle", 2096 value: function circle(t, e, s, n) { 2097 var o = this.gen.circle(t, e, s, n); 2098 return this.draw(o), o; 2099 } 2100 }, { 2101 key: "linearPath", 2102 value: function linearPath(t, e) { 2103 var s = this.gen.linearPath(t, e); 2104 return this.draw(s), s; 2105 } 2106 }, { 2107 key: "polygon", 2108 value: function polygon(t, e) { 2109 var s = this.gen.polygon(t, e); 2110 return this.draw(s), s; 2111 } 2112 }, { 2113 key: "arc", 2114 value: function arc(t, e, s, n, o, a) { 2115 var r = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1; 2116 var h = arguments.length > 7 ? arguments[7] : undefined; 2117 var i = this.gen.arc(t, e, s, n, o, a, r, h); 2118 return this.draw(i), i; 2119 } 2120 }, { 2121 key: "curve", 2122 value: function curve(t, e) { 2123 var s = this.gen.curve(t, e); 2124 return this.draw(s), s; 2125 } 2126 }, { 2127 key: "path", 2128 value: function path(t, e) { 2129 var s = this.gen.path(t, e); 2130 return this.draw(s), s; 2131 } 2132 }, { 2133 key: "generator", 2134 get: function get() { 2135 return this.gen; 2136 } 2137 }]); 2138 2139 return Y; 2140 }(); 2141 2142 var tt = "http://www.w3.org/2000/svg"; 2143 2144 var et = /*#__PURE__*/function () { 2145 function et(t, e) { 2146 _classCallCheck(this, et); 2147 2148 this.svg = t, this.gen = new U(e); 2149 } 2150 2151 _createClass(et, [{ 2152 key: "draw", 2153 value: function draw(t) { 2154 var e = t.sets || [], 2155 s = t.options || this.getDefaultOptions(), 2156 n = this.svg.ownerDocument || window.document, 2157 o = n.createElementNS(tt, "g"), 2158 a = t.options.fixedDecimalPlaceDigits; 2159 2160 var _iterator11 = _createForOfIteratorHelper(e), 2161 _step11; 2162 2163 try { 2164 for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { 2165 var _r17 = _step11.value; 2166 var _e28 = null; 2167 2168 switch (_r17.type) { 2169 case "path": 2170 _e28 = n.createElementNS(tt, "path"), _e28.setAttribute("d", this.opsToPath(_r17, a)), _e28.setAttribute("stroke", s.stroke), _e28.setAttribute("stroke-width", s.strokeWidth + ""), _e28.setAttribute("fill", "none"), s.strokeLineDash && _e28.setAttribute("stroke-dasharray", s.strokeLineDash.join(" ").trim()), s.strokeLineDashOffset && _e28.setAttribute("stroke-dashoffset", "".concat(s.strokeLineDashOffset)); 2171 break; 2172 2173 case "fillPath": 2174 _e28 = n.createElementNS(tt, "path"), _e28.setAttribute("d", this.opsToPath(_r17, a)), _e28.setAttribute("stroke", "none"), _e28.setAttribute("stroke-width", "0"), _e28.setAttribute("fill", s.fill || ""), "curve" !== t.shape && "polygon" !== t.shape || _e28.setAttribute("fill-rule", "evenodd"); 2175 break; 2176 2177 case "fillSketch": 2178 _e28 = this.fillSketch(n, _r17, s); 2179 } 2180 2181 _e28 && o.appendChild(_e28); 2182 } 2183 } catch (err) { 2184 _iterator11.e(err); 2185 } finally { 2186 _iterator11.f(); 2187 } 2188 2189 return o; 2190 } 2191 }, { 2192 key: "fillSketch", 2193 value: function fillSketch(t, e, s) { 2194 var n = s.fillWeight; 2195 n < 0 && (n = s.strokeWidth / 2); 2196 var o = t.createElementNS(tt, "path"); 2197 return o.setAttribute("d", this.opsToPath(e, s.fixedDecimalPlaceDigits)), o.setAttribute("stroke", s.fill || ""), o.setAttribute("stroke-width", n + ""), o.setAttribute("fill", "none"), s.fillLineDash && o.setAttribute("stroke-dasharray", s.fillLineDash.join(" ").trim()), s.fillLineDashOffset && o.setAttribute("stroke-dashoffset", "".concat(s.fillLineDashOffset)), o; 2198 } 2199 }, { 2200 key: "getDefaultOptions", 2201 value: function getDefaultOptions() { 2202 return this.gen.defaultOptions; 2203 } 2204 }, { 2205 key: "opsToPath", 2206 value: function opsToPath(t, e) { 2207 return this.gen.opsToPath(t, e); 2208 } 2209 }, { 2210 key: "line", 2211 value: function line(t, e, s, n, o) { 2212 var a = this.gen.line(t, e, s, n, o); 2213 return this.draw(a); 2214 } 2215 }, { 2216 key: "rectangle", 2217 value: function rectangle(t, e, s, n, o) { 2218 var a = this.gen.rectangle(t, e, s, n, o); 2219 return this.draw(a); 2220 } 2221 }, { 2222 key: "ellipse", 2223 value: function ellipse(t, e, s, n, o) { 2224 var a = this.gen.ellipse(t, e, s, n, o); 2225 return this.draw(a); 2226 } 2227 }, { 2228 key: "circle", 2229 value: function circle(t, e, s, n) { 2230 var o = this.gen.circle(t, e, s, n); 2231 return this.draw(o); 2232 } 2233 }, { 2234 key: "linearPath", 2235 value: function linearPath(t, e) { 2236 var s = this.gen.linearPath(t, e); 2237 return this.draw(s); 2238 } 2239 }, { 2240 key: "polygon", 2241 value: function polygon(t, e) { 2242 var s = this.gen.polygon(t, e); 2243 return this.draw(s); 2244 } 2245 }, { 2246 key: "arc", 2247 value: function arc(t, e, s, n, o, a) { 2248 var r = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1; 2249 var h = arguments.length > 7 ? arguments[7] : undefined; 2250 var i = this.gen.arc(t, e, s, n, o, a, r, h); 2251 return this.draw(i); 2252 } 2253 }, { 2254 key: "curve", 2255 value: function curve(t, e) { 2256 var s = this.gen.curve(t, e); 2257 return this.draw(s); 2258 } 2259 }, { 2260 key: "path", 2261 value: function path(t, e) { 2262 var s = this.gen.path(t, e); 2263 return this.draw(s); 2264 } 2265 }, { 2266 key: "generator", 2267 get: function get() { 2268 return this.gen; 2269 } 2270 }]); 2271 2272 return et; 2273 }(); 2274 2275 return { 2276 canvas: function canvas(t, e) { 2277 return new Y(t, e); 2278 }, 2279 svg: function svg(t, e) { 2280 return new et(t, e); 2281 }, 2282 generator: function generator(t) { 2283 return new U(t); 2284 }, 2285 newSeed: function newSeed() { 2286 return U.newSeed(); 2287 } 2288 }; 2289}();