var Fn = Object.defineProperty;
var hn = (e, A, r) => A in e ? Fn(e, A, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[A] = r;
var SA = (e, A, r) => (hn(e, typeof A != "symbol" ? A + "" : A, r), r);
import { ViewMode as QB, UIActionHandler as dn, PluginStaticResource as En } from "@ibiz-template/runtime";
import { useWFStepTraceViewController as pn, usePropsWatch as gB, useNamespace as er, useViewController as wB, useEditView3Controller as Hn } from "@ibiz-template/vue-util";
import { defineComponent as rr, getCurrentInstance as tr, ref as _e, h as _A } from "vue";
import { ViewType as In } from "@ibiz-template/model";
import { createUUID as Qt } from "qx-util";
import { WFDynaEditView3Controller as vn, WFStepTraceViewController as mn } from "@ibiz-template/controller";
const lB = rr({
  name: "WFStepTraceGrid",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const {
      proxy: A
    } = tr(), r = pn(A, e.modelPath);
    gB(A, "deName", r.setDeName.bind(r));
    const t = er("wf-step-trace-grid"), B = _e([]), n = (a, i, o = !1) => {
      a.identitylinks.length > 0 || a.comments.length > 0 && a.comments.forEach((c) => {
        o && c.type === "启动流程" || i.push({
          id: Qt(),
          nodeName: a.userTaskName,
          personName: c.authorName,
          time: c.time,
          content: c.type,
          comment: c.fullMessage
        });
      });
    };
    r.nerve.self.evt.on("mounted", () => {
      var a;
      r.data && ((a = r.data.usertasks) == null || a.forEach((i) => {
        if (i.usertasks && i.usertasks.length > 0) {
          const o = [];
          i.usertasks.forEach((c) => {
            n(c, o, !0);
          }), B.value.push({
            id: Qt(),
            nodeName: `${i.userTaskName}`,
            personName: "",
            time: "",
            content: "",
            comment: "",
            children: o,
            _showChildren: !0
          });
        } else
          n(i, B.value);
      }), B.value.sort((i, o) => Date.parse(i.time) - Date.parse(o.time)));
    });
    const s = _e([{
      title: "处理环节",
      key: "nodeName",
      width: 250,
      resizable: !0,
      tree: !0,
      className: "clhj"
    }, {
      title: "处理人",
      key: "personName",
      width: 150,
      resizable: !0
    }, {
      title: "处理时间",
      key: "time",
      width: 180,
      resizable: !0
    }, {
      title: "处理内容",
      key: "content",
      width: 150,
      resizable: !0
    }, {
      title: "处理意见",
      key: "comment"
    }]);
    return {
      c: r,
      ns: t,
      gridData: B,
      columns: s
    };
  },
  render() {
    return _A("div", {
      class: this.ns.b()
    }, [_A("div", {
      class: this.ns.e("title")
    }, [_A("span", {
      class: this.ns.e("caption")
    }, ["审批信息"])]), _A("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData,
        "row-key": "id"
      },
      class: this.ns.e("grid")
    })]);
  }
});
class yn extends vn {
  async calcWfToolbar() {
    await super.calcWfToolbar(), this.isEditable && this.wfLinks.unshift({
      sequenceFlowName: "保存",
      type: "FORM_SAVE"
    });
  }
  async onLinkClick(A) {
    A.type === "FORM_SAVE" ? await this.save() : super.onLinkClick(A);
  }
}
const Kn = rr({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: A
    } = tr(), r = wB(A, (s, a) => new yn(e.modelPath, s, a)), t = er(`view-${In.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), B = _e(["mainForm"]);
    return {
      c: r,
      ns: t,
      onTabClick: (s) => {
        B.value.includes(s) || B.value.push(s);
      },
      lazyList: B
    };
  },
  render(e) {
    const A = [];
    if (this.c.complete) {
      const {
        activeForm: r
      } = this.c;
      r && this.c.providers[r.name] && A.push(e(this.c.providers[r.name].component, {
        props: {
          modelData: r,
          context: this.c.context,
          params: this.c.params
        },
        style: {
          height: "auto"
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit("form")
        }
      }));
    }
    if (this.c.complete && this.c.model.drTab.pages[0]) {
      const r = this.c.model.drTab.pages[0], t = this.c.drPages[r.source.name];
      A.push(e(lB, {
        attrs: {
          context: t.context,
          params: t.params,
          deName: this.c.model.appEntity.source.codeName,
          modal: this.modal,
          modelPath: r.embedView.source.modelPath
        }
      }));
    }
    return e("view-base", {
      attrs: {
        controller: this.c
      },
      scopedSlots: {
        toolbar: () => this.c.complete ? [this.c.wfLinks.length > 0 && e("wf-toolbar", {
          attrs: {
            wfLinks: this.c.wfLinks
          },
          on: {
            "wf-link-click": (r) => {
              this.c.onLinkClick(r);
            }
          }
        })] : null
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [A]), this.c.model.drTab.pages.map((r) => {
      const t = this.c.drPages[r.source.name];
      return e("i-tab-pane", {
        class: this.ns.be("", "tab-item"),
        attrs: {
          tab: this.c.model.drTab.source.name,
          disabled: this.c.isNewData,
          label: r.source.caption,
          name: r.source.name
        }
      }, [!this.c.isNewData && this.lazyList.includes(r.source.name) && e("ViewShell", {
        attrs: {
          context: t.context,
          params: t.params,
          modal: {
            mode: QB.EMBED
          },
          modelPath: r.embedView.source.modelPath,
          // 流程跟踪视图用
          deName: this.c.model.appEntity.source.codeName
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(r.source.name)
        },
        key: t.key
      })]);
    })])]);
  }
});
class Ln {
  constructor() {
    SA(this, "component", Kn);
  }
}
const bn = rr({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: A
    } = tr(), r = Hn(A, e.modelPath), t = er("view-deeditview3"), B = _e(["mainForm"]);
    return {
      c: r,
      ns: t,
      onTabClick: (s) => {
        B.value.includes(s) || B.value.push(s);
      },
      lazyList: B
    };
  },
  render(e) {
    return e("view-base", {
      attrs: {
        controller: this.c
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [e("edit-form-control", {
      attrs: {
        modelData: this.c.model.form,
        context: this.c.context,
        params: this.c.params
      },
      style: {
        height: "auto"
      },
      on: {
        neuronInit: this.c.nerve.onNeuronInit(this.c.model.form.source.name)
      }
    }), e(lB, {
      attrs: {
        context: this.c.drPages[this.c.model.drTab.pages[0].source.name].context,
        params: this.c.drPages[this.c.model.drTab.pages[0].source.name].params,
        deName: this.c.model.appEntity.source.codeName,
        modal: this.modal,
        modelPath: this.c.model.drTab.pages[0].embedView.source.modelPath
      }
    })]), this.c.model.drTab.pages.map((A) => {
      const r = this.c.drPages[A.source.name];
      if (r)
        return e("i-tab-pane", {
          class: this.ns.be("", "tab-item"),
          attrs: {
            tab: this.c.model.drTab.source.name,
            disabled: this.c.isNewData,
            label: A.source.caption,
            name: A.source.name
          }
        }, [!this.c.isNewData && this.lazyList.includes(A.source.name) && e("ViewShell", {
          attrs: {
            context: r.context,
            params: r.params,
            modal: {
              mode: QB.EMBED
            },
            modelPath: A.embedView.source.modelPath,
            // 流程跟踪视图用
            deName: this.c.model.appEntity.source.codeName
          },
          on: {
            neuronInit: this.c.nerve.onNeuronInit(A.source.name)
          },
          key: r.key
        })]);
    })])]);
  }
});
class Dn {
  constructor() {
    SA(this, "component", bn);
  }
}
/*!
 * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var Sr = function(e, A) {
  return Sr = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, t) {
    r.__proto__ = t;
  } || function(r, t) {
    for (var B in t)
      Object.prototype.hasOwnProperty.call(t, B) && (r[B] = t[B]);
  }, Sr(e, A);
};
function tA(e, A) {
  if (typeof A != "function" && A !== null)
    throw new TypeError("Class extends value " + String(A) + " is not a constructor or null");
  Sr(e, A);
  function r() {
    this.constructor = e;
  }
  e.prototype = A === null ? Object.create(A) : (r.prototype = A.prototype, new r());
}
var Or = function() {
  return Or = Object.assign || function(A) {
    for (var r, t = 1, B = arguments.length; t < B; t++) {
      r = arguments[t];
      for (var n in r)
        Object.prototype.hasOwnProperty.call(r, n) && (A[n] = r[n]);
    }
    return A;
  }, Or.apply(this, arguments);
};
function J(e, A, r, t) {
  function B(n) {
    return n instanceof r ? n : new r(function(s) {
      s(n);
    });
  }
  return new (r || (r = Promise))(function(n, s) {
    function a(c) {
      try {
        o(t.next(c));
      } catch (Q) {
        s(Q);
      }
    }
    function i(c) {
      try {
        o(t.throw(c));
      } catch (Q) {
        s(Q);
      }
    }
    function o(c) {
      c.done ? n(c.value) : B(c.value).then(a, i);
    }
    o((t = t.apply(e, A || [])).next());
  });
}
function X(e, A) {
  var r = { label: 0, sent: function() {
    if (n[0] & 1)
      throw n[1];
    return n[1];
  }, trys: [], ops: [] }, t, B, n, s;
  return s = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
    return this;
  }), s;
  function a(o) {
    return function(c) {
      return i([o, c]);
    };
  }
  function i(o) {
    if (t)
      throw new TypeError("Generator is already executing.");
    for (; r; )
      try {
        if (t = 1, B && (n = o[0] & 2 ? B.return : o[0] ? B.throw || ((n = B.return) && n.call(B), 0) : B.next) && !(n = n.call(B, o[1])).done)
          return n;
        switch (B = 0, n && (o = [o[0] & 2, n.value]), o[0]) {
          case 0:
          case 1:
            n = o;
            break;
          case 4:
            return r.label++, { value: o[1], done: !1 };
          case 5:
            r.label++, B = o[1], o = [0];
            continue;
          case 7:
            o = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (n = r.trys, !(n = n.length > 0 && n[n.length - 1]) && (o[0] === 6 || o[0] === 2)) {
              r = 0;
              continue;
            }
            if (o[0] === 3 && (!n || o[1] > n[0] && o[1] < n[3])) {
              r.label = o[1];
              break;
            }
            if (o[0] === 6 && r.label < n[1]) {
              r.label = n[1], n = o;
              break;
            }
            if (n && r.label < n[2]) {
              r.label = n[2], r.ops.push(o);
              break;
            }
            n[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        o = A.call(e, r);
      } catch (c) {
        o = [6, c], B = 0;
      } finally {
        t = n = 0;
      }
    if (o[0] & 5)
      throw o[1];
    return { value: o[0] ? o[1] : void 0, done: !0 };
  }
}
function fe(e, A, r) {
  if (r || arguments.length === 2)
    for (var t = 0, B = A.length, n; t < B; t++)
      (n || !(t in A)) && (n || (n = Array.prototype.slice.call(A, 0, t)), n[t] = A[t]);
  return e.concat(n || A);
}
var wA = (
  /** @class */
  function() {
    function e(A, r, t, B) {
      this.left = A, this.top = r, this.width = t, this.height = B;
    }
    return e.prototype.add = function(A, r, t, B) {
      return new e(this.left + A, this.top + r, this.width + t, this.height + B);
    }, e.fromClientRect = function(A, r) {
      return new e(r.left + A.windowBounds.left, r.top + A.windowBounds.top, r.width, r.height);
    }, e.fromDOMRectList = function(A, r) {
      var t = Array.from(r).find(function(B) {
        return B.width !== 0;
      });
      return t ? new e(t.left + A.windowBounds.left, t.top + A.windowBounds.top, t.width, t.height) : e.EMPTY;
    }, e.EMPTY = new e(0, 0, 0, 0), e;
  }()
), Br = function(e, A) {
  return wA.fromClientRect(e, A.getBoundingClientRect());
}, xn = function(e) {
  var A = e.body, r = e.documentElement;
  if (!A || !r)
    throw new Error("Unable to get document size");
  var t = Math.max(Math.max(A.scrollWidth, r.scrollWidth), Math.max(A.offsetWidth, r.offsetWidth), Math.max(A.clientWidth, r.clientWidth)), B = Math.max(Math.max(A.scrollHeight, r.scrollHeight), Math.max(A.offsetHeight, r.offsetHeight), Math.max(A.clientHeight, r.clientHeight));
  return new wA(0, 0, t, B);
}, nr = function(e) {
  for (var A = [], r = 0, t = e.length; r < t; ) {
    var B = e.charCodeAt(r++);
    if (B >= 55296 && B <= 56319 && r < t) {
      var n = e.charCodeAt(r++);
      (n & 64512) === 56320 ? A.push(((B & 1023) << 10) + (n & 1023) + 65536) : (A.push(B), r--);
    } else
      A.push(B);
  }
  return A;
}, S = function() {
  for (var e = [], A = 0; A < arguments.length; A++)
    e[A] = arguments[A];
  if (String.fromCodePoint)
    return String.fromCodePoint.apply(String, e);
  var r = e.length;
  if (!r)
    return "";
  for (var t = [], B = -1, n = ""; ++B < r; ) {
    var s = e[B];
    s <= 65535 ? t.push(s) : (s -= 65536, t.push((s >> 10) + 55296, s % 1024 + 56320)), (B + 1 === r || t.length > 16384) && (n += String.fromCharCode.apply(String, t), t.length = 0);
  }
  return n;
}, gt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Tn = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Ue = 0; Ue < gt.length; Ue++)
  Tn[gt.charCodeAt(Ue)] = Ue;
var wt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ae = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Fe = 0; Fe < wt.length; Fe++)
  Ae[wt.charCodeAt(Fe)] = Fe;
var Sn = function(e) {
  var A = e.length * 0.75, r = e.length, t, B = 0, n, s, a, i;
  e[e.length - 1] === "=" && (A--, e[e.length - 2] === "=" && A--);
  var o = typeof ArrayBuffer < "u" && typeof Uint8Array < "u" && typeof Uint8Array.prototype.slice < "u" ? new ArrayBuffer(A) : new Array(A), c = Array.isArray(o) ? o : new Uint8Array(o);
  for (t = 0; t < r; t += 4)
    n = Ae[e.charCodeAt(t)], s = Ae[e.charCodeAt(t + 1)], a = Ae[e.charCodeAt(t + 2)], i = Ae[e.charCodeAt(t + 3)], c[B++] = n << 2 | s >> 4, c[B++] = (s & 15) << 4 | a >> 2, c[B++] = (a & 3) << 6 | i & 63;
  return o;
}, On = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 2)
    r.push(e[t + 1] << 8 | e[t]);
  return r;
}, Mn = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 4)
    r.push(e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t]);
  return r;
}, DA = 5, Bt = 6 + 5, lr = 2, Gn = Bt - DA, uB = 65536 >> DA, Rn = 1 << DA, ur = Rn - 1, Vn = 1024 >> DA, Nn = uB + Vn, Pn = Nn, Xn = 32, _n = Pn + Xn, Jn = 65536 >> Bt, kn = 1 << Gn, Wn = kn - 1, lt = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint16Array(Array.prototype.slice.call(e, A, r));
}, Yn = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint32Array(Array.prototype.slice.call(e, A, r));
}, Zn = function(e, A) {
  var r = Sn(e), t = Array.isArray(r) ? Mn(r) : new Uint32Array(r), B = Array.isArray(r) ? On(r) : new Uint16Array(r), n = 24, s = lt(B, n / 2, t[4] / 2), a = t[5] === 2 ? lt(B, (n + t[4]) / 2) : Yn(t, Math.ceil((n + t[4]) / 4));
  return new qn(t[0], t[1], t[2], t[3], s, a);
}, qn = (
  /** @class */
  function() {
    function e(A, r, t, B, n, s) {
      this.initialValue = A, this.errorValue = r, this.highStart = t, this.highValueIndex = B, this.index = n, this.data = s;
    }
    return e.prototype.get = function(A) {
      var r;
      if (A >= 0) {
        if (A < 55296 || A > 56319 && A <= 65535)
          return r = this.index[A >> DA], r = (r << lr) + (A & ur), this.data[r];
        if (A <= 65535)
          return r = this.index[uB + (A - 55296 >> DA)], r = (r << lr) + (A & ur), this.data[r];
        if (A < this.highStart)
          return r = _n - Jn + (A >> Bt), r = this.index[r], r += A >> DA & Wn, r = this.index[r], r = (r << lr) + (A & ur), this.data[r];
        if (A <= 1114111)
          return this.data[this.highValueIndex];
      }
      return this.errorValue;
    }, e;
  }()
), ut = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", jn = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var he = 0; he < ut.length; he++)
  jn[ut.charCodeAt(he)] = he;
var zn = " ", Ct = 50, $n = 1, CB = 2, fB = 3, As = 4, es = 5, ft = 7, UB = 8, Ut = 9, FA = 10, Mr = 11, Ft = 12, Gr = 13, rs = 14, ee = 15, Rr = 16, de = 17, qA = 18, ts = 19, ht = 20, Vr = 21, jA = 22, Cr = 23, OA = 24, j = 25, re = 26, te = 27, MA = 28, Bs = 29, LA = 30, ns = 31, Ee = 32, pe = 33, Nr = 34, Pr = 35, Xr = 36, ge = 37, _r = 38, Ve = 39, Ne = 40, fr = 41, FB = 42, ss = 43, as = [9001, 65288], hB = "!", I = "×", He = "÷", Jr = Zn(zn), cA = [LA, Xr], kr = [$n, CB, fB, es], dB = [FA, UB], dt = [te, re], is = kr.concat(dB), Et = [_r, Ve, Ne, Nr, Pr], os = [ee, Gr], cs = function(e, A) {
  A === void 0 && (A = "strict");
  var r = [], t = [], B = [];
  return e.forEach(function(n, s) {
    var a = Jr.get(n);
    if (a > Ct ? (B.push(!0), a -= Ct) : B.push(!1), ["normal", "auto", "loose"].indexOf(A) !== -1 && [8208, 8211, 12316, 12448].indexOf(n) !== -1)
      return t.push(s), r.push(Rr);
    if (a === As || a === Mr) {
      if (s === 0)
        return t.push(s), r.push(LA);
      var i = r[s - 1];
      return is.indexOf(i) === -1 ? (t.push(t[s - 1]), r.push(i)) : (t.push(s), r.push(LA));
    }
    if (t.push(s), a === ns)
      return r.push(A === "strict" ? Vr : ge);
    if (a === FB || a === Bs)
      return r.push(LA);
    if (a === ss)
      return n >= 131072 && n <= 196605 || n >= 196608 && n <= 262141 ? r.push(ge) : r.push(LA);
    r.push(a);
  }), [t, r, B];
}, Ur = function(e, A, r, t) {
  var B = t[r];
  if (Array.isArray(e) ? e.indexOf(B) !== -1 : e === B)
    for (var n = r; n <= t.length; ) {
      n++;
      var s = t[n];
      if (s === A)
        return !0;
      if (s !== FA)
        break;
    }
  if (B === FA)
    for (var n = r; n > 0; ) {
      n--;
      var a = t[n];
      if (Array.isArray(e) ? e.indexOf(a) !== -1 : e === a)
        for (var i = r; i <= t.length; ) {
          i++;
          var s = t[i];
          if (s === A)
            return !0;
          if (s !== FA)
            break;
        }
      if (a !== FA)
        break;
    }
  return !1;
}, pt = function(e, A) {
  for (var r = e; r >= 0; ) {
    var t = A[r];
    if (t === FA)
      r--;
    else
      return t;
  }
  return 0;
}, Qs = function(e, A, r, t, B) {
  if (r[t] === 0)
    return I;
  var n = t - 1;
  if (Array.isArray(B) && B[n] === !0)
    return I;
  var s = n - 1, a = n + 1, i = A[n], o = s >= 0 ? A[s] : 0, c = A[a];
  if (i === CB && c === fB)
    return I;
  if (kr.indexOf(i) !== -1)
    return hB;
  if (kr.indexOf(c) !== -1 || dB.indexOf(c) !== -1)
    return I;
  if (pt(n, A) === UB)
    return He;
  if (Jr.get(e[n]) === Mr || (i === Ee || i === pe) && Jr.get(e[a]) === Mr || i === ft || c === ft || i === Ut || [FA, Gr, ee].indexOf(i) === -1 && c === Ut || [de, qA, ts, OA, MA].indexOf(c) !== -1 || pt(n, A) === jA || Ur(Cr, jA, n, A) || Ur([de, qA], Vr, n, A) || Ur(Ft, Ft, n, A))
    return I;
  if (i === FA)
    return He;
  if (i === Cr || c === Cr)
    return I;
  if (c === Rr || i === Rr)
    return He;
  if ([Gr, ee, Vr].indexOf(c) !== -1 || i === rs || o === Xr && os.indexOf(i) !== -1 || i === MA && c === Xr || c === ht || cA.indexOf(c) !== -1 && i === j || cA.indexOf(i) !== -1 && c === j || i === te && [ge, Ee, pe].indexOf(c) !== -1 || [ge, Ee, pe].indexOf(i) !== -1 && c === re || cA.indexOf(i) !== -1 && dt.indexOf(c) !== -1 || dt.indexOf(i) !== -1 && cA.indexOf(c) !== -1 || // (PR | PO) × ( OP | HY )? NU
  [te, re].indexOf(i) !== -1 && (c === j || [jA, ee].indexOf(c) !== -1 && A[a + 1] === j) || // ( OP | HY ) × NU
  [jA, ee].indexOf(i) !== -1 && c === j || // NU ×	(NU | SY | IS)
  i === j && [j, MA, OA].indexOf(c) !== -1)
    return I;
  if ([j, MA, OA, de, qA].indexOf(c) !== -1)
    for (var Q = n; Q >= 0; ) {
      var g = A[Q];
      if (g === j)
        return I;
      if ([MA, OA].indexOf(g) !== -1)
        Q--;
      else
        break;
    }
  if ([te, re].indexOf(c) !== -1)
    for (var Q = [de, qA].indexOf(i) !== -1 ? s : n; Q >= 0; ) {
      var g = A[Q];
      if (g === j)
        return I;
      if ([MA, OA].indexOf(g) !== -1)
        Q--;
      else
        break;
    }
  if (_r === i && [_r, Ve, Nr, Pr].indexOf(c) !== -1 || [Ve, Nr].indexOf(i) !== -1 && [Ve, Ne].indexOf(c) !== -1 || [Ne, Pr].indexOf(i) !== -1 && c === Ne || Et.indexOf(i) !== -1 && [ht, re].indexOf(c) !== -1 || Et.indexOf(c) !== -1 && i === te || cA.indexOf(i) !== -1 && cA.indexOf(c) !== -1 || i === OA && cA.indexOf(c) !== -1 || cA.concat(j).indexOf(i) !== -1 && c === jA && as.indexOf(e[a]) === -1 || cA.concat(j).indexOf(c) !== -1 && i === qA)
    return I;
  if (i === fr && c === fr) {
    for (var f = r[n], w = 1; f > 0 && (f--, A[f] === fr); )
      w++;
    if (w % 2 !== 0)
      return I;
  }
  return i === Ee && c === pe ? I : He;
}, gs = function(e, A) {
  A || (A = { lineBreak: "normal", wordBreak: "normal" });
  var r = cs(e, A.lineBreak), t = r[0], B = r[1], n = r[2];
  (A.wordBreak === "break-all" || A.wordBreak === "break-word") && (B = B.map(function(a) {
    return [j, LA, FB].indexOf(a) !== -1 ? ge : a;
  }));
  var s = A.wordBreak === "keep-all" ? n.map(function(a, i) {
    return a && e[i] >= 19968 && e[i] <= 40959;
  }) : void 0;
  return [t, B, s];
}, ws = (
  /** @class */
  function() {
    function e(A, r, t, B) {
      this.codePoints = A, this.required = r === hB, this.start = t, this.end = B;
    }
    return e.prototype.slice = function() {
      return S.apply(void 0, this.codePoints.slice(this.start, this.end));
    }, e;
  }()
), ls = function(e, A) {
  var r = nr(e), t = gs(r, A), B = t[0], n = t[1], s = t[2], a = r.length, i = 0, o = 0;
  return {
    next: function() {
      if (o >= a)
        return { done: !0, value: null };
      for (var c = I; o < a && (c = Qs(r, n, B, ++o, s)) === I; )
        ;
      if (c !== I || o === a) {
        var Q = new ws(r, c, i, o);
        return i = o, { value: Q, done: !1 };
      }
      return { done: !0, value: null };
    }
  };
}, us = 1 << 0, Cs = 1 << 1, ue = 1 << 2, Ht = 1 << 3, Je = 10, It = 47, ae = 92, fs = 9, Us = 32, Ie = 34, zA = 61, Fs = 35, hs = 36, ds = 37, ve = 39, me = 40, $A = 41, Es = 95, Z = 45, ps = 33, Hs = 60, Is = 62, vs = 64, ms = 91, ys = 93, Ks = 61, Ls = 123, ye = 63, bs = 125, vt = 124, Ds = 126, xs = 128, mt = 65533, Fr = 42, bA = 43, Ts = 44, Ss = 58, Os = 59, we = 46, Ms = 0, Gs = 8, Rs = 11, Vs = 14, Ns = 31, Ps = 127, nA = -1, EB = 48, pB = 97, HB = 101, Xs = 102, _s = 117, Js = 122, IB = 65, vB = 69, mB = 70, ks = 85, Ws = 90, _ = function(e) {
  return e >= EB && e <= 57;
}, Ys = function(e) {
  return e >= 55296 && e <= 57343;
}, GA = function(e) {
  return _(e) || e >= IB && e <= mB || e >= pB && e <= Xs;
}, Zs = function(e) {
  return e >= pB && e <= Js;
}, qs = function(e) {
  return e >= IB && e <= Ws;
}, js = function(e) {
  return Zs(e) || qs(e);
}, zs = function(e) {
  return e >= xs;
}, Ke = function(e) {
  return e === Je || e === fs || e === Us;
}, ke = function(e) {
  return js(e) || zs(e) || e === Es;
}, yt = function(e) {
  return ke(e) || _(e) || e === Z;
}, $s = function(e) {
  return e >= Ms && e <= Gs || e === Rs || e >= Vs && e <= Ns || e === Ps;
}, UA = function(e, A) {
  return e !== ae ? !1 : A !== Je;
}, Le = function(e, A, r) {
  return e === Z ? ke(A) || UA(A, r) : ke(e) ? !0 : !!(e === ae && UA(e, A));
}, hr = function(e, A, r) {
  return e === bA || e === Z ? _(A) ? !0 : A === we && _(r) : _(e === we ? A : e);
}, Aa = function(e) {
  var A = 0, r = 1;
  (e[A] === bA || e[A] === Z) && (e[A] === Z && (r = -1), A++);
  for (var t = []; _(e[A]); )
    t.push(e[A++]);
  var B = t.length ? parseInt(S.apply(void 0, t), 10) : 0;
  e[A] === we && A++;
  for (var n = []; _(e[A]); )
    n.push(e[A++]);
  var s = n.length, a = s ? parseInt(S.apply(void 0, n), 10) : 0;
  (e[A] === vB || e[A] === HB) && A++;
  var i = 1;
  (e[A] === bA || e[A] === Z) && (e[A] === Z && (i = -1), A++);
  for (var o = []; _(e[A]); )
    o.push(e[A++]);
  var c = o.length ? parseInt(S.apply(void 0, o), 10) : 0;
  return r * (B + a * Math.pow(10, -s)) * Math.pow(10, i * c);
}, ea = {
  type: 2
  /* LEFT_PARENTHESIS_TOKEN */
}, ra = {
  type: 3
  /* RIGHT_PARENTHESIS_TOKEN */
}, ta = {
  type: 4
  /* COMMA_TOKEN */
}, Ba = {
  type: 13
  /* SUFFIX_MATCH_TOKEN */
}, na = {
  type: 8
  /* PREFIX_MATCH_TOKEN */
}, sa = {
  type: 21
  /* COLUMN_TOKEN */
}, aa = {
  type: 9
  /* DASH_MATCH_TOKEN */
}, ia = {
  type: 10
  /* INCLUDE_MATCH_TOKEN */
}, oa = {
  type: 11
  /* LEFT_CURLY_BRACKET_TOKEN */
}, ca = {
  type: 12
  /* RIGHT_CURLY_BRACKET_TOKEN */
}, Qa = {
  type: 14
  /* SUBSTRING_MATCH_TOKEN */
}, be = {
  type: 23
  /* BAD_URL_TOKEN */
}, ga = {
  type: 1
  /* BAD_STRING_TOKEN */
}, wa = {
  type: 25
  /* CDO_TOKEN */
}, la = {
  type: 24
  /* CDC_TOKEN */
}, ua = {
  type: 26
  /* COLON_TOKEN */
}, Ca = {
  type: 27
  /* SEMICOLON_TOKEN */
}, fa = {
  type: 28
  /* LEFT_SQUARE_BRACKET_TOKEN */
}, Ua = {
  type: 29
  /* RIGHT_SQUARE_BRACKET_TOKEN */
}, Fa = {
  type: 31
  /* WHITESPACE_TOKEN */
}, Wr = {
  type: 32
  /* EOF_TOKEN */
}, yB = (
  /** @class */
  function() {
    function e() {
      this._value = [];
    }
    return e.prototype.write = function(A) {
      this._value = this._value.concat(nr(A));
    }, e.prototype.read = function() {
      for (var A = [], r = this.consumeToken(); r !== Wr; )
        A.push(r), r = this.consumeToken();
      return A;
    }, e.prototype.consumeToken = function() {
      var A = this.consumeCodePoint();
      switch (A) {
        case Ie:
          return this.consumeStringToken(Ie);
        case Fs:
          var r = this.peekCodePoint(0), t = this.peekCodePoint(1), B = this.peekCodePoint(2);
          if (yt(r) || UA(t, B)) {
            var n = Le(r, t, B) ? Cs : us, s = this.consumeName();
            return { type: 5, value: s, flags: n };
          }
          break;
        case hs:
          if (this.peekCodePoint(0) === zA)
            return this.consumeCodePoint(), Ba;
          break;
        case ve:
          return this.consumeStringToken(ve);
        case me:
          return ea;
        case $A:
          return ra;
        case Fr:
          if (this.peekCodePoint(0) === zA)
            return this.consumeCodePoint(), Qa;
          break;
        case bA:
          if (hr(A, this.peekCodePoint(0), this.peekCodePoint(1)))
            return this.reconsumeCodePoint(A), this.consumeNumericToken();
          break;
        case Ts:
          return ta;
        case Z:
          var a = A, i = this.peekCodePoint(0), o = this.peekCodePoint(1);
          if (hr(a, i, o))
            return this.reconsumeCodePoint(A), this.consumeNumericToken();
          if (Le(a, i, o))
            return this.reconsumeCodePoint(A), this.consumeIdentLikeToken();
          if (i === Z && o === Is)
            return this.consumeCodePoint(), this.consumeCodePoint(), la;
          break;
        case we:
          if (hr(A, this.peekCodePoint(0), this.peekCodePoint(1)))
            return this.reconsumeCodePoint(A), this.consumeNumericToken();
          break;
        case It:
          if (this.peekCodePoint(0) === Fr)
            for (this.consumeCodePoint(); ; ) {
              var c = this.consumeCodePoint();
              if (c === Fr && (c = this.consumeCodePoint(), c === It))
                return this.consumeToken();
              if (c === nA)
                return this.consumeToken();
            }
          break;
        case Ss:
          return ua;
        case Os:
          return Ca;
        case Hs:
          if (this.peekCodePoint(0) === ps && this.peekCodePoint(1) === Z && this.peekCodePoint(2) === Z)
            return this.consumeCodePoint(), this.consumeCodePoint(), wa;
          break;
        case vs:
          var Q = this.peekCodePoint(0), g = this.peekCodePoint(1), f = this.peekCodePoint(2);
          if (Le(Q, g, f)) {
            var s = this.consumeName();
            return { type: 7, value: s };
          }
          break;
        case ms:
          return fa;
        case ae:
          if (UA(A, this.peekCodePoint(0)))
            return this.reconsumeCodePoint(A), this.consumeIdentLikeToken();
          break;
        case ys:
          return Ua;
        case Ks:
          if (this.peekCodePoint(0) === zA)
            return this.consumeCodePoint(), na;
          break;
        case Ls:
          return oa;
        case bs:
          return ca;
        case _s:
        case ks:
          var w = this.peekCodePoint(0), l = this.peekCodePoint(1);
          return w === bA && (GA(l) || l === ye) && (this.consumeCodePoint(), this.consumeUnicodeRangeToken()), this.reconsumeCodePoint(A), this.consumeIdentLikeToken();
        case vt:
          if (this.peekCodePoint(0) === zA)
            return this.consumeCodePoint(), aa;
          if (this.peekCodePoint(0) === vt)
            return this.consumeCodePoint(), sa;
          break;
        case Ds:
          if (this.peekCodePoint(0) === zA)
            return this.consumeCodePoint(), ia;
          break;
        case nA:
          return Wr;
      }
      return Ke(A) ? (this.consumeWhiteSpace(), Fa) : _(A) ? (this.reconsumeCodePoint(A), this.consumeNumericToken()) : ke(A) ? (this.reconsumeCodePoint(A), this.consumeIdentLikeToken()) : { type: 6, value: S(A) };
    }, e.prototype.consumeCodePoint = function() {
      var A = this._value.shift();
      return typeof A > "u" ? -1 : A;
    }, e.prototype.reconsumeCodePoint = function(A) {
      this._value.unshift(A);
    }, e.prototype.peekCodePoint = function(A) {
      return A >= this._value.length ? -1 : this._value[A];
    }, e.prototype.consumeUnicodeRangeToken = function() {
      for (var A = [], r = this.consumeCodePoint(); GA(r) && A.length < 6; )
        A.push(r), r = this.consumeCodePoint();
      for (var t = !1; r === ye && A.length < 6; )
        A.push(r), r = this.consumeCodePoint(), t = !0;
      if (t) {
        var B = parseInt(S.apply(void 0, A.map(function(i) {
          return i === ye ? EB : i;
        })), 16), n = parseInt(S.apply(void 0, A.map(function(i) {
          return i === ye ? mB : i;
        })), 16);
        return { type: 30, start: B, end: n };
      }
      var s = parseInt(S.apply(void 0, A), 16);
      if (this.peekCodePoint(0) === Z && GA(this.peekCodePoint(1))) {
        this.consumeCodePoint(), r = this.consumeCodePoint();
        for (var a = []; GA(r) && a.length < 6; )
          a.push(r), r = this.consumeCodePoint();
        var n = parseInt(S.apply(void 0, a), 16);
        return { type: 30, start: s, end: n };
      } else
        return { type: 30, start: s, end: s };
    }, e.prototype.consumeIdentLikeToken = function() {
      var A = this.consumeName();
      return A.toLowerCase() === "url" && this.peekCodePoint(0) === me ? (this.consumeCodePoint(), this.consumeUrlToken()) : this.peekCodePoint(0) === me ? (this.consumeCodePoint(), { type: 19, value: A }) : { type: 20, value: A };
    }, e.prototype.consumeUrlToken = function() {
      var A = [];
      if (this.consumeWhiteSpace(), this.peekCodePoint(0) === nA)
        return { type: 22, value: "" };
      var r = this.peekCodePoint(0);
      if (r === ve || r === Ie) {
        var t = this.consumeStringToken(this.consumeCodePoint());
        return t.type === 0 && (this.consumeWhiteSpace(), this.peekCodePoint(0) === nA || this.peekCodePoint(0) === $A) ? (this.consumeCodePoint(), { type: 22, value: t.value }) : (this.consumeBadUrlRemnants(), be);
      }
      for (; ; ) {
        var B = this.consumeCodePoint();
        if (B === nA || B === $A)
          return { type: 22, value: S.apply(void 0, A) };
        if (Ke(B))
          return this.consumeWhiteSpace(), this.peekCodePoint(0) === nA || this.peekCodePoint(0) === $A ? (this.consumeCodePoint(), { type: 22, value: S.apply(void 0, A) }) : (this.consumeBadUrlRemnants(), be);
        if (B === Ie || B === ve || B === me || $s(B))
          return this.consumeBadUrlRemnants(), be;
        if (B === ae)
          if (UA(B, this.peekCodePoint(0)))
            A.push(this.consumeEscapedCodePoint());
          else
            return this.consumeBadUrlRemnants(), be;
        else
          A.push(B);
      }
    }, e.prototype.consumeWhiteSpace = function() {
      for (; Ke(this.peekCodePoint(0)); )
        this.consumeCodePoint();
    }, e.prototype.consumeBadUrlRemnants = function() {
      for (; ; ) {
        var A = this.consumeCodePoint();
        if (A === $A || A === nA)
          return;
        UA(A, this.peekCodePoint(0)) && this.consumeEscapedCodePoint();
      }
    }, e.prototype.consumeStringSlice = function(A) {
      for (var r = 5e4, t = ""; A > 0; ) {
        var B = Math.min(r, A);
        t += S.apply(void 0, this._value.splice(0, B)), A -= B;
      }
      return this._value.shift(), t;
    }, e.prototype.consumeStringToken = function(A) {
      var r = "", t = 0;
      do {
        var B = this._value[t];
        if (B === nA || B === void 0 || B === A)
          return r += this.consumeStringSlice(t), { type: 0, value: r };
        if (B === Je)
          return this._value.splice(0, t), ga;
        if (B === ae) {
          var n = this._value[t + 1];
          n !== nA && n !== void 0 && (n === Je ? (r += this.consumeStringSlice(t), t = -1, this._value.shift()) : UA(B, n) && (r += this.consumeStringSlice(t), r += S(this.consumeEscapedCodePoint()), t = -1));
        }
        t++;
      } while (!0);
    }, e.prototype.consumeNumber = function() {
      var A = [], r = ue, t = this.peekCodePoint(0);
      for ((t === bA || t === Z) && A.push(this.consumeCodePoint()); _(this.peekCodePoint(0)); )
        A.push(this.consumeCodePoint());
      t = this.peekCodePoint(0);
      var B = this.peekCodePoint(1);
      if (t === we && _(B))
        for (A.push(this.consumeCodePoint(), this.consumeCodePoint()), r = Ht; _(this.peekCodePoint(0)); )
          A.push(this.consumeCodePoint());
      t = this.peekCodePoint(0), B = this.peekCodePoint(1);
      var n = this.peekCodePoint(2);
      if ((t === vB || t === HB) && ((B === bA || B === Z) && _(n) || _(B)))
        for (A.push(this.consumeCodePoint(), this.consumeCodePoint()), r = Ht; _(this.peekCodePoint(0)); )
          A.push(this.consumeCodePoint());
      return [Aa(A), r];
    }, e.prototype.consumeNumericToken = function() {
      var A = this.consumeNumber(), r = A[0], t = A[1], B = this.peekCodePoint(0), n = this.peekCodePoint(1), s = this.peekCodePoint(2);
      if (Le(B, n, s)) {
        var a = this.consumeName();
        return { type: 15, number: r, flags: t, unit: a };
      }
      return B === ds ? (this.consumeCodePoint(), { type: 16, number: r, flags: t }) : { type: 17, number: r, flags: t };
    }, e.prototype.consumeEscapedCodePoint = function() {
      var A = this.consumeCodePoint();
      if (GA(A)) {
        for (var r = S(A); GA(this.peekCodePoint(0)) && r.length < 6; )
          r += S(this.consumeCodePoint());
        Ke(this.peekCodePoint(0)) && this.consumeCodePoint();
        var t = parseInt(r, 16);
        return t === 0 || Ys(t) || t > 1114111 ? mt : t;
      }
      return A === nA ? mt : A;
    }, e.prototype.consumeName = function() {
      for (var A = ""; ; ) {
        var r = this.consumeCodePoint();
        if (yt(r))
          A += S(r);
        else if (UA(r, this.peekCodePoint(0)))
          A += S(this.consumeEscapedCodePoint());
        else
          return this.reconsumeCodePoint(r), A;
      }
    }, e;
  }()
), KB = (
  /** @class */
  function() {
    function e(A) {
      this._tokens = A;
    }
    return e.create = function(A) {
      var r = new yB();
      return r.write(A), new e(r.read());
    }, e.parseValue = function(A) {
      return e.create(A).parseComponentValue();
    }, e.parseValues = function(A) {
      return e.create(A).parseComponentValues();
    }, e.prototype.parseComponentValue = function() {
      for (var A = this.consumeToken(); A.type === 31; )
        A = this.consumeToken();
      if (A.type === 32)
        throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
      this.reconsumeToken(A);
      var r = this.consumeComponentValue();
      do
        A = this.consumeToken();
      while (A.type === 31);
      if (A.type === 32)
        return r;
      throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
    }, e.prototype.parseComponentValues = function() {
      for (var A = []; ; ) {
        var r = this.consumeComponentValue();
        if (r.type === 32)
          return A;
        A.push(r), A.push();
      }
    }, e.prototype.consumeComponentValue = function() {
      var A = this.consumeToken();
      switch (A.type) {
        case 11:
        case 28:
        case 2:
          return this.consumeSimpleBlock(A.type);
        case 19:
          return this.consumeFunction(A);
      }
      return A;
    }, e.prototype.consumeSimpleBlock = function(A) {
      for (var r = { type: A, values: [] }, t = this.consumeToken(); ; ) {
        if (t.type === 32 || da(t, A))
          return r;
        this.reconsumeToken(t), r.values.push(this.consumeComponentValue()), t = this.consumeToken();
      }
    }, e.prototype.consumeFunction = function(A) {
      for (var r = {
        name: A.value,
        values: [],
        type: 18
        /* FUNCTION */
      }; ; ) {
        var t = this.consumeToken();
        if (t.type === 32 || t.type === 3)
          return r;
        this.reconsumeToken(t), r.values.push(this.consumeComponentValue());
      }
    }, e.prototype.consumeToken = function() {
      var A = this._tokens.shift();
      return typeof A > "u" ? Wr : A;
    }, e.prototype.reconsumeToken = function(A) {
      this._tokens.unshift(A);
    }, e;
  }()
), Ce = function(e) {
  return e.type === 15;
}, YA = function(e) {
  return e.type === 17;
}, b = function(e) {
  return e.type === 20;
}, ha = function(e) {
  return e.type === 0;
}, Yr = function(e, A) {
  return b(e) && e.value === A;
}, LB = function(e) {
  return e.type !== 31;
}, WA = function(e) {
  return e.type !== 31 && e.type !== 4;
}, sA = function(e) {
  var A = [], r = [];
  return e.forEach(function(t) {
    if (t.type === 4) {
      if (r.length === 0)
        throw new Error("Error parsing function args, zero tokens for arg");
      A.push(r), r = [];
      return;
    }
    t.type !== 31 && r.push(t);
  }), r.length && A.push(r), A;
}, da = function(e, A) {
  return A === 11 && e.type === 12 || A === 28 && e.type === 29 ? !0 : A === 2 && e.type === 3;
}, HA = function(e) {
  return e.type === 17 || e.type === 15;
}, M = function(e) {
  return e.type === 16 || HA(e);
}, bB = function(e) {
  return e.length > 1 ? [e[0], e[1]] : [e[0]];
}, P = {
  type: 17,
  number: 0,
  flags: ue
}, nt = {
  type: 16,
  number: 50,
  flags: ue
}, hA = {
  type: 16,
  number: 100,
  flags: ue
}, Be = function(e, A, r) {
  var t = e[0], B = e[1];
  return [D(t, A), D(typeof B < "u" ? B : t, r)];
}, D = function(e, A) {
  if (e.type === 16)
    return e.number / 100 * A;
  if (Ce(e))
    switch (e.unit) {
      case "rem":
      case "em":
        return 16 * e.number;
      case "px":
      default:
        return e.number;
    }
  return e.number;
}, DB = "deg", xB = "grad", TB = "rad", SB = "turn", sr = {
  name: "angle",
  parse: function(e, A) {
    if (A.type === 15)
      switch (A.unit) {
        case DB:
          return Math.PI * A.number / 180;
        case xB:
          return Math.PI / 200 * A.number;
        case TB:
          return A.number;
        case SB:
          return Math.PI * 2 * A.number;
      }
    throw new Error("Unsupported angle type");
  }
}, OB = function(e) {
  return e.type === 15 && (e.unit === DB || e.unit === xB || e.unit === TB || e.unit === SB);
}, MB = function(e) {
  var A = e.filter(b).map(function(r) {
    return r.value;
  }).join(" ");
  switch (A) {
    case "to bottom right":
    case "to right bottom":
    case "left top":
    case "top left":
      return [P, P];
    case "to top":
    case "bottom":
      return AA(0);
    case "to bottom left":
    case "to left bottom":
    case "right top":
    case "top right":
      return [P, hA];
    case "to right":
    case "left":
      return AA(90);
    case "to top left":
    case "to left top":
    case "right bottom":
    case "bottom right":
      return [hA, hA];
    case "to bottom":
    case "top":
      return AA(180);
    case "to top right":
    case "to right top":
    case "left bottom":
    case "bottom left":
      return [hA, P];
    case "to left":
    case "right":
      return AA(270);
  }
  return 0;
}, AA = function(e) {
  return Math.PI * e / 180;
}, EA = {
  name: "color",
  parse: function(e, A) {
    if (A.type === 18) {
      var r = Ea[A.name];
      if (typeof r > "u")
        throw new Error('Attempting to parse an unsupported color function "' + A.name + '"');
      return r(e, A.values);
    }
    if (A.type === 5) {
      if (A.value.length === 3) {
        var t = A.value.substring(0, 1), B = A.value.substring(1, 2), n = A.value.substring(2, 3);
        return dA(parseInt(t + t, 16), parseInt(B + B, 16), parseInt(n + n, 16), 1);
      }
      if (A.value.length === 4) {
        var t = A.value.substring(0, 1), B = A.value.substring(1, 2), n = A.value.substring(2, 3), s = A.value.substring(3, 4);
        return dA(parseInt(t + t, 16), parseInt(B + B, 16), parseInt(n + n, 16), parseInt(s + s, 16) / 255);
      }
      if (A.value.length === 6) {
        var t = A.value.substring(0, 2), B = A.value.substring(2, 4), n = A.value.substring(4, 6);
        return dA(parseInt(t, 16), parseInt(B, 16), parseInt(n, 16), 1);
      }
      if (A.value.length === 8) {
        var t = A.value.substring(0, 2), B = A.value.substring(2, 4), n = A.value.substring(4, 6), s = A.value.substring(6, 8);
        return dA(parseInt(t, 16), parseInt(B, 16), parseInt(n, 16), parseInt(s, 16) / 255);
      }
    }
    if (A.type === 20) {
      var a = gA[A.value.toUpperCase()];
      if (typeof a < "u")
        return a;
    }
    return gA.TRANSPARENT;
  }
}, pA = function(e) {
  return (255 & e) === 0;
}, R = function(e) {
  var A = 255 & e, r = 255 & e >> 8, t = 255 & e >> 16, B = 255 & e >> 24;
  return A < 255 ? "rgba(" + B + "," + t + "," + r + "," + A / 255 + ")" : "rgb(" + B + "," + t + "," + r + ")";
}, dA = function(e, A, r, t) {
  return (e << 24 | A << 16 | r << 8 | Math.round(t * 255) << 0) >>> 0;
}, Kt = function(e, A) {
  if (e.type === 17)
    return e.number;
  if (e.type === 16) {
    var r = A === 3 ? 1 : 255;
    return A === 3 ? e.number / 100 * r : Math.round(e.number / 100 * r);
  }
  return 0;
}, Lt = function(e, A) {
  var r = A.filter(WA);
  if (r.length === 3) {
    var t = r.map(Kt), B = t[0], n = t[1], s = t[2];
    return dA(B, n, s, 1);
  }
  if (r.length === 4) {
    var a = r.map(Kt), B = a[0], n = a[1], s = a[2], i = a[3];
    return dA(B, n, s, i);
  }
  return 0;
};
function dr(e, A, r) {
  return r < 0 && (r += 1), r >= 1 && (r -= 1), r < 1 / 6 ? (A - e) * r * 6 + e : r < 1 / 2 ? A : r < 2 / 3 ? (A - e) * 6 * (2 / 3 - r) + e : e;
}
var bt = function(e, A) {
  var r = A.filter(WA), t = r[0], B = r[1], n = r[2], s = r[3], a = (t.type === 17 ? AA(t.number) : sr.parse(e, t)) / (Math.PI * 2), i = M(B) ? B.number / 100 : 0, o = M(n) ? n.number / 100 : 0, c = typeof s < "u" && M(s) ? D(s, 1) : 1;
  if (i === 0)
    return dA(o * 255, o * 255, o * 255, 1);
  var Q = o <= 0.5 ? o * (i + 1) : o + i - o * i, g = o * 2 - Q, f = dr(g, Q, a + 1 / 3), w = dr(g, Q, a), l = dr(g, Q, a - 1 / 3);
  return dA(f * 255, w * 255, l * 255, c);
}, Ea = {
  hsl: bt,
  hsla: bt,
  rgb: Lt,
  rgba: Lt
}, ie = function(e, A) {
  return EA.parse(e, KB.create(A).parseComponentValue());
}, gA = {
  ALICEBLUE: 4042850303,
  ANTIQUEWHITE: 4209760255,
  AQUA: 16777215,
  AQUAMARINE: 2147472639,
  AZURE: 4043309055,
  BEIGE: 4126530815,
  BISQUE: 4293182719,
  BLACK: 255,
  BLANCHEDALMOND: 4293643775,
  BLUE: 65535,
  BLUEVIOLET: 2318131967,
  BROWN: 2771004159,
  BURLYWOOD: 3736635391,
  CADETBLUE: 1604231423,
  CHARTREUSE: 2147418367,
  CHOCOLATE: 3530104575,
  CORAL: 4286533887,
  CORNFLOWERBLUE: 1687547391,
  CORNSILK: 4294499583,
  CRIMSON: 3692313855,
  CYAN: 16777215,
  DARKBLUE: 35839,
  DARKCYAN: 9145343,
  DARKGOLDENROD: 3095837695,
  DARKGRAY: 2846468607,
  DARKGREEN: 6553855,
  DARKGREY: 2846468607,
  DARKKHAKI: 3182914559,
  DARKMAGENTA: 2332068863,
  DARKOLIVEGREEN: 1433087999,
  DARKORANGE: 4287365375,
  DARKORCHID: 2570243327,
  DARKRED: 2332033279,
  DARKSALMON: 3918953215,
  DARKSEAGREEN: 2411499519,
  DARKSLATEBLUE: 1211993087,
  DARKSLATEGRAY: 793726975,
  DARKSLATEGREY: 793726975,
  DARKTURQUOISE: 13554175,
  DARKVIOLET: 2483082239,
  DEEPPINK: 4279538687,
  DEEPSKYBLUE: 12582911,
  DIMGRAY: 1768516095,
  DIMGREY: 1768516095,
  DODGERBLUE: 512819199,
  FIREBRICK: 2988581631,
  FLORALWHITE: 4294635775,
  FORESTGREEN: 579543807,
  FUCHSIA: 4278255615,
  GAINSBORO: 3705462015,
  GHOSTWHITE: 4177068031,
  GOLD: 4292280575,
  GOLDENROD: 3668254975,
  GRAY: 2155905279,
  GREEN: 8388863,
  GREENYELLOW: 2919182335,
  GREY: 2155905279,
  HONEYDEW: 4043305215,
  HOTPINK: 4285117695,
  INDIANRED: 3445382399,
  INDIGO: 1258324735,
  IVORY: 4294963455,
  KHAKI: 4041641215,
  LAVENDER: 3873897215,
  LAVENDERBLUSH: 4293981695,
  LAWNGREEN: 2096890111,
  LEMONCHIFFON: 4294626815,
  LIGHTBLUE: 2916673279,
  LIGHTCORAL: 4034953471,
  LIGHTCYAN: 3774873599,
  LIGHTGOLDENRODYELLOW: 4210742015,
  LIGHTGRAY: 3553874943,
  LIGHTGREEN: 2431553791,
  LIGHTGREY: 3553874943,
  LIGHTPINK: 4290167295,
  LIGHTSALMON: 4288707327,
  LIGHTSEAGREEN: 548580095,
  LIGHTSKYBLUE: 2278488831,
  LIGHTSLATEGRAY: 2005441023,
  LIGHTSLATEGREY: 2005441023,
  LIGHTSTEELBLUE: 2965692159,
  LIGHTYELLOW: 4294959359,
  LIME: 16711935,
  LIMEGREEN: 852308735,
  LINEN: 4210091775,
  MAGENTA: 4278255615,
  MAROON: 2147483903,
  MEDIUMAQUAMARINE: 1724754687,
  MEDIUMBLUE: 52735,
  MEDIUMORCHID: 3126187007,
  MEDIUMPURPLE: 2473647103,
  MEDIUMSEAGREEN: 1018393087,
  MEDIUMSLATEBLUE: 2070474495,
  MEDIUMSPRINGGREEN: 16423679,
  MEDIUMTURQUOISE: 1221709055,
  MEDIUMVIOLETRED: 3340076543,
  MIDNIGHTBLUE: 421097727,
  MINTCREAM: 4127193855,
  MISTYROSE: 4293190143,
  MOCCASIN: 4293178879,
  NAVAJOWHITE: 4292783615,
  NAVY: 33023,
  OLDLACE: 4260751103,
  OLIVE: 2155872511,
  OLIVEDRAB: 1804477439,
  ORANGE: 4289003775,
  ORANGERED: 4282712319,
  ORCHID: 3664828159,
  PALEGOLDENROD: 4008225535,
  PALEGREEN: 2566625535,
  PALETURQUOISE: 2951671551,
  PALEVIOLETRED: 3681588223,
  PAPAYAWHIP: 4293907967,
  PEACHPUFF: 4292524543,
  PERU: 3448061951,
  PINK: 4290825215,
  PLUM: 3718307327,
  POWDERBLUE: 2967529215,
  PURPLE: 2147516671,
  REBECCAPURPLE: 1714657791,
  RED: 4278190335,
  ROSYBROWN: 3163525119,
  ROYALBLUE: 1097458175,
  SADDLEBROWN: 2336560127,
  SALMON: 4202722047,
  SANDYBROWN: 4104413439,
  SEAGREEN: 780883967,
  SEASHELL: 4294307583,
  SIENNA: 2689740287,
  SILVER: 3233857791,
  SKYBLUE: 2278484991,
  SLATEBLUE: 1784335871,
  SLATEGRAY: 1887473919,
  SLATEGREY: 1887473919,
  SNOW: 4294638335,
  SPRINGGREEN: 16744447,
  STEELBLUE: 1182971135,
  TAN: 3535047935,
  TEAL: 8421631,
  THISTLE: 3636451583,
  TOMATO: 4284696575,
  TRANSPARENT: 0,
  TURQUOISE: 1088475391,
  VIOLET: 4001558271,
  WHEAT: 4125012991,
  WHITE: 4294967295,
  WHITESMOKE: 4126537215,
  YELLOW: 4294902015,
  YELLOWGREEN: 2597139199
}, pa = {
  name: "background-clip",
  initialValue: "border-box",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.map(function(r) {
      if (b(r))
        switch (r.value) {
          case "padding-box":
            return 1;
          case "content-box":
            return 2;
        }
      return 0;
    });
  }
}, Ha = {
  name: "background-color",
  initialValue: "transparent",
  prefix: !1,
  type: 3,
  format: "color"
}, ar = function(e, A) {
  var r = EA.parse(e, A[0]), t = A[1];
  return t && M(t) ? { color: r, stop: t } : { color: r, stop: null };
}, Dt = function(e, A) {
  var r = e[0], t = e[e.length - 1];
  r.stop === null && (r.stop = P), t.stop === null && (t.stop = hA);
  for (var B = [], n = 0, s = 0; s < e.length; s++) {
    var a = e[s].stop;
    if (a !== null) {
      var i = D(a, A);
      i > n ? B.push(i) : B.push(n), n = i;
    } else
      B.push(null);
  }
  for (var o = null, s = 0; s < B.length; s++) {
    var c = B[s];
    if (c === null)
      o === null && (o = s);
    else if (o !== null) {
      for (var Q = s - o, g = B[o - 1], f = (c - g) / (Q + 1), w = 1; w <= Q; w++)
        B[o + w - 1] = f * w;
      o = null;
    }
  }
  return e.map(function(l, p) {
    var h = l.color;
    return { color: h, stop: Math.max(Math.min(1, B[p] / A), 0) };
  });
}, Ia = function(e, A, r) {
  var t = A / 2, B = r / 2, n = D(e[0], A) - t, s = B - D(e[1], r);
  return (Math.atan2(s, n) + Math.PI * 2) % (Math.PI * 2);
}, va = function(e, A, r) {
  var t = typeof e == "number" ? e : Ia(e, A, r), B = Math.abs(A * Math.sin(t)) + Math.abs(r * Math.cos(t)), n = A / 2, s = r / 2, a = B / 2, i = Math.sin(t - Math.PI / 2) * a, o = Math.cos(t - Math.PI / 2) * a;
  return [B, n - o, n + o, s - i, s + i];
}, rA = function(e, A) {
  return Math.sqrt(e * e + A * A);
}, xt = function(e, A, r, t, B) {
  var n = [
    [0, 0],
    [0, A],
    [e, 0],
    [e, A]
  ];
  return n.reduce(function(s, a) {
    var i = a[0], o = a[1], c = rA(r - i, t - o);
    return (B ? c < s.optimumDistance : c > s.optimumDistance) ? {
      optimumCorner: a,
      optimumDistance: c
    } : s;
  }, {
    optimumDistance: B ? 1 / 0 : -1 / 0,
    optimumCorner: null
  }).optimumCorner;
}, ma = function(e, A, r, t, B) {
  var n = 0, s = 0;
  switch (e.size) {
    case 0:
      e.shape === 0 ? n = s = Math.min(Math.abs(A), Math.abs(A - t), Math.abs(r), Math.abs(r - B)) : e.shape === 1 && (n = Math.min(Math.abs(A), Math.abs(A - t)), s = Math.min(Math.abs(r), Math.abs(r - B)));
      break;
    case 2:
      if (e.shape === 0)
        n = s = Math.min(rA(A, r), rA(A, r - B), rA(A - t, r), rA(A - t, r - B));
      else if (e.shape === 1) {
        var a = Math.min(Math.abs(r), Math.abs(r - B)) / Math.min(Math.abs(A), Math.abs(A - t)), i = xt(t, B, A, r, !0), o = i[0], c = i[1];
        n = rA(o - A, (c - r) / a), s = a * n;
      }
      break;
    case 1:
      e.shape === 0 ? n = s = Math.max(Math.abs(A), Math.abs(A - t), Math.abs(r), Math.abs(r - B)) : e.shape === 1 && (n = Math.max(Math.abs(A), Math.abs(A - t)), s = Math.max(Math.abs(r), Math.abs(r - B)));
      break;
    case 3:
      if (e.shape === 0)
        n = s = Math.max(rA(A, r), rA(A, r - B), rA(A - t, r), rA(A - t, r - B));
      else if (e.shape === 1) {
        var a = Math.max(Math.abs(r), Math.abs(r - B)) / Math.max(Math.abs(A), Math.abs(A - t)), Q = xt(t, B, A, r, !1), o = Q[0], c = Q[1];
        n = rA(o - A, (c - r) / a), s = a * n;
      }
      break;
  }
  return Array.isArray(e.size) && (n = D(e.size[0], t), s = e.size.length === 2 ? D(e.size[1], B) : n), [n, s];
}, ya = function(e, A) {
  var r = AA(180), t = [];
  return sA(A).forEach(function(B, n) {
    if (n === 0) {
      var s = B[0];
      if (s.type === 20 && s.value === "to") {
        r = MB(B);
        return;
      } else if (OB(s)) {
        r = sr.parse(e, s);
        return;
      }
    }
    var a = ar(e, B);
    t.push(a);
  }), {
    angle: r,
    stops: t,
    type: 1
    /* LINEAR_GRADIENT */
  };
}, De = function(e, A) {
  var r = AA(180), t = [];
  return sA(A).forEach(function(B, n) {
    if (n === 0) {
      var s = B[0];
      if (s.type === 20 && ["top", "left", "right", "bottom"].indexOf(s.value) !== -1) {
        r = MB(B);
        return;
      } else if (OB(s)) {
        r = (sr.parse(e, s) + AA(270)) % AA(360);
        return;
      }
    }
    var a = ar(e, B);
    t.push(a);
  }), {
    angle: r,
    stops: t,
    type: 1
    /* LINEAR_GRADIENT */
  };
}, Ka = function(e, A) {
  var r = AA(180), t = [], B = 1, n = 0, s = 3, a = [];
  return sA(A).forEach(function(i, o) {
    var c = i[0];
    if (o === 0) {
      if (b(c) && c.value === "linear") {
        B = 1;
        return;
      } else if (b(c) && c.value === "radial") {
        B = 2;
        return;
      }
    }
    if (c.type === 18) {
      if (c.name === "from") {
        var Q = EA.parse(e, c.values[0]);
        t.push({ stop: P, color: Q });
      } else if (c.name === "to") {
        var Q = EA.parse(e, c.values[0]);
        t.push({ stop: hA, color: Q });
      } else if (c.name === "color-stop") {
        var g = c.values.filter(WA);
        if (g.length === 2) {
          var Q = EA.parse(e, g[1]), f = g[0];
          YA(f) && t.push({
            stop: { type: 16, number: f.number * 100, flags: f.flags },
            color: Q
          });
        }
      }
    }
  }), B === 1 ? {
    angle: (r + AA(180)) % AA(360),
    stops: t,
    type: B
  } : { size: s, shape: n, stops: t, position: a, type: B };
}, GB = "closest-side", RB = "farthest-side", VB = "closest-corner", NB = "farthest-corner", PB = "circle", XB = "ellipse", _B = "cover", JB = "contain", La = function(e, A) {
  var r = 0, t = 3, B = [], n = [];
  return sA(A).forEach(function(s, a) {
    var i = !0;
    if (a === 0) {
      var o = !1;
      i = s.reduce(function(Q, g) {
        if (o)
          if (b(g))
            switch (g.value) {
              case "center":
                return n.push(nt), Q;
              case "top":
              case "left":
                return n.push(P), Q;
              case "right":
              case "bottom":
                return n.push(hA), Q;
            }
          else
            (M(g) || HA(g)) && n.push(g);
        else if (b(g))
          switch (g.value) {
            case PB:
              return r = 0, !1;
            case XB:
              return r = 1, !1;
            case "at":
              return o = !0, !1;
            case GB:
              return t = 0, !1;
            case _B:
            case RB:
              return t = 1, !1;
            case JB:
            case VB:
              return t = 2, !1;
            case NB:
              return t = 3, !1;
          }
        else if (HA(g) || M(g))
          return Array.isArray(t) || (t = []), t.push(g), !1;
        return Q;
      }, i);
    }
    if (i) {
      var c = ar(e, s);
      B.push(c);
    }
  }), {
    size: t,
    shape: r,
    stops: B,
    position: n,
    type: 2
    /* RADIAL_GRADIENT */
  };
}, xe = function(e, A) {
  var r = 0, t = 3, B = [], n = [];
  return sA(A).forEach(function(s, a) {
    var i = !0;
    if (a === 0 ? i = s.reduce(function(c, Q) {
      if (b(Q))
        switch (Q.value) {
          case "center":
            return n.push(nt), !1;
          case "top":
          case "left":
            return n.push(P), !1;
          case "right":
          case "bottom":
            return n.push(hA), !1;
        }
      else if (M(Q) || HA(Q))
        return n.push(Q), !1;
      return c;
    }, i) : a === 1 && (i = s.reduce(function(c, Q) {
      if (b(Q))
        switch (Q.value) {
          case PB:
            return r = 0, !1;
          case XB:
            return r = 1, !1;
          case JB:
          case GB:
            return t = 0, !1;
          case RB:
            return t = 1, !1;
          case VB:
            return t = 2, !1;
          case _B:
          case NB:
            return t = 3, !1;
        }
      else if (HA(Q) || M(Q))
        return Array.isArray(t) || (t = []), t.push(Q), !1;
      return c;
    }, i)), i) {
      var o = ar(e, s);
      B.push(o);
    }
  }), {
    size: t,
    shape: r,
    stops: B,
    position: n,
    type: 2
    /* RADIAL_GRADIENT */
  };
}, ba = function(e) {
  return e.type === 1;
}, Da = function(e) {
  return e.type === 2;
}, st = {
  name: "image",
  parse: function(e, A) {
    if (A.type === 22) {
      var r = {
        url: A.value,
        type: 0
        /* URL */
      };
      return e.cache.addImage(A.value), r;
    }
    if (A.type === 18) {
      var t = kB[A.name];
      if (typeof t > "u")
        throw new Error('Attempting to parse an unsupported image function "' + A.name + '"');
      return t(e, A.values);
    }
    throw new Error("Unsupported image type " + A.type);
  }
};
function xa(e) {
  return !(e.type === 20 && e.value === "none") && (e.type !== 18 || !!kB[e.name]);
}
var kB = {
  "linear-gradient": ya,
  "-moz-linear-gradient": De,
  "-ms-linear-gradient": De,
  "-o-linear-gradient": De,
  "-webkit-linear-gradient": De,
  "radial-gradient": La,
  "-moz-radial-gradient": xe,
  "-ms-radial-gradient": xe,
  "-o-radial-gradient": xe,
  "-webkit-radial-gradient": xe,
  "-webkit-gradient": Ka
}, Ta = {
  name: "background-image",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    if (A.length === 0)
      return [];
    var r = A[0];
    return r.type === 20 && r.value === "none" ? [] : A.filter(function(t) {
      return WA(t) && xa(t);
    }).map(function(t) {
      return st.parse(e, t);
    });
  }
}, Sa = {
  name: "background-origin",
  initialValue: "border-box",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.map(function(r) {
      if (b(r))
        switch (r.value) {
          case "padding-box":
            return 1;
          case "content-box":
            return 2;
        }
      return 0;
    });
  }
}, Oa = {
  name: "background-position",
  initialValue: "0% 0%",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return sA(A).map(function(r) {
      return r.filter(M);
    }).map(bB);
  }
}, Ma = {
  name: "background-repeat",
  initialValue: "repeat",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return sA(A).map(function(r) {
      return r.filter(b).map(function(t) {
        return t.value;
      }).join(" ");
    }).map(Ga);
  }
}, Ga = function(e) {
  switch (e) {
    case "no-repeat":
      return 1;
    case "repeat-x":
    case "repeat no-repeat":
      return 2;
    case "repeat-y":
    case "no-repeat repeat":
      return 3;
    case "repeat":
    default:
      return 0;
  }
}, kA;
(function(e) {
  e.AUTO = "auto", e.CONTAIN = "contain", e.COVER = "cover";
})(kA || (kA = {}));
var Ra = {
  name: "background-size",
  initialValue: "0",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return sA(A).map(function(r) {
      return r.filter(Va);
    });
  }
}, Va = function(e) {
  return b(e) || M(e);
}, ir = function(e) {
  return {
    name: "border-" + e + "-color",
    initialValue: "transparent",
    prefix: !1,
    type: 3,
    format: "color"
  };
}, Na = ir("top"), Pa = ir("right"), Xa = ir("bottom"), _a = ir("left"), or = function(e) {
  return {
    name: "border-radius-" + e,
    initialValue: "0 0",
    prefix: !1,
    type: 1,
    parse: function(A, r) {
      return bB(r.filter(M));
    }
  };
}, Ja = or("top-left"), ka = or("top-right"), Wa = or("bottom-right"), Ya = or("bottom-left"), cr = function(e) {
  return {
    name: "border-" + e + "-style",
    initialValue: "solid",
    prefix: !1,
    type: 2,
    parse: function(A, r) {
      switch (r) {
        case "none":
          return 0;
        case "dashed":
          return 2;
        case "dotted":
          return 3;
        case "double":
          return 4;
      }
      return 1;
    }
  };
}, Za = cr("top"), qa = cr("right"), ja = cr("bottom"), za = cr("left"), Qr = function(e) {
  return {
    name: "border-" + e + "-width",
    initialValue: "0",
    type: 0,
    prefix: !1,
    parse: function(A, r) {
      return Ce(r) ? r.number : 0;
    }
  };
}, $a = Qr("top"), Ai = Qr("right"), ei = Qr("bottom"), ri = Qr("left"), ti = {
  name: "color",
  initialValue: "transparent",
  prefix: !1,
  type: 3,
  format: "color"
}, Bi = {
  name: "direction",
  initialValue: "ltr",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "rtl":
        return 1;
      case "ltr":
      default:
        return 0;
    }
  }
}, ni = {
  name: "display",
  initialValue: "inline-block",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(b).reduce(
      function(r, t) {
        return r | si(t.value);
      },
      0
      /* NONE */
    );
  }
}, si = function(e) {
  switch (e) {
    case "block":
    case "-webkit-box":
      return 2;
    case "inline":
      return 4;
    case "run-in":
      return 8;
    case "flow":
      return 16;
    case "flow-root":
      return 32;
    case "table":
      return 64;
    case "flex":
    case "-webkit-flex":
      return 128;
    case "grid":
    case "-ms-grid":
      return 256;
    case "ruby":
      return 512;
    case "subgrid":
      return 1024;
    case "list-item":
      return 2048;
    case "table-row-group":
      return 4096;
    case "table-header-group":
      return 8192;
    case "table-footer-group":
      return 16384;
    case "table-row":
      return 32768;
    case "table-cell":
      return 65536;
    case "table-column-group":
      return 131072;
    case "table-column":
      return 262144;
    case "table-caption":
      return 524288;
    case "ruby-base":
      return 1048576;
    case "ruby-text":
      return 2097152;
    case "ruby-base-container":
      return 4194304;
    case "ruby-text-container":
      return 8388608;
    case "contents":
      return 16777216;
    case "inline-block":
      return 33554432;
    case "inline-list-item":
      return 67108864;
    case "inline-table":
      return 134217728;
    case "inline-flex":
      return 268435456;
    case "inline-grid":
      return 536870912;
  }
  return 0;
}, ai = {
  name: "float",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "left":
        return 1;
      case "right":
        return 2;
      case "inline-start":
        return 3;
      case "inline-end":
        return 4;
    }
    return 0;
  }
}, ii = {
  name: "letter-spacing",
  initialValue: "0",
  prefix: !1,
  type: 0,
  parse: function(e, A) {
    return A.type === 20 && A.value === "normal" ? 0 : A.type === 17 || A.type === 15 ? A.number : 0;
  }
}, We;
(function(e) {
  e.NORMAL = "normal", e.STRICT = "strict";
})(We || (We = {}));
var oi = {
  name: "line-break",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "strict":
        return We.STRICT;
      case "normal":
      default:
        return We.NORMAL;
    }
  }
}, ci = {
  name: "line-height",
  initialValue: "normal",
  prefix: !1,
  type: 4
  /* TOKEN_VALUE */
}, Tt = function(e, A) {
  return b(e) && e.value === "normal" ? 1.2 * A : e.type === 17 ? A * e.number : M(e) ? D(e, A) : A;
}, Qi = {
  name: "list-style-image",
  initialValue: "none",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    return A.type === 20 && A.value === "none" ? null : st.parse(e, A);
  }
}, gi = {
  name: "list-style-position",
  initialValue: "outside",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "inside":
        return 0;
      case "outside":
      default:
        return 1;
    }
  }
}, Zr = {
  name: "list-style-type",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "disc":
        return 0;
      case "circle":
        return 1;
      case "square":
        return 2;
      case "decimal":
        return 3;
      case "cjk-decimal":
        return 4;
      case "decimal-leading-zero":
        return 5;
      case "lower-roman":
        return 6;
      case "upper-roman":
        return 7;
      case "lower-greek":
        return 8;
      case "lower-alpha":
        return 9;
      case "upper-alpha":
        return 10;
      case "arabic-indic":
        return 11;
      case "armenian":
        return 12;
      case "bengali":
        return 13;
      case "cambodian":
        return 14;
      case "cjk-earthly-branch":
        return 15;
      case "cjk-heavenly-stem":
        return 16;
      case "cjk-ideographic":
        return 17;
      case "devanagari":
        return 18;
      case "ethiopic-numeric":
        return 19;
      case "georgian":
        return 20;
      case "gujarati":
        return 21;
      case "gurmukhi":
        return 22;
      case "hebrew":
        return 22;
      case "hiragana":
        return 23;
      case "hiragana-iroha":
        return 24;
      case "japanese-formal":
        return 25;
      case "japanese-informal":
        return 26;
      case "kannada":
        return 27;
      case "katakana":
        return 28;
      case "katakana-iroha":
        return 29;
      case "khmer":
        return 30;
      case "korean-hangul-formal":
        return 31;
      case "korean-hanja-formal":
        return 32;
      case "korean-hanja-informal":
        return 33;
      case "lao":
        return 34;
      case "lower-armenian":
        return 35;
      case "malayalam":
        return 36;
      case "mongolian":
        return 37;
      case "myanmar":
        return 38;
      case "oriya":
        return 39;
      case "persian":
        return 40;
      case "simp-chinese-formal":
        return 41;
      case "simp-chinese-informal":
        return 42;
      case "tamil":
        return 43;
      case "telugu":
        return 44;
      case "thai":
        return 45;
      case "tibetan":
        return 46;
      case "trad-chinese-formal":
        return 47;
      case "trad-chinese-informal":
        return 48;
      case "upper-armenian":
        return 49;
      case "disclosure-open":
        return 50;
      case "disclosure-closed":
        return 51;
      case "none":
      default:
        return -1;
    }
  }
}, gr = function(e) {
  return {
    name: "margin-" + e,
    initialValue: "0",
    prefix: !1,
    type: 4
    /* TOKEN_VALUE */
  };
}, wi = gr("top"), li = gr("right"), ui = gr("bottom"), Ci = gr("left"), fi = {
  name: "overflow",
  initialValue: "visible",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(b).map(function(r) {
      switch (r.value) {
        case "hidden":
          return 1;
        case "scroll":
          return 2;
        case "clip":
          return 3;
        case "auto":
          return 4;
        case "visible":
        default:
          return 0;
      }
    });
  }
}, Ui = {
  name: "overflow-wrap",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "break-word":
        return "break-word";
      case "normal":
      default:
        return "normal";
    }
  }
}, wr = function(e) {
  return {
    name: "padding-" + e,
    initialValue: "0",
    prefix: !1,
    type: 3,
    format: "length-percentage"
  };
}, Fi = wr("top"), hi = wr("right"), di = wr("bottom"), Ei = wr("left"), pi = {
  name: "text-align",
  initialValue: "left",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "right":
        return 2;
      case "center":
      case "justify":
        return 1;
      case "left":
      default:
        return 0;
    }
  }
}, Hi = {
  name: "position",
  initialValue: "static",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "relative":
        return 1;
      case "absolute":
        return 2;
      case "fixed":
        return 3;
      case "sticky":
        return 4;
    }
    return 0;
  }
}, Ii = {
  name: "text-shadow",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return A.length === 1 && Yr(A[0], "none") ? [] : sA(A).map(function(r) {
      for (var t = {
        color: gA.TRANSPARENT,
        offsetX: P,
        offsetY: P,
        blur: P
      }, B = 0, n = 0; n < r.length; n++) {
        var s = r[n];
        HA(s) ? (B === 0 ? t.offsetX = s : B === 1 ? t.offsetY = s : t.blur = s, B++) : t.color = EA.parse(e, s);
      }
      return t;
    });
  }
}, vi = {
  name: "text-transform",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "uppercase":
        return 2;
      case "lowercase":
        return 1;
      case "capitalize":
        return 3;
    }
    return 0;
  }
}, mi = {
  name: "transform",
  initialValue: "none",
  prefix: !0,
  type: 0,
  parse: function(e, A) {
    if (A.type === 20 && A.value === "none")
      return null;
    if (A.type === 18) {
      var r = Li[A.name];
      if (typeof r > "u")
        throw new Error('Attempting to parse an unsupported transform function "' + A.name + '"');
      return r(A.values);
    }
    return null;
  }
}, yi = function(e) {
  var A = e.filter(function(r) {
    return r.type === 17;
  }).map(function(r) {
    return r.number;
  });
  return A.length === 6 ? A : null;
}, Ki = function(e) {
  var A = e.filter(function(i) {
    return i.type === 17;
  }).map(function(i) {
    return i.number;
  }), r = A[0], t = A[1];
  A[2], A[3];
  var B = A[4], n = A[5];
  A[6], A[7], A[8], A[9], A[10], A[11];
  var s = A[12], a = A[13];
  return A[14], A[15], A.length === 16 ? [r, t, B, n, s, a] : null;
}, Li = {
  matrix: yi,
  matrix3d: Ki
}, St = {
  type: 16,
  number: 50,
  flags: ue
}, bi = [St, St], Di = {
  name: "transform-origin",
  initialValue: "50% 50%",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    var r = A.filter(M);
    return r.length !== 2 ? bi : [r[0], r[1]];
  }
}, xi = {
  name: "visible",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "hidden":
        return 1;
      case "collapse":
        return 2;
      case "visible":
      default:
        return 0;
    }
  }
}, oe;
(function(e) {
  e.NORMAL = "normal", e.BREAK_ALL = "break-all", e.KEEP_ALL = "keep-all";
})(oe || (oe = {}));
var Ti = {
  name: "word-break",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "break-all":
        return oe.BREAK_ALL;
      case "keep-all":
        return oe.KEEP_ALL;
      case "normal":
      default:
        return oe.NORMAL;
    }
  }
}, Si = {
  name: "z-index",
  initialValue: "auto",
  prefix: !1,
  type: 0,
  parse: function(e, A) {
    if (A.type === 20)
      return { auto: !0, order: 0 };
    if (YA(A))
      return { auto: !1, order: A.number };
    throw new Error("Invalid z-index number parsed");
  }
}, WB = {
  name: "time",
  parse: function(e, A) {
    if (A.type === 15)
      switch (A.unit.toLowerCase()) {
        case "s":
          return 1e3 * A.number;
        case "ms":
          return A.number;
      }
    throw new Error("Unsupported time type");
  }
}, Oi = {
  name: "opacity",
  initialValue: "1",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    return YA(A) ? A.number : 1;
  }
}, Mi = {
  name: "text-decoration-color",
  initialValue: "transparent",
  prefix: !1,
  type: 3,
  format: "color"
}, Gi = {
  name: "text-decoration-line",
  initialValue: "none",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(b).map(function(r) {
      switch (r.value) {
        case "underline":
          return 1;
        case "overline":
          return 2;
        case "line-through":
          return 3;
        case "none":
          return 4;
      }
      return 0;
    }).filter(function(r) {
      return r !== 0;
    });
  }
}, Ri = {
  name: "font-family",
  initialValue: "",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    var r = [], t = [];
    return A.forEach(function(B) {
      switch (B.type) {
        case 20:
        case 0:
          r.push(B.value);
          break;
        case 17:
          r.push(B.number.toString());
          break;
        case 4:
          t.push(r.join(" ")), r.length = 0;
          break;
      }
    }), r.length && t.push(r.join(" ")), t.map(function(B) {
      return B.indexOf(" ") === -1 ? B : "'" + B + "'";
    });
  }
}, Vi = {
  name: "font-size",
  initialValue: "0",
  prefix: !1,
  type: 3,
  format: "length"
}, Ni = {
  name: "font-weight",
  initialValue: "normal",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    if (YA(A))
      return A.number;
    if (b(A))
      switch (A.value) {
        case "bold":
          return 700;
        case "normal":
        default:
          return 400;
      }
    return 400;
  }
}, Pi = {
  name: "font-variant",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return A.filter(b).map(function(r) {
      return r.value;
    });
  }
}, Xi = {
  name: "font-style",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "oblique":
        return "oblique";
      case "italic":
        return "italic";
      case "normal":
      default:
        return "normal";
    }
  }
}, G = function(e, A) {
  return (e & A) !== 0;
}, _i = {
  name: "content",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    if (A.length === 0)
      return [];
    var r = A[0];
    return r.type === 20 && r.value === "none" ? [] : A;
  }
}, Ji = {
  name: "counter-increment",
  initialValue: "none",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    if (A.length === 0)
      return null;
    var r = A[0];
    if (r.type === 20 && r.value === "none")
      return null;
    for (var t = [], B = A.filter(LB), n = 0; n < B.length; n++) {
      var s = B[n], a = B[n + 1];
      if (s.type === 20) {
        var i = a && YA(a) ? a.number : 1;
        t.push({ counter: s.value, increment: i });
      }
    }
    return t;
  }
}, ki = {
  name: "counter-reset",
  initialValue: "none",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    if (A.length === 0)
      return [];
    for (var r = [], t = A.filter(LB), B = 0; B < t.length; B++) {
      var n = t[B], s = t[B + 1];
      if (b(n) && n.value !== "none") {
        var a = s && YA(s) ? s.number : 0;
        r.push({ counter: n.value, reset: a });
      }
    }
    return r;
  }
}, Wi = {
  name: "duration",
  initialValue: "0s",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(Ce).map(function(r) {
      return WB.parse(e, r);
    });
  }
}, Yi = {
  name: "quotes",
  initialValue: "none",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    if (A.length === 0)
      return null;
    var r = A[0];
    if (r.type === 20 && r.value === "none")
      return null;
    var t = [], B = A.filter(ha);
    if (B.length % 2 !== 0)
      return null;
    for (var n = 0; n < B.length; n += 2) {
      var s = B[n].value, a = B[n + 1].value;
      t.push({ open: s, close: a });
    }
    return t;
  }
}, Ot = function(e, A, r) {
  if (!e)
    return "";
  var t = e[Math.min(A, e.length - 1)];
  return t ? r ? t.open : t.close : "";
}, Zi = {
  name: "box-shadow",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return A.length === 1 && Yr(A[0], "none") ? [] : sA(A).map(function(r) {
      for (var t = {
        color: 255,
        offsetX: P,
        offsetY: P,
        blur: P,
        spread: P,
        inset: !1
      }, B = 0, n = 0; n < r.length; n++) {
        var s = r[n];
        Yr(s, "inset") ? t.inset = !0 : HA(s) ? (B === 0 ? t.offsetX = s : B === 1 ? t.offsetY = s : B === 2 ? t.blur = s : t.spread = s, B++) : t.color = EA.parse(e, s);
      }
      return t;
    });
  }
}, qi = {
  name: "paint-order",
  initialValue: "normal",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    var r = [
      0,
      1,
      2
      /* MARKERS */
    ], t = [];
    return A.filter(b).forEach(function(B) {
      switch (B.value) {
        case "stroke":
          t.push(
            1
            /* STROKE */
          );
          break;
        case "fill":
          t.push(
            0
            /* FILL */
          );
          break;
        case "markers":
          t.push(
            2
            /* MARKERS */
          );
          break;
      }
    }), r.forEach(function(B) {
      t.indexOf(B) === -1 && t.push(B);
    }), t;
  }
}, ji = {
  name: "-webkit-text-stroke-color",
  initialValue: "currentcolor",
  prefix: !1,
  type: 3,
  format: "color"
}, zi = {
  name: "-webkit-text-stroke-width",
  initialValue: "0",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    return Ce(A) ? A.number : 0;
  }
}, $i = (
  /** @class */
  function() {
    function e(A, r) {
      var t, B;
      this.animationDuration = U(A, Wi, r.animationDuration), this.backgroundClip = U(A, pa, r.backgroundClip), this.backgroundColor = U(A, Ha, r.backgroundColor), this.backgroundImage = U(A, Ta, r.backgroundImage), this.backgroundOrigin = U(A, Sa, r.backgroundOrigin), this.backgroundPosition = U(A, Oa, r.backgroundPosition), this.backgroundRepeat = U(A, Ma, r.backgroundRepeat), this.backgroundSize = U(A, Ra, r.backgroundSize), this.borderTopColor = U(A, Na, r.borderTopColor), this.borderRightColor = U(A, Pa, r.borderRightColor), this.borderBottomColor = U(A, Xa, r.borderBottomColor), this.borderLeftColor = U(A, _a, r.borderLeftColor), this.borderTopLeftRadius = U(A, Ja, r.borderTopLeftRadius), this.borderTopRightRadius = U(A, ka, r.borderTopRightRadius), this.borderBottomRightRadius = U(A, Wa, r.borderBottomRightRadius), this.borderBottomLeftRadius = U(A, Ya, r.borderBottomLeftRadius), this.borderTopStyle = U(A, Za, r.borderTopStyle), this.borderRightStyle = U(A, qa, r.borderRightStyle), this.borderBottomStyle = U(A, ja, r.borderBottomStyle), this.borderLeftStyle = U(A, za, r.borderLeftStyle), this.borderTopWidth = U(A, $a, r.borderTopWidth), this.borderRightWidth = U(A, Ai, r.borderRightWidth), this.borderBottomWidth = U(A, ei, r.borderBottomWidth), this.borderLeftWidth = U(A, ri, r.borderLeftWidth), this.boxShadow = U(A, Zi, r.boxShadow), this.color = U(A, ti, r.color), this.direction = U(A, Bi, r.direction), this.display = U(A, ni, r.display), this.float = U(A, ai, r.cssFloat), this.fontFamily = U(A, Ri, r.fontFamily), this.fontSize = U(A, Vi, r.fontSize), this.fontStyle = U(A, Xi, r.fontStyle), this.fontVariant = U(A, Pi, r.fontVariant), this.fontWeight = U(A, Ni, r.fontWeight), this.letterSpacing = U(A, ii, r.letterSpacing), this.lineBreak = U(A, oi, r.lineBreak), this.lineHeight = U(A, ci, r.lineHeight), this.listStyleImage = U(A, Qi, r.listStyleImage), this.listStylePosition = U(A, gi, r.listStylePosition), this.listStyleType = U(A, Zr, r.listStyleType), this.marginTop = U(A, wi, r.marginTop), this.marginRight = U(A, li, r.marginRight), this.marginBottom = U(A, ui, r.marginBottom), this.marginLeft = U(A, Ci, r.marginLeft), this.opacity = U(A, Oi, r.opacity);
      var n = U(A, fi, r.overflow);
      this.overflowX = n[0], this.overflowY = n[n.length > 1 ? 1 : 0], this.overflowWrap = U(A, Ui, r.overflowWrap), this.paddingTop = U(A, Fi, r.paddingTop), this.paddingRight = U(A, hi, r.paddingRight), this.paddingBottom = U(A, di, r.paddingBottom), this.paddingLeft = U(A, Ei, r.paddingLeft), this.paintOrder = U(A, qi, r.paintOrder), this.position = U(A, Hi, r.position), this.textAlign = U(A, pi, r.textAlign), this.textDecorationColor = U(A, Mi, (t = r.textDecorationColor) !== null && t !== void 0 ? t : r.color), this.textDecorationLine = U(A, Gi, (B = r.textDecorationLine) !== null && B !== void 0 ? B : r.textDecoration), this.textShadow = U(A, Ii, r.textShadow), this.textTransform = U(A, vi, r.textTransform), this.transform = U(A, mi, r.transform), this.transformOrigin = U(A, Di, r.transformOrigin), this.visibility = U(A, xi, r.visibility), this.webkitTextStrokeColor = U(A, ji, r.webkitTextStrokeColor), this.webkitTextStrokeWidth = U(A, zi, r.webkitTextStrokeWidth), this.wordBreak = U(A, Ti, r.wordBreak), this.zIndex = U(A, Si, r.zIndex);
    }
    return e.prototype.isVisible = function() {
      return this.display > 0 && this.opacity > 0 && this.visibility === 0;
    }, e.prototype.isTransparent = function() {
      return pA(this.backgroundColor);
    }, e.prototype.isTransformed = function() {
      return this.transform !== null;
    }, e.prototype.isPositioned = function() {
      return this.position !== 0;
    }, e.prototype.isPositionedWithZIndex = function() {
      return this.isPositioned() && !this.zIndex.auto;
    }, e.prototype.isFloating = function() {
      return this.float !== 0;
    }, e.prototype.isInlineLevel = function() {
      return G(
        this.display,
        4
        /* INLINE */
      ) || G(
        this.display,
        33554432
        /* INLINE_BLOCK */
      ) || G(
        this.display,
        268435456
        /* INLINE_FLEX */
      ) || G(
        this.display,
        536870912
        /* INLINE_GRID */
      ) || G(
        this.display,
        67108864
        /* INLINE_LIST_ITEM */
      ) || G(
        this.display,
        134217728
        /* INLINE_TABLE */
      );
    }, e;
  }()
), Ao = (
  /** @class */
  function() {
    function e(A, r) {
      this.content = U(A, _i, r.content), this.quotes = U(A, Yi, r.quotes);
    }
    return e;
  }()
), Mt = (
  /** @class */
  function() {
    function e(A, r) {
      this.counterIncrement = U(A, Ji, r.counterIncrement), this.counterReset = U(A, ki, r.counterReset);
    }
    return e;
  }()
), U = function(e, A, r) {
  var t = new yB(), B = r !== null && typeof r < "u" ? r.toString() : A.initialValue;
  t.write(B);
  var n = new KB(t.read());
  switch (A.type) {
    case 2:
      var s = n.parseComponentValue();
      return A.parse(e, b(s) ? s.value : A.initialValue);
    case 0:
      return A.parse(e, n.parseComponentValue());
    case 1:
      return A.parse(e, n.parseComponentValues());
    case 4:
      return n.parseComponentValue();
    case 3:
      switch (A.format) {
        case "angle":
          return sr.parse(e, n.parseComponentValue());
        case "color":
          return EA.parse(e, n.parseComponentValue());
        case "image":
          return st.parse(e, n.parseComponentValue());
        case "length":
          var a = n.parseComponentValue();
          return HA(a) ? a : P;
        case "length-percentage":
          var i = n.parseComponentValue();
          return M(i) ? i : P;
        case "time":
          return WB.parse(e, n.parseComponentValue());
      }
      break;
  }
}, eo = "data-html2canvas-debug", ro = function(e) {
  var A = e.getAttribute(eo);
  switch (A) {
    case "all":
      return 1;
    case "clone":
      return 2;
    case "parse":
      return 3;
    case "render":
      return 4;
    default:
      return 0;
  }
}, qr = function(e, A) {
  var r = ro(e);
  return r === 1 || A === r;
}, aA = (
  /** @class */
  function() {
    function e(A, r) {
      if (this.context = A, this.textNodes = [], this.elements = [], this.flags = 0, qr(
        r,
        3
        /* PARSE */
      ))
        debugger;
      this.styles = new $i(A, window.getComputedStyle(r, null)), $r(r) && (this.styles.animationDuration.some(function(t) {
        return t > 0;
      }) && (r.style.animationDuration = "0s"), this.styles.transform !== null && (r.style.transform = "none")), this.bounds = Br(this.context, r), qr(
        r,
        4
        /* RENDER */
      ) && (this.flags |= 16);
    }
    return e;
  }()
), to = " ", Gt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ne = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Te = 0; Te < Gt.length; Te++)
  ne[Gt.charCodeAt(Te)] = Te;
var Bo = function(e) {
  var A = e.length * 0.75, r = e.length, t, B = 0, n, s, a, i;
  e[e.length - 1] === "=" && (A--, e[e.length - 2] === "=" && A--);
  var o = typeof ArrayBuffer < "u" && typeof Uint8Array < "u" && typeof Uint8Array.prototype.slice < "u" ? new ArrayBuffer(A) : new Array(A), c = Array.isArray(o) ? o : new Uint8Array(o);
  for (t = 0; t < r; t += 4)
    n = ne[e.charCodeAt(t)], s = ne[e.charCodeAt(t + 1)], a = ne[e.charCodeAt(t + 2)], i = ne[e.charCodeAt(t + 3)], c[B++] = n << 2 | s >> 4, c[B++] = (s & 15) << 4 | a >> 2, c[B++] = (a & 3) << 6 | i & 63;
  return o;
}, no = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 2)
    r.push(e[t + 1] << 8 | e[t]);
  return r;
}, so = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 4)
    r.push(e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t]);
  return r;
}, xA = 5, at = 6 + 5, Er = 2, ao = at - xA, YB = 65536 >> xA, io = 1 << xA, pr = io - 1, oo = 1024 >> xA, co = YB + oo, Qo = co, go = 32, wo = Qo + go, lo = 65536 >> at, uo = 1 << ao, Co = uo - 1, Rt = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint16Array(Array.prototype.slice.call(e, A, r));
}, fo = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint32Array(Array.prototype.slice.call(e, A, r));
}, Uo = function(e, A) {
  var r = Bo(e), t = Array.isArray(r) ? so(r) : new Uint32Array(r), B = Array.isArray(r) ? no(r) : new Uint16Array(r), n = 24, s = Rt(B, n / 2, t[4] / 2), a = t[5] === 2 ? Rt(B, (n + t[4]) / 2) : fo(t, Math.ceil((n + t[4]) / 4));
  return new Fo(t[0], t[1], t[2], t[3], s, a);
}, Fo = (
  /** @class */
  function() {
    function e(A, r, t, B, n, s) {
      this.initialValue = A, this.errorValue = r, this.highStart = t, this.highValueIndex = B, this.index = n, this.data = s;
    }
    return e.prototype.get = function(A) {
      var r;
      if (A >= 0) {
        if (A < 55296 || A > 56319 && A <= 65535)
          return r = this.index[A >> xA], r = (r << Er) + (A & pr), this.data[r];
        if (A <= 65535)
          return r = this.index[YB + (A - 55296 >> xA)], r = (r << Er) + (A & pr), this.data[r];
        if (A < this.highStart)
          return r = wo - lo + (A >> at), r = this.index[r], r += A >> xA & Co, r = this.index[r], r = (r << Er) + (A & pr), this.data[r];
        if (A <= 1114111)
          return this.data[this.highValueIndex];
      }
      return this.errorValue;
    }, e;
  }()
), Vt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ho = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Se = 0; Se < Vt.length; Se++)
  ho[Vt.charCodeAt(Se)] = Se;
var Eo = 1, Hr = 2, Ir = 3, Nt = 4, Pt = 5, po = 7, Xt = 8, vr = 9, mr = 10, _t = 11, Jt = 12, kt = 13, Wt = 14, yr = 15, Ho = function(e) {
  for (var A = [], r = 0, t = e.length; r < t; ) {
    var B = e.charCodeAt(r++);
    if (B >= 55296 && B <= 56319 && r < t) {
      var n = e.charCodeAt(r++);
      (n & 64512) === 56320 ? A.push(((B & 1023) << 10) + (n & 1023) + 65536) : (A.push(B), r--);
    } else
      A.push(B);
  }
  return A;
}, Io = function() {
  for (var e = [], A = 0; A < arguments.length; A++)
    e[A] = arguments[A];
  if (String.fromCodePoint)
    return String.fromCodePoint.apply(String, e);
  var r = e.length;
  if (!r)
    return "";
  for (var t = [], B = -1, n = ""; ++B < r; ) {
    var s = e[B];
    s <= 65535 ? t.push(s) : (s -= 65536, t.push((s >> 10) + 55296, s % 1024 + 56320)), (B + 1 === r || t.length > 16384) && (n += String.fromCharCode.apply(String, t), t.length = 0);
  }
  return n;
}, vo = Uo(to), z = "×", Kr = "÷", mo = function(e) {
  return vo.get(e);
}, yo = function(e, A, r) {
  var t = r - 2, B = A[t], n = A[r - 1], s = A[r];
  if (n === Hr && s === Ir)
    return z;
  if (n === Hr || n === Ir || n === Nt || s === Hr || s === Ir || s === Nt)
    return Kr;
  if (n === Xt && [Xt, vr, _t, Jt].indexOf(s) !== -1 || (n === _t || n === vr) && (s === vr || s === mr) || (n === Jt || n === mr) && s === mr || s === kt || s === Pt || s === po || n === Eo)
    return z;
  if (n === kt && s === Wt) {
    for (; B === Pt; )
      B = A[--t];
    if (B === Wt)
      return z;
  }
  if (n === yr && s === yr) {
    for (var a = 0; B === yr; )
      a++, B = A[--t];
    if (a % 2 === 0)
      return z;
  }
  return Kr;
}, Ko = function(e) {
  var A = Ho(e), r = A.length, t = 0, B = 0, n = A.map(mo);
  return {
    next: function() {
      if (t >= r)
        return { done: !0, value: null };
      for (var s = z; t < r && (s = yo(A, n, ++t)) === z; )
        ;
      if (s !== z || t === r) {
        var a = Io.apply(null, A.slice(B, t));
        return B = t, { value: a, done: !1 };
      }
      return { done: !0, value: null };
    }
  };
}, Lo = function(e) {
  for (var A = Ko(e), r = [], t; !(t = A.next()).done; )
    t.value && r.push(t.value.slice());
  return r;
}, bo = function(e) {
  var A = 123;
  if (e.createRange) {
    var r = e.createRange();
    if (r.getBoundingClientRect) {
      var t = e.createElement("boundtest");
      t.style.height = A + "px", t.style.display = "block", e.body.appendChild(t), r.selectNode(t);
      var B = r.getBoundingClientRect(), n = Math.round(B.height);
      if (e.body.removeChild(t), n === A)
        return !0;
    }
  }
  return !1;
}, Do = function(e) {
  var A = e.createElement("boundtest");
  A.style.width = "50px", A.style.display = "block", A.style.fontSize = "12px", A.style.letterSpacing = "0px", A.style.wordSpacing = "0px", e.body.appendChild(A);
  var r = e.createRange();
  A.innerHTML = typeof "".repeat == "function" ? "&#128104;".repeat(10) : "";
  var t = A.firstChild, B = nr(t.data).map(function(i) {
    return S(i);
  }), n = 0, s = {}, a = B.every(function(i, o) {
    r.setStart(t, n), r.setEnd(t, n + i.length);
    var c = r.getBoundingClientRect();
    n += i.length;
    var Q = c.x > s.x || c.y > s.y;
    return s = c, o === 0 ? !0 : Q;
  });
  return e.body.removeChild(A), a;
}, xo = function() {
  return typeof new Image().crossOrigin < "u";
}, To = function() {
  return typeof new XMLHttpRequest().responseType == "string";
}, So = function(e) {
  var A = new Image(), r = e.createElement("canvas"), t = r.getContext("2d");
  if (!t)
    return !1;
  A.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  try {
    t.drawImage(A, 0, 0), r.toDataURL();
  } catch (B) {
    return !1;
  }
  return !0;
}, Yt = function(e) {
  return e[0] === 0 && e[1] === 255 && e[2] === 0 && e[3] === 255;
}, Oo = function(e) {
  var A = e.createElement("canvas"), r = 100;
  A.width = r, A.height = r;
  var t = A.getContext("2d");
  if (!t)
    return Promise.reject(!1);
  t.fillStyle = "rgb(0, 255, 0)", t.fillRect(0, 0, r, r);
  var B = new Image(), n = A.toDataURL();
  B.src = n;
  var s = jr(r, r, 0, 0, B);
  return t.fillStyle = "red", t.fillRect(0, 0, r, r), Zt(s).then(function(a) {
    t.drawImage(a, 0, 0);
    var i = t.getImageData(0, 0, r, r).data;
    t.fillStyle = "red", t.fillRect(0, 0, r, r);
    var o = e.createElement("div");
    return o.style.backgroundImage = "url(" + n + ")", o.style.height = r + "px", Yt(i) ? Zt(jr(r, r, 0, 0, o)) : Promise.reject(!1);
  }).then(function(a) {
    return t.drawImage(a, 0, 0), Yt(t.getImageData(0, 0, r, r).data);
  }).catch(function() {
    return !1;
  });
}, jr = function(e, A, r, t, B) {
  var n = "http://www.w3.org/2000/svg", s = document.createElementNS(n, "svg"), a = document.createElementNS(n, "foreignObject");
  return s.setAttributeNS(null, "width", e.toString()), s.setAttributeNS(null, "height", A.toString()), a.setAttributeNS(null, "width", "100%"), a.setAttributeNS(null, "height", "100%"), a.setAttributeNS(null, "x", r.toString()), a.setAttributeNS(null, "y", t.toString()), a.setAttributeNS(null, "externalResourcesRequired", "true"), s.appendChild(a), a.appendChild(B), s;
}, Zt = function(e) {
  return new Promise(function(A, r) {
    var t = new Image();
    t.onload = function() {
      return A(t);
    }, t.onerror = r, t.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(e));
  });
}, N = {
  get SUPPORT_RANGE_BOUNDS() {
    var e = bo(document);
    return Object.defineProperty(N, "SUPPORT_RANGE_BOUNDS", { value: e }), e;
  },
  get SUPPORT_WORD_BREAKING() {
    var e = N.SUPPORT_RANGE_BOUNDS && Do(document);
    return Object.defineProperty(N, "SUPPORT_WORD_BREAKING", { value: e }), e;
  },
  get SUPPORT_SVG_DRAWING() {
    var e = So(document);
    return Object.defineProperty(N, "SUPPORT_SVG_DRAWING", { value: e }), e;
  },
  get SUPPORT_FOREIGNOBJECT_DRAWING() {
    var e = typeof Array.from == "function" && typeof window.fetch == "function" ? Oo(document) : Promise.resolve(!1);
    return Object.defineProperty(N, "SUPPORT_FOREIGNOBJECT_DRAWING", { value: e }), e;
  },
  get SUPPORT_CORS_IMAGES() {
    var e = xo();
    return Object.defineProperty(N, "SUPPORT_CORS_IMAGES", { value: e }), e;
  },
  get SUPPORT_RESPONSE_TYPE() {
    var e = To();
    return Object.defineProperty(N, "SUPPORT_RESPONSE_TYPE", { value: e }), e;
  },
  get SUPPORT_CORS_XHR() {
    var e = "withCredentials" in new XMLHttpRequest();
    return Object.defineProperty(N, "SUPPORT_CORS_XHR", { value: e }), e;
  },
  get SUPPORT_NATIVE_TEXT_SEGMENTATION() {
    var e = !!(typeof Intl < "u" && Intl.Segmenter);
    return Object.defineProperty(N, "SUPPORT_NATIVE_TEXT_SEGMENTATION", { value: e }), e;
  }
}, ce = (
  /** @class */
  function() {
    function e(A, r) {
      this.text = A, this.bounds = r;
    }
    return e;
  }()
), Mo = function(e, A, r, t) {
  var B = Vo(A, r), n = [], s = 0;
  return B.forEach(function(a) {
    if (r.textDecorationLine.length || a.trim().length > 0)
      if (N.SUPPORT_RANGE_BOUNDS) {
        var i = qt(t, s, a.length).getClientRects();
        if (i.length > 1) {
          var o = it(a), c = 0;
          o.forEach(function(g) {
            n.push(new ce(g, wA.fromDOMRectList(e, qt(t, c + s, g.length).getClientRects()))), c += g.length;
          });
        } else
          n.push(new ce(a, wA.fromDOMRectList(e, i)));
      } else {
        var Q = t.splitText(a.length);
        n.push(new ce(a, Go(e, t))), t = Q;
      }
    else
      N.SUPPORT_RANGE_BOUNDS || (t = t.splitText(a.length));
    s += a.length;
  }), n;
}, Go = function(e, A) {
  var r = A.ownerDocument;
  if (r) {
    var t = r.createElement("html2canvaswrapper");
    t.appendChild(A.cloneNode(!0));
    var B = A.parentNode;
    if (B) {
      B.replaceChild(t, A);
      var n = Br(e, t);
      return t.firstChild && B.replaceChild(t.firstChild, t), n;
    }
  }
  return wA.EMPTY;
}, qt = function(e, A, r) {
  var t = e.ownerDocument;
  if (!t)
    throw new Error("Node has no owner document");
  var B = t.createRange();
  return B.setStart(e, A), B.setEnd(e, A + r), B;
}, it = function(e) {
  if (N.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
    var A = new Intl.Segmenter(void 0, { granularity: "grapheme" });
    return Array.from(A.segment(e)).map(function(r) {
      return r.segment;
    });
  }
  return Lo(e);
}, Ro = function(e, A) {
  if (N.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
    var r = new Intl.Segmenter(void 0, {
      granularity: "word"
    });
    return Array.from(r.segment(e)).map(function(t) {
      return t.segment;
    });
  }
  return Po(e, A);
}, Vo = function(e, A) {
  return A.letterSpacing !== 0 ? it(e) : Ro(e, A);
}, No = [32, 160, 4961, 65792, 65793, 4153, 4241], Po = function(e, A) {
  for (var r = ls(e, {
    lineBreak: A.lineBreak,
    wordBreak: A.overflowWrap === "break-word" ? "break-word" : A.wordBreak
  }), t = [], B, n = function() {
    if (B.value) {
      var s = B.value.slice(), a = nr(s), i = "";
      a.forEach(function(o) {
        No.indexOf(o) === -1 ? i += S(o) : (i.length && t.push(i), t.push(S(o)), i = "");
      }), i.length && t.push(i);
    }
  }; !(B = r.next()).done; )
    n();
  return t;
}, Xo = (
  /** @class */
  function() {
    function e(A, r, t) {
      this.text = _o(r.data, t.textTransform), this.textBounds = Mo(A, this.text, t, r);
    }
    return e;
  }()
), _o = function(e, A) {
  switch (A) {
    case 1:
      return e.toLowerCase();
    case 3:
      return e.replace(Jo, ko);
    case 2:
      return e.toUpperCase();
    default:
      return e;
  }
}, Jo = /(^|\s|:|-|\(|\))([a-z])/g, ko = function(e, A, r) {
  return e.length > 0 ? A + r.toUpperCase() : e;
}, ZB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.src = t.currentSrc || t.src, B.intrinsicWidth = t.naturalWidth, B.intrinsicHeight = t.naturalHeight, B.context.cache.addImage(B.src), B;
    }
    return A;
  }(aA)
), qB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.canvas = t, B.intrinsicWidth = t.width, B.intrinsicHeight = t.height, B;
    }
    return A;
  }(aA)
), jB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this, n = new XMLSerializer(), s = Br(r, t);
      return t.setAttribute("width", s.width + "px"), t.setAttribute("height", s.height + "px"), B.svg = "data:image/svg+xml," + encodeURIComponent(n.serializeToString(t)), B.intrinsicWidth = t.width.baseVal.value, B.intrinsicHeight = t.height.baseVal.value, B.context.cache.addImage(B.svg), B;
    }
    return A;
  }(aA)
), zB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.value = t.value, B;
    }
    return A;
  }(aA)
), zr = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.start = t.start, B.reversed = typeof t.reversed == "boolean" && t.reversed === !0, B;
    }
    return A;
  }(aA)
), Wo = [
  {
    type: 15,
    flags: 0,
    unit: "px",
    number: 3
  }
], Yo = [
  {
    type: 16,
    flags: 0,
    number: 50
  }
], Zo = function(e) {
  return e.width > e.height ? new wA(e.left + (e.width - e.height) / 2, e.top, e.height, e.height) : e.width < e.height ? new wA(e.left, e.top + (e.height - e.width) / 2, e.width, e.width) : e;
}, qo = function(e) {
  var A = e.type === jo ? new Array(e.value.length + 1).join("•") : e.value;
  return A.length === 0 ? e.placeholder || "" : A;
}, Ye = "checkbox", Ze = "radio", jo = "password", jt = 707406591, ot = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      switch (B.type = t.type.toLowerCase(), B.checked = t.checked, B.value = qo(t), (B.type === Ye || B.type === Ze) && (B.styles.backgroundColor = 3739148031, B.styles.borderTopColor = B.styles.borderRightColor = B.styles.borderBottomColor = B.styles.borderLeftColor = 2779096575, B.styles.borderTopWidth = B.styles.borderRightWidth = B.styles.borderBottomWidth = B.styles.borderLeftWidth = 1, B.styles.borderTopStyle = B.styles.borderRightStyle = B.styles.borderBottomStyle = B.styles.borderLeftStyle = 1, B.styles.backgroundClip = [
        0
        /* BORDER_BOX */
      ], B.styles.backgroundOrigin = [
        0
        /* BORDER_BOX */
      ], B.bounds = Zo(B.bounds)), B.type) {
        case Ye:
          B.styles.borderTopRightRadius = B.styles.borderTopLeftRadius = B.styles.borderBottomRightRadius = B.styles.borderBottomLeftRadius = Wo;
          break;
        case Ze:
          B.styles.borderTopRightRadius = B.styles.borderTopLeftRadius = B.styles.borderBottomRightRadius = B.styles.borderBottomLeftRadius = Yo;
          break;
      }
      return B;
    }
    return A;
  }(aA)
), $B = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this, n = t.options[t.selectedIndex || 0];
      return B.value = n && n.text || "", B;
    }
    return A;
  }(aA)
), An = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.value = t.value, B;
    }
    return A;
  }(aA)
), en = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      B.src = t.src, B.width = parseInt(t.width, 10) || 0, B.height = parseInt(t.height, 10) || 0, B.backgroundColor = B.styles.backgroundColor;
      try {
        if (t.contentWindow && t.contentWindow.document && t.contentWindow.document.documentElement) {
          B.tree = tn(r, t.contentWindow.document.documentElement);
          var n = t.contentWindow.document.documentElement ? ie(r, getComputedStyle(t.contentWindow.document.documentElement).backgroundColor) : gA.TRANSPARENT, s = t.contentWindow.document.body ? ie(r, getComputedStyle(t.contentWindow.document.body).backgroundColor) : gA.TRANSPARENT;
          B.backgroundColor = pA(n) ? pA(s) ? B.styles.backgroundColor : s : n;
        }
      } catch (a) {
      }
      return B;
    }
    return A;
  }(aA)
), zo = ["OL", "UL", "MENU"], Pe = function(e, A, r, t) {
  for (var B = A.firstChild, n = void 0; B; B = n)
    if (n = B.nextSibling, Bn(B) && B.data.trim().length > 0)
      r.textNodes.push(new Xo(e, B, r.styles));
    else if (JA(B))
      if (on(B) && B.assignedNodes)
        B.assignedNodes().forEach(function(a) {
          return Pe(e, a, r, t);
        });
      else {
        var s = rn(e, B);
        s.styles.isVisible() && ($o(B, s, t) ? s.flags |= 4 : Ac(s.styles) && (s.flags |= 2), zo.indexOf(B.tagName) !== -1 && (s.flags |= 8), r.elements.push(s), B.slot, B.shadowRoot ? Pe(e, B.shadowRoot, s, t) : !qe(B) && !nn(B) && !je(B) && Pe(e, B, s, t));
      }
}, rn = function(e, A) {
  return At(A) ? new ZB(e, A) : sn(A) ? new qB(e, A) : nn(A) ? new jB(e, A) : ec(A) ? new zB(e, A) : rc(A) ? new zr(e, A) : tc(A) ? new ot(e, A) : je(A) ? new $B(e, A) : qe(A) ? new An(e, A) : an(A) ? new en(e, A) : new aA(e, A);
}, tn = function(e, A) {
  var r = rn(e, A);
  return r.flags |= 4, Pe(e, A, r, r), r;
}, $o = function(e, A, r) {
  return A.styles.isPositionedWithZIndex() || A.styles.opacity < 1 || A.styles.isTransformed() || ct(e) && r.styles.isTransparent();
}, Ac = function(e) {
  return e.isPositioned() || e.isFloating();
}, Bn = function(e) {
  return e.nodeType === Node.TEXT_NODE;
}, JA = function(e) {
  return e.nodeType === Node.ELEMENT_NODE;
}, $r = function(e) {
  return JA(e) && typeof e.style < "u" && !Xe(e);
}, Xe = function(e) {
  return typeof e.className == "object";
}, ec = function(e) {
  return e.tagName === "LI";
}, rc = function(e) {
  return e.tagName === "OL";
}, tc = function(e) {
  return e.tagName === "INPUT";
}, Bc = function(e) {
  return e.tagName === "HTML";
}, nn = function(e) {
  return e.tagName === "svg";
}, ct = function(e) {
  return e.tagName === "BODY";
}, sn = function(e) {
  return e.tagName === "CANVAS";
}, zt = function(e) {
  return e.tagName === "VIDEO";
}, At = function(e) {
  return e.tagName === "IMG";
}, an = function(e) {
  return e.tagName === "IFRAME";
}, $t = function(e) {
  return e.tagName === "STYLE";
}, nc = function(e) {
  return e.tagName === "SCRIPT";
}, qe = function(e) {
  return e.tagName === "TEXTAREA";
}, je = function(e) {
  return e.tagName === "SELECT";
}, on = function(e) {
  return e.tagName === "SLOT";
}, AB = function(e) {
  return e.tagName.indexOf("-") > 0;
}, sc = (
  /** @class */
  function() {
    function e() {
      this.counters = {};
    }
    return e.prototype.getCounterValue = function(A) {
      var r = this.counters[A];
      return r && r.length ? r[r.length - 1] : 1;
    }, e.prototype.getCounterValues = function(A) {
      var r = this.counters[A];
      return r || [];
    }, e.prototype.pop = function(A) {
      var r = this;
      A.forEach(function(t) {
        return r.counters[t].pop();
      });
    }, e.prototype.parse = function(A) {
      var r = this, t = A.counterIncrement, B = A.counterReset, n = !0;
      t !== null && t.forEach(function(a) {
        var i = r.counters[a.counter];
        i && a.increment !== 0 && (n = !1, i.length || i.push(1), i[Math.max(0, i.length - 1)] += a.increment);
      });
      var s = [];
      return n && B.forEach(function(a) {
        var i = r.counters[a.counter];
        s.push(a.counter), i || (i = r.counters[a.counter] = []), i.push(a.reset);
      }), s;
    }, e;
  }()
), eB = {
  integers: [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
  values: ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
}, rB = {
  integers: [
    9e3,
    8e3,
    7e3,
    6e3,
    5e3,
    4e3,
    3e3,
    2e3,
    1e3,
    900,
    800,
    700,
    600,
    500,
    400,
    300,
    200,
    100,
    90,
    80,
    70,
    60,
    50,
    40,
    30,
    20,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
  ],
  values: [
    "Ք",
    "Փ",
    "Ւ",
    "Ց",
    "Ր",
    "Տ",
    "Վ",
    "Ս",
    "Ռ",
    "Ջ",
    "Պ",
    "Չ",
    "Ո",
    "Շ",
    "Ն",
    "Յ",
    "Մ",
    "Ճ",
    "Ղ",
    "Ձ",
    "Հ",
    "Կ",
    "Ծ",
    "Խ",
    "Լ",
    "Ի",
    "Ժ",
    "Թ",
    "Ը",
    "Է",
    "Զ",
    "Ե",
    "Դ",
    "Գ",
    "Բ",
    "Ա"
  ]
}, ac = {
  integers: [
    1e4,
    9e3,
    8e3,
    7e3,
    6e3,
    5e3,
    4e3,
    3e3,
    2e3,
    1e3,
    400,
    300,
    200,
    100,
    90,
    80,
    70,
    60,
    50,
    40,
    30,
    20,
    19,
    18,
    17,
    16,
    15,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
  ],
  values: [
    "י׳",
    "ט׳",
    "ח׳",
    "ז׳",
    "ו׳",
    "ה׳",
    "ד׳",
    "ג׳",
    "ב׳",
    "א׳",
    "ת",
    "ש",
    "ר",
    "ק",
    "צ",
    "פ",
    "ע",
    "ס",
    "נ",
    "מ",
    "ל",
    "כ",
    "יט",
    "יח",
    "יז",
    "טז",
    "טו",
    "י",
    "ט",
    "ח",
    "ז",
    "ו",
    "ה",
    "ד",
    "ג",
    "ב",
    "א"
  ]
}, ic = {
  integers: [
    1e4,
    9e3,
    8e3,
    7e3,
    6e3,
    5e3,
    4e3,
    3e3,
    2e3,
    1e3,
    900,
    800,
    700,
    600,
    500,
    400,
    300,
    200,
    100,
    90,
    80,
    70,
    60,
    50,
    40,
    30,
    20,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
  ],
  values: [
    "ჵ",
    "ჰ",
    "ჯ",
    "ჴ",
    "ხ",
    "ჭ",
    "წ",
    "ძ",
    "ც",
    "ჩ",
    "შ",
    "ყ",
    "ღ",
    "ქ",
    "ფ",
    "ჳ",
    "ტ",
    "ს",
    "რ",
    "ჟ",
    "პ",
    "ო",
    "ჲ",
    "ნ",
    "მ",
    "ლ",
    "კ",
    "ი",
    "თ",
    "ჱ",
    "ზ",
    "ვ",
    "ე",
    "დ",
    "გ",
    "ბ",
    "ა"
  ]
}, RA = function(e, A, r, t, B, n) {
  return e < A || e > r ? le(e, B, n.length > 0) : t.integers.reduce(function(s, a, i) {
    for (; e >= a; )
      e -= a, s += t.values[i];
    return s;
  }, "") + n;
}, cn = function(e, A, r, t) {
  var B = "";
  do
    r || e--, B = t(e) + B, e /= A;
  while (e * A >= A);
  return B;
}, T = function(e, A, r, t, B) {
  var n = r - A + 1;
  return (e < 0 ? "-" : "") + (cn(Math.abs(e), n, t, function(s) {
    return S(Math.floor(s % n) + A);
  }) + B);
}, KA = function(e, A, r) {
  r === void 0 && (r = ". ");
  var t = A.length;
  return cn(Math.abs(e), t, !1, function(B) {
    return A[Math.floor(B % t)];
  }) + r;
}, PA = 1 << 0, CA = 1 << 1, fA = 1 << 2, se = 1 << 3, QA = function(e, A, r, t, B, n) {
  if (e < -9999 || e > 9999)
    return le(e, 4, B.length > 0);
  var s = Math.abs(e), a = B;
  if (s === 0)
    return A[0] + a;
  for (var i = 0; s > 0 && i <= 4; i++) {
    var o = s % 10;
    o === 0 && G(n, PA) && a !== "" ? a = A[o] + a : o > 1 || o === 1 && i === 0 || o === 1 && i === 1 && G(n, CA) || o === 1 && i === 1 && G(n, fA) && e > 100 || o === 1 && i > 1 && G(n, se) ? a = A[o] + (i > 0 ? r[i - 1] : "") + a : o === 1 && i > 0 && (a = r[i - 1] + a), s = Math.floor(s / 10);
  }
  return (e < 0 ? t : "") + a;
}, tB = "十百千萬", BB = "拾佰仟萬", nB = "マイナス", Lr = "마이너스", le = function(e, A, r) {
  var t = r ? ". " : "", B = r ? "、" : "", n = r ? ", " : "", s = r ? " " : "";
  switch (A) {
    case 0:
      return "•" + s;
    case 1:
      return "◦" + s;
    case 2:
      return "◾" + s;
    case 5:
      var a = T(e, 48, 57, !0, t);
      return a.length < 4 ? "0" + a : a;
    case 4:
      return KA(e, "〇一二三四五六七八九", B);
    case 6:
      return RA(e, 1, 3999, eB, 3, t).toLowerCase();
    case 7:
      return RA(e, 1, 3999, eB, 3, t);
    case 8:
      return T(e, 945, 969, !1, t);
    case 9:
      return T(e, 97, 122, !1, t);
    case 10:
      return T(e, 65, 90, !1, t);
    case 11:
      return T(e, 1632, 1641, !0, t);
    case 12:
    case 49:
      return RA(e, 1, 9999, rB, 3, t);
    case 35:
      return RA(e, 1, 9999, rB, 3, t).toLowerCase();
    case 13:
      return T(e, 2534, 2543, !0, t);
    case 14:
    case 30:
      return T(e, 6112, 6121, !0, t);
    case 15:
      return KA(e, "子丑寅卯辰巳午未申酉戌亥", B);
    case 16:
      return KA(e, "甲乙丙丁戊己庚辛壬癸", B);
    case 17:
    case 48:
      return QA(e, "零一二三四五六七八九", tB, "負", B, CA | fA | se);
    case 47:
      return QA(e, "零壹貳參肆伍陸柒捌玖", BB, "負", B, PA | CA | fA | se);
    case 42:
      return QA(e, "零一二三四五六七八九", tB, "负", B, CA | fA | se);
    case 41:
      return QA(e, "零壹贰叁肆伍陆柒捌玖", BB, "负", B, PA | CA | fA | se);
    case 26:
      return QA(e, "〇一二三四五六七八九", "十百千万", nB, B, 0);
    case 25:
      return QA(e, "零壱弐参四伍六七八九", "拾百千万", nB, B, PA | CA | fA);
    case 31:
      return QA(e, "영일이삼사오육칠팔구", "십백천만", Lr, n, PA | CA | fA);
    case 33:
      return QA(e, "零一二三四五六七八九", "十百千萬", Lr, n, 0);
    case 32:
      return QA(e, "零壹貳參四五六七八九", "拾百千", Lr, n, PA | CA | fA);
    case 18:
      return T(e, 2406, 2415, !0, t);
    case 20:
      return RA(e, 1, 19999, ic, 3, t);
    case 21:
      return T(e, 2790, 2799, !0, t);
    case 22:
      return T(e, 2662, 2671, !0, t);
    case 22:
      return RA(e, 1, 10999, ac, 3, t);
    case 23:
      return KA(e, "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");
    case 24:
      return KA(e, "いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");
    case 27:
      return T(e, 3302, 3311, !0, t);
    case 28:
      return KA(e, "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン", B);
    case 29:
      return KA(e, "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス", B);
    case 34:
      return T(e, 3792, 3801, !0, t);
    case 37:
      return T(e, 6160, 6169, !0, t);
    case 38:
      return T(e, 4160, 4169, !0, t);
    case 39:
      return T(e, 2918, 2927, !0, t);
    case 40:
      return T(e, 1776, 1785, !0, t);
    case 43:
      return T(e, 3046, 3055, !0, t);
    case 44:
      return T(e, 3174, 3183, !0, t);
    case 45:
      return T(e, 3664, 3673, !0, t);
    case 46:
      return T(e, 3872, 3881, !0, t);
    case 3:
    default:
      return T(e, 48, 57, !0, t);
  }
}, Qn = "data-html2canvas-ignore", sB = (
  /** @class */
  function() {
    function e(A, r, t) {
      if (this.context = A, this.options = t, this.scrolledElements = [], this.referenceElement = r, this.counters = new sc(), this.quoteDepth = 0, !r.ownerDocument)
        throw new Error("Cloned element does not have an owner document");
      this.documentElement = this.cloneNode(r.ownerDocument.documentElement, !1);
    }
    return e.prototype.toIFrame = function(A, r) {
      var t = this, B = oc(A, r);
      if (!B.contentWindow)
        return Promise.reject("Unable to find iframe window");
      var n = A.defaultView.pageXOffset, s = A.defaultView.pageYOffset, a = B.contentWindow, i = a.document, o = gc(B).then(function() {
        return J(t, void 0, void 0, function() {
          var c, Q;
          return X(this, function(g) {
            switch (g.label) {
              case 0:
                return this.scrolledElements.forEach(Cc), a && (a.scrollTo(r.left, r.top), /(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (a.scrollY !== r.top || a.scrollX !== r.left) && (this.context.logger.warn("Unable to restore scroll position for cloned document"), this.context.windowBounds = this.context.windowBounds.add(a.scrollX - r.left, a.scrollY - r.top, 0, 0))), c = this.options.onclone, Q = this.clonedReferenceElement, typeof Q > "u" ? [2, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")] : i.fonts && i.fonts.ready ? [4, i.fonts.ready] : [3, 2];
              case 1:
                g.sent(), g.label = 2;
              case 2:
                return /(AppleWebKit)/g.test(navigator.userAgent) ? [4, Qc(i)] : [3, 4];
              case 3:
                g.sent(), g.label = 4;
              case 4:
                return typeof c == "function" ? [2, Promise.resolve().then(function() {
                  return c(i, Q);
                }).then(function() {
                  return B;
                })] : [2, B];
            }
          });
        });
      });
      return i.open(), i.write(lc(document.doctype) + "<html></html>"), uc(this.referenceElement.ownerDocument, n, s), i.replaceChild(i.adoptNode(this.documentElement), i.documentElement), i.close(), o;
    }, e.prototype.createElementClone = function(A) {
      if (qr(
        A,
        2
        /* CLONE */
      ))
        debugger;
      if (sn(A))
        return this.createCanvasClone(A);
      if (zt(A))
        return this.createVideoClone(A);
      if ($t(A))
        return this.createStyleClone(A);
      var r = A.cloneNode(!1);
      return At(r) && (At(A) && A.currentSrc && A.currentSrc !== A.src && (r.src = A.currentSrc, r.srcset = ""), r.loading === "lazy" && (r.loading = "eager")), AB(r) ? this.createCustomElementClone(r) : r;
    }, e.prototype.createCustomElementClone = function(A) {
      var r = document.createElement("html2canvascustomelement");
      return br(A.style, r), r;
    }, e.prototype.createStyleClone = function(A) {
      try {
        var r = A.sheet;
        if (r && r.cssRules) {
          var t = [].slice.call(r.cssRules, 0).reduce(function(n, s) {
            return s && typeof s.cssText == "string" ? n + s.cssText : n;
          }, ""), B = A.cloneNode(!1);
          return B.textContent = t, B;
        }
      } catch (n) {
        if (this.context.logger.error("Unable to access cssRules property", n), n.name !== "SecurityError")
          throw n;
      }
      return A.cloneNode(!1);
    }, e.prototype.createCanvasClone = function(A) {
      var r;
      if (this.options.inlineImages && A.ownerDocument) {
        var t = A.ownerDocument.createElement("img");
        try {
          return t.src = A.toDataURL(), t;
        } catch (o) {
          this.context.logger.info("Unable to inline canvas contents, canvas is tainted", A);
        }
      }
      var B = A.cloneNode(!1);
      try {
        B.width = A.width, B.height = A.height;
        var n = A.getContext("2d"), s = B.getContext("2d");
        if (s)
          if (!this.options.allowTaint && n)
            s.putImageData(n.getImageData(0, 0, A.width, A.height), 0, 0);
          else {
            var a = (r = A.getContext("webgl2")) !== null && r !== void 0 ? r : A.getContext("webgl");
            if (a) {
              var i = a.getContextAttributes();
              (i == null ? void 0 : i.preserveDrawingBuffer) === !1 && this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false", A);
            }
            s.drawImage(A, 0, 0);
          }
        return B;
      } catch (o) {
        this.context.logger.info("Unable to clone canvas as it is tainted", A);
      }
      return B;
    }, e.prototype.createVideoClone = function(A) {
      var r = A.ownerDocument.createElement("canvas");
      r.width = A.offsetWidth, r.height = A.offsetHeight;
      var t = r.getContext("2d");
      try {
        return t && (t.drawImage(A, 0, 0, r.width, r.height), this.options.allowTaint || t.getImageData(0, 0, r.width, r.height)), r;
      } catch (n) {
        this.context.logger.info("Unable to clone video as it is tainted", A);
      }
      var B = A.ownerDocument.createElement("canvas");
      return B.width = A.offsetWidth, B.height = A.offsetHeight, B;
    }, e.prototype.appendChildNode = function(A, r, t) {
      (!JA(r) || !nc(r) && !r.hasAttribute(Qn) && (typeof this.options.ignoreElements != "function" || !this.options.ignoreElements(r))) && (!this.options.copyStyles || !JA(r) || !$t(r)) && A.appendChild(this.cloneNode(r, t));
    }, e.prototype.cloneChildNodes = function(A, r, t) {
      for (var B = this, n = A.shadowRoot ? A.shadowRoot.firstChild : A.firstChild; n; n = n.nextSibling)
        if (JA(n) && on(n) && typeof n.assignedNodes == "function") {
          var s = n.assignedNodes();
          s.length && s.forEach(function(a) {
            return B.appendChildNode(r, a, t);
          });
        } else
          this.appendChildNode(r, n, t);
    }, e.prototype.cloneNode = function(A, r) {
      if (Bn(A))
        return document.createTextNode(A.data);
      if (!A.ownerDocument)
        return A.cloneNode(!1);
      var t = A.ownerDocument.defaultView;
      if (t && JA(A) && ($r(A) || Xe(A))) {
        var B = this.createElementClone(A);
        B.style.transitionProperty = "none";
        var n = t.getComputedStyle(A), s = t.getComputedStyle(A, ":before"), a = t.getComputedStyle(A, ":after");
        this.referenceElement === A && $r(B) && (this.clonedReferenceElement = B), ct(B) && Fc(B);
        var i = this.counters.parse(new Mt(this.context, n)), o = this.resolvePseudoContent(A, B, s, Qe.BEFORE);
        AB(A) && (r = !0), zt(A) || this.cloneChildNodes(A, B, r), o && B.insertBefore(o, B.firstChild);
        var c = this.resolvePseudoContent(A, B, a, Qe.AFTER);
        return c && B.appendChild(c), this.counters.pop(i), (n && (this.options.copyStyles || Xe(A)) && !an(A) || r) && br(n, B), (A.scrollTop !== 0 || A.scrollLeft !== 0) && this.scrolledElements.push([B, A.scrollLeft, A.scrollTop]), (qe(A) || je(A)) && (qe(B) || je(B)) && (B.value = A.value), B;
      }
      return A.cloneNode(!1);
    }, e.prototype.resolvePseudoContent = function(A, r, t, B) {
      var n = this;
      if (t) {
        var s = t.content, a = r.ownerDocument;
        if (!(!a || !s || s === "none" || s === "-moz-alt-content" || t.display === "none")) {
          this.counters.parse(new Mt(this.context, t));
          var i = new Ao(this.context, t), o = a.createElement("html2canvaspseudoelement");
          br(t, o), i.content.forEach(function(Q) {
            if (Q.type === 0)
              o.appendChild(a.createTextNode(Q.value));
            else if (Q.type === 22) {
              var g = a.createElement("img");
              g.src = Q.value, g.style.opacity = "1", o.appendChild(g);
            } else if (Q.type === 18) {
              if (Q.name === "attr") {
                var f = Q.values.filter(b);
                f.length && o.appendChild(a.createTextNode(A.getAttribute(f[0].value) || ""));
              } else if (Q.name === "counter") {
                var w = Q.values.filter(WA), l = w[0], p = w[1];
                if (l && b(l)) {
                  var h = n.counters.getCounterValue(l.value), F = p && b(p) ? Zr.parse(n.context, p.value) : 3;
                  o.appendChild(a.createTextNode(le(h, F, !1)));
                }
              } else if (Q.name === "counters") {
                var y = Q.values.filter(WA), l = y[0], H = y[1], p = y[2];
                if (l && b(l)) {
                  var d = n.counters.getCounterValues(l.value), C = p && b(p) ? Zr.parse(n.context, p.value) : 3, v = H && H.type === 0 ? H.value : "", m = d.map(function(k) {
                    return le(k, C, !1);
                  }).join(v);
                  o.appendChild(a.createTextNode(m));
                }
              }
            } else if (Q.type === 20)
              switch (Q.value) {
                case "open-quote":
                  o.appendChild(a.createTextNode(Ot(i.quotes, n.quoteDepth++, !0)));
                  break;
                case "close-quote":
                  o.appendChild(a.createTextNode(Ot(i.quotes, --n.quoteDepth, !1)));
                  break;
                default:
                  o.appendChild(a.createTextNode(Q.value));
              }
          }), o.className = et + " " + rt;
          var c = B === Qe.BEFORE ? " " + et : " " + rt;
          return Xe(r) ? r.className.baseValue += c : r.className += c, o;
        }
      }
    }, e.destroy = function(A) {
      return A.parentNode ? (A.parentNode.removeChild(A), !0) : !1;
    }, e;
  }()
), Qe;
(function(e) {
  e[e.BEFORE = 0] = "BEFORE", e[e.AFTER = 1] = "AFTER";
})(Qe || (Qe = {}));
var oc = function(e, A) {
  var r = e.createElement("iframe");
  return r.className = "html2canvas-container", r.style.visibility = "hidden", r.style.position = "fixed", r.style.left = "-10000px", r.style.top = "0px", r.style.border = "0", r.width = A.width.toString(), r.height = A.height.toString(), r.scrolling = "no", r.setAttribute(Qn, "true"), e.body.appendChild(r), r;
}, cc = function(e) {
  return new Promise(function(A) {
    if (e.complete) {
      A();
      return;
    }
    if (!e.src) {
      A();
      return;
    }
    e.onload = A, e.onerror = A;
  });
}, Qc = function(e) {
  return Promise.all([].slice.call(e.images, 0).map(cc));
}, gc = function(e) {
  return new Promise(function(A, r) {
    var t = e.contentWindow;
    if (!t)
      return r("No window assigned for iframe");
    var B = t.document;
    t.onload = e.onload = function() {
      t.onload = e.onload = null;
      var n = setInterval(function() {
        B.body.childNodes.length > 0 && B.readyState === "complete" && (clearInterval(n), A(e));
      }, 50);
    };
  });
}, wc = [
  "all",
  "d",
  "content"
  // Safari shows pseudoelements if content is set
], br = function(e, A) {
  for (var r = e.length - 1; r >= 0; r--) {
    var t = e.item(r);
    wc.indexOf(t) === -1 && A.style.setProperty(t, e.getPropertyValue(t));
  }
  return A;
}, lc = function(e) {
  var A = "";
  return e && (A += "<!DOCTYPE ", e.name && (A += e.name), e.internalSubset && (A += e.internalSubset), e.publicId && (A += '"' + e.publicId + '"'), e.systemId && (A += '"' + e.systemId + '"'), A += ">"), A;
}, uc = function(e, A, r) {
  e && e.defaultView && (A !== e.defaultView.pageXOffset || r !== e.defaultView.pageYOffset) && e.defaultView.scrollTo(A, r);
}, Cc = function(e) {
  var A = e[0], r = e[1], t = e[2];
  A.scrollLeft = r, A.scrollTop = t;
}, fc = ":before", Uc = ":after", et = "___html2canvas___pseudoelement_before", rt = "___html2canvas___pseudoelement_after", aB = `{
    content: "" !important;
    display: none !important;
}`, Fc = function(e) {
  hc(e, "." + et + fc + aB + `
         .` + rt + Uc + aB);
}, hc = function(e, A) {
  var r = e.ownerDocument;
  if (r) {
    var t = r.createElement("style");
    t.textContent = A, e.appendChild(t);
  }
}, gn = (
  /** @class */
  function() {
    function e() {
    }
    return e.getOrigin = function(A) {
      var r = e._link;
      return r ? (r.href = A, r.href = r.href, r.protocol + r.hostname + r.port) : "about:blank";
    }, e.isSameOrigin = function(A) {
      return e.getOrigin(A) === e._origin;
    }, e.setContext = function(A) {
      e._link = A.document.createElement("a"), e._origin = e.getOrigin(A.location.href);
    }, e._origin = "about:blank", e;
  }()
), dc = (
  /** @class */
  function() {
    function e(A, r) {
      this.context = A, this._options = r, this._cache = {};
    }
    return e.prototype.addImage = function(A) {
      var r = Promise.resolve();
      return this.has(A) || (xr(A) || Ic(A)) && (this._cache[A] = this.loadImage(A)).catch(function() {
      }), r;
    }, e.prototype.match = function(A) {
      return this._cache[A];
    }, e.prototype.loadImage = function(A) {
      return J(this, void 0, void 0, function() {
        var r, t, B, n, s = this;
        return X(this, function(a) {
          switch (a.label) {
            case 0:
              return r = gn.isSameOrigin(A), t = !Dr(A) && this._options.useCORS === !0 && N.SUPPORT_CORS_IMAGES && !r, B = !Dr(A) && !r && !xr(A) && typeof this._options.proxy == "string" && N.SUPPORT_CORS_XHR && !t, !r && this._options.allowTaint === !1 && !Dr(A) && !xr(A) && !B && !t ? [
                2
                /*return*/
              ] : (n = A, B ? [4, this.proxy(n)] : [3, 2]);
            case 1:
              n = a.sent(), a.label = 2;
            case 2:
              return this.context.logger.debug("Added image " + A.substring(0, 256)), [4, new Promise(function(i, o) {
                var c = new Image();
                c.onload = function() {
                  return i(c);
                }, c.onerror = o, (vc(n) || t) && (c.crossOrigin = "anonymous"), c.src = n, c.complete === !0 && setTimeout(function() {
                  return i(c);
                }, 500), s._options.imageTimeout > 0 && setTimeout(function() {
                  return o("Timed out (" + s._options.imageTimeout + "ms) loading image");
                }, s._options.imageTimeout);
              })];
            case 3:
              return [2, a.sent()];
          }
        });
      });
    }, e.prototype.has = function(A) {
      return typeof this._cache[A] < "u";
    }, e.prototype.keys = function() {
      return Promise.resolve(Object.keys(this._cache));
    }, e.prototype.proxy = function(A) {
      var r = this, t = this._options.proxy;
      if (!t)
        throw new Error("No proxy defined");
      var B = A.substring(0, 256);
      return new Promise(function(n, s) {
        var a = N.SUPPORT_RESPONSE_TYPE ? "blob" : "text", i = new XMLHttpRequest();
        i.onload = function() {
          if (i.status === 200)
            if (a === "text")
              n(i.response);
            else {
              var Q = new FileReader();
              Q.addEventListener("load", function() {
                return n(Q.result);
              }, !1), Q.addEventListener("error", function(g) {
                return s(g);
              }, !1), Q.readAsDataURL(i.response);
            }
          else
            s("Failed to proxy resource " + B + " with status code " + i.status);
        }, i.onerror = s;
        var o = t.indexOf("?") > -1 ? "&" : "?";
        if (i.open("GET", "" + t + o + "url=" + encodeURIComponent(A) + "&responseType=" + a), a !== "text" && i instanceof XMLHttpRequest && (i.responseType = a), r._options.imageTimeout) {
          var c = r._options.imageTimeout;
          i.timeout = c, i.ontimeout = function() {
            return s("Timed out (" + c + "ms) proxying " + B);
          };
        }
        i.send();
      });
    }, e;
  }()
), Ec = /^data:image\/svg\+xml/i, pc = /^data:image\/.*;base64,/i, Hc = /^data:image\/.*/i, Ic = function(e) {
  return N.SUPPORT_SVG_DRAWING || !mc(e);
}, Dr = function(e) {
  return Hc.test(e);
}, vc = function(e) {
  return pc.test(e);
}, xr = function(e) {
  return e.substr(0, 4) === "blob";
}, mc = function(e) {
  return e.substr(-3).toLowerCase() === "svg" || Ec.test(e);
}, u = (
  /** @class */
  function() {
    function e(A, r) {
      this.type = 0, this.x = A, this.y = r;
    }
    return e.prototype.add = function(A, r) {
      return new e(this.x + A, this.y + r);
    }, e;
  }()
), VA = function(e, A, r) {
  return new u(e.x + (A.x - e.x) * r, e.y + (A.y - e.y) * r);
}, Oe = (
  /** @class */
  function() {
    function e(A, r, t, B) {
      this.type = 1, this.start = A, this.startControl = r, this.endControl = t, this.end = B;
    }
    return e.prototype.subdivide = function(A, r) {
      var t = VA(this.start, this.startControl, A), B = VA(this.startControl, this.endControl, A), n = VA(this.endControl, this.end, A), s = VA(t, B, A), a = VA(B, n, A), i = VA(s, a, A);
      return r ? new e(this.start, t, s, i) : new e(i, a, n, this.end);
    }, e.prototype.add = function(A, r) {
      return new e(this.start.add(A, r), this.startControl.add(A, r), this.endControl.add(A, r), this.end.add(A, r));
    }, e.prototype.reverse = function() {
      return new e(this.end, this.endControl, this.startControl, this.start);
    }, e;
  }()
), $ = function(e) {
  return e.type === 1;
}, yc = (
  /** @class */
  function() {
    function e(A) {
      var r = A.styles, t = A.bounds, B = Be(r.borderTopLeftRadius, t.width, t.height), n = B[0], s = B[1], a = Be(r.borderTopRightRadius, t.width, t.height), i = a[0], o = a[1], c = Be(r.borderBottomRightRadius, t.width, t.height), Q = c[0], g = c[1], f = Be(r.borderBottomLeftRadius, t.width, t.height), w = f[0], l = f[1], p = [];
      p.push((n + i) / t.width), p.push((w + Q) / t.width), p.push((s + l) / t.height), p.push((o + g) / t.height);
      var h = Math.max.apply(Math, p);
      h > 1 && (n /= h, s /= h, i /= h, o /= h, Q /= h, g /= h, w /= h, l /= h);
      var F = t.width - i, y = t.height - g, H = t.width - Q, d = t.height - l, C = r.borderTopWidth, v = r.borderRightWidth, m = r.borderBottomWidth, E = r.borderLeftWidth, O = D(r.paddingTop, A.bounds.width), k = D(r.paddingRight, A.bounds.width), q = D(r.paddingBottom, A.bounds.width), L = D(r.paddingLeft, A.bounds.width);
      this.topLeftBorderDoubleOuterBox = n > 0 || s > 0 ? x(t.left + E / 3, t.top + C / 3, n - E / 3, s - C / 3, K.TOP_LEFT) : new u(t.left + E / 3, t.top + C / 3), this.topRightBorderDoubleOuterBox = n > 0 || s > 0 ? x(t.left + F, t.top + C / 3, i - v / 3, o - C / 3, K.TOP_RIGHT) : new u(t.left + t.width - v / 3, t.top + C / 3), this.bottomRightBorderDoubleOuterBox = Q > 0 || g > 0 ? x(t.left + H, t.top + y, Q - v / 3, g - m / 3, K.BOTTOM_RIGHT) : new u(t.left + t.width - v / 3, t.top + t.height - m / 3), this.bottomLeftBorderDoubleOuterBox = w > 0 || l > 0 ? x(t.left + E / 3, t.top + d, w - E / 3, l - m / 3, K.BOTTOM_LEFT) : new u(t.left + E / 3, t.top + t.height - m / 3), this.topLeftBorderDoubleInnerBox = n > 0 || s > 0 ? x(t.left + E * 2 / 3, t.top + C * 2 / 3, n - E * 2 / 3, s - C * 2 / 3, K.TOP_LEFT) : new u(t.left + E * 2 / 3, t.top + C * 2 / 3), this.topRightBorderDoubleInnerBox = n > 0 || s > 0 ? x(t.left + F, t.top + C * 2 / 3, i - v * 2 / 3, o - C * 2 / 3, K.TOP_RIGHT) : new u(t.left + t.width - v * 2 / 3, t.top + C * 2 / 3), this.bottomRightBorderDoubleInnerBox = Q > 0 || g > 0 ? x(t.left + H, t.top + y, Q - v * 2 / 3, g - m * 2 / 3, K.BOTTOM_RIGHT) : new u(t.left + t.width - v * 2 / 3, t.top + t.height - m * 2 / 3), this.bottomLeftBorderDoubleInnerBox = w > 0 || l > 0 ? x(t.left + E * 2 / 3, t.top + d, w - E * 2 / 3, l - m * 2 / 3, K.BOTTOM_LEFT) : new u(t.left + E * 2 / 3, t.top + t.height - m * 2 / 3), this.topLeftBorderStroke = n > 0 || s > 0 ? x(t.left + E / 2, t.top + C / 2, n - E / 2, s - C / 2, K.TOP_LEFT) : new u(t.left + E / 2, t.top + C / 2), this.topRightBorderStroke = n > 0 || s > 0 ? x(t.left + F, t.top + C / 2, i - v / 2, o - C / 2, K.TOP_RIGHT) : new u(t.left + t.width - v / 2, t.top + C / 2), this.bottomRightBorderStroke = Q > 0 || g > 0 ? x(t.left + H, t.top + y, Q - v / 2, g - m / 2, K.BOTTOM_RIGHT) : new u(t.left + t.width - v / 2, t.top + t.height - m / 2), this.bottomLeftBorderStroke = w > 0 || l > 0 ? x(t.left + E / 2, t.top + d, w - E / 2, l - m / 2, K.BOTTOM_LEFT) : new u(t.left + E / 2, t.top + t.height - m / 2), this.topLeftBorderBox = n > 0 || s > 0 ? x(t.left, t.top, n, s, K.TOP_LEFT) : new u(t.left, t.top), this.topRightBorderBox = i > 0 || o > 0 ? x(t.left + F, t.top, i, o, K.TOP_RIGHT) : new u(t.left + t.width, t.top), this.bottomRightBorderBox = Q > 0 || g > 0 ? x(t.left + H, t.top + y, Q, g, K.BOTTOM_RIGHT) : new u(t.left + t.width, t.top + t.height), this.bottomLeftBorderBox = w > 0 || l > 0 ? x(t.left, t.top + d, w, l, K.BOTTOM_LEFT) : new u(t.left, t.top + t.height), this.topLeftPaddingBox = n > 0 || s > 0 ? x(t.left + E, t.top + C, Math.max(0, n - E), Math.max(0, s - C), K.TOP_LEFT) : new u(t.left + E, t.top + C), this.topRightPaddingBox = i > 0 || o > 0 ? x(t.left + Math.min(F, t.width - v), t.top + C, F > t.width + v ? 0 : Math.max(0, i - v), Math.max(0, o - C), K.TOP_RIGHT) : new u(t.left + t.width - v, t.top + C), this.bottomRightPaddingBox = Q > 0 || g > 0 ? x(t.left + Math.min(H, t.width - E), t.top + Math.min(y, t.height - m), Math.max(0, Q - v), Math.max(0, g - m), K.BOTTOM_RIGHT) : new u(t.left + t.width - v, t.top + t.height - m), this.bottomLeftPaddingBox = w > 0 || l > 0 ? x(t.left + E, t.top + Math.min(d, t.height - m), Math.max(0, w - E), Math.max(0, l - m), K.BOTTOM_LEFT) : new u(t.left + E, t.top + t.height - m), this.topLeftContentBox = n > 0 || s > 0 ? x(t.left + E + L, t.top + C + O, Math.max(0, n - (E + L)), Math.max(0, s - (C + O)), K.TOP_LEFT) : new u(t.left + E + L, t.top + C + O), this.topRightContentBox = i > 0 || o > 0 ? x(t.left + Math.min(F, t.width + E + L), t.top + C + O, F > t.width + E + L ? 0 : i - E + L, o - (C + O), K.TOP_RIGHT) : new u(t.left + t.width - (v + k), t.top + C + O), this.bottomRightContentBox = Q > 0 || g > 0 ? x(t.left + Math.min(H, t.width - (E + L)), t.top + Math.min(y, t.height + C + O), Math.max(0, Q - (v + k)), g - (m + q), K.BOTTOM_RIGHT) : new u(t.left + t.width - (v + k), t.top + t.height - (m + q)), this.bottomLeftContentBox = w > 0 || l > 0 ? x(t.left + E + L, t.top + d, Math.max(0, w - (E + L)), l - (m + q), K.BOTTOM_LEFT) : new u(t.left + E + L, t.top + t.height - (m + q));
    }
    return e;
  }()
), K;
(function(e) {
  e[e.TOP_LEFT = 0] = "TOP_LEFT", e[e.TOP_RIGHT = 1] = "TOP_RIGHT", e[e.BOTTOM_RIGHT = 2] = "BOTTOM_RIGHT", e[e.BOTTOM_LEFT = 3] = "BOTTOM_LEFT";
})(K || (K = {}));
var x = function(e, A, r, t, B) {
  var n = 4 * ((Math.sqrt(2) - 1) / 3), s = r * n, a = t * n, i = e + r, o = A + t;
  switch (B) {
    case K.TOP_LEFT:
      return new Oe(new u(e, o), new u(e, o - a), new u(i - s, A), new u(i, A));
    case K.TOP_RIGHT:
      return new Oe(new u(e, A), new u(e + s, A), new u(i, o - a), new u(i, o));
    case K.BOTTOM_RIGHT:
      return new Oe(new u(i, A), new u(i, A + a), new u(e + s, o), new u(e, o));
    case K.BOTTOM_LEFT:
    default:
      return new Oe(new u(i, o), new u(i - s, o), new u(e, A + a), new u(e, A));
  }
}, ze = function(e) {
  return [e.topLeftBorderBox, e.topRightBorderBox, e.bottomRightBorderBox, e.bottomLeftBorderBox];
}, Kc = function(e) {
  return [
    e.topLeftContentBox,
    e.topRightContentBox,
    e.bottomRightContentBox,
    e.bottomLeftContentBox
  ];
}, $e = function(e) {
  return [
    e.topLeftPaddingBox,
    e.topRightPaddingBox,
    e.bottomRightPaddingBox,
    e.bottomLeftPaddingBox
  ];
}, Lc = (
  /** @class */
  function() {
    function e(A, r, t) {
      this.offsetX = A, this.offsetY = r, this.matrix = t, this.type = 0, this.target = 6;
    }
    return e;
  }()
), Me = (
  /** @class */
  function() {
    function e(A, r) {
      this.path = A, this.target = r, this.type = 1;
    }
    return e;
  }()
), bc = (
  /** @class */
  function() {
    function e(A) {
      this.opacity = A, this.type = 2, this.target = 6;
    }
    return e;
  }()
), Dc = function(e) {
  return e.type === 0;
}, wn = function(e) {
  return e.type === 1;
}, xc = function(e) {
  return e.type === 2;
}, iB = function(e, A) {
  return e.length === A.length ? e.some(function(r, t) {
    return r === A[t];
  }) : !1;
}, Tc = function(e, A, r, t, B) {
  return e.map(function(n, s) {
    switch (s) {
      case 0:
        return n.add(A, r);
      case 1:
        return n.add(A + t, r);
      case 2:
        return n.add(A + t, r + B);
      case 3:
        return n.add(A, r + B);
    }
    return n;
  });
}, ln = (
  /** @class */
  function() {
    function e(A) {
      this.element = A, this.inlineLevel = [], this.nonInlineLevel = [], this.negativeZIndex = [], this.zeroOrAutoZIndexOrTransformedOrOpacity = [], this.positiveZIndex = [], this.nonPositionedFloats = [], this.nonPositionedInlineLevel = [];
    }
    return e;
  }()
), un = (
  /** @class */
  function() {
    function e(A, r) {
      if (this.container = A, this.parent = r, this.effects = [], this.curves = new yc(this.container), this.container.styles.opacity < 1 && this.effects.push(new bc(this.container.styles.opacity)), this.container.styles.transform !== null) {
        var t = this.container.bounds.left + this.container.styles.transformOrigin[0].number, B = this.container.bounds.top + this.container.styles.transformOrigin[1].number, n = this.container.styles.transform;
        this.effects.push(new Lc(t, B, n));
      }
      if (this.container.styles.overflowX !== 0) {
        var s = ze(this.curves), a = $e(this.curves);
        iB(s, a) ? this.effects.push(new Me(
          s,
          6
          /* CONTENT */
        )) : (this.effects.push(new Me(
          s,
          2
          /* BACKGROUND_BORDERS */
        )), this.effects.push(new Me(
          a,
          4
          /* CONTENT */
        )));
      }
    }
    return e.prototype.getEffects = function(A) {
      for (var r = [
        2,
        3
        /* FIXED */
      ].indexOf(this.container.styles.position) === -1, t = this.parent, B = this.effects.slice(0); t; ) {
        var n = t.effects.filter(function(i) {
          return !wn(i);
        });
        if (r || t.container.styles.position !== 0 || !t.parent) {
          if (B.unshift.apply(B, n), r = [
            2,
            3
            /* FIXED */
          ].indexOf(t.container.styles.position) === -1, t.container.styles.overflowX !== 0) {
            var s = ze(t.curves), a = $e(t.curves);
            iB(s, a) || B.unshift(new Me(
              a,
              6
              /* CONTENT */
            ));
          }
        } else
          B.unshift.apply(B, n);
        t = t.parent;
      }
      return B.filter(function(i) {
        return G(i.target, A);
      });
    }, e;
  }()
), tt = function(e, A, r, t) {
  e.container.elements.forEach(function(B) {
    var n = G(
      B.flags,
      4
      /* CREATES_REAL_STACKING_CONTEXT */
    ), s = G(
      B.flags,
      2
      /* CREATES_STACKING_CONTEXT */
    ), a = new un(B, e);
    G(
      B.styles.display,
      2048
      /* LIST_ITEM */
    ) && t.push(a);
    var i = G(
      B.flags,
      8
      /* IS_LIST_OWNER */
    ) ? [] : t;
    if (n || s) {
      var o = n || B.styles.isPositioned() ? r : A, c = new ln(a);
      if (B.styles.isPositioned() || B.styles.opacity < 1 || B.styles.isTransformed()) {
        var Q = B.styles.zIndex.order;
        if (Q < 0) {
          var g = 0;
          o.negativeZIndex.some(function(w, l) {
            return Q > w.element.container.styles.zIndex.order ? (g = l, !1) : g > 0;
          }), o.negativeZIndex.splice(g, 0, c);
        } else if (Q > 0) {
          var f = 0;
          o.positiveZIndex.some(function(w, l) {
            return Q >= w.element.container.styles.zIndex.order ? (f = l + 1, !1) : f > 0;
          }), o.positiveZIndex.splice(f, 0, c);
        } else
          o.zeroOrAutoZIndexOrTransformedOrOpacity.push(c);
      } else
        B.styles.isFloating() ? o.nonPositionedFloats.push(c) : o.nonPositionedInlineLevel.push(c);
      tt(a, c, n ? c : r, i);
    } else
      B.styles.isInlineLevel() ? A.inlineLevel.push(a) : A.nonInlineLevel.push(a), tt(a, A, r, i);
    G(
      B.flags,
      8
      /* IS_LIST_OWNER */
    ) && Cn(B, i);
  });
}, Cn = function(e, A) {
  for (var r = e instanceof zr ? e.start : 1, t = e instanceof zr ? e.reversed : !1, B = 0; B < A.length; B++) {
    var n = A[B];
    n.container instanceof zB && typeof n.container.value == "number" && n.container.value !== 0 && (r = n.container.value), n.listValue = le(r, n.container.styles.listStyleType, !0), r += t ? -1 : 1;
  }
}, Sc = function(e) {
  var A = new un(e, null), r = new ln(A), t = [];
  return tt(A, r, r, t), Cn(A.container, t), r;
}, oB = function(e, A) {
  switch (A) {
    case 0:
      return eA(e.topLeftBorderBox, e.topLeftPaddingBox, e.topRightBorderBox, e.topRightPaddingBox);
    case 1:
      return eA(e.topRightBorderBox, e.topRightPaddingBox, e.bottomRightBorderBox, e.bottomRightPaddingBox);
    case 2:
      return eA(e.bottomRightBorderBox, e.bottomRightPaddingBox, e.bottomLeftBorderBox, e.bottomLeftPaddingBox);
    case 3:
    default:
      return eA(e.bottomLeftBorderBox, e.bottomLeftPaddingBox, e.topLeftBorderBox, e.topLeftPaddingBox);
  }
}, Oc = function(e, A) {
  switch (A) {
    case 0:
      return eA(e.topLeftBorderBox, e.topLeftBorderDoubleOuterBox, e.topRightBorderBox, e.topRightBorderDoubleOuterBox);
    case 1:
      return eA(e.topRightBorderBox, e.topRightBorderDoubleOuterBox, e.bottomRightBorderBox, e.bottomRightBorderDoubleOuterBox);
    case 2:
      return eA(e.bottomRightBorderBox, e.bottomRightBorderDoubleOuterBox, e.bottomLeftBorderBox, e.bottomLeftBorderDoubleOuterBox);
    case 3:
    default:
      return eA(e.bottomLeftBorderBox, e.bottomLeftBorderDoubleOuterBox, e.topLeftBorderBox, e.topLeftBorderDoubleOuterBox);
  }
}, Mc = function(e, A) {
  switch (A) {
    case 0:
      return eA(e.topLeftBorderDoubleInnerBox, e.topLeftPaddingBox, e.topRightBorderDoubleInnerBox, e.topRightPaddingBox);
    case 1:
      return eA(e.topRightBorderDoubleInnerBox, e.topRightPaddingBox, e.bottomRightBorderDoubleInnerBox, e.bottomRightPaddingBox);
    case 2:
      return eA(e.bottomRightBorderDoubleInnerBox, e.bottomRightPaddingBox, e.bottomLeftBorderDoubleInnerBox, e.bottomLeftPaddingBox);
    case 3:
    default:
      return eA(e.bottomLeftBorderDoubleInnerBox, e.bottomLeftPaddingBox, e.topLeftBorderDoubleInnerBox, e.topLeftPaddingBox);
  }
}, Gc = function(e, A) {
  switch (A) {
    case 0:
      return Ge(e.topLeftBorderStroke, e.topRightBorderStroke);
    case 1:
      return Ge(e.topRightBorderStroke, e.bottomRightBorderStroke);
    case 2:
      return Ge(e.bottomRightBorderStroke, e.bottomLeftBorderStroke);
    case 3:
    default:
      return Ge(e.bottomLeftBorderStroke, e.topLeftBorderStroke);
  }
}, Ge = function(e, A) {
  var r = [];
  return $(e) ? r.push(e.subdivide(0.5, !1)) : r.push(e), $(A) ? r.push(A.subdivide(0.5, !0)) : r.push(A), r;
}, eA = function(e, A, r, t) {
  var B = [];
  return $(e) ? B.push(e.subdivide(0.5, !1)) : B.push(e), $(r) ? B.push(r.subdivide(0.5, !0)) : B.push(r), $(t) ? B.push(t.subdivide(0.5, !0).reverse()) : B.push(t), $(A) ? B.push(A.subdivide(0.5, !1).reverse()) : B.push(A), B;
}, fn = function(e) {
  var A = e.bounds, r = e.styles;
  return A.add(r.borderLeftWidth, r.borderTopWidth, -(r.borderRightWidth + r.borderLeftWidth), -(r.borderTopWidth + r.borderBottomWidth));
}, Ar = function(e) {
  var A = e.styles, r = e.bounds, t = D(A.paddingLeft, r.width), B = D(A.paddingRight, r.width), n = D(A.paddingTop, r.width), s = D(A.paddingBottom, r.width);
  return r.add(t + A.borderLeftWidth, n + A.borderTopWidth, -(A.borderRightWidth + A.borderLeftWidth + t + B), -(A.borderTopWidth + A.borderBottomWidth + n + s));
}, Rc = function(e, A) {
  return e === 0 ? A.bounds : e === 2 ? Ar(A) : fn(A);
}, Vc = function(e, A) {
  return e === 0 ? A.bounds : e === 2 ? Ar(A) : fn(A);
}, Tr = function(e, A, r) {
  var t = Rc(XA(e.styles.backgroundOrigin, A), e), B = Vc(XA(e.styles.backgroundClip, A), e), n = Nc(XA(e.styles.backgroundSize, A), r, t), s = n[0], a = n[1], i = Be(XA(e.styles.backgroundPosition, A), t.width - s, t.height - a), o = Pc(XA(e.styles.backgroundRepeat, A), i, n, t, B), c = Math.round(t.left + i[0]), Q = Math.round(t.top + i[1]);
  return [o, c, Q, s, a];
}, NA = function(e) {
  return b(e) && e.value === kA.AUTO;
}, Re = function(e) {
  return typeof e == "number";
}, Nc = function(e, A, r) {
  var t = A[0], B = A[1], n = A[2], s = e[0], a = e[1];
  if (!s)
    return [0, 0];
  if (M(s) && a && M(a))
    return [D(s, r.width), D(a, r.height)];
  var i = Re(n);
  if (b(s) && (s.value === kA.CONTAIN || s.value === kA.COVER)) {
    if (Re(n)) {
      var o = r.width / r.height;
      return o < n != (s.value === kA.COVER) ? [r.width, r.width / n] : [r.height * n, r.height];
    }
    return [r.width, r.height];
  }
  var c = Re(t), Q = Re(B), g = c || Q;
  if (NA(s) && (!a || NA(a))) {
    if (c && Q)
      return [t, B];
    if (!i && !g)
      return [r.width, r.height];
    if (g && i) {
      var f = c ? t : B * n, w = Q ? B : t / n;
      return [f, w];
    }
    var l = c ? t : r.width, p = Q ? B : r.height;
    return [l, p];
  }
  if (i) {
    var h = 0, F = 0;
    return M(s) ? h = D(s, r.width) : M(a) && (F = D(a, r.height)), NA(s) ? h = F * n : (!a || NA(a)) && (F = h / n), [h, F];
  }
  var y = null, H = null;
  if (M(s) ? y = D(s, r.width) : a && M(a) && (H = D(a, r.height)), y !== null && (!a || NA(a)) && (H = c && Q ? y / t * B : r.height), H !== null && NA(s) && (y = c && Q ? H / B * t : r.width), y !== null && H !== null)
    return [y, H];
  throw new Error("Unable to calculate background-size for element");
}, XA = function(e, A) {
  var r = e[A];
  return typeof r > "u" ? e[0] : r;
}, Pc = function(e, A, r, t, B) {
  var n = A[0], s = A[1], a = r[0], i = r[1];
  switch (e) {
    case 2:
      return [
        new u(Math.round(t.left), Math.round(t.top + s)),
        new u(Math.round(t.left + t.width), Math.round(t.top + s)),
        new u(Math.round(t.left + t.width), Math.round(i + t.top + s)),
        new u(Math.round(t.left), Math.round(i + t.top + s))
      ];
    case 3:
      return [
        new u(Math.round(t.left + n), Math.round(t.top)),
        new u(Math.round(t.left + n + a), Math.round(t.top)),
        new u(Math.round(t.left + n + a), Math.round(t.height + t.top)),
        new u(Math.round(t.left + n), Math.round(t.height + t.top))
      ];
    case 1:
      return [
        new u(Math.round(t.left + n), Math.round(t.top + s)),
        new u(Math.round(t.left + n + a), Math.round(t.top + s)),
        new u(Math.round(t.left + n + a), Math.round(t.top + s + i)),
        new u(Math.round(t.left + n), Math.round(t.top + s + i))
      ];
    default:
      return [
        new u(Math.round(B.left), Math.round(B.top)),
        new u(Math.round(B.left + B.width), Math.round(B.top)),
        new u(Math.round(B.left + B.width), Math.round(B.height + B.top)),
        new u(Math.round(B.left), Math.round(B.height + B.top))
      ];
  }
}, Xc = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", cB = "Hidden Text", _c = (
  /** @class */
  function() {
    function e(A) {
      this._data = {}, this._document = A;
    }
    return e.prototype.parseMetrics = function(A, r) {
      var t = this._document.createElement("div"), B = this._document.createElement("img"), n = this._document.createElement("span"), s = this._document.body;
      t.style.visibility = "hidden", t.style.fontFamily = A, t.style.fontSize = r, t.style.margin = "0", t.style.padding = "0", t.style.whiteSpace = "nowrap", s.appendChild(t), B.src = Xc, B.width = 1, B.height = 1, B.style.margin = "0", B.style.padding = "0", B.style.verticalAlign = "baseline", n.style.fontFamily = A, n.style.fontSize = r, n.style.margin = "0", n.style.padding = "0", n.appendChild(this._document.createTextNode(cB)), t.appendChild(n), t.appendChild(B);
      var a = B.offsetTop - n.offsetTop + 2;
      t.removeChild(n), t.appendChild(this._document.createTextNode(cB)), t.style.lineHeight = "normal", B.style.verticalAlign = "super";
      var i = B.offsetTop - t.offsetTop + 2;
      return s.removeChild(t), { baseline: a, middle: i };
    }, e.prototype.getMetrics = function(A, r) {
      var t = A + " " + r;
      return typeof this._data[t] > "u" && (this._data[t] = this.parseMetrics(A, r)), this._data[t];
    }, e;
  }()
), Un = (
  /** @class */
  function() {
    function e(A, r) {
      this.context = A, this.options = r;
    }
    return e;
  }()
), Jc = 1e4, kc = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B._activeEffects = [], B.canvas = t.canvas ? t.canvas : document.createElement("canvas"), B.ctx = B.canvas.getContext("2d"), t.canvas || (B.canvas.width = Math.floor(t.width * t.scale), B.canvas.height = Math.floor(t.height * t.scale), B.canvas.style.width = t.width + "px", B.canvas.style.height = t.height + "px"), B.fontMetrics = new _c(document), B.ctx.scale(B.options.scale, B.options.scale), B.ctx.translate(-t.x, -t.y), B.ctx.textBaseline = "bottom", B._activeEffects = [], B.context.logger.debug("Canvas renderer initialized (" + t.width + "x" + t.height + ") with scale " + t.scale), B;
    }
    return A.prototype.applyEffects = function(r) {
      for (var t = this; this._activeEffects.length; )
        this.popEffect();
      r.forEach(function(B) {
        return t.applyEffect(B);
      });
    }, A.prototype.applyEffect = function(r) {
      this.ctx.save(), xc(r) && (this.ctx.globalAlpha = r.opacity), Dc(r) && (this.ctx.translate(r.offsetX, r.offsetY), this.ctx.transform(r.matrix[0], r.matrix[1], r.matrix[2], r.matrix[3], r.matrix[4], r.matrix[5]), this.ctx.translate(-r.offsetX, -r.offsetY)), wn(r) && (this.path(r.path), this.ctx.clip()), this._activeEffects.push(r);
    }, A.prototype.popEffect = function() {
      this._activeEffects.pop(), this.ctx.restore();
    }, A.prototype.renderStack = function(r) {
      return J(this, void 0, void 0, function() {
        var t;
        return X(this, function(B) {
          switch (B.label) {
            case 0:
              return t = r.element.container.styles, t.isVisible() ? [4, this.renderStackContent(r)] : [3, 2];
            case 1:
              B.sent(), B.label = 2;
            case 2:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderNode = function(r) {
      return J(this, void 0, void 0, function() {
        return X(this, function(t) {
          switch (t.label) {
            case 0:
              if (G(
                r.container.flags,
                16
                /* DEBUG_RENDER */
              ))
                debugger;
              return r.container.styles.isVisible() ? [4, this.renderNodeBackgroundAndBorders(r)] : [3, 3];
            case 1:
              return t.sent(), [4, this.renderNodeContent(r)];
            case 2:
              t.sent(), t.label = 3;
            case 3:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderTextWithLetterSpacing = function(r, t, B) {
      var n = this;
      if (t === 0)
        this.ctx.fillText(r.text, r.bounds.left, r.bounds.top + B);
      else {
        var s = it(r.text);
        s.reduce(function(a, i) {
          return n.ctx.fillText(i, a, r.bounds.top + B), a + n.ctx.measureText(i).width;
        }, r.bounds.left);
      }
    }, A.prototype.createFontStyle = function(r) {
      var t = r.fontVariant.filter(function(s) {
        return s === "normal" || s === "small-caps";
      }).join(""), B = jc(r.fontFamily).join(", "), n = Ce(r.fontSize) ? "" + r.fontSize.number + r.fontSize.unit : r.fontSize.number + "px";
      return [
        [r.fontStyle, t, r.fontWeight, n, B].join(" "),
        B,
        n
      ];
    }, A.prototype.renderTextNode = function(r, t) {
      return J(this, void 0, void 0, function() {
        var B, n, s, a, i, o, c, Q, g = this;
        return X(this, function(f) {
          return B = this.createFontStyle(t), n = B[0], s = B[1], a = B[2], this.ctx.font = n, this.ctx.direction = t.direction === 1 ? "rtl" : "ltr", this.ctx.textAlign = "left", this.ctx.textBaseline = "alphabetic", i = this.fontMetrics.getMetrics(s, a), o = i.baseline, c = i.middle, Q = t.paintOrder, r.textBounds.forEach(function(w) {
            Q.forEach(function(l) {
              switch (l) {
                case 0:
                  g.ctx.fillStyle = R(t.color), g.renderTextWithLetterSpacing(w, t.letterSpacing, o);
                  var p = t.textShadow;
                  p.length && w.text.trim().length && (p.slice(0).reverse().forEach(function(h) {
                    g.ctx.shadowColor = R(h.color), g.ctx.shadowOffsetX = h.offsetX.number * g.options.scale, g.ctx.shadowOffsetY = h.offsetY.number * g.options.scale, g.ctx.shadowBlur = h.blur.number, g.renderTextWithLetterSpacing(w, t.letterSpacing, o);
                  }), g.ctx.shadowColor = "", g.ctx.shadowOffsetX = 0, g.ctx.shadowOffsetY = 0, g.ctx.shadowBlur = 0), t.textDecorationLine.length && (g.ctx.fillStyle = R(t.textDecorationColor || t.color), t.textDecorationLine.forEach(function(h) {
                    switch (h) {
                      case 1:
                        g.ctx.fillRect(w.bounds.left, Math.round(w.bounds.top + o), w.bounds.width, 1);
                        break;
                      case 2:
                        g.ctx.fillRect(w.bounds.left, Math.round(w.bounds.top), w.bounds.width, 1);
                        break;
                      case 3:
                        g.ctx.fillRect(w.bounds.left, Math.ceil(w.bounds.top + c), w.bounds.width, 1);
                        break;
                    }
                  }));
                  break;
                case 1:
                  t.webkitTextStrokeWidth && w.text.trim().length && (g.ctx.strokeStyle = R(t.webkitTextStrokeColor), g.ctx.lineWidth = t.webkitTextStrokeWidth, g.ctx.lineJoin = window.chrome ? "miter" : "round", g.ctx.strokeText(w.text, w.bounds.left, w.bounds.top + o)), g.ctx.strokeStyle = "", g.ctx.lineWidth = 0, g.ctx.lineJoin = "miter";
                  break;
              }
            });
          }), [
            2
            /*return*/
          ];
        });
      });
    }, A.prototype.renderReplacedElement = function(r, t, B) {
      if (B && r.intrinsicWidth > 0 && r.intrinsicHeight > 0) {
        var n = Ar(r), s = $e(t);
        this.path(s), this.ctx.save(), this.ctx.clip(), this.ctx.drawImage(B, 0, 0, r.intrinsicWidth, r.intrinsicHeight, n.left, n.top, n.width, n.height), this.ctx.restore();
      }
    }, A.prototype.renderNodeContent = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, n, s, a, i, F, F, o, c, Q, g, H, f, w, d, l, p, h, F, y, H, d;
        return X(this, function(C) {
          switch (C.label) {
            case 0:
              this.applyEffects(r.getEffects(
                4
                /* CONTENT */
              )), t = r.container, B = r.curves, n = t.styles, s = 0, a = t.textNodes, C.label = 1;
            case 1:
              return s < a.length ? (i = a[s], [4, this.renderTextNode(i, n)]) : [3, 4];
            case 2:
              C.sent(), C.label = 3;
            case 3:
              return s++, [3, 1];
            case 4:
              if (!(t instanceof ZB))
                return [3, 8];
              C.label = 5;
            case 5:
              return C.trys.push([5, 7, , 8]), [4, this.context.cache.match(t.src)];
            case 6:
              return F = C.sent(), this.renderReplacedElement(t, B, F), [3, 8];
            case 7:
              return C.sent(), this.context.logger.error("Error loading image " + t.src), [3, 8];
            case 8:
              if (t instanceof qB && this.renderReplacedElement(t, B, t.canvas), !(t instanceof jB))
                return [3, 12];
              C.label = 9;
            case 9:
              return C.trys.push([9, 11, , 12]), [4, this.context.cache.match(t.svg)];
            case 10:
              return F = C.sent(), this.renderReplacedElement(t, B, F), [3, 12];
            case 11:
              return C.sent(), this.context.logger.error("Error loading svg " + t.svg.substring(0, 255)), [3, 12];
            case 12:
              return t instanceof en && t.tree ? (o = new A(this.context, {
                scale: this.options.scale,
                backgroundColor: t.backgroundColor,
                x: 0,
                y: 0,
                width: t.width,
                height: t.height
              }), [4, o.render(t.tree)]) : [3, 14];
            case 13:
              c = C.sent(), t.width && t.height && this.ctx.drawImage(c, 0, 0, t.width, t.height, t.bounds.left, t.bounds.top, t.bounds.width, t.bounds.height), C.label = 14;
            case 14:
              if (t instanceof ot && (Q = Math.min(t.bounds.width, t.bounds.height), t.type === Ye ? t.checked && (this.ctx.save(), this.path([
                new u(t.bounds.left + Q * 0.39363, t.bounds.top + Q * 0.79),
                new u(t.bounds.left + Q * 0.16, t.bounds.top + Q * 0.5549),
                new u(t.bounds.left + Q * 0.27347, t.bounds.top + Q * 0.44071),
                new u(t.bounds.left + Q * 0.39694, t.bounds.top + Q * 0.5649),
                new u(t.bounds.left + Q * 0.72983, t.bounds.top + Q * 0.23),
                new u(t.bounds.left + Q * 0.84, t.bounds.top + Q * 0.34085),
                new u(t.bounds.left + Q * 0.39363, t.bounds.top + Q * 0.79)
              ]), this.ctx.fillStyle = R(jt), this.ctx.fill(), this.ctx.restore()) : t.type === Ze && t.checked && (this.ctx.save(), this.ctx.beginPath(), this.ctx.arc(t.bounds.left + Q / 2, t.bounds.top + Q / 2, Q / 4, 0, Math.PI * 2, !0), this.ctx.fillStyle = R(jt), this.ctx.fill(), this.ctx.restore())), Wc(t) && t.value.length) {
                switch (g = this.createFontStyle(n), H = g[0], f = g[1], w = this.fontMetrics.getMetrics(H, f).baseline, this.ctx.font = H, this.ctx.fillStyle = R(n.color), this.ctx.textBaseline = "alphabetic", this.ctx.textAlign = Zc(t.styles.textAlign), d = Ar(t), l = 0, t.styles.textAlign) {
                  case 1:
                    l += d.width / 2;
                    break;
                  case 2:
                    l += d.width;
                    break;
                }
                p = d.add(l, 0, 0, -d.height / 2 + 1), this.ctx.save(), this.path([
                  new u(d.left, d.top),
                  new u(d.left + d.width, d.top),
                  new u(d.left + d.width, d.top + d.height),
                  new u(d.left, d.top + d.height)
                ]), this.ctx.clip(), this.renderTextWithLetterSpacing(new ce(t.value, p), n.letterSpacing, w), this.ctx.restore(), this.ctx.textBaseline = "alphabetic", this.ctx.textAlign = "left";
              }
              if (!G(
                t.styles.display,
                2048
                /* LIST_ITEM */
              ))
                return [3, 20];
              if (t.styles.listStyleImage === null)
                return [3, 19];
              if (h = t.styles.listStyleImage, h.type !== 0)
                return [3, 18];
              F = void 0, y = h.url, C.label = 15;
            case 15:
              return C.trys.push([15, 17, , 18]), [4, this.context.cache.match(y)];
            case 16:
              return F = C.sent(), this.ctx.drawImage(F, t.bounds.left - (F.width + 10), t.bounds.top), [3, 18];
            case 17:
              return C.sent(), this.context.logger.error("Error loading list-style-image " + y), [3, 18];
            case 18:
              return [3, 20];
            case 19:
              r.listValue && t.styles.listStyleType !== -1 && (H = this.createFontStyle(n)[0], this.ctx.font = H, this.ctx.fillStyle = R(n.color), this.ctx.textBaseline = "middle", this.ctx.textAlign = "right", d = new wA(t.bounds.left, t.bounds.top + D(t.styles.paddingTop, t.bounds.width), t.bounds.width, Tt(n.lineHeight, n.fontSize.number) / 2 + 1), this.renderTextWithLetterSpacing(new ce(r.listValue, d), n.letterSpacing, Tt(n.lineHeight, n.fontSize.number) / 2 + 2), this.ctx.textBaseline = "bottom", this.ctx.textAlign = "left"), C.label = 20;
            case 20:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderStackContent = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, h, n, s, h, a, i, h, o, c, h, Q, g, h, f, w, h, l, p, h;
        return X(this, function(F) {
          switch (F.label) {
            case 0:
              if (G(
                r.element.container.flags,
                16
                /* DEBUG_RENDER */
              ))
                debugger;
              return [4, this.renderNodeBackgroundAndBorders(r.element)];
            case 1:
              F.sent(), t = 0, B = r.negativeZIndex, F.label = 2;
            case 2:
              return t < B.length ? (h = B[t], [4, this.renderStack(h)]) : [3, 5];
            case 3:
              F.sent(), F.label = 4;
            case 4:
              return t++, [3, 2];
            case 5:
              return [4, this.renderNodeContent(r.element)];
            case 6:
              F.sent(), n = 0, s = r.nonInlineLevel, F.label = 7;
            case 7:
              return n < s.length ? (h = s[n], [4, this.renderNode(h)]) : [3, 10];
            case 8:
              F.sent(), F.label = 9;
            case 9:
              return n++, [3, 7];
            case 10:
              a = 0, i = r.nonPositionedFloats, F.label = 11;
            case 11:
              return a < i.length ? (h = i[a], [4, this.renderStack(h)]) : [3, 14];
            case 12:
              F.sent(), F.label = 13;
            case 13:
              return a++, [3, 11];
            case 14:
              o = 0, c = r.nonPositionedInlineLevel, F.label = 15;
            case 15:
              return o < c.length ? (h = c[o], [4, this.renderStack(h)]) : [3, 18];
            case 16:
              F.sent(), F.label = 17;
            case 17:
              return o++, [3, 15];
            case 18:
              Q = 0, g = r.inlineLevel, F.label = 19;
            case 19:
              return Q < g.length ? (h = g[Q], [4, this.renderNode(h)]) : [3, 22];
            case 20:
              F.sent(), F.label = 21;
            case 21:
              return Q++, [3, 19];
            case 22:
              f = 0, w = r.zeroOrAutoZIndexOrTransformedOrOpacity, F.label = 23;
            case 23:
              return f < w.length ? (h = w[f], [4, this.renderStack(h)]) : [3, 26];
            case 24:
              F.sent(), F.label = 25;
            case 25:
              return f++, [3, 23];
            case 26:
              l = 0, p = r.positiveZIndex, F.label = 27;
            case 27:
              return l < p.length ? (h = p[l], [4, this.renderStack(h)]) : [3, 30];
            case 28:
              F.sent(), F.label = 29;
            case 29:
              return l++, [3, 27];
            case 30:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.mask = function(r) {
      this.ctx.beginPath(), this.ctx.moveTo(0, 0), this.ctx.lineTo(this.canvas.width, 0), this.ctx.lineTo(this.canvas.width, this.canvas.height), this.ctx.lineTo(0, this.canvas.height), this.ctx.lineTo(0, 0), this.formatPath(r.slice(0).reverse()), this.ctx.closePath();
    }, A.prototype.path = function(r) {
      this.ctx.beginPath(), this.formatPath(r), this.ctx.closePath();
    }, A.prototype.formatPath = function(r) {
      var t = this;
      r.forEach(function(B, n) {
        var s = $(B) ? B.start : B;
        n === 0 ? t.ctx.moveTo(s.x, s.y) : t.ctx.lineTo(s.x, s.y), $(B) && t.ctx.bezierCurveTo(B.startControl.x, B.startControl.y, B.endControl.x, B.endControl.y, B.end.x, B.end.y);
      });
    }, A.prototype.renderRepeat = function(r, t, B, n) {
      this.path(r), this.ctx.fillStyle = t, this.ctx.translate(B, n), this.ctx.fill(), this.ctx.translate(-B, -n);
    }, A.prototype.resizeImage = function(r, t, B) {
      var n;
      if (r.width === t && r.height === B)
        return r;
      var s = (n = this.canvas.ownerDocument) !== null && n !== void 0 ? n : document, a = s.createElement("canvas");
      a.width = Math.max(1, t), a.height = Math.max(1, B);
      var i = a.getContext("2d");
      return i.drawImage(r, 0, 0, r.width, r.height, 0, 0, t, B), a;
    }, A.prototype.renderBackgroundImage = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, n, s, a, i;
        return X(this, function(o) {
          switch (o.label) {
            case 0:
              t = r.styles.backgroundImage.length - 1, B = function(c) {
                var Q, g, f, O, W, Y, L, V, m, w, O, W, Y, L, V, l, p, h, F, y, H, d, C, v, m, E, O, k, q, L, V, lA, W, Y, IA, BA, uA, vA, mA, iA, yA, oA;
                return X(this, function(TA) {
                  switch (TA.label) {
                    case 0:
                      if (c.type !== 0)
                        return [3, 5];
                      Q = void 0, g = c.url, TA.label = 1;
                    case 1:
                      return TA.trys.push([1, 3, , 4]), [4, n.context.cache.match(g)];
                    case 2:
                      return Q = TA.sent(), [3, 4];
                    case 3:
                      return TA.sent(), n.context.logger.error("Error loading background-image " + g), [3, 4];
                    case 4:
                      return Q && (f = Tr(r, t, [
                        Q.width,
                        Q.height,
                        Q.width / Q.height
                      ]), O = f[0], W = f[1], Y = f[2], L = f[3], V = f[4], m = n.ctx.createPattern(n.resizeImage(Q, L, V), "repeat"), n.renderRepeat(O, m, W, Y)), [3, 6];
                    case 5:
                      ba(c) ? (w = Tr(r, t, [null, null, null]), O = w[0], W = w[1], Y = w[2], L = w[3], V = w[4], l = va(c.angle, L, V), p = l[0], h = l[1], F = l[2], y = l[3], H = l[4], d = document.createElement("canvas"), d.width = L, d.height = V, C = d.getContext("2d"), v = C.createLinearGradient(h, y, F, H), Dt(c.stops, p).forEach(function(ZA) {
                        return v.addColorStop(ZA.stop, R(ZA.color));
                      }), C.fillStyle = v, C.fillRect(0, 0, L, V), L > 0 && V > 0 && (m = n.ctx.createPattern(d, "repeat"), n.renderRepeat(O, m, W, Y))) : Da(c) && (E = Tr(r, t, [
                        null,
                        null,
                        null
                      ]), O = E[0], k = E[1], q = E[2], L = E[3], V = E[4], lA = c.position.length === 0 ? [nt] : c.position, W = D(lA[0], L), Y = D(lA[lA.length - 1], V), IA = ma(c, W, Y, L, V), BA = IA[0], uA = IA[1], BA > 0 && uA > 0 && (vA = n.ctx.createRadialGradient(k + W, q + Y, 0, k + W, q + Y, BA), Dt(c.stops, BA * 2).forEach(function(ZA) {
                        return vA.addColorStop(ZA.stop, R(ZA.color));
                      }), n.path(O), n.ctx.fillStyle = vA, BA !== uA ? (mA = r.bounds.left + 0.5 * r.bounds.width, iA = r.bounds.top + 0.5 * r.bounds.height, yA = uA / BA, oA = 1 / yA, n.ctx.save(), n.ctx.translate(mA, iA), n.ctx.transform(1, 0, 0, yA, 0, 0), n.ctx.translate(-mA, -iA), n.ctx.fillRect(k, oA * (q - iA) + iA, L, V * oA), n.ctx.restore()) : n.ctx.fill())), TA.label = 6;
                    case 6:
                      return t--, [
                        2
                        /*return*/
                      ];
                  }
                });
              }, n = this, s = 0, a = r.styles.backgroundImage.slice(0).reverse(), o.label = 1;
            case 1:
              return s < a.length ? (i = a[s], [5, B(i)]) : [3, 4];
            case 2:
              o.sent(), o.label = 3;
            case 3:
              return s++, [3, 1];
            case 4:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderSolidBorder = function(r, t, B) {
      return J(this, void 0, void 0, function() {
        return X(this, function(n) {
          return this.path(oB(B, t)), this.ctx.fillStyle = R(r), this.ctx.fill(), [
            2
            /*return*/
          ];
        });
      });
    }, A.prototype.renderDoubleBorder = function(r, t, B, n) {
      return J(this, void 0, void 0, function() {
        var s, a;
        return X(this, function(i) {
          switch (i.label) {
            case 0:
              return t < 3 ? [4, this.renderSolidBorder(r, B, n)] : [3, 2];
            case 1:
              return i.sent(), [
                2
                /*return*/
              ];
            case 2:
              return s = Oc(n, B), this.path(s), this.ctx.fillStyle = R(r), this.ctx.fill(), a = Mc(n, B), this.path(a), this.ctx.fill(), [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderNodeBackgroundAndBorders = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, n, s, a, i, o, c, Q = this;
        return X(this, function(g) {
          switch (g.label) {
            case 0:
              return this.applyEffects(r.getEffects(
                2
                /* BACKGROUND_BORDERS */
              )), t = r.container.styles, B = !pA(t.backgroundColor) || t.backgroundImage.length, n = [
                { style: t.borderTopStyle, color: t.borderTopColor, width: t.borderTopWidth },
                { style: t.borderRightStyle, color: t.borderRightColor, width: t.borderRightWidth },
                { style: t.borderBottomStyle, color: t.borderBottomColor, width: t.borderBottomWidth },
                { style: t.borderLeftStyle, color: t.borderLeftColor, width: t.borderLeftWidth }
              ], s = Yc(XA(t.backgroundClip, 0), r.curves), B || t.boxShadow.length ? (this.ctx.save(), this.path(s), this.ctx.clip(), pA(t.backgroundColor) || (this.ctx.fillStyle = R(t.backgroundColor), this.ctx.fill()), [4, this.renderBackgroundImage(r.container)]) : [3, 2];
            case 1:
              g.sent(), this.ctx.restore(), t.boxShadow.slice(0).reverse().forEach(function(f) {
                Q.ctx.save();
                var w = ze(r.curves), l = f.inset ? 0 : Jc, p = Tc(w, -l + (f.inset ? 1 : -1) * f.spread.number, (f.inset ? 1 : -1) * f.spread.number, f.spread.number * (f.inset ? -2 : 2), f.spread.number * (f.inset ? -2 : 2));
                f.inset ? (Q.path(w), Q.ctx.clip(), Q.mask(p)) : (Q.mask(w), Q.ctx.clip(), Q.path(p)), Q.ctx.shadowOffsetX = f.offsetX.number + l, Q.ctx.shadowOffsetY = f.offsetY.number, Q.ctx.shadowColor = R(f.color), Q.ctx.shadowBlur = f.blur.number, Q.ctx.fillStyle = f.inset ? R(f.color) : "rgba(0,0,0,1)", Q.ctx.fill(), Q.ctx.restore();
              }), g.label = 2;
            case 2:
              a = 0, i = 0, o = n, g.label = 3;
            case 3:
              return i < o.length ? (c = o[i], c.style !== 0 && !pA(c.color) && c.width > 0 ? c.style !== 2 ? [3, 5] : [4, this.renderDashedDottedBorder(
                c.color,
                c.width,
                a,
                r.curves,
                2
                /* DASHED */
              )] : [3, 11]) : [3, 13];
            case 4:
              return g.sent(), [3, 11];
            case 5:
              return c.style !== 3 ? [3, 7] : [4, this.renderDashedDottedBorder(
                c.color,
                c.width,
                a,
                r.curves,
                3
                /* DOTTED */
              )];
            case 6:
              return g.sent(), [3, 11];
            case 7:
              return c.style !== 4 ? [3, 9] : [4, this.renderDoubleBorder(c.color, c.width, a, r.curves)];
            case 8:
              return g.sent(), [3, 11];
            case 9:
              return [4, this.renderSolidBorder(c.color, a, r.curves)];
            case 10:
              g.sent(), g.label = 11;
            case 11:
              a++, g.label = 12;
            case 12:
              return i++, [3, 3];
            case 13:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderDashedDottedBorder = function(r, t, B, n, s) {
      return J(this, void 0, void 0, function() {
        var a, i, o, c, Q, g, f, w, l, p, h, F, y, H, d, C, d, C;
        return X(this, function(v) {
          return this.ctx.save(), a = Gc(n, B), i = oB(n, B), s === 2 && (this.path(i), this.ctx.clip()), $(i[0]) ? (o = i[0].start.x, c = i[0].start.y) : (o = i[0].x, c = i[0].y), $(i[1]) ? (Q = i[1].end.x, g = i[1].end.y) : (Q = i[1].x, g = i[1].y), B === 0 || B === 2 ? f = Math.abs(o - Q) : f = Math.abs(c - g), this.ctx.beginPath(), s === 3 ? this.formatPath(a) : this.formatPath(i.slice(0, 2)), w = t < 3 ? t * 3 : t * 2, l = t < 3 ? t * 2 : t, s === 3 && (w = t, l = t), p = !0, f <= w * 2 ? p = !1 : f <= w * 2 + l ? (h = f / (2 * w + l), w *= h, l *= h) : (F = Math.floor((f + l) / (w + l)), y = (f - F * w) / (F - 1), H = (f - (F + 1) * w) / F, l = H <= 0 || Math.abs(l - y) < Math.abs(l - H) ? y : H), p && (s === 3 ? this.ctx.setLineDash([0, w + l]) : this.ctx.setLineDash([w, l])), s === 3 ? (this.ctx.lineCap = "round", this.ctx.lineWidth = t) : this.ctx.lineWidth = t * 2 + 1.1, this.ctx.strokeStyle = R(r), this.ctx.stroke(), this.ctx.setLineDash([]), s === 2 && ($(i[0]) && (d = i[3], C = i[0], this.ctx.beginPath(), this.formatPath([new u(d.end.x, d.end.y), new u(C.start.x, C.start.y)]), this.ctx.stroke()), $(i[1]) && (d = i[1], C = i[2], this.ctx.beginPath(), this.formatPath([new u(d.end.x, d.end.y), new u(C.start.x, C.start.y)]), this.ctx.stroke())), this.ctx.restore(), [
            2
            /*return*/
          ];
        });
      });
    }, A.prototype.render = function(r) {
      return J(this, void 0, void 0, function() {
        var t;
        return X(this, function(B) {
          switch (B.label) {
            case 0:
              return this.options.backgroundColor && (this.ctx.fillStyle = R(this.options.backgroundColor), this.ctx.fillRect(this.options.x, this.options.y, this.options.width, this.options.height)), t = Sc(r), [4, this.renderStack(t)];
            case 1:
              return B.sent(), this.applyEffects([]), [2, this.canvas];
          }
        });
      });
    }, A;
  }(Un)
), Wc = function(e) {
  return e instanceof An || e instanceof $B ? !0 : e instanceof ot && e.type !== Ze && e.type !== Ye;
}, Yc = function(e, A) {
  switch (e) {
    case 0:
      return ze(A);
    case 2:
      return Kc(A);
    case 1:
    default:
      return $e(A);
  }
}, Zc = function(e) {
  switch (e) {
    case 1:
      return "center";
    case 2:
      return "right";
    case 0:
    default:
      return "left";
  }
}, qc = ["-apple-system", "system-ui"], jc = function(e) {
  return /iPhone OS 15_(0|1)/.test(window.navigator.userAgent) ? e.filter(function(A) {
    return qc.indexOf(A) === -1;
  }) : e;
}, zc = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.canvas = t.canvas ? t.canvas : document.createElement("canvas"), B.ctx = B.canvas.getContext("2d"), B.options = t, B.canvas.width = Math.floor(t.width * t.scale), B.canvas.height = Math.floor(t.height * t.scale), B.canvas.style.width = t.width + "px", B.canvas.style.height = t.height + "px", B.ctx.scale(B.options.scale, B.options.scale), B.ctx.translate(-t.x, -t.y), B.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + t.width + "x" + t.height + " at " + t.x + "," + t.y + ") with scale " + t.scale), B;
    }
    return A.prototype.render = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B;
        return X(this, function(n) {
          switch (n.label) {
            case 0:
              return t = jr(this.options.width * this.options.scale, this.options.height * this.options.scale, this.options.scale, this.options.scale, r), [4, $c(t)];
            case 1:
              return B = n.sent(), this.options.backgroundColor && (this.ctx.fillStyle = R(this.options.backgroundColor), this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale)), this.ctx.drawImage(B, -this.options.x * this.options.scale, -this.options.y * this.options.scale), [2, this.canvas];
          }
        });
      });
    }, A;
  }(Un)
), $c = function(e) {
  return new Promise(function(A, r) {
    var t = new Image();
    t.onload = function() {
      A(t);
    }, t.onerror = r, t.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(e));
  });
}, AQ = (
  /** @class */
  function() {
    function e(A) {
      var r = A.id, t = A.enabled;
      this.id = r, this.enabled = t, this.start = Date.now();
    }
    return e.prototype.debug = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && (typeof window < "u" && window.console && typeof console.debug == "function" ? console.debug.apply(console, fe([this.id, this.getTime() + "ms"], A)) : this.info.apply(this, A));
    }, e.prototype.getTime = function() {
      return Date.now() - this.start;
    }, e.prototype.info = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && typeof window < "u" && window.console && typeof console.info == "function" && console.info.apply(console, fe([this.id, this.getTime() + "ms"], A));
    }, e.prototype.warn = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && (typeof window < "u" && window.console && typeof console.warn == "function" ? console.warn.apply(console, fe([this.id, this.getTime() + "ms"], A)) : this.info.apply(this, A));
    }, e.prototype.error = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && (typeof window < "u" && window.console && typeof console.error == "function" ? console.error.apply(console, fe([this.id, this.getTime() + "ms"], A)) : this.info.apply(this, A));
    }, e.instances = {}, e;
  }()
), eQ = (
  /** @class */
  function() {
    function e(A, r) {
      var t;
      this.windowBounds = r, this.instanceName = "#" + e.instanceCount++, this.logger = new AQ({ id: this.instanceName, enabled: A.logging }), this.cache = (t = A.cache) !== null && t !== void 0 ? t : new dc(this, A);
    }
    return e.instanceCount = 1, e;
  }()
), rQ = function(e, A) {
  return A === void 0 && (A = {}), tQ(e, A);
};
typeof window < "u" && gn.setContext(window);
var tQ = function(e, A) {
  return J(void 0, void 0, void 0, function() {
    var r, t, B, n, s, a, i, o, c, Q, g, f, w, l, p, h, F, y, H, d, v, C, v, m, E, O, k, q, L, V, lA, W, Y, IA, BA, uA, vA, mA, iA, yA;
    return X(this, function(oA) {
      switch (oA.label) {
        case 0:
          if (!e || typeof e != "object")
            return [2, Promise.reject("Invalid element provided as first argument")];
          if (r = e.ownerDocument, !r)
            throw new Error("Element is not attached to a Document");
          if (t = r.defaultView, !t)
            throw new Error("Document is not attached to a Window");
          return B = {
            allowTaint: (m = A.allowTaint) !== null && m !== void 0 ? m : !1,
            imageTimeout: (E = A.imageTimeout) !== null && E !== void 0 ? E : 15e3,
            proxy: A.proxy,
            useCORS: (O = A.useCORS) !== null && O !== void 0 ? O : !1
          }, n = Or({ logging: (k = A.logging) !== null && k !== void 0 ? k : !0, cache: A.cache }, B), s = {
            windowWidth: (q = A.windowWidth) !== null && q !== void 0 ? q : t.innerWidth,
            windowHeight: (L = A.windowHeight) !== null && L !== void 0 ? L : t.innerHeight,
            scrollX: (V = A.scrollX) !== null && V !== void 0 ? V : t.pageXOffset,
            scrollY: (lA = A.scrollY) !== null && lA !== void 0 ? lA : t.pageYOffset
          }, a = new wA(s.scrollX, s.scrollY, s.windowWidth, s.windowHeight), i = new eQ(n, a), o = (W = A.foreignObjectRendering) !== null && W !== void 0 ? W : !1, c = {
            allowTaint: (Y = A.allowTaint) !== null && Y !== void 0 ? Y : !1,
            onclone: A.onclone,
            ignoreElements: A.ignoreElements,
            inlineImages: o,
            copyStyles: o
          }, i.logger.debug("Starting document clone with size " + a.width + "x" + a.height + " scrolled to " + -a.left + "," + -a.top), Q = new sB(i, e, c), g = Q.clonedReferenceElement, g ? [4, Q.toIFrame(r, a)] : [2, Promise.reject("Unable to find element in cloned iframe")];
        case 1:
          return f = oA.sent(), w = ct(g) || Bc(g) ? xn(g.ownerDocument) : Br(i, g), l = w.width, p = w.height, h = w.left, F = w.top, y = BQ(i, g, A.backgroundColor), H = {
            canvas: A.canvas,
            backgroundColor: y,
            scale: (BA = (IA = A.scale) !== null && IA !== void 0 ? IA : t.devicePixelRatio) !== null && BA !== void 0 ? BA : 1,
            x: ((uA = A.x) !== null && uA !== void 0 ? uA : 0) + h,
            y: ((vA = A.y) !== null && vA !== void 0 ? vA : 0) + F,
            width: (mA = A.width) !== null && mA !== void 0 ? mA : Math.ceil(l),
            height: (iA = A.height) !== null && iA !== void 0 ? iA : Math.ceil(p)
          }, o ? (i.logger.debug("Document cloned, using foreign object rendering"), v = new zc(i, H), [4, v.render(g)]) : [3, 3];
        case 2:
          return d = oA.sent(), [3, 5];
        case 3:
          return i.logger.debug("Document cloned, element located at " + h + "," + F + " with size " + l + "x" + p + " using computed rendering"), i.logger.debug("Starting DOM parsing"), C = tn(i, g), y === C.styles.backgroundColor && (C.styles.backgroundColor = gA.TRANSPARENT), i.logger.debug("Starting renderer for element at " + H.x + "," + H.y + " with size " + H.width + "x" + H.height), v = new kc(i, H), [4, v.render(C)];
        case 4:
          d = oA.sent(), oA.label = 5;
        case 5:
          return (!((yA = A.removeContainer) !== null && yA !== void 0) || yA) && (sB.destroy(f) || i.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")), i.logger.debug("Finished rendering"), [2, d];
      }
    });
  });
}, BQ = function(e, A, r) {
  var t = A.ownerDocument, B = t.documentElement ? ie(e, getComputedStyle(t.documentElement).backgroundColor) : gA.TRANSPARENT, n = t.body ? ie(e, getComputedStyle(t.body).backgroundColor) : gA.TRANSPARENT, s = typeof r == "string" ? ie(e, r) : r === null ? gA.TRANSPARENT : 4294967295;
  return A === t.documentElement ? pA(B) ? pA(n) ? s : n : B : s;
};
class nQ extends dn {
  async execAction(A, r, t, B, n) {
    try {
      this.exportImg(t);
    } catch (s) {
      ibiz.log.error(s);
    }
    return {
      refresh: !1,
      closeView: !1
    };
  }
  exportImg(A) {
    const r = document.querySelector(
      ".ibiz-view.ibiz-view-deeditview3"
    ), t = document.querySelector(".ivu-tabs-tabpane");
    if (r && t) {
      const B = r.scrollHeight + t.scrollHeight - t.offsetHeight;
      rQ(r, {
        useCORS: !0,
        allowTaint: !0,
        // 这两个属性都是图片跨域相关属性
        height: B,
        windowHeight: B * 2,
        scale: window.devicePixelRatio
      }).then(function(n) {
        const s = n.toDataURL("image/png").replace("image/png", "image/octet-stream"), a = document.createElement("a");
        a.href = s;
        let i = "downLoad.png";
        A && A[0] && (i = `${A[0].srfmajortext}.png`), a.download = i, a.click();
      });
    }
  }
}
class sQ {
  constructor() {
    SA(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new nQ()), this.handler;
  }
}
class aQ extends mn {
  constructor() {
    super(...arguments);
    /**
     * 流程图url
     *
     * @type {string}
     * @memberof PresetWFChartViewController
     */
    SA(this, "imgSrc");
  }
  async getUIData() {
    const r = Object.assign(this.context.clone(), this.params), t = await this.entityService.wf.getWFProcessDiagram(r), B = new Blob([t.data]);
    this.imgSrc = URL.createObjectURL(B);
  }
}
const iQ = rr({
  name: "PresetWFChartView",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const A = er("preset-wf-chart-view"), {
      proxy: r
    } = tr(), t = wB(r, (B, n) => new aQ(e.modelPath, B, n));
    return gB(r, "deName", t.setDeName.bind(t)), {
      c: t,
      ns: A
    };
  },
  render() {
    return _A("div", {
      class: this.ns.b()
    }, [_A("img", {
      attrs: {
        src: this.c.imgSrc
      }
    })]);
  }
});
class oQ {
  constructor() {
    SA(this, "component", iQ);
  }
}
const cQ = new En(import.meta.url), UQ = {
  mateUrl: import.meta.url,
  // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
  install(e) {
    cQ.loadStyle(["/style.css"]), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new Ln()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new Dn()
    ), ibiz.register.uiAction.register(
      "DEUIACTION_ExportAsImagePlugin",
      new sQ()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_PresetWFChartView",
      new oQ()
    );
  }
};
export {
  UQ as default
};
